Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
re: where to upload / publish my c:b patches
mikejonesey:
where should I upload / publish my patches to codeblocks?
stahta01:
If there are bug fixes I suggest the standard place
http://developer.berlios.de/patch/?group_id=5358
Note: if they are short you could post them in this thread.
If long attach them and post description in this or another thread.
But, if no one applies them in 2 weeks; I would post them on Berlios C::B site.
Tim S.
mikejonesey:
ok well they're not bug fixes; just little "annoying things", for some reason you can't navigate the project manager via keyboard;
1st patch:
--- Code: ------ src/sdk/projectmanager_old.cpp 2011-02-27 13:36:32.000766001 +0000
+++ src/sdk/projectmanager.cpp 2011-02-27 15:55:00.000000000 +0000
@@ -141,12 +141,86 @@
wxPostEvent(GetParent(), e);
}
else
+ {
event.Skip();
+ }
+ }
+ void OnKeyDown(wxKeyEvent& event)
+ {
+ wxString key;
+ long keycode = event.GetKeyCode();
+ switch ( keycode )
+ {
+ case WXK_UP: key = _T("UP"); break;
+ case WXK_DOWN: key = _T("DOWN"); break;
+ case WXK_LEFT: key = _T("LEFT"); break;
+ case WXK_RIGHT: key = _T("RIGHT"); break;
+ case WXK_RETURN: key = _T("ENTER"); break;
+ }
+ wxTreeItemId itemId = this->GetSelection();
+ if((key) && (key==_("UP")) && (itemId.IsOk()))
+ {
+ //GetPrevVisible - not implemented... strange...
+ wxTreeItemId itemIdb = this->GetPrevSibling(itemId);
+ if(itemIdb.IsOk())
+ {
+ this->SelectItem(itemIdb, true);
+ }
+ else
+ {
+ wxTreeItemId itemIdb = this->GetItemParent(itemId);
+ if(itemIdb.IsOk())
+ this->SelectItem(itemIdb, true);
+ }
+ }
+ else if((key) && (key==_("DOWN")) && (itemId.IsOk()))
+ {
+ wxTreeItemId tmpId = this->GetNextVisible(itemId);
+ if(tmpId.IsOk())
+ this->SelectItem(tmpId, true);
+ }
+ else if((key) && (key==_("LEFT")) && (itemId.IsOk()))
+ {
+ if((this->ItemHasChildren(itemId))&&(this->IsExpanded(itemId)))
+ {
+ this->Collapse(itemId);
+ }
+ else
+ {
+ wxTreeItemId itemIdb = this->GetItemParent(itemId);
+ if(itemIdb.IsOk())
+ this->SelectItem(itemIdb, true);
+ }
+ }
+ else if((key) && (key==_("RIGHT")) && (itemId.IsOk()))
+ {
+ if((this->ItemHasChildren(itemId)) && (!this->IsExpanded(itemId)))
+ {
+ this->Expand(itemId);
+ }
+ else
+ {
+ wxTreeItemIdValue cookieMonsta;
+ wxTreeItemId itemIdb = this->GetFirstChild(itemId, cookieMonsta);
+ if(itemIdb.IsOk())
+ this->SelectItem(itemIdb, true);
+ }
+ }
+ else if((key) && (key==_("ENTER")) && (itemId.IsOk()))
+ {
+ wxTreeEvent myevent = wxTreeEvent(wxEVT_COMMAND_TREE_ITEM_ACTIVATED, this, itemId);
+ wxPostEvent(this, myevent);
+ }
+ else
+ {
+ event.Skip();
+ }
}
DECLARE_EVENT_TABLE();
};
BEGIN_EVENT_TABLE(PrjTree, wxTreeCtrl)
EVT_RIGHT_DOWN(PrjTree::OnRightClick)
+ EVT_KEY_DOWN(PrjTree::OnKeyDown)
END_EVENT_TABLE()
#endif // !__WXMSW__
--- End code ---
also when you close all editors it's nice for the project tree to gain focus so you can key to the next file to edit;
2nd patch;
--- Code: ------ src/sdk/cbeditor_old.cpp 2011-02-27 15:57:43.000000000 +0000
+++ src/sdk/cbeditor.cpp 2011-02-27 15:52:45.000000000 +0000
@@ -758,6 +758,11 @@
DestroySplitView();
delete m_pData;
+ size_t editorCount = Manager::Get()->GetEditorManager()->GetNotebook()->GetPageCount();
+ if(editorCount<1)
+ {
+ Manager::Get()->GetProjectManager()->GetTree()->SetFocus();
+ }
}
void cbEditor::DoInitializations(const wxString& filename, LoaderBase* fileLdr)
--- End code ---
If I have pasted in the wrong place please let me know;
these are simple patched but make an essential difference for me;
cheers...
MortenMacFly:
--- Quote from: mikejonesey on February 27, 2011, 05:15:08 pm ---1st patch:
--- End quote ---
While I like the idea with the "Enter" key (in fact that's a limitation I experienced myself) I don't understand the cursor movement... This works very well! Under what circumstances does it not work?
Finally: Why don't you replace all occurrences of "(key) && (key==_("UP"))" with "(keycode == WXK_UP)"? That would be a way better style instead comparing strings... :shock:
--- Quote from: mikejonesey on February 27, 2011, 05:15:08 pm ---2nd patch:
--- End quote ---
Good one... I'll think about it...
Jenna:
--- Quote from: MortenMacFly on February 27, 2011, 05:21:38 pm ---[...] I don't understand the cursor movement... This works very well! Under what circumstances does it not work?
--- End quote ---
Does not work in linux (most likely a limitation of the wxWidgets implememtation).
Navigation
[0] Message Index
[#] Next page
Go to full version