UB.h 5.11 KB
Newer Older
Claudio Valerio's avatar
Claudio Valerio committed
1
/*
2
 * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
Claudio Valerio's avatar
Claudio Valerio committed
3
 *
4 5
 * This file is part of Open-Sankoré.
 *
Claudio Valerio's avatar
Claudio Valerio committed
6 7 8
 * Open-Sankoré 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, version 3 of the License,
9 10 11 12 13
 * with a specific linking exception for the OpenSSL project's
 * "OpenSSL" library (or with modified versions of it that use the
 * same license as the "OpenSSL" library).
 *
 * Open-Sankoré is distributed in the hope that it will be useful,
Claudio Valerio's avatar
Claudio Valerio committed
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Claudio Valerio's avatar
Claudio Valerio committed
15 16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
Claudio Valerio's avatar
Claudio Valerio committed
17
 *
Claudio Valerio's avatar
Claudio Valerio committed
18 19
 * You should have received a copy of the GNU General Public License
 * along with Open-Sankoré.  If not, see <http://www.gnu.org/licenses/>.
Claudio Valerio's avatar
Claudio Valerio committed
20 21
 */

22

Claudio Valerio's avatar
Claudio Valerio committed
23

Claudio Valerio's avatar
Claudio Valerio committed
24 25 26 27 28
#ifndef UB_H_
#define UB_H_

#include <QtGui>

29
#define UB_MAX_ZOOM 9
Claudio Valerio's avatar
Claudio Valerio committed
30

31 32 33 34 35 36 37 38 39 40 41 42 43
struct UBMimeType
{
    enum Enum
    {
        RasterImage = 0,
        VectorImage,
        AppleWidget,
        W3CWidget,
        Video,
        Audio,
        Flash,
        PDF,
        UniboardTool,
44
        Group,
45 46 47 48
        UNKNOWN
    };
};

Claudio Valerio's avatar
Claudio Valerio committed
49 50 51 52
struct UBStylusTool
{
    enum Enum
    {
53 54 55 56
        Pen = 0,
        Eraser,
        Marker,
        Selector,
57
        Play,
58 59 60 61 62 63
        Hand,
        ZoomIn,
        ZoomOut,
        Pointer,
        Line,
        Text,
Claudio Valerio's avatar
Claudio Valerio committed
64
        Capture
Claudio Valerio's avatar
Claudio Valerio committed
65 66 67 68 69 70 71 72 73 74 75
    };
};

struct UBWidth
{
    enum Enum
    {
        Fine = 0, Medium, Strong
    };
};

76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
struct UBZoom
{
    enum Enum
    {
        Small = 0, Medium, Large
    };
};

struct UBSize
{
    enum Enum
    {
        Small = 0, Medium, Large
    };
};

shibakaneki's avatar
shibakaneki committed
92
// Deprecated. Keep it for backward campability with old versions
Claudio Valerio's avatar
Claudio Valerio committed
93 94 95 96 97 98 99 100
struct UBItemLayerType
{
    enum Enum
    {
        FixedBackground = -2000, Object = -1000, Graphic = 0, Tool = 1000, Control = 2000
    };
};

shibakaneki's avatar
shibakaneki committed
101 102 103 104 105 106 107 108 109 110 111 112 113 114
struct itemLayerType
{
    enum Enum {
        NoLayer = 0
        , BackgroundItem
        , ObjectItem
        , DrawingItem
        , ToolItem
        , CppTool
        , Eraiser
        , Curtain
        , Pointer
        , Cache
        , SelectedItem
115
        , SelectionFrame
shibakaneki's avatar
shibakaneki committed
116 117 118 119
    };
};


Claudio Valerio's avatar
Claudio Valerio committed
120 121 122 123
struct UBGraphicsItemData
{
    enum Enum
    {
shibakaneki's avatar
shibakaneki committed
124
        ItemLayerType //Deprecated. Keep it for backward campability with old versions. Use itemLayerType instead
125 126
        , ItemLocked
        , ItemEditable//for text only
127
        , ItemOwnZValue
shibakaneki's avatar
shibakaneki committed
128
        , itemLayerType //use instead of deprecated ItemLayerType
Ivan Ilyin's avatar
Ivan Ilyin committed
129
        , ItemUuid //storing uuid in QGraphicsItem for fast finding operations
130 131 132
        //Duplicating delegate's functions to make possible working with pure QGraphicsItem
        , ItemFlippable // (bool)
        , ItemRotatable // (bool)
Claudio Valerio's avatar
Claudio Valerio committed
133 134 135
    };
};

