diff options
-rw-r--r-- | src/libs/client/ModelEngineInterface.cpp | 8 | ||||
-rw-r--r-- | src/libs/client/ModelEngineInterface.h | 4 | ||||
-rw-r--r-- | src/libs/client/NodeModel.cpp | 3 | ||||
-rw-r--r-- | src/libs/client/PatchLibrarian.cpp | 6 | ||||
-rw-r--r-- | src/progs/ingenuity/LoadPluginWindow.cpp | 18 | ||||
-rw-r--r-- | src/progs/ingenuity/LoadPluginWindow.h | 4 | ||||
-rw-r--r-- | src/progs/ingenuity/LoadSubpatchWindow.cpp | 10 | ||||
-rw-r--r-- | src/progs/ingenuity/LoadSubpatchWindow.h | 3 | ||||
-rw-r--r-- | src/progs/ingenuity/NewSubpatchWindow.cpp | 27 | ||||
-rw-r--r-- | src/progs/ingenuity/NewSubpatchWindow.h | 3 | ||||
-rw-r--r-- | src/progs/ingenuity/PatchWindow.cpp | 18 | ||||
-rw-r--r-- | src/progs/ingenuity/PatchWindow.h | 4 | ||||
-rw-r--r-- | src/progs/ingenuity/WindowFactory.h | 4 |
13 files changed, 40 insertions, 72 deletions
diff --git a/src/libs/client/ModelEngineInterface.cpp b/src/libs/client/ModelEngineInterface.cpp index 3add8854..40de205c 100644 --- a/src/libs/client/ModelEngineInterface.cpp +++ b/src/libs/client/ModelEngineInterface.cpp @@ -56,14 +56,14 @@ ModelEngineInterface::create_node_with_data(const string& plugin_uri, /** Create a patch. */ void -ModelEngineInterface::create_patch_from_model(const PatchModel* pm) +ModelEngineInterface::create_patch_with_data(const Path& path, size_t poly, const MetadataMap& data) { - create_patch(pm->path().c_str(), pm->poly()); - set_metadata_map(pm->path(), pm->metadata()); + create_patch(path, poly); + set_metadata_map(path, data); } -/** Set all pieces of metadata in a model. +/** Set all pieces of metadata in a map. */ void ModelEngineInterface::set_metadata_map(const Path& subject, const MetadataMap& data) diff --git a/src/libs/client/ModelEngineInterface.h b/src/libs/client/ModelEngineInterface.h index 7bc65d1a..e97947a3 100644 --- a/src/libs/client/ModelEngineInterface.h +++ b/src/libs/client/ModelEngineInterface.h @@ -44,7 +44,9 @@ class ModelEngineInterface : public virtual Shared::EngineInterface public: virtual ~ModelEngineInterface() {} - virtual void create_patch_from_model(const PatchModel* pm); + virtual void create_patch_with_data(const Path& path, + size_t poly, + const MetadataMap& initial_data); virtual void create_node_with_data(const string& plugin_uri, const Path& path, diff --git a/src/libs/client/NodeModel.cpp b/src/libs/client/NodeModel.cpp index cb46bafc..c5e399d2 100644 --- a/src/libs/client/NodeModel.cpp +++ b/src/libs/client/NodeModel.cpp @@ -122,6 +122,9 @@ NodeModel::add_port(CountedPtr<PortModel> pm) // Store should have handled this by merging the two assert(existing == m_ports.end()); + + m_ports.push_back(pm); + new_port_sig.emit(pm); } diff --git a/src/libs/client/PatchLibrarian.cpp b/src/libs/client/PatchLibrarian.cpp index 9fc70ee7..ebc33f36 100644 --- a/src/libs/client/PatchLibrarian.cpp +++ b/src/libs/client/PatchLibrarian.cpp @@ -479,7 +479,8 @@ PatchLibrarian::load_patch(CountedPtr<PatchModel> pm, bool wait, bool existing) if (wait) { //int id = _engine->get_next_request_id(); //_engine->set_wait_response_id(id); - _engine->create_patch_from_model(pm.get()); + cerr << "FIXME: create patch\n"; + //_engine->create_patch_from_model(pm.get()); //bool succeeded = _engine->wait_for_response(); // If creating the patch failed, bail out so we don't load all these nodes @@ -489,7 +490,8 @@ PatchLibrarian::load_patch(CountedPtr<PatchModel> pm, bool wait, bool existing) return ""; }*/ // FIXME } else { - _engine->create_patch_from_model(pm.get()); + cerr << "FIXME: create patch (2)\n"; + //_engine->create_patch_from_model(pm.get()); } } diff --git a/src/progs/ingenuity/LoadPluginWindow.cpp b/src/progs/ingenuity/LoadPluginWindow.cpp index 2c09584c..5235dacd 100644 --- a/src/progs/ingenuity/LoadPluginWindow.cpp +++ b/src/progs/ingenuity/LoadPluginWindow.cpp @@ -35,9 +35,7 @@ namespace Ingenuity { LoadPluginWindow::LoadPluginWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& xml) : Gtk::Window(cobject), m_has_shown(false), - m_plugin_name_offset(0), - m_new_module_x(0), - m_new_module_y(0) + m_plugin_name_offset(0) { xml->get_widget("load_plugin_plugins_treeview", m_plugins_treeview); xml->get_widget("load_plugin_polyphonic_checkbutton", m_polyphonic_checkbutton); @@ -184,15 +182,6 @@ LoadPluginWindow::on_show() void -LoadPluginWindow::on_hide() -{ - m_new_module_x = 0; - m_new_module_y = 0; - Gtk::Window::on_hide(); -} - - -void LoadPluginWindow::set_plugin_list(const std::map<string, CountedPtr<PluginModel> >& m) { m_plugins_liststore->clear(); @@ -319,8 +308,9 @@ LoadPluginWindow::add_clicked() m_node_name_entry->set_text(generate_module_name(m_plugin_name_offset)); // Set the next module location 20 over, for a cascade effect - m_new_module_x += 20; - m_new_module_y += 20; + cerr << "FIXME: cascade\n"; + //m_new_module_x += 20; + //m_new_module_y += 20; } } } diff --git a/src/progs/ingenuity/LoadPluginWindow.h b/src/progs/ingenuity/LoadPluginWindow.h index 0af40d05..08433d37 100644 --- a/src/progs/ingenuity/LoadPluginWindow.h +++ b/src/progs/ingenuity/LoadPluginWindow.h @@ -98,7 +98,6 @@ public: protected: void on_show(); - void on_hide(); bool on_key_press_event(GdkEventKey* event); private: @@ -129,9 +128,6 @@ private: int m_plugin_name_offset; // see comments for generate_plugin_name - double m_new_module_x; - double m_new_module_y; - Gtk::TreeView* m_plugins_treeview; Gtk::CheckButton* m_polyphonic_checkbutton; Gtk::Entry* m_node_name_entry; diff --git a/src/progs/ingenuity/LoadSubpatchWindow.cpp b/src/progs/ingenuity/LoadSubpatchWindow.cpp index ed5da0ee..07b51716 100644 --- a/src/progs/ingenuity/LoadSubpatchWindow.cpp +++ b/src/progs/ingenuity/LoadSubpatchWindow.cpp @@ -30,9 +30,7 @@ namespace Ingenuity { LoadSubpatchWindow::LoadSubpatchWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& xml) -: Gtk::FileChooserDialog(cobject), - m_new_module_x(0), - m_new_module_y(0) +: Gtk::FileChooserDialog(cobject) { xml->get_widget("load_subpatch_name_from_file_radio", m_name_from_file_radio); xml->get_widget("load_subpatch_name_from_user_radio", m_name_from_user_radio); @@ -152,12 +150,6 @@ LoadSubpatchWindow::ok_clicked() else if (m_poly_from_parent_radio->get_active()) poly = m_patch->poly(); - if (m_new_module_x == 0 && m_new_module_y == 0) { - throw; // FIXME - //m_patch_controller->get_view()->canvas()->get_new_module_location( - // m_new_module_x, m_new_module_y); - } - /*CountedPtr<PatchModel> pm(new PatchModel(m_patch->path().base() + name, poly)); pm->filename(filename); diff --git a/src/progs/ingenuity/LoadSubpatchWindow.h b/src/progs/ingenuity/LoadSubpatchWindow.h index ae65a9f4..81e4f4d7 100644 --- a/src/progs/ingenuity/LoadSubpatchWindow.h +++ b/src/progs/ingenuity/LoadSubpatchWindow.h @@ -59,9 +59,6 @@ private: CountedPtr<PatchModel> m_patch; - double m_new_module_x; - double m_new_module_y; - Gtk::RadioButton* m_name_from_file_radio; Gtk::RadioButton* m_name_from_user_radio; Gtk::Entry* m_name_entry; diff --git a/src/progs/ingenuity/NewSubpatchWindow.cpp b/src/progs/ingenuity/NewSubpatchWindow.cpp index 1d730582..44da3a4e 100644 --- a/src/progs/ingenuity/NewSubpatchWindow.cpp +++ b/src/progs/ingenuity/NewSubpatchWindow.cpp @@ -25,9 +25,7 @@ namespace Ingenuity { NewSubpatchWindow::NewSubpatchWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& xml) -: Gtk::Window(cobject), - m_new_module_x(0), - m_new_module_y(0) +: Gtk::Window(cobject) { xml->get_widget("new_subpatch_name_entry", m_name_entry); xml->get_widget("new_subpatch_message_label", m_message_label); @@ -87,24 +85,11 @@ NewSubpatchWindow::name_changed() void NewSubpatchWindow::ok_clicked() { - cerr << "FIXME: new subpatch\n"; -#if 0 - PatchModel* pm = new PatchModel( - m_patch->path().base() + m_name_entry->get_text(), - m_poly_spinbutton->get_value_as_int()); - - if (m_new_module_x == 0 && m_new_module_y == 0) { - throw; // FIXME - //m_patch_controller->get_view()->canvas()->get_new_module_location( - // m_new_module_x, m_new_module_y); - } - - // FIXME: necessary? - //pm->set_parent(m_patch); - pm->set_metadata("module-x", (float)m_new_module_x); - pm->set_metadata("module-y", (float)m_new_module_y); - App::instance().engine()->create_patch_from_model(pm); -#endif + const Path path = m_patch->path().base() + Path::nameify(m_name_entry->get_text()); + const size_t poly = m_poly_spinbutton->get_value_as_int(); + + App::instance().engine()->create_patch_with_data(path, poly, m_initial_data); + hide(); } diff --git a/src/progs/ingenuity/NewSubpatchWindow.h b/src/progs/ingenuity/NewSubpatchWindow.h index 420b82c4..57c6c7ee 100644 --- a/src/progs/ingenuity/NewSubpatchWindow.h +++ b/src/progs/ingenuity/NewSubpatchWindow.h @@ -51,9 +51,6 @@ private: MetadataMap m_initial_data; CountedPtr<PatchModel> m_patch; - double m_new_module_x; - double m_new_module_y; - Gtk::Entry* m_name_entry; Gtk::Label* m_message_label; Gtk::SpinButton* m_poly_spinbutton; diff --git a/src/progs/ingenuity/PatchWindow.cpp b/src/progs/ingenuity/PatchWindow.cpp index 6915b4a1..07bcb781 100644 --- a/src/progs/ingenuity/PatchWindow.cpp +++ b/src/progs/ingenuity/PatchWindow.cpp @@ -122,7 +122,7 @@ PatchWindow::~PatchWindow() // Prevents deletion //m_patch->claim_patch_view(); - App::instance().remove_patch_window(this); + //App::instance().remove_patch_window(this); delete m_breadcrumb_box; } @@ -188,11 +188,20 @@ PatchWindow::set_patch(CountedPtr<PatchModel> patch, CountedPtr<PatchView> view) else m_menu_destroy_patch->set_sensitive(true); + m_patch->destroyed_sig.connect(sigc::mem_fun(this, &PatchWindow::patch_destroyed)); + m_enable_signal = true; } void +PatchWindow::patch_destroyed() +{ + App::instance().window_factory()->remove_patch_window(this); +} + + +void PatchWindow::event_show_engine() { if (m_patch) @@ -303,7 +312,6 @@ PatchWindow::on_show() void PatchWindow::on_hide() { - claim_breadcrumbs(); m_position_stored = true; get_position(m_x, m_y); Gtk::Window::on_hide(); @@ -383,11 +391,5 @@ PatchWindow::event_fullscreen_toggled() } } -void -PatchWindow::claim_breadcrumbs() -{ - m_breadcrumb_box->reparent(m_breadcrumb_bin); -} - } // namespace Ingenuity diff --git a/src/progs/ingenuity/PatchWindow.h b/src/progs/ingenuity/PatchWindow.h index 2e0a388b..79284cb5 100644 --- a/src/progs/ingenuity/PatchWindow.h +++ b/src/progs/ingenuity/PatchWindow.h @@ -72,8 +72,6 @@ public: Gtk::MenuItem* menu_view_control_window() { return m_menu_view_control_window; } - void claim_breadcrumbs(); - protected: void on_show(); void on_hide(); @@ -91,6 +89,8 @@ private: void event_show_controls(); void event_show_engine(); + void patch_destroyed(); + CountedPtr<PatchModel> m_patch; CountedPtr<PatchView> m_view; diff --git a/src/progs/ingenuity/WindowFactory.h b/src/progs/ingenuity/WindowFactory.h index 831ab646..37d218f6 100644 --- a/src/progs/ingenuity/WindowFactory.h +++ b/src/progs/ingenuity/WindowFactory.h @@ -60,13 +60,15 @@ public: void present_load_subpatch(CountedPtr<PatchModel> patch, MetadataMap data = MetadataMap()); void present_rename(CountedPtr<ObjectModel> object); void present_properties(CountedPtr<NodeModel> node); + + bool remove_patch_window(PatchWindow* win, GdkEventAny* ignored = NULL); private: typedef std::map<Path, PatchWindow*> PatchWindowMap; typedef std::map<Path, NodeControlWindow*> ControlWindowMap; PatchWindow* new_patch_window(CountedPtr<PatchModel> patch, CountedPtr<PatchView> view); - bool remove_patch_window(PatchWindow* win, GdkEventAny* ignored); + NodeControlWindow* new_control_window(CountedPtr<NodeModel> node); bool remove_control_window(NodeControlWindow* win, GdkEventAny* ignored); |