1
/* ============================================================
2
* Author: Gilles Caulier <caulier dot gilles at free.fr>
6
* Copyright 2004 by Gilles Caulier
8
* This program is free software; you can redistribute it
9
* and/or modify it under the terms of the GNU General
10
* Public License as published by the Free Software Foundation;
11
* either version 2, or (at your option)
14
* This program is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU General Public License for more details.
19
* ============================================================ */
21
#ifndef IMAGESELECTIONWIDGET_H
22
#define IMAGESELECTIONWIDGET_H
37
class ImageSelectionWidget : public QWidget
43
enum RatioAspect // Contrained Aspect Ratio list.
45
RATIOCUSTOM=0, // Custom aspect ratio.
52
RATIONONE // No aspect ratio.
61
ImageSelectionWidget(int width, int height, QWidget *parent=0,
62
float aspectRatioValue=1.0, int aspectRatio=RATIO01X01,
63
int orient=Landscape, bool ruleThirdLines=false);
64
~ImageSelectionWidget();
66
void setCenterSelection(void);
67
void setSelectionX(int x);
68
void setSelectionY(int y);
69
void setSelectionWidth(int w);
70
void setSelectionHeight(int h);
71
void setSelectionOrientation(int orient);
72
void setSelectionAspectRatioType(int aspectRatioType);
73
void setSelectionAspectRatioValue(float aspectRatioValue);
75
int getOriginalImageWidth(void);
76
int getOriginalImageHeight(void);
77
QRect getRegionSelection(void);
79
int getMinWidthRange(void);
80
int getMinHeightRange(void);
82
void resetSelection(void);
83
void maxAspectSelection(void);
87
void slotRuleThirdLines(bool ruleThirdLines);
91
void signalSelectionMoved( QRect rect );
92
void signalSelectionChanged( QRect rect );
93
void signalSelectionWidthChanged( int newWidth );
94
void signalSelectionHeightChanged( int newHeight );
98
void paintEvent( QPaintEvent *e );
99
void mousePressEvent ( QMouseEvent * e );
100
void mouseReleaseEvent ( QMouseEvent * e );
101
void mouseMoveEvent ( QMouseEvent * e );
105
void slotTimerDone(void);
120
bool m_ruleThirdLines;
130
QRect m_regionSelection; // Real size image selection.
131
QRect m_localRegionSelection; // Local size selection.
133
// Draggable local region selection corners.
134
QRect m_localTopLeftCorner;
135
QRect m_localBottomLeftCorner;
136
QRect m_localTopRightCorner;
137
QRect m_localBottomRightCorner;
144
int m_currentAspectRatioType;
145
int m_currentAspectRatio;
146
int m_currentResizing;
147
int m_currentOrientation;
149
float m_currentAspectRatioValue;
151
// Recalculate the target selection position and emit 'signalSelectionMoved'.
152
void regionSelectionMoved( bool targetDone );
154
void regionSelectionChanged(bool targetDone);
155
void realToLocalRegion(bool updateSizeOnly=false);
156
void localToRealRegion(void);
157
void applyAspectRatio(bool WOrH, bool repaintWidget=true, bool updateChange=true);
158
void updatePixmap(void);
161
} // NameSpace Digikam
163
#endif /* IMAGESELECTIONWIDGET_H */