Author Topic: Tidy main context menu  (Read 18567 times)

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Tidy main context menu
« on: September 01, 2012, 02:27:04 pm »
The main context menu (from right-clicking in the editor) is huge.  I plan to try reorganizing it to be more manageable/efficient.

If people could post which menu entries they use the most, and which (if any) they rarely/never use, it would be helpful to my reorganization.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5916
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Tidy main context menu
« Reply #1 on: September 01, 2012, 02:47:18 pm »
I mostly use:
Context menu:
Edit->Copy
Edit->Paste
Find declaration of xxx
Find implementation of xxx
Find occurrence of xxx

I nearly do not use other items.

"Run to cursor" should not exist when the debugger is not running, right?
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline p2rkw

  • Almost regular
  • **
  • Posts: 142
Re: Tidy main context menu
« Reply #2 on: September 01, 2012, 04:14:01 pm »
I don't use: toggle breakpoint, swap header/source, open containing folder, Edit, Folding, split view, configure editor, remove from project, show file in project tree.
Most of context menu items are related to current file. My suggestion is to move these items ( if they aren't already there ) to tabs context menu.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5916
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Tidy main context menu
« Reply #3 on: September 01, 2012, 04:41:53 pm »
I don't use: toggle breakpoint, swap header/source, open containing folder, Edit, Folding, split view, configure editor, remove from project, show file in project tree.
Most of context menu items are related to current file. My suggestion is to move these items ( if they aren't already there ) to tabs context menu.
Agree.
Some of the menu item like "swap header/source, open containing folder" were also shown in the editor tab context menu, I use them sometimes, but I think they should only be in tab context menu.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Tidy main context menu
« Reply #4 on: September 01, 2012, 05:14:25 pm »
The last and only try I had at discussing this failed miserably and the poll was an internal one.
Everybody uses a subset of this menu and doesn't like items removed from it.

This is what I've written back then:
I've some targets, which I think should be removed:
1. Configure editor (never used this one and never would)
2. Remove file from project
3. Show file in project tree
4. Swap header/source
5. Open containing folder
6. Properties

(2-6 can be found in the context menu for the notebook).
I think this group of items should be removed 100%.

For the next group I have some doubts (50:50% here):
1. Split view (I think this should stay, because many people can't find this feature)
2. Bookmarks
3. Folding

The answer to this post was pretty negative.
So, I think the best option is to provide an UI for hiding certain item. By name or by regexpr.
So the users sees an menu item he/she doesn't like. Goes to the settings and hides it.
All other option will make us suffer and we would have to answer questions like:
"Why have you removed XXX, I use it and like it and I want it back, else I switch IDEs?".

"Run to cursor" should not exist when the debugger is not running, right?
Why not? Have you tried it to see what it does in this situation :)

(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Tidy main context menu
« Reply #5 on: September 01, 2012, 05:52:47 pm »
"Why have you removed XXX, I use it and like it and I want it back, else I switch IDEs?".
I am not planning to remove any functionality, just reorganize to make the most used items easily accessible, and hopefully decrease the size of the menu.

So, I think the best option is to provide an UI for hiding certain item. By name or by regexpr.
This is also something I will be trying to do.

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Tidy main context menu
« Reply #6 on: September 01, 2012, 06:51:53 pm »
A long time ago, mandrav, the founder of the project had started work on a registry for toolbar/menu/popup menu items. This would make it much easier to offer a UI that would give the user more control over what shows up and in what order. Apparently he lost the work, but the idea is a good one. A lot of the clutter that plugins create could then be turned off by default.

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Tidy main context menu
« Reply #7 on: September 01, 2012, 07:22:08 pm »
That sounds like an interesting idea, but I am not certain I understand exactly what you are describing.  Do you have more details?

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Tidy main context menu
« Reply #8 on: September 02, 2012, 04:37:54 am »
Are there any objections to hiding CC's "Find ... of: ..." entries when (1) the current file is not C/C++, and (2) the item is in a string/comment?

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Tidy main context menu
« Reply #9 on: September 02, 2012, 09:53:49 am »
First of all, these items I use regularly:
- Find declaration/implementation/(...) - all of them
- Insert class methods with...
- Swap header/source
- Folding: fold/unfold all
- all of aligner
- Permanently highlight...
- Add ToDo item...
- Show file in project tree
- Spelling suggestions -> should be way more at the top, btw!

The Find... options could be grouped which would shrink the menu a lot. But I honestly think the best way would indeed be a registry. The menu items used here are really user specific, so everything you think is good, won't be for others (remember the simple switch header/source discussion). In the end the core knows all it needs to know for a registry, as plugins have register their menus.

Are there any objections to hiding CC's "Find ... of: ..." entries when (1) the current file is not C/C++, and (2) the item is in a string/comment?
This is such a case: Think about that you don't know exactly, what items are C/C++ - its a user option.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Tidy main context menu
« Reply #10 on: September 02, 2012, 03:11:49 pm »
Menu registry would be a useful, however, I currently am unsure of how to implement it.  Until a design is figured out (by me, or anyone with ideas about it), I will see what I can to with organizing the existing structure.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Tidy main context menu
« Reply #11 on: September 02, 2012, 03:56:00 pm »
Menu registry would be a useful, however, I currently am unsure of how to implement it.
I think most of the bits and pieces are there already. Basically the interface would change, so that plugins are not offered a menu which they can access themselves, but offer a menu they would like to plugin to and the code (SDK) decides where and if to plug.

So the interface functions are there, just the "direction" needs to change and the handler in the SDK that sorts the menus.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5916
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Tidy main context menu
« Reply #12 on: September 04, 2012, 08:57:45 am »
"Run to cursor" should not exist when the debugger is not running, right?
Why not? Have you tried it to see what it does in this situation :)

I just tried, when click on this menu item, it will start the debugging session, but sometimes it does not stop on the current cursor.( in this case,  I have the option "Do not run the debugee" option checked, then the debugger just halt when started) If this option does not checked, but have some breakpoints setting before the cursor, the debugger will stop at the breakpoint.
I realize that it's the normal behavior "Run to cursor" should do. :)

Thanks.

If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Tidy main context menu
« Reply #13 on: September 04, 2012, 09:56:06 am »
I realize that it's the normal behavior "Run to cursor" should do. :)
Yes :)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Tidy main context menu
« Reply #14 on: September 04, 2012, 02:45:33 pm »
Menu registry would be a useful, however, I currently am unsure of how to implement it.
I think most of the bits and pieces are there already. Basically the interface would change, so that plugins are not offered a menu which they can access themselves, but offer a menu they would like to plugin to and the code (SDK) decides where and if to plug.

So the interface functions are there, just the "direction" needs to change and the handler in the SDK that sorts the menus.

Just my 2c:

At start up, the framework and each plugin should "register" the menu commands/popup/toolbar items it offers with a unique ID. That ID could then be used to control whether the item appears, key bindings (cannot current assign keybindings to pop up or toolbar items or menu items whose labels change) and with a lot more work where items appear in menus (I don't think that last one is really necessary, so might be nice).

I am agnostic on the implementation details, but want to keep things simple for plugin authors and don't want to impact runtime performance with lots of checks before opening menus.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Tidy main context menu
« Reply #15 on: September 04, 2012, 03:50:39 pm »
At start up, the framework and each plugin should "register" the menu commands/popup/toolbar items it offers with a unique ID.
Exactly what I meant. Just that the menu's ID is automatically given by the wxMenu item, which is unique in itself. So IMHO there is no need to provide more information than the menu.
« Last Edit: September 04, 2012, 03:52:52 pm by MortenMacFly »
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Tidy main context menu
« Reply #16 on: September 04, 2012, 04:15:52 pm »
At start up, the framework and each plugin should "register" the menu commands/popup/toolbar items it offers with a unique ID.
Exactly what I meant. Just that the menu's ID is automatically given by the wxMenu item, which is unique in itself. So IMHO there is no need to provide more information than the menu.

You need persistent IDs for keybinder (which is why keybinder currently uses the menu label) and to let the user control whether certain items will or will not display. wxIDs like Menu ID's are dynamic, so this is a problem. (Even bigger problem for popup items).

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Tidy main context menu
« Reply #17 on: September 04, 2012, 04:56:12 pm »
You need persistent IDs for keybinder (which is why keybinder currently uses the menu label)
The label, maybe in combination with the parent item, is just fine - including for popup menus IMHO. I do it similar in another project of mine.

How would you do persistent ID's otherwise? (Maybe I misunderstood "persistent" - you don't mean globally unique ID's that don't change through sessions, do you?!)
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Tidy main context menu
« Reply #18 on: September 04, 2012, 08:47:23 pm »
You need persistent IDs for keybinder (which is why keybinder currently uses the menu label)
The label, maybe in combination with the parent item, is just fine - including for popup menus IMHO. I do it similar in another project of mine.

But it doesn't work for menus that dynamically update their label: e.g. "Find declaration of: 'NULL'"

The simplest thing to do would be to assign a unique XRCID (or equivalently "name" member) to every menu/toolbar/popup item. This would nicely tie in nicely to the wxWidgets event system. This would make it easy to find items in, say, a menu by using wxWindow::FindWindowByName, wxWindow::GetName etc.

EDIT: Turns out this isn't so simple -- I forgot MenuItem's aren't derived from wxWindow...

It might also be possible to have the SDK supply unique names using wxWindow::SetName, but would have to be careful not to break XRC based UI.
« Last Edit: September 04, 2012, 08:59:23 pm by dmoore »

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Tidy main context menu
« Reply #19 on: September 04, 2012, 09:05:11 pm »
How would you do persistent ID's otherwise? (Maybe I misunderstood "persistent" - you don't mean globally unique ID's that don't change through sessions, do you?!)

