summaryrefslogtreecommitdiffstats
path: root/src/gui/PropertiesWindow.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2013-06-09 04:51:32 +0000
committerDavid Robillard <d@drobilla.net>2013-06-09 04:51:32 +0000
commitfe81cb8af20ecbe721eba55d53fa62c5e2041421 (patch)
tree98e94e5dcf675054ac6023ddbccd44b1381ddda0 /src/gui/PropertiesWindow.cpp
parentc8e00539e66bbe3584798ab8619f4b5927e83c2c (diff)
downloadingen-fe81cb8af20ecbe721eba55d53fa62c5e2041421.tar.gz
ingen-fe81cb8af20ecbe721eba55d53fa62c5e2041421.tar.bz2
ingen-fe81cb8af20ecbe721eba55d53fa62c5e2041421.zip
Support removing properties from the properties dialog.
You can definitely blow your leg off with this one, clever ontology awareness (e.g. required properties) would be good... git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5138 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/gui/PropertiesWindow.cpp')
-rw-r--r--src/gui/PropertiesWindow.cpp37
1 files changed, 30 insertions, 7 deletions
diff --git a/src/gui/PropertiesWindow.cpp b/src/gui/PropertiesWindow.cpp
index 2177de8c..50332c65 100644
--- a/src/gui/PropertiesWindow.cpp
+++ b/src/gui/PropertiesWindow.cpp
@@ -126,14 +126,18 @@ PropertiesWindow::add_property(const Raul::URI& uri, const Atom& value)
lilv_node_free(prop);
// Column 1: Value
- Gtk::Alignment* align = manage(new Gtk::Alignment(0.0, 0.5, 1.0, 0.0));
- Gtk::Widget* val_widget = create_value_widget(uri, value);
+ Gtk::Alignment* align = manage(new Gtk::Alignment(0.0, 0.5, 1.0, 0.0));
+ Gtk::CheckButton* present = manage(new Gtk::CheckButton());
+ Gtk::Widget* val_widget = create_value_widget(uri, value);
+ present->set_active(true);
if (val_widget) {
align->add(*val_widget);
}
_table->attach(*align, 1, 2, n_rows, n_rows + 1,
Gtk::FILL|Gtk::EXPAND, Gtk::SHRINK);
- _records.insert(make_pair(uri, Record(value, align, n_rows)));
+ _table->attach(*present, 2, 3, n_rows, n_rows + 1,
+ Gtk::FILL, Gtk::SHRINK);
+ _records.insert(make_pair(uri, Record(value, align, n_rows, present)));
}
/** Set the node this window is associated with.
@@ -208,6 +212,8 @@ PropertiesWindow::set_object(SPtr<const ObjectModel> model)
_property_connection = model->signal_property().connect(
sigc::mem_fun(this, &PropertiesWindow::property_changed));
+ _property_removed_connection = model->signal_property_removed().connect(
+ sigc::mem_fun(this, &PropertiesWindow::property_removed));
}
Gtk::Widget*
@@ -323,6 +329,14 @@ PropertiesWindow::property_changed(const Raul::URI& predicate,
}
void
+PropertiesWindow::property_removed(const Raul::URI& predicate,
+ const Atom& value)
+{
+ // Bleh, there doesn't seem to be an easy way to remove a Gtk::Table row...
+ set_object(_model);
+}
+
+void
PropertiesWindow::value_edited(const Raul::URI& predicate)
{
Records::iterator r = _records.find(predicate);
@@ -446,16 +460,25 @@ PropertiesWindow::cancel_clicked()
void
PropertiesWindow::apply_clicked()
{
- Resource::Properties properties;
+ Resource::Properties remove;
+ Resource::Properties add;
for (const auto& r : _records) {
const Raul::URI& uri = r.first;
const Record& record = r.second;
- if (!_model->has_property(uri, record.value)) {
- properties.insert(make_pair(uri, record.value));
+ if (record.present_button->get_active()) {
+ if (!_model->has_property(uri, record.value)) {
+ add.insert(make_pair(uri, record.value));
+ }
+ } else {
+ remove.insert(make_pair(uri, record.value));
}
}
- _app->interface()->put(_model->uri(), properties);
+ if (remove.empty()) {
+ _app->interface()->put(_model->uri(), add);
+ } else {
+ _app->interface()->delta(_model->uri(), remove, add);
+ }
}
void