Patch #2433 2008-04-05 15:55
arkay
"Insert class method..." dialog enhancements- Download
- 2433-Insert_class_m.patch (11.6 KB)
- Category
- Plugin::Refinement
- Status
- Open
- Close date
- Assigned to
Index: src/plugins/codecompletion/insertclassmethoddlg.cpp
===================================================================
--- src/plugins/codecompletion/insertclassmethoddlg.cpp (revision 4993)
+++ src/plugins/codecompletion/insertclassmethoddlg.cpp (working copy)
@@ -78,6 +78,7 @@
wxListBox* lb = XRCCTRL(*this, "lstClasses", wxListBox);
lb->Freeze();
lb->Clear();
+
TokensTree* tree = m_pParser->GetTokens();
for (size_t i = 0; i < tree->size(); ++i)
{
@@ -85,8 +86,29 @@
//Manager::Get()->GetLogManager()->DebugLog("m_Filename=%s, token=%s", m_Filename.c_str(), token->m_Filename.c_str());
if (token && (token->m_TokenKind & (tkClass | tkTypedef))) //&&
//token->m_Filename == UnixFilename(m_Filename))
+ {
// TODO: check against file's pair too
- lb->Append(token->m_Name, token);
+ // Make sure we actually have something to implement
+ TokensTree* treeChildren = token->GetTree();
+ if (treeChildren)
+ {
+ bool valid = false;
+ for (TokenIdxSet::iterator it = token->m_Children.begin(); it != token->m_Children.end(); ++it)
+ {
+ int idx = *it;
+ const Token* tokenChild = treeChildren->at(idx);
+ if (!tokenChild)
+ continue;
+ if (tokenChild->m_TokenKind & (tkFunction | tkConstructor | tkDestructor))
+ {
+ valid = true;
+ break;
+ }
+ }
+ if (valid)
+ lb->Append(token->m_Name, token);
+ }
+ }
}
lb->Thaw();
FillMethods();
Index: src/plugins/codecompletion/resources/insert_class_method.xrc
===================================================================
--- src/plugins/codecompletion/resources/insert_class_method.xrc (revision 4993)
+++ src/plugins/codecompletion/resources/insert_class_method.xrc (working copy)
@@ -1,140 +1,135 @@
<?xml version="1.0" ?>
<resource>
- <object class="wxDialog" name="dlgInsertClassMethod">
- <title>Insert class method...</title>
- <centered>1</centered>
- <object class="wxBoxSizer">
- <orient>wxVERTICAL</orient>
- <object class="sizeritem">
- <object class="wxFlexGridSizer">
- <cols>2</cols>
- <rows>2</rows>
- <vgap>4</vgap>
- <hgap>8</hgap>
- <growablecols>1</growablecols>
- <growablerows>1</growablerows>
- <object class="sizeritem">
- <object class="wxStaticText">
- <label>Known classes:</label>
- </object>
- </object>
- <object class="sizeritem">
- <object class="wxStaticText">
- <label>Class methods:</label>
- </object>
- </object>
- <object class="sizeritem">
- <object class="wxListBox" name="lstClasses">
- <content/>
- </object>
- <flag>wxEXPAND</flag>
- <minsize>196,-1</minsize>
- </object>
- <object class="sizeritem">
- <object class="wxBoxSizer">
- <orient>wxVERTICAL</orient>
- <object class="sizeritem">
- <object class="wxCheckListBox" name="chklstMethods">
- <content/>
- </object>
- <option>1</option>
- <flag>wxEXPAND</flag>
- </object>
- <object class="sizeritem">
- <object class="wxBoxSizer">
- <orient>wxHORIZONTAL</orient>
- <object class="sizeritem">
- <object class="wxRadioBox" name="rbCode">
- <label>Code output</label>
- <content>
- <item>Declaration</item>
- <item>Implementation</item>
- </content>
- <dimension>1</dimension>
- <style>wxRA_SPECIFY_COLS</style>
- </object>
- <flag>wxRIGHT</flag>
- <border>8</border>
- </object>
- <object class="sizeritem">
- <object class="wxStaticBoxSizer">
- <label>Filter methods</label>
- <orient>wxHORIZONTAL</orient>
- <object class="sizeritem">
- <object class="wxCheckBox" name="chkPrivate">
- <label>Private</label>
- <checked>0</checked>
- </object>
- <flag>wxALIGN_CENTRE_VERTICAL|wxLEFT</flag>
- <border>8</border>
- </object>
- <object class="sizeritem">
- <object class="wxCheckBox
download for full patch...
History
arkay 2008-04-05 15:57
I patched it a little (against the svn tree)...
- xrc: wxListBox -> wxLB_HSCROLL|wxLB_NEEDED_SB|wxLB_SORT
- cpp: only show classes / structs which actually have something to implement (at least 1 ctor/dtor/method)