summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 044fd25)
raw | patch | inline | side by side (parent: 044fd25)
author | Jon A. Cruz <jon@joncruz.org> | |
Fri, 15 Jan 2010 06:45:34 +0000 (22:45 -0800) | ||
committer | Jon A. Cruz <jon@joncruz.org> | |
Fri, 15 Jan 2010 06:45:34 +0000 (22:45 -0800) |
src/selection-chemistry.cpp | patch | blob | history | |
src/selection-chemistry.h | patch | blob | history | |
src/verbs.cpp | patch | blob | history |
index dfe47bee842f9b1b08aa2534c919099172723813..e81d133c2dd9dc049790c801c7e8c72584e5719d 100644 (file)
-#define __SP_SELECTION_CHEMISTRY_C__
-
/** @file
* @brief Miscellanous operations on selected items
*/
* MenTaLguY <mental@rydia.net>
* bulia byak <buliabyak@users.sf.net>
* Andrius R. <knutux@gmail.com>
+ * Jon A. Cruz <jon@joncruz.org>
*
- * Copyright (C) 1999-2006 authors
+ * Copyright (C) 1999-2010 authors
* Copyright (C) 2001-2002 Ximian, Inc.
*
* Released under GNU GPL, read the file 'COPYING' for more information
#include "selection-chemistry.h"
+// TOOD fixme: This should be moved into preference repr
+SPCycleType SP_CYCLING = SP_CYCLE_FOCUS;
+
+
#include <gtkmm/clipboard.h>
#include "svg/svg.h"
#include "sp-linear-gradient-fns.h"
#include "sp-pattern.h"
#include "sp-radial-gradient-fns.h"
+#include "gradient-context.h"
#include "sp-namedview.h"
#include "preferences.h"
#include "sp-offset.h"
#include "display/curve.h"
#include "display/canvas-bpath.h"
#include "inkscape-private.h"
+#include "path-chemistry.h"
+#include "ui/tool/control-point-selection.h"
+#include "ui/tool/multi-path-manipulator.h"
// For clippath editing
#include "tools-switch.h"
because the layer manipulation code uses them. It should be rewritten specifically
for that purpose. */
+
+
+namespace Inkscape {
+
+void SelectionHelper::selectAll(SPDesktop *dt)
+{
+ if (tools_isactive(dt, TOOLS_NODES)) {
+ InkNodeTool *nt = static_cast<InkNodeTool*>(dt->event_context);
+ nt->_multipath->selectSubpaths();
+ } else {
+ sp_edit_select_all(dt);
+ }
+}
+
+void SelectionHelper::selectAllInAll(SPDesktop *dt)
+{
+ if (tools_isactive(dt, TOOLS_NODES)) {
+ InkNodeTool *nt = static_cast<InkNodeTool*>(dt->event_context);
+ nt->_selected_nodes->selectAll();
+ } else {
+ sp_edit_select_all_in_all_layers(dt);
+ }
+}
+
+void SelectionHelper::selectNone(SPDesktop *dt)
+{
+ if (tools_isactive(dt, TOOLS_NODES)) {
+ InkNodeTool *nt = static_cast<InkNodeTool*>(dt->event_context);
+ nt->_selected_nodes->clear();
+ } else {
+ sp_desktop_selection(dt)->clear();
+ }
+}
+
+void SelectionHelper::invert(SPDesktop *dt)
+{
+ if (tools_isactive(dt, TOOLS_NODES)) {
+ InkNodeTool *nt = static_cast<InkNodeTool*>(dt->event_context);
+ nt->_multipath->invertSelectionInSubpaths();
+ } else {
+ sp_edit_invert(dt);
+ }
+}
+
+void SelectionHelper::invertAllInAll(SPDesktop *dt)
+{
+ if (tools_isactive(dt, TOOLS_NODES)) {
+ InkNodeTool *nt = static_cast<InkNodeTool*>(dt->event_context);
+ nt->_selected_nodes->invertSelection();
+ } else {
+ sp_edit_invert_in_all_layers(dt);
+ }
+}
+
+void SelectionHelper::reverse(SPDesktop *dt)
+{
+ // TODO make this a virtual method of event context!
+ if (tools_isactive(dt, TOOLS_NODES)) {
+ InkNodeTool *nt = static_cast<InkNodeTool*>(dt->event_context);
+ nt->_multipath->reverseSubpaths();
+ } else {
+ sp_selected_path_reverse(dt);
+ }
+}
+
+void SelectionHelper::selectNext(SPDesktop *dt)
+{
+ SPEventContext *ec = dt->event_context;
+ if (tools_isactive(dt, TOOLS_NODES)) {
+ InkNodeTool *nt = static_cast<InkNodeTool*>(dt->event_context);
+ nt->_multipath->shiftSelection(1);
+ } else if (tools_isactive(dt, TOOLS_GRADIENT)
+ && ec->_grdrag->isNonEmpty()) {
+ sp_gradient_context_select_next(ec);
+ } else {
+ sp_selection_item_next(dt);
+ }
+}
+
+void SelectionHelper::selectPrev(SPDesktop *dt)
+{
+ SPEventContext *ec = dt->event_context;
+ if (tools_isactive(dt, TOOLS_NODES)) {
+ InkNodeTool *nt = static_cast<InkNodeTool*>(dt->event_context);
+ nt->_multipath->shiftSelection(-1);
+ } else if (tools_isactive(dt, TOOLS_GRADIENT)
+ && ec->_grdrag->isNonEmpty()) {
+ sp_gradient_context_select_prev(ec);
+ } else {
+ sp_selection_item_prev(dt);
+ }
+}
+
+} // namespace Inkscape
+
+
/**
* Copies repr and its inherited css style elements, along with the accumulated transform 'full_t',
* then prepends the copy to 'clip'.
index 7cc5f8d9f55992d824b81ca289e03ad181825537..60d64ced9c8c3e181ab4fddde046c33fa920ec00 100644 (file)
-#ifndef __SP_SELECTION_CHEMISTRY_H__
-#define __SP_SELECTION_CHEMISTRY_H__
+#ifndef SEEN_SELECTION_CHEMISTRY_H
+#define SEEN_SELECTION_CHEMISTRY_H
/*
* Miscellanous operations on selected items
* Lauris Kaplinski <lauris@kaplinski.com>
* Frank Felfe <innerspace@iname.com>
* bulia byak <buliabyak@users.sf.net>
+ * Jon A. Cruz <jon@joncruz.org>
*
- * Copyright (C) 1999-2005 authors
+ * Copyright (C) 1999-2010 authors
* Copyright (C) 2001-2002 Ximian, Inc.
*
* Released under GNU GPL, read the file 'COPYING' for more information
class SPCSSAttr;
+namespace Inkscape {
+ class SelectionHelper {
+ public:
+ static void selectAll(SPDesktop *desktop);
+ static void selectAllInAll(SPDesktop *desktop);
+ static void selectNone(SPDesktop *desktop);
+ static void invert(SPDesktop *desktop);
+ static void invertAllInAll(SPDesktop *desktop);
+ static void reverse(SPDesktop *dt);
+ static void selectNext(SPDesktop *desktop);
+ static void selectPrev(SPDesktop *desktop);
+ };
+} // namespace Inkscape
+
void sp_selection_delete(SPDesktop *desktop);
void sp_selection_duplicate(SPDesktop *desktop, bool suppressDone = false);
void sp_edit_clear_all(SPDesktop *desktop);
/* selection cycling */
typedef enum
{
- SP_CYCLE_SIMPLE,
- SP_CYCLE_VISIBLE, /* cycle only visible items */
- SP_CYCLE_FOCUS /* readjust visible area to view selected item */
+ SP_CYCLE_SIMPLE,
+ SP_CYCLE_VISIBLE, // cycle only visible items
+ SP_CYCLE_FOCUS // readjust visible area to view selected item
} SPCycleType;
-/* fixme: This should be moved into preference repr */
-#ifndef __SP_SELECTION_CHEMISTRY_C__
-extern SPCycleType SP_CYCLING;
-#else
-SPCycleType SP_CYCLING = SP_CYCLE_FOCUS;
-#endif
-
-#endif
+// TOOD fixme: This should be moved into preference repr
+extern SPCycleType SP_CYCLING;
+#endif // SEEN_SELECTION_CHEMISTRY_H
diff --git a/src/verbs.cpp b/src/verbs.cpp
index 37f4da4d6f30d48646393cc8bb41ec88fa2d169c..7c3652b36012bba485fea83be0d7c132bc2c944c 100644 (file)
--- a/src/verbs.cpp
+++ b/src/verbs.cpp
* MenTaLguY <mental@rydia.net>
* David Turner <novalis@gnu.org>
* bulia byak <buliabyak@users.sf.net>
+ * Jon A. Cruz <jon@joncruz.org>
*
* Copyright (C) 2006 Johan Engelen <johan@shouraizou.nl>
* Copyright (C) (date unspecified) Authors
#include "draw-context.h"
#include "extension/effect.h"
#include "file.h"
-#include "gradient-context.h"
#include "gradient-drag.h"
#include "helper/action.h"
#include "help.h"
#include "ui/dialog/layers.h"
#include "ui/dialog/swatches.h"
#include "ui/icon-names.h"
-#include "ui/tool/control-point-selection.h"
-#include "ui/tool/multi-path-manipulator.h"
#include "ui/tool/node-tool.h"
//#ifdef WITH_INKBOARD
SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
if (!dt)
return;
- SPEventContext *ec = dt->event_context;
switch (reinterpret_cast<std::size_t>(data)) {
case SP_VERB_EDIT_UNDO:
sp_edit_clear_all(dt);
break;
case SP_VERB_EDIT_SELECT_ALL:
- if (tools_isactive(dt, TOOLS_NODES)) {
- InkNodeTool *nt = static_cast<InkNodeTool*>(dt->event_context);
- nt->_multipath->selectSubpaths();
- } else {
- sp_edit_select_all(dt);
- }
+ SelectionHelper::selectAll(dt);
break;
case SP_VERB_EDIT_INVERT:
- if (tools_isactive(dt, TOOLS_NODES)) {
- InkNodeTool *nt = static_cast<InkNodeTool*>(dt->event_context);
- nt->_multipath->invertSelectionInSubpaths();
- } else {
- sp_edit_invert(dt);
- }
+ SelectionHelper::invert(dt);
break;
case SP_VERB_EDIT_SELECT_ALL_IN_ALL_LAYERS:
- if (tools_isactive(dt, TOOLS_NODES)) {
- InkNodeTool *nt = static_cast<InkNodeTool*>(dt->event_context);
- nt->_selected_nodes->selectAll();
- } else {
- sp_edit_select_all_in_all_layers(dt);
- }
+ SelectionHelper::selectAllInAll(dt);
break;
case SP_VERB_EDIT_INVERT_IN_ALL_LAYERS:
- if (tools_isactive(dt, TOOLS_NODES)) {
- InkNodeTool *nt = static_cast<InkNodeTool*>(dt->event_context);
- nt->_selected_nodes->invertSelection();
- } else {
- sp_edit_invert_in_all_layers(dt);
- }
+ SelectionHelper::invertAllInAll(dt);
break;
-
case SP_VERB_EDIT_SELECT_NEXT:
- if (tools_isactive(dt, TOOLS_NODES)) {
- InkNodeTool *nt = static_cast<InkNodeTool*>(dt->event_context);
- nt->_multipath->shiftSelection(1);
- } else if (tools_isactive(dt, TOOLS_GRADIENT)
- && ec->_grdrag->isNonEmpty()) {
- sp_gradient_context_select_next (ec);
- } else {
- sp_selection_item_next(dt);
- }
+ SelectionHelper::selectNext(dt);
break;
case SP_VERB_EDIT_SELECT_PREV:
- if (tools_isactive(dt, TOOLS_NODES)) {
- InkNodeTool *nt = static_cast<InkNodeTool*>(dt->event_context);
- nt->_multipath->shiftSelection(-1);
- } else if (tools_isactive(dt, TOOLS_GRADIENT)
- && ec->_grdrag->isNonEmpty()) {
- sp_gradient_context_select_prev (ec);
- } else {
- sp_selection_item_prev(dt);
- }
+ SelectionHelper::selectPrev(dt);
break;
-
case SP_VERB_EDIT_DESELECT:
- if (tools_isactive(dt, TOOLS_NODES)) {
- InkNodeTool *nt = static_cast<InkNodeTool*>(dt->event_context);
- nt->_selected_nodes->clear();
- } else {
- sp_desktop_selection(dt)->clear();
- }
+ SelectionHelper::selectNone(dt);
break;
-
case SP_VERB_EDIT_GUIDES_AROUND_PAGE:
sp_guide_create_guides_around_page(dt);
break;
sp_selected_path_simplify(dt);
break;
case SP_VERB_SELECTION_REVERSE:
- // TODO make this a virtual method of event context!
- if (tools_isactive(dt, TOOLS_NODES)) {
- InkNodeTool *nt = static_cast<InkNodeTool*>(dt->event_context);
- nt->_multipath->reverseSubpaths();
- } else {
- sp_selected_path_reverse(dt);
- }
+ SelectionHelper::reverse(dt);
break;
case SP_VERB_SELECTION_TRACE:
inkscape_dialogs_unhide();