Pressing the numpad-5 key in non-numlock mode rolls the current line to center of visible window.
Says uploads are disabled right now. Go to SourceForge CodeLite patch page for download.
http://sourceforge.net/support/tracker.php?aid=3064703
- Rick
PATCH: numpad-5 centers current line
-
- CodeLite Expert
- Posts: 120
- Joined: Sun May 10, 2009 6:56 am
- Contact:
- eranif
- CodeLite Plugin
- Posts: 6375
- Joined: Wed Feb 06, 2008 9:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: PATCH: numpad-5 centers current line
The patch is too much hard coded.
Each key combination should be editable from the 'settings -> keyboard shortcuts..'
To achieve what you want you should have:
- Add new menu entry to one of the menus (e.g. Edit -> Center Editor Line) - this is done by editing the menu.xrc file:
add the following menu entry to the Edit menu in the menu.xrc file:
- Next, add new entry to the global accelerator file (accelerators.conf.default), like this:
Where:
center_line - is the identifier for the event, must be identical as the name attribute added to the menu.xrc file
Edit - is the parent menu holding the new menu entry
Center Line - is the menu entry name
CLEAR - it is the accelerator name for NumPad5 (when NumPad is Off)
By adding this line, codelite will automatically add an entry to the 'Keyboard Shortcuts...' dialog + it will add new menu entry to the 'Edit' menu.
Now all is left is to add event handler for the new menu entry, you should add this line to frame.cpp:
Add the actual code to the class EditHandler::ProcessCommandEvent, from file menu_event_handlers.cpp.
Eran
Each key combination should be editable from the 'settings -> keyboard shortcuts..'
To achieve what you want you should have:
- Add new menu entry to one of the menus (e.g. Edit -> Center Editor Line) - this is done by editing the menu.xrc file:
add the following menu entry to the Edit menu in the menu.xrc file:
Code: Select all
<object class="wxMenuItem" name="center_line">
<label>Center Editor L&ine</label>
</object>
Code: Select all
center_line|Edit|Center Editor Line|CLEAR
center_line - is the identifier for the event, must be identical as the name attribute added to the menu.xrc file
Edit - is the parent menu holding the new menu entry
Center Line - is the menu entry name
CLEAR - it is the accelerator name for NumPad5 (when NumPad is Off)
By adding this line, codelite will automatically add an entry to the 'Keyboard Shortcuts...' dialog + it will add new menu entry to the 'Edit' menu.
Now all is left is to add event handler for the new menu entry, you should add this line to frame.cpp:
Code: Select all
EVT_MENU(XRCID("center_line"), clMainFrame::DispatchCommandEvent)
EVT_UPDATE_UI(XRCID("center_line"), clMainFrame::OnFileExistUpdateUI)
Eran
Make sure you have read the HOW TO POST thread
-
- CodeLite Expert
- Posts: 120
- Joined: Sun May 10, 2009 6:56 am
- Contact:
Re: PATCH: numpad-5 centers current line
An excellent explanation. Thanks. On Ubuntu 10.04, the numpad-5 key is KP_BEGIN when numlock off.eranif wrote:The patch is too much hard coded....
I did all you say. I can't get the code in this patch to even execute my code in the function. Not even when I select it from the menu. If you get a chance to look it over, what did I do wrong?
You do not have the required permissions to view the files attached to this post.
-
- CodeLite Expert
- Posts: 120
- Joined: Sun May 10, 2009 6:56 am
- Contact:
Re: PATCH: numpad-5 centers current line
Do you have a chance to look over it? The patch itself is pretty small.foxmuldr wrote:I did all you say. I can't get the code in this patch to even execute my code in the function. Not even when I select it from the menu. If you get a chance to look it over, what did I do wrong?
- eranif
- CodeLite Plugin
- Posts: 6375
- Joined: Wed Feb 06, 2008 9:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: PATCH: numpad-5 centers current line
One line of code was missing:
in file menumanager.cpp:
You needed to register the new command with the event handler.
Patch, applied
Eran
in file menumanager.cpp:
Code: Select all
PushHandler(new EditHandler(XRCID("center_line")));
Patch, applied
Eran
Make sure you have read the HOW TO POST thread