Some namespace cleanup.
This commit is contained in:
+156
-162
@@ -18,8 +18,8 @@
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef glabels_View_h
|
||||
#define glabels_View_h
|
||||
#ifndef View_h
|
||||
#define View_h
|
||||
|
||||
#include <QWidget>
|
||||
#include <QScrollArea>
|
||||
@@ -28,190 +28,184 @@
|
||||
#include "LabelRegion.h"
|
||||
|
||||
|
||||
namespace glabels
|
||||
// Forward References
|
||||
class LabelModel;
|
||||
class LabelModelObject;
|
||||
class Handle;
|
||||
|
||||
|
||||
///
|
||||
/// View Widget
|
||||
///
|
||||
class View : public QWidget
|
||||
{
|
||||
// Forward References
|
||||
class LabelModel;
|
||||
class LabelModelObject;
|
||||
class Handle;
|
||||
Q_OBJECT
|
||||
|
||||
/////////////////////////////////////
|
||||
// Lifecycle
|
||||
/////////////////////////////////////
|
||||
public:
|
||||
View( QScrollArea* scrollArea, QWidget* parent = 0 );
|
||||
|
||||
|
||||
///
|
||||
/// View Widget
|
||||
///
|
||||
class View : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
/////////////////////////////////////
|
||||
// Lifecycle
|
||||
/////////////////////////////////////
|
||||
public:
|
||||
View( QScrollArea* scrollArea, QWidget* parent = 0 );
|
||||
/////////////////////////////////////
|
||||
// Signals
|
||||
/////////////////////////////////////
|
||||
signals:
|
||||
void contextMenuActivate();
|
||||
void zoomChanged();
|
||||
void pointerMoved( const glabels::Distance& x, const glabels::Distance& y );
|
||||
void pointerExited();
|
||||
void modeChanged();
|
||||
|
||||
|
||||
/////////////////////////////////////
|
||||
// Signals
|
||||
/////////////////////////////////////
|
||||
signals:
|
||||
void contextMenuActivate();
|
||||
void zoomChanged();
|
||||
void pointerMoved( const libglabels::Distance& x, const libglabels::Distance& y );
|
||||
void pointerExited();
|
||||
void modeChanged();
|
||||
/////////////////////////////////////
|
||||
// Parameters
|
||||
/////////////////////////////////////
|
||||
public:
|
||||
double zoom() const;
|
||||
bool markupVisible() const;
|
||||
bool qridVisible() const;
|
||||
|
||||
|
||||
/////////////////////////////////////
|
||||
// Parameters
|
||||
/////////////////////////////////////
|
||||
public:
|
||||
double zoom() const;
|
||||
bool markupVisible() const;
|
||||
bool qridVisible() const;
|
||||
/////////////////////////////////////
|
||||
// Model
|
||||
/////////////////////////////////////
|
||||
public:
|
||||
void setModel( LabelModel* model );
|
||||
|
||||
|
||||
/////////////////////////////////////
|
||||
// Model
|
||||
/////////////////////////////////////
|
||||
public:
|
||||
void setModel( LabelModel* model );
|
||||
/////////////////////////////////////
|
||||
// Visibility operations
|
||||
/////////////////////////////////////
|
||||
public:
|
||||
void setGridVisible( bool visibleFlag );
|
||||
void setMarkupVisible( bool visibleFlag );
|
||||
|
||||
|
||||
/////////////////////////////////////
|
||||
// Visibility operations
|
||||
/////////////////////////////////////
|
||||
public:
|
||||
void setGridVisible( bool visibleFlag );
|
||||
void setMarkupVisible( bool visibleFlag );
|
||||
/////////////////////////////////////
|
||||
// Zoom operations
|
||||
/////////////////////////////////////
|
||||
public:
|
||||
void zoomIn();
|
||||
void zoomOut();
|
||||
void zoom1To1();
|
||||
void zoomToFit();
|
||||
bool isZoomMax() const;
|
||||
bool isZoomMin() const;
|
||||
private:
|
||||
void setZoomReal( double zoom, bool zoomToFitFlag );
|
||||
|
||||
|
||||
/////////////////////////////////////
|
||||
// Zoom operations
|
||||
/////////////////////////////////////
|
||||
public:
|
||||
void zoomIn();
|
||||
void zoomOut();
|
||||
void zoom1To1();
|
||||
void zoomToFit();
|
||||
bool isZoomMax() const;
|
||||
bool isZoomMin() const;
|
||||
private:
|
||||
void setZoomReal( double zoom, bool zoomToFitFlag );
|
||||
/////////////////////////////////////
|
||||
// Mode operations
|
||||
/////////////////////////////////////
|
||||
public:
|
||||
void arrowMode();
|
||||
void createBoxMode();
|
||||
void createEllipseMode();
|
||||
void createLineMode();
|
||||
void createImageMode();
|
||||
void createTextMode();
|
||||
void createBarcodeMode();
|
||||
|
||||
|
||||
/////////////////////////////////////
|
||||
// Mode operations
|
||||
/////////////////////////////////////
|
||||
public:
|
||||
void arrowMode();
|
||||
void createBoxMode();
|
||||
void createEllipseMode();
|
||||
void createLineMode();
|
||||
void createImageMode();
|
||||
void createTextMode();
|
||||
void createBarcodeMode();
|
||||
/////////////////////////////////////
|
||||
// Event handlers
|
||||
/////////////////////////////////////
|
||||
protected:
|
||||
void resizeEvent( QResizeEvent* event );
|
||||
void mousePressEvent( QMouseEvent* event );
|
||||
void mouseMoveEvent( QMouseEvent* event );
|
||||
void mouseReleaseEvent( QMouseEvent* event );
|
||||
void leaveEvent( QEvent* event );
|
||||
void paintEvent( QPaintEvent* event );
|
||||
|
||||
|
||||
/////////////////////////////////////
|
||||
// Event handlers
|
||||
/////////////////////////////////////
|
||||
protected:
|
||||
void resizeEvent( QResizeEvent* event );
|
||||
void mousePressEvent( QMouseEvent* event );
|
||||
void mouseMoveEvent( QMouseEvent* event );
|
||||
void mouseReleaseEvent( QMouseEvent* event );
|
||||
void leaveEvent( QEvent* event );
|
||||
void paintEvent( QPaintEvent* event );
|
||||
/////////////////////////////////////
|
||||
// Private methods
|
||||
/////////////////////////////////////
|
||||
private:
|
||||
void handleResizeMotion( const glabels::Distance& xWorld,
|
||||
const glabels::Distance& yWorld );
|
||||
|
||||
void drawBgLayer( QPainter* painter );
|
||||
void drawGridLayer( QPainter* painter );
|
||||
void drawMarkupLayer( QPainter* painter );
|
||||
void drawObjectsLayer( QPainter* painter );
|
||||
void drawFgLayer( QPainter* painter );
|
||||
void drawHighlightLayer( QPainter* painter );
|
||||
void drawSelectRegionLayer( QPainter* painter );
|
||||
|
||||
|
||||
/////////////////////////////////////
|
||||
// Private methods
|
||||
/////////////////////////////////////
|
||||
private:
|
||||
void handleResizeMotion( const libglabels::Distance& xWorld,
|
||||
const libglabels::Distance& yWorld );
|
||||
|
||||
void drawBgLayer( QPainter* painter );
|
||||
void drawGridLayer( QPainter* painter );
|
||||
void drawMarkupLayer( QPainter* painter );
|
||||
void drawObjectsLayer( QPainter* painter );
|
||||
void drawFgLayer( QPainter* painter );
|
||||
void drawHighlightLayer( QPainter* painter );
|
||||
void drawSelectRegionLayer( QPainter* painter );
|
||||
|
||||
|
||||
/////////////////////////////////////
|
||||
// Private slots
|
||||
/////////////////////////////////////
|
||||
private:
|
||||
void onModelChanged();
|
||||
void onModelSizeChanged();
|
||||
|
||||
|
||||
/////////////////////////////////////
|
||||
// Private data
|
||||
/////////////////////////////////////
|
||||
private:
|
||||
enum State {
|
||||
IdleState,
|
||||
ArrowSelectRegion,
|
||||
ArrowMove,
|
||||
ArrowResize,
|
||||
CreateIdle,
|
||||
CreateDrag
|
||||
};
|
||||
|
||||
enum CreateType {
|
||||
Box,
|
||||
Ellipse,
|
||||
Line,
|
||||
Image,
|
||||
Text,
|
||||
Barcode
|
||||
};
|
||||
|
||||
QScrollArea* mScrollArea;
|
||||
|
||||
double mZoom;
|
||||
bool mZoomToFitFlag;
|
||||
double mScale;
|
||||
libglabels::Distance mX0;
|
||||
libglabels::Distance mY0;
|
||||
|
||||
bool mMarkupVisible;
|
||||
bool mGridVisible;
|
||||
|
||||
double mGridSpacing;
|
||||
|
||||
LabelModel* mModel;
|
||||
|
||||
State mState;
|
||||
|
||||
/* ArrowSelectRegion state */
|
||||
bool mSelectRegionVisible;
|
||||
LabelRegion mSelectRegion;
|
||||
|
||||
/* ArrowMove state */
|
||||
libglabels::Distance mMoveLastX;
|
||||
libglabels::Distance mMoveLastY;
|
||||
|
||||
/* ArrowResize state */
|
||||
LabelModelObject* mResizeObject;
|
||||
Handle* mResizeHandle;
|
||||
bool mResizeHonorAspect;
|
||||
|
||||
/* CreateDrag state */
|
||||
CreateType mCreateObjectType;
|
||||
LabelModelObject* mCreateObject;
|
||||
libglabels::Distance mCreateX0;
|
||||
libglabels::Distance mCreateY0;
|
||||
/////////////////////////////////////
|
||||
// Private slots
|
||||
/////////////////////////////////////
|
||||
private slots:
|
||||
void onModelChanged();
|
||||
void onModelSizeChanged();
|
||||
|
||||
|
||||
/////////////////////////////////////
|
||||
// Private data
|
||||
/////////////////////////////////////
|
||||
private:
|
||||
enum State {
|
||||
IdleState,
|
||||
ArrowSelectRegion,
|
||||
ArrowMove,
|
||||
ArrowResize,
|
||||
CreateIdle,
|
||||
CreateDrag
|
||||
};
|
||||
|
||||
enum CreateType {
|
||||
Box,
|
||||
Ellipse,
|
||||
Line,
|
||||
Image,
|
||||
Text,
|
||||
Barcode
|
||||
};
|
||||
|
||||
}
|
||||
QScrollArea* mScrollArea;
|
||||
|
||||
double mZoom;
|
||||
bool mZoomToFitFlag;
|
||||
double mScale;
|
||||
glabels::Distance mX0;
|
||||
glabels::Distance mY0;
|
||||
|
||||
bool mMarkupVisible;
|
||||
bool mGridVisible;
|
||||
|
||||
double mGridSpacing;
|
||||
|
||||
LabelModel* mModel;
|
||||
|
||||
State mState;
|
||||
|
||||
/* ArrowSelectRegion state */
|
||||
bool mSelectRegionVisible;
|
||||
LabelRegion mSelectRegion;
|
||||
|
||||
/* ArrowMove state */
|
||||
glabels::Distance mMoveLastX;
|
||||
glabels::Distance mMoveLastY;
|
||||
|
||||
/* ArrowResize state */
|
||||
LabelModelObject* mResizeObject;
|
||||
Handle* mResizeHandle;
|
||||
bool mResizeHonorAspect;
|
||||
|
||||
/* CreateDrag state */
|
||||
CreateType mCreateObjectType;
|
||||
LabelModelObject* mCreateObject;
|
||||
glabels::Distance mCreateX0;
|
||||
glabels::Distance mCreateY0;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // glabels_View_h
|
||||
|
||||
#endif // View_h
|
||||
|
||||
Reference in New Issue
Block a user