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 struct SubtoolEntry {
34 Inkscape::LivePathEffect::EffectType type;
35 gchar const *icon_name;
36 };
38 extern SubtoolEntry lpesubtools[];
40 enum LPEToolState {
41 LPETOOL_STATE_PEN,
42 LPETOOL_STATE_NODE
43 };
45 namespace Inkscape {
46 class Selection;
47 }
49 class ShapeEditor;
51 struct SPLPEToolContext : public SPPenContext {
52 ShapeEditor* shape_editor;
53 SPCanvasItem *canvas_bbox;
54 Inkscape::LivePathEffect::EffectType mode;
56 std::map<SPPath *, SPCanvasItem*> *measuring_items;
58 Inkscape::MessageContext *_lpetool_message_context;
60 sigc::connection sel_changed_connection;
61 sigc::connection sel_modified_connection;
62 };
64 struct SPLPEToolContextClass : public SPEventContextClass{};
66 int lpetool_mode_to_index(Inkscape::LivePathEffect::EffectType const type);
67 int lpetool_item_has_construction(SPLPEToolContext *lc, SPItem *item);
68 bool lpetool_try_construction(SPLPEToolContext *lc, Inkscape::LivePathEffect::EffectType const type);
69 void lpetool_context_switch_mode(SPLPEToolContext *lc, Inkscape::LivePathEffect::EffectType const type);
70 void lpetool_get_limiting_bbox_corners(SPDocument *document, Geom::Point &A, Geom::Point &B);
71 void lpetool_context_reset_limiting_bbox(SPLPEToolContext *lc);
72 void lpetool_create_measuring_items(SPLPEToolContext *lc, Inkscape::Selection *selection = NULL);
73 void lpetool_delete_measuring_items(SPLPEToolContext *lc);
74 void lpetool_update_measuring_items(SPLPEToolContext *lc);
75 void lpetool_show_measuring_info(SPLPEToolContext *lc, bool show = true);
77 GType sp_lpetool_context_get_type(void);
79 #endif // SP_LPETOOL_CONTEXT_H_SEEN
81 /*
82 Local Variables:
83 mode:c++
84 c-file-style:"stroustrup"
85 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
86 indent-tabs-mode:nil
87 fill-column:99
88 End:
89 */
90 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :