AlbumShaper  1.0a3
selectionInterface.h
Go to the documentation of this file.
1 //Added by qt3to4:
2 #include <QResizeEvent>
3 #include <QMouseEvent>
4 #include <QKeyEvent>
5 #include <QPaintEvent>
6 //==============================================
7 // copyright : (C) 2003-2005 by Will Stokes
8 //==============================================
9 // This program is free software; you can redistribute it
10 // and/or modify it under the terms of the GNU General
11 // Public License as published by the Free Software
12 // Foundation; either version 2 of the License, or
13 // (at your option) any later version.
14 //==============================================
15 
16 #ifndef GUI_EDITING_SELECTIONINTERFACE_H
17 #define GUI_EDITING_SELECTIONINTERFACE_H
18 
20 typedef enum
21 {
35 } DRAG_MODE;
36 
37 //--------------------
38 //forward declarations
39 class QPoint;
40 //--------------------
41 
42 #include <qwidget.h>
43 #include <qimage.h>
44 
45 //=====================================
48 //=====================================
50 {
51 Q_OBJECT
52 
53 public:
55  SelectionInterface(QWidget *parent=0,
56  const char* name=0);
57 
60 
62  void setPhoto(QString imageFilename, bool resetSelection=true);
63 
66  void getSelection(QPoint &topLeft, QPoint &bottomRight);
67 
70  void setSelection(QPoint topLeft, QPoint bottomRight, double cropMaxDimen=-1.0);
71 
73  bool selectionEmpty();
74 
76  void getDisplaySize(int &width, int &height);
77 
79  void enterDrawLineMode();
80  //----------------------
81 signals:
84  void ctrlClick();
85 
87  void selectionChanged();
88 
90  void aspectRatioChanged();
91 
94  void lineSelected( QPoint p1, QPoint p2 );
95  //----------------------
96 protected:
97  QSize sizeHint();
98  void paintEvent( QPaintEvent *e);
99  void mousePressEvent( QMouseEvent *e);
100  void mouseReleaseEvent( QMouseEvent *);
101  void mouseMoveEvent( QMouseEvent *e);
102  void resizeEvent( QResizeEvent * );
103  void keyPressEvent(QKeyEvent *e);
104  void keyReleaseEvent(QKeyEvent *e);
105  //----------------------
106 public slots:
108  void selectNone();
109 
111  void selectAll();
112  //----------------------
113 private:
116 
118  QPoint cropSelectedPoint(QPoint p);
119 
121  QPoint ConvertDisplayToImageCoordinate( QPoint p );
122 
124  QPoint ConvertImageToDisplayCoordinate( QPoint p );
125 
127  void constructDisplayImages();
128 
130  void updateCursorShape( QPoint p );
131 
133  bool scaleSelection( int delta );
134 
137 
139  QImage scaledImage;
140 
143 
146 
149 
152 
155 
159 
162 
165 
168 
171 
176 
178  double cropMaxDimen;
179 //----------------------
180 };
181 //======================
182 
183 #endif //GUI_EDITING_SELECTIONINTERFACE_H
QPoint bottomRight
QSize origImageSize
original image dimensions
void mousePressEvent(QMouseEvent *e)
void updateCursorShape(QPoint p)
update mouse cursor based on position over widget and selected region
QPoint topLeft
void keyPressEvent(QKeyEvent *e)
QString origImageFilename
original image filename
~SelectionInterface()
Deletes objects.
void selectionChanged()
emitted when the user changed the selected region
void constructDisplayImages()
construct scaled image and unselected images for drawing purposes
QPoint mousePressPoint
first corner of selection, where mouse first clicked
DRAG_MODE
current drag mode, effect of mouse movement on selected range
double cropMaxDimen
Current crop max dimension (in inches)
QPoint mouseDragPoint
second corner of selection, where mouse moved to
void keyReleaseEvent(QKeyEvent *e)
void enterDrawLineMode()
enter draw line mode - used for tilt correction
bool SHIFT_Pressed
state of SHIFT button, effects if mouse drags adjust or scale the current selection ...
void setPhoto(QString imageFilename, bool resetSelection=true)
Updates displayed photo.
DRAG_MODE
current drag mode, effect of mouse movement on current selection
DRAG_MODE currentDragMode
method of dragging out, either new selection or resizing selection corner or side ...
int width
Definition: blur.cpp:79
QPoint cropSelectedPoint(QPoint p)
crops a selected point to within the photo
void selectAll()
selects all of the image
QPoint ConvertDisplayToImageCoordinate(QPoint p)
converts a point from display coordinates to original image coordinates
void mouseReleaseEvent(QMouseEvent *)
void paintEvent(QPaintEvent *e)
void getSelection(QPoint &topLeft, QPoint &bottomRight)
Returns the current selected coordinates (actual slideshow image space, aka not including buffered wh...
bool CTRL_Pressed
state of CTRL button, effects if mouse clicks rotate current selection
QPoint cachedSelctionCenter
cache the aspect ratio when pressing the control buttion, this helps aleviate numerical error that bu...
void getDisplaySize(int &width, int &height)
returns the current photo display size (in screen pixels)
void setSelection(QPoint topLeft, QPoint bottomRight, double cropMaxDimen=-1.0)
Sets the current selection cropMaxDimen specifies the idealized dimension in dominant direction in in...
Display widget for photos. Used by the PhotoEditWidget.
DRAG_MODE currentMouseShape
current mouse shape.
void aspectRatioChanged()
emitted when the user changed the aspect ratio of the selected region
QPoint cachedMousePosition
cached mouse position, used to scale or drag around selection area
void resizeEvent(QResizeEvent *)
void selectNone()
selects none of the image
void ctrlClick()
emitted when a user CTRL-clicks a selection indicating the selection needs to be rotated intelligentl...
void lineSelected(QPoint p1, QPoint p2)
emitted once line has been selected, on or the other points will be set to -1,-1 if the user escaped ...
bool scaleSelection(int delta)
increase/decrease selection while maintaining aspect ratio by changing selected width by delta ...
QImage unselectedScaledImage
Grayscale version of scaled image, used for drawing non-selected regions.
void mouseMoveEvent(QMouseEvent *e)
QPoint ConvertImageToDisplayCoordinate(QPoint p)
converts a point from original image coordinates to display coordinates
bool selectionEmpty()
returns true if selection is empty
DRAG_MODE mouseActionByPosition(QPoint p)
determine action based on mouse position
SelectionInterface(QWidget *parent=0, const char *name=0)
Creates layout.
QImage scaledImage
Scaled image used for display purposes.
QImage fullScreenImage
Full screen version of image.
int height
Definition: blur.cpp:79