User forums > Using Code::Blocks
Keyboard Shortcuts for non menu items
killerbot:
I have done some testing, and have a similar conclusion.
Now when the focus is not on a variable or the function declaration/implementation signature, the right click menu doesn't allow you to Find/Jump to declaration/definition.
But the new menu entries and keyboard shortcuts do allow you to trigger the methods, which then say they didn't find anything.
So we need the check to see if the menu should be enabled, and as such also (un)block the keyboard shortcuts.
killerbot:
I have refactored and implemented the requirement that the menu entries are only enabled when it makes sense (same requirements as with the right click context pop up menu).
However the shortcuts are not disabled and still can be called whenever you like (eg after start up while the cursor is on whitespace).
Is there a way so the shortcuts follow the enable/disable status of what they are the shortcut for ??
Or am I enforced even on invocation to do the necessary check on the requirements and then in the end silently ignore the non fulfillment, otherwise we get that nasty message box again.
killerbot:
Implemented (question about shortcuts getting disabled with their menu entry still stands though, but could solve the issue without this knowledge).
There might be much more ideas that could be of interest for improvements to the current way (now and before my changes) :
1) go to declaration of the method enclosing the position of the cursor
1bis) go to the start of the method enclosing the position of the cursor
2) after you jumped to declaration or definition : the cursor is at the beginning of the line : you can NOT jump back to the point you came from (in the sense of find declaration/implementation) because your cursor has to be on the method name. Counter example what if the first word on the line is the return value of a user defined type (enum, struct, class) where does the user expects to jump to then [one could argue if the return value is not such a type then jump to the method name]
3) goto declaration of local variables does NOT work (it never did), make it work ;-)
4) goto definition of the class containing the method enclosing the position of the cursor
PS : currently I still have 1 difference :
void CodeCompletion::BuildMenu(wxMenuBar* menuBar)
put the cursor somewhere on 'CodeCompletion', through the right click I can jump to declaration or definition, but not with the menu or short cuts.
EDIT : last issue also solved, this happened in the case that there was more then 1 match, I have no idea why the partial check I commented out now was needed. The method was always called in this context (right click : idGotoImplementation or idGotoDeclaration) and now also from the menu context. So the original patch where I started from was suffering from this bug too.
--- Code: --- if ((/*event.GetId() == idGotoImplementation &&*/ !sel->GetImplFilename().IsEmpty()) ||
(/*event.GetId() == idGotoDeclaration &&*/ !sel->GetFilename().IsEmpty()))
--- End code ---
dmoore:
strange that a patch like this is now acceptable:
http://developer.berlios.de/patch/?func=detailpatch&patch_id=2074&group_id=5358
killerbot:
--- Quote from: dmoore on June 17, 2008, 07:04:12 am ---strange that a patch like this is now acceptable:
http://developer.berlios.de/patch/?func=detailpatch&patch_id=2074&group_id=5358
--- End quote ---
I will also implement the open include file part of it.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version