karbon

vpenciltool.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2001, 2002, 2003 The Karbon Developers
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018 
00019 */
00020 
00021 #ifndef __VPENCILTOOL_H__
00022 #define __VPENCILTOOL_H__
00023 
00024 
00025 #include <qptrlist.h>
00026 #include <qstring.h>
00027 
00028 #include <klocale.h>
00029 #include <kdialogbase.h>
00030 #include "KoPoint.h"
00031 
00032 #include "vtool.h"
00033 
00034 
00035 class QLabel;
00036 class QWidget;
00037 class VPath;
00038 class KarbonView;
00039 class QCheckBox;
00040 class QWidgetStack;
00041 class QComboBox;
00042 class KDoubleNumInput;
00043 class QCursor;
00044 
00045 class VPencilOptionsWidget : public KDialogBase
00046 {
00047     Q_OBJECT
00048     public:
00049         VPencilOptionsWidget( KarbonView*view, QWidget* parent = 0L, const char* name = 0L );
00050 
00051         int currentMode();
00052         bool optimize();
00053         float combineAngle();
00054         float fittingError();
00055         
00056     public slots:
00057         void selectMode();
00058 
00059     private:
00060         KarbonView          *m_view;
00061         QCheckBox           *m_optimizeRaw;
00062         QCheckBox           *m_optimizeCurve;
00063         KDoubleNumInput         *m_combineAngle;
00064         KDoubleNumInput         *m_fittingError;
00065         QWidgetStack            *m_widgetStack;
00066         QComboBox           *m_combo;
00067         int             m_mode;
00068 };
00069 
00070 
00081 class VPencilTool : public VTool
00082 {
00083     public:
00084         VPencilTool( KarbonView *view );
00085         ~VPencilTool(); 
00086 
00087         virtual void activate();
00088         virtual void deactivate();
00089 
00090         virtual void setup(KActionCollection *collection);
00091         virtual QString uiname() { return i18n( "Pencil Tool" ); }
00092         virtual QString contextHelp();
00093         virtual enumToolType toolType() { return TOOL_FREEHAND; }
00094 
00095         virtual bool showDialog() const;
00096         
00097         enum {
00098             RAW,
00099             STRAIGHT,
00100             CURVE
00101         };
00102 
00103     protected:
00107         void draw();
00108 
00109         virtual void mouseMove();
00110         virtual void mouseButtonPress();
00111         virtual void mouseButtonRelease();
00112         virtual void mouseButtonDblClick();
00113         virtual void mouseDrag();
00114         virtual void mouseDragRelease();
00115         virtual void mouseDragShiftPressed();
00116         virtual void mouseDragCtrlPressed();
00117         virtual void mouseDragShiftReleased();
00118         virtual void mouseDragCtrlReleased();
00119 
00120         virtual void cancel();
00121         virtual void cancelStep();
00122         virtual void accept();
00123 
00127         QPtrList<KoPoint> m_Points;
00128 
00132         KoPoint m_lastVectorStart;
00133 
00137         KoPoint m_lastVectorEnd;
00138 
00142         bool m_close;
00143 
00148         short m_mode;
00149 
00150         bool m_optimize;
00151 
00152         float m_combineAngle;
00153 
00154         VPencilOptionsWidget *m_optionWidget;
00155 
00156     private:
00157         QCursor* m_cursor;
00158 };
00159 
00160 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys