/usr/include/scribus/canvasmode.h is in scribus-dev 1.4.6+dfsg-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | /*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef CANVAS_MODE_H
#define CANVAS_MODE_H
#include "scribusapi.h"
#include <QBrush>
#include <QCursor>
#include <QMap>
#include <QPen>
class QDragEnterEvent;
class QDragMoveEvent;
class QDragLeaveEvent;
class QDropEvent;
class QEvent;
class QInputMethodEvent;
class QImage;
class QMouseEvent;
class QKeyEvent;
class QPainter;
class Canvas;
struct CanvasViewMode;
class PanGesture;
class ScribusDoc;
class ScribusView;
class ScribusMainWindow;
class PageItem;
class PageItemPreview;
/** These aren't real appmodes but open a new window or override behaviour for a short time */
enum SubMode
{
submodeFirstSubmode = 1000,
submodePaintingDone, // return to normal mode
submodeEndNodeEdit, // return from node/shape editing
submodeLoadPic, // open GetImage dialog
submodeStatusPic, // open ManageImages dialog
submodeEditExternal, // open external image editor
submodeAnnotProps, // open properties dialog
submodeLastSubmode
};
/**
This class is a superclass for all mode handlers.
By default, all events are ignored.
*/
class SCRIBUS_API CanvasMode : public QObject
{
Q_OBJECT
protected:
CanvasMode (ScribusView* view);
public:
static CanvasMode* createForAppMode(ScribusView* view, int appMode);
/**
Is called when this mode becomes active, either because it was selected by the user
(fromgesture == false) or because a gesture completed and the canvas returns back to
this mode (fromGesture == true)
*/
virtual void activate(bool fromGesture) {}
/**
Is called when this mode becomes inactive, either because the canvas switches to
another mode (forGesture == false) or because a gesture is activated (forGesture == true)
*/
virtual void deactivate(bool forGesture) {}
virtual void enterEvent(QEvent *) {}
virtual void leaveEvent(QEvent *) {}
virtual void dragEnterEvent(QDragEnterEvent *e) {}
virtual void dragMoveEvent(QDragMoveEvent *e) {}
virtual void dragLeaveEvent(QDragLeaveEvent *e) {}
virtual void dropEvent(QDropEvent *e) {}
virtual void mouseDoubleClickEvent(QMouseEvent *m) {}
virtual void mouseReleaseEvent(QMouseEvent *m) {}
virtual void mouseMoveEvent(QMouseEvent *m) {}
virtual void mousePressEvent(QMouseEvent *m) {}
virtual void keyPressEvent(QKeyEvent *e) {}
virtual void keyReleaseEvent(QKeyEvent *e) {}
virtual void inputMethodEvent(QInputMethodEvent *e) {}
/**
Sets appropiate values for this canvas mode
*/
virtual void updateViewMode(CanvasViewMode* viewmode);
/**
Draws the controls for this mode and the selection marker.
If viewmode.drawSelectionWithControls is true, also draws the selection contents first.
*/
virtual void drawControls(QPainter* p) { }
/** Draws the regular selection marker */
void drawSelection(QPainter* psx, bool drawHandles);
/** Draws an outline of selected items */
void drawOutline(QPainter* p, double scalex=1.0, double scaley=1.0, double deltax=0.0, double deltay=0.0);
#ifdef GESTURE_FRAME_PREVIEW
// I don’t know why the methods above have been implemented here and left non-virtual.
// I need to setup some companion members - pm
private:
QMap<PageItem*, PageItemPreview*> m_pixmapCache;
public:
void clearPixmapCache();
#endif // GESTURE_FRAME_PREVIEW
QCursor modeCursor();
void setModeCursor();
/** main canvas modes dont have a delegate */
virtual CanvasMode* delegate() { return 0; }
ScribusView* view() const { return m_view; }
virtual ~CanvasMode();
protected:
ScribusView * const m_view;
Canvas * const m_canvas;
ScribusDoc * const m_doc;
PanGesture * m_panGesture;
void setResizeCursor(int how, double rot = 0.0);
bool commonMouseMove(QMouseEvent *m);
void commonDrawControls(QPainter* p, bool drawHandles);
private:
QMap<QString,QPen> m_pen;
QMap<QString,QBrush> m_brush;
};
#endif
|