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:
Code: Select all
<object class="wxMenuItem" name="center_line">
<label>Center Editor L&ine</label>
</object>
- Next, add new entry to the global accelerator file (accelerators.conf.default), like this:
Code: Select all
center_line|Edit|Center Editor Line|CLEAR
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:
Code: Select all
EVT_MENU(XRCID("center_line"), clMainFrame::DispatchCommandEvent)
EVT_UPDATE_UI(XRCID("center_line"), clMainFrame::OnFileExistUpdateUI)
Add the actual code to the class EditHandler::ProcessCommandEvent, from file menu_event_handlers.cpp.
Eran