A simple patch to insert a menu item for 'Create diagram' so that a shortcut can be assigned. The menu item must be disabled when no text is selected or else cb will crash. Unfortunately, I don't know how to accomplish that.
Some comments:
1. Please place the return statements on new lines and not on the same line as the ifs.
2. Don't add spaces around conditions. if (bla) ...; instead of if ( bla ) ...;
3. Don't exit early in the OnTextSelected method, but instead always set a value. Replace all early returns with Enabled(false); or even better rework the function to use a bool variable and only set it to true if the right condition is met.
4. OnTextSelected is not the most appropriate name for the method. Use something like OnUpdateUIMenuItem.
5. There is an indent error on this line: wxMenu* viewmenu = menuBar->GetMenu(pos);
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
That is not my coding style but the original authors. I tried to respect that and left it as it is, otherwise the whole file should go into a revision imo.
Same as 1.
That fixed the 'enabled menu item' problem I posted on cb forum. Thanks.
'OnTextSelected' changed to 'OnUpdateUIMenuItem'.
If you're talking about the tab character, it's fixed.
Attached a new patch which also disables the menu item when no text is selected.
Some comments:
1. Please place the return statements on new lines and not on the same line as the ifs.
2. Don't add spaces around conditions. if (bla) ...; instead of if ( bla ) ...;
3. Don't exit early in the OnTextSelected method, but instead always set a value. Replace all early returns with Enabled(false); or even better rework the function to use a bool variable and only set it to true if the right condition is met.
4. OnTextSelected is not the most appropriate name for the method. Use something like OnUpdateUIMenuItem.
5. There is an indent error on this line: wxMenu* viewmenu = menuBar->GetMenu(pos);
Patch attached.
Please fix 1 and 2 and I'm going to commit this patch.
If you don't fix them I'll have, too do it anyway.
I don't think it's right but if you'd like it that way I attached the new patch.
Applied in head (with slight modifications).