AlbumShaper  1.0a3
splitViewInterface.h
Go to the documentation of this file.
1 //==============================================
2 // copyright : (C) 2003-2005 by Will Stokes
3 //==============================================
4 // This program is free software; you can redistribute it
5 // and/or modify it under the terms of the GNU General
6 // Public License as published by the Free Software
7 // Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 //==============================================
10 
11 #ifndef GUI_EDITING_SPLITVIEWINTERFACE_H
12 #define GUI_EDITING_SPLITVIEWINTERFACE_H
13 
14 //--------------------
15 //forward declarations
16 //--------------------
17 
18 #include <qwidget.h>
19 #include <qimage.h>
20 //Added by qt3to4:
21 #include <QPaintEvent>
22 #include <QResizeEvent>
23 #include <QMouseEvent>
24 
26 typedef enum
27 {
32 } PREVIEW_MODE;
33 
35 typedef enum
36 {
40 
41 //=====================================
46 //=====================================
48 {
49 Q_OBJECT
50 
51 public:
53  SplitViewInterface(QWidget *parent=0,
54  const char* name=0);
55 
57  void setPreviewMode( PREVIEW_MODE mode, bool forceDrawLabel=false );
58 
59  virtual QSize sizeHint() const = 0;
60  virtual QSize minimumSizeHint() const;
61 
62  //sets both orig and adjusted images and repaints
63  void setImages( QImage origImage, QImage adjustedImage );
64 
66  void setAdjustedImage( QImage adjustedImage );
67 
69  QImage& getOrigImage();
70  //----------------------
71 protected:
72  void paintEvent( QPaintEvent *e);
73  void mousePressEvent( QMouseEvent *e);
74  void mouseReleaseEvent( QMouseEvent *);
75  void mouseMoveEvent( QMouseEvent *e);
76 
77  virtual void resizeEvent( QResizeEvent * ) = 0;
78  //----------------------
79 private:
81  double displayToWorld( int coordinate );
82 
84  int worldToDisplay( double coordinate );
85 
87  bool nearSplitPoint( QPoint p );
88 
91 
94 
96  QString originalString;
97  QString adjustedString;
98 
100  QFont textFont;
101 
103  double dragOffset;
104 
107 
111 
113  QImage origImage;
114 
117  //----------------------
118 };
119 //======================
120 
121 #endif //GUI_EDITING_SPLITVIEWINTERFACE_H
A split view interface provides a means to show before and after versions of an image while adjustmen...
PREVIEW_MOUSE_MODE mouseMode
current mouse move mode
int worldToDisplay(double coordinate)
convert world coordinates to display coordinates (int from 0 to origImage width-1)
virtual QSize minimumSizeHint() const
bool nearSplitPoint(QPoint p)
determines if mouse is near split point
QString originalString
Original and adjusted strings.
double displayToWorld(int coordinate)
convert display coordinates to world coordinates (double from 0.0 - 1.0)
void mousePressEvent(QMouseEvent *e)
bool forceDrawLabel
Draw original/adjusted lables outside of split view mode?
QImage adjustedImage
Scaled adjusted image.
void paintEvent(QPaintEvent *e)
double dragOffset
x (or y) coordinate of split between drawn adjusted and original images
QFont textFont
Larger font used for drawing text.
QImage & getOrigImage()
returns orig image object
void setImages(QImage origImage, QImage adjustedImage)
QImage origImage
Scaled original image.
virtual void resizeEvent(QResizeEvent *)=0
PREVIEW_MODE previewMode
Current display setting (adjusted or split screen)
SplitViewInterface(QWidget *parent=0, const char *name=0)
Creates layout.
virtual QSize sizeHint() const =0
void mouseReleaseEvent(QMouseEvent *)
void mouseMoveEvent(QMouseEvent *e)
void setAdjustedImage(QImage adjustedImage)
sets adjusted image and repaints
PREVIEW_MOUSE_MODE currentMouseShape
current mouse shape.
void setPreviewMode(PREVIEW_MODE mode, bool forceDrawLabel=false)
Sets preview mode.
PREVIEW_MOUSE_MODE
ceffect of mouse movement on split point
@ DRAG_SPLIT
@ NO_EFFECT_ON_SPLIT
PREVIEW_MODE
current preview mode
@ SPLIT_VIEW
@ ORIGINAL_IMAGE
@ ADJUSTED_IMAGE
@ INV_SPLIT_VIEW