summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2006-06-15 08:22:48 +0000
committerDavid Robillard <d@drobilla.net>2006-06-15 08:22:48 +0000
commit55c6e4c46d388189e35329a6519b9afa86f029fa (patch)
treea65e43a34a7dce7aa2c599ce39e7388e14c193cc /src
parent94c0fff479da5e81dede855cf5c382cf23aadf7d (diff)
downloadingen-55c6e4c46d388189e35329a6519b9afa86f029fa.tar.gz
ingen-55c6e4c46d388189e35329a6519b9afa86f029fa.tar.bz2
ingen-55c6e4c46d388189e35329a6519b9afa86f029fa.zip
Switched patch "description" window into a properties window (hopefully to extend
in the future) git-svn-id: http://svn.drobilla.net/lad/grauph@40 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/progs/gtk/Makefile.am4
-rw-r--r--src/progs/gtk/NodeController.h2
-rw-r--r--src/progs/gtk/NodePropertiesWindow.cpp8
-rw-r--r--src/progs/gtk/PatchController.cpp34
-rw-r--r--src/progs/gtk/PatchController.h6
-rw-r--r--src/progs/gtk/PatchPropertiesWindow.cpp (renamed from src/progs/gtk/PatchDescriptionWindow.cpp)22
-rw-r--r--src/progs/gtk/PatchPropertiesWindow.h (renamed from src/progs/gtk/PatchDescriptionWindow.h)12
-rw-r--r--src/progs/gtk/PatchView.cpp2
-rw-r--r--src/progs/gtk/PatchWindow.cpp27
-rw-r--r--src/progs/gtk/PatchWindow.h7
-rw-r--r--src/progs/gtk/om_gtk.glade14
-rw-r--r--src/progs/gtk/om_gtk.glade.bak2
12 files changed, 76 insertions, 64 deletions
diff --git a/src/progs/gtk/Makefile.am b/src/progs/gtk/Makefile.am
index 16c99949..3bf779a8 100644
--- a/src/progs/gtk/Makefile.am
+++ b/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/src/progs/gtk/NodeController.h b/src/progs/gtk/NodeController.h
index 54c103b5..3168bc7b 100644
--- a/src/progs/gtk/NodeController.h
+++ b/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/src/progs/gtk/NodePropertiesWindow.cpp b/src/progs/gtk/NodePropertiesWindow.cpp
index b0028864..abf5625c 100644
--- a/src/progs/gtk/NodePropertiesWindow.cpp
+++ b/src/progs/gtk/NodePropertiesWindow.cpp
@@ -53,9 +53,11 @@ NodePropertiesWindow::set_node(CountedPtr<NodeModel> node_model)
CountedPtr<PluginModel> 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/src/progs/gtk/PatchController.cpp b/src/progs/gtk/PatchController.cpp
index 8246efa6..20dcc096 100644
--- a/src/progs/gtk/PatchController.cpp
+++ b/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<PatchModel> 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<Gnome::Glade::Xml> 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<ConnectionModel> 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<NodeModel> 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<NodeModel> object)
CountedPtr<NodeModel> node(object);
if (node) {
- cerr << "\tNode Child\n";
assert(node->parent() == m_patch_model);
NodeController* nc = NULL;
CountedPtr<PatchModel> 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<NodeModel> object)
}
}
-
-
- /*CountedPtr<PortModel> port(object);
- if (port) {
- cerr << "\tPort Child??\n";
- //assert(port->parent() == m_patch_model);
- }*/
}
diff --git a/src/progs/gtk/PatchController.h b/src/progs/gtk/PatchController.h
index 236fd0b6..eff525c8 100644
--- a/src/progs/gtk/PatchController.h
+++ b/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<ConnectionModel> 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<PatchModel> m_patch_model;
diff --git a/src/progs/gtk/PatchDescriptionWindow.cpp b/src/progs/gtk/PatchPropertiesWindow.cpp
index 7ae154c3..6e17a1f7 100644
--- a/src/progs/gtk/PatchDescriptionWindow.cpp
+++ b/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 <string>
#include "PatchModel.h"
@@ -22,17 +22,17 @@ namespace OmGtk {
using std::string;
-PatchDescriptionWindow::PatchDescriptionWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& glade_xml)
+PatchPropertiesWindow::PatchPropertiesWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& 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<PatchModel> patch_model)
+PatchPropertiesWindow::patch_model(CountedPtr<PatchModel> patch_model)
{
property_title() = patch_model->path() + " Properties";
m_patch_model = patch_model;
@@ -52,7 +52,7 @@ PatchDescriptionWindow::patch_model(CountedPtr<PatchModel> 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/src/progs/gtk/PatchDescriptionWindow.h b/src/progs/gtk/PatchPropertiesWindow.h
index 0ad8b286..adca6e75 100644
--- a/src/progs/gtk/PatchDescriptionWindow.h
+++ b/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 <string>
#include <gtkmm.h>
@@ -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<Gnome::Glade::Xml>& refGlade);
+ PatchPropertiesWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& refGlade);
void patch_model(CountedPtr<PatchModel> patch_model);
@@ -57,4 +57,4 @@ private:
} // namespace OmGtk
-#endif // PATCHDESCRIPTIONWINDOW_H
+#endif // PATCHPROPERTIESWINDOW_H
diff --git a/src/progs/gtk/PatchView.cpp b/src/progs/gtk/PatchView.cpp
index e89428e9..4d421979 100644
--- a/src/progs/gtk/PatchView.cpp
+++ b/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/src/progs/gtk/PatchWindow.cpp b/src/progs/gtk/PatchWindow.cpp
index 9387257f..8211e653 100644
--- a/src/progs/gtk/PatchWindow.cpp
+++ b/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::RefPtr<Gnome::Glad
xml->get_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::RefPtr<Gnome::Glad
m_menu_fullscreen->signal_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<PatchController*>(
+ 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/src/progs/gtk/PatchWindow.h b/src/progs/gtk/PatchWindow.h
index 54ea11ef..42fba478 100644
--- a/src/progs/gtk/PatchWindow.h
+++ b/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/src/progs/gtk/om_gtk.glade b/src/progs/gtk/om_gtk.glade
index abe5f254..bbf98197 100644
--- a/src/progs/gtk/om_gtk.glade
+++ b/src/progs/gtk/om_gtk.glade
@@ -1252,7 +1252,7 @@
<widget class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
- <property name="spacing">10</property>
+ <property name="spacing">24</property>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area1">
@@ -1606,7 +1606,7 @@
<child internal-child="vbox">
<widget class="GtkVBox" id="vbox11">
<property name="homogeneous">False</property>
- <property name="spacing">8</property>
+ <property name="spacing">24</property>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="hbuttonbox1">
@@ -2476,7 +2476,7 @@
</child>
</widget>
-<widget class="GtkWindow" id="patch_description_win">
+<widget class="GtkWindow" id="patch_properties_win">
<property name="border_width">8</property>
<property name="width_request">400</property>
<property name="height_request">200</property>
@@ -2533,7 +2533,7 @@
</child>
<child>
- <widget class="GtkEntry" id="description_author_entry">
+ <widget class="GtkEntry" id="properties_author_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
@@ -2568,7 +2568,7 @@
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
- <widget class="GtkTextView" id="description_description_textview">
+ <widget class="GtkTextView" id="properties_description_textview">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">A short description of the patch to be included in the patch file</property>
<property name="can_focus">True</property>
@@ -2602,7 +2602,7 @@
<property name="spacing">5</property>
<child>
- <widget class="GtkButton" id="description_cancel_button">
+ <widget class="GtkButton" id="properties_cancel_button">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
@@ -2614,7 +2614,7 @@
</child>
<child>
- <widget class="GtkButton" id="description_ok_button">
+ <widget class="GtkButton" id="properties_ok_button">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Apply these changes to be saved the next time the patch is saved</property>
<property name="can_default">True</property>
diff --git a/src/progs/gtk/om_gtk.glade.bak b/src/progs/gtk/om_gtk.glade.bak
index 7714d1f3..508ee6b1 100644
--- a/src/progs/gtk/om_gtk.glade.bak
+++ b/src/progs/gtk/om_gtk.glade.bak
@@ -2476,7 +2476,7 @@
</child>
</widget>
-<widget class="GtkWindow" id="patch_description_win">
+<widget class="GtkWindow" id="patch_properties_win">
<property name="border_width">8</property>
<property name="width_request">400</property>
<property name="height_request">200</property>