summaryrefslogtreecommitdiffstats
path: root/src/progs
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2006-06-18 08:06:14 +0000
committerDavid Robillard <d@drobilla.net>2006-06-18 08:06:14 +0000
commit172a0119ee0a0bb6d50836c70936907c3eb71c9e (patch)
treecbcc56285b033bb9857b9be85f5f9be193b6f38f /src/progs
parente6f42fd640dcbad6b2e39cc85bdf307d197278b0 (diff)
downloadingen-172a0119ee0a0bb6d50836c70936907c3eb71c9e.tar.gz
ingen-172a0119ee0a0bb6d50836c70936907c3eb71c9e.tar.bz2
ingen-172a0119ee0a0bb6d50836c70936907c3eb71c9e.zip
More work on new ports implementation;
lots of mass renaming and code removal. git-svn-id: http://svn.drobilla.net/lad/grauph@52 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/progs')
-rw-r--r--src/progs/gtk/OmFlowCanvas.cpp96
-rw-r--r--src/progs/gtk/OmFlowCanvas.h15
-rw-r--r--src/progs/gtk/PatchController.h4
-rw-r--r--src/progs/gtk/PortController.cpp12
4 files changed, 118 insertions, 9 deletions
diff --git a/src/progs/gtk/OmFlowCanvas.cpp b/src/progs/gtk/OmFlowCanvas.cpp
index 863ba014..4920dc59 100644
--- a/src/progs/gtk/OmFlowCanvas.cpp
+++ b/src/progs/gtk/OmFlowCanvas.cpp
@@ -51,16 +51,39 @@ OmFlowCanvas::OmFlowCanvas(PatchController* controller, int width, int height)
Glib::RefPtr<Gnome::Glade::Xml> xml = GladeFactory::new_glade_reference();
xml->get_widget("canvas_menu", m_menu);
+ xml->get_widget("canvas_menu_add_audio_input", m_menu_add_audio_input);
+ xml->get_widget("canvas_menu_add_audio_output", m_menu_add_audio_output);
+ xml->get_widget("canvas_menu_add_control_input", m_menu_add_control_input);
+ xml->get_widget("canvas_menu_add_control_output", m_menu_add_control_output);
+ xml->get_widget("canvas_menu_add_midi_input", m_menu_add_midi_input);
+ xml->get_widget("canvas_menu_add_midi_output", m_menu_add_midi_output);
xml->get_widget("canvas_menu_load_plugin", m_menu_load_plugin);
xml->get_widget("canvas_menu_load_patch", m_menu_load_patch);
xml->get_widget("canvas_menu_new_patch", m_menu_new_patch);
- m_menu_load_plugin->signal_activate().connect(
- sigc::mem_fun<void>(this, &OmFlowCanvas::menu_load_plugin));
- m_menu_load_patch->signal_activate().connect(
- sigc::mem_fun<void>(this, &OmFlowCanvas::menu_load_patch));
- m_menu_new_patch->signal_activate().connect(
- sigc::mem_fun<void>(this, &OmFlowCanvas::menu_new_patch));
+ // Add port menu items
+ m_menu_add_audio_input->signal_activate().connect(
+ sigc::bind(sigc::mem_fun(this, &OmFlowCanvas::menu_add_port),
+ "audio_input", "AUDIO", false));
+ m_menu_add_audio_output->signal_activate().connect(
+ sigc::bind(sigc::mem_fun(this, &OmFlowCanvas::menu_add_port),
+ "audio_output", "AUDIO", true));
+ m_menu_add_control_input->signal_activate().connect(
+ sigc::bind(sigc::mem_fun(this, &OmFlowCanvas::menu_add_port),
+ "control_input", "CONTROL", false));
+ m_menu_add_control_output->signal_activate().connect(
+ sigc::bind(sigc::mem_fun(this, &OmFlowCanvas::menu_add_port),
+ "control_output", "CONTROL", true));
+ m_menu_add_midi_input->signal_activate().connect(
+ sigc::bind(sigc::mem_fun(this, &OmFlowCanvas::menu_add_port),
+ "midi_input", "MIDI", false));
+ m_menu_add_midi_output->signal_activate().connect(
+ sigc::bind(sigc::mem_fun(this, &OmFlowCanvas::menu_add_port),
+ "midi_output", "MIDI", true));
+
+ m_menu_load_plugin->signal_activate().connect(sigc::mem_fun(this, &OmFlowCanvas::menu_load_plugin));
+ m_menu_load_patch->signal_activate().connect(sigc::mem_fun(this, &OmFlowCanvas::menu_load_patch));
+ m_menu_new_patch->signal_activate().connect(sigc::mem_fun(this, &OmFlowCanvas::menu_new_patch));
}
@@ -150,6 +173,67 @@ OmFlowCanvas::destroy_selected()
void
+OmFlowCanvas::menu_add_port(const string& name, const string& type, bool is_output)
+{
+ const Path& path = m_patch_controller->path().base_path() + name;
+ Controller::instance().create_port(path, type, is_output);
+
+ char temp_buf[16];
+ snprintf(temp_buf, 16, "%d", m_last_click_x);
+ Controller::instance().set_metadata(path, "module-x", temp_buf);
+ snprintf(temp_buf, 16, "%d", m_last_click_y);
+ Controller::instance().set_metadata(path, "module-y", temp_buf);
+}
+/*
+void
+OmFlowCanvas::menu_add_audio_input()
+{
+ string name = "audio_in";
+ Controller::instance().create_port(m_patch_controller->path().base_path() + name, "AUDIO", false);
+}
+
+
+void
+OmFlowCanvas::menu_add_audio_output()
+{
+ string name = "audio_out";
+ Controller::instance().create_port(m_patch_controller->path().base_path() + name, "AUDIO", true);
+}
+
+
+void
+OmFlowCanvas::menu_add_control_input()
+{
+ string name = "control_in";
+ Controller::instance().create_port(m_patch_controller->path().base_path() + name, "CONTROL", false);
+}
+
+
+void
+OmFlowCanvas::menu_add_control_output()
+{
+ string name = "control_out";
+ Controller::instance().create_port(m_patch_controller->path().base_path() + name, "CONTROL", true);
+}
+
+
+void
+OmFlowCanvas::menu_add_midi_input()
+{
+ string name = "midi_in";
+ Controller::instance().create_port(m_patch_controller->path().base_path() + name, "MIDI", false);
+}
+
+
+void
+OmFlowCanvas::menu_add_midi_output()
+{
+ string name = "midi_out";
+ Controller::instance().create_port(m_patch_controller->path().base_path() + name, "MIDI", true);
+}
+*/
+
+void
OmFlowCanvas::menu_load_plugin()
{
m_patch_controller->window()->load_plugin_window()->set_next_module_location(
diff --git a/src/progs/gtk/OmFlowCanvas.h b/src/progs/gtk/OmFlowCanvas.h
index 1871de80..c645d43f 100644
--- a/src/progs/gtk/OmFlowCanvas.h
+++ b/src/progs/gtk/OmFlowCanvas.h
@@ -52,16 +52,29 @@ public:
void show_menu(GdkEvent* event)
{ m_menu->popup(event->button.button, event->button.time); }
+private:
+ void menu_add_port(const string& name, const string& type, bool is_output);
+ /*void menu_add_audio_input();
+ void menu_add_audio_output();
+ void menu_add_control_input();
+ void menu_add_control_output();
+ void menu_add_midi_input();
+ void menu_add_midi_output();*/
void menu_load_plugin();
void menu_new_patch();
void menu_load_patch();
-private:
PatchController* m_patch_controller;
int m_last_click_x;
int m_last_click_y;
Gtk::Menu* m_menu;
+ Gtk::MenuItem* m_menu_add_audio_input;
+ Gtk::MenuItem* m_menu_add_audio_output;
+ Gtk::MenuItem* m_menu_add_control_input;
+ Gtk::MenuItem* m_menu_add_control_output;
+ Gtk::MenuItem* m_menu_add_midi_input;
+ Gtk::MenuItem* m_menu_add_midi_output;
Gtk::MenuItem* m_menu_load_plugin;
Gtk::MenuItem* m_menu_load_patch;
Gtk::MenuItem* m_menu_new_patch;
diff --git a/src/progs/gtk/PatchController.h b/src/progs/gtk/PatchController.h
index 04bc82a8..4dde58e3 100644
--- a/src/progs/gtk/PatchController.h
+++ b/src/progs/gtk/PatchController.h
@@ -94,8 +94,8 @@ public:
PatchWindow* window() const { return m_window; }
void window(PatchWindow* pw) { m_window = pw; }
- inline string name() const { return m_model->name(); }
- inline const string& path() const { return m_model->path(); }
+ inline string name() const { return m_model->name(); }
+ inline const Path& path() const { return m_model->path(); }
void set_path(const Path& new_path);
diff --git a/src/progs/gtk/PortController.cpp b/src/progs/gtk/PortController.cpp
index cdae49f7..a33a2122 100644
--- a/src/progs/gtk/PortController.cpp
+++ b/src/progs/gtk/PortController.cpp
@@ -101,6 +101,18 @@ PortController::metadata_update(const string& key, const string& value)
m_control_panel->set_range_max(m_model->path(), atof(value.c_str()));
}
+ if (m_module != NULL) {
+ if (key == "module-x") {
+ float x = atof(value.c_str());
+ //if (x > 0 && x < m_canvas->width())
+ m_module->move_to(x, m_module->property_y().get_value());
+ } else if (key == "module-y") {
+ float y = atof(value.c_str());
+ //if (y > 0 && y < m_canvas->height())
+ m_module->move_to(m_module->property_x().get_value(), y);
+ }
+ }
+
GtkObjectController::metadata_update(key, value);
}