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
156
157
158
159
160
161
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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
|
/* ============================================================
*
* This file is a part of digiKam project
* http://www.digikam.org
*
* Date : 2003-01-09
* Description : image editor canvas management class
*
* Copyright (C) 2004-2005 by Renchi Raju <[email protected]>
* Copyright (C) 2004-2008 by Gilles Caulier <caulier dot gilles at gmail dot com>
*
* 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, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* ============================================================ */
#ifndef CANVAS_H
#define CANVAS_H
// TQt includes.
#include <tqscrollview.h>
#include <tqrect.h>
// Local includes.
#include "digikam_export.h"
#include "dimg.h"
class TQString;
class TQStringList;
class TQPixmap;
class TQPaintEvent;
class TQResizeEvent;
class TQWheelEvent;
class TQKeyEvent;
class TQColor;
namespace Digikam
{
class CanvasPrivate;
class DImgInterface;
class ExposureSettingsContainer;
class ICCSettingsContainer;
class IOFileSettingsContainer;
class DIGIKAM_EXPORT Canvas : public TQScrollView
{
TQ_OBJECT
public:
Canvas(TQWidget *parent=0);
~Canvas();
void load(const TQString& filename, IOFileSettingsContainer *IOFileSettings);
void preload(const TQString& filename);
void saveAs(const TQString& filename, IOFileSettingsContainer *IOFileSettings,
bool setExifOrientationTag, const TQString& mimeType=TQString());
void resetImage();
void switchToLastSaved(const TQString& newFilename);
void abortSaving();
void setModified();
void readMetadataFromFile(const TQString &file);
void clearUndoHistory();
void setUndoHistoryOrigin();
void updateUndoState();
DImg currentImage();
TQString currentImageFileFormat();
TQString currentImageFilePath();
DImgInterface *interface() const;
void makeDefaultEditingCanvas();
double snapZoom(double z);
void setZoomFactorSnapped(double zoom);
double zoomFactor();
void setZoomFactor(double z);
bool fitToWindow();
bool maxZoom();
bool minZoom();
bool exifRotated();
int imageWidth();
int imageHeight();
TQRect getSelectedArea();
// If current image file format is only available in read only,
// typicially all RAW image file formats.
bool isReadOnly();
void resizeImage(int w, int h);
void setBackgroundColor(const TQColor& color);
void setICCSettings(ICCSettingsContainer *cmSettings);
void setExposureSettings(ExposureSettingsContainer *expoSettings);
void setExifOrient(bool exifOrient);
void increaseGamma();
void decreaseGamma();
void increaseBrightness();
void decreaseBrightness();
void increaseContrast();
void decreaseContrast();
void getUndoHistory(TQStringList &titles);
void getRedoHistory(TQStringList &titles);
void toggleFitToWindow();
void fitToSelect();
signals:
void signalZoomChanged(double zoom);
void signalMaxZoom();
void signalMinZoom();
void signalChanged();
void signalUndoStateChanged(bool, bool, bool);
void signalSelected(bool);
void signalRightButtonClicked();
void signalShowNextImage();
void signalShowPrevImage();
void signalPrepareToLoad();
void signalLoadingStarted(const TQString &filename);
void signalLoadingFinished(const TQString &filename, bool success);
void signalLoadingProgress(const TQString& filePath, float progress);
void signalSavingStarted(const TQString &filename);
void signalSavingFinished(const TQString &filename, bool success);
void signalSavingProgress(const TQString& filePath, float progress);
void signalSelectionChanged(const TQRect&);
void signalToggleOffFitToWindow();
public slots:
void slotIncreaseZoom();
void slotDecreaseZoom();
// image modifiers
void slotRotate90();
void slotRotate180();
void slotRotate270();
void slotFlipHoriz();
void slotFlipVert();
void slotCrop();
void slotRestore();
void slotUndo(int steps=1);
void slotRedo(int steps=1);
void slotCopy();
void slotSelectAll();
void slotSelectNone();
protected:
void resizeEvent(TQResizeEvent* e);
void viewportPaintEvent(TQPaintEvent *e);
void contentsMousePressEvent(TQMouseEvent *e);
void contentsMouseMoveEvent(TQMouseEvent *e);
void contentsMouseReleaseEvent(TQMouseEvent *e);
void contentsWheelEvent(TQWheelEvent *e);
private:
TQRect calcSeletedArea();
double calcAutoZoomFactor();
void updateAutoZoom();
void updateContentsSize(bool deleteRubber);
void drawRubber();
void paintViewport(const TQRect& er, bool antialias);
void reset();
private slots:
void slotSelected();
void slotModified();
void slotImageLoaded(const TQString& filePath, bool success);
void slotImageSaved(const TQString& filePath, bool success);
void slotCornerButtonPressed();
void slotZoomChanged(double);
void slotPanIconSelectionMoved(const TQRect&, bool);
void slotPanIconHiden();
private:
CanvasPrivate *d;
};
} // namespace Digikam
#endif /* CANVAS_H */
|