From 156cf3323a936c7dfccd9e09458cd8b5d174b7fe Mon Sep 17 00:00:00 2001 From: "Liam P. White" Date: Sun, 5 Oct 2014 19:24:27 -0400 Subject: Move more UI code into ui/ (bzr r13341.1.253) --- src/ui/tools/select-tool.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ui/tools/select-tool.cpp') diff --git a/src/ui/tools/select-tool.cpp b/src/ui/tools/select-tool.cpp index 83bef17c9..394b0b369 100644 --- a/src/ui/tools/select-tool.cpp +++ b/src/ui/tools/select-tool.cpp @@ -41,7 +41,7 @@ #include "desktop-handles.h" #include "sp-root.h" #include "preferences.h" -#include "tools-switch.h" +#include "ui/tools-switch.h" #include "message-stack.h" #include "selection-describer.h" #include "seltrans.h" @@ -49,7 +49,7 @@ #include "display/sp-canvas.h" #include "display/sp-canvas-item.h" #include "display/drawing-item.h" -#include "tool-factory.h" +#include "ui/tool-factory.h" using Inkscape::DocumentUndo; -- cgit v1.2.3 From e2ae473da92a1f96e307e3f1f3e206cad7bd1c38 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Thu, 23 Oct 2014 19:33:47 -0700 Subject: Initial removal of box3d outdated GTKish macros. (bzr r13634) --- src/ui/tools/select-tool.cpp | 78 +++++++++++++++++++++++++++----------------- 1 file changed, 48 insertions(+), 30 deletions(-) (limited to 'src/ui/tools/select-tool.cpp') diff --git a/src/ui/tools/select-tool.cpp b/src/ui/tools/select-tool.cpp index 83bef17c9..21f37e83d 100644 --- a/src/ui/tools/select-tool.cpp +++ b/src/ui/tools/select-tool.cpp @@ -264,15 +264,16 @@ sp_select_context_up_one_layer(SPDesktop *desktop) SPObject *const current_layer = desktop->currentLayer(); if (current_layer) { SPObject *const parent = current_layer->parent; + SPGroup *current_group = dynamic_cast(current_layer); if ( parent && ( parent->parent - || !( SP_IS_GROUP(current_layer) - && ( SPGroup::LAYER - == SP_GROUP(current_layer)->layerMode() ) ) ) ) + || !( current_group + && ( SPGroup::LAYER == current_group->layerMode() ) ) ) ) { desktop->setCurrentLayer(parent); - if (SP_IS_GROUP(current_layer) && SPGroup::LAYER != SP_GROUP(current_layer)->layerMode()) + if (current_group && (SPGroup::LAYER != current_group->layerMode())) { sp_desktop_selection(desktop)->set(current_layer); + } } } } @@ -403,7 +404,8 @@ void SelectTool::sp_select_context_cycle_through_items(Inkscape::Selection *sele } Inkscape::DrawingItem *arenaitem; - SPItem *item = SP_ITEM(this->cycling_cur_item->data); + SPItem *item = dynamic_cast(static_cast(cycling_cur_item->data)); + g_assert(item != NULL); // Deactivate current item if (!g_list_find(this->cycling_items_selected_before, item) && selection->includes(item)) { @@ -427,7 +429,8 @@ void SelectTool::sp_select_context_cycle_through_items(Inkscape::Selection *sele if (next) { this->cycling_cur_item = next; - item = SP_ITEM(this->cycling_cur_item->data); + item = dynamic_cast(static_cast(this->cycling_cur_item->data)); + g_assert(item != NULL); } arenaitem = item->get_arenaitem(desktop->dkey); @@ -442,8 +445,13 @@ void SelectTool::sp_select_context_cycle_through_items(Inkscape::Selection *sele void SelectTool::sp_select_context_reset_opacities() { for (GList *l = this->cycling_items; l != NULL; l = g_list_next(l)) { - Inkscape::DrawingItem *arenaitem = SP_ITEM(l->data)->get_arenaitem(this->desktop->dkey); - arenaitem->setOpacity(SP_SCALE24_TO_FLOAT(SP_ITEM(l->data)->style->opacity.value)); + SPItem *item = dynamic_cast(static_cast(l->data)); + if (item) { + Inkscape::DrawingItem *arenaitem = item->get_arenaitem(desktop->dkey); + arenaitem->setOpacity(SP_SCALE24_TO_FLOAT(item->style->opacity.value)); + } else { + g_assert_not_reached(); + } } g_list_free(this->cycling_items); @@ -475,8 +483,8 @@ bool SelectTool::root_handler(GdkEvent* event) { if (!selection->isEmpty()) { SPItem *clicked_item = static_cast(selection->itemList()->data); - if (SP_IS_GROUP(clicked_item) && !SP_IS_BOX3D(clicked_item)) { // enter group if it's not a 3D box - desktop->setCurrentLayer(reinterpret_cast(clicked_item)); + if (dynamic_cast(clicked_item) && !dynamic_cast(clicked_item)) { // enter group if it's not a 3D box + desktop->setCurrentLayer(clicked_item); sp_desktop_selection(desktop)->clear(); this->dragging = false; sp_event_context_discard_delayed_snap_event(this); @@ -591,8 +599,11 @@ bool SelectTool::root_handler(GdkEvent* event) { item_in_group = desktop->getItemAtPoint(Geom::Point(event->button.x, event->button.y), TRUE); group_at_point = desktop->getGroupAtPoint(Geom::Point(event->button.x, event->button.y)); - if (SP_IS_LAYER(selection->single())) { - group_at_point = SP_GROUP(selection->single()); + { + SPGroup *selGroup = dynamic_cast(selection->single()); + if (selGroup && (selGroup->layerMode() == SPGroup::LAYER)) { + group_at_point = selGroup; + } } // group-at-point is meant to be topmost item if it's a group, @@ -673,10 +684,11 @@ bool SelectTool::root_handler(GdkEvent* event) { selection->toggle(this->item); } else { SPObject* single = selection->single(); + SPGroup *singleGroup = dynamic_cast(single); // without shift, increase state (i.e. toggle scale/rotation handles) if (selection->includes(this->item)) { _seltrans->increaseState(); - } else if (SP_IS_LAYER(single) && single->isAncestorOf(this->item)) { + } else if (singleGroup && (singleGroup->layerMode() == SPGroup::LAYER) && single->isAncestorOf(this->item)) { _seltrans->increaseState(); } else { _seltrans->resetState(); @@ -818,7 +830,7 @@ bool SelectTool::root_handler(GdkEvent* event) { SPItem *item = desktop->getItemAtPoint(p, true, NULL); // Save pointer to current cycle-item so that we can find it again later, in the freshly built list - SPItem *tmp_cur_item = this->cycling_cur_item ? SP_ITEM(this->cycling_cur_item->data) : NULL; + SPItem *tmp_cur_item = this->cycling_cur_item ? dynamic_cast(static_cast(this->cycling_cur_item->data)) : NULL; g_list_free(this->cycling_items); this->cycling_items = NULL; this->cycling_cur_item = NULL; @@ -851,11 +863,14 @@ bool SelectTool::root_handler(GdkEvent* event) { Inkscape::DrawingItem *arenaitem; for(GList *l = this->cycling_items_cmp; l != NULL; l = l->next) { - arenaitem = SP_ITEM(l->data)->get_arenaitem(desktop->dkey); - arenaitem->setOpacity(1.0); - //if (!shift_pressed && !g_list_find(this->cycling_items_selected_before, SP_ITEM(l->data)) && selection->includes(SP_ITEM(l->data))) - if (!g_list_find(this->cycling_items_selected_before, SP_ITEM(l->data)) && selection->includes(SP_ITEM(l->data))) { - selection->remove(SP_ITEM(l->data)); + SPItem *item = dynamic_cast(static_cast(l->data)); + if (item) { + arenaitem = item->get_arenaitem(desktop->dkey); + arenaitem->setOpacity(1.0); + //if (!shift_pressed && !g_list_find(this->cycling_items_selected_before, item) && selection->includes(item)) + if (!g_list_find(this->cycling_items_selected_before, item) && selection->includes(item)) { + selection->remove(item); + } } } @@ -869,16 +884,19 @@ bool SelectTool::root_handler(GdkEvent* event) { // ... and rebuild them with the new items. this->cycling_items_cmp = g_list_copy(this->cycling_items); - SPItem *item; for(GList *l = this->cycling_items; l != NULL; l = l->next) { - item = SP_ITEM(l->data); - arenaitem = item->get_arenaitem(desktop->dkey); - arenaitem->setOpacity(0.3); - - if (selection->includes(item)) { - // already selected items are stored separately, too - this->cycling_items_selected_before = g_list_append(this->cycling_items_selected_before, item); + SPItem *item = dynamic_cast(static_cast(l->data)); + if (item) { + arenaitem = item->get_arenaitem(desktop->dkey); + arenaitem->setOpacity(0.3); + + if (selection->includes(item)) { + // already selected items are stored separately, too + this->cycling_items_selected_before = g_list_append(this->cycling_items_selected_before, item); + } + } else { + g_assert_not_reached(); } } @@ -1134,9 +1152,9 @@ bool SelectTool::root_handler(GdkEvent* event) { if (MOD__CTRL_ONLY(event)) { if (selection->singleItem()) { SPItem *clicked_item = selection->singleItem(); - - if ( SP_IS_GROUP(clicked_item) || SP_IS_BOX3D(clicked_item)) { // enter group or a 3D box - desktop->setCurrentLayer(reinterpret_cast(clicked_item)); + SPGroup *clickedGroup = dynamic_cast(clicked_item); + if ( (clickedGroup && (clickedGroup->layerMode() == SPGroup::LAYER)) || dynamic_cast(clicked_item)) { // enter group or a 3D box + desktop->setCurrentLayer(clicked_item); sp_desktop_selection(desktop)->clear(); } else { this->desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Selected object is not a group. Cannot enter.")); -- cgit v1.2.3 From dd6537989eab9f89d15163dd96d7c87256b3e9ce Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Sun, 2 Nov 2014 06:14:30 -0800 Subject: Correct check-for-layer that should have been check-for-group. Fixes bug #1388297. Fixed bugs: - https://launchpad.net/bugs/1388297 (bzr r13658) --- src/ui/tools/select-tool.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui/tools/select-tool.cpp') diff --git a/src/ui/tools/select-tool.cpp b/src/ui/tools/select-tool.cpp index 21459e5d0..a8267ea1d 100644 --- a/src/ui/tools/select-tool.cpp +++ b/src/ui/tools/select-tool.cpp @@ -1153,7 +1153,7 @@ bool SelectTool::root_handler(GdkEvent* event) { if (selection->singleItem()) { SPItem *clicked_item = selection->singleItem(); SPGroup *clickedGroup = dynamic_cast(clicked_item); - if ( (clickedGroup && (clickedGroup->layerMode() == SPGroup::LAYER)) || dynamic_cast(clicked_item)) { // enter group or a 3D box + if ( (clickedGroup && (clickedGroup->layerMode() != SPGroup::LAYER)) || dynamic_cast(clicked_item)) { // enter group or a 3D box desktop->setCurrentLayer(clicked_item); sp_desktop_selection(desktop)->clear(); } else { -- cgit v1.2.3