diff options
author | David Robillard <d@drobilla.net> | 2007-07-26 09:32:49 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-07-26 09:32:49 +0000 |
commit | f7368e7850307de97b024238a4f520afe1150c8b (patch) | |
tree | bcc3cb7099c57cb4b3206f68c41e8b828175b18a /src/libs/gui | |
parent | 397667bfaffdb622dfcf5bbbf64c49fd6a729f7e (diff) | |
download | ingen-f7368e7850307de97b024238a4f520afe1150c8b.tar.gz ingen-f7368e7850307de97b024238a4f520afe1150c8b.tar.bz2 ingen-f7368e7850307de97b024238a4f520afe1150c8b.zip |
Add const find interface to Raul::Table, fix bugs.
Use Raul::Table on Ingen client side instead of std::map for objects, plugins.
Work on renaming (still broken).
git-svn-id: http://svn.drobilla.net/lad/ingen@634 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/gui')
-rw-r--r-- | src/libs/gui/LoadPluginWindow.cpp | 10 | ||||
-rw-r--r-- | src/libs/gui/LoadPluginWindow.hpp | 4 | ||||
-rw-r--r-- | src/libs/gui/NodeMenu.cpp | 8 | ||||
-rw-r--r-- | src/libs/gui/PatchCanvas.cpp | 22 | ||||
-rw-r--r-- | src/libs/gui/PatchPortModule.cpp | 5 | ||||
-rw-r--r-- | src/libs/gui/Port.cpp | 9 | ||||
-rw-r--r-- | src/libs/gui/Port.hpp | 1 | ||||
-rw-r--r-- | src/libs/gui/WindowFactory.cpp | 17 | ||||
-rw-r--r-- | src/libs/gui/ingen_gui.glade | 2 |
9 files changed, 48 insertions, 30 deletions
diff --git a/src/libs/gui/LoadPluginWindow.cpp b/src/libs/gui/LoadPluginWindow.cpp index 194b6636..f079bb18 100644 --- a/src/libs/gui/LoadPluginWindow.cpp +++ b/src/libs/gui/LoadPluginWindow.cpp @@ -168,7 +168,7 @@ void LoadPluginWindow::on_show() { if (!_has_shown) { - set_plugin_list(App::instance().store()->plugins()); + set_plugins(App::instance().store()->plugins()); // Center on patch window /*int _w, _h; @@ -209,11 +209,11 @@ LoadPluginWindow::plugin_compare(const Gtk::TreeModel::iterator& a_i, void -LoadPluginWindow::set_plugin_list(const std::map<string, SharedPtr<PluginModel> >& m) +LoadPluginWindow::set_plugins(const Raul::Table<string, SharedPtr<PluginModel> >& m) { _plugins_liststore->clear(); - for (std::map<string, SharedPtr<PluginModel> >::const_iterator i = m.begin(); i != m.end(); ++i) { + for (Raul::Table<string, SharedPtr<PluginModel> >::const_iterator i = m.begin(); i != m.end(); ++i) { SharedPtr<PluginModel> plugin = (*i).second; Gtk::TreeModel::iterator iter = _plugins_liststore->append(); @@ -393,7 +393,7 @@ LoadPluginWindow::filter_changed() size_t num_visible = 0; - for (std::map<string, SharedPtr<PluginModel> >::const_iterator i = App::instance().store()->plugins().begin(); + for (Raul::Table<string, SharedPtr<PluginModel> >::const_iterator i = App::instance().store()->plugins().begin(); i != App::instance().store()->plugins().end(); ++i) { const SharedPtr<PluginModel> plugin = (*i).second; @@ -440,7 +440,7 @@ void LoadPluginWindow::clear_clicked() { _search_entry->set_text(""); - set_plugin_list(App::instance().store()->plugins()); + set_plugins(App::instance().store()->plugins()); } bool diff --git a/src/libs/gui/LoadPluginWindow.hpp b/src/libs/gui/LoadPluginWindow.hpp index ce8a331b..f1ba6383 100644 --- a/src/libs/gui/LoadPluginWindow.hpp +++ b/src/libs/gui/LoadPluginWindow.hpp @@ -19,11 +19,11 @@ #ifndef LOADPLUGINWINDOW_H #define LOADPLUGINWINDOW_H -#include <map> #include <libglademm/xml.h> #include <libglademm.h> #include <gtkmm.h> #include <raul/SharedPtr.hpp> +#include <raul/Table.hpp> #include "client/PatchModel.hpp" #include "client/PluginModel.hpp" using Ingen::Client::PluginModel; @@ -91,7 +91,7 @@ public: LoadPluginWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& xml); void set_patch(SharedPtr<PatchModel> patch); - void set_plugin_list(const std::map<string, SharedPtr<PluginModel> >& m); + void set_plugins(const Raul::Table<string, SharedPtr<PluginModel> >& m); void add_plugin(SharedPtr<PluginModel> plugin); bool has_shown() const { return _has_shown; } diff --git a/src/libs/gui/NodeMenu.cpp b/src/libs/gui/NodeMenu.cpp index f65eb512..3a09e34f 100644 --- a/src/libs/gui/NodeMenu.cpp +++ b/src/libs/gui/NodeMenu.cpp @@ -44,15 +44,15 @@ NodeMenu::NodeMenu(SharedPtr<NodeModel> node) items().push_back(Gtk::Menu_Helpers::SeparatorElem()); - /*items().push_back(Gtk::Menu_Helpers::MenuElem("Rename...", + items().push_back(Gtk::Menu_Helpers::MenuElem("Rename...", sigc::bind( sigc::mem_fun(app.window_factory(), &WindowFactory::present_rename), - node)));*/ + node))); + /*items().push_back(Gtk::Menu_Helpers::MenuElem("Clone", sigc::bind( sigc::mem_fun(app.engine(), &EngineInterface::clone), - node))); - sigc::mem_fun(this, &NodeMenu::on_menu_clone)));*/ + node)));*/ items().push_back(Gtk::Menu_Helpers::MenuElem("Disconnect All", sigc::mem_fun(this, &NodeMenu::on_menu_disconnect_all))); diff --git a/src/libs/gui/PatchCanvas.cpp b/src/libs/gui/PatchCanvas.cpp index 44ee72e6..e209a43f 100644 --- a/src/libs/gui/PatchCanvas.cpp +++ b/src/libs/gui/PatchCanvas.cpp @@ -70,12 +70,6 @@ PatchCanvas::PatchCanvas(SharedPtr<PatchModel> patch, int width, int height) xml->get_widget("canvas_menu_load_plugin", _menu_load_plugin); xml->get_widget("canvas_menu_load_patch", _menu_load_patch); xml->get_widget("canvas_menu_new_patch", _menu_new_patch); - - // Add control menu items - _menu_add_number_control->signal_activate().connect( - sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_control), NUMBER)); - _menu_add_button_control->signal_activate().connect( - sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_control), BUTTON)); // Add port menu items _menu_add_audio_input->signal_activate().connect( @@ -102,6 +96,12 @@ PatchCanvas::PatchCanvas(SharedPtr<PatchModel> patch, int width, int height) _menu_add_osc_output->signal_activate().connect( sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_port), "osc_output", "ingen:osc", true)); + + // Add control menu items + _menu_add_number_control->signal_activate().connect( + sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_control), NUMBER)); + _menu_add_button_control->signal_activate().connect( + sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_control), BUTTON)); #ifdef HAVE_SLV2 build_plugin_menu(); @@ -176,7 +176,7 @@ PatchCanvas::build_plugin_menu() Gtk::MenuItem* plugin_menu_item = &(_menu->items().back()); Gtk::Menu* plugin_menu = Gtk::manage(new Gtk::Menu()); plugin_menu_item->set_submenu(*plugin_menu); - _menu->reorder_child(*plugin_menu_item, 2); + _menu->reorder_child(*plugin_menu_item, 3); SLV2PluginClass lv2_plugin = slv2_world_get_plugin_class(PluginModel::slv2_world()); SLV2PluginClasses classes = slv2_world_get_plugin_classes(PluginModel::slv2_world()); @@ -193,9 +193,11 @@ PatchCanvas::build() boost::dynamic_pointer_cast<PatchCanvas>(shared_from_this()); // Create modules for nodes - for (NodeModelMap::const_iterator i = _patch->nodes().begin(); - i != _patch->nodes().end(); ++i) { - add_node((*i).second); + for (ObjectModel::Children::const_iterator i = _patch->children().begin(); + i != _patch->children().end(); ++i) { + SharedPtr<NodeModel> node = PtrCast<NodeModel>(i->second); + if (node) + add_node(node); } // Create pseudo modules for ports (ports on this canvas, not on our module) diff --git a/src/libs/gui/PatchPortModule.cpp b/src/libs/gui/PatchPortModule.cpp index 1d566741..bf63e9b6 100644 --- a/src/libs/gui/PatchPortModule.cpp +++ b/src/libs/gui/PatchPortModule.cpp @@ -26,6 +26,7 @@ #include "GladeFactory.hpp" #include "RenameWindow.hpp" #include "PatchWindow.hpp" +#include "WindowFactory.hpp" namespace Ingen { namespace GUI { @@ -71,6 +72,10 @@ PatchPortModule::create(boost::shared_ptr<PatchCanvas> canvas, SharedPtr<PortMod assert(ret); ret->_patch_port = boost::shared_ptr<Port>(new Port(ret, port, true, true)); + ret->_patch_port->menu().items().push_back(Gtk::Menu_Helpers::MenuElem("Rename...", + sigc::bind( + sigc::mem_fun(App::instance().window_factory(), &WindowFactory::present_rename), + port))); ret->add_port(ret->_patch_port); for (MetadataMap::const_iterator m = port->metadata().begin(); m != port->metadata().end(); ++m) diff --git a/src/libs/gui/Port.cpp b/src/libs/gui/Port.cpp index 4b824f15..cd13d89d 100644 --- a/src/libs/gui/Port.cpp +++ b/src/libs/gui/Port.cpp @@ -47,6 +47,8 @@ Port::Port(boost::shared_ptr<FlowCanvas::Module> module, SharedPtr<PortModel> pm if (destroyable) _menu.items().push_back(Gtk::Menu_Helpers::MenuElem("Destroy", sigc::mem_fun(this, &Port::on_menu_destroy))); + + _port_model->renamed_sig.connect(sigc::mem_fun(this, &Port::renamed)); } @@ -57,5 +59,12 @@ Port::on_menu_destroy() } +void +Port::renamed() +{ + set_name(_port_model->path().name()); +} + + } // namespace GUI } // namespace Ingen diff --git a/src/libs/gui/Port.hpp b/src/libs/gui/Port.hpp index 84a1643c..b381c44b 100644 --- a/src/libs/gui/Port.hpp +++ b/src/libs/gui/Port.hpp @@ -46,6 +46,7 @@ public: private: void on_menu_destroy(); + void renamed(); SharedPtr<PortModel> _port_model; }; diff --git a/src/libs/gui/WindowFactory.cpp b/src/libs/gui/WindowFactory.cpp index 9f128e8e..b1ebe5ae 100644 --- a/src/libs/gui/WindowFactory.cpp +++ b/src/libs/gui/WindowFactory.cpp @@ -35,14 +35,14 @@ namespace GUI { WindowFactory::WindowFactory() -: _load_plugin_win(NULL) -, _load_patch_win(NULL) -, _load_remote_patch_win(NULL) -, _upload_patch_win(NULL) -, _new_subpatch_win(NULL) -, _load_subpatch_win(NULL) -, _node_properties_win(NULL) -, _patch_properties_win(NULL) + : _load_plugin_win(NULL) + , _load_patch_win(NULL) + , _load_remote_patch_win(NULL) + , _upload_patch_win(NULL) + , _new_subpatch_win(NULL) + , _load_subpatch_win(NULL) + , _node_properties_win(NULL) + , _patch_properties_win(NULL) { Glib::RefPtr<Gnome::Glade::Xml> xml = GladeFactory::new_glade_reference(); @@ -54,6 +54,7 @@ WindowFactory::WindowFactory() 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("rename_win", _rename_win); } diff --git a/src/libs/gui/ingen_gui.glade b/src/libs/gui/ingen_gui.glade index 6294791c..a4609be7 100644 --- a/src/libs/gui/ingen_gui.glade +++ b/src/libs/gui/ingen_gui.glade @@ -2555,7 +2555,7 @@ Contributors: <widget class="GtkImage" id="menu-item-image20"> <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="stock">gtk-edit</property> + <property name="stock">gtk-add</property> </widget> </child> </widget> |