diff options
| author | Martin Owens <doctormo@gmail.com> | 2018-09-27 15:57:34 +0000 |
|---|---|---|
| committer | Martin Owens <doctormo@gmail.com> | 2018-09-27 15:57:34 +0000 |
| commit | cee0577811f45f5b82cbecee14c3df18528b9410 (patch) | |
| tree | b2b4763acc14f86cac31fa508bcaed618c88ce91 /src | |
| parent | Propagate IconRenderer's activate signal so we don't have to guess where the ... (diff) | |
| download | inkscape-cee0577811f45f5b82cbecee14c3df18528b9410.tar.gz inkscape-cee0577811f45f5b82cbecee14c3df18528b9410.zip | |
Make attrdialog use the new iconrenderer sigc++ signal
Diffstat (limited to 'src')
| -rw-r--r-- | src/ui/dialog/attrdialog.cpp | 33 | ||||
| -rw-r--r-- | src/ui/dialog/attrdialog.h | 2 |
2 files changed, 10 insertions, 25 deletions
diff --git a/src/ui/dialog/attrdialog.cpp b/src/ui/dialog/attrdialog.cpp index 0c00a6b76..bb4f241b8 100644 --- a/src/ui/dialog/attrdialog.cpp +++ b/src/ui/dialog/attrdialog.cpp @@ -82,7 +82,8 @@ AttrDialog::AttrDialog(): // isn't in this exact way, the onAttrDelete is called when the header lines are pressed. button->signal_button_release_event().connect(sigc::mem_fun(*this, &AttrDialog::onAttrCreate), false); } - _treeView.signal_button_release_event().connect(sigc::mem_fun(*this, &AttrDialog::onAttrDelete)); + //_treeView.signal_button_release_event().connect(sigc::mem_fun(*this, &AttrDialog::onAttrDelete)); + addRenderer->signal_activated().connect(sigc::mem_fun(*this, &AttrDialog::onAttrDelete)); _treeView.signal_key_press_event().connect(sigc::mem_fun(*this, &AttrDialog::onKeyPressed)); _treeView.set_search_column(-1); @@ -214,31 +215,15 @@ bool AttrDialog::onAttrCreate(GdkEventButton *event) * @return true * Delete the attribute from the xml */ -bool AttrDialog::onAttrDelete(GdkEventButton *event) +//bool AttrDialog::onAttrDelete(GdkEventButton *event) +void AttrDialog::onAttrDelete(Glib::ustring path) { - if (event->type == GDK_BUTTON_RELEASE && event->button == 1 && this->_repr) { - if(!this->_treeView.has_focus()) { - // If the treeView doesn't have focus, then it's probably the edit - // input box or some other widget that propergates to the same click - return false; - } - int x = static_cast<int>(event->x); - int y = static_cast<int>(event->y); - Gtk::TreeModel::Path path; - Gtk::TreeViewColumn *col = nullptr; - int x2, y2 = 0; - if (_treeView.get_path_at_pos(x, y, path, col, x2, y2)) { - Gtk::TreeModel::Row row = *_store->get_iter(path); - if (col == _treeView.get_column(0) && row) { - Glib::ustring name = row[_attrColumns._attributeName]; - this->_repr->setAttribute(name.c_str(), nullptr, false); - this->setUndo(_("Delete attribute")); - // Return true to prevent propergation - return true; - } - } + Gtk::TreeModel::Row row = *_store->get_iter(path); + if (row) { + Glib::ustring name = row[_attrColumns._attributeName]; + this->_repr->setAttribute(name.c_str(), nullptr, false); + this->setUndo(_("Delete attribute")); } - return false; } /** diff --git a/src/ui/dialog/attrdialog.h b/src/ui/dialog/attrdialog.h index c2efb66fc..cbce0c5fb 100644 --- a/src/ui/dialog/attrdialog.h +++ b/src/ui/dialog/attrdialog.h @@ -76,8 +76,8 @@ public: // Signal handlers void onAttrChanged(Inkscape::XML::Node *repr, const gchar * name, const gchar * new_value); + void onAttrDelete(Glib::ustring path); bool onAttrCreate(GdkEventButton *event); - bool onAttrDelete(GdkEventButton *event); bool onKeyPressed(GdkEventKey *event); void nameEdited(const Glib::ustring &path, const Glib::ustring &name); void valueEdited(const Glib::ustring &path, const Glib::ustring &value); |