shibakaneki's avatar
shibakaneki committed
136 137


Claudio Valerio's avatar
Claudio Valerio committed
138 139 140 141
struct UBGraphicsItemType
{
    enum Enum
    {
142
        PolygonItemType = QGraphicsItem::UserType + 1,
Claudio Valerio's avatar
Claudio Valerio committed
143
        PixmapItemType,
144
        SvgItemType,
145
        DelegateButtonType,
146 147
        MediaItemType,
        PDFItemType,
Claudio Valerio's avatar
Claudio Valerio committed
148 149
        TextItemType,
        CurtainItemType,
150 151 152
        RulerItemType,
        CompassItemType,
        ProtractorItemType,
Claudio Valerio's avatar
Claudio Valerio committed
153 154
        StrokeItemType,
        TriangleItemType,
155
        MagnifierItemType,
Ivan Ilyin's avatar
Ivan Ilyin committed
156
        cacheItemType,
157
        groupContainerType,
158
        ToolWidgetItemType,
159
        GraphicsWidgetItemType,
160 161
        UserTypesCount,
        SelectionFrameType// this line must be the last line in this enum because it is types counter.
Claudio Valerio's avatar
Claudio Valerio committed
162 163 164
    };
};

165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189
// Might be fit in int value under most OS
enum UBGraphicsFlag {
    GF_NONE                          = 0x0000 //0000 0000 0000 0000
    ,GF_FLIPPABLE_X_AXIS             = 0x0001 //0000 0000 0000 0001
    ,GF_FLIPPABLE_Y_AXIS             = 0x0002 //0000 0000 0000 0010
    ,GF_FLIPPABLE_ALL_AXIS           = 0x0003 //0000 0000 0000 0011 GF_FLIPPABLE_X_AXIS | GF_FLIPPABLE_Y_AXIS
    ,GF_REVOLVABLE                   = 0x0004 //0000 0000 0000 0100
    ,GF_SCALABLE_X_AXIS              = 0x0008 //0000 0000 0000 1000
    ,GF_SCALABLE_Y_AXIS              = 0x0010 //0000 0000 0001 0000
    ,GF_SCALABLE_ALL_AXIS            = 0x0018 //0000 0000 0001 1000 GF_SCALABLE_X_AXIS | GF_SCALABLE_Y_AXIS
    ,GF_DUPLICATION_ENABLED          = 0x0020 //0000 0000 0010 0000
    ,GF_MENU_SPECIFIED               = 0x0040 //0000 0000 0100 0000
    ,GF_ZORDER_MANIPULATIONS_ALLOWED = 0x0080 //0000 0000 1000 0000
    ,GF_TOOLBAR_USED                 = 0x0100 //0000 0001 0000 0000
    ,GF_SHOW_CONTENT_SOURCE          = 0x0200 //0000 0010 0000 0000
    ,GF_RESPECT_RATIO                = 0x0418 //0000 0100 0001 1000
    ,GF_COMMON                       = 0x00F8 /*0000 0000 1111 1000   GF_SCALABLE_ALL_AXIS
                                                                     |GF_DUPLICATION_ENABLED
                                                                     |GF_MENU_SPECIFIED
                                                                     |GF_ZORDER_MANIPULATIONS_ALLOWED */
    ,GF_ALL                          = 0xFFFF //1111 1111 1111 1111
};
Q_DECLARE_FLAGS(UBGraphicsFlags, UBGraphicsFlag)
Q_DECLARE_OPERATORS_FOR_FLAGS(UBGraphicsFlags )

Claudio Valerio's avatar
Claudio Valerio committed
190 191 192 193 194 195 196 197 198
struct DocumentSizeRatio
{
    enum Enum
    {
        Ratio4_3 = 0, Ratio16_9, Custom
    };
};

#endif /* UB_H_ */