diff options
author | David Robillard <d@drobilla.net> | 2007-10-06 23:12:15 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-10-06 23:12:15 +0000 |
commit | f2d5d172ff5f0ff02e6dfe0d0bd472b068192244 (patch) | |
tree | f6a03e0fdec83af952fb51112d3ecbaea210f2bf /src/libs/gui | |
parent | 25fd375c074c45929f71d6b9ca4841882c832b05 (diff) | |
download | ingen-f2d5d172ff5f0ff02e6dfe0d0bd472b068192244.tar.gz ingen-f2d5d172ff5f0ff02e6dfe0d0bd472b068192244.tar.bz2 ingen-f2d5d172ff5f0ff02e6dfe0d0bd472b068192244.zip |
Access to object properties window via context menu (most importantly the port one, for control ranges).
git-svn-id: http://svn.drobilla.net/lad/ingen@833 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/gui')
-rw-r--r-- | src/libs/gui/ControlGroups.cpp | 7 | ||||
-rw-r--r-- | src/libs/gui/ControlGroups.hpp | 3 | ||||
-rw-r--r-- | src/libs/gui/DSSIController.hpp | 2 | ||||
-rw-r--r-- | src/libs/gui/NodeMenu.hpp | 5 | ||||
-rw-r--r-- | src/libs/gui/ObjectMenu.cpp | 26 | ||||
-rw-r--r-- | src/libs/gui/ObjectMenu.hpp | 2 | ||||
-rw-r--r-- | src/libs/gui/PortMenu.hpp | 5 | ||||
-rw-r--r-- | src/libs/gui/PortPropertiesWindow.cpp | 32 | ||||
-rw-r--r-- | src/libs/gui/PortPropertiesWindow.hpp | 18 | ||||
-rw-r--r-- | src/libs/gui/WindowFactory.cpp | 35 | ||||
-rw-r--r-- | src/libs/gui/WindowFactory.hpp | 8 | ||||
-rw-r--r-- | src/libs/gui/ingen_gui.glade | 26 |
12 files changed, 101 insertions, 68 deletions
diff --git a/src/libs/gui/ControlGroups.cpp b/src/libs/gui/ControlGroups.cpp index 46052d72..b7828a48 100644 --- a/src/libs/gui/ControlGroups.cpp +++ b/src/libs/gui/ControlGroups.cpp @@ -156,10 +156,9 @@ SliderControlGroup::menu_properties() { Glib::RefPtr<Gnome::Glade::Xml> xml = GladeFactory::new_glade_reference(); - PortPropertiesWindow* dialog; - xml->get_widget_derived("port_properties_win", dialog); - dialog->init(this, _port_model); - dialog->run(); + PortPropertiesWindow* window; + xml->get_widget_derived("port_properties_win", window); + window->present(_port_model); } diff --git a/src/libs/gui/ControlGroups.hpp b/src/libs/gui/ControlGroups.hpp index 232b1b56..15e5a6ea 100644 --- a/src/libs/gui/ControlGroups.hpp +++ b/src/libs/gui/ControlGroups.hpp @@ -32,7 +32,6 @@ namespace Ingen { namespace GUI { class ControlPanel; -class PortPropertiesWindow; /** A group of controls (for a single Port) in a NodeControlWindow. @@ -50,8 +49,6 @@ public: inline const SharedPtr<PortModel> port_model() const { return _port_model; } protected: - friend class PortPropertiesWindow; - virtual void set_value(float value) = 0; virtual void set_range(float min, float max) {} diff --git a/src/libs/gui/DSSIController.hpp b/src/libs/gui/DSSIController.hpp index 0d7073ea..7d6e0c97 100644 --- a/src/libs/gui/DSSIController.hpp +++ b/src/libs/gui/DSSIController.hpp @@ -36,7 +36,7 @@ namespace Ingen { namespace GUI { class NodeControlWindow; -class NodePropertiesWindow; + /* Controller for a DSSI node. * diff --git a/src/libs/gui/NodeMenu.hpp b/src/libs/gui/NodeMenu.hpp index 715cf6b9..05457b8f 100644 --- a/src/libs/gui/NodeMenu.hpp +++ b/src/libs/gui/NodeMenu.hpp @@ -30,11 +30,6 @@ using Ingen::Client::NodeModel; namespace Ingen { namespace GUI { -class Controller; -class NodeControlWindow; -class NodePropertiesWindow; -class PatchCanvas; - /** Menu for a Node. * diff --git a/src/libs/gui/ObjectMenu.cpp b/src/libs/gui/ObjectMenu.cpp index ca000cfa..73d01389 100644 --- a/src/libs/gui/ObjectMenu.cpp +++ b/src/libs/gui/ObjectMenu.cpp @@ -33,11 +33,13 @@ ObjectMenu::ObjectMenu(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade: , _disconnect_menuitem(NULL) , _rename_menuitem(NULL) , _destroy_menuitem(NULL) + , _properties_menuitem(NULL) { xml->get_widget("object_polyphonic_menuitem", _polyphonic_menuitem); xml->get_widget("object_disconnect_menuitem", _disconnect_menuitem); xml->get_widget("object_rename_menuitem", _rename_menuitem); xml->get_widget("object_destroy_menuitem", _destroy_menuitem); + xml->get_widget("object_properties_menuitem", _properties_menuitem); } @@ -62,6 +64,9 @@ ObjectMenu::init(SharedPtr<ObjectModel> object) _destroy_menuitem->signal_activate().connect( sigc::mem_fun(this, &ObjectMenu::on_menu_destroy)); + + _properties_menuitem->signal_activate().connect( + sigc::mem_fun(this, &ObjectMenu::on_menu_properties)); object->signal_polyphonic.connect(sigc::mem_fun(this, &ObjectMenu::polyphonic_changed)); @@ -70,13 +75,6 @@ ObjectMenu::init(SharedPtr<ObjectModel> object) void -ObjectMenu::on_menu_destroy() -{ - App::instance().engine()->destroy(_object->path()); -} - - -void ObjectMenu::on_menu_polyphonic() { if (_enable_signal) @@ -99,6 +97,20 @@ ObjectMenu::on_menu_disconnect() App::instance().engine()->disconnect_all(_object->path()); } + +void +ObjectMenu::on_menu_destroy() +{ + App::instance().engine()->destroy(_object->path()); +} + + +void +ObjectMenu::on_menu_properties() +{ + App::instance().window_factory()->present_properties(_object); +} + } // namespace GUI } // namespace Ingen diff --git a/src/libs/gui/ObjectMenu.hpp b/src/libs/gui/ObjectMenu.hpp index b65c78ef..1acc278f 100644 --- a/src/libs/gui/ObjectMenu.hpp +++ b/src/libs/gui/ObjectMenu.hpp @@ -50,6 +50,7 @@ protected: void on_menu_polyphonic(); void on_menu_disconnect(); void on_menu_destroy(); + void on_menu_properties(); void polyphonic_changed(bool polyphonic); @@ -59,6 +60,7 @@ protected: Gtk::MenuItem* _disconnect_menuitem; Gtk::MenuItem* _rename_menuitem; Gtk::MenuItem* _destroy_menuitem; + Gtk::MenuItem* _properties_menuitem; }; diff --git a/src/libs/gui/PortMenu.hpp b/src/libs/gui/PortMenu.hpp index e1079f0d..06e8ac7d 100644 --- a/src/libs/gui/PortMenu.hpp +++ b/src/libs/gui/PortMenu.hpp @@ -30,11 +30,6 @@ using Ingen::Client::PortModel; namespace Ingen { namespace GUI { -class Controller; -class PortControlWindow; -class PortPropertiesWindow; -class PatchCanvas; - /** Menu for a Port. * diff --git a/src/libs/gui/PortPropertiesWindow.cpp b/src/libs/gui/PortPropertiesWindow.cpp index cf8dbd98..a715a114 100644 --- a/src/libs/gui/PortPropertiesWindow.cpp +++ b/src/libs/gui/PortPropertiesWindow.cpp @@ -31,9 +31,8 @@ namespace GUI { PortPropertiesWindow::PortPropertiesWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& xml) - : Gtk::Dialog(cobject) + : Gtk::Window(cobject) , _enable_signal(false) - , _control(NULL) { xml->get_widget("port_properties_min_spinner", _min_spinner); xml->get_widget("port_properties_max_spinner", _max_spinner); @@ -52,13 +51,16 @@ PortPropertiesWindow::PortPropertiesWindow(BaseObjectType* cobject, const Glib:: * This function MUST be called before using this object in any way. */ void -PortPropertiesWindow::init(ControlGroup* control, SharedPtr<PortModel> pm) +PortPropertiesWindow::present(SharedPtr<PortModel> pm) { assert(pm); - assert(control); + for (list<sigc::connection>::iterator i = _connections.begin(); i != _connections.end(); ++i) + (*i).disconnect(); + + _connections.clear(); + _port_model = pm; - _control = control; set_title(pm->path() + " Properties"); @@ -71,13 +73,19 @@ PortPropertiesWindow::init(ControlGroup* control, SharedPtr<PortModel> pm) _initial_max = max; _min_spinner->set_value(min); - _min_spinner->signal_value_changed().connect(sigc::mem_fun(*this, &PortPropertiesWindow::min_changed)); + _connections.push_back(_min_spinner->signal_value_changed().connect( + sigc::mem_fun(*this, &PortPropertiesWindow::min_changed))); + _max_spinner->set_value(max); - _max_spinner->signal_value_changed().connect(sigc::mem_fun(*this, &PortPropertiesWindow::max_changed)); + _connections.push_back(_max_spinner->signal_value_changed().connect( + sigc::mem_fun(*this, &PortPropertiesWindow::max_changed))); - pm->signal_metadata.connect(sigc::mem_fun(this, &PortPropertiesWindow::metadata_update)); + _connections.push_back(pm->signal_metadata.connect( + sigc::mem_fun(this, &PortPropertiesWindow::metadata_update))); _enable_signal = true; + + Gtk::Window::present(); } @@ -106,8 +114,6 @@ PortPropertiesWindow::min_changed() _max_spinner->set_value(max); } - _control->set_range(min, max); - if (_enable_signal) App::instance().engine()->set_metadata(_port_model->path(), "ingen:minimum", min); } @@ -124,8 +130,6 @@ PortPropertiesWindow::max_changed() _min_spinner->set_value(min); } - _control->set_range(min, max); - if (_enable_signal) App::instance().engine()->set_metadata(_port_model->path(), "ingen:maximum", max); } @@ -136,14 +140,14 @@ PortPropertiesWindow::cancel() { App::instance().engine()->set_metadata(_port_model->path(), "ingen:minimum", _initial_min); App::instance().engine()->set_metadata(_port_model->path(), "ingen:maximum", _initial_max); - delete this; + hide(); } void PortPropertiesWindow::ok() { - delete this; + hide(); } diff --git a/src/libs/gui/PortPropertiesWindow.hpp b/src/libs/gui/PortPropertiesWindow.hpp index 8c8f1c96..5d10960d 100644 --- a/src/libs/gui/PortPropertiesWindow.hpp +++ b/src/libs/gui/PortPropertiesWindow.hpp @@ -27,8 +27,6 @@ using namespace Ingen::Client; namespace Ingen { namespace GUI { -class ControlGroup; - /** Port properties window. * @@ -36,12 +34,12 @@ class ControlGroup; * * \ingroup GUI */ -class PortPropertiesWindow : public Gtk::Dialog +class PortPropertiesWindow : public Gtk::Window { public: PortPropertiesWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& refGlade); - void init(ControlGroup* control, SharedPtr<PortModel> port_model); + void present(SharedPtr<PortModel> port_model); private: void metadata_update(const string& key, const Atom& value); @@ -56,12 +54,12 @@ private: float _initial_min; float _initial_max; - ControlGroup* _control; - SharedPtr<PortModel> _port_model; - Gtk::SpinButton* _min_spinner; - Gtk::SpinButton* _max_spinner; - Gtk::Button* _cancel_button; - Gtk::Button* _ok_button; + SharedPtr<PortModel> _port_model; + Gtk::SpinButton* _min_spinner; + Gtk::SpinButton* _max_spinner; + Gtk::Button* _cancel_button; + Gtk::Button* _ok_button; + std::list<sigc::connection> _connections; }; } // namespace GUI diff --git a/src/libs/gui/WindowFactory.cpp b/src/libs/gui/WindowFactory.cpp index 096bb9df..caa02390 100644 --- a/src/libs/gui/WindowFactory.cpp +++ b/src/libs/gui/WindowFactory.cpp @@ -20,8 +20,9 @@ #include "App.hpp" #include "PatchWindow.hpp" #include "GladeFactory.hpp" -#include "NodePropertiesWindow.hpp" #include "PatchPropertiesWindow.hpp" +#include "NodePropertiesWindow.hpp" +#include "PortPropertiesWindow.hpp" #include "NodeControlWindow.hpp" #include "LoadPluginWindow.hpp" #include "LoadPatchWindow.hpp" @@ -44,8 +45,9 @@ WindowFactory::WindowFactory() , _upload_patch_win(NULL) , _new_subpatch_win(NULL) , _load_subpatch_win(NULL) - , _node_properties_win(NULL) , _patch_properties_win(NULL) + , _node_properties_win(NULL) + , _port_properties_win(NULL) { Glib::RefPtr<Gnome::Glade::Xml> xml = GladeFactory::new_glade_reference(); @@ -54,8 +56,9 @@ WindowFactory::WindowFactory() xml->get_widget_derived("load_remote_patch_win", _load_remote_patch_win); xml->get_widget_derived("new_subpatch_win", _new_subpatch_win); xml->get_widget_derived("load_subpatch_win", _load_subpatch_win); - xml->get_widget_derived("node_properties_win", _node_properties_win); xml->get_widget_derived("patch_properties_win", _patch_properties_win); + xml->get_widget_derived("node_properties_win", _node_properties_win); + xml->get_widget_derived("port_properties_win", _port_properties_win); xml->get_widget_derived("rename_win", _rename_win); #ifdef HAVE_CURL @@ -340,24 +343,36 @@ WindowFactory::present_rename(SharedPtr<ObjectModel> object) void -WindowFactory::present_properties(SharedPtr<NodeModel> node) +WindowFactory::present_properties(SharedPtr<ObjectModel> object) { - SharedPtr<PatchModel> patch = PtrCast<PatchModel>(node); + SharedPtr<PatchModel> patch = PtrCast<PatchModel>(object); if (patch) { - PatchWindowMap::iterator w = _patch_windows.find(patch->path()); if (w != _patch_windows.end()) _patch_properties_win->set_transient_for(*w->second); _patch_properties_win->present(patch); + return; + } - } else { - - PatchWindowMap::iterator w = _patch_windows.find(node->parent()->path()); + SharedPtr<NodeModel> node = PtrCast<NodeModel>(object); + if (node) { + PatchWindowMap::iterator w = _patch_windows.find(node->path().parent()); if (w != _patch_windows.end()) _node_properties_win->set_transient_for(*w->second); - + _node_properties_win->present(node); + return; + } + + SharedPtr<PortModel> port = PtrCast<PortModel>(object); + if (port) { + PatchWindowMap::iterator w = _patch_windows.find(port->path().parent().parent()); + if (w != _patch_windows.end()) + _patch_properties_win->set_transient_for(*w->second); + + _port_properties_win->present(port); + return; } } diff --git a/src/libs/gui/WindowFactory.hpp b/src/libs/gui/WindowFactory.hpp index 0227f728..91fb27ab 100644 --- a/src/libs/gui/WindowFactory.hpp +++ b/src/libs/gui/WindowFactory.hpp @@ -31,8 +31,9 @@ namespace GUI { class PatchWindow; class NodeControlWindow; -class NodePropertiesWindow; class PatchPropertiesWindow; +class NodePropertiesWindow; +class PortPropertiesWindow; class LoadPatchWindow; class LoadRemotePatchWindow; class UploadPatchWindow; @@ -68,7 +69,7 @@ public: void present_new_subpatch(SharedPtr<PatchModel> patch, MetadataMap data = MetadataMap()); void present_load_subpatch(SharedPtr<PatchModel> patch, MetadataMap data = MetadataMap()); void present_rename(SharedPtr<ObjectModel> object); - void present_properties(SharedPtr<NodeModel> node); + void present_properties(SharedPtr<ObjectModel> object); bool remove_patch_window(PatchWindow* win, GdkEventAny* ignored = NULL); @@ -93,8 +94,9 @@ private: UploadPatchWindow* _upload_patch_win; NewSubpatchWindow* _new_subpatch_win; LoadSubpatchWindow* _load_subpatch_win; - NodePropertiesWindow* _node_properties_win; PatchPropertiesWindow* _patch_properties_win; + NodePropertiesWindow* _node_properties_win; + PortPropertiesWindow* _port_properties_win; RenameWindow* _rename_win; }; diff --git a/src/libs/gui/ingen_gui.glade b/src/libs/gui/ingen_gui.glade index e2e9d093..1ef92b53 100644 --- a/src/libs/gui/ingen_gui.glade +++ b/src/libs/gui/ingen_gui.glade @@ -2030,9 +2030,10 @@ Hold <Ctrl> to play controls in either mode.</property> </child> </widget> <widget class="GtkWindow" id="node_properties_win"> - <property name="border_width">6</property> + <property name="border_width">8</property> <property name="title" translatable="yes">Node Properties - Ingen</property> <property name="icon">ingen.svg</property> + <property name="window_position">GTK_WIN_POS_MOUSE</property> <child> <widget class="GtkVBox" id="vbox17"> <property name="visible">True</property> @@ -2985,15 +2986,13 @@ Thank you for contributing.</property> </widget> </child> </widget> - <widget class="GtkDialog" id="port_properties_win"> + <widget class="GtkWindow" id="port_properties_win"> <property name="border_width">8</property> <property name="type">GTK_WINDOW_POPUP</property> <property name="title" translatable="yes">Port Properties - Ingen</property> <property name="resizable">False</property> <property name="window_position">GTK_WIN_POS_MOUSE</property> - <property name="destroy_with_parent">True</property> - <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> - <child internal-child="vbox"> + <child> <widget class="GtkVBox" id="dialog-vbox6"> <property name="visible">True</property> <property name="spacing">8</property> @@ -3065,7 +3064,7 @@ Thank you for contributing.</property> <property name="position">2</property> </packing> </child> - <child internal-child="action_area"> + <child> <widget class="GtkHButtonBox" id="dialog-action_area6"> <property name="visible">True</property> <property name="layout_style">GTK_BUTTONBOX_END</property> @@ -3150,6 +3149,21 @@ Thank you for contributing.</property> <property name="use_stock">True</property> </widget> </child> + <child> + <widget class="GtkSeparatorMenuItem" id="separator9"> + <property name="visible">True</property> + </widget> + </child> + <child> + <widget class="GtkImageMenuItem" id="object_properties_menuitem"> + <property name="visible">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="tooltip" translatable="yes">View and edit properties</property> + <property name="label" translatable="yes">gtk-properties</property> + <property name="use_underline">True</property> + <property name="use_stock">True</property> + </widget> + </child> </widget> <widget class="GtkMenu" id="node_menu"> <property name="visible">True</property> |