From 5cf681ec91b868e84d422b94f9191b9286b02279 Mon Sep 17 00:00:00 2001 From: Alexander Valavanis Date: Mon, 10 Jul 2017 11:28:46 +0200 Subject: input devices: Update treeview usage --- src/ui/dialog/input.cpp | 58 ++++--------------------------------------------- 1 file changed, 4 insertions(+), 54 deletions(-) (limited to 'src/ui/dialog/input.cpp') diff --git a/src/ui/dialog/input.cpp b/src/ui/dialog/input.cpp index 91611f2f2..5b316936d 100644 --- a/src/ui/dialog/input.cpp +++ b/src/ui/dialog/input.cpp @@ -512,7 +512,7 @@ private: void handleDeviceChange(Glib::RefPtr device); void updateDeviceAxes(Glib::RefPtr device); void updateDeviceButtons(Glib::RefPtr device); - static void updateDeviceLinks(Glib::RefPtr device, Gtk::TreeIter tabletIter, Glib::RefPtr tree); + static void updateDeviceLinks(Glib::RefPtr device, Gtk::TreeIter tabletIter, Gtk::TreeView *tree); static bool findDevice(const Gtk::TreeModel::iterator& iter, Glib::ustring id, @@ -590,7 +590,6 @@ InputDialogImpl::InputDialogImpl() : { Gtk::Box *contents = _getContents(); - treeScroller.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); treeScroller.set_shadow_type(Gtk::SHADOW_IN); treeScroller.add(deviceTree); @@ -661,16 +660,6 @@ InputDialogImpl::InputDialogImpl() : int rowNum = 0; -/* Gtk::Label* lbl = Gtk::manage(new Gtk::Label(_("Name:"))); - axisTable.attach(*lbl, 0, 1, rowNum, rowNum+ 1, - ::Gtk::FILL, - ::Gtk::SHRINK); - axisTable.attach(devName, 1, 2, rowNum, rowNum + 1, - ::Gtk::SHRINK, - ::Gtk::SHRINK); - - rowNum++;*/ - axisFrame.add(axisTable); Gtk::Label *lbl = Gtk::manage(new Gtk::Label(_("Link:"))); @@ -687,19 +676,6 @@ InputDialogImpl::InputDialogImpl() : axisTable.attach(devAxesCount, 1, rowNum, 1, 1); rowNum++; - -/* - lbl = Gtk::manage(new Gtk::Label(_("Actual axes count:"))); - devDetails.attach(*lbl, 0, 1, rowNum, rowNum+ 1, - ::Gtk::FILL, - ::Gtk::SHRINK); - devDetails.attach(axesCombo, 1, 2, rowNum, rowNum + 1, - ::Gtk::SHRINK, - ::Gtk::SHRINK); - - rowNum++; -*/ - for ( guint barNum = 0; barNum < static_cast(G_N_ELEMENTS(axesValues)); barNum++ ) { lbl = Gtk::manage(new Gtk::Label(_("axis:"))); lbl->set_hexpand(); @@ -721,30 +697,12 @@ InputDialogImpl::InputDialogImpl() : rowNum++; -/* - lbl = Gtk::manage(new Gtk::Label(_("Actual button count:"))); - devDetails.attach(*lbl, 0, 1, rowNum, rowNum+ 1, - ::Gtk::FILL, - ::Gtk::SHRINK); - devDetails.attach(buttonCombo, 1, 2, rowNum, rowNum + 1, - ::Gtk::SHRINK, - ::Gtk::SHRINK); - - rowNum++; -*/ - axisTable.attach(keyVal, 0, rowNum, 2, 1); rowNum++; - testDetector.signal_event().connect(sigc::mem_fun(*this, &InputDialogImpl::eventSnoop)); -// void gdk_input_set_extension_events (GdkWindow *window, -// gint mask, -// GdkExtensionMode mode); - - // TODO: Extension event stuff has been removed from public API in GTK+ 3 // Need to check that this hasn't broken anything testDetector.add_events(Gdk::POINTER_MOTION_MASK|Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK |Gdk::PROXIMITY_IN_MASK|Gdk::PROXIMITY_OUT_MASK|Gdk::SCROLL_MASK); @@ -756,18 +714,12 @@ InputDialogImpl::InputDialogImpl() : axisTable.set_sensitive(false); -/* detailScroller.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); - detailScroller.set_shadow_type(Gtk::SHADOW_NONE); - detailScroller.set_border_width (0); - detailScroller.add(devDetails);*/ - //- 16x16/devices // gnome-dev-mouse-optical // input-mouse // input-tablet // mouse - //Add the TreeView's view columns: deviceTree.append_column("I", getCols().thumbnail); deviceTree.append_column("Bar", getCols().description); @@ -782,8 +734,7 @@ InputDialogImpl::InputDialogImpl() : Inkscape::DeviceManager::getManager().signalDeviceChanged().connect(sigc::mem_fun(*this, &InputDialogImpl::handleDeviceChange)); Inkscape::DeviceManager::getManager().signalAxesChanged().connect(sigc::mem_fun(*this, &InputDialogImpl::updateDeviceAxes)); Inkscape::DeviceManager::getManager().signalButtonsChanged().connect(sigc::mem_fun(*this, &InputDialogImpl::updateDeviceButtons)); - Glib::RefPtr treePtr(&deviceTree); - Inkscape::DeviceManager::getManager().signalLinkChanged().connect(sigc::bind(sigc::ptr_fun(&InputDialogImpl::updateDeviceLinks), deviceIter, treePtr)); + Inkscape::DeviceManager::getManager().signalLinkChanged().connect(sigc::bind(sigc::ptr_fun(&InputDialogImpl::updateDeviceLinks), deviceIter, &deviceTree)); deviceTree.expand_all(); show_all_children(); @@ -1023,8 +974,7 @@ InputDialogImpl::ConfPanel::ConfPanel() : setupTree( confDeviceStore, confDeviceIter ); - Glib::RefPtr treePtr(&confDeviceTree); - Inkscape::DeviceManager::getManager().signalLinkChanged().connect(sigc::bind(sigc::ptr_fun(&InputDialogImpl::updateDeviceLinks), confDeviceIter, treePtr)); + Inkscape::DeviceManager::getManager().signalLinkChanged().connect(sigc::bind(sigc::ptr_fun(&InputDialogImpl::updateDeviceLinks), confDeviceIter, &confDeviceTree)); confDeviceTree.expand_all(); @@ -1316,7 +1266,7 @@ bool InputDialogImpl::findDeviceByLink(const Gtk::TreeModel::iterator& iter, return stop; } -void InputDialogImpl::updateDeviceLinks(Glib::RefPtr device, Gtk::TreeIter tabletIter, Glib::RefPtr tree) +void InputDialogImpl::updateDeviceLinks(Glib::RefPtr device, Gtk::TreeIter tabletIter, Gtk::TreeView *tree) { Glib::RefPtr deviceStore = Glib::RefPtr::cast_dynamic(tree->get_model()); -- cgit v1.2.3