1
/* ============================================================
3
* This file is a part of digiKam project
4
* http://www.digikam.org
7
* Description : image editor canvas management class
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>
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)
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.
23
* ============================================================ */
30
#include <Q3ScrollView>
32
#include <QWheelEvent>
33
#include <QPaintEvent>
34
#include <QResizeEvent>
36
#include <QMouseEvent>
41
#include "digikam_export.h"
57
class ExposureSettingsContainer;
58
class ICCSettingsContainer;
62
class DIGIKAM_EXPORT Canvas : public Q3ScrollView
68
explicit Canvas(QWidget* const parent = 0);
71
void load(const QString& filename, IOFileSettings* const IOFileSettings);
72
void preload(const QString& filename);
76
void applyTransform(const IccTransform& transform);
79
EditorCore* interface() const;
80
void makeDefaultEditingCanvas();
82
double snapZoom(double z) const;
83
void setZoomFactorSnapped(double zoom);
85
void setZoomFactor(double z);
86
double zoomFactor() const;
88
void setFitToWindow(bool enable);
89
bool fitToWindow() const;
91
QString ensureHasCurrentUuid() const;
92
DImg currentImage() const;
93
QString currentImageFileFormat() const;
94
QString currentImageFilePath() const;
95
double zoomMax() const;
96
double zoomMin() const;
99
int imageWidth() const;
100
int imageHeight() const;
101
bool exifRotated() const;
102
QRect getSelectedArea() const;
103
QRect visibleArea() const;
105
// If current image file format is only available in read only,
106
// typically all RAW image file formats.
107
bool isReadOnly() const;
109
void setBackgroundColor(const QColor& color);
110
void setICCSettings(const ICCSettingsContainer& cmSettings);
111
void setExposureSettings(ExposureSettingsContainer* const expoSettings);
112
void setSoftProofingEnabled(bool enable);
114
void setExifOrient(bool exifOrient);
116
void toggleFitToWindow();
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);
143
void slotIncreaseZoom();
144
void slotDecreaseZoom();
148
void slotRotate180();
149
void slotRotate270();
150
void slotFlipHoriz();
155
void slotUndo(int steps = 1);
156
void slotRedo(int steps = 1);
160
void slotSelectAll();
161
void slotSelectNone();
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*);
175
QRect calcSelectedArea() const;
176
double calcAutoZoomFactor() const;
178
void updateAutoZoom();
179
void updateContentsSize(bool deleteRubber);
180
void paintViewport(const QRect& er, bool antialias);
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();
200
} // namespace Digikam
202
#endif /* CANVAS_H */