From a89dd0f5f45c3df19c3d6756fef83ab06f3d5356 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Mon, 21 May 2012 11:01:41 +0100 Subject: More size-request GTK+ 3 fixes (bzr r11391) --- src/ui/dialog/layers.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/ui/dialog/layers.cpp') diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index 3bd047ebc..6fb41fcbf 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -626,7 +626,13 @@ LayersPanel::LayersPanel() : _scroller.add( _tree ); _scroller.set_policy( Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC ); _scroller.set_shadow_type(Gtk::SHADOW_IN); - Gtk:: Requisition sreq = _scroller.size_request(); + Gtk::Requisition sreq; +#if WITH_GTKMM_3_0 + Gtk::Requisition sreq_natural; + _scroller.get_preferred_size(sreq_natural, sreq); +#else + sreq = _scroller.size_request(); +#endif int minHeight = 70; if (sreq.height < minHeight) { // Set a min height to see the layers when used with Ubuntu liboverlay-scrollbar -- cgit v1.2.3 From de5c278bf27041b3895a53c29b83caa9640bc782 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Wed, 30 May 2012 23:54:24 +0100 Subject: Gtkmm 3.0 fixes for layers dialog (bzr r11436) --- src/ui/dialog/layers.cpp | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'src/ui/dialog/layers.cpp') diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index 6fb41fcbf..b3cef7122 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -16,6 +16,12 @@ #include "layers.h" #include #include + +#if WITH_GTKMM_3_0 +#include +#include +#endif + #include #include "desktop.h" @@ -142,7 +148,20 @@ Gtk::MenuItem& LayersPanel::_addPopupItem( SPDesktop *desktop, unsigned int code } +#if WITH_GTKMM_3_0 + Gtk::MenuItem* item = 0; + + if (wrapped) { + item = Gtk::manage(new Gtk::ImageMenuItem(*wrapped, label)); + } else { + item = Gtk::manage(new Gtk::MenuItem(label)); + } + + item->signal_activate().connect(sigc::bind(sigc::mem_fun(*this, &LayersPanel::_takeAction), id)); + _popupMenu.append(*item); + return *item; +#else Gtk::Menu::MenuList& menulist = _popupMenu.items(); if ( wrapped ) { @@ -150,7 +169,9 @@ Gtk::MenuItem& LayersPanel::_addPopupItem( SPDesktop *desktop, unsigned int code } else { menulist.push_back( Gtk::Menu_Helpers::MenuElem( label, sigc::bind( sigc::mem_fun(*this, &LayersPanel::_takeAction), id)) ); } + return menulist.back(); +#endif } void LayersPanel::_fireAction( unsigned int code ) @@ -649,7 +670,12 @@ LayersPanel::LayersPanel() : SPDesktop* targetDesktop = getDesktop(); +#if !WITH_GTKMM_3_0 + // TODO: This has been removed from Gtkmm 3.0. Check that everything still + // looks OK! _buttonsRow.set_child_min_width( 16 ); +#endif + _buttonsRow.set_layout (Gtk::BUTTONBOX_END); Gtk::Button* btn = manage( new Gtk::Button() ); @@ -703,7 +729,12 @@ LayersPanel::LayersPanel() : _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_NEW, 0, "New", (int)BUTTON_NEW ) ); _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_SOLO, 0, "Solo", (int)BUTTON_SOLO ) ); - _popupMenu.items().push_back( Gtk::Menu_Helpers::SeparatorElem() ); +#if WITH_GTKMM_3_0 + Gtk::MenuItem* item = Gtk::manage(new Gtk::SeparatorMenuItem()); + _popupMenu.append(*item); +#else + _popupMenu.items().push_back( Gtk::Menu_Helpers::SeparatorElem() ); +#endif _watchingNonTop.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_RAISE, GTK_STOCK_GO_UP, "Up", (int)BUTTON_UP ) ); _watchingNonBottom.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_LOWER, GTK_STOCK_GO_DOWN, "Down", (int)BUTTON_DOWN ) ); -- cgit v1.2.3 From 180528a72e66d1e6eb9a604dac274709a347a094 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Thu, 31 May 2012 01:11:59 +0100 Subject: Tidy up deprecated Gtkmm menu stuff (bzr r11440) --- src/ui/dialog/layers.cpp | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) (limited to 'src/ui/dialog/layers.cpp') diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index b3cef7122..0a6900066 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -16,11 +16,8 @@ #include "layers.h" #include #include - -#if WITH_GTKMM_3_0 #include #include -#endif #include @@ -148,30 +145,18 @@ Gtk::MenuItem& LayersPanel::_addPopupItem( SPDesktop *desktop, unsigned int code } -#if WITH_GTKMM_3_0 Gtk::MenuItem* item = 0; if (wrapped) { - item = Gtk::manage(new Gtk::ImageMenuItem(*wrapped, label)); + item = Gtk::manage(new Gtk::ImageMenuItem(*wrapped, label, true)); } else { - item = Gtk::manage(new Gtk::MenuItem(label)); + item = Gtk::manage(new Gtk::MenuItem(label, true)); } item->signal_activate().connect(sigc::bind(sigc::mem_fun(*this, &LayersPanel::_takeAction), id)); _popupMenu.append(*item); return *item; -#else - Gtk::Menu::MenuList& menulist = _popupMenu.items(); - - if ( wrapped ) { - menulist.push_back( Gtk::Menu_Helpers::ImageMenuElem( label, *wrapped, sigc::bind( sigc::mem_fun(*this, &LayersPanel::_takeAction), id)) ); - } else { - menulist.push_back( Gtk::Menu_Helpers::MenuElem( label, sigc::bind( sigc::mem_fun(*this, &LayersPanel::_takeAction), id)) ); - } - - return menulist.back(); -#endif } void LayersPanel::_fireAction( unsigned int code ) @@ -729,12 +714,8 @@ LayersPanel::LayersPanel() : _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_NEW, 0, "New", (int)BUTTON_NEW ) ); _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_SOLO, 0, "Solo", (int)BUTTON_SOLO ) ); -#if WITH_GTKMM_3_0 Gtk::MenuItem* item = Gtk::manage(new Gtk::SeparatorMenuItem()); _popupMenu.append(*item); -#else - _popupMenu.items().push_back( Gtk::Menu_Helpers::SeparatorElem() ); -#endif _watchingNonTop.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_RAISE, GTK_STOCK_GO_UP, "Up", (int)BUTTON_UP ) ); _watchingNonBottom.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_LOWER, GTK_STOCK_GO_DOWN, "Down", (int)BUTTON_DOWN ) ); -- cgit v1.2.3 From 23b6b126c73efed2f651727f5f0c5763de3fd57c Mon Sep 17 00:00:00 2001 From: John Smith Date: Thu, 5 Jul 2012 09:35:33 +0900 Subject: Fix for 181473 : Layers drag and drop (bzr r11526) --- src/ui/dialog/layers.cpp | 144 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 137 insertions(+), 7 deletions(-) (limited to 'src/ui/dialog/layers.cpp') diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index 0a6900066..77873e5ec 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -66,7 +66,8 @@ enum { BUTTON_DOWN, BUTTON_DUPLICATE, BUTTON_DELETE, - BUTTON_SOLO + BUTTON_SOLO, + DRAGNDROP }; class LayersPanel::InternalUIBounce @@ -195,7 +196,7 @@ bool LayersPanel::_executeAction() // Make sure selected layer hasn't changed since the action was triggered if ( _pending && ( - (_pending->_actionCode == BUTTON_NEW) + (_pending->_actionCode == BUTTON_NEW || _pending->_actionCode == DRAGNDROP) || !( (_desktop && _desktop->currentLayer()) && (_desktop->currentLayer() != _pending->_target) ) @@ -250,6 +251,11 @@ bool LayersPanel::_executeAction() _fireAction( SP_VERB_LAYER_SOLO ); } break; + case DRAGNDROP: + { + _doTreeMove( ); + } + break; } delete _pending; @@ -503,10 +509,11 @@ void LayersPanel::_toggled( Glib::ustring const& str, int targetCol ) void LayersPanel::_handleButtonEvent(GdkEventButton* evt) { + static unsigned doubleclick = 0; + // TODO - fix to a better is-popup function if ( (evt->type == GDK_BUTTON_PRESS) && (evt->button == 3) ) { - { Gtk::TreeModel::Path path; Gtk::TreeViewColumn* col = 0; @@ -523,21 +530,131 @@ void LayersPanel::_handleButtonEvent(GdkEventButton* evt) } } + + if ( (evt->type == GDK_2BUTTON_PRESS) && (evt->button == 1) ) { + doubleclick = 1; + } + + if ( evt->type == GDK_BUTTON_RELEASE && doubleclick) { + doubleclick = 0; + Gtk::TreeModel::Path path; + Gtk::TreeViewColumn* col = 0; + int x = static_cast(evt->x); + int y = static_cast(evt->y); + int x2 = 0; + int y2 = 0; + if ( _tree.get_path_at_pos( x, y, path, col, x2, y2 ) && col == _name_column) { + // Double click on the Layer name, enable editing + _text_renderer->property_editable() = true; + _tree.set_cursor (path, *_name_column, true); + grab_focus(); + } + } + +} + +/* + * Drap and drop within the tree + * Save the drag source and drop target SPObjects and if its a drag between layers or into (sublayer) a layer + */ +bool LayersPanel::_handleDragDrop(const Glib::RefPtr& context, int x, int y, guint time) +{ + int cell_x = 0, cell_y = 0; + Gtk::TreeModel::Path target_path; + Gtk::TreeView::Column *target_column; + SPObject *selected = _selectedLayer(); + + _dnd_into = false; + _dnd_target = NULL; + _dnd_source = ( selected && SP_IS_ITEM(selected) ) ? SP_ITEM(selected) : 0; + + if (_tree.get_path_at_pos (x, y, target_path, target_column, cell_x, cell_y)) { + // Are we before, inside or after the drop layer + Gdk::Rectangle rect; + _tree.get_background_area (target_path, *target_column, rect); + int cell_height = rect.get_height(); + _dnd_into = (cell_y > (int)(cell_height * 1/3) && cell_y <= (int)(cell_height * 2/3)); + if (cell_y > (int)(cell_height * 2/3)) { + Gtk::TreeModel::Path next_path = target_path; + next_path.next(); + if (_store->iter_is_valid(_store->get_iter(next_path))) { + target_path = next_path; + } else { + // Dragging to the "end" + Gtk::TreeModel::Path up_path = target_path; + up_path.up(); + if (_store->iter_is_valid(_store->get_iter(up_path))) { + // Drop into parent + target_path = up_path; + _dnd_into = true; + } else { + // Drop into the top level + _dnd_target = NULL; + } + } + } + Gtk::TreeModel::iterator iter = _store->get_iter(target_path); + if (_store->iter_is_valid(iter)) { + Gtk::TreeModel::Row row = *iter; + SPObject *obj = row[_model->_colObject]; + _dnd_target = ( obj && SP_IS_ITEM(obj) ) ? SP_ITEM(obj) : 0; + } + } + + _takeAction(DRAGNDROP); + + return false; +} + +/* + * Move a layer in response to a drag & drop action + */ +void LayersPanel::_doTreeMove( ) +{ + if (_dnd_source ) { + _dnd_source->moveTo(_dnd_target, _dnd_into); + _selectLayer(_dnd_source); + _dnd_source = NULL; + DocumentUndo::done( _desktop->doc() , SP_VERB_NONE, + _("Moved layer")); + + } +} + + +void LayersPanel::_handleEdited(const Glib::ustring& path, const Glib::ustring& new_text) +{ + Gtk::TreeModel::iterator iter = _tree.get_model()->get_iter(path); + Gtk::TreeModel::Row row = *iter; + + _renameLayer(row, new_text); + _text_renderer->property_editable() = false; +} + +void LayersPanel::_handleEditingCancelled() +{ + _text_renderer->property_editable() = false; } void LayersPanel::_handleRowChange( Gtk::TreeModel::Path const& /*path*/, Gtk::TreeModel::iterator const& iter ) { Gtk::TreeModel::Row row = *iter; + Glib::ustring label = row[_model->_colLabel]; + _renameLayer(row, label); +} + +void LayersPanel::_renameLayer(Gtk::TreeModel::Row row, const Glib::ustring& name) +{ if ( row && _desktop && _desktop->layer_manager) { SPObject* obj = row[_model->_colObject]; if ( obj ) { gchar const* oldLabel = obj->label(); - Glib::ustring tmp = row[_model->_colLabel]; - if ( oldLabel && oldLabel[0] && !tmp.empty() && (tmp != oldLabel) ) { - _desktop->layer_manager->renameLayer( obj, tmp.c_str(), FALSE ); + if ( oldLabel && oldLabel[0] && !name.empty() && (name != oldLabel) ) { + _desktop->layer_manager->renameLayer( obj, name.c_str(), FALSE ); DocumentUndo::done( _desktop->doc() , SP_VERB_NONE, _("Renamed layer")); } + } } } @@ -594,6 +711,8 @@ LayersPanel::LayersPanel() : _tree.set_model( _store ); _tree.set_headers_visible(false); + _tree.set_reorderable(true); + _tree.enable_model_drag_dest (Gdk::ACTION_MOVE); Inkscape::UI::Widget::ImageToggler *eyeRenderer = manage( new Inkscape::UI::Widget::ImageToggler( INKSCAPE_ICON("object-visible"), INKSCAPE_ICON("object-hidden")) ); @@ -606,6 +725,7 @@ LayersPanel::LayersPanel() : col->add_attribute( eyeRenderer->property_active(), _model->_colVisible ); } + Inkscape::UI::Widget::ImageToggler * renderer = manage( new Inkscape::UI::Widget::ImageToggler( INKSCAPE_ICON("object-locked"), INKSCAPE_ICON("object-unlocked")) ); int lockedColNum = _tree.append_column("lock", *renderer) - 1; @@ -617,7 +737,10 @@ LayersPanel::LayersPanel() : col->add_attribute( renderer->property_active(), _model->_colLocked ); } - int nameColNum = _tree.append_column_editable("Name", _model->_colLabel) - 1; + _text_renderer = manage(new Gtk::CellRendererText()); + int nameColNum = _tree.append_column("Name", *_text_renderer) - 1; + _name_column = _tree.get_column(nameColNum); + _name_column->add_attribute(_text_renderer->property_text(), _model->_colLabel); _tree.set_expander_column( *_tree.get_column(nameColNum) ); @@ -626,8 +749,15 @@ LayersPanel::LayersPanel() : _selectedConnection = _tree.get_selection()->signal_changed().connect( sigc::mem_fun(*this, &LayersPanel::_pushTreeSelectionToCurrent) ); _tree.get_selection()->set_select_function( sigc::mem_fun(*this, &LayersPanel::_rowSelectFunction) ); + _tree.signal_drag_drop().connect( sigc::mem_fun(*this, &LayersPanel::_handleDragDrop), false); _tree.get_model()->signal_row_changed().connect( sigc::mem_fun(*this, &LayersPanel::_handleRowChange) ); + + + _text_renderer->signal_edited().connect( sigc::mem_fun(*this, &LayersPanel::_handleEdited) ); + _text_renderer->signal_editing_canceled().connect( sigc::mem_fun(*this, &LayersPanel::_handleEditingCancelled) ); + _tree.signal_button_press_event().connect_notify( sigc::mem_fun(*this, &LayersPanel::_handleButtonEvent) ); + _tree.signal_button_release_event().connect_notify( sigc::mem_fun(*this, &LayersPanel::_handleButtonEvent) ); _scroller.add( _tree ); _scroller.set_policy( Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC ); -- cgit v1.2.3 From 49efde87b3c658385e2f06b2b662308b5982c710 Mon Sep 17 00:00:00 2001 From: John Smith Date: Sun, 8 Jul 2012 10:56:11 +0900 Subject: Fix for 181473 : Layer label edit keyboard shortcuts (bzr r11532) --- src/ui/dialog/layers.cpp | 42 ++++++++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 10 deletions(-) (limited to 'src/ui/dialog/layers.cpp') diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index 77873e5ec..e8fe6dc08 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -39,7 +39,7 @@ #include "widgets/icon.h" #include "xml/repr.h" #include "sp-root.h" - +#include "event-context.h" //#define DUMP_LAYERS 1 @@ -507,40 +507,61 @@ void LayersPanel::_toggled( Glib::ustring const& str, int targetCol ) } } -void LayersPanel::_handleButtonEvent(GdkEventButton* evt) +bool LayersPanel::_handleKeyEvent(GdkEventKey *event) +{ + + switch (get_group0_keyval(event)) { + case GDK_KEY_Return: + case GDK_KEY_KP_Enter: + case GDK_KEY_F2: { + Gtk::TreeModel::iterator iter = _tree.get_selection()->get_selected(); + if (iter && !_text_renderer->property_editable()) { + Gtk::TreeModel::Path *path = new Gtk::TreeModel::Path(iter); + // Edit the layer label + _text_renderer->property_editable() = true; + _tree.set_cursor(*path, *_name_column, true); + grab_focus(); + return true; + } + } + break; + } + return false; +} +void LayersPanel::_handleButtonEvent(GdkEventButton* event) { static unsigned doubleclick = 0; // TODO - fix to a better is-popup function - if ( (evt->type == GDK_BUTTON_PRESS) && (evt->button == 3) ) { + if ( (event->type == GDK_BUTTON_PRESS) && (event->button == 3) ) { { Gtk::TreeModel::Path path; Gtk::TreeViewColumn* col = 0; - int x = static_cast(evt->x); - int y = static_cast(evt->y); + int x = static_cast(event->x); + int y = static_cast(event->y); int x2 = 0; int y2 = 0; if ( _tree.get_path_at_pos( x, y, path, col, x2, y2 ) ) { _checkTreeSelection(); - _popupMenu.popup(evt->button, evt->time); + _popupMenu.popup(event->button, event->time); } } } - if ( (evt->type == GDK_2BUTTON_PRESS) && (evt->button == 1) ) { + if ( (event->type == GDK_2BUTTON_PRESS) && (event->button == 1) ) { doubleclick = 1; } - if ( evt->type == GDK_BUTTON_RELEASE && doubleclick) { + if ( event->type == GDK_BUTTON_RELEASE && doubleclick) { doubleclick = 0; Gtk::TreeModel::Path path; Gtk::TreeViewColumn* col = 0; - int x = static_cast(evt->x); - int y = static_cast(evt->y); + int x = static_cast(event->x); + int y = static_cast(event->y); int x2 = 0; int y2 = 0; if ( _tree.get_path_at_pos( x, y, path, col, x2, y2 ) && col == _name_column) { @@ -758,6 +779,7 @@ LayersPanel::LayersPanel() : _tree.signal_button_press_event().connect_notify( sigc::mem_fun(*this, &LayersPanel::_handleButtonEvent) ); _tree.signal_button_release_event().connect_notify( sigc::mem_fun(*this, &LayersPanel::_handleButtonEvent) ); + _tree.signal_key_press_event().connect( sigc::mem_fun(*this, &LayersPanel::_handleKeyEvent), false ); _scroller.add( _tree ); _scroller.set_policy( Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC ); -- cgit v1.2.3 From 300b0183542d39469cfeb28c06530cee0b2d5d37 Mon Sep 17 00:00:00 2001 From: John Smith Date: Thu, 12 Jul 2012 10:00:16 +0900 Subject: Fix for 377294 : Layer dialog rename when no label exists (bzr r11541) --- src/ui/dialog/layers.cpp | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'src/ui/dialog/layers.cpp') diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index e8fe6dc08..c01b533a3 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -657,20 +657,13 @@ void LayersPanel::_handleEditingCancelled() _text_renderer->property_editable() = false; } -void LayersPanel::_handleRowChange( Gtk::TreeModel::Path const& /*path*/, Gtk::TreeModel::iterator const& iter ) -{ - Gtk::TreeModel::Row row = *iter; - Glib::ustring label = row[_model->_colLabel]; - _renameLayer(row, label); -} - void LayersPanel::_renameLayer(Gtk::TreeModel::Row row, const Glib::ustring& name) { if ( row && _desktop && _desktop->layer_manager) { SPObject* obj = row[_model->_colObject]; if ( obj ) { gchar const* oldLabel = obj->label(); - if ( oldLabel && oldLabel[0] && !name.empty() && (name != oldLabel) ) { + if ( !name.empty() && (!oldLabel || name != oldLabel) ) { _desktop->layer_manager->renameLayer( obj, name.c_str(), FALSE ); DocumentUndo::done( _desktop->doc() , SP_VERB_NONE, _("Renamed layer")); @@ -771,8 +764,6 @@ LayersPanel::LayersPanel() : _tree.get_selection()->set_select_function( sigc::mem_fun(*this, &LayersPanel::_rowSelectFunction) ); _tree.signal_drag_drop().connect( sigc::mem_fun(*this, &LayersPanel::_handleDragDrop), false); - _tree.get_model()->signal_row_changed().connect( sigc::mem_fun(*this, &LayersPanel::_handleRowChange) ); - _text_renderer->signal_edited().connect( sigc::mem_fun(*this, &LayersPanel::_handleEdited) ); _text_renderer->signal_editing_canceled().connect( sigc::mem_fun(*this, &LayersPanel::_handleEditingCancelled) ); -- cgit v1.2.3 From eef4e4067dbd2997e08ae87990d258f64f335df7 Mon Sep 17 00:00:00 2001 From: John Smith Date: Thu, 12 Jul 2012 18:42:23 +0900 Subject: Fix for 378413 : Show/Hide all layers (bzr r11545) --- src/ui/dialog/layers.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'src/ui/dialog/layers.cpp') diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index c01b533a3..70cf7075c 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -67,6 +67,8 @@ enum { BUTTON_DUPLICATE, BUTTON_DELETE, BUTTON_SOLO, + BUTTON_SHOW_ALL, + BUTTON_HIDE_ALL, DRAGNDROP }; @@ -251,6 +253,16 @@ bool LayersPanel::_executeAction() _fireAction( SP_VERB_LAYER_SOLO ); } break; + case BUTTON_SHOW_ALL: + { + _fireAction( SP_VERB_LAYER_SHOW_ALL ); + } + break; + case BUTTON_HIDE_ALL: + { + _fireAction( SP_VERB_LAYER_HIDE_ALL ); + } + break; case DRAGNDROP: { _doTreeMove( ); @@ -855,10 +867,14 @@ LayersPanel::LayersPanel() : _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_RENAME, 0, "Rename", (int)BUTTON_RENAME ) ); _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_DUPLICATE, 0, "Duplicate", (int)BUTTON_DUPLICATE ) ); _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_NEW, 0, "New", (int)BUTTON_NEW ) ); + + _popupMenu.append(*manage(new Gtk::SeparatorMenuItem())); + _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_SOLO, 0, "Solo", (int)BUTTON_SOLO ) ); + _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_SHOW_ALL, 0, "Show All", (int)BUTTON_SHOW_ALL ) ); + _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_HIDE_ALL, 0, "Hide All", (int)BUTTON_HIDE_ALL ) ); - Gtk::MenuItem* item = Gtk::manage(new Gtk::SeparatorMenuItem()); - _popupMenu.append(*item); + _popupMenu.append(*manage(new Gtk::SeparatorMenuItem())); _watchingNonTop.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_RAISE, GTK_STOCK_GO_UP, "Up", (int)BUTTON_UP ) ); _watchingNonBottom.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_LOWER, GTK_STOCK_GO_DOWN, "Down", (int)BUTTON_DOWN ) ); -- cgit v1.2.3 From 1208e5f7938731244720438bff526c0b6e07c54f Mon Sep 17 00:00:00 2001 From: John Smith Date: Tue, 9 Oct 2012 15:26:18 +0900 Subject: Fix for 191020 : Lock/Unlock all layers (bzr r11764) --- src/ui/dialog/layers.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/ui/dialog/layers.cpp') diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index 70cf7075c..44eef89bb 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -69,6 +69,8 @@ enum { BUTTON_SOLO, BUTTON_SHOW_ALL, BUTTON_HIDE_ALL, + BUTTON_LOCK_ALL, + BUTTON_UNLOCK_ALL, DRAGNDROP }; @@ -263,6 +265,16 @@ bool LayersPanel::_executeAction() _fireAction( SP_VERB_LAYER_HIDE_ALL ); } break; + case BUTTON_LOCK_ALL: + { + _fireAction( SP_VERB_LAYER_LOCK_ALL ); + } + break; + case BUTTON_UNLOCK_ALL: + { + _fireAction( SP_VERB_LAYER_UNLOCK_ALL ); + } + break; case DRAGNDROP: { _doTreeMove( ); @@ -876,6 +888,11 @@ LayersPanel::LayersPanel() : _popupMenu.append(*manage(new Gtk::SeparatorMenuItem())); + _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_LOCK_ALL, 0, "Lock All", (int)BUTTON_LOCK_ALL ) ); + _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_UNLOCK_ALL, 0, "Unlock All", (int)BUTTON_UNLOCK_ALL ) ); + + _popupMenu.append(*manage(new Gtk::SeparatorMenuItem())); + _watchingNonTop.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_RAISE, GTK_STOCK_GO_UP, "Up", (int)BUTTON_UP ) ); _watchingNonBottom.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_LOWER, GTK_STOCK_GO_DOWN, "Down", (int)BUTTON_DOWN ) ); -- cgit v1.2.3 From c520388928f8cc85d91f24a2f01fa7549096fe83 Mon Sep 17 00:00:00 2001 From: John Smith Date: Thu, 11 Oct 2012 18:43:21 +0900 Subject: Fix for 191020 : Lock/Unlock all layers - Lock other layers (bzr r11779) --- src/ui/dialog/layers.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/ui/dialog/layers.cpp') diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index 44eef89bb..457f7c147 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -69,6 +69,7 @@ enum { BUTTON_SOLO, BUTTON_SHOW_ALL, BUTTON_HIDE_ALL, + BUTTON_LOCK_OTHERS, BUTTON_LOCK_ALL, BUTTON_UNLOCK_ALL, DRAGNDROP @@ -265,6 +266,11 @@ bool LayersPanel::_executeAction() _fireAction( SP_VERB_LAYER_HIDE_ALL ); } break; + case BUTTON_LOCK_OTHERS: + { + _fireAction( SP_VERB_LAYER_LOCK_OTHERS ); + } + break; case BUTTON_LOCK_ALL: { _fireAction( SP_VERB_LAYER_LOCK_ALL ); @@ -888,6 +894,7 @@ LayersPanel::LayersPanel() : _popupMenu.append(*manage(new Gtk::SeparatorMenuItem())); + _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_LOCK_OTHERS, 0, "Lock Others", (int)BUTTON_LOCK_OTHERS ) ); _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_LOCK_ALL, 0, "Lock All", (int)BUTTON_LOCK_ALL ) ); _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_UNLOCK_ALL, 0, "Unlock All", (int)BUTTON_UNLOCK_ALL ) ); -- cgit v1.2.3 From a67988fae58348562bcde83ea1c5fb8aa4eecb78 Mon Sep 17 00:00:00 2001 From: John Smith Date: Fri, 12 Oct 2012 13:15:19 +0900 Subject: Fix for 177931 : Shift click layer icons to trigger solo (bzr r11784) --- src/ui/dialog/layers.cpp | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) (limited to 'src/ui/dialog/layers.cpp') diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index 457f7c147..55a2f19a5 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -562,26 +562,36 @@ void LayersPanel::_handleButtonEvent(GdkEventButton* event) { static unsigned doubleclick = 0; - // TODO - fix to a better is-popup function if ( (event->type == GDK_BUTTON_PRESS) && (event->button == 3) ) { + // TODO - fix to a better is-popup function + Gtk::TreeModel::Path path; + int x = static_cast(event->x); + int y = static_cast(event->y); + if ( _tree.get_path_at_pos( x, y, path ) ) { + _checkTreeSelection(); + _popupMenu.popup(event->button, event->time); + } + } - { - Gtk::TreeModel::Path path; - Gtk::TreeViewColumn* col = 0; - int x = static_cast(event->x); - int y = static_cast(event->y); - int x2 = 0; - int y2 = 0; - if ( _tree.get_path_at_pos( x, y, - path, col, - x2, y2 ) ) { - _checkTreeSelection(); - _popupMenu.popup(event->button, event->time); + if ( event->type == GDK_BUTTON_RELEASE && (event->button == 1) + && (event->state & GDK_SHIFT_MASK)) { + // Shift left click on the visible/lock columns toggles "solo" mode + Gtk::TreeModel::Path path; + Gtk::TreeViewColumn* col = 0; + int x = static_cast(event->x); + int y = static_cast(event->y); + int x2 = 0; + int y2 = 0; + if ( _tree.get_path_at_pos( x, y, path, col, x2, y2 ) ) { + if (col == _tree.get_column(COL_VISIBLE-1)) { + _takeAction(BUTTON_SOLO); + } else if (col == _tree.get_column(COL_LOCKED-1)) { + _takeAction(BUTTON_LOCK_OTHERS); } } - } + if ( (event->type == GDK_2BUTTON_PRESS) && (event->button == 1) ) { doubleclick = 1; } -- cgit v1.2.3 From 092ea6e9a6ca2a4af8b5fd2f54220dfaddeac8d5 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Tue, 23 Oct 2012 10:07:26 +0100 Subject: Use Gtk::Box to arrange layer dialog buttons. Prevents oversized buttons in GTK+ 3 Fixed bugs: - https://launchpad.net/bugs/1069181 (bzr r11823) --- src/ui/dialog/layers.cpp | 52 ++++++++++++++++++++---------------------------- 1 file changed, 22 insertions(+), 30 deletions(-) (limited to 'src/ui/dialog/layers.cpp') diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index 55a2f19a5..f851f72c1 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -838,43 +838,34 @@ LayersPanel::LayersPanel() : SPDesktop* targetDesktop = getDesktop(); -#if !WITH_GTKMM_3_0 - // TODO: This has been removed from Gtkmm 3.0. Check that everything still - // looks OK! - _buttonsRow.set_child_min_width( 16 ); -#endif - - _buttonsRow.set_layout (Gtk::BUTTONBOX_END); - Gtk::Button* btn = manage( new Gtk::Button() ); _styleButton( *btn, targetDesktop, SP_VERB_LAYER_NEW, GTK_STOCK_ADD, C_("Layers", "New") ); btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &LayersPanel::_takeAction), (int)BUTTON_NEW) ); - _buttonsRow.add( *btn ); - _buttonsRow.set_child_secondary( *btn , true); - - btn = manage( new Gtk::Button() ); - _styleButton( *btn, targetDesktop, SP_VERB_LAYER_TO_TOP, GTK_STOCK_GOTO_TOP, C_("Layers", "Top") ); - btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &LayersPanel::_takeAction), (int)BUTTON_TOP) ); - _watchingNonTop.push_back( btn ); - _buttonsRow.add( *btn ); + _buttonsSecondary.pack_start(*btn, Gtk::PACK_SHRINK); btn = manage( new Gtk::Button() ); - _styleButton( *btn, targetDesktop, SP_VERB_LAYER_RAISE, GTK_STOCK_GO_UP, C_("Layers", "Up") ); - btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &LayersPanel::_takeAction), (int)BUTTON_UP) ); - _watchingNonTop.push_back( btn ); - _buttonsRow.add( *btn ); - + _styleButton( *btn, targetDesktop, SP_VERB_LAYER_TO_BOTTOM, GTK_STOCK_GOTO_BOTTOM, C_("Layers", "Bot") ); + btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &LayersPanel::_takeAction), (int)BUTTON_BOTTOM) ); + _watchingNonBottom.push_back( btn ); + _buttonsPrimary.pack_end(*btn, Gtk::PACK_SHRINK); + btn = manage( new Gtk::Button() ); _styleButton( *btn, targetDesktop, SP_VERB_LAYER_LOWER, GTK_STOCK_GO_DOWN, C_("Layers", "Dn") ); btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &LayersPanel::_takeAction), (int)BUTTON_DOWN) ); _watchingNonBottom.push_back( btn ); - _buttonsRow.add( *btn ); - + _buttonsPrimary.pack_end(*btn, Gtk::PACK_SHRINK); + btn = manage( new Gtk::Button() ); - _styleButton( *btn, targetDesktop, SP_VERB_LAYER_TO_BOTTOM, GTK_STOCK_GOTO_BOTTOM, C_("Layers", "Bot") ); - btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &LayersPanel::_takeAction), (int)BUTTON_BOTTOM) ); - _watchingNonBottom.push_back( btn ); - _buttonsRow.add( *btn ); + _styleButton( *btn, targetDesktop, SP_VERB_LAYER_RAISE, GTK_STOCK_GO_UP, C_("Layers", "Up") ); + btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &LayersPanel::_takeAction), (int)BUTTON_UP) ); + _watchingNonTop.push_back( btn ); + _buttonsPrimary.pack_end(*btn, Gtk::PACK_SHRINK); + + btn = manage( new Gtk::Button() ); + _styleButton( *btn, targetDesktop, SP_VERB_LAYER_TO_TOP, GTK_STOCK_GOTO_TOP, C_("Layers", "Top") ); + btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &LayersPanel::_takeAction), (int)BUTTON_TOP) ); + _watchingNonTop.push_back( btn ); + _buttonsPrimary.pack_end(*btn, Gtk::PACK_SHRINK); // btn = manage( new Gtk::Button("Dup") ); // btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &LayersPanel::_takeAction), (int)BUTTON_DUPLICATE) ); @@ -884,9 +875,10 @@ LayersPanel::LayersPanel() : _styleButton( *btn, targetDesktop, SP_VERB_LAYER_DELETE, GTK_STOCK_REMOVE, _("X") ); btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &LayersPanel::_takeAction), (int)BUTTON_DELETE) ); _watching.push_back( btn ); - _buttonsRow.add( *btn ); - _buttonsRow.set_child_secondary( *btn , true); - + _buttonsSecondary.pack_start(*btn, Gtk::PACK_SHRINK); + + _buttonsRow.pack_start(_buttonsSecondary, Gtk::PACK_EXPAND_WIDGET); + _buttonsRow.pack_end(_buttonsPrimary, Gtk::PACK_EXPAND_WIDGET); -- cgit v1.2.3 From ba3802c42dbf90ec56b235d96b9ab0a7736ae290 Mon Sep 17 00:00:00 2001 From: John Smith Date: Sun, 18 Nov 2012 10:39:47 +0900 Subject: Fix for 177931 : Layer dialog toggle solo mode with Shift/Alt click (bzr r11879) --- src/ui/dialog/layers.cpp | 57 +++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 47 insertions(+), 10 deletions(-) (limited to 'src/ui/dialog/layers.cpp') diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index f851f72c1..ffdf27b62 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -558,7 +558,8 @@ bool LayersPanel::_handleKeyEvent(GdkEventKey *event) } return false; } -void LayersPanel::_handleButtonEvent(GdkEventButton* event) + +bool LayersPanel::_handleButtonEvent(GdkEventButton* event) { static unsigned doubleclick = 0; @@ -573,9 +574,9 @@ void LayersPanel::_handleButtonEvent(GdkEventButton* event) } } - if ( event->type == GDK_BUTTON_RELEASE && (event->button == 1) - && (event->state & GDK_SHIFT_MASK)) { - // Shift left click on the visible/lock columns toggles "solo" mode + if ( (event->type == GDK_BUTTON_PRESS) && (event->button == 1) + && (event->state & GDK_MOD1_MASK)) { + // Alt left click on the visible/lock columns - eat this event to keep row selection Gtk::TreeModel::Path path; Gtk::TreeViewColumn* col = 0; int x = static_cast(event->x); @@ -583,10 +584,45 @@ void LayersPanel::_handleButtonEvent(GdkEventButton* event) int x2 = 0; int y2 = 0; if ( _tree.get_path_at_pos( x, y, path, col, x2, y2 ) ) { - if (col == _tree.get_column(COL_VISIBLE-1)) { - _takeAction(BUTTON_SOLO); - } else if (col == _tree.get_column(COL_LOCKED-1)) { - _takeAction(BUTTON_LOCK_OTHERS); + if (col == _tree.get_column(COL_VISIBLE-1) || + col == _tree.get_column(COL_LOCKED-1)) { + return true; + } + } + } + + // TODO - ImageToggler doesn't seem to handle Shift/Alt clicks - so we deal with them here. + if ( (event->type == GDK_BUTTON_RELEASE) && (event->button == 1) + && (event->state & (GDK_SHIFT_MASK | GDK_MOD1_MASK))) { + + Gtk::TreeModel::Path path; + Gtk::TreeViewColumn* col = 0; + int x = static_cast(event->x); + int y = static_cast(event->y); + int x2 = 0; + int y2 = 0; + if ( _tree.get_path_at_pos( x, y, path, col, x2, y2 ) ) { + if (event->state & GDK_SHIFT_MASK) { + // Shift left click on the visible/lock columns toggles "solo" mode + if (col == _tree.get_column(COL_VISIBLE - 1)) { + _takeAction(BUTTON_SOLO); + } else if (col == _tree.get_column(COL_LOCKED - 1)) { + _takeAction(BUTTON_LOCK_OTHERS); + } + } else if (event->state & GDK_MOD1_MASK) { + // Alt+left click on the visible/lock columns toggles "solo" mode and preserves selection + Gtk::TreeModel::iterator iter = _store->get_iter(path); + if (_store->iter_is_valid(iter)) { + Gtk::TreeModel::Row row = *iter; + SPObject *obj = row[_model->_colObject]; + if (col == _tree.get_column(COL_VISIBLE - 1)) { + _desktop->toggleLayerSolo( obj ); + DocumentUndo::maybeDone(_desktop->doc(), "layer:solo", SP_VERB_LAYER_SOLO, _("Toggle layer solo")); + } else if (col == _tree.get_column(COL_LOCKED - 1)) { + _desktop->toggleLockOtherLayers( obj ); + DocumentUndo::maybeDone(_desktop->doc(), "layer:lockothers", SP_VERB_LAYER_LOCK_OTHERS, _("Lock other layers")); + } + } } } } @@ -612,6 +648,7 @@ void LayersPanel::_handleButtonEvent(GdkEventButton* event) } } + return false; } /* @@ -808,8 +845,8 @@ LayersPanel::LayersPanel() : _text_renderer->signal_edited().connect( sigc::mem_fun(*this, &LayersPanel::_handleEdited) ); _text_renderer->signal_editing_canceled().connect( sigc::mem_fun(*this, &LayersPanel::_handleEditingCancelled) ); - _tree.signal_button_press_event().connect_notify( sigc::mem_fun(*this, &LayersPanel::_handleButtonEvent) ); - _tree.signal_button_release_event().connect_notify( sigc::mem_fun(*this, &LayersPanel::_handleButtonEvent) ); + _tree.signal_button_press_event().connect( sigc::mem_fun(*this, &LayersPanel::_handleButtonEvent), false ); + _tree.signal_button_release_event().connect( sigc::mem_fun(*this, &LayersPanel::_handleButtonEvent), false ); _tree.signal_key_press_event().connect( sigc::mem_fun(*this, &LayersPanel::_handleKeyEvent), false ); _scroller.add( _tree ); -- cgit v1.2.3 From ab63da7c5449a97ca9eb698b0d461184464c26c8 Mon Sep 17 00:00:00 2001 From: su_v Date: Mon, 26 Nov 2012 07:29:21 +0100 Subject: Fix undo history entry for layer renaming to be consistent with 'Rename Layer' dialog (bzr r11903) --- src/ui/dialog/layers.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui/dialog/layers.cpp') diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index ffdf27b62..4f7b8f27c 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -743,7 +743,7 @@ void LayersPanel::_renameLayer(Gtk::TreeModel::Row row, const Glib::ustring& nam if ( !name.empty() && (!oldLabel || name != oldLabel) ) { _desktop->layer_manager->renameLayer( obj, name.c_str(), FALSE ); DocumentUndo::done( _desktop->doc() , SP_VERB_NONE, - _("Renamed layer")); + _("Rename layer")); } } -- cgit v1.2.3 From cfe9c94712a2ff6849b123672e51b603f20e76ae Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Thu, 10 Jan 2013 23:30:09 -0800 Subject: Warning and dead code cleanup. (bzr r12014) --- src/ui/dialog/layers.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui/dialog/layers.cpp') diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index 4f7b8f27c..fdc33b2a6 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -655,7 +655,7 @@ bool LayersPanel::_handleButtonEvent(GdkEventButton* event) * Drap and drop within the tree * Save the drag source and drop target SPObjects and if its a drag between layers or into (sublayer) a layer */ -bool LayersPanel::_handleDragDrop(const Glib::RefPtr& context, int x, int y, guint time) +bool LayersPanel::_handleDragDrop(const Glib::RefPtr& /*context*/, int x, int y, guint /*time*/) { int cell_x = 0, cell_y = 0; Gtk::TreeModel::Path target_path; -- cgit v1.2.3 From ea952687e7b1ae64c4c30c8eb66bd875d75fec2d Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Sat, 23 Feb 2013 13:57:26 +0000 Subject: Fix missing headers for Gtk+ 3 build Fixed bugs: - https://launchpad.net/bugs/1122816 (bzr r12145) --- src/ui/dialog/layers.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/ui/dialog/layers.cpp') diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index fdc33b2a6..dd147d00f 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -20,6 +20,7 @@ #include #include +#include #include "desktop.h" #include "desktop-style.h" -- cgit v1.2.3 From 21ee7692231394923e753545733183e77d67df44 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Sun, 12 May 2013 13:45:33 +0200 Subject: Fix for Bug #181493 (Locked layers not completely locked) by frenchie4111. Fixed bugs: - https://launchpad.net/bugs/181493 (bzr r12328) --- src/ui/dialog/layers.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/ui/dialog/layers.cpp') diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index dd147d00f..5cc9578f1 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -41,6 +41,7 @@ #include "xml/repr.h" #include "sp-root.h" #include "event-context.h" +#include "selection-chemistry.h" //#define DUMP_LAYERS 1 @@ -536,6 +537,7 @@ void LayersPanel::_toggled( Glib::ustring const& str, int targetCol ) break; } } + Inkscape::SelectionHelper::fixSelection(_desktop); } bool LayersPanel::_handleKeyEvent(GdkEventKey *event) -- cgit v1.2.3 From 6ba58cf2eb05a8e44f21f853dc638a41b6cc59b2 Mon Sep 17 00:00:00 2001 From: Martin Owens Date: Fri, 28 Jun 2013 00:45:10 -0400 Subject: Fix crash when undoing/redoing a duplicate layer. Fixed bugs: - https://launchpad.net/bugs/1183206 (bzr r12395) --- src/ui/dialog/layers.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ui/dialog/layers.cpp') diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index 5cc9578f1..ce923f6b4 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -404,13 +404,13 @@ void LayersPanel::_addLayer( SPDocument* doc, SPObject* layer, Gtk::TreeModel::R SPObject *child = _desktop->layer_manager->nthChildOf(layer, i); if ( child ) { #if DUMP_LAYERS - g_message(" %3d layer:%p {%s} [%s]", level, child, child->id, child->label() ); + g_message(" %3d layer:%p {%s} [%s]", level, child, child->getId(), child->label() ); #endif // DUMP_LAYERS Gtk::TreeModel::iterator iter = parentRow ? _store->prepend(parentRow->children()) : _store->prepend(); Gtk::TreeModel::Row row = *iter; row[_model->_colObject] = child; - row[_model->_colLabel] = child->label() ? child->label() : child->getId(); + row[_model->_colLabel] = child->defaultLabel(); row[_model->_colVisible] = SP_IS_ITEM(child) ? !SP_ITEM(child)->isHidden() : false; row[_model->_colLocked] = SP_IS_ITEM(child) ? SP_ITEM(child)->isLocked() : false; -- cgit v1.2.3 From c3a160589a9cb41c70a56e5e7b66a65857a0d10e Mon Sep 17 00:00:00 2001 From: Eric Greveson Date: Mon, 1 Jul 2013 21:04:32 +0100 Subject: Factored layer model out into new Inkscape::LayerModel class. This allows Inkscape::Selection to use a LayerModel that is not associated with a UI. Changed the interface of verbs (SPAction) to use a new ActionContext rather than UI::View::View, again so that verbs may be used in a console mode. Modified boolean operation verbs to work in console-only mode. Fixed up DESKTOP_IS_ACTIVE macro to work in the case of no desktops. Modified main.cpp to process selections and verbs in no-GUI mode. Other changes are all consequences of the SPDesktop, Selection and LayerModel interface changes. (bzr r12387.1.1) --- src/ui/dialog/layers.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/ui/dialog/layers.cpp') diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index 5cc9578f1..32d85574d 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -27,6 +27,7 @@ #include "document.h" #include "document-undo.h" #include "helper/action.h" +#include "helper/action-context.h" #include "inkscape.h" #include "layer-fns.h" #include "layer-manager.h" @@ -99,7 +100,7 @@ void LayersPanel::_styleButton( Gtk::Button& btn, SPDesktop *desktop, unsigned i if ( desktop ) { Verb *verb = Verb::get( code ); if ( verb ) { - SPAction *action = verb->get_action(desktop); + SPAction *action = verb->get_action(Inkscape::ActionContext(desktop)); if ( !set && action && action->image ) { GtkWidget *child = sp_icon_new( Inkscape::ICON_SIZE_SMALL_TOOLBAR, action->image ); gtk_widget_show( child ); @@ -131,7 +132,7 @@ Gtk::MenuItem& LayersPanel::_addPopupItem( SPDesktop *desktop, unsigned int code if ( desktop ) { Verb *verb = Verb::get( code ); if ( verb ) { - SPAction *action = verb->get_action(desktop); + SPAction *action = verb->get_action(Inkscape::ActionContext(desktop)); if ( !iconWidget && action && action->image ) { iconWidget = sp_icon_new( Inkscape::ICON_SIZE_MENU, action->image ); } @@ -172,7 +173,7 @@ void LayersPanel::_fireAction( unsigned int code ) if ( _desktop ) { Verb *verb = Verb::get( code ); if ( verb ) { - SPAction *action = verb->get_action(_desktop); + SPAction *action = verb->get_action(Inkscape::ActionContext(_desktop)); if ( action ) { sp_action_perform( action, NULL ); // } else { -- cgit v1.2.3 From 2bc1f3fc0275dee7b934ab584457fe3e4754816c Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Sat, 7 Sep 2013 08:46:37 +0200 Subject: Fix for bug #1219175 (Typing in Layers Dialog searches hidden/unhidden state instead of layer name). Fixed bugs: - https://launchpad.net/bugs/1219175 (bzr r12503) --- src/ui/dialog/layers.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/ui/dialog/layers.cpp') diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index c41046123..c01903f94 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -838,7 +838,8 @@ LayersPanel::LayersPanel() : _name_column->add_attribute(_text_renderer->property_text(), _model->_colLabel); _tree.set_expander_column( *_tree.get_column(nameColNum) ); - + _tree.set_search_column(nameColNum + 1); + _compositeSettings.setSubject(&_subject); _selectedConnection = _tree.get_selection()->signal_changed().connect( sigc::mem_fun(*this, &LayersPanel::_pushTreeSelectionToCurrent) ); -- cgit v1.2.3 From 55b451bf382e0c3d5ed8728e42fbb535acfa8a33 Mon Sep 17 00:00:00 2001 From: Markus Engel Date: Thu, 7 Nov 2013 21:44:00 +0100 Subject: First step of moving tools into appropriate namespaces. (bzr r12782) --- src/ui/dialog/layers.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui/dialog/layers.cpp') diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index c01903f94..ff9265c8d 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -544,7 +544,7 @@ void LayersPanel::_toggled( Glib::ustring const& str, int targetCol ) bool LayersPanel::_handleKeyEvent(GdkEventKey *event) { - switch (get_group0_keyval(event)) { + switch (Inkscape::UI::Tools::get_group0_keyval(event)) { case GDK_KEY_Return: case GDK_KEY_KP_Enter: case GDK_KEY_F2: { -- cgit v1.2.3 From c04e30df241a3ee039077425bab9b9c37abe2854 Mon Sep 17 00:00:00 2001 From: Markus Engel Date: Sat, 9 Nov 2013 23:36:13 +0100 Subject: Moved and renamed some tool-related files. (bzr r12785) --- src/ui/dialog/layers.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui/dialog/layers.cpp') diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index ff9265c8d..12fdf6b7d 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -41,7 +41,7 @@ #include "widgets/icon.h" #include "xml/repr.h" #include "sp-root.h" -#include "event-context.h" +#include "ui/tools/tool-base.h" #include "selection-chemistry.h" //#define DUMP_LAYERS 1 -- cgit v1.2.3 From c862d2996b29dcace346d6c2e746672fd9d1949d Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Thu, 2 Jan 2014 17:34:58 +0000 Subject: Fix Gtk+ 3.10 warnings: GtkStockItem is deprecated (bzr r12868) --- src/ui/dialog/layers.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/ui/dialog/layers.cpp') diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index 12fdf6b7d..381810f1e 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -881,30 +881,30 @@ LayersPanel::LayersPanel() : SPDesktop* targetDesktop = getDesktop(); Gtk::Button* btn = manage( new Gtk::Button() ); - _styleButton( *btn, targetDesktop, SP_VERB_LAYER_NEW, GTK_STOCK_ADD, C_("Layers", "New") ); + _styleButton( *btn, targetDesktop, SP_VERB_LAYER_NEW, INKSCAPE_ICON("list-add"), C_("Layers", "New") ); btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &LayersPanel::_takeAction), (int)BUTTON_NEW) ); _buttonsSecondary.pack_start(*btn, Gtk::PACK_SHRINK); btn = manage( new Gtk::Button() ); - _styleButton( *btn, targetDesktop, SP_VERB_LAYER_TO_BOTTOM, GTK_STOCK_GOTO_BOTTOM, C_("Layers", "Bot") ); + _styleButton( *btn, targetDesktop, SP_VERB_LAYER_TO_BOTTOM, INKSCAPE_ICON("go-bottom"), C_("Layers", "Bot") ); btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &LayersPanel::_takeAction), (int)BUTTON_BOTTOM) ); _watchingNonBottom.push_back( btn ); _buttonsPrimary.pack_end(*btn, Gtk::PACK_SHRINK); btn = manage( new Gtk::Button() ); - _styleButton( *btn, targetDesktop, SP_VERB_LAYER_LOWER, GTK_STOCK_GO_DOWN, C_("Layers", "Dn") ); + _styleButton( *btn, targetDesktop, SP_VERB_LAYER_LOWER, INKSCAPE_ICON("go-down"), C_("Layers", "Dn") ); btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &LayersPanel::_takeAction), (int)BUTTON_DOWN) ); _watchingNonBottom.push_back( btn ); _buttonsPrimary.pack_end(*btn, Gtk::PACK_SHRINK); btn = manage( new Gtk::Button() ); - _styleButton( *btn, targetDesktop, SP_VERB_LAYER_RAISE, GTK_STOCK_GO_UP, C_("Layers", "Up") ); + _styleButton( *btn, targetDesktop, SP_VERB_LAYER_RAISE, INKSCAPE_ICON("go-up"), C_("Layers", "Up") ); btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &LayersPanel::_takeAction), (int)BUTTON_UP) ); _watchingNonTop.push_back( btn ); _buttonsPrimary.pack_end(*btn, Gtk::PACK_SHRINK); btn = manage( new Gtk::Button() ); - _styleButton( *btn, targetDesktop, SP_VERB_LAYER_TO_TOP, GTK_STOCK_GOTO_TOP, C_("Layers", "Top") ); + _styleButton( *btn, targetDesktop, SP_VERB_LAYER_TO_TOP, INKSCAPE_ICON("go-top"), C_("Layers", "Top") ); btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &LayersPanel::_takeAction), (int)BUTTON_TOP) ); _watchingNonTop.push_back( btn ); _buttonsPrimary.pack_end(*btn, Gtk::PACK_SHRINK); @@ -914,7 +914,7 @@ LayersPanel::LayersPanel() : // _buttonsRow.add( *btn ); btn = manage( new Gtk::Button() ); - _styleButton( *btn, targetDesktop, SP_VERB_LAYER_DELETE, GTK_STOCK_REMOVE, _("X") ); + _styleButton( *btn, targetDesktop, SP_VERB_LAYER_DELETE, INKSCAPE_ICON("list-remove"), _("X") ); btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &LayersPanel::_takeAction), (int)BUTTON_DELETE) ); _watching.push_back( btn ); _buttonsSecondary.pack_start(*btn, Gtk::PACK_SHRINK); @@ -944,8 +944,8 @@ LayersPanel::LayersPanel() : _popupMenu.append(*manage(new Gtk::SeparatorMenuItem())); - _watchingNonTop.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_RAISE, GTK_STOCK_GO_UP, "Up", (int)BUTTON_UP ) ); - _watchingNonBottom.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_LOWER, GTK_STOCK_GO_DOWN, "Down", (int)BUTTON_DOWN ) ); + _watchingNonTop.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_RAISE, INKSCAPE_ICON("go-up"), "Up", (int)BUTTON_UP ) ); + _watchingNonBottom.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_LOWER, INKSCAPE_ICON("go-down"), "Down", (int)BUTTON_DOWN ) ); _popupMenu.show_all_children(); } -- cgit v1.2.3