diff options
Diffstat (limited to 'src/progs')
-rw-r--r-- | src/progs/ingenuity/LoadPluginWindow.cpp | 28 | ||||
-rw-r--r-- | src/progs/ingenuity/LoadPluginWindow.h | 1 | ||||
-rw-r--r-- | src/progs/ingenuity/PatchController.cpp | 16 | ||||
-rw-r--r-- | src/progs/ingenuity/PatchView.cpp | 17 | ||||
-rw-r--r-- | src/progs/ingenuity/PatchView.h | 2 |
5 files changed, 47 insertions, 17 deletions
diff --git a/src/progs/ingenuity/LoadPluginWindow.cpp b/src/progs/ingenuity/LoadPluginWindow.cpp index b6c2ca67..4b4290c4 100644 --- a/src/progs/ingenuity/LoadPluginWindow.cpp +++ b/src/progs/ingenuity/LoadPluginWindow.cpp @@ -47,7 +47,7 @@ LoadPluginWindow::LoadPluginWindow(BaseObjectType* cobject, const Glib::RefPtr<G xml->get_widget("load_plugin_clear_button", m_clear_button); xml->get_widget("load_plugin_add_button", m_add_button); xml->get_widget("load_plugin_close_button", m_close_button); - //xml->get_widget("load_plugin_ok_button", m_ok_button); + //xml->get_widget("load_plugin_ok_button", m_add_button); xml->get_widget("load_plugin_filter_combo", m_filter_combo); xml->get_widget("load_plugin_search_entry", m_search_entry); @@ -94,10 +94,11 @@ LoadPluginWindow::LoadPluginWindow(BaseObjectType* cobject, const Glib::RefPtr<G m_clear_button->signal_clicked().connect( sigc::mem_fun(this, &LoadPluginWindow::clear_clicked)); m_add_button->signal_clicked().connect( sigc::mem_fun(this, &LoadPluginWindow::add_clicked)); m_close_button->signal_clicked().connect( sigc::mem_fun(this, &LoadPluginWindow::close_clicked)); - //m_ok_button->signal_clicked().connect( sigc::mem_fun(this, &LoadPluginWindow::ok_clicked)); + //m_add_button->signal_clicked().connect( sigc::mem_fun(this, &LoadPluginWindow::ok_clicked)); m_plugins_treeview->signal_row_activated().connect(sigc::mem_fun(this, &LoadPluginWindow::plugin_activated)); m_search_entry->signal_activate().connect( sigc::mem_fun(this, &LoadPluginWindow::add_clicked)); m_search_entry->signal_changed().connect( sigc::mem_fun(this, &LoadPluginWindow::filter_changed)); + m_node_name_entry->signal_changed().connect( sigc::mem_fun(this, &LoadPluginWindow::name_changed)); m_selection = m_plugins_treeview->get_selection(); m_selection->signal_changed().connect(sigc::mem_fun(this, &LoadPluginWindow::plugin_selection_changed)); @@ -106,6 +107,29 @@ LoadPluginWindow::LoadPluginWindow(BaseObjectType* cobject, const Glib::RefPtr<G } +/** Called every time the user types into the name input box. + * Used to display warning messages, and enable/disable the OK button. + */ +void +LoadPluginWindow::name_changed() +{ + string name = m_node_name_entry->get_text(); + if (!Path::is_valid_name(name)) { + //m_message_label->set_text("Name contains invalid characters."); + m_add_button->property_sensitive() = false; + } else if (m_patch_controller->patch_model()->get_node(name)) { + //m_message_label->set_text("An object already exists with that name."); + m_add_button->property_sensitive() = false; + } else if (name.length() == 0) { + //m_message_label->set_text(""); + m_add_button->property_sensitive() = false; + } else { + //m_message_label->set_text(""); + m_add_button->property_sensitive() = true; + } +} + + /** Sets the patch controller for this window and initializes everything. * * This function MUST be called before using the window in any way! diff --git a/src/progs/ingenuity/LoadPluginWindow.h b/src/progs/ingenuity/LoadPluginWindow.h index 00035b13..9d875358 100644 --- a/src/progs/ingenuity/LoadPluginWindow.h +++ b/src/progs/ingenuity/LoadPluginWindow.h @@ -107,6 +107,7 @@ private: //void ok_clicked(); void filter_changed(); void clear_clicked(); + void name_changed(); void plugin_activated(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* col); void plugin_selection_changed(); diff --git a/src/progs/ingenuity/PatchController.cpp b/src/progs/ingenuity/PatchController.cpp index 84c6eb7b..6ef90d32 100644 --- a/src/progs/ingenuity/PatchController.cpp +++ b/src/progs/ingenuity/PatchController.cpp @@ -423,9 +423,9 @@ PatchController::add_node(CountedPtr<NodeModel> object) node->y(y); // Set zoom to 1.0 so module isn't messed up (Death to GnomeCanvas) - float old_zoom = m_patch_view->canvas()->zoom(); + float old_zoom = m_patch_view->canvas()->get_zoom(); if (old_zoom != 1.0) - m_patch_view->canvas()->zoom(1.0); + m_patch_view->canvas()->set_zoom(1.0); nc->create_module(m_patch_view->canvas()); assert(nc->module()); @@ -433,7 +433,7 @@ PatchController::add_node(CountedPtr<NodeModel> object) // Reset zoom if (old_zoom != 1.0) { - m_patch_view->canvas()->zoom(old_zoom); + m_patch_view->canvas()->set_zoom(old_zoom); nc->module()->zoom(old_zoom); } } @@ -496,17 +496,13 @@ PatchController::add_port(CountedPtr<PortModel> pm) if (m_patch_view != NULL) { // Set zoom to 1.0 so module isn't messed up (Death to GnomeCanvas) - float old_zoom = m_patch_view->canvas()->zoom(); - if (old_zoom != 1.0) - m_patch_view->canvas()->zoom(1.0); + float old_zoom = m_patch_view->canvas()->get_zoom(); + m_patch_view->canvas()->set_zoom(1.0); pc->create_module(m_patch_view->canvas()); // Reset zoom - if (old_zoom != 1.0) { - m_patch_view->canvas()->zoom(old_zoom); - pc->module()->zoom(old_zoom); - } + pc->module()->zoom(old_zoom); } if (m_control_window != NULL) { diff --git a/src/progs/ingenuity/PatchView.cpp b/src/progs/ingenuity/PatchView.cpp index eb1fc1ce..bce44369 100644 --- a/src/progs/ingenuity/PatchView.cpp +++ b/src/progs/ingenuity/PatchView.cpp @@ -42,12 +42,16 @@ PatchView::PatchView(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::X { property_visible() = false; - xml->get_widget("patch_view_scrolledwindow", _canvas_scrolledwindow); + xml->get_widget("patch_view_breadcrumb_container", _breadcrumb_container); + xml->get_widget("patch_view_process_but", _process_but); + xml->get_widget("patch_view_poly_spin", _poly_spin); + xml->get_widget("patch_view_clear_but", _clear_but); + xml->get_widget("patch_view_destroy_but", _destroy_but); + xml->get_widget("patch_view_refresh_but", _refresh_but); + xml->get_widget("patch_view_save_but", _save_but); xml->get_widget("patch_view_zoom_full_but", _zoom_full_but); xml->get_widget("patch_view_zoom_normal_but", _zoom_normal_but); - xml->get_widget("patch_view_poly_spin", _poly_spin); - xml->get_widget("patch_view_process_but", _process_but); - xml->get_widget("patch_view_breadcrumb_container", _breadcrumb_container); + xml->get_widget("patch_view_scrolledwindow", _canvas_scrolledwindow); _process_but->signal_toggled().connect(sigc::mem_fun(this, &PatchView::process_toggled)); } @@ -64,7 +68,7 @@ PatchView::patch_controller(PatchController* pc) _patch = pc; _canvas = new OmFlowCanvas(pc, 1600*2, 1200*2); - + _canvas_scrolledwindow->add(*_canvas); //_canvas->show(); //_canvas_scrolledwindow->show(); @@ -75,6 +79,9 @@ PatchView::patch_controller(PatchController* pc) pc->patch_model()->enabled_sig.connect(sigc::mem_fun(this, &PatchView::enable)); pc->patch_model()->disabled_sig.connect(sigc::mem_fun(this, &PatchView::disable)); + + _zoom_normal_but->signal_clicked().connect(sigc::bind(sigc::mem_fun(static_cast<FlowCanvas*>(_canvas), &FlowCanvas::set_zoom), 1.0)); + _zoom_full_but->signal_clicked().connect(sigc::mem_fun(static_cast<FlowCanvas*>(_canvas), &FlowCanvas::zoom_full)); } diff --git a/src/progs/ingenuity/PatchView.h b/src/progs/ingenuity/PatchView.h index 7f91f6cf..3c507b94 100644 --- a/src/progs/ingenuity/PatchView.h +++ b/src/progs/ingenuity/PatchView.h @@ -68,6 +68,8 @@ public: void enable(); void disable(); + void zoom_full(); + private: PatchController* _patch; OmFlowCanvas* _canvas; |