karbon

vpenciltool.h
1/* This file is part of the KDE project
2 Copyright (C) 2001, 2002, 2003 The Karbon Developers
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18
19*/
20
21#ifndef __VPENCILTOOL_H__
22#define __VPENCILTOOL_H__
23
24
25#include <tqptrlist.h>
26#include <tqstring.h>
27
28#include <tdelocale.h>
29#include <kdialogbase.h>
30#include "KoPoint.h"
31
32#include "vtool.h"
33
34
35class TQLabel;
36class TQWidget;
37class VPath;
38class KarbonView;
39class TQCheckBox;
40class TQWidgetStack;
41class TQComboBox;
42class KDoubleNumInput;
43class TQCursor;
44
45class VPencilOptionsWidget : public KDialogBase
46{
47 TQ_OBJECT
48
49 public:
50 VPencilOptionsWidget( KarbonView*view, TQWidget* parent = 0L, const char* name = 0L );
51
52 int currentMode();
53 bool optimize();
54 float combineAngle();
55 float fittingError();
56
57 public slots:
58 void selectMode();
59
60 private:
61 KarbonView *m_view;
62 TQCheckBox *m_optimizeRaw;
63 TQCheckBox *m_optimizeCurve;
64 KDoubleNumInput *m_combineAngle;
65 KDoubleNumInput *m_fittingError;
66 TQWidgetStack *m_widgetStack;
67 TQComboBox *m_combo;
68 int m_mode;
69};
70
71
82class VPencilTool : public VTool
83{
84 public:
85 VPencilTool( KarbonView *view );
86 ~VPencilTool();
87
88 virtual void activate();
89 virtual void deactivate();
90
91 virtual void setup(TDEActionCollection *collection);
92 virtual TQString uiname() { return i18n( "Pencil Tool" ); }
93 virtual TQString contextHelp();
94 virtual enumToolType toolType() { return TOOL_FREEHAND; }
95
96 virtual bool showDialog() const;
97
98 enum {
99 RAW,
100 STRAIGHT,
101 CURVE
102 };
103
104 protected:
108 void draw();
109
110 virtual void mouseMove();
111 virtual void mouseButtonPress();
112 virtual void mouseButtonRelease();
113 virtual void mouseButtonDblClick();
114 virtual void mouseDrag();
115 virtual void mouseDragRelease();
116 virtual void mouseDragShiftPressed();
117 virtual void mouseDragCtrlPressed();
118 virtual void mouseDragShiftReleased();
119 virtual void mouseDragCtrlReleased();
120
121 virtual void cancel();
122 virtual void cancelStep();
123 virtual void accept();
124
128 TQPtrList<KoPoint> m_Points;
129
134
139
144
149 short m_mode;
150
151 bool m_optimize;
152
153 float m_combineAngle;
154
155 VPencilOptionsWidget *m_optionWidget;
156
157 private:
158 TQCursor* m_cursor;
159};
160
161#endif
A composite path consists of one or many subpaths.
Definition vcomposite.h:48
The pencil tool.
Definition vpenciltool.h:83
virtual void mouseDragCtrlReleased()
"Ctrl" key released while mouse drag.
virtual void mouseMove()
Mouse move.
virtual void mouseButtonRelease()
Left mouse button release.
virtual void cancel()
Cancels all tool operations.
virtual void deactivate()
Deactivates the tool.
virtual TQString contextHelp()
The context help of the tool.
KoPoint m_lastVectorEnd
The end of the last drawn vector.
short m_mode
The mode of the pencile.
TQPtrList< KoPoint > m_Points
The list of this polyline points.
virtual void cancelStep()
Cancels the last tool step (if any).
virtual void mouseDragShiftPressed()
Mouse drag with "Shift" key pressed at the same time.
virtual TQString uiname()
The name of the tool.
Definition vpenciltool.h:92
virtual void activate()
Called during the tool activation.
virtual void mouseButtonPress()
Left mouse button press.
KoPoint m_lastVectorStart
The start of the last drawn vector.
virtual void setup(TDEActionCollection *collection)
Called after tool creation.
virtual void mouseDragRelease()
Mouse button release.
virtual bool showDialog() const
Shows the tools option dialog.
virtual void accept()
Terminates the current tool drawing (if any).
virtual void mouseButtonDblClick()
Mouse button double click.
virtual void mouseDragShiftReleased()
"Shift" key released while mouse drag.
virtual enumToolType toolType()
The tool type.
Definition vpenciltool.h:94
void draw()
Helper method: draws the polyline.
bool m_close
Indicates if the Line is to close.
virtual void mouseDragCtrlPressed()
Mouse drag with "Ctrl" key pressed at the same time.
virtual void mouseDrag()
Mouse drag.
The base class for all karbon tools.
Definition vtool.h:52
KarbonView * view() const
Returns the connected karbon part.
Definition vtool.cpp:66