1 #ifndef SP_LPETOOL_CONTEXT_H_SEEN
2 #define SP_LPETOOL_CONTEXT_H_SEEN
4 /*
5 * LPEToolContext: a context for a generic tool composed of subtools that are given by LPEs
6 *
7 * Authors:
8 * Maximilian Albert <maximilian.albert@gmail.com>
9 *
10 * Copyright (C) 1998 The Free Software Foundation
11 * Copyright (C) 1999-2002 authors
12 * Copyright (C) 2001-2002 Ximian, Inc.
13 * Copyright (C) 2008 Maximilian Albert
14 *
15 * Released under GNU GPL, read the file 'COPYING' for more information
16 */
18 #include "pen-context.h"
19 #include "helper/units.h"
21 #define SP_TYPE_LPETOOL_CONTEXT (sp_lpetool_context_get_type())
22 #define SP_LPETOOL_CONTEXT(o) (GTK_CHECK_CAST((o), SP_TYPE_LPETOOL_CONTEXT, SPLPEToolContext))
23 #define SP_LPETOOL_CONTEXT_CLASS(k) (GTK_CHECK_CLASS_CAST((k), SP_TYPE_LPETOOL_CONTEXT, SPLPEToolContextClass))
24 #define SP_IS_LPETOOL_CONTEXT(o) (GTK_CHECK_TYPE((o), SP_TYPE_LPETOOL_CONTEXT))
25 #define SP_IS_LPETOOL_CONTEXT_CLASS(k) (GTK_CHECK_CLASS_TYPE((k), SP_TYPE_LPETOOL_CONTEXT))
27 class SPLPEToolContext;
28 class SPLPEToolContextClass;
30 /* This is the list of subtools from which the toolbar of the LPETool is built automatically */
31 extern const int num_subtools;
33 extern Inkscape::LivePathEffect::EffectType lpesubtools[];
35 enum LPEToolState {
36 LPETOOL_STATE_PEN,
37 LPETOOL_STATE_NODE
38 };
40 namespace Inkscape {
41 class Selection;
42 }
44 class ShapeEditor;
46 struct SPLPEToolContext : public SPPenContext {
47 ShapeEditor* shape_editor;
48 SPCanvasItem *canvas_bbox;
49 Inkscape::LivePathEffect::EffectType mode;
51 std::map<SPPath *, SPCanvasItem*> *measuring_items;
53 Inkscape::MessageContext *_lpetool_message_context;
55 sigc::connection sel_changed_connection;
56 sigc::connection sel_modified_connection;
57 };
59 struct SPLPEToolContextClass : public SPEventContextClass{};
61 int lpetool_mode_to_index(Inkscape::LivePathEffect::EffectType const type);
62 int lpetool_item_has_construction(SPLPEToolContext *lc, SPItem *item);
63 bool lpetool_try_construction(SPLPEToolContext *lc, Inkscape::LivePathEffect::EffectType const type);
64 void lpetool_context_switch_mode(SPLPEToolContext *lc, Inkscape::LivePathEffect::EffectType const type);
65 void lpetool_get_limiting_bbox_corners(SPDocument *document, Geom::Point &A, Geom::Point &B);
66 void lpetool_context_reset_limiting_bbox(SPLPEToolContext *lc);
67 void lpetool_create_measuring_items(SPLPEToolContext *lc, Inkscape::Selection *selection = NULL);
68 void lpetool_delete_measuring_items(SPLPEToolContext *lc);
69 void lpetool_update_measuring_items(SPLPEToolContext *lc);
70 void lpetool_show_measuring_info(SPLPEToolContext *lc, bool show = true);
72 GType sp_lpetool_context_get_type(void);
74 #endif // SP_LPETOOL_CONTEXT_H_SEEN
76 /*
77 Local Variables:
78 mode:c++
79 c-file-style:"stroustrup"
80 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
81 indent-tabs-mode:nil
82 fill-column:99
83 End:
84 */
85 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :