diff options
| author | Markus Engel <markus.engel@tum.de> | 2014-03-26 21:14:16 +0000 |
|---|---|---|
| committer | Markus Engel <markus.engel@tum.de> | 2014-03-26 21:14:16 +0000 |
| commit | 2af3266fc2db760a1c8771e5945a0c94587d18e8 (patch) | |
| tree | 7424a03211c9a27311d034ecd5366eecde58fb85 /src | |
| parent | Two more changes in libuemf to silence analyzer. (diff) | |
| download | inkscape-2af3266fc2db760a1c8771e5945a0c94587d18e8.tar.gz inkscape-2af3266fc2db760a1c8771e5945a0c94587d18e8.zip | |
Cleaned up includes of tools / revert experimental casting macro replacements from r13061
(bzr r13216)
Diffstat (limited to 'src')
| -rw-r--r-- | src/ui/tools/arc-tool.h | 10 | ||||
| -rw-r--r-- | src/ui/tools/box3d-tool.h | 19 | ||||
| -rw-r--r-- | src/ui/tools/calligraphic-tool.h | 10 | ||||
| -rw-r--r-- | src/ui/tools/connector-tool.h | 33 | ||||
| -rw-r--r-- | src/ui/tools/dropper-tool.h | 4 | ||||
| -rw-r--r-- | src/ui/tools/dynamic-base.cpp | 1 | ||||
| -rw-r--r-- | src/ui/tools/dynamic-base.h | 11 | ||||
| -rw-r--r-- | src/ui/tools/eraser-tool.cpp | 1 | ||||
| -rw-r--r-- | src/ui/tools/eraser-tool.h | 2 | ||||
| -rw-r--r-- | src/ui/tools/freehand-base.h | 25 | ||||
| -rw-r--r-- | src/ui/tools/measure-tool.cpp | 1 | ||||
| -rw-r--r-- | src/ui/tools/pencil-tool.h | 4 | ||||
| -rw-r--r-- | src/ui/tools/tool-base.cpp | 1 | ||||
| -rw-r--r-- | src/ui/tools/tool-base.h | 92 | ||||
| -rw-r--r-- | src/widgets/connector-toolbar.cpp | 3 | ||||
| -rw-r--r-- | src/widgets/pencil-toolbar.cpp | 12 |
16 files changed, 147 insertions, 82 deletions
diff --git a/src/ui/tools/arc-tool.h b/src/ui/tools/arc-tool.h index eaa50f2b9..c4c67660d 100644 --- a/src/ui/tools/arc-tool.h +++ b/src/ui/tools/arc-tool.h @@ -16,12 +16,18 @@ */ #include <stddef.h> -#include <sigc++/connection.h> #include <2geom/point.h> +#include <sigc++/connection.h> + #include "ui/tools/tool-base.h" -#include "sp-ellipse.h" +class SPItem; +class SPGenericEllipse; + +namespace Inkscape { + class Selection; +} #define SP_ARC_CONTEXT(obj) (dynamic_cast<Inkscape::UI::Tools::ArcTool*>((Inkscape::UI::Tools::ToolBase*)obj)) #define SP_IS_ARC_CONTEXT(obj) (dynamic_cast<const Inkscape::UI::Tools::ArcTool*>(const Inkscape::UI::Tools::ToolBase*(obj)) != NULL) diff --git a/src/ui/tools/box3d-tool.h b/src/ui/tools/box3d-tool.h index 99bf99a7a..1dd6bb5f8 100644 --- a/src/ui/tools/box3d-tool.h +++ b/src/ui/tools/box3d-tool.h @@ -16,12 +16,25 @@ */ #include <stddef.h> -#include <sigc++/sigc++.h> -#include "ui/tools/tool-base.h" + +#include <2geom/point.h> +#include <sigc++/connection.h> + #include "proj_pt.h" #include "vanishing-point.h" -#include "box3d.h" +#include "ui/tools/tool-base.h" + +class SPItem; +class SPBox3D; + +namespace Box3D { + struct VPDrag; +} + +namespace Inkscape { + class Selection; +} #define SP_BOX3D_CONTEXT(obj) (dynamic_cast<Inkscape::UI::Tools::Box3dTool*>((Inkscape::UI::Tools::ToolBase*)obj)) #define SP_IS_BOX3D_CONTEXT(obj) (dynamic_cast<const Inkscape::UI::Tools::Box3dTool*>((const Inkscape::UI::Tools::ToolBase*)obj) != NULL) diff --git a/src/ui/tools/calligraphic-tool.h b/src/ui/tools/calligraphic-tool.h index 926e9d126..83b4d73ff 100644 --- a/src/ui/tools/calligraphic-tool.h +++ b/src/ui/tools/calligraphic-tool.h @@ -18,8 +18,16 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#include <list> +#include <string> + +#include <2geom/point.h> + #include "ui/tools/dynamic-base.h" -#include "splivarot.h" + +class SPItem; +class Path; +struct SPCanvasItem; #define DDC_MIN_PRESSURE 0.0 #define DDC_MAX_PRESSURE 1.0 diff --git a/src/ui/tools/connector-tool.h b/src/ui/tools/connector-tool.h index 59534a173..b85412a53 100644 --- a/src/ui/tools/connector-tool.h +++ b/src/ui/tools/connector-tool.h @@ -12,25 +12,34 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include <stddef.h> -#include <sigc++/sigc++.h> -#include <sigc++/connection.h> -#include "ui/tools/tool-base.h" +#include <map> +#include <string> + #include <2geom/point.h> -#include "libavoid/connector.h" -#include <glibmm/i18n.h> +#include <sigc++/connection.h> -#define SP_CONNECTOR_CONTEXT(obj) (dynamic_cast<Inkscape::UI::Tools::ConnectorTool*>((Inkscape::UI::Tools::ToolBase*)obj)) -//#define SP_IS_CONNECTOR_CONTEXT(obj) (dynamic_cast<const ConnectorTool*>((const ToolBase*)obj) != NULL) +#include "ui/tools/tool-base.h" -struct SPKnot; +class SPItem; class SPCurve; +struct SPKnot; +struct SPCanvasItem; + +namespace Avoid { + class ConnRef; +} + +namespace Inkscape { + class Selection; -namespace Inkscape -{ - class Selection; + namespace XML { + class Node; + } } +#define SP_CONNECTOR_CONTEXT(obj) (dynamic_cast<Inkscape::UI::Tools::ConnectorTool*>((Inkscape::UI::Tools::ToolBase*)obj)) +//#define SP_IS_CONNECTOR_CONTEXT(obj) (dynamic_cast<const ConnectorTool*>((const ToolBase*)obj) != NULL) + enum { SP_CONNECTOR_CONTEXT_IDLE, SP_CONNECTOR_CONTEXT_DRAGGING, diff --git a/src/ui/tools/dropper-tool.h b/src/ui/tools/dropper-tool.h index dd6f25bb6..cfeb91dab 100644 --- a/src/ui/tools/dropper-tool.h +++ b/src/ui/tools/dropper-tool.h @@ -12,8 +12,12 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#include <2geom/point.h> + #include "ui/tools/tool-base.h" +struct SPCanvasItem; + #define SP_DROPPER_CONTEXT(obj) (dynamic_cast<Inkscape::UI::Tools::DropperTool*>((Inkscape::UI::Tools::ToolBase*)obj)) #define SP_IS_DROPPER_CONTEXT(obj) (dynamic_cast<const Inkscape::UI::Tools::DropperTool*>((const Inkscape::UI::Tools::ToolBase*)obj) != NULL) diff --git a/src/ui/tools/dynamic-base.cpp b/src/ui/tools/dynamic-base.cpp index 21b4b0532..eb789d850 100644 --- a/src/ui/tools/dynamic-base.cpp +++ b/src/ui/tools/dynamic-base.cpp @@ -10,6 +10,7 @@ #include "preferences.h" #include "display/sp-canvas-item.h" #include "desktop.h" +#include "display/curve.h" #define MIN_PRESSURE 0.0 #define MAX_PRESSURE 1.0 diff --git a/src/ui/tools/dynamic-base.h b/src/ui/tools/dynamic-base.h index 76fcd0f02..c948fa286 100644 --- a/src/ui/tools/dynamic-base.h +++ b/src/ui/tools/dynamic-base.h @@ -20,8 +20,15 @@ */ #include "ui/tools/tool-base.h" -#include "display/curve.h" -#include <2geom/point.h> + +struct SPCanvasItem; +class SPCurve; + +namespace Inkscape { + namespace XML { + class Node; + } +} #define SAMPLING_SIZE 8 /* fixme: ?? */ diff --git a/src/ui/tools/eraser-tool.cpp b/src/ui/tools/eraser-tool.cpp index 011d28663..4106785e7 100644 --- a/src/ui/tools/eraser-tool.cpp +++ b/src/ui/tools/eraser-tool.cpp @@ -66,6 +66,7 @@ #include "verbs.h" #include <2geom/math-utils.h> #include <2geom/pathvector.h> +#include "display/curve.h" #include "ui/tools/eraser-tool.h" diff --git a/src/ui/tools/eraser-tool.h b/src/ui/tools/eraser-tool.h index eb7eb16e8..110f57ba3 100644 --- a/src/ui/tools/eraser-tool.h +++ b/src/ui/tools/eraser-tool.h @@ -19,6 +19,8 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#include <2geom/point.h> + #include "ui/tools/dynamic-base.h" #define ERC_MIN_PRESSURE 0.0 diff --git a/src/ui/tools/freehand-base.h b/src/ui/tools/freehand-base.h index c8da9faed..5a4b91800 100644 --- a/src/ui/tools/freehand-base.h +++ b/src/ui/tools/freehand-base.h @@ -14,22 +14,29 @@ * Released under GNU GPL */ -#include <stddef.h> -#include <sigc++/sigc++.h> -#include <2geom/point.h> +#include <sigc++/connection.h> + #include "ui/tools/tool-base.h" -#include "live_effects/effect.h" +#include "live_effects/effect-enum.h" + +struct SPCanvasItem; +class SPCurve; +struct SPDrawAnchor; + +namespace Inkscape { + class Selection; +} + +namespace boost { + template<class T> + class optional; +} /* Freehand context */ #define SP_DRAW_CONTEXT(obj) (dynamic_cast<Inkscape::UI::Tools::FreehandBase*>((Inkscape::UI::Tools::ToolBase*)obj)) #define SP_IS_DRAW_CONTEXT(obj) (dynamic_cast<const Inkscape::UI::Tools::FreehandBase*>((const Inkscape::UI::Tools::ToolBase*)obj) != NULL) -struct SPDrawAnchor; -namespace Inkscape -{ - class Selection; -} namespace Inkscape { namespace UI { diff --git a/src/ui/tools/measure-tool.cpp b/src/ui/tools/measure-tool.cpp index 380aa79e3..2c85874bc 100644 --- a/src/ui/tools/measure-tool.cpp +++ b/src/ui/tools/measure-tool.cpp @@ -43,6 +43,7 @@ #include "sp-namedview.h" #include "enums.h" #include "ui/control-manager.h" +#include "knot-enums.h" using Inkscape::ControlManager; using Inkscape::CTLINE_SECONDARY; diff --git a/src/ui/tools/pencil-tool.h b/src/ui/tools/pencil-tool.h index efc1f60e0..2ad05606d 100644 --- a/src/ui/tools/pencil-tool.h +++ b/src/ui/tools/pencil-tool.h @@ -7,6 +7,10 @@ #include "ui/tools/freehand-base.h" +#include <2geom/piecewise.h> +#include <2geom/d2.h> +#include <2geom/sbasis.h> + #define SP_PENCIL_CONTEXT(obj) (dynamic_cast<Inkscape::UI::Tools::PencilTool*>((ToolBase*)obj)) #define SP_IS_PENCIL_CONTEXT(obj) (dynamic_cast<const Inkscape::UI::Tools::PencilTool*>((const ToolBase*)obj) != NULL) diff --git a/src/ui/tools/tool-base.cpp b/src/ui/tools/tool-base.cpp index 752053be1..96ac95926 100644 --- a/src/ui/tools/tool-base.cpp +++ b/src/ui/tools/tool-base.cpp @@ -57,6 +57,7 @@ #include "shape-editor.h" #include "sp-guide.h" #include "color.h" +#include "knot.h" // globals for temporary switching to selector by space static bool selector_toggled = FALSE; diff --git a/src/ui/tools/tool-base.h b/src/ui/tools/tool-base.h index def6e3d91..e11a22296 100644 --- a/src/ui/tools/tool-base.h +++ b/src/ui/tools/tool-base.h @@ -12,25 +12,29 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include <glib-object.h> +#include <stddef.h> +#include <string> + +#include <2geom/point.h> #include <gdk/gdk.h> +#include <glib-object.h> #include <sigc++/trackable.h> #include "knot.h" -#include "2geom/forward.h" #include "preferences.h" -class GrDrag; -class SPDesktop; -class SPItem; -class ShapeEditor; +namespace Glib { + class ustring; +} + +class GrDrag; +class SPDesktop; +class SPItem; +class ShapeEditor; namespace Inkscape { class MessageContext; class SelCue; - namespace XML { - class Node; - } } #define SP_EVENT_CONTEXT(obj) (dynamic_cast<Inkscape::UI::Tools::ToolBase*>((Inkscape::UI::Tools::ToolBase*)obj)) @@ -45,8 +49,7 @@ class ToolBase; gboolean sp_event_context_snap_watchdog_callback(gpointer data); void sp_event_context_discard_delayed_snap_event(ToolBase *ec); -class DelayedSnapEvent -{ +class DelayedSnapEvent { public: enum DelayedSnapEventOrigin { UNDEFINED_HANDLER = 0, @@ -60,12 +63,19 @@ public: }; DelayedSnapEvent(ToolBase *event_context, gpointer const dse_item, gpointer dse_item2, GdkEventMotion const *event, DelayedSnapEvent::DelayedSnapEventOrigin const origin) - : _timer_id(0), _event(NULL), _item(dse_item), _item2(dse_item2), _origin(origin), _event_context(event_context) + : _timer_id(0) + , _event(NULL) + , _item(dse_item) + , _item2(dse_item2) + , _origin(origin) + , _event_context(event_context) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); double value = prefs->getDoubleLimited("/options/snapdelay/value", 0, 0, 1000); + _timer_id = g_timeout_add(value, &sp_event_context_snap_watchdog_callback, this); _event = gdk_event_copy((GdkEvent*) event); + ((GdkEventMotion *)_event)->time = GDK_CURRENT_TIME; } @@ -74,11 +84,25 @@ public: if (_event != NULL) gdk_event_free(_event); // Remove the copy of the original event } - ToolBase* getEventContext() {return _event_context;} - DelayedSnapEventOrigin getOrigin() {return _origin;} - GdkEvent* getEvent() {return _event;} - gpointer getItem() {return _item;} - gpointer getItem2() {return _item2;} + ToolBase* getEventContext() { + return _event_context; + } + + DelayedSnapEventOrigin getOrigin() { + return _origin; + } + + GdkEvent* getEvent() { + return _event; + } + + gpointer getItem() { + return _item; + } + + gpointer getItem2() { + return _item2; + } private: guint _timer_id; @@ -137,7 +161,10 @@ public: Inkscape::SelCue *_selcue; GrDrag *_grdrag; - GrDrag *get_drag () {return _grdrag;} + + GrDrag *get_drag () { + return _grdrag; + } ShapeEditor* shape_editor; @@ -162,8 +189,10 @@ public: */ class ToolPrefObserver: public Inkscape::Preferences::Observer { public: - ToolPrefObserver(Glib::ustring const &path, ToolBase *ec) : - Inkscape::Preferences::Observer(path), ec(ec) { + ToolPrefObserver(Glib::ustring const &path, ToolBase *ec) + : Inkscape::Preferences::Observer(path) + , ec(ec) + { } virtual void notify(Inkscape::Preferences::Entry const &val) { @@ -189,7 +218,6 @@ protected: /// The cursor's hot spot gint hot_x, hot_y; - /// Whether the tool should receive delayed snap events bool sp_event_context_knot_mouseover() const; @@ -226,28 +254,6 @@ void sp_toggle_dropper(SPDesktop *dt); bool sp_event_context_knot_mouseover(ToolBase *ec); } // namespace Tools - -//#include <type_traits> - -namespace Tool { - -template<class Derived, typename T> -bool is_a(const T* t) { - //static_assert(std::is_base_of<Tools::ToolBase, Derived>(), "Destination type not derived from ToolBase."); - //static_assert(std::is_convertible<const Tools::ToolBase*, const T*>(), "Cannot cast passed pointer to ToolBase*."); - - return dynamic_cast<const Derived*>(static_cast<const Tools::ToolBase*>(t)) != NULL; -} - -template<class Derived, typename T> -Derived* to(T* t) { - //static_assert(std::is_base_of<Tools::ToolBase, Derived>(), "Destination type not derived from ToolBase."); - //static_assert(std::is_convertible<Tools::ToolBase*, T*>(), "Cannot cast passed pointer to ToolBase*."); - - return dynamic_cast<Derived*>(static_cast<Tools::ToolBase*>(t)); -} - -} // namespace Tool } // namespace UI } // namespace Inkscape diff --git a/src/widgets/connector-toolbar.cpp b/src/widgets/connector-toolbar.cpp index a0965721f..9bbc1bbb4 100644 --- a/src/widgets/connector-toolbar.cpp +++ b/src/widgets/connector-toolbar.cpp @@ -28,12 +28,15 @@ # include "config.h" #endif +#include <glibmm/i18n.h> + #include "connector-toolbar.h" #include "conn-avoid-ref.h" #include "desktop-handles.h" #include "desktop.h" #include "document-undo.h" #include "ege-adjustment-action.h" +#include "enums.h" #include "graphlayout.h" #include "ink-action.h" #include "inkscape.h" diff --git a/src/widgets/pencil-toolbar.cpp b/src/widgets/pencil-toolbar.cpp index 6598e995a..682de8594 100644 --- a/src/widgets/pencil-toolbar.cpp +++ b/src/widgets/pencil-toolbar.cpp @@ -73,16 +73,8 @@ static void freehand_mode_changed(EgeSelectOneAction* act, GObject* tbl) // in pen tool we have more options than in pencil tool; if one of them was chosen, we do any // preparatory work here - //if (SP_IS_PEN_CONTEXT(desktop->event_context)) { - // Inkscape::UI::Tools::PenTool *pc = SP_PEN_CONTEXT(desktop->event_context); - // sp_pen_context_set_polyline_mode(pc); - //} - - using namespace Inkscape::UI; - using Inkscape::UI::Tools::PenTool; - - if (Tool::is_a<PenTool>(desktop->event_context)) { - PenTool* pc = Tool::to<PenTool>(desktop->event_context); + if (SP_IS_PEN_CONTEXT(desktop->event_context)) { + Inkscape::UI::Tools::PenTool *pc = SP_PEN_CONTEXT(desktop->event_context); pc->setPolylineMode(); } } |
