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
36
37//--------------------
38//forward declarations
39class QPoint;
40//--------------------
41
42#include <qwidget.h>
43#include <qimage.h>
44
45//=====================================
48//=====================================
50{
51Q_OBJECT
52
53public:
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 //----------------------
81signals:
84 void ctrlClick();
85
88
91
94 void lineSelected( QPoint p1, QPoint p2 );
95 //----------------------
96protected:
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 //----------------------
106public slots:
108 void selectNone();
109
111 void selectAll();
112 //----------------------
113private:
116
118 QPoint cropSelectedPoint(QPoint p);
119
121 QPoint ConvertDisplayToImageCoordinate( QPoint p );
122
124 QPoint ConvertImageToDisplayCoordinate( QPoint p );
125
128
130 void updateCursorShape( QPoint p );
131
133 bool scaleSelection( int delta );
134
137
140
143
146
149
152
155
159
162
165
168
171
176
179//----------------------
180};
181//======================
182
183#endif //GUI_EDITING_SELECTIONINTERFACE_H
int width
Definition blur.cpp:79
int height
Definition blur.cpp:79
Display widget for photos. Used by the PhotoEditWidget.
QPoint mousePressPoint
first corner of selection, where mouse first clicked
void ctrlClick()
emitted when a user CTRL-clicks a selection indicating the selection needs to be rotated intelligentl...
bool selectionEmpty()
returns true if selection is empty
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 ...
SelectionInterface(QWidget *parent=0, const char *name=0)
Creates layout.
void selectNone()
selects none of the image
void setPhoto(QString imageFilename, bool resetSelection=true)
Updates displayed photo.
void selectAll()
selects all of the image
bool scaleSelection(int delta)
increase/decrease selection while maintaining aspect ratio by changing selected width by delta
~SelectionInterface()
Deletes objects.
void aspectRatioChanged()
emitted when the user changed the aspect ratio of the selected region
double cropMaxDimen
Current crop max dimension (in inches)
void keyReleaseEvent(QKeyEvent *e)
QPoint ConvertDisplayToImageCoordinate(QPoint p)
converts a point from display coordinates to original image coordinates
QSize origImageSize
original image dimensions
QString origImageFilename
original image filename
DRAG_MODE currentDragMode
method of dragging out, either new selection or resizing selection corner or side
void mouseMoveEvent(QMouseEvent *e)
QPoint ConvertImageToDisplayCoordinate(QPoint p)
converts a point from original image coordinates to display coordinates
void getDisplaySize(int &width, int &height)
returns the current photo display size (in screen pixels)
void paintEvent(QPaintEvent *e)
void updateCursorShape(QPoint p)
update mouse cursor based on position over widget and selected region
void resizeEvent(QResizeEvent *)
void enterDrawLineMode()
enter draw line mode - used for tilt correction
void mousePressEvent(QMouseEvent *e)
QPoint cachedSelctionCenter
cache the aspect ratio when pressing the control buttion, this helps aleviate numerical error that bu...
DRAG_MODE mouseActionByPosition(QPoint p)
determine action based on mouse position
bool SHIFT_Pressed
state of SHIFT button, effects if mouse drags adjust or scale the current selection
void constructDisplayImages()
construct scaled image and unselected images for drawing purposes
void setSelection(QPoint topLeft, QPoint bottomRight, double cropMaxDimen=-1.0)
Sets the current selection cropMaxDimen specifies the idealized dimension in dominant direction in in...
DRAG_MODE currentMouseShape
current mouse shape.
QImage unselectedScaledImage
Grayscale version of scaled image, used for drawing non-selected regions.
QPoint cropSelectedPoint(QPoint p)
crops a selected point to within the photo
void getSelection(QPoint &topLeft, QPoint &bottomRight)
Returns the current selected coordinates (actual slideshow image space, aka not including buffered wh...
QImage scaledImage
Scaled image used for display purposes.
QPoint mouseDragPoint
second corner of selection, where mouse moved to
void keyPressEvent(QKeyEvent *e)
bool CTRL_Pressed
state of CTRL button, effects if mouse clicks rotate current selection
QPoint cachedMousePosition
cached mouse position, used to scale or drag around selection area
void mouseReleaseEvent(QMouseEvent *)
void selectionChanged()
emitted when the user changed the selected region
QImage fullScreenImage
Full screen version of image.
QPoint topLeft
QPoint bottomRight
DRAG_MODE
current drag mode, effect of mouse movement on current selection
@ MOVE_TOP_SIDE
@ MOVE_BOTTOM_RIGHT_CORNER
@ MOVE_TOP_RIGHT_CORNER
@ DRAW_SELECTION
@ NO_EFFECT
@ DRAW_LINE
@ MOVE_BOTTOM_SIDE
@ MOVE_RIGHT_SIDE
@ MOVE_SELECTION
@ MOVE_LEFT_SIDE
@ MOVE_TOP_LEFT_CORNER
@ MOVE_BOTTOM_LEFT_CORNER
@ SCALE_SELECTION