So what would be so bad about this? To do this stuff we want to do, we need some mapping between a unique ID (that lets us store persistent information about the menu/popup/toolbar items such as keybindings and hidden state) and their run-time id's. We defacto do this right now using the label, but why not just take it a step further and use a unique ID?

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Tidy main context menu
« Reply #20 on: September 04, 2012, 10:37:33 pm »
So what would be so bad about this?
I am not saying its bad, I just want to understand your idea.

So - there are many ways, some are:
  • use menu addresses as ID's, not provided by the plugins
  • use menu labels (including parent labels) for ID's, not provided by the plugins
  • use an ID provided by a plugin (might interfere with another)
  • use some kind of global UUID
...for all these cases I am not sure how easy it would be to store e.g. the settings for these ID's so you can manipulate menus across C::B session. The overall goal would be to allow the user to modify the menu items (s)he want to see, any maybe even the order. You brought in dynamic menu labels (like for spell checking) which is something I did not even consider.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Tidy main context menu
« Reply #21 on: September 04, 2012, 11:18:08 pm »
We have lots of them, example: watches, data breakpoints, various find .... of...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Tidy main context menu
« Reply #22 on: September 04, 2012, 11:30:34 pm »
  • use an ID provided by a plugin (might interfere with another)
could use the plugin ID as a prefix: e.g. "codesnippets/AddSnippet"

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Tidy main context menu
« Reply #23 on: September 05, 2012, 01:31:39 am »
Just to let people know, I agree that this registering system is better than the current system, however, I do not yet have any very good ideas of how to create it (nor really quite enough willpower :)).  I am still working on reorganizing the menu using the current system, and will hopefully come up with something a bit more efficient (for use until such a time as someone implements menu registration).

(If anyone here has decided to work on menu registration now, please tell me so I do not waste time with writing code that will immediately become obsolete.)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Tidy main context menu
« Reply #24 on: September 05, 2012, 02:14:25 am »
(If anyone here has decided to work on menu registration now, please tell me so I do not waste time with writing code that will immediately become obsolete.)
Don't waste time if you don't write a menu registration system. If dmoore hasn't implemented such system until I get some free time, I'll do it, as I have some ideas :)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Tidy main context menu
« Reply #25 on: September 05, 2012, 03:00:38 am »
(If anyone here has decided to work on menu registration now, please tell me so I do not waste time with writing code that will immediately become obsolete.)
Don't waste time if you don't write a menu registration system. If dmoore hasn't implemented such system until I get some free time, I'll do it, as I have some ideas :)

I don't have any immediate plans, but maybe in a few weeks (say 3) if noone else has started I will take a look. I'll be happy to test others code. It will take a bit of planning and is a reasonably big job because of all the plugins that will need to be refactored.