Subversion Repositories Scribus

Rev

Rev 11576 | Rev 12799 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
12610 jghali 1
/*
2
 For general Scribus (>=1.3.2) copyright and licensing information please refer
3
 to the COPYING file provided with the program. Following this notice may exist
4
 a copyright and/or license notice that predates the release of Scribus 1.3.2
5
 for which a new license (GPL+exception) is in place.
6
 */
7
/***************************************************************************
8
*                                                                         *
9
*   This program is free software; you can redistribute it and/or modify  *
10
*   it under the terms of the GNU General Public License as published by  *
11
*   the Free Software Foundation; either version 2 of the License, or     *
12
*   (at your option) any later version.                                   *
13
*                                                                         *
14
***************************************************************************/
15
 
16
 
17
 
18
#ifndef CANVAS_MODE_CREATE_H
19
#define CANVAS_MODE_CREATE_H
20
 
21
#include "canvasmode.h"
22
#include "fpointarray.h"
23
 
24
class PageItem;
25
class ScribusMainWindow;
26
class ScribusView;
27
class UndoTransaction;
28
 
29
/**
30
  Handles the creation of new pageitems
31
*/
32
class CreateMode : public CanvasMode
33
{
34
public:
35
        CreateMode(ScribusView* view);
36
 
37
        virtual void enterEvent(QEvent *);
38
        virtual void leaveEvent(QEvent *);
39
 
40
        virtual void activate(bool);
41
        virtual void deactivate(bool);
42
        virtual void mouseDoubleClickEvent(QMouseEvent *m);
43
        virtual void mouseReleaseEvent(QMouseEvent *m);
44
        virtual void mouseMoveEvent(QMouseEvent *m);
45
        virtual void mousePressEvent(QMouseEvent *m);
46
        virtual void drawControls(QPainter* p);
47
 
48
protected:
49
        void setResizeCursor(int);
50
 
51
private:
52
        inline bool GetItem(PageItem** pi);
53
        void selectPage(QMouseEvent *m);
54
        void SetupDrawNoResize(int nr);
55
 
56
        PageItem* doCreateNewObject(void);
57
        bool      doOneClick(FPoint& startPoint, FPoint& endPoint);
58
 
59
        // We do not use PageItem::ItemType and PageItem::FrameType here
60
        // for the pure sake of not including pageitem.h
61
        void getFrameItemTypes(int& itemType, int& frameType);
62
 
63
        bool   inItemCreation;
64
        bool   m_MouseButtonPressed;
65
        FPoint mouseGlobalCoord;
66
        FPoint canvasPressCoord;
67
        FPoint canvasCurrCoord;
68
        FPoint createObjectPos;
69
        int    createObjectMode;
70
        int    createObjectSubMode;
71
        Qt::KeyboardModifiers modifiers;
72
        UndoTransaction* m_createTransaction;
73
};
74
 
75
 
76
#endif