~ubuntu-branches/ubuntu/trusty/digikam/trusty

« back to all changes in this revision

Viewing changes to core/utilities/imageeditor/q3support/canvas.h

  • Committer: Package Import Robot
  • Author(s): Rohan Garg
  • Date: 2012-11-26 18:24:20 UTC
  • mfrom: (1.9.1) (3.1.23 experimental)
  • Revision ID: package-import@ubuntu.com-20121126182420-qoy6z0nx4ai0wzcl
Tags: 4:3.0.0~beta3-0ubuntu1
* New upstream release
  - Add build-deps :  libhupnp-dev, libqtgstreamer-dev, libmagickcore-dev
* Merge from debian, remaining changes:
  - Make sure libqt4-opengl-dev, libgl1-mesa-dev and libglu1-mesa-dev only
    install on i386,amd64 and powerpc
  - Depend on libtiff-dev instead of libtiff4-dev
  - Drop digikam breaks/replaces kipi-plugins-common since we're past the
    LTS release now
  - digikam to recommend mplayerthumbs | ffmpegthumbs. We currently only
    have latter in the archives, even though former is also supposed to
    be part of kdemultimedia. (LP: #890059)
  - kipi-plugins to recommend www-browser rather than konqueror directly
    since 2.8 no direct usage of konqueror is present in the flickr
    plugin anymore (LP: #1011211)
  - Keep kubuntu_mysqld_executable_name.diff
  - Don't install libkipi translations
  - Keep deps on libcv-dev, libcvaux-dev
  - Keep split packaging of libraries
  - Replace icons from KDE 3 time in debian/xpm.d/*.xpm with the new
    versions (LP: #658047)
* Update debian/not-installed

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* ============================================================
 
2
 *
 
3
 * This file is a part of digiKam project
 
4
 * http://www.digikam.org
 
5
 *
 
6
 * Date        : 2003-01-09
 
7
 * Description : image editor canvas management class
 
8
 *
 
9
 * Copyright (C) 2004-2005 by Renchi Raju <renchi dot raju at gmail dot com>
 
10
 * Copyright (C) 2004-2012 by Gilles Caulier <caulier dot gilles at gmail dot com>
 
11
 *
 
12
 * This program is free software; you can redistribute it
 
13
 * and/or modify it under the terms of the GNU General
 
14
 * Public License as published by the Free Software Foundation;
 
15
 * either version 2, or (at your option)
 
16
 * any later version.
 
17
 *
 
18
 * This program is distributed in the hope that it will be useful,
 
19
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
20
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
21
 * GNU General Public License for more details.
 
22
 *
 
23
 * ============================================================ */
 
24
 
 
25
#ifndef CANVAS_H
 
26
#define CANVAS_H
 
27
 
 
28
// Qt includes
 
29
 
 
30
#include <Q3ScrollView>
 
31
#include <QRect>
 
32
#include <QWheelEvent>
 
33
#include <QPaintEvent>
 
34
#include <QResizeEvent>
 
35
#include <QPixmap>
 
36
#include <QMouseEvent>
 
37
#include <QKeyEvent>
 
38
 
 
39
// Local includes
 
40
 
 
41
#include "digikam_export.h"
 
42
#include "dimg.h"
 
43
 
 
44
class QString;
 
45
class QStringList;
 
46
class QPixmap;
 
47
class QPaintEvent;
 
48
class QResizeEvent;
 
49
class QWheelEvent;
 
50
class QKeyEvent;
 
51
class QColor;
 
52
 
 
53
namespace Digikam
 
54
{
 
55
 
 
56
class EditorCore;
 
57
class ExposureSettingsContainer;
 
58
class ICCSettingsContainer;
 
59
class IccTransform;
 
60
class IOFileSettings;
 
61
 
 
62
class DIGIKAM_EXPORT Canvas : public Q3ScrollView
 
63
{
 
64
    Q_OBJECT
 
65
 
 
66
public:
 
67
 
 
68
    explicit Canvas(QWidget* const parent = 0);
 
69
    ~Canvas();
 
70
 
 
71
    void    load(const QString& filename, IOFileSettings* const IOFileSettings);
 
72
    void    preload(const QString& filename);
 
73
 
 
74
    void    resetImage();
 
75
    void    abortSaving();
 
76
    void    applyTransform(const IccTransform& transform);
 
77
    void    setModified();
 
78
 
 
79
    EditorCore* interface() const;
 
80
    void makeDefaultEditingCanvas();
 
81
 
 
82
    double snapZoom(double z) const;
 
83
    void   setZoomFactorSnapped(double zoom);
 
84
 
 
85
    void   setZoomFactor(double z);
 
86
    double zoomFactor() const;
 
87
 
 
88
    void   setFitToWindow(bool enable);
 
89
    bool   fitToWindow() const;
 
90
 
 
91
    QString ensureHasCurrentUuid()   const;
 
92
    DImg    currentImage()           const;
 
93
    QString currentImageFileFormat() const;
 
94
    QString currentImageFilePath()   const;
 
95
    double zoomMax()                 const;
 
96
    double zoomMin()                 const;
 
97
    bool   maxZoom()                 const;
 
98
    bool   minZoom()                 const;
 
99
    int    imageWidth()              const;
 
100
    int    imageHeight()             const;
 
101
    bool   exifRotated()             const;
 
102
    QRect  getSelectedArea()         const;
 
103
    QRect  visibleArea()             const;
 
104
 
 
105
    // If current image file format is only available in read only,
 
106
    // typically all RAW image file formats.
 
107
    bool  isReadOnly()               const;
 
108
 
 
109
    void  setBackgroundColor(const QColor& color);
 
110
    void  setICCSettings(const ICCSettingsContainer& cmSettings);
 
111
    void  setExposureSettings(ExposureSettingsContainer* const expoSettings);
 
112
    void  setSoftProofingEnabled(bool enable);
 
113
 
 
114
    void  setExifOrient(bool exifOrient);
 
115
 
 
116
    void  toggleFitToWindow();
 
117
    void  fitToSelect();
 
118
 
 
119
Q_SIGNALS:
 
120
 
 
121
    void signalZoomChanged(double zoom);
 
122
    void signalMaxZoom();
 
123
    void signalMinZoom();
 
124
    void signalChanged();
 
125
    void signalSelected(bool);
 
126
    void signalRightButtonClicked();
 
127
    void signalShowNextImage();
 
128
    void signalShowPrevImage();
 
129
    void signalPrepareToLoad();
 
130
    void signalLoadingStarted(const QString& filename);
 
131
    void signalLoadingFinished(const QString& filename, bool success);
 
132
    void signalLoadingProgress(const QString& filePath, float progress);
 
133
    void signalSavingStarted(const QString& filename);
 
134
    void signalSavingFinished(const QString& filename, bool success);
 
135
    void signalSavingProgress(const QString& filePath, float progress);
 
136
    void signalSelectionChanged(const QRect&);
 
137
    void signalToggleOffFitToWindow();
 
138
    void signalUndoSteps(int);
 
139
    void signalRedoSteps(int);
 
140
 
 
141
public Q_SLOTS:
 
142
 
 
143
    void slotIncreaseZoom();
 
144
    void slotDecreaseZoom();
 
145
 
 
146
    // image modifiers
 
147
    void slotRotate90();
 
148
    void slotRotate180();
 
149
    void slotRotate270();
 
150
    void slotFlipHoriz();
 
151
    void slotFlipVert();
 
152
    void slotCrop();
 
153
 
 
154
    void slotRestore();
 
155
    void slotUndo(int steps = 1);
 
156
    void slotRedo(int steps = 1);
 
157
 
 
158
    void slotCopy();
 
159
 
 
160
    void slotSelectAll();
 
161
    void slotSelectNone();
 
162
 
 
163
protected:
 
164
 
 
165
    void resizeEvent(QResizeEvent*);
 
166
    void viewportPaintEvent(QPaintEvent*);
 
167
    void contentsMousePressEvent(QMouseEvent*);
 
168
    void contentsMouseMoveEvent(QMouseEvent*);
 
169
    void contentsMouseReleaseEvent(QMouseEvent*);
 
170
    void contentsWheelEvent(QWheelEvent*);
 
171
    void keyPressEvent(QKeyEvent*);
 
172
 
 
173
private:
 
174
 
 
175
    QRect  calcSelectedArea()   const;
 
176
    double calcAutoZoomFactor() const;
 
177
 
 
178
    void   updateAutoZoom();
 
179
    void   updateContentsSize(bool deleteRubber);
 
180
    void   paintViewport(const QRect& er, bool antialias);
 
181
    void   reset();
 
182
 
 
183
private Q_SLOTS:
 
184
 
 
185
    void slotSelected();
 
186
    void slotModified();
 
187
    void slotImageLoaded(const QString& filePath, bool success);
 
188
    void slotImageSaved(const QString& filePath, bool success);
 
189
    void slotCornerButtonPressed();
 
190
    void slotZoomChanged(double);
 
191
    void slotPanIconSelectionMoved(const QRect&, bool);
 
192
    void slotPanIconHiden();
 
193
 
 
194
private:
 
195
 
 
196
    class Private;
 
197
    Private* const d;
 
198
};
 
199
 
 
200
}  // namespace Digikam
 
201
 
 
202
#endif /* CANVAS_H */