From 1c736a348c59d98e4022fb02b49a8b4c93baa3d2 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 1 May 2012 22:30:55 +0000 Subject: Remove half baked control window stuff. The canvas is better anyway. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4309 a436a847-0d15-0410-975c-d299462d15a1 --- src/gui/App.cpp | 1 - src/gui/ControlPanel.cpp | 157 ---------------- src/gui/ControlPanel.hpp | 86 --------- src/gui/Controls.cpp | 396 --------------------------------------- src/gui/Controls.hpp | 153 --------------- src/gui/NodeControlWindow.cpp | 129 ------------- src/gui/NodeControlWindow.hpp | 72 ------- src/gui/NodeMenu.cpp | 18 -- src/gui/NodeMenu.hpp | 4 - src/gui/NodeModule.cpp | 14 +- src/gui/NodeModule.hpp | 1 - src/gui/PatchBox.cpp | 9 - src/gui/PatchBox.hpp | 2 - src/gui/PatchView.cpp | 1 - src/gui/PatchView.hpp | 1 - src/gui/PortPropertiesWindow.cpp | 1 - src/gui/SubpatchModule.cpp | 1 - src/gui/SubpatchModule.hpp | 1 - src/gui/WindowFactory.cpp | 63 ------- src/gui/WindowFactory.hpp | 18 +- src/gui/ingen_gui.ui | 9 - src/gui/wscript | 3 - 22 files changed, 5 insertions(+), 1135 deletions(-) delete mode 100644 src/gui/ControlPanel.cpp delete mode 100644 src/gui/ControlPanel.hpp delete mode 100644 src/gui/Controls.cpp delete mode 100644 src/gui/Controls.hpp delete mode 100644 src/gui/NodeControlWindow.cpp delete mode 100644 src/gui/NodeControlWindow.hpp (limited to 'src') diff --git a/src/gui/App.cpp b/src/gui/App.cpp index 9fd2c214..4d108c71 100644 --- a/src/gui/App.cpp +++ b/src/gui/App.cpp @@ -38,7 +38,6 @@ #include "App.hpp" #include "Configuration.hpp" #include "ConnectWindow.hpp" -#include "ControlPanel.hpp" #include "LoadPluginWindow.hpp" #include "MessagesWindow.hpp" #include "NodeModule.hpp" diff --git a/src/gui/ControlPanel.cpp b/src/gui/ControlPanel.cpp deleted file mode 100644 index ca838e53..00000000 --- a/src/gui/ControlPanel.cpp +++ /dev/null @@ -1,157 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 David Robillard - - Ingen is free software: you can redistribute it and/or modify it under the - terms of the GNU Affero General Public License as published by the Free - Software Foundation, either version 3 of the License, or any later version. - - Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. - - You should have received a copy of the GNU Affero General Public License - along with Ingen. If not, see . -*/ - -#include "ingen/Interface.hpp" -#include "ingen/shared/LV2URIMap.hpp" -#include "ingen/client/NodeModel.hpp" -#include "ingen/client/PortModel.hpp" -#include "ingen/client/PluginModel.hpp" -#include "App.hpp" -#include "ControlPanel.hpp" -#include "Controls.hpp" -#include "WidgetFactory.hpp" - -using namespace std; -using namespace Raul; - -namespace Ingen { - -using namespace Client; - -namespace GUI { - -ControlPanel::ControlPanel(BaseObjectType* cobject, - const Glib::RefPtr& xml) - : Gtk::HBox(cobject) - , _callback_enabled(true) -{ - xml->get_widget("control_panel_controls_box", _control_box); - - show_all(); -} - -ControlPanel::~ControlPanel() -{ - for (vector::iterator i = _controls.begin(); i != _controls.end(); ++i) - delete (*i); -} - -void -ControlPanel::init(App& app, SharedPtr node, uint32_t poly) -{ - assert(node != NULL); - assert(poly > 0); - - _app = &app; - - for (NodeModel::Ports::const_iterator i = node->ports().begin(); - i != node->ports().end(); ++i) { - add_port(*i); - } - - _callback_enabled = true; -} - -Control* -ControlPanel::find_port(const Path& path) const -{ - for (vector::const_iterator cg = _controls.begin(); cg != _controls.end(); ++cg) - if ((*cg)->port_model()->path() == path) - return (*cg); - - return NULL; -} - -/** Add a control to the panel for the given port. - */ -void -ControlPanel::add_port(SharedPtr pm) -{ - assert(pm); - - // Already have port, don't add another - if (find_port(pm->path()) != NULL) - return; - - Control* control = NULL; - - // Add port - if (pm->is_input()) { - if (pm->is_toggle()) { - ToggleControl* tc; - WidgetFactory::get_widget_derived("toggle_control", tc); - control = tc; - } else if (pm->is_a(_app->uris().lv2_ControlPort) - || pm->is_a(_app->uris().lv2_CVPort) - || pm->supports(_app->uris().atom_Float)) { - SliderControl* sc; - WidgetFactory::get_widget_derived("control_strip", sc); - control = sc; - } else if (pm->supports(_app->uris().atom_String)) { - StringControl* sc; - WidgetFactory::get_widget_derived("string_control", sc); - control = sc; - } - } - - if (control) { - control->init(*_app, this, pm); - - if (_controls.size() > 0) - _control_box->pack_start(*Gtk::manage(new Gtk::HSeparator()), false, false, 4); - - _controls.push_back(control); - _control_box->pack_start(*control, false, false, 0); - - control->enable(); - control->show(); - } - - Gtk::Requisition controls_size; - _control_box->size_request(controls_size); - _ideal_size.first = controls_size.width; - _ideal_size.second = controls_size.height; -} - -/** Remove the control for the given port. - */ -void -ControlPanel::remove_port(const Path& path) -{ - for (vector::iterator cg = _controls.begin(); cg != _controls.end(); ++cg) { - if ((*cg)->port_model()->path() == path) { - _control_box->remove(**cg); - _controls.erase(cg); - break; - } - } -} - -/** Callback for Controls to notify this of a change. - */ -void -ControlPanel::value_changed_atom(SharedPtr port, - const Raul::Atom& val) -{ - if (_callback_enabled) { - _app->engine()->set_property(port->path(), - _app->uris().ingen_value, - val); - } -} - -} // namespace GUI -} // namespace Ingen diff --git a/src/gui/ControlPanel.hpp b/src/gui/ControlPanel.hpp deleted file mode 100644 index 50bdfb26..00000000 --- a/src/gui/ControlPanel.hpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 David Robillard - - Ingen is free software: you can redistribute it and/or modify it under the - terms of the GNU Affero General Public License as published by the Free - Software Foundation, either version 3 of the License, or any later version. - - Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. - - You should have received a copy of the GNU Affero General Public License - along with Ingen. If not, see . -*/ - -#ifndef INGEN_GUI_CONTROLPANEL_HPP -#define INGEN_GUI_CONTROLPANEL_HPP - -#include -#include -#include - -#include - -#include "Controls.hpp" - -namespace Raul { class Path; } - -namespace Ingen { - -namespace Client { - class PortModel; - class NodeModel; -} - -namespace GUI { - -class App; - -/** A group of controls for a node (or patch). - * - * Used by both NodeControlWindow and the main window (for patch controls). - * - * \ingroup GUI - */ -class ControlPanel : public Gtk::HBox { -public: - ControlPanel(BaseObjectType* cobject, - const Glib::RefPtr& xml); - virtual ~ControlPanel(); - - void init(App& app, SharedPtr node, uint32_t poly); - - Control* find_port(const Raul::Path& path) const; - - void add_port(SharedPtr port); - void remove_port(const Raul::Path& path); - - void enable_port(const Raul::Path& path); - void disable_port(const Raul::Path& path); - - size_t num_controls() const { return _controls.size(); } - std::pair ideal_size() const { return _ideal_size; } - - // Callback for Control - void value_changed_atom(SharedPtr port, - const Raul::Atom& val); - - template - void value_changed(SharedPtr port, T val) { - this->value_changed_atom(port, _app->forge().make(val)); - } - -private: - App* _app; - std::pair _ideal_size; - std::vector _controls; - Gtk::VBox* _control_box; - bool _callback_enabled; -}; - -} // namespace GUI -} // namespace Ingen - -#endif // INGEN_GUI_CONTROLPANEL_HPP diff --git a/src/gui/Controls.cpp b/src/gui/Controls.cpp deleted file mode 100644 index 5d00e311..00000000 --- a/src/gui/Controls.cpp +++ /dev/null @@ -1,396 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 David Robillard - - Ingen is free software: you can redistribute it and/or modify it under the - terms of the GNU Affero General Public License as published by the Free - Software Foundation, either version 3 of the License, or any later version. - - Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. - - You should have received a copy of the GNU Affero General Public License - along with Ingen. If not, see . -*/ - -#include -#include -#include "raul/log.hpp" -#include "ingen/Interface.hpp" -#include "ingen/shared/LV2URIMap.hpp" -#include "ingen/client/PluginModel.hpp" -#include "ingen/client/NodeModel.hpp" -#include "ingen/client/PortModel.hpp" -#include "App.hpp" -#include "ControlPanel.hpp" -#include "Controls.hpp" -#include "WidgetFactory.hpp" -#include "PortPropertiesWindow.hpp" - -using namespace std; -using namespace Raul; - -namespace Ingen { -using namespace Client; -namespace GUI { - -// ////////////////////// Control ///////////////////////////////// // - -Control::Control(BaseObjectType* cobject, - const Glib::RefPtr& xml) - : Gtk::VBox(cobject) - , _app(NULL) - , _control_panel(NULL) - , _name_label(NULL) - , _enable_signal(false) -{ - Glib::RefPtr menu_xml = WidgetFactory::create("port_control_menu"); - menu_xml->get_widget("port_control_menu", _menu); - menu_xml->get_widget("port_control_menu_properties", _menu_properties); - - _menu_properties->signal_activate().connect( - sigc::mem_fun(this, &Control::menu_properties)); -} - -Control::~Control() -{ - _enable_signal = false; - _control_connection.disconnect(); - _port_model.reset(); -} - -void -Control::init(App& app, ControlPanel* panel, SharedPtr pm) -{ - _app = &app; - _control_panel = panel; - _port_model = pm, - - assert(_port_model); - assert(panel); - - _control_connection.disconnect(); - _control_connection = pm->signal_value_changed().connect( - sigc::mem_fun(this, &Control::set_value)); - - boost::shared_ptr parent = PtrCast(_port_model->parent()); - if (parent) - set_label(parent->port_label(pm)); - else - set_label(pm->symbol().c_str()); -} - -void -Control::enable() -{ - for (Gtk::Box_Helpers::BoxList::const_iterator i = children().begin(); - i != children().end(); ++i) - i->get_widget()->set_sensitive(true); -} - -void -Control::disable() -{ - for (Gtk::Box_Helpers::BoxList::const_iterator i = children().begin(); - i != children().end(); ++i) - i->get_widget()->set_sensitive(false); -} - -void -Control::set_label(const string& name) -{ - const string name_markup = string("") + name + ""; - _name_label->set_markup(name_markup); -} - -void -Control::menu_properties() -{ - PortPropertiesWindow* window; - WidgetFactory::get_widget_derived("port_properties_win", window); - window->init_window(*_app); - window->present(_port_model); -} - -// ////////////////// SliderControl ////////////////////// // - -SliderControl::SliderControl(BaseObjectType* cobject, - const Glib::RefPtr& xml) - : Control(cobject, xml) - , _enabled(true) -{ - xml->get_widget("control_strip_name_label", _name_label); - xml->get_widget("control_strip_slider", _slider); - xml->get_widget("control_strip_spinner", _value_spinner); -} - -void -SliderControl::init(App& app, ControlPanel* panel, SharedPtr pm) -{ - _enable_signal = false; - _enabled = true; - - Control::init(app, panel, pm); - - assert(_name_label); - assert(_slider); - - _slider->set_draw_value(false); - - signal_button_press_event().connect(sigc::mem_fun(*this, &SliderControl::clicked)); - _slider->signal_button_press_event().connect(sigc::mem_fun(*this, &SliderControl::clicked)); - - _slider->signal_event().connect( - sigc::mem_fun(*this, &SliderControl::slider_pressed)); - - _slider->signal_value_changed().connect( - sigc::mem_fun(*this, &SliderControl::update_value_from_slider)); - - _value_spinner->signal_value_changed().connect( - sigc::mem_fun(*this, &SliderControl::update_value_from_spinner)); - - float min = 0.0f, max = 1.0f; - - boost::shared_ptr parent = PtrCast(_port_model->parent()); - if (parent) - parent->port_value_range(_port_model, min, max, app.sample_rate()); - - if (pm->is_integer() || pm->is_toggle()) { - _slider->set_increments(1, 10); - _value_spinner->set_digits(0); - } else { - _slider->set_increments(0, 0); - } - - pm->signal_property().connect( - sigc::mem_fun(this, &SliderControl::port_property_changed)); - - set_range(std::min(min, pm->value().get_float()), - std::max(max, pm->value().get_float())); - - set_value(pm->value()); - - _enable_signal = true; - - show_all(); -} - -bool -SliderControl::clicked(GdkEventButton* ev) -{ - if (ev->button == 3) { - _menu->popup(ev->button, ev->time); - return true; - } else { - return false; - } -} - -void -SliderControl::set_value(const Atom& atom) -{ - if (_enabled) { - _enable_signal = false; - float val = atom.get_float(); - - if (_port_model->is_integer()) - val = lrintf(val); - - if (_slider->get_value() != val) { - const Gtk::Adjustment* range = _slider->get_adjustment(); - const float lower = range->get_lower(); - const float upper = range->get_upper(); - if (val < lower || val > upper) - set_range(min(lower, val), max(lower, val)); - _slider->set_value(val); - _value_spinner->set_value(val); - } - - _enable_signal = true; - } -} - -void -SliderControl::port_property_changed(const URI& key, const Atom& value) -{ - _enable_signal = false; - - const Shared::URIs& uris = _app->uris(); - if (key == uris.lv2_minimum && value.type() == uris.forge.Float) - set_range(value.get_float(), _slider->get_adjustment()->get_upper()); - else if (key == uris.lv2_maximum && value.type() == uris.forge.Float) - set_range(_slider->get_adjustment()->get_lower(), value.get_float()); - - _enable_signal = true; -} - -void -SliderControl::set_range(float min, float max) -{ - if (max <= min) - max = min + 1.0; - - _slider->set_range(min, max); - _value_spinner->set_range(min, max); -} - -void -SliderControl::update_value_from_slider() -{ - if (_enable_signal) { - float value = _slider->get_value(); - bool change = true; - - _enable_signal = false; - - if (_port_model->is_integer()) { - value = lrintf(value); - if (value == lrintf(_port_model->value().get_float())) - change = false; - } - - if (change) { - _value_spinner->set_value(value); - _control_panel->value_changed(_port_model, value); - } - - _enable_signal = true; - } -} - -void -SliderControl::update_value_from_spinner() -{ - if (_enable_signal) { - _enable_signal = false; - const float value = _value_spinner->get_value(); - - set_value(_app->forge().make(value)); - - _control_panel->value_changed(_port_model, value); - - _enable_signal = true; - } -} - -/** Callback for when slider is grabbed so we can ignore set_control - * events for this port (and avoid nasty feedback issues). - */ -bool -SliderControl::slider_pressed(GdkEvent* ev) -{ - if (ev->type == GDK_BUTTON_PRESS) { - _enabled = false; - } else if (ev->type == GDK_BUTTON_RELEASE) { - _enabled = true; - } - - return false; -} - -// ///////////// ToggleControl ////////////// // - -ToggleControl::ToggleControl(BaseObjectType* cobject, - const Glib::RefPtr& xml) - : Control(cobject, xml) -{ - xml->get_widget("toggle_control_name_label", _name_label); - xml->get_widget("toggle_control_check", _checkbutton); -} - -void -ToggleControl::init(App& app, ControlPanel* panel, SharedPtr pm) -{ - _enable_signal = false; - - Control::init(app, panel, pm); - - assert(_name_label); - assert(_checkbutton); - - _checkbutton->signal_toggled().connect(sigc::mem_fun(*this, &ToggleControl::toggled)); - set_value(pm->value()); - - _enable_signal = true; - show_all(); -} - -void -ToggleControl::set_value(const Atom& val) -{ - const Shared::URIs& uris = _app->uris(); - bool enable = false; - if (val.type() == uris.forge.Float) { - enable = (val.get_float() != 0.0f); - } else if (val.type() == uris.forge.Int) { - enable = (val.get_int32() != 0); - } else if (val.type() == uris.forge.Bool) { - enable = (val.get_bool()); - } else { - error << "Unsupported value type for toggle control" << endl; - } - - _enable_signal = false; - _checkbutton->set_active(enable); - _enable_signal = true; -} - -void -ToggleControl::toggled() -{ - if (_enable_signal) { - float value = _checkbutton->get_active() ? 1.0f : 0.0f; - _control_panel->value_changed(_port_model, value); - } -} - -// ///////////// StringControl ////////////// // - -StringControl::StringControl(BaseObjectType* cobject, - const Glib::RefPtr& xml) - : Control(cobject, xml) -{ - xml->get_widget("string_control_name_label", _name_label); - xml->get_widget("string_control_entry", _entry); -} - -void -StringControl::init(App& app, ControlPanel* panel, SharedPtr pm) -{ - _enable_signal = false; - - Control::init(app, panel, pm); - - assert(_name_label); - assert(_entry); - - _entry->signal_activate().connect(sigc::mem_fun(*this, &StringControl::activated)); - set_value(pm->value()); - - _enable_signal = true; - show_all(); -} - -void -StringControl::set_value(const Atom& val) -{ - _enable_signal = false; - if (val.type() == _app->forge().String) - _entry->set_text(val.get_string()); - else - error << "Non-string value for string port " << _port_model->path() << endl; - _enable_signal = true; -} - -void -StringControl::activated() -{ - if (_enable_signal) - _control_panel->value_changed_atom( - _port_model, - _app->forge().alloc(_entry->get_text().c_str())); -} - -} // namespace GUI -} // namespace Ingen diff --git a/src/gui/Controls.hpp b/src/gui/Controls.hpp deleted file mode 100644 index cbf6cf4c..00000000 --- a/src/gui/Controls.hpp +++ /dev/null @@ -1,153 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 David Robillard - - Ingen is free software: you can redistribute it and/or modify it under the - terms of the GNU Affero General Public License as published by the Free - Software Foundation, either version 3 of the License, or any later version. - - Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. - - You should have received a copy of the GNU Affero General Public License - along with Ingen. If not, see . -*/ - -#ifndef INGEN_GUI_CONTROLS_HPP -#define INGEN_GUI_CONTROLS_HPP - -#include - -#include - -#include "raul/SharedPtr.hpp" - -#include "ingen/client/PortModel.hpp" - -namespace Ingen { namespace Client { class PortModel; } } - -namespace Ingen { -namespace GUI { - -class ControlPanel; - -/** A group of controls (for a single Port) in a ControlPanel. - * - * \ingroup GUI - */ -class Control : public Gtk::VBox -{ -public: - Control(BaseObjectType* cobject, - const Glib::RefPtr& xml); - virtual ~Control(); - - virtual void init(App& app, - ControlPanel* panel, - SharedPtr pm); - - void enable(); - void disable(); - - inline const SharedPtr port_model() const { return _port_model; } - -protected: - virtual void set_value(const Raul::Atom& value) = 0; - virtual void set_range(float min, float max) {} - - void set_label(const std::string& name); - void menu_properties(); - - App* _app; - ControlPanel* _control_panel; - SharedPtr _port_model; - sigc::connection _control_connection; - Gtk::Menu* _menu; - Gtk::MenuItem* _menu_properties; - Gtk::Label* _name_label; - bool _enable_signal; -}; - -/** A slider for a continuous control. - * - * \ingroup GUI - */ -class SliderControl : public Control -{ -public: - SliderControl(BaseObjectType* cobject, - const Glib::RefPtr& xml); - - void init(App& app, - ControlPanel* panel, - SharedPtr pm); - - void set_min(float val); - void set_max(float val); - -private: - void set_value(const Raul::Atom& value); - void set_range(float min, float max); - - void port_property_changed(const Raul::URI& key, const Raul::Atom& value); - - void update_range(); - void update_value_from_slider(); - void update_value_from_spinner(); - - bool slider_pressed(GdkEvent* ev); - bool clicked(GdkEventButton* ev); - - bool _enabled; - - Gtk::SpinButton* _value_spinner; - Gtk::HScale* _slider; -}; - -/** A radio button for toggle controls. - * - * \ingroup GUI - */ -class ToggleControl : public Control -{ -public: - ToggleControl(BaseObjectType* cobject, - const Glib::RefPtr& xml); - - void init(App& app, - ControlPanel* panel, - SharedPtr pm); - -private: - void set_value(const Raul::Atom& value); - void toggled(); - - Gtk::CheckButton* _checkbutton; -}; - -/** A text entry for string controls. - * - * \ingroup GUI - */ -class StringControl : public Control -{ -public: - StringControl(BaseObjectType* cobject, - const Glib::RefPtr& xml); - - void init(App& app, - ControlPanel* panel, - SharedPtr pm); - -private: - void set_value(const Raul::Atom& value); - void activated(); - - Gtk::Entry* _entry; -}; - -} // namespace GUI -} // namespace Ingen - -#endif // INGEN_GUI_CONTROLS_HPP diff --git a/src/gui/NodeControlWindow.cpp b/src/gui/NodeControlWindow.cpp deleted file mode 100644 index c0b82f89..00000000 --- a/src/gui/NodeControlWindow.cpp +++ /dev/null @@ -1,129 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 David Robillard - - Ingen is free software: you can redistribute it and/or modify it under the - terms of the GNU Affero General Public License as published by the Free - Software Foundation, either version 3 of the License, or any later version. - - Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. - - You should have received a copy of the GNU Affero General Public License - along with Ingen. If not, see . -*/ - -#include -#include "ingen/Interface.hpp" -#include "ingen/shared/LV2URIMap.hpp" -#include "ingen/client/NodeModel.hpp" -#include "App.hpp" -#include "NodeControlWindow.hpp" -#include "WidgetFactory.hpp" -#include "Controls.hpp" -#include "ControlPanel.hpp" -#include "PatchWindow.hpp" - -using namespace std; - -namespace Ingen { - -using namespace Client; - -namespace GUI { - -/** Create a node control window and load a new ControlPanel for it. - */ -NodeControlWindow::NodeControlWindow(App& app, - SharedPtr node, - uint32_t poly) - : _node(node) - , _position_stored(false) - , _x(0) - , _y(0) -{ - assert(_node); - - property_resizable() = true; - set_border_width(5); - - set_title(_node->plugin_model()->human_name() + " - Ingen"); - - Glib::RefPtr xml = WidgetFactory::create("warehouse_win"); - xml->get_widget_derived("control_panel_vbox", _control_panel); - - show_all_children(); - - _control_panel->reparent(*this); - _control_panel->init(app, _node, poly); - _control_panel->show(); - - resize(); - - _callback_enabled = true; -} - -/** Create a node control window and with an existing ControlPanel. - */ -NodeControlWindow::NodeControlWindow(App& app, - SharedPtr node, - ControlPanel* panel) - : _node(node) - , _control_panel(panel) -{ - assert(_node); - - property_resizable() = true; - set_border_width(5); - - set_title(_node->path().chop_scheme() + " Controls - Ingen"); - - _control_panel->reparent(*this); - - show_all_children(); - resize(); - - _callback_enabled = true; -} - -NodeControlWindow::~NodeControlWindow() -{ - delete _control_panel; -} - -void -NodeControlWindow::resize() -{ - pair controls_size = _control_panel->ideal_size(); - - int width = controls_size.first; - int height = controls_size.second; - - if (height > property_screen().get_value()->get_height() - 64) - height = property_screen().get_value()->get_height() - 64; - if (width > property_screen().get_value()->get_width() - 64) - width = property_screen().get_value()->get_width() - 64; - - Gtk::Window::resize(width, height); -} - -void -NodeControlWindow::on_show() -{ - if (_position_stored) - move(_x, _y); - - Gtk::Window::on_show(); -} - -void -NodeControlWindow::on_hide() -{ - _position_stored = true; - get_position(_x, _y); - Gtk::Window::on_hide(); -} - -} // namespace GUI -} // namespace Ingen diff --git a/src/gui/NodeControlWindow.hpp b/src/gui/NodeControlWindow.hpp deleted file mode 100644 index a9bc7c5c..00000000 --- a/src/gui/NodeControlWindow.hpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 David Robillard - - Ingen is free software: you can redistribute it and/or modify it under the - terms of the GNU Affero General Public License as published by the Free - Software Foundation, either version 3 of the License, or any later version. - - Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. - - You should have received a copy of the GNU Affero General Public License - along with Ingen. If not, see . -*/ - -#ifndef INGEN_GUI_NODECONTROLWINDOW_HPP -#define INGEN_GUI_NODECONTROLWINDOW_HPP - -#include -#include - -#include "raul/SharedPtr.hpp" - -#include "Window.hpp" - -namespace Ingen { namespace Client { - class NodeModel; -} } - -namespace Ingen { -namespace GUI { - -class ControlGroup; -class ControlPanel; - -/** Window with controls (sliders) for all control-rate ports on a Node. - * - * \ingroup GUI - */ -class NodeControlWindow : public Window -{ -public: - NodeControlWindow(App& app, SharedPtr node, uint32_t poly); - NodeControlWindow(App& app, SharedPtr node, ControlPanel* panel); - - virtual ~NodeControlWindow(); - - SharedPtr node() const { return _node; } - - ControlPanel* control_panel() const { return _control_panel; } - - void resize(); - -protected: - void on_show(); - void on_hide(); - -private: - SharedPtr _node; - ControlPanel* _control_panel; - bool _callback_enabled; - - bool _position_stored; - int _x; - int _y; -}; - -} // namespace GUI -} // namespace Ingen - -#endif // INGEN_GUI_NODECONTROLWINDOW_HPP diff --git a/src/gui/NodeMenu.cpp b/src/gui/NodeMenu.cpp index e12c1b9f..08f27c2a 100644 --- a/src/gui/NodeMenu.cpp +++ b/src/gui/NodeMenu.cpp @@ -38,10 +38,8 @@ namespace GUI { NodeMenu::NodeMenu(BaseObjectType* cobject, const Glib::RefPtr& xml) : ObjectMenu(cobject, xml) - , _controls_menuitem(NULL) , _presets_menu(NULL) { - xml->get_widget("node_controls_menuitem", _controls_menuitem); xml->get_widget("node_popup_gui_menuitem", _popup_gui_menuitem); xml->get_widget("node_embed_gui_menuitem", _embed_gui_menuitem); xml->get_widget("node_randomize_menuitem", _randomize_menuitem); @@ -54,10 +52,6 @@ NodeMenu::init(App& app, SharedPtr node) _learn_menuitem->signal_activate().connect(sigc::mem_fun(this, &NodeMenu::on_menu_learn)); - _controls_menuitem->signal_activate().connect( - sigc::bind(sigc::mem_fun(_app->window_factory(), - &WindowFactory::present_controls), - node)); _popup_gui_menuitem->signal_activate().connect( sigc::mem_fun(signal_popup_gui, &sigc::signal::emit)); _embed_gui_menuitem->signal_toggled().connect( @@ -234,17 +228,5 @@ NodeMenu::has_control_inputs() return false; } -void -NodeMenu::enable_controls_menuitem() -{ - _controls_menuitem->property_sensitive() = true; -} - -void -NodeMenu::disable_controls_menuitem() -{ - _controls_menuitem->property_sensitive() = false; -} - } // namespace GUI } // namespace Ingen diff --git a/src/gui/NodeMenu.hpp b/src/gui/NodeMenu.hpp index 307d2680..e6c7e175 100644 --- a/src/gui/NodeMenu.hpp +++ b/src/gui/NodeMenu.hpp @@ -44,16 +44,12 @@ public: sigc::signal signal_embed_gui; protected: - virtual void enable_controls_menuitem(); - virtual void disable_controls_menuitem(); - void on_menu_disconnect(); void on_menu_embed_gui(); void on_menu_randomize(); void on_preset_activated(const std::string& uri); bool on_preset_clicked(const std::string& uri, GdkEventButton* ev); - Gtk::MenuItem* _controls_menuitem; Gtk::MenuItem* _popup_gui_menuitem; Gtk::CheckMenuItem* _embed_gui_menuitem; Gtk::MenuItem* _randomize_menuitem; diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp index 1336c9e9..510d63bf 100644 --- a/src/gui/NodeModule.cpp +++ b/src/gui/NodeModule.cpp @@ -25,7 +25,6 @@ #include "ingen/client/PluginUI.hpp" #include "App.hpp" #include "WidgetFactory.hpp" -#include "NodeControlWindow.hpp" #include "NodeModule.hpp" #include "PatchCanvas.hpp" #include "PatchWindow.hpp" @@ -81,9 +80,6 @@ NodeModule::~NodeModule() { delete _gui_widget; delete _gui_window; - - NodeControlWindow* win = app().window_factory()->control_window(_node); - delete win; // Will be removed from window factory via signal } bool @@ -343,18 +339,10 @@ NodeModule::set_control_values() } } -void -NodeModule::show_control_window() -{ - app().window_factory()->present_controls(_node); -} - bool NodeModule::on_double_click(GdkEventButton* event) { - if (!popup_gui()) { - show_control_window(); - } + popup_gui(); return true; } diff --git a/src/gui/NodeModule.hpp b/src/gui/NodeModule.hpp index a887fe3a..7d89dc32 100644 --- a/src/gui/NodeModule.hpp +++ b/src/gui/NodeModule.hpp @@ -71,7 +71,6 @@ protected: bool on_event(GdkEvent* ev); - void show_control_window(); void on_embed_gui_toggled(bool embed); void embed_gui(bool embed); bool popup_gui(); diff --git a/src/gui/PatchBox.cpp b/src/gui/PatchBox.cpp index a97c4e52..188e1df1 100644 --- a/src/gui/PatchBox.cpp +++ b/src/gui/PatchBox.cpp @@ -34,7 +34,6 @@ #include "LoadPluginWindow.hpp" #include "MessagesWindow.hpp" #include "NewSubpatchWindow.hpp" -#include "NodeControlWindow.hpp" #include "PatchCanvas.hpp" #include "PatchTreeWindow.hpp" #include "PatchView.hpp" @@ -145,8 +144,6 @@ PatchBox::PatchBox(BaseObjectType* cobject, sigc::mem_fun(this, &PatchBox::event_zoom_normal)); _menu_view_engine_window->signal_activate().connect( sigc::mem_fun(this, &PatchBox::event_show_engine)); - _menu_view_control_window->signal_activate().connect( - sigc::mem_fun(this, &PatchBox::event_show_controls)); _menu_view_patch_properties->signal_activate().connect( sigc::mem_fun(this, &PatchBox::event_show_properties)); @@ -411,12 +408,6 @@ PatchBox::event_clipboard_changed(GdkEventOwnerChange* ev) _menu_paste->set_sensitive(clipboard->wait_is_text_available()); } -void -PatchBox::event_show_controls() -{ - _app->window_factory()->present_controls(_patch); -} - void PatchBox::event_show_properties() { diff --git a/src/gui/PatchBox.hpp b/src/gui/PatchBox.hpp index bc5c8c9a..34d70aa7 100644 --- a/src/gui/PatchBox.hpp +++ b/src/gui/PatchBox.hpp @@ -42,7 +42,6 @@ class BreadCrumbs; class LoadPatchBox; class LoadPluginWindow; class NewSubpatchWindow; -class NodeControlWindow; class PatchDescriptionWindow; class PatchView; class PatchWindow; @@ -112,7 +111,6 @@ private: void event_zoom_normal(); void event_arrange(); void event_show_properties(); - void event_show_controls(); void event_show_engine(); void event_clipboard_changed(GdkEventOwnerChange* ev); diff --git a/src/gui/PatchView.cpp b/src/gui/PatchView.cpp index 2fde6ad8..252772a9 100644 --- a/src/gui/PatchView.cpp +++ b/src/gui/PatchView.cpp @@ -25,7 +25,6 @@ #include "PatchCanvas.hpp" #include "LoadPluginWindow.hpp" #include "NewSubpatchWindow.hpp" -#include "NodeControlWindow.hpp" #include "PatchTreeWindow.hpp" #include "WidgetFactory.hpp" diff --git a/src/gui/PatchView.hpp b/src/gui/PatchView.hpp index 7db0dd85..a3c0c473 100644 --- a/src/gui/PatchView.hpp +++ b/src/gui/PatchView.hpp @@ -40,7 +40,6 @@ namespace GUI { class App; class LoadPluginWindow; class NewSubpatchWindow; -class NodeControlWindow; class PatchCanvas; class PatchDescriptionWindow; class SubpatchModule; diff --git a/src/gui/PortPropertiesWindow.cpp b/src/gui/PortPropertiesWindow.cpp index ade77589..62e7d4ac 100644 --- a/src/gui/PortPropertiesWindow.cpp +++ b/src/gui/PortPropertiesWindow.cpp @@ -21,7 +21,6 @@ #include "ingen/client/NodeModel.hpp" #include "ingen/client/PluginModel.hpp" #include "App.hpp" -#include "Controls.hpp" #include "PortPropertiesWindow.hpp" using namespace std; diff --git a/src/gui/SubpatchModule.cpp b/src/gui/SubpatchModule.cpp index b17d2e30..cbdc8a8f 100644 --- a/src/gui/SubpatchModule.cpp +++ b/src/gui/SubpatchModule.cpp @@ -23,7 +23,6 @@ #include "ingen/shared/LV2URIMap.hpp" #include "App.hpp" -#include "NodeControlWindow.hpp" #include "NodeModule.hpp" #include "PatchCanvas.hpp" #include "PatchWindow.hpp" diff --git a/src/gui/SubpatchModule.hpp b/src/gui/SubpatchModule.hpp index 9caa6331..e71dbe63 100644 --- a/src/gui/SubpatchModule.hpp +++ b/src/gui/SubpatchModule.hpp @@ -33,7 +33,6 @@ namespace Ingen { namespace GUI { class PatchCanvas; -class NodeControlWindow; /** A module to represent a subpatch * diff --git a/src/gui/WindowFactory.cpp b/src/gui/WindowFactory.cpp index fe3e2053..adcdd131 100644 --- a/src/gui/WindowFactory.cpp +++ b/src/gui/WindowFactory.cpp @@ -22,7 +22,6 @@ #include "LoadPatchWindow.hpp" #include "LoadPluginWindow.hpp" #include "NewSubpatchWindow.hpp" -#include "NodeControlWindow.hpp" #include "PropertiesWindow.hpp" #include "PatchView.hpp" #include "PatchWindow.hpp" @@ -63,11 +62,6 @@ WindowFactory::~WindowFactory() for (PatchWindowMap::iterator i = _patch_windows.begin(); i != _patch_windows.end(); ++i) delete i->second; - - for (ControlWindowMap::iterator i = _control_windows.begin(); - i != _control_windows.end(); ++i) - delete i->second; - } void @@ -78,12 +72,6 @@ WindowFactory::clear() delete i->second; _patch_windows.clear(); - - for (ControlWindowMap::iterator i = _control_windows.begin(); - i != _control_windows.end(); ++i) - delete i->second; - - _control_windows.clear(); } /** Returns the number of Patch windows currently visible. @@ -131,14 +119,6 @@ WindowFactory::parent_patch_window(SharedPtr node) return patch_window(PtrCast(node->parent())); } -NodeControlWindow* -WindowFactory::control_window(SharedPtr node) -{ - ControlWindowMap::iterator w = _control_windows.find(node->path()); - - return (w == _control_windows.end()) ? NULL : w->second; -} - /** Present a PatchWindow for a Patch. * * If @a preferred is not NULL, it will be set to display @a patch if the patch @@ -206,49 +186,6 @@ WindowFactory::remove_patch_window(PatchWindow* win, GdkEventAny* ignored) return false; } -void -WindowFactory::present_controls(SharedPtr node) -{ - NodeControlWindow* win = control_window(node); - - if (win) { - win->present(); - } else { - win = new_control_window(node); - win->present(); - } -} - -NodeControlWindow* -WindowFactory::new_control_window(SharedPtr node) -{ - uint32_t poly = 1; - if (node->polyphonic() && node->parent()) - poly = ((PatchModel*)node->parent().get())->internal_poly(); - - NodeControlWindow* win = new NodeControlWindow(_app, node, poly); - - _control_windows[node->path()] = win; - - win->signal_delete_event().connect(sigc::bind<0>( - sigc::mem_fun(this, &WindowFactory::remove_control_window), win)); - - return win; -} - -bool -WindowFactory::remove_control_window(NodeControlWindow* win, GdkEventAny* ignored) -{ - ControlWindowMap::iterator w = _control_windows.find(win->node()->path()); - - assert((*w).second == win); - _control_windows.erase(w); - - delete win; - - return true; -} - void WindowFactory::present_load_plugin(SharedPtr patch, GraphObject::Properties data) diff --git a/src/gui/WindowFactory.hpp b/src/gui/WindowFactory.hpp index a962856c..c9d281c3 100644 --- a/src/gui/WindowFactory.hpp +++ b/src/gui/WindowFactory.hpp @@ -40,7 +40,6 @@ class App; class LoadPatchWindow; class LoadPluginWindow; class NewSubpatchWindow; -class NodeControlWindow; class PropertiesWindow; class PatchBox; class PatchView; @@ -61,18 +60,15 @@ public: size_t num_open_patch_windows(); - PatchBox* patch_box(SharedPtr patch); - PatchWindow* patch_window(SharedPtr patch); - PatchWindow* parent_patch_window(SharedPtr node); - NodeControlWindow* control_window(SharedPtr node); + PatchBox* patch_box(SharedPtr patch); + PatchWindow* patch_window(SharedPtr patch); + PatchWindow* parent_patch_window(SharedPtr node); void present_patch( SharedPtr model, PatchWindow* preferred = NULL, SharedPtr view = SharedPtr()); - void present_controls(SharedPtr node); - typedef GraphObject::Properties Properties; void present_load_plugin(SharedPtr patch, Properties data=Properties()); @@ -89,20 +85,14 @@ public: void clear(); private: - typedef std::map PatchWindowMap; - typedef std::map ControlWindowMap; + typedef std::map PatchWindowMap; PatchWindow* new_patch_window(SharedPtr patch, SharedPtr view); - NodeControlWindow* new_control_window(SharedPtr node); - bool remove_control_window(NodeControlWindow* win, - GdkEventAny* ignored); - App& _app; PatchBox* _main_box; PatchWindowMap _patch_windows; - ControlWindowMap _control_windows; LoadPluginWindow* _load_plugin_win; LoadPatchWindow* _load_patch_win; NewSubpatchWindow* _new_subpatch_win; diff --git a/src/gui/ingen_gui.ui b/src/gui/ingen_gui.ui index e8023463..16549a27 100644 --- a/src/gui/ingen_gui.ui +++ b/src/gui/ingen_gui.ui @@ -1461,15 +1461,6 @@ Contributors: True - - - Show Controls... - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - False - - Show GUI... diff --git a/src/gui/wscript b/src/gui/wscript index 1a732f54..f0893cbf 100644 --- a/src/gui/wscript +++ b/src/gui/wscript @@ -32,13 +32,10 @@ def build(bld): Configuration.cpp ConnectWindow.cpp Connection.cpp - ControlPanel.cpp - Controls.cpp LoadPatchWindow.cpp LoadPluginWindow.cpp MessagesWindow.cpp NewSubpatchWindow.cpp - NodeControlWindow.cpp NodeMenu.cpp NodeModule.cpp ObjectMenu.cpp -- cgit v1.2.1