~ubuntu-branches/ubuntu/precise/koffice/precise

« back to all changes in this revision

Viewing changes to krita/plugins/tools/selectiontools/kis_tool_select_outline.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2006-04-20 21:38:53 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20060420213853-j5lxluqvymxt2zny
Tags: 1:1.5.0-0ubuntu2
UbuntuĀ uploadĀ 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  kis_tool_select_freehand.h - part of Krayon^WKrita
 
3
 *
 
4
 *  Copyright (c) 2000 John Califf <jcaliff@compuzone.net>
 
5
 *  Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
 
6
 *  Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
 
7
 *
 
8
 *  This program is free software; you can redistribute it and/or modify
 
9
 *  it under the terms of the GNU General Public License as published by
 
10
 *  the Free Software Foundation; either version 2 of the License, or
 
11
 *  (at your option) any later version.
 
12
 *
 
13
 *  This program is distributed in the hope that it will be useful,
 
14
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
16
 *  GNU General Public License for more details.
 
17
 *
 
18
 *  You should have received a copy of the GNU General Public License
 
19
 *  along with this program; if not, write to the Free Software
 
20
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
21
 */
 
22
 
 
23
#ifndef __selecttoolfreehand_h__
 
24
#define __selecttoolfreehand_h__
 
25
 
 
26
#include <qpoint.h>
 
27
#include <qpointarray.h>
 
28
 
 
29
#include "kis_point.h"
 
30
#include "kis_tool_non_paint.h"
 
31
#include "kis_tool_factory.h"
 
32
#include "kis_selection.h"
 
33
 
 
34
class KisSelectionOptions;
 
35
 
 
36
class KisToolSelectOutline : public KisToolNonPaint {
 
37
 
 
38
    typedef KisToolNonPaint super;
 
39
    Q_OBJECT
 
40
public:
 
41
    KisToolSelectOutline();
 
42
    virtual ~KisToolSelectOutline();
 
43
 
 
44
    virtual void update (KisCanvasSubject *subject);
 
45
 
 
46
    virtual void setup(KActionCollection *collection);
 
47
    virtual Q_UINT32 priority() { return 6; }
 
48
    virtual enumToolType toolType() { return TOOL_SELECT; }
 
49
 
 
50
    virtual void buttonPress(KisButtonPressEvent *event);
 
51
    virtual void move(KisMoveEvent *event);
 
52
    virtual void buttonRelease(KisButtonReleaseEvent *event);
 
53
 
 
54
    QWidget* createOptionWidget(QWidget* parent);
 
55
    virtual QWidget* optionWidget();
 
56
 
 
57
public slots:
 
58
    virtual void slotSetAction(int);
 
59
    virtual void activate();
 
60
    void deactivate();
 
61
 
 
62
protected:
 
63
    virtual void paint(KisCanvasPainter& gc);
 
64
    virtual void paint(KisCanvasPainter& gc, const QRect& rc);
 
65
    void draw(KisCanvasPainter& gc);
 
66
    void draw();
 
67
 
 
68
 
 
69
protected:
 
70
    KisPoint m_dragStart;
 
71
    KisPoint m_dragEnd;
 
72
 
 
73
    bool m_dragging;
 
74
private:
 
75
    typedef QValueVector<KisPoint> KisPointVector;
 
76
    KisCanvasSubject *m_subject;
 
77
    KisPointVector m_points;
 
78
    KisSelectionOptions * m_optWidget;
 
79
    enumSelectionMode m_selectAction;
 
80
};
 
81
 
 
82
 
 
83
class KisToolSelectOutlineFactory : public KisToolFactory {
 
84
    typedef KisToolFactory super;
 
85
public:
 
86
    KisToolSelectOutlineFactory() : super() {};
 
87
    virtual ~KisToolSelectOutlineFactory(){};
 
88
 
 
89
    virtual KisTool * createTool(KActionCollection * ac) {
 
90
        KisTool * t =  new KisToolSelectOutline();
 
91
        Q_CHECK_PTR(t);
 
92
        t->setup(ac);
 
93
        return t;
 
94
    }
 
95
    virtual KisID id() { return KisID("selectoutline", i18n("Select Outline tool")); }
 
96
};
 
97
 
 
98
 
 
99
#endif //__selecttoolfreehand_h__
 
100