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