diff options
author | David Robillard <d@drobilla.net> | 2014-08-09 04:55:56 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2014-08-09 04:55:56 +0000 |
commit | bbd2f572a06786eafc49f1ba046c3eddbb005917 (patch) | |
tree | 20b5237e71b75e0b776db1720d1a272f0d9569a0 | |
parent | 42347b5c859a77eb99af1c718b48170b0672dc5e (diff) | |
download | ingen-bbd2f572a06786eafc49f1ba046c3eddbb005917.tar.gz ingen-bbd2f572a06786eafc49f1ba046c3eddbb005917.tar.bz2 ingen-bbd2f572a06786eafc49f1ba046c3eddbb005917.zip |
Improve object context menu.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5446 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r-- | src/gui/NodeMenu.cpp | 20 | ||||
-rw-r--r-- | src/gui/ObjectMenu.cpp | 1 | ||||
-rw-r--r-- | src/gui/ObjectMenu.hpp | 1 | ||||
-rw-r--r-- | src/gui/PortMenu.cpp | 4 | ||||
-rw-r--r-- | src/gui/ingen_gui.ui | 106 |
5 files changed, 80 insertions, 52 deletions
diff --git a/src/gui/NodeMenu.cpp b/src/gui/NodeMenu.cpp index 1a64d04e..5434f6be 100644 --- a/src/gui/NodeMenu.cpp +++ b/src/gui/NodeMenu.cpp @@ -87,6 +87,7 @@ NodeMenu::init(App& app, SPtr<const Client::BlockModel> block) if (presets) { _presets_menu = Gtk::manage(new Gtk::Menu()); + unsigned n_presets = 0; LILV_FOREACH(nodes, i, presets) { const LilvNode* preset = lilv_nodes_get(presets, i); lilv_world_load_resource(plugin->lilv_world(), preset); @@ -109,6 +110,7 @@ NodeMenu::init(App& app, SPtr<const Client::BlockModel> block) string(lilv_node_as_string(preset)))); lilv_nodes_free(labels); + ++n_presets; } else { app.log().error( fmt("Preset <%1> has no rdfs:label\n") @@ -116,10 +118,14 @@ NodeMenu::init(App& app, SPtr<const Client::BlockModel> block) } } - items().push_front(Gtk::Menu_Helpers::ImageMenuElem("_Presets", - *(manage(new Gtk::Image(Gtk::Stock::INDEX, Gtk::ICON_SIZE_MENU))))); - Gtk::MenuItem* presets_menu_item = &(items().front()); - presets_menu_item->set_submenu(*_presets_menu); + if (n_presets > 0) { + items().push_front( + Gtk::Menu_Helpers::ImageMenuElem( + "_Presets", + *(manage(new Gtk::Image(Gtk::Stock::INDEX, Gtk::ICON_SIZE_MENU))))); + Gtk::MenuItem* presets_menu_item = &(items().front()); + presets_menu_item->set_submenu(*_presets_menu); + } lilv_nodes_free(presets); } lilv_node_free(pset_Preset); @@ -137,6 +143,12 @@ NodeMenu::init(App& app, SPtr<const Client::BlockModel> block) else _learn_menuitem->hide(); + if (!_popup_gui_menuitem->is_visible() && + !_embed_gui_menuitem->is_visible() && + !_randomize_menuitem->is_visible()) { + _separator_menuitem->hide(); + } + _enable_signal = true; } diff --git a/src/gui/ObjectMenu.cpp b/src/gui/ObjectMenu.cpp index a6211797..2d44622b 100644 --- a/src/gui/ObjectMenu.cpp +++ b/src/gui/ObjectMenu.cpp @@ -48,6 +48,7 @@ ObjectMenu::ObjectMenu(BaseObjectType* cobject, xml->get_widget("object_rename_menuitem", _rename_menuitem); xml->get_widget("object_destroy_menuitem", _destroy_menuitem); xml->get_widget("object_properties_menuitem", _properties_menuitem); + xml->get_widget("object_menu_separator", _separator_menuitem); } void diff --git a/src/gui/ObjectMenu.hpp b/src/gui/ObjectMenu.hpp index d3ed647e..344af9f3 100644 --- a/src/gui/ObjectMenu.hpp +++ b/src/gui/ObjectMenu.hpp @@ -66,6 +66,7 @@ protected: Gtk::MenuItem* _rename_menuitem; Gtk::MenuItem* _destroy_menuitem; Gtk::MenuItem* _properties_menuitem; + Gtk::SeparatorMenuItem* _separator_menuitem; bool _enable_signal; }; diff --git a/src/gui/PortMenu.cpp b/src/gui/PortMenu.cpp index 3b8cc741..7eeef5b1 100644 --- a/src/gui/PortMenu.cpp +++ b/src/gui/PortMenu.cpp @@ -83,6 +83,10 @@ PortMenu::init(App& app, SPtr<const PortModel> port, bool is_graph_port) _learn_menuitem->set_visible(is_control); _unlearn_menuitem->set_visible(is_control); + if (!is_control && is_on_graph) { + _separator_menuitem->hide(); + } + _enable_signal = true; } diff --git a/src/gui/ingen_gui.ui b/src/gui/ingen_gui.ui index 88bf08d5..1a61bdb7 100644 --- a/src/gui/ingen_gui.ui +++ b/src/gui/ingen_gui.ui @@ -2065,129 +2065,139 @@ Contributors: <property name="can_focus">False</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <child> - <object class="GtkCheckMenuItem" id="object_polyphonic_menuitem"> + <object class="GtkImageMenuItem" id="node_popup_gui_menuitem"> + <property name="label" translatable="yes">Show GUI...</property> <property name="use_action_appearance">False</property> - <property name="visible">True</property> <property name="can_focus">False</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label" translatable="yes">P_olyphonic</property> - <property name="use_underline">True</property> + <property name="use_stock">False</property> </object> </child> <child> - <object class="GtkMenuItem" id="object_learn_menuitem"> + <object class="GtkCheckMenuItem" id="node_embed_gui_menuitem"> <property name="use_action_appearance">False</property> - <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes">_Learn</property> - <property name="use_underline">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="label" translatable="yes">Embed GUI</property> </object> </child> <child> - <object class="GtkMenuItem" id="object_unlearn_menuitem"> + <object class="GtkImageMenuItem" id="node_randomize_menuitem"> + <property name="label" translatable="yes">Randomi_ze</property> <property name="use_action_appearance">False</property> - <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes">_Unlearn</property> + <property name="use_stock">False</property> <property name="use_underline">True</property> </object> </child> <child> - <object class="GtkImageMenuItem" id="object_disconnect_menuitem"> - <property name="label">Dis_connect</property> + <object class="GtkMenuItem" id="port_set_min_menuitem"> <property name="use_action_appearance">False</property> - <property name="visible">True</property> <property name="can_focus">False</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="label" translatable="yes">Set Value as Mi_nimum</property> <property name="use_underline">True</property> - <property name="use_stock">False</property> </object> </child> <child> - <object class="GtkImageMenuItem" id="object_rename_menuitem"> - <property name="label">_Rename...</property> + <object class="GtkMenuItem" id="port_set_max_menuitem"> <property name="use_action_appearance">False</property> - <property name="visible">True</property> <property name="can_focus">False</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="label" translatable="yes">Set Value as Ma_ximum</property> <property name="use_underline">True</property> - <property name="use_stock">False</property> </object> </child> <child> - <object class="GtkImageMenuItem" id="object_destroy_menuitem"> - <property name="label">gtk-delete</property> + <object class="GtkMenuItem" id="port_reset_range_menuitem"> <property name="use_action_appearance">False</property> - <property name="visible">True</property> <property name="can_focus">False</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="label" translatable="yes">Re_set Range</property> <property name="use_underline">True</property> - <property name="use_stock">True</property> </object> </child> <child> - <object class="GtkImageMenuItem" id="object_properties_menuitem"> - <property name="label">gtk-properties</property> + <object class="GtkMenuItem" id="port_expose_menuitem"> <property name="use_action_appearance">False</property> - <property name="visible">True</property> <property name="can_focus">False</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="label" translatable="yes">_Expose</property> <property name="use_underline">True</property> - <property name="use_stock">True</property> </object> </child> <child> - <object class="GtkImageMenuItem" id="node_popup_gui_menuitem"> - <property name="label" translatable="yes">Show GUI...</property> + <object class="GtkSeparatorMenuItem" id="object_menu_separator"> + <property name="visible">True</property> + <property name="can_focus">False</property> + </object> + </child> + <child> + <object class="GtkCheckMenuItem" id="object_polyphonic_menuitem"> <property name="use_action_appearance">False</property> + <property name="visible">True</property> <property name="can_focus">False</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="use_stock">False</property> + <property name="label" translatable="yes">P_olyphonic</property> + <property name="use_underline">True</property> </object> </child> <child> - <object class="GtkCheckMenuItem" id="node_embed_gui_menuitem"> + <object class="GtkMenuItem" id="object_learn_menuitem"> <property name="use_action_appearance">False</property> + <property name="visible">True</property> <property name="can_focus">False</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label" translatable="yes">Embed GUI</property> + <property name="label" translatable="yes">_Learn</property> + <property name="use_underline">True</property> </object> </child> <child> - <object class="GtkImageMenuItem" id="node_randomize_menuitem"> - <property name="label" translatable="yes">Randomize</property> + <object class="GtkMenuItem" id="object_unlearn_menuitem"> <property name="use_action_appearance">False</property> + <property name="visible">True</property> <property name="can_focus">False</property> - <property name="use_stock">False</property> + <property name="label" translatable="yes">_Unlearn</property> + <property name="use_underline">True</property> </object> </child> <child> - <object class="GtkMenuItem" id="port_set_min_menuitem"> + <object class="GtkImageMenuItem" id="object_disconnect_menuitem"> + <property name="label">Dis_connect</property> <property name="use_action_appearance">False</property> + <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes">Set Minimum</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="use_underline">True</property> + <property name="use_stock">False</property> </object> </child> <child> - <object class="GtkMenuItem" id="port_set_max_menuitem"> + <object class="GtkImageMenuItem" id="object_destroy_menuitem"> + <property name="label">gtk-delete</property> <property name="use_action_appearance">False</property> + <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes">Set Maximum</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="use_underline">True</property> + <property name="use_stock">True</property> </object> </child> <child> - <object class="GtkMenuItem" id="port_reset_range_menuitem"> + <object class="GtkImageMenuItem" id="object_rename_menuitem"> + <property name="label">_Rename...</property> <property name="use_action_appearance">False</property> + <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes">Reset Range</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="use_underline">True</property> + <property name="use_stock">False</property> </object> </child> <child> - <object class="GtkMenuItem" id="port_expose_menuitem"> + <object class="GtkImageMenuItem" id="object_properties_menuitem"> + <property name="label">_Properties...</property> <property name="use_action_appearance">False</property> + <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes">_Expose</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="use_underline">True</property> + <property name="use_stock">False</property> </object> </child> </object> |