#include <selectionInterface.h>
Inheritance diagram for SelectionInterface:
Definition at line 44 of file selectionInterface.h.
Public Slots | |
void | selectNone () |
selects none of the image | |
void | selectAll () |
selects all of the image | |
Signals | |
void | ctrlClick () |
emitted when a user CTRL-clicks a selection indicating the selection needs to be rotated intelligently | |
void | selectionChanged () |
emitted when the user changed the selected region | |
void | aspectRatioChanged () |
emitted when the user changed the aspect ratio of the selected region | |
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 out the selected a line | |
Public Member Functions | |
SelectionInterface (QWidget *parent=0, const char *name=0) | |
Creates layout. | |
~SelectionInterface () | |
Deletes objects. | |
void | setPhoto (QString imageFilename, bool resetSelection=true) |
Updates displayed photo. | |
void | getSelection (QPoint &topLeft, QPoint &bottomRight) |
Returns the current selected coordinates (actual slideshow image space, aka not including buffered whitespace or widget offsets). | |
void | setSelection (QPoint topLeft, QPoint bottomRight, double cropMaxDimen=-1.0) |
Sets the current selection cropMaxDimen specifies the idealized dimension in dominant direction in inches (eg 7"). | |
bool | selectionEmpty () |
returns true if selection is empty | |
void | getDisplaySize (int &width, int &height) |
returns the current photo display size (in screen pixels) | |
void | enterDrawLineMode () |
enter draw line mode - used for tilt correction | |
Protected Member Functions | |
QSize | sizeHint () |
void | paintEvent (QPaintEvent *e) |
void | mousePressEvent (QMouseEvent *e) |
void | mouseReleaseEvent (QMouseEvent *) |
void | mouseMoveEvent (QMouseEvent *e) |
void | resizeEvent (QResizeEvent *) |
void | keyPressEvent (QKeyEvent *e) |
void | keyReleaseEvent (QKeyEvent *e) |
Private Member Functions | |
DRAG_MODE | mouseActionByPosition (QPoint p) |
determine action based on mouse position | |
QPoint | cropSelectedPoint (QPoint p) |
crops a selected point to within the photo | |
QPoint | ConvertDisplayToImageCoordinate (QPoint p) |
converts a point from display coordinates to original image coordinates | |
QPoint | ConvertImageToDisplayCoordinate (QPoint p) |
converts a point from original image coordinates to display coordinates | |
void | constructDisplayImages () |
construct scaled image and unselected images for drawing purposes | |
void | updateCursorShape (QPoint p) |
update mouse cursor based on position over widget and selected region | |
bool | scaleSelection (int delta) |
increase/decrease selection while maintaining aspect ratio by changing selected width by delta | |
Private Attributes | |
QImage | fullScreenImage |
Full screen version of image. | |
QImage | scaledImage |
Scaled image used for display purposes. | |
QImage | unselectedScaledImage |
Grayscale version of scaled image, used for drawing non-selected regions. | |
QPoint | mousePressPoint |
first corner of selection, where mouse first clicked | |
QPoint | mouseDragPoint |
second corner of selection, where mouse moved to | |
QPoint | cachedMousePosition |
cached mouse position, used to scale or drag around selection area | |
DRAG_MODE | currentDragMode |
method of dragging out, either new selection or resizing selection corner or side | |
DRAG_MODE | currentMouseShape |
current mouse shape. | |
QString | origImageFilename |
original image filename | |
QSize | origImageSize |
original image dimensions | |
bool | SHIFT_Pressed |
state of SHIFT button, effects if mouse drags adjust or scale the current selection | |
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 builds up when scaling up and down selections | |
QSize | cachedSelectionSize |
double | cropMaxDimen |
Current crop max dimension (in inches). |
|
Creates layout.
Definition at line 41 of file selectionInterface.cpp. References cachedMousePosition, cropMaxDimen, currentDragMode, currentMouseShape, mouseDragPoint, mousePressPoint, NO_EFFECT, selectAll(), SelectionInterface(), and selectNone(). Referenced by SelectionInterface().
|
|
Deletes objects.
Definition at line 73 of file selectionInterface.cpp.
|
|
emitted when the user changed the aspect ratio of the selected region
Referenced by mouseMoveEvent(), mousePressEvent(), selectAll(), and selectNone(). |
|
construct scaled image and unselected images for drawing purposes
Definition at line 117 of file selectionInterface.cpp. References b, fullScreenImage, height, HSVtoRGB(), RGBtoHSV(), scaledImage, unselectedScaledImage, and width. Referenced by resizeEvent(), and setPhoto().
|
|
converts a point from display coordinates to original image coordinates
Definition at line 874 of file selectionInterface.cpp. References ConvertDisplayToImageCoordinate(), height, origImageSize, scaledImage, and width. Referenced by ConvertDisplayToImageCoordinate(), mouseMoveEvent(), mousePressEvent(), and mouseReleaseEvent().
|
|
converts a point from original image coordinates to display coordinates
Definition at line 900 of file selectionInterface.cpp. References ConvertImageToDisplayCoordinate(), height, origImageSize, scaledImage, and width. Referenced by ConvertImageToDisplayCoordinate(), enterDrawLineMode(), keyPressEvent(), keyReleaseEvent(), mouseActionByPosition(), mouseMoveEvent(), mouseReleaseEvent(), and paintEvent().
|
|
crops a selected point to within the photo
Definition at line 926 of file selectionInterface.cpp. References cropSelectedPoint(), height, scaledImage, and width. Referenced by cropSelectedPoint(), and mouseMoveEvent().
|
|
emitted when a user CTRL-clicks a selection indicating the selection needs to be rotated intelligently
Referenced by mousePressEvent(). |
|
enter draw line mode - used for tilt correction
Definition at line 1182 of file selectionInterface.cpp. References cachedMousePosition, ConvertImageToDisplayCoordinate(), CTRL_Pressed, currentDragMode, DRAW_LINE, mouseDragPoint, mousePressPoint, SHIFT_Pressed, and updateCursorShape(). Referenced by EditingInterface::startCorrectTilt().
|
|
returns the current photo display size (in screen pixels)
Definition at line 1010 of file selectionInterface.cpp. References getDisplaySize(), height, scaledImage, and width. Referenced by EditingInterface::applyImageUpdate(), getDisplaySize(), EditingInterface::revertCurrentPhoto(), EditingInterface::rotateFlip(), EditingInterface::setPhoto(), and EditingInterface::showNextPrevFirstLastPhoto().
|
|
Returns the current selected coordinates (actual slideshow image space, aka not including buffered whitespace or widget offsets).
Definition at line 993 of file selectionInterface.cpp. References bottomRight, getSelection(), mouseDragPoint, mousePressPoint, and topLeft. Referenced by EditingInterface::findSelection(), getSelection(), EditingInterface::rotateSelection(), and EditingInterface::selectAspectRatio().
|
|
Definition at line 1016 of file selectionInterface.cpp. References bottomRight, cachedMousePosition, cachedSelctionCenter, ConvertImageToDisplayCoordinate(), CTRL_Pressed, currentDragMode, DRAW_LINE, keyPressEvent(), lineSelected(), mouseDragPoint, mousePressPoint, NO_EFFECT, origImageSize, scaledImage, scaleSelection(), selectionChanged(), selectionEmpty(), selectNone(), SHIFT_Pressed, topLeft, and updateCursorShape(). Referenced by keyPressEvent().
|
|
Definition at line 1162 of file selectionInterface.cpp. References cachedMousePosition, ConvertImageToDisplayCoordinate(), CTRL_Pressed, keyReleaseEvent(), SHIFT_Pressed, and updateCursorShape(). Referenced by keyReleaseEvent().
|
|
emitted once line has been selected, on or the other points will be set to -1,-1 if the user escaped out the selected a line
Referenced by keyPressEvent(), and mouseReleaseEvent(). |
|
determine action based on mouse position
Definition at line 351 of file selectionInterface.cpp. References bottomRight, ConvertImageToDisplayCoordinate(), DRAG_MODE, DRAG_THRESHOLD, DRAW_SELECTION, height, mouseActionByPosition(), mouseDragPoint, mousePressPoint, MOVE_BOTTOM_LEFT_CORNER, MOVE_BOTTOM_RIGHT_CORNER, MOVE_BOTTOM_SIDE, MOVE_LEFT_SIDE, MOVE_RIGHT_SIDE, MOVE_SELECTION, MOVE_THRESHOLD, MOVE_TOP_LEFT_CORNER, MOVE_TOP_RIGHT_CORNER, MOVE_TOP_SIDE, NO_EFFECT, origImageSize, SCALE_SELECTION, scaledImage, SHIFT_Pressed, topLeft, and width. Referenced by mouseActionByPosition(), mouseMoveEvent(), mousePressEvent(), and updateCursorShape().
|
|
Definition at line 651 of file selectionInterface.cpp. References aspectRatioChanged(), bottomRight, cachedMousePosition, cachedSelctionCenter, cachedSelectionSize, ConvertDisplayToImageCoordinate(), ConvertImageToDisplayCoordinate(), cropMaxDimen, cropSelectedPoint(), CTRL_Pressed, currentDragMode, currentMouseShape, DRAW_LINE, DRAW_SELECTION, mouseActionByPosition(), mouseDragPoint, mouseMoveEvent(), mousePressPoint, MOVE_BOTTOM_LEFT_CORNER, MOVE_BOTTOM_RIGHT_CORNER, MOVE_BOTTOM_SIDE, MOVE_LEFT_SIDE, MOVE_RIGHT_SIDE, MOVE_SELECTION, MOVE_TOP_LEFT_CORNER, MOVE_TOP_RIGHT_CORNER, MOVE_TOP_SIDE, NO_EFFECT, origImageSize, scaleSelection(), selectionChanged(), SHIFT_Pressed, topLeft, and updateCursorShape(). Referenced by mouseMoveEvent().
|
|
Definition at line 436 of file selectionInterface.cpp. References aspectRatioChanged(), bottomRight, ConvertDisplayToImageCoordinate(), cropMaxDimen, CTRL_Pressed, ctrlClick(), currentDragMode, DRAW_LINE, DRAW_SELECTION, mouseActionByPosition(), mouseDragPoint, mousePressEvent(), mousePressPoint, MOVE_BOTTOM_LEFT_CORNER, MOVE_BOTTOM_RIGHT_CORNER, MOVE_BOTTOM_SIDE, MOVE_LEFT_SIDE, MOVE_RIGHT_SIDE, MOVE_SELECTION, MOVE_TOP_LEFT_CORNER, MOVE_TOP_RIGHT_CORNER, MOVE_TOP_SIDE, selectionChanged(), and topLeft. Referenced by mousePressEvent().
|
|
Definition at line 824 of file selectionInterface.cpp. References bottomRight, cachedMousePosition, ConvertDisplayToImageCoordinate(), ConvertImageToDisplayCoordinate(), currentDragMode, DRAW_LINE, lineSelected(), MINIMUM_SELECTION_SIZE, mouseDragPoint, mousePressPoint, mouseReleaseEvent(), NO_EFFECT, selectNone(), topLeft, and updateCursorShape(). Referenced by mouseReleaseEvent().
|
|
Definition at line 161 of file selectionInterface.cpp. References bottomRight, buffer, ConvertImageToDisplayCoordinate(), cropMaxDimen, currentDragMode, DRAW_LINE, height, mouseDragPoint, mousePressPoint, NO_EFFECT, paintEvent(), scaledImage, TEXT_MARGIN, topLeft, unselectedScaledImage, and width. Referenced by paintEvent().
|
|
Definition at line 108 of file selectionInterface.cpp. References constructDisplayImages(), fullScreenImage, and resizeEvent(). Referenced by resizeEvent().
|
|
increase/decrease selection while maintaining aspect ratio by changing selected width by delta
Definition at line 565 of file selectionInterface.cpp. References bottomRight, cachedSelctionCenter, cachedSelectionSize, mouseDragPoint, mousePressPoint, origImageSize, scaleSelection(), and topLeft. Referenced by keyPressEvent(), mouseMoveEvent(), and scaleSelection().
|
|
selects all of the image
Definition at line 946 of file selectionInterface.cpp. References aspectRatioChanged(), cachedSelctionCenter, cachedSelectionSize, cropMaxDimen, mouseDragPoint, mousePressPoint, origImageSize, and selectionChanged(). Referenced by SelectionInterface().
|
|
emitted when the user changed the selected region
Referenced by keyPressEvent(), mouseMoveEvent(), mousePressEvent(), selectAll(), selectNone(), setPhoto(), and setSelection(). |
|
returns true if selection is empty
Definition at line 937 of file selectionInterface.cpp. References mouseDragPoint, and mousePressPoint. Referenced by keyPressEvent().
|
|
selects none of the image
Definition at line 965 of file selectionInterface.cpp. References aspectRatioChanged(), cropMaxDimen, mouseDragPoint, mousePressPoint, and selectionChanged(). Referenced by EditingInterface::applyImageUpdate(), keyPressEvent(), mouseReleaseEvent(), and SelectionInterface().
|
|
Updates displayed photo.
Definition at line 75 of file selectionInterface.cpp. References constructDisplayImages(), cropMaxDimen, CTRL_Pressed, fullScreenImage, getImageSize(), mouseDragPoint, mousePressPoint, origImageFilename, origImageSize, scaleImage(), selectionChanged(), setPhoto(), and SHIFT_Pressed. Referenced by EditingInterface::applyImageUpdate(), EditingInterface::revertCurrentPhoto(), EditingInterface::rotateFlip(), setPhoto(), EditingInterface::setPhoto(), and EditingInterface::showNextPrevFirstLastPhoto().
|
|
Sets the current selection cropMaxDimen specifies the idealized dimension in dominant direction in inches (eg 7").
Definition at line 975 of file selectionInterface.cpp. References bottomRight, cachedSelctionCenter, cachedSelectionSize, mouseDragPoint, mousePressPoint, selectionChanged(), setSelection(), and topLeft. Referenced by EditingInterface::rotateSelection(), EditingInterface::selectAspectRatio(), setSelection(), and EditingInterface::showNextPrevFirstLastPhoto().
|
|
|
|
update mouse cursor based on position over widget and selected region
Definition at line 515 of file selectionInterface.cpp. References CROSS_CURSOR, CTRL_Pressed, currentDragMode, currentMouseShape, DRAW_LINE, DRAW_SELECTION, getCursor(), mouseActionByPosition(), MOVE_BOTTOM_LEFT_CORNER, MOVE_BOTTOM_RIGHT_CORNER, MOVE_BOTTOM_SIDE, MOVE_HOR_CURSOR, MOVE_LEFT_SIDE, MOVE_RIGHT_SIDE, MOVE_SELECTION, MOVE_SELECTION_CURSOR, MOVE_TL_CURSOR, MOVE_TOP_LEFT_CORNER, MOVE_TOP_RIGHT_CORNER, MOVE_TOP_SIDE, MOVE_TR_CURSOR, MOVE_VERT_CURSOR, ROTATE_CURSOR, SCALE_SELECTION_CURSOR, SHIFT_Pressed, TARGET_CURSOR, and updateCursorShape(). Referenced by enterDrawLineMode(), keyPressEvent(), keyReleaseEvent(), mouseMoveEvent(), mouseReleaseEvent(), and updateCursorShape().
|
|
cached mouse position, used to scale or drag around selection area
Definition at line 146 of file selectionInterface.h. Referenced by enterDrawLineMode(), keyPressEvent(), keyReleaseEvent(), mouseMoveEvent(), mouseReleaseEvent(), and SelectionInterface(). |
|
cache the aspect ratio when pressing the control buttion, this helps aleviate numerical error that builds up when scaling up and down selections
Definition at line 169 of file selectionInterface.h. Referenced by keyPressEvent(), mouseMoveEvent(), scaleSelection(), selectAll(), and setSelection(). |
|
Definition at line 170 of file selectionInterface.h. Referenced by mouseMoveEvent(), scaleSelection(), selectAll(), and setSelection(). |
|
Current crop max dimension (in inches).
Definition at line 173 of file selectionInterface.h. Referenced by mouseMoveEvent(), mousePressEvent(), paintEvent(), selectAll(), SelectionInterface(), selectNone(), and setPhoto(). |
|
state of CTRL button, effects if mouse clicks rotate current selection
Definition at line 165 of file selectionInterface.h. Referenced by enterDrawLineMode(), keyPressEvent(), keyReleaseEvent(), mouseMoveEvent(), mousePressEvent(), setPhoto(), and updateCursorShape(). |
|
method of dragging out, either new selection or resizing selection corner or side
Definition at line 149 of file selectionInterface.h. Referenced by enterDrawLineMode(), keyPressEvent(), mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), paintEvent(), SelectionInterface(), and updateCursorShape(). |
|
current mouse shape. by caching this value we avoid resetting the mouse cursor every time it moves etc. Definition at line 153 of file selectionInterface.h. Referenced by mouseMoveEvent(), SelectionInterface(), and updateCursorShape(). |
|
Full screen version of image.
Definition at line 131 of file selectionInterface.h. Referenced by constructDisplayImages(), resizeEvent(), and setPhoto(). |
|
second corner of selection, where mouse moved to
Definition at line 143 of file selectionInterface.h. Referenced by enterDrawLineMode(), getSelection(), keyPressEvent(), mouseActionByPosition(), mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), paintEvent(), scaleSelection(), selectAll(), selectionEmpty(), SelectionInterface(), selectNone(), setPhoto(), and setSelection(). |
|
first corner of selection, where mouse first clicked
Definition at line 140 of file selectionInterface.h. Referenced by enterDrawLineMode(), getSelection(), keyPressEvent(), mouseActionByPosition(), mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), paintEvent(), scaleSelection(), selectAll(), selectionEmpty(), SelectionInterface(), selectNone(), setPhoto(), and setSelection(). |
|
original image filename
Definition at line 156 of file selectionInterface.h. Referenced by setPhoto(). |
|
original image dimensions
Definition at line 159 of file selectionInterface.h. Referenced by ConvertDisplayToImageCoordinate(), ConvertImageToDisplayCoordinate(), keyPressEvent(), mouseActionByPosition(), mouseMoveEvent(), scaleSelection(), selectAll(), and setPhoto(). |
|
Scaled image used for display purposes.
Definition at line 134 of file selectionInterface.h. Referenced by constructDisplayImages(), ConvertDisplayToImageCoordinate(), ConvertImageToDisplayCoordinate(), cropSelectedPoint(), getDisplaySize(), keyPressEvent(), mouseActionByPosition(), and paintEvent(). |
|
state of SHIFT button, effects if mouse drags adjust or scale the current selection
Definition at line 162 of file selectionInterface.h. Referenced by enterDrawLineMode(), keyPressEvent(), keyReleaseEvent(), mouseActionByPosition(), mouseMoveEvent(), setPhoto(), and updateCursorShape(). |
|
Grayscale version of scaled image, used for drawing non-selected regions.
Definition at line 137 of file selectionInterface.h. Referenced by constructDisplayImages(), and paintEvent(). |