From f0d0c5cc23e60d25c601ab7ae50314b3095aee1f Mon Sep 17 00:00:00 2001 From: dave Date: Thu, 15 Jun 2006 08:22:48 +0000 Subject: [PATCH] Switched patch "description" window into a properties window (hopefully to extend in the future) git-svn-id: http://svn.drobilla.net/lad@40 a436a847-0d15-0410-975c-d299462d15a1 --- grauph/src/progs/gtk/Makefile.am | 4 +-- grauph/src/progs/gtk/NodeController.h | 2 +- grauph/src/progs/gtk/NodePropertiesWindow.cpp | 8 +++-- grauph/src/progs/gtk/PatchController.cpp | 34 ++++++++++++------- grauph/src/progs/gtk/PatchController.h | 6 +++- ...onWindow.cpp => PatchPropertiesWindow.cpp} | 22 ++++++------ ...iptionWindow.h => PatchPropertiesWindow.h} | 12 +++---- grauph/src/progs/gtk/PatchView.cpp | 2 +- grauph/src/progs/gtk/PatchWindow.cpp | 27 +++++++-------- grauph/src/progs/gtk/PatchWindow.h | 7 ++-- grauph/src/progs/gtk/om_gtk.glade | 14 ++++---- grauph/src/progs/gtk/om_gtk.glade.bak | 2 +- 12 files changed, 76 insertions(+), 64 deletions(-) rename grauph/src/progs/gtk/{PatchDescriptionWindow.cpp => PatchPropertiesWindow.cpp} (73%) rename grauph/src/progs/gtk/{PatchDescriptionWindow.h => PatchPropertiesWindow.h} (82%) diff --git a/grauph/src/progs/gtk/Makefile.am b/grauph/src/progs/gtk/Makefile.am index 16c99949..3bf779a8 100644 --- a/grauph/src/progs/gtk/Makefile.am +++ b/grauph/src/progs/gtk/Makefile.am @@ -72,8 +72,8 @@ om_gtk_SOURCES = \ NewSubpatchWindow.cpp \ ConfigWindow.h \ ConfigWindow.cpp \ - PatchDescriptionWindow.h \ - PatchDescriptionWindow.cpp \ + PatchPropertiesWindow.h \ + PatchPropertiesWindow.cpp \ Loader.h \ Loader.cpp \ RenameWindow.h \ diff --git a/grauph/src/progs/gtk/NodeController.h b/grauph/src/progs/gtk/NodeController.h index 54c103b5..3168bc7b 100644 --- a/grauph/src/progs/gtk/NodeController.h +++ b/grauph/src/progs/gtk/NodeController.h @@ -77,8 +77,8 @@ public: void control_window(NodeControlWindow* cw) { m_control_window = cw; } virtual void show_control_window(); + virtual void show_properties_window(); void show_rename_window(); - void show_properties_window(); bool has_control_inputs(); diff --git a/grauph/src/progs/gtk/NodePropertiesWindow.cpp b/grauph/src/progs/gtk/NodePropertiesWindow.cpp index b0028864..abf5625c 100644 --- a/grauph/src/progs/gtk/NodePropertiesWindow.cpp +++ b/grauph/src/progs/gtk/NodePropertiesWindow.cpp @@ -53,9 +53,11 @@ NodePropertiesWindow::set_node(CountedPtr node_model) CountedPtr pm = node_model->plugin(); - m_plugin_type_label->set_text(pm->type_string()); - m_plugin_uri_label->set_text(pm->uri()); - m_plugin_name_label->set_text(pm->name()); + if (pm) { + m_plugin_type_label->set_text(pm->type_string()); + m_plugin_uri_label->set_text(pm->uri()); + m_plugin_name_label->set_text(pm->name()); + } } diff --git a/grauph/src/progs/gtk/PatchController.cpp b/grauph/src/progs/gtk/PatchController.cpp index 8246efa6..20dcc096 100644 --- a/grauph/src/progs/gtk/PatchController.cpp +++ b/grauph/src/progs/gtk/PatchController.cpp @@ -40,6 +40,7 @@ #include "PortController.h" #include "App.h" #include "PatchTreeWindow.h" +#include "PatchPropertiesWindow.h" #include "DSSIController.h" #include "PatchModel.h" #include "Store.h" @@ -53,6 +54,7 @@ namespace OmGtk { PatchController::PatchController(CountedPtr model) : NodeController(model), + m_properties_window(NULL), m_window(NULL), m_patch_view(NULL), m_patch_model(model), @@ -349,6 +351,20 @@ PatchController::create_view() } +void +PatchController::show_properties_window() +{ + if (!m_properties_window) { + Glib::RefPtr glade_xml = GladeFactory::new_glade_reference(); + glade_xml->get_widget_derived("patch_properties_win", m_properties_window); + m_properties_window->patch_model(patch_model()); + } + + m_properties_window->show(); + +} + + /** Create a connection in the view (canvas). */ void @@ -387,11 +403,14 @@ PatchController::create_connection(CountedPtr cm) } +/** Add a child node to this patch. + * + * This is for plugin nodes and patches, and is responsible for creating the + * GtkObjectController for @a object (and through that the View if necessary) + */ void PatchController::add_node(CountedPtr object) { - cerr << "ADD NODE\n"; - assert(object); assert(object->parent() == m_patch_model); assert(object->path().parent() == m_patch_model->path()); @@ -405,19 +424,15 @@ PatchController::add_node(CountedPtr object) CountedPtr node(object); if (node) { - cerr << "\tNode Child\n"; assert(node->parent() == m_patch_model); NodeController* nc = NULL; CountedPtr patch(node); if (patch) { - cerr << "\t.. is a Patch Child\n"; assert(patch->parent() == m_patch_model); - nc = new PatchController(patch); } else { - cerr << "\t... is a Plugin Node Child\n"; assert(node->plugin()); if (node->plugin()->type() == PluginModel::DSSI) nc = new DSSIController(node); @@ -465,13 +480,6 @@ PatchController::add_node(CountedPtr object) } } - - - /*CountedPtr port(object); - if (port) { - cerr << "\tPort Child??\n"; - //assert(port->parent() == m_patch_model); - }*/ } diff --git a/grauph/src/progs/gtk/PatchController.h b/grauph/src/progs/gtk/PatchController.h index 236fd0b6..eff525c8 100644 --- a/grauph/src/progs/gtk/PatchController.h +++ b/grauph/src/progs/gtk/PatchController.h @@ -41,6 +41,7 @@ class SubpatchModule; class Controller; class OmFlowCanvas; class NodeControlWindow; +class PatchPropertiesWindow; class ControlPanel; class PatchView; class NodeController; @@ -81,6 +82,7 @@ public: void get_new_module_location(int& x, int& y); void show_control_window(); + void show_properties_window(); void show_patch_window(); void claim_patch_view(); @@ -111,7 +113,9 @@ private: void create_connection(CountedPtr cm); - PatchWindow* m_window; ///< Window currently showing this patch + PatchPropertiesWindow* m_properties_window; + + PatchWindow* m_window; ///< Patch Window currently showing m_patch_view PatchView* m_patch_view; ///< View (canvas) of this patch CountedPtr m_patch_model; diff --git a/grauph/src/progs/gtk/PatchDescriptionWindow.cpp b/grauph/src/progs/gtk/PatchPropertiesWindow.cpp similarity index 73% rename from grauph/src/progs/gtk/PatchDescriptionWindow.cpp rename to grauph/src/progs/gtk/PatchPropertiesWindow.cpp index 7ae154c3..6e17a1f7 100644 --- a/grauph/src/progs/gtk/PatchDescriptionWindow.cpp +++ b/grauph/src/progs/gtk/PatchPropertiesWindow.cpp @@ -14,7 +14,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "PatchDescriptionWindow.h" +#include "PatchPropertiesWindow.h" #include #include "PatchModel.h" @@ -22,17 +22,17 @@ namespace OmGtk { using std::string; -PatchDescriptionWindow::PatchDescriptionWindow(BaseObjectType* cobject, const Glib::RefPtr& glade_xml) +PatchPropertiesWindow::PatchPropertiesWindow(BaseObjectType* cobject, const Glib::RefPtr& glade_xml) : Gtk::Window(cobject) , m_patch_model(NULL) { - glade_xml->get_widget("description_author_entry", m_author_entry); - glade_xml->get_widget("description_description_textview", m_textview); - glade_xml->get_widget("description_cancel_button", m_cancel_button); - glade_xml->get_widget("description_ok_button", m_ok_button); + glade_xml->get_widget("properties_author_entry", m_author_entry); + glade_xml->get_widget("properties_description_textview", m_textview); + glade_xml->get_widget("properties_cancel_button", m_cancel_button); + glade_xml->get_widget("properties_ok_button", m_ok_button); - m_cancel_button->signal_clicked().connect(sigc::mem_fun(this, &PatchDescriptionWindow::cancel_clicked)); - m_ok_button->signal_clicked().connect(sigc::mem_fun(this, &PatchDescriptionWindow::ok_clicked)); + m_cancel_button->signal_clicked().connect(sigc::mem_fun(this, &PatchPropertiesWindow::cancel_clicked)); + m_ok_button->signal_clicked().connect(sigc::mem_fun(this, &PatchPropertiesWindow::ok_clicked)); } @@ -42,7 +42,7 @@ PatchDescriptionWindow::PatchDescriptionWindow(BaseObjectType* cobject, const Gl * the window in any way. */ void -PatchDescriptionWindow::patch_model(CountedPtr patch_model) +PatchPropertiesWindow::patch_model(CountedPtr patch_model) { property_title() = patch_model->path() + " Properties"; m_patch_model = patch_model; @@ -52,7 +52,7 @@ PatchDescriptionWindow::patch_model(CountedPtr patch_model) void -PatchDescriptionWindow::cancel_clicked() +PatchPropertiesWindow::cancel_clicked() { m_author_entry->set_text(m_patch_model->get_metadata("author")); m_textview->get_buffer()->set_text(m_patch_model->get_metadata("description")); @@ -61,7 +61,7 @@ PatchDescriptionWindow::cancel_clicked() void -PatchDescriptionWindow::ok_clicked() +PatchPropertiesWindow::ok_clicked() { m_patch_model->set_metadata("author", m_author_entry->get_text()); m_patch_model->set_metadata("description", m_textview->get_buffer()->get_text()); diff --git a/grauph/src/progs/gtk/PatchDescriptionWindow.h b/grauph/src/progs/gtk/PatchPropertiesWindow.h similarity index 82% rename from grauph/src/progs/gtk/PatchDescriptionWindow.h rename to grauph/src/progs/gtk/PatchPropertiesWindow.h index 0ad8b286..adca6e75 100644 --- a/grauph/src/progs/gtk/PatchDescriptionWindow.h +++ b/grauph/src/progs/gtk/PatchPropertiesWindow.h @@ -14,8 +14,8 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef PATCHDESCRIPTIONWINDOW_H -#define PATCHDESCRIPTIONWINDOW_H +#ifndef PATCHPROPERTIESWINDOW_H +#define PATCHPROPERTIESWINDOW_H #include #include @@ -29,16 +29,16 @@ using LibOmClient::PatchModel; namespace OmGtk { -/** Patch Description Window. +/** Patch Properties Window. * * Loaded by libglade as a derived object. * * \ingroup OmGtk */ -class PatchDescriptionWindow : public Gtk::Window +class PatchPropertiesWindow : public Gtk::Window { public: - PatchDescriptionWindow(BaseObjectType* cobject, const Glib::RefPtr& refGlade); + PatchPropertiesWindow(BaseObjectType* cobject, const Glib::RefPtr& refGlade); void patch_model(CountedPtr patch_model); @@ -57,4 +57,4 @@ private: } // namespace OmGtk -#endif // PATCHDESCRIPTIONWINDOW_H +#endif // PATCHPROPERTIESWINDOW_H diff --git a/grauph/src/progs/gtk/PatchView.cpp b/grauph/src/progs/gtk/PatchView.cpp index e89428e9..4d421979 100644 --- a/grauph/src/progs/gtk/PatchView.cpp +++ b/grauph/src/progs/gtk/PatchView.cpp @@ -26,7 +26,7 @@ #include "NewSubpatchWindow.h" #include "LoadSubpatchWindow.h" #include "NodeControlWindow.h" -#include "PatchDescriptionWindow.h" +#include "PatchPropertiesWindow.h" #include "PatchTreeWindow.h" #include "Controller.h" diff --git a/grauph/src/progs/gtk/PatchWindow.cpp b/grauph/src/progs/gtk/PatchWindow.cpp index 9387257f..8211e653 100644 --- a/grauph/src/progs/gtk/PatchWindow.cpp +++ b/grauph/src/progs/gtk/PatchWindow.cpp @@ -28,7 +28,7 @@ #include "LoadPatchWindow.h" #include "LoadSubpatchWindow.h" #include "NodeControlWindow.h" -#include "PatchDescriptionWindow.h" +#include "PatchPropertiesWindow.h" #include "ConfigWindow.h" #include "MessagesWindow.h" #include "PatchTreeWindow.h" @@ -79,13 +79,11 @@ PatchWindow::PatchWindow(BaseObjectType* cobject, const Glib::RefPtrget_widget_derived("new_subpatch_win", m_new_subpatch_window); xml->get_widget_derived("load_patch_win", m_load_patch_window); xml->get_widget_derived("load_subpatch_win", m_load_subpatch_window); - xml->get_widget_derived("patch_description_win", m_description_window); //m_load_plugin_window->set_transient_for(*this); m_new_subpatch_window->set_transient_for(*this); m_load_patch_window->set_transient_for(*this); m_load_subpatch_window->set_transient_for(*this); - m_description_window->set_transient_for(*this); m_menu_view_control_window->property_sensitive() = false; //m_status_bar->push(Controller::instance().engine_url()); @@ -110,9 +108,9 @@ PatchWindow::PatchWindow(BaseObjectType* cobject, const Glib::RefPtrsignal_toggled().connect( sigc::mem_fun(this, &PatchWindow::event_fullscreen_toggled)); m_menu_view_control_window->signal_activate().connect( - sigc::mem_fun(this, &PatchWindow::show_control_window)); + sigc::mem_fun(this, &PatchWindow::event_show_controls)); m_menu_view_patch_description->signal_activate().connect( - sigc::mem_fun(this, &PatchWindow::show_description_window)); + sigc::mem_fun(this, &PatchWindow::event_show_properties)); m_menu_destroy_patch->signal_activate().connect( sigc::mem_fun(this, &PatchWindow::event_destroy)); m_menu_clear->signal_activate().connect( @@ -201,7 +199,7 @@ PatchWindow::patch_controller(PatchController* pc) set_title(m_patch->model()->path()); - m_description_window->patch_model(pc->patch_model()); + //m_properties_window->patch_model(pc->patch_model()); // Setup breadcrumbs box @@ -283,10 +281,11 @@ PatchWindow::rebuild_breadcrumbs() void PatchWindow::breadcrumb_clicked(BreadCrumb* crumb) { - cerr << "FIXME: crumb\n"; - /* if (m_enable_signal) { - PatchController* const pc = crumb->patch(); + // FIXME: check to be sure PatchModel exists, then controller - maybe + // even make a controller if there isn't one? + PatchController* const pc = dynamic_cast( + Store::instance().patch(crumb->path())->controller()); assert(pc != NULL); if (pc == m_patch) { @@ -298,22 +297,22 @@ PatchWindow::breadcrumb_clicked(BreadCrumb* crumb) patch_controller(pc); } } - */ } void -PatchWindow::show_control_window() +PatchWindow::event_show_controls() { - if (m_patch != NULL) + if (m_patch) m_patch->show_control_window(); } void -PatchWindow::show_description_window() +PatchWindow::event_show_properties() { - m_description_window->show(); + if (m_patch) + m_patch->show_properties_window(); } diff --git a/grauph/src/progs/gtk/PatchWindow.h b/grauph/src/progs/gtk/PatchWindow.h index 54ea11ef..42fba478 100644 --- a/grauph/src/progs/gtk/PatchWindow.h +++ b/grauph/src/progs/gtk/PatchWindow.h @@ -69,9 +69,6 @@ public: LoadSubpatchWindow* load_subpatch_window() const { return m_load_subpatch_window; } NewSubpatchWindow* new_subpatch_window() const { return m_new_subpatch_window; } - void show_control_window(); - void show_description_window(); - // Breadcrumb management void node_removed(const string& name); void node_renamed(const string& old_path, const string& new_path); @@ -96,13 +93,15 @@ private: void event_destroy(); void event_clear(); void event_fullscreen_toggled(); + void event_show_properties(); + void event_show_controls(); + PatchController* m_patch; LoadPluginWindow* m_load_plugin_window; LoadPatchWindow* m_load_patch_window; NewSubpatchWindow* m_new_subpatch_window; LoadSubpatchWindow* m_load_subpatch_window; - PatchDescriptionWindow* m_description_window; bool m_enable_signal; bool m_position_stored; diff --git a/grauph/src/progs/gtk/om_gtk.glade b/grauph/src/progs/gtk/om_gtk.glade index abe5f254..bbf98197 100644 --- a/grauph/src/progs/gtk/om_gtk.glade +++ b/grauph/src/progs/gtk/om_gtk.glade @@ -1252,7 +1252,7 @@ True False - 10 + 24 @@ -1606,7 +1606,7 @@ False - 8 + 24 @@ -2476,7 +2476,7 @@ - + 8 400 200 @@ -2533,7 +2533,7 @@ - + True True True @@ -2568,7 +2568,7 @@ GTK_CORNER_TOP_LEFT - + True A short description of the patch to be included in the patch file True @@ -2602,7 +2602,7 @@ 5 - + True True True @@ -2614,7 +2614,7 @@ - + True Apply these changes to be saved the next time the patch is saved True diff --git a/grauph/src/progs/gtk/om_gtk.glade.bak b/grauph/src/progs/gtk/om_gtk.glade.bak index 7714d1f3..508ee6b1 100644 --- a/grauph/src/progs/gtk/om_gtk.glade.bak +++ b/grauph/src/progs/gtk/om_gtk.glade.bak @@ -2476,7 +2476,7 @@ - + 8 400 200