diff options
-rw-r--r-- | src/common/interface/Resource.hpp | 2 | ||||
-rw-r--r-- | src/gui/Controls.cpp | 8 | ||||
-rw-r--r-- | src/gui/LoadPluginWindow.hpp | 30 | ||||
-rw-r--r-- | src/gui/NodePropertiesWindow.cpp | 76 | ||||
-rw-r--r-- | src/gui/NodePropertiesWindow.hpp | 61 | ||||
-rw-r--r-- | src/gui/PatchPropertiesWindow.cpp | 103 | ||||
-rw-r--r-- | src/gui/PatchPropertiesWindow.hpp | 64 | ||||
-rw-r--r-- | src/gui/PatchView.cpp | 1 | ||||
-rw-r--r-- | src/gui/PatchWindow.cpp | 1 | ||||
-rw-r--r-- | src/gui/Port.cpp | 1 | ||||
-rw-r--r-- | src/gui/PropertiesWindow.cpp | 302 | ||||
-rw-r--r-- | src/gui/PropertiesWindow.hpp | 96 | ||||
-rw-r--r-- | src/gui/WindowFactory.cpp | 47 | ||||
-rw-r--r-- | src/gui/WindowFactory.hpp | 8 | ||||
-rw-r--r-- | src/gui/ingen_gui.glade | 482 | ||||
-rw-r--r-- | src/gui/wscript | 3 | ||||
-rw-r--r-- | src/shared/ResourceImpl.cpp | 13 | ||||
-rw-r--r-- | src/shared/ResourceImpl.hpp | 1 |
18 files changed, 553 insertions, 746 deletions
diff --git a/src/common/interface/Resource.hpp b/src/common/interface/Resource.hpp index 5c9a90eb..4f3e6128 100644 --- a/src/common/interface/Resource.hpp +++ b/src/common/interface/Resource.hpp @@ -44,6 +44,8 @@ public: const Raul::Atom& value) = 0; virtual const Raul::Atom& get_property(const Raul::URI& uri) const = 0; + + virtual bool has_property(const Raul::URI& uri, const Raul::Atom& value) = 0; }; diff --git a/src/gui/Controls.cpp b/src/gui/Controls.cpp index 6b825b48..e810585d 100644 --- a/src/gui/Controls.cpp +++ b/src/gui/Controls.cpp @@ -22,11 +22,11 @@ #include "client/PluginModel.hpp" #include "client/NodeModel.hpp" #include "client/PortModel.hpp" -#include "Controls.hpp" +#include "App.hpp" #include "ControlPanel.hpp" -#include "PortPropertiesWindow.hpp" +#include "Controls.hpp" #include "GladeFactory.hpp" -#include "App.hpp" +#include "PortPropertiesWindow.hpp" using namespace std; using namespace Raul; @@ -49,7 +49,7 @@ Control::Control(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& menu_xml->get_widget("port_control_menu_properties", _menu_properties); _menu_properties->signal_activate().connect( - sigc::mem_fun(this, &SliderControl::menu_properties)); + sigc::mem_fun(this, &SliderControl::menu_properties)); } diff --git a/src/gui/LoadPluginWindow.hpp b/src/gui/LoadPluginWindow.hpp index b5a3bbd5..9f24d278 100644 --- a/src/gui/LoadPluginWindow.hpp +++ b/src/gui/LoadPluginWindow.hpp @@ -65,21 +65,21 @@ private: /** Columns for the plugin list */ class ModelColumns : public Gtk::TreeModel::ColumnRecord { public: - ModelColumns() { - add(_col_icon); - add(_col_name); - add(_col_type); - add(_col_uri); - add(_col_plugin); - } - - Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> > _col_icon; - Gtk::TreeModelColumn<Glib::ustring> _col_name; - Gtk::TreeModelColumn<Glib::ustring> _col_type; - Gtk::TreeModelColumn<Glib::ustring> _col_uri; - - // Not displayed: - Gtk::TreeModelColumn<SharedPtr<PluginModel> > _col_plugin; + ModelColumns() { + add(_col_icon); + add(_col_name); + add(_col_type); + add(_col_uri); + add(_col_plugin); + } + + Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> > _col_icon; + Gtk::TreeModelColumn<Glib::ustring> _col_name; + Gtk::TreeModelColumn<Glib::ustring> _col_type; + Gtk::TreeModelColumn<Glib::ustring> _col_uri; + + // Not displayed: + Gtk::TreeModelColumn<SharedPtr<PluginModel> > _col_plugin; }; /** Column for the filter criteria combo box. */ diff --git a/src/gui/NodePropertiesWindow.cpp b/src/gui/NodePropertiesWindow.cpp deleted file mode 100644 index f3058e5d..00000000 --- a/src/gui/NodePropertiesWindow.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007-2009 Dave Robillard <http://drobilla.net> - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) 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 General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include <cassert> -#include <string> -#include "client/NodeModel.hpp" -#include "client/PluginModel.hpp" -#include "NodePropertiesWindow.hpp" - -using namespace std; -using namespace Raul; - -namespace Ingen { -namespace GUI { - - -NodePropertiesWindow::NodePropertiesWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& glade_xml) - : Window(cobject) -{ - glade_xml->get_widget("node_properties_path_label", _node_path_label); - glade_xml->get_widget("node_properties_polyphonic_checkbutton", _node_polyphonic_toggle); - glade_xml->get_widget("node_properties_plugin_type_label", _plugin_type_label); - glade_xml->get_widget("node_properties_plugin_uri_label", _plugin_uri_label); - glade_xml->get_widget("node_properties_plugin_name_label", _plugin_name_label); - glade_xml->get_widget("node_properties_close_button", _close_button); - - _close_button->signal_clicked().connect( - sigc::mem_fun(this, &Window::hide)); -} - - -/** Set the node this window is associated with. - * This function MUST be called before using this object in any way. - */ -void -NodePropertiesWindow::set_node(SharedPtr<NodeModel> node_model) -{ - assert(node_model); - - _node_model = node_model; - - set_title(node_model->path().str() + " Properties - Ingen"); - - _node_path_label->set_text(node_model->path().str()); - _node_polyphonic_toggle->set_active(node_model->polyphonic()); - - const PluginModel* pm = dynamic_cast<const PluginModel*>(node_model->plugin()); - if (pm) { - _plugin_type_label->set_text(pm->type_uri()); - _plugin_uri_label->set_text(pm->uri().str()); - const Atom& name = pm->get_property("doap:name"); - if (name.is_valid()) - _plugin_name_label->set_text(pm->get_property("doap:name").get_string()); - else - _plugin_name_label->set_text("(Unknown)"); - } -} - - -} // namespace GUI -} // namespace Ingen - diff --git a/src/gui/NodePropertiesWindow.hpp b/src/gui/NodePropertiesWindow.hpp deleted file mode 100644 index adbdb2c4..00000000 --- a/src/gui/NodePropertiesWindow.hpp +++ /dev/null @@ -1,61 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007-2009 Dave Robillard <http://drobilla.net> - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) 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 General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef NODEPROPERTIESWINDOW_H -#define NODEPROPERTIESWINDOW_H - -#include <gtkmm.h> -#include <libglademm.h> -#include "raul/SharedPtr.hpp" -#include "client/NodeModel.hpp" -#include "Window.hpp" - -using namespace Ingen::Client; - -namespace Ingen { -namespace GUI { - - -/** Node properties window. - * - * Loaded by libglade as a derived object. - * - * \ingroup GUI - */ -class NodePropertiesWindow : public Window -{ -public: - NodePropertiesWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& refGlade); - - void present(SharedPtr<NodeModel> node_model) { set_node(node_model); Gtk::Window::present(); } - void set_node(SharedPtr<NodeModel> node_model); - -private: - - SharedPtr<NodeModel> _node_model; - Gtk::Label* _node_path_label; - Gtk::CheckButton* _node_polyphonic_toggle; - Gtk::Label* _plugin_type_label; - Gtk::Label* _plugin_uri_label; - Gtk::Label* _plugin_name_label; - Gtk::Button* _close_button; -}; - -} // namespace GUI -} // namespace Ingen - -#endif // NODEPROPERTIESWINDOW_H diff --git a/src/gui/PatchPropertiesWindow.cpp b/src/gui/PatchPropertiesWindow.cpp deleted file mode 100644 index cf5a9917..00000000 --- a/src/gui/PatchPropertiesWindow.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007-2009 Dave Robillard <http://drobilla.net> - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) 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 General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include <string> -#include "client/PatchModel.hpp" -#include "PatchPropertiesWindow.hpp" -#include "App.hpp" - -using namespace std; -using namespace Raul; - -namespace Ingen { -namespace GUI { - - -PatchPropertiesWindow::PatchPropertiesWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& glade_xml) - : Window(cobject) -{ - glade_xml->get_widget("properties_name_entry", _name_entry); - glade_xml->get_widget("properties_author_entry", _author_entry); - glade_xml->get_widget("properties_description_textview", _textview); - glade_xml->get_widget("properties_cancel_button", _cancel_button); - glade_xml->get_widget("properties_ok_button", _ok_button); - - _cancel_button->signal_clicked().connect(sigc::mem_fun(this, &PatchPropertiesWindow::cancel_clicked)); - _ok_button->signal_clicked().connect(sigc::mem_fun(this, &PatchPropertiesWindow::ok_clicked)); -} - - -/** Set the patch model this description is for. - * - * This function is a "post-constructor" - it MUST be called before using - * the window in any way. - */ -void -PatchPropertiesWindow::set_patch(SharedPtr<PatchModel> patch_model) -{ - property_title() = patch_model->path().str() + " Properties"; - _patch_model = patch_model; - - const Atom& name_atom = _patch_model->get_property("doap:name"); - _name_entry->set_text( - (name_atom.type() == Atom::STRING) ? name_atom.get_string() : "" ); - - const Atom& author_atom = _patch_model->get_property("dc:creator"); - _author_entry->set_text( - (author_atom.type() == Atom::STRING) ? author_atom.get_string() : "" ); - - const Atom& desc_atom = _patch_model->get_property("dc:description"); - _textview->get_buffer()->set_text( - (desc_atom.type() == Atom::STRING) ? desc_atom.get_string() : "" ); -} - - -void -PatchPropertiesWindow::cancel_clicked() -{ - const Atom& name_atom = _patch_model->get_property("doap:name"); - _name_entry->set_text( - (name_atom.type() == Atom::STRING) ? name_atom.get_string() : "" ); - - const Atom& author_atom = _patch_model->get_property("dc:creator"); - _author_entry->set_text( - (author_atom.type() == Atom::STRING) ? author_atom.get_string() : "" ); - - const Atom& desc_atom = _patch_model->get_property("dc:description"); - _textview->get_buffer()->set_text( - (desc_atom.type() == Atom::STRING) ? desc_atom.get_string() : "" ); - - hide(); -} - - -void -PatchPropertiesWindow::ok_clicked() -{ - App::instance().engine()->set_property(_patch_model->path(), "doap:name", - Atom(Atom::STRING, _name_entry->get_text())); - App::instance().engine()->set_property(_patch_model->path(), "dc:creator", - Atom(Atom::STRING, _author_entry->get_text())); - App::instance().engine()->set_property(_patch_model->path(), "dc:description", - Atom(Atom::STRING, _textview->get_buffer()->get_text())); - hide(); -} - - - -} // namespace GUI -} // namespace Ingen diff --git a/src/gui/PatchPropertiesWindow.hpp b/src/gui/PatchPropertiesWindow.hpp deleted file mode 100644 index 3683fdd0..00000000 --- a/src/gui/PatchPropertiesWindow.hpp +++ /dev/null @@ -1,64 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007-2009 Dave Robillard <http://drobilla.net> - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) 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 General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef PATCHPROPERTIESWINDOW_H -#define PATCHPROPERTIESWINDOW_H - -#include <gtkmm.h> -#include <libglademm/xml.h> -#include "raul/SharedPtr.hpp" -#include "Window.hpp" - -namespace Ingen { namespace Client { class PatchModel; } } -using Ingen::Client::PatchModel; - -namespace Ingen { -namespace GUI { - - -/** Patch Properties Window. - * - * Loaded by libglade as a derived object. - * - * \ingroup GUI - */ -class PatchPropertiesWindow : public Window -{ -public: - PatchPropertiesWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& refGlade); - - void present(SharedPtr<PatchModel> patch_model) { set_patch(patch_model); Gtk::Window::present(); } - void set_patch(SharedPtr<PatchModel> patch_model); - - void cancel_clicked(); - void ok_clicked(); - -private: - SharedPtr<PatchModel> _patch_model; - - Gtk::Entry* _name_entry; - Gtk::Entry* _author_entry; - Gtk::TextView* _textview; - Gtk::Button* _cancel_button; - Gtk::Button* _ok_button; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // PATCHPROPERTIESWINDOW_H diff --git a/src/gui/PatchView.cpp b/src/gui/PatchView.cpp index 6e3282bc..6fce3797 100644 --- a/src/gui/PatchView.cpp +++ b/src/gui/PatchView.cpp @@ -27,7 +27,6 @@ #include "NewSubpatchWindow.hpp" #include "LoadSubpatchWindow.hpp" #include "NodeControlWindow.hpp" -#include "PatchPropertiesWindow.hpp" #include "PatchTreeWindow.hpp" #include "GladeFactory.hpp" diff --git a/src/gui/PatchWindow.cpp b/src/gui/PatchWindow.cpp index 926929f9..13c1f2ff 100644 --- a/src/gui/PatchWindow.cpp +++ b/src/gui/PatchWindow.cpp @@ -31,7 +31,6 @@ #include "LoadPatchWindow.hpp" #include "LoadSubpatchWindow.hpp" #include "NodeControlWindow.hpp" -#include "PatchPropertiesWindow.hpp" #include "Configuration.hpp" #include "MessagesWindow.hpp" #include "PatchTreeWindow.hpp" diff --git a/src/gui/Port.cpp b/src/gui/Port.cpp index 5e1050f8..bbde8100 100644 --- a/src/gui/Port.cpp +++ b/src/gui/Port.cpp @@ -103,7 +103,6 @@ Port::update_metadata() } - void Port::create_menu() { diff --git a/src/gui/PropertiesWindow.cpp b/src/gui/PropertiesWindow.cpp new file mode 100644 index 00000000..48440817 --- /dev/null +++ b/src/gui/PropertiesWindow.cpp @@ -0,0 +1,302 @@ +/* This file is part of Ingen. + * Copyright (C) 2007-2009 Dave Robillard <http://drobilla.net> + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) 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 General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include <cassert> +#include <string> +#include "raul/log.hpp" +#include "client/NodeModel.hpp" +#include "client/PluginModel.hpp" +#include "App.hpp" +#include "PropertiesWindow.hpp" + +#define LOG(s) s << "[PropertiesWindow] " + +using namespace std; +using namespace Raul; + +namespace Ingen { +namespace GUI { + + +PropertiesWindow::PropertiesWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& glade_xml) + : Window(cobject) +{ + glade_xml->get_widget("properties_vbox", _vbox); + glade_xml->get_widget("properties_scrolledwindow", _scrolledwindow); + glade_xml->get_widget("properties_table", _table); + glade_xml->get_widget("properties_cancel_button", _cancel_button); + glade_xml->get_widget("properties_apply_button", _apply_button); + glade_xml->get_widget("properties_ok_button", _ok_button); + + _type_choices = Gtk::ListStore::create(_type_cols); + for (int i = Raul::Atom::INT; i <= Raul::Atom::BLOB; ++i) { + Gtk::TreeModel::Row row = *_type_choices->append(); + row[_type_cols.type] = static_cast<Raul::Atom::Type>(i); + ostringstream ss; + ss << static_cast<Raul::Atom::Type>(i); + row[_type_cols.choice] = ss.str(); + } + + _cancel_button->signal_clicked().connect( + sigc::mem_fun(this, &PropertiesWindow::cancel_clicked)); + + _apply_button->signal_clicked().connect( + sigc::mem_fun(this, &PropertiesWindow::apply_clicked)); + + _ok_button->signal_clicked().connect( + sigc::mem_fun(this, &PropertiesWindow::ok_clicked)); +} + + +/** Set the node this window is associated with. + * This function MUST be called before using this object in any way. + */ +void +PropertiesWindow::set_object(SharedPtr<ObjectModel> model) +{ + _table->children().clear(); + _table->resize(1, 3); + _table->property_n_rows() = 1; + + _property_connection.disconnect(); + _model = model; + + set_title(model->path().chop_scheme() + " Properties - Ingen"); + + ostringstream ss; + unsigned n_rows = 0; + for (ObjectModel::Properties::const_iterator i = model->properties().begin(); + i != model->properties().end(); ++i) { + _table->property_n_rows() = ++n_rows; + + const Raul::Atom& value = i->second; + + // Column 0: Property + Gtk::Label* lab = manage(new Gtk::Label(i->first.str(), 0.0, 0.5)); + _table->attach(*lab, 0, 1, n_rows, n_rows + 1, Gtk::FILL|Gtk::SHRINK, Gtk::SHRINK); + + // Column 1: Type + Gtk::ComboBox* combo = manage(new Gtk::ComboBox()); + combo->set_model(_type_choices); + combo->pack_start(_type_cols.choice); + const char path[] = { static_cast<int>(value.type()) - 1 + '0', '\0' }; + combo->set_active(_type_choices->get_iter(path)); + Gtk::Alignment* align = manage(new Gtk::Alignment(0.0, 0.5, 0.0, 1.0)); + align->add(*combo); + _table->attach(*align, 1, 2, n_rows, n_rows + 1, Gtk::FILL|Gtk::SHRINK, Gtk::SHRINK); + + Record record; + record.value = value; + record.type_widget = combo; + + // Column 2: Value + align = manage(new Gtk::Alignment(0.0, 0.5, 1.0, 0.0)); + Gtk::Widget* value_widget = create_value_widget(i->first, value); + align->add(*value_widget); + _table->attach(*align, 2, 3, n_rows, n_rows + 1, Gtk::FILL|Gtk::EXPAND, Gtk::SHRINK); + record.value_widget = align; + record.row = n_rows; + _records.insert(make_pair(i->first, record)); + } + + _table->show_all(); + + _property_connection = model->signal_property.connect( + sigc::mem_fun(this, &PropertiesWindow::property_changed)); +} + +Gtk::Widget* +PropertiesWindow::create_value_widget(const Raul::URI& uri, const Raul::Atom& value) +{ + if (value.type() == Atom::INT) { + Gtk::SpinButton* widget = manage(new Gtk::SpinButton(0.0, 0)); + widget->property_numeric() = true; + widget->set_value(value.get_int32()); + widget->set_snap_to_ticks(true); + widget->set_range(INT_MIN, INT_MAX); + widget->set_increments(1, 10); + widget->signal_value_changed().connect(sigc::bind( + sigc::mem_fun(this, &PropertiesWindow::value_edited), + uri)); + return widget; + } else if (value.type() == Atom::FLOAT) { + Gtk::SpinButton* widget = manage(new Gtk::SpinButton(0.0, 4)); + widget->property_numeric() = true; + widget->set_snap_to_ticks(false); + widget->set_range(DBL_MIN, DBL_MAX); + widget->set_value(value.get_float()); + widget->set_increments(0.1, 1.0); + widget->signal_value_changed().connect(sigc::bind( + sigc::mem_fun(this, &PropertiesWindow::value_edited), + uri)); + return widget; + } else if (value.type() == Atom::BOOL) { + Gtk::CheckButton* widget = manage(new Gtk::CheckButton()); + widget->set_active(value.get_bool()); + widget->signal_toggled().connect(sigc::bind( + sigc::mem_fun(this, &PropertiesWindow::value_edited), + uri)); + return widget; + } else if (value.type() == Atom::URI) { + Gtk::Entry* widget = manage(new Gtk::Entry()); + widget->set_text(value.get_uri()); + widget->signal_changed().connect(sigc::bind( + sigc::mem_fun(this, &PropertiesWindow::value_edited), + uri)); + return widget; + } else if (value.type() == Atom::STRING) { + Gtk::Entry* widget = manage(new Gtk::Entry()); + widget->set_text(value.get_string()); + widget->signal_changed().connect(sigc::bind( + sigc::mem_fun(this, &PropertiesWindow::value_edited), + uri)); + return widget; + } + + return NULL; +} + + +void +PropertiesWindow::on_show() +{ + static const int WIN_PAD = 32; + static const int VBOX_PAD = 12; + int width = 0; + int height = 0; + Gtk::Requisition req; + + typedef Gtk::Box_Helpers::BoxList Children; + for (Children::const_iterator i = _vbox->children().begin(); i != _vbox->children().end(); ++i) { + req = (*i).get_widget()->size_request(); + if ((*i).get_widget() != _scrolledwindow) { + width = std::max(width, req.width); + height += req.height + VBOX_PAD; + } + } + + req = _table->size_request(); + width = std::max(width, req.width); + height += req.height; + + set_default_size(width + WIN_PAD, height + WIN_PAD); + resize(width + WIN_PAD, height + WIN_PAD); + Gtk::Window::on_show(); +} + + +void +PropertiesWindow::property_changed(const Raul::URI& predicate, const Raul::Atom& value) +{ + Records::iterator r = _records.find(predicate); + if (r == _records.end()) { + LOG(error) << "Unknown property `" << predicate << "' changed" << endl; + return; + } + + Record& record = r->second; + Gtk::Widget* value_widget = create_value_widget(predicate, value); + + record.value_widget->remove(); + record.value_widget->add(*value_widget); + record.value = value; + value_widget->show(); +} + + +void +PropertiesWindow::value_edited(const Raul::URI& predicate) +{ + Records::iterator r = _records.find(predicate); + if (r == _records.end()) { + LOG(error) << "Unknown property `" << predicate << "' edited" << endl; + return; + } + + Record& record = r->second; + Raul::Atom::Type type = (*record.type_widget->get_active())[_type_cols.type]; + if (type == Atom::INT) { + Gtk::SpinButton* widget = dynamic_cast<Gtk::SpinButton*>(record.value_widget->get_child()); + if (!widget) goto bad_type; + record.value = Atom(widget->get_value_as_int()); + } else if (type == Atom::FLOAT) { + Gtk::SpinButton* widget = dynamic_cast<Gtk::SpinButton*>(record.value_widget->get_child()); + if (!widget) goto bad_type; + record.value = Atom(static_cast<float>(widget->get_value())); + } else if (type == Atom::BOOL) { + Gtk::CheckButton* widget = dynamic_cast<Gtk::CheckButton*>(record.value_widget->get_child()); + if (!widget) goto bad_type; + record.value = Atom(widget->get_active()); + } else if (type == Atom::URI) { + Gtk::Entry* widget = dynamic_cast<Gtk::Entry*>(record.value_widget->get_child()); + if (!widget) goto bad_type; + record.value = Atom(Atom::URI, widget->get_text()); + } else if (type == Atom::STRING) { + Gtk::Entry* widget = dynamic_cast<Gtk::Entry*>(record.value_widget->get_child()); + if (!widget) goto bad_type; + record.value = Atom(Atom::URI, widget->get_text()); + } + + cout << "VALUE EDITED " << predicate << " = " << record.value << endl; + return; + +bad_type: + LOG(error) << "Property `" << predicate << "' value widget has wrong type" << endl; + return; +} + + +void +PropertiesWindow::cancel_clicked() +{ + set_object(_model); // reset + Gtk::Window::hide(); +} + + +void +PropertiesWindow::apply_clicked() +{ + LOG(debug) << "apply {" << endl; + Shared::Resource::Properties properties; + for (Records::const_iterator r = _records.begin(); r != _records.end(); ++r) { + const Raul::URI& uri = r->first; + const Record& record = r->second; + if (!_model->has_property(uri, record.value)) { + LOG(debug) << "\t" << uri + << " = " << record.value + << " :: " << record.value.type() << endl; + properties.insert(make_pair(uri, record.value)); + } + } + + App::instance().engine()->put(_model->path(), properties); + + LOG(debug) << "}" << endl; +} + + +void +PropertiesWindow::ok_clicked() +{ + apply_clicked(); + Gtk::Window::hide(); +} + + +} // namespace GUI +} // namespace Ingen diff --git a/src/gui/PropertiesWindow.hpp b/src/gui/PropertiesWindow.hpp new file mode 100644 index 00000000..d2f619f9 --- /dev/null +++ b/src/gui/PropertiesWindow.hpp @@ -0,0 +1,96 @@ +/* This file is part of Ingen. + * Copyright (C) 2007-2009 Dave Robillard <http://drobilla.net> + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) 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 General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef PROPERTIES_WINDOW_HPP +#define PROPERTIES_WINDOW_HPP + +#include <gtkmm.h> +#include <libglademm.h> +#include "raul/SharedPtr.hpp" +#include "client/NodeModel.hpp" +#include "Window.hpp" + +using namespace Ingen::Client; + +namespace Ingen { +namespace GUI { + + +/** Node properties window. + * + * Loaded by libglade as a derived object. + * + * \ingroup GUI + */ +class PropertiesWindow : public Window +{ +public: + PropertiesWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& refGlade); + + void present(SharedPtr<ObjectModel> model) { set_object(model); Gtk::Window::present(); } + void set_object(SharedPtr<ObjectModel> model); + +private: + /** Record of a property (row in the table) */ + struct Record { + Raul::Atom value; + Gtk::ComboBox* type_widget; + Gtk::Alignment* value_widget; + int row; + }; + + /** Columns for type combo in treeview */ + class TypeColumns : public Gtk::TreeModel::ColumnRecord { + public: + TypeColumns() { add(type); add(choice); } + + Gtk::TreeModelColumn<Raul::Atom::Type> type; + Gtk::TreeModelColumn<Glib::ustring> choice; + }; + + Gtk::Widget* create_value_widget(const Raul::URI& uri, const Raul::Atom& value); + + void on_show(); + + void property_changed(const Raul::URI& predicate, const Raul::Atom& value); + + void value_edited(const Raul::URI& predicate); + + void cancel_clicked(); + void apply_clicked(); + void ok_clicked(); + + typedef std::map<Raul::URI, Record> Records; + Records _records; + + TypeColumns _type_cols; + Glib::RefPtr<Gtk::ListStore> _type_choices; + + SharedPtr<ObjectModel> _model; + sigc::connection _property_connection; + Gtk::VBox* _vbox; + Gtk::ScrolledWindow* _scrolledwindow; + Gtk::Table* _table; + Gtk::Button* _cancel_button; + Gtk::Button* _apply_button; + Gtk::Button* _ok_button; +}; + +} // namespace GUI +} // namespace Ingen + +#endif // PROPERTIES_WINDOW_HPP diff --git a/src/gui/WindowFactory.cpp b/src/gui/WindowFactory.cpp index 3131070f..1842a04a 100644 --- a/src/gui/WindowFactory.cpp +++ b/src/gui/WindowFactory.cpp @@ -26,11 +26,9 @@ #include "LoadSubpatchWindow.hpp" #include "NewSubpatchWindow.hpp" #include "NodeControlWindow.hpp" -#include "NodePropertiesWindow.hpp" -#include "PatchPropertiesWindow.hpp" +#include "PropertiesWindow.hpp" #include "PatchView.hpp" #include "PatchWindow.hpp" -#include "PortPropertiesWindow.hpp" #include "RenameWindow.hpp" #include "WindowFactory.hpp" #ifdef HAVE_CURL @@ -50,9 +48,7 @@ WindowFactory::WindowFactory() , _upload_patch_win(NULL) , _new_subpatch_win(NULL) , _load_subpatch_win(NULL) - , _patch_properties_win(NULL) - , _node_properties_win(NULL) - , _port_properties_win(NULL) + , _properties_win(NULL) { Glib::RefPtr<Gnome::Glade::Xml> xml = GladeFactory::new_glade_reference(); @@ -61,9 +57,7 @@ WindowFactory::WindowFactory() xml->get_widget_derived("load_remote_patch_win", _load_remote_patch_win); xml->get_widget_derived("new_subpatch_win", _new_subpatch_win); xml->get_widget_derived("load_subpatch_win", _load_subpatch_win); - xml->get_widget_derived("patch_properties_win", _patch_properties_win); - xml->get_widget_derived("node_properties_win", _node_properties_win); - xml->get_widget_derived("port_properties_win", _port_properties_win); + xml->get_widget_derived("properties_win", _properties_win); xml->get_widget_derived("rename_win", _rename_win); #ifdef HAVE_CURL @@ -347,35 +341,16 @@ WindowFactory::present_rename(SharedPtr<ObjectModel> object) void WindowFactory::present_properties(SharedPtr<ObjectModel> object) { - SharedPtr<PatchModel> patch = PtrCast<PatchModel>(object); - if (patch) { - PatchWindowMap::iterator w = _patch_windows.find(patch->path()); - if (w != _patch_windows.end()) - _patch_properties_win->set_transient_for(*w->second); - - _patch_properties_win->present(patch); - return; - } - - SharedPtr<NodeModel> node = PtrCast<NodeModel>(object); - if (node) { - PatchWindowMap::iterator w = _patch_windows.find(node->path().parent()); - if (w != _patch_windows.end()) - _node_properties_win->set_transient_for(*w->second); - - _node_properties_win->present(node); - return; - } + PatchWindowMap::iterator w = _patch_windows.find(object->path()); + if (w == _patch_windows.end()) + w = _patch_windows.find(object->path().parent()); + if (w == _patch_windows.end()) + w = _patch_windows.find(object->path().parent().parent()); - SharedPtr<PortModel> port = PtrCast<PortModel>(object); - if (port) { - PatchWindowMap::iterator w = _patch_windows.find(port->path().parent().parent()); - if (w != _patch_windows.end()) - _patch_properties_win->set_transient_for(*w->second); + if (w != _patch_windows.end()) + _properties_win->set_transient_for(*w->second); - _port_properties_win->present(port); - return; - } + _properties_win->present(object); } diff --git a/src/gui/WindowFactory.hpp b/src/gui/WindowFactory.hpp index dce08c96..adfd1c0d 100644 --- a/src/gui/WindowFactory.hpp +++ b/src/gui/WindowFactory.hpp @@ -42,11 +42,9 @@ class LoadRemotePatchWindow; class LoadSubpatchWindow; class NewSubpatchWindow; class NodeControlWindow; -class NodePropertiesWindow; -class PatchPropertiesWindow; +class PropertiesWindow; class PatchView; class PatchWindow; -class PortPropertiesWindow; class RenameWindow; class UploadPatchWindow; @@ -107,9 +105,7 @@ private: UploadPatchWindow* _upload_patch_win; NewSubpatchWindow* _new_subpatch_win; LoadSubpatchWindow* _load_subpatch_win; - PatchPropertiesWindow* _patch_properties_win; - NodePropertiesWindow* _node_properties_win; - PortPropertiesWindow* _port_properties_win; + PropertiesWindow* _properties_win; RenameWindow* _rename_win; }; diff --git a/src/gui/ingen_gui.glade b/src/gui/ingen_gui.glade index a255e541..f294678b 100644 --- a/src/gui/ingen_gui.glade +++ b/src/gui/ingen_gui.glade @@ -1231,7 +1231,8 @@ <widget class="GtkTable" id="table8"> <property name="visible">True</property> <property name="n_rows">6</property> - <property name="n_columns">2</property> + <property name="column_spacing">12</property> + <property name="row_spacing">12</property> <child> <widget class="GtkVBox" id="toggle_control"> <property name="visible">True</property> @@ -1750,24 +1751,6 @@ <property name="y_padding">8</property> </packing> </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> </widget> </child> </widget> @@ -1976,137 +1959,6 @@ </widget> </child> </widget> - <widget class="GtkWindow" id="patch_properties_win"> - <property name="width_request">400</property> - <property name="height_request">200</property> - <property name="border_width">8</property> - <property name="title" translatable="yes">Patch Description</property> - <property name="window_position">center-on-parent</property> - <child> - <widget class="GtkVBox" id="vbox14"> - <property name="visible">True</property> - <property name="spacing">6</property> - <child> - <widget class="GtkTable" id="table2"> - <property name="visible">True</property> - <property name="n_rows">2</property> - <property name="n_columns">2</property> - <property name="column_spacing">8</property> - <property name="row_spacing">8</property> - <child> - <widget class="GtkLabel" id="label1"> - <property name="visible">True</property> - <property name="label" translatable="yes">Name:</property> - </widget> - <packing> - <property name="x_options">GTK_FILL</property> - </packing> - </child> - <child> - <widget class="GtkEntry" id="properties_name_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - </packing> - </child> - <child> - <widget class="GtkEntry" id="properties_author_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - </packing> - </child> - <child> - <widget class="GtkLabel" id="label93"> - <property name="visible">True</property> - <property name="label" translatable="yes">Author:</property> - </widget> - <packing> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">GTK_FILL</property> - </packing> - </child> - </widget> - <packing> - <property name="expand">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <widget class="GtkScrolledWindow" id="scrolledwindow9"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hscrollbar_policy">automatic</property> - <property name="vscrollbar_policy">automatic</property> - <property name="shadow_type">in</property> - <child> - <widget class="GtkTextView" id="properties_description_textview"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="tooltip" translatable="yes">A short description of the patch to be included in the patch file</property> - <property name="wrap_mode">word</property> - </widget> - </child> - </widget> - <packing> - <property name="position">1</property> - </packing> - </child> - <child> - <widget class="GtkHButtonBox" id="hbuttonbox3"> - <property name="visible">True</property> - <property name="spacing">5</property> - <property name="layout_style">end</property> - <child> - <widget class="GtkButton" id="properties_cancel_button"> - <property name="label">gtk-cancel</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="receives_default">False</property> - <property name="use_stock">True</property> - </widget> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <widget class="GtkButton" id="properties_ok_button"> - <property name="label">gtk-ok</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="receives_default">False</property> - <property name="tooltip" translatable="yes">Apply these changes to be saved the next time the patch is saved</property> - <property name="use_stock">True</property> - </widget> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">1</property> - </packing> - </child> - </widget> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">2</property> - </packing> - </child> - </widget> - </child> - </widget> <widget class="GtkWindow" id="rename_win"> <property name="width_request">250</property> <property name="title" translatable="yes">Rename</property> @@ -2264,230 +2116,6 @@ </widget> </child> </widget> - <widget class="GtkWindow" id="node_properties_win"> - <property name="border_width">8</property> - <property name="title" translatable="yes">Node Properties - Ingen</property> - <property name="window_position">mouse</property> - <child> - <widget class="GtkVBox" id="vbox17"> - <property name="visible">True</property> - <property name="orientation">vertical</property> - <property name="spacing">4</property> - <child> - <widget class="GtkLabel" id="label105"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes"><b>Node</b></property> - <property name="use_markup">True</property> - </widget> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <widget class="GtkVBox" id="vbox18"> - <property name="visible">True</property> - <property name="border_width">12</property> - <property name="orientation">vertical</property> - <property name="spacing">6</property> - <child> - <widget class="GtkHBox" id="hbox56"> - <property name="visible">True</property> - <property name="spacing">4</property> - <child> - <widget class="GtkLabel" id="label121"> - <property name="visible">True</property> - <property name="label" translatable="yes">Path: </property> - </widget> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <widget class="GtkLabel" id="node_properties_path_label"> - <property name="visible">True</property> - <property name="label" translatable="yes">-</property> - <property name="selectable">True</property> - </widget> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">1</property> - </packing> - </child> - </widget> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <widget class="GtkCheckButton" id="node_properties_polyphonic_checkbutton"> - <property name="label" translatable="yes">Polyphonic</property> - <property name="visible">True</property> - <property name="sensitive">False</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">1</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">6</property> - <property name="position">1</property> - </packing> - </child> - <child> - <widget class="GtkLabel" id="label106"> - <property name="width_request">240</property> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes"><b>Plugin</b></property> - <property name="use_markup">True</property> - </widget> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">2</property> - </packing> - </child> - <child> - <widget class="GtkTable" id="table13"> - <property name="visible">True</property> - <property name="border_width">12</property> - <property name="n_rows">3</property> - <property name="n_columns">2</property> - <property name="column_spacing">10</property> - <property name="row_spacing">6</property> - <child> - <widget class="GtkLabel" id="node_properties_plugin_type_label"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">-</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="x_options">GTK_FILL</property> - <property name="y_options"></property> - </packing> - </child> - <child> - <widget class="GtkLabel" id="label114"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Type: </property> - </widget> - <packing> - <property name="x_options">GTK_FILL</property> - <property name="y_options"></property> - </packing> - </child> - <child> - <widget class="GtkLabel" id="label120"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">URI: </property> - </widget> - <packing> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">GTK_FILL</property> - <property name="y_options"></property> - </packing> - </child> - <child> - <widget class="GtkLabel" id="node_properties_plugin_uri_label"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">-</property> - <property name="selectable">True</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">GTK_FILL</property> - <property name="y_options"></property> - </packing> - </child> - <child> - <widget class="GtkLabel" id="label116"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Name: </property> - </widget> - <packing> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_options">GTK_FILL</property> - <property name="y_options"></property> - </packing> - </child> - <child> - <widget class="GtkLabel" id="node_properties_plugin_name_label"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">-</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_options">GTK_FILL</property> - <property name="y_options"></property> - </packing> - </child> - </widget> - <packing> - <property name="position">3</property> - </packing> - </child> - <child> - <widget class="GtkHButtonBox" id="hbuttonbox1"> - <property name="visible">True</property> - <property name="layout_style">end</property> - <child> - <widget class="GtkButton" id="node_properties_close_button"> - <property name="label">gtk-close</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="has_focus">True</property> - <property name="is_focus">True</property> - <property name="can_default">True</property> - <property name="has_default">True</property> - <property name="receives_default">True</property> - <property name="use_stock">True</property> - </widget> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - </widget> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">4</property> - </packing> - </child> - </widget> - </child> - </widget> <widget class="GtkAboutDialog" id="about_win"> <property name="destroy_with_parent">True</property> <property name="type_hint">normal</property> @@ -3296,8 +2924,7 @@ Thank you for contributing.</property> <widget class="GtkImageMenuItem" id="port_control_menu_properties"> <property name="label">gtk-properties</property> <property name="visible">True</property> - <property name="use_underline">True</property> - <property name="use_stock">False</property> + <property name="use_stock">True</property> <signal name="activate" handler="on_port_control_menu_properties_activate"/> </widget> </child> @@ -3534,4 +3161,107 @@ Thank you for contributing.</property> </widget> </child> </widget> + <widget class="GtkWindow" id="properties_win"> + <property name="border_width">12</property> + <property name="window_position">center-on-parent</property> + <child> + <widget class="GtkVBox" id="properties_vbox"> + <property name="visible">True</property> + <property name="orientation">vertical</property> + <property name="spacing">12</property> + <child> + <widget class="GtkScrolledWindow" id="properties_scrolledwindow"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hscrollbar_policy">automatic</property> + <property name="vscrollbar_policy">automatic</property> + <child> + <widget class="GtkViewport" id="viewport1"> + <property name="visible">True</property> + <property name="resize_mode">queue</property> + <property name="shadow_type">none</property> + <child> + <widget class="GtkTable" id="properties_table"> + <property name="visible">True</property> + <property name="n_columns">3</property> + <property name="column_spacing">12</property> + <property name="row_spacing">6</property> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + </widget> + </child> + </widget> + </child> + </widget> + <packing> + <property name="position">0</property> + </packing> + </child> + <child> + <widget class="GtkHButtonBox" id="properties_buttonbox"> + <property name="visible">True</property> + <property name="spacing">6</property> + <property name="layout_style">end</property> + <child> + <widget class="GtkButton" id="properties_cancel_button"> + <property name="label">gtk-cancel</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="can_default">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> + </widget> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <widget class="GtkButton" id="properties_apply_button"> + <property name="label">gtk-apply</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> + </widget> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">1</property> + </packing> + </child> + <child> + <widget class="GtkButton" id="properties_ok_button"> + <property name="label">gtk-ok</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="can_default">True</property> + <property name="has_default">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> + </widget> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">2</property> + </packing> + </child> + </widget> + <packing> + <property name="expand">False</property> + <property name="pack_type">end</property> + <property name="position">1</property> + </packing> + </child> + </widget> + </child> + </widget> </glade-interface> diff --git a/src/gui/wscript b/src/gui/wscript index 7d7e61fc..5550f836 100644 --- a/src/gui/wscript +++ b/src/gui/wscript @@ -24,17 +24,16 @@ def build(bld): NodeControlWindow.cpp NodeMenu.cpp NodeModule.cpp - NodePropertiesWindow.cpp ObjectMenu.cpp PatchCanvas.cpp PatchPortModule.cpp - PatchPropertiesWindow.cpp PatchTreeWindow.cpp PatchView.cpp PatchWindow.cpp Port.cpp PortMenu.cpp PortPropertiesWindow.cpp + PropertiesWindow.cpp RenameWindow.cpp SubpatchModule.cpp ThreadedLoader.cpp diff --git a/src/shared/ResourceImpl.cpp b/src/shared/ResourceImpl.cpp index 93d6ea03..949a8b36 100644 --- a/src/shared/ResourceImpl.cpp +++ b/src/shared/ResourceImpl.cpp @@ -62,6 +62,19 @@ ResourceImpl::set_property(const Raul::URI& uri, const Raul::Atom& value) } +bool +ResourceImpl::has_property(const Raul::URI& uri, const Raul::Atom& value) +{ + Properties::const_iterator i = _properties.find(uri); + for (; i->first == uri; ++i) { + if (i->second == value) { + return true; + } + } + return false; +} + + Raul::Atom& ResourceImpl::set_property(const Raul::URI& uri, const Raul::Atom& value) const { diff --git a/src/shared/ResourceImpl.hpp b/src/shared/ResourceImpl.hpp index b4afc50a..7ff88f6a 100644 --- a/src/shared/ResourceImpl.hpp +++ b/src/shared/ResourceImpl.hpp @@ -40,6 +40,7 @@ public: const Raul::Atom& get_property(const Raul::URI& uri) const; Raul::Atom& set_property(const Raul::URI& uri, const Raul::Atom& value); + bool has_property(const Raul::URI& uri, const Raul::Atom& value); void add_property(const Raul::URI& uri, const Raul::Atom& value); void set_properties(const Properties& p); void add_properties(const Properties& p); |