Getting menu items from class Desktop
Hi, Newbie question follows:
I'm trying to fix bug #1664790 ("Display mode toggle doesn't update radio button"). Today's the first time I have delved into the Inkscape sources. I've got the hang of how the menu UI portion is generated automatically and how verbs work (more or less). I've also been able to trace my way to the Desktop class's setDisplayModeNormal( ) and setDisplayModeOutline( ) functions which is where I should implement logic to toggle the radio button change for it to happen. Question is, how to get the GTK widget handle for the main menu bar? I couldn't find any helper functions in Desktop nor any in events.cpp
TIA, Irfan.
Hi Irfan,
I'm trying to fix bug #1664790 ("Display mode toggle doesn't update radio button"). Today's the first time I have delved into the Inkscape sources. I've got the hang of how the menu UI portion is generated automatically and how verbs work (more or less). I've also been able to trace my way to the Desktop class's setDisplayModeNormal( ) and setDisplayModeOutline( ) functions which is where I should implement logic to toggle the radio button change for it to happen. Question is, how to get the GTK widget handle for the main menu bar? I couldn't find any helper functions in Desktop nor any in events.cpp
I think SPDesktop is the wrong place to update menu items. It should work the other way round. The menu, when opened, gets the expose event. In response it must ask the desktop which mode it is in (or just read "options.outlinemode" from prefs, becase desktop always sets it when changing mode) and set the state of its menu items accordingly.
A similar thing is already done for checkbox menu items in View > Show/Hide; note that if you for example show or hide scrollbars by Ctrl+B and then go to the menu, the "Scrollbars" item will be in the correct state. You just need to do the same for the display mode menu items too.
participants (2)
-
bulia byak
-
Irfan Hamid