Added intermediate base class for shape objects (box and ellipse).
This commit is contained in:
@@ -24,6 +24,7 @@ set (glabels_sources
|
|||||||
LabelModel.cpp
|
LabelModel.cpp
|
||||||
LabelModelObject.cpp
|
LabelModelObject.cpp
|
||||||
LabelModelBoxObject.cpp
|
LabelModelBoxObject.cpp
|
||||||
|
LabelModelShapeObject.cpp
|
||||||
LabelRegion.cpp
|
LabelRegion.cpp
|
||||||
MainWindow.cpp
|
MainWindow.cpp
|
||||||
MergeField.cpp
|
MergeField.cpp
|
||||||
@@ -53,6 +54,7 @@ set (glabels_qobject_headers
|
|||||||
LabelModel.h
|
LabelModel.h
|
||||||
LabelModelObject.h
|
LabelModelObject.h
|
||||||
LabelModelBoxObject.h
|
LabelModelBoxObject.h
|
||||||
|
LabelModelShapeObject.h
|
||||||
NewLabelDialog.h
|
NewLabelDialog.h
|
||||||
MainWindow.h
|
MainWindow.h
|
||||||
SimplePreview.h
|
SimplePreview.h
|
||||||
|
|||||||
@@ -30,18 +30,8 @@ namespace glabels
|
|||||||
///
|
///
|
||||||
/// Constructor
|
/// Constructor
|
||||||
///
|
///
|
||||||
LabelModelBoxObject::LabelModelBoxObject( QObject* parent ) : LabelModelObject(parent)
|
LabelModelBoxObject::LabelModelBoxObject( QObject* parent ) : LabelModelShapeObject(parent)
|
||||||
{
|
{
|
||||||
mHandles << new HandleNorthWest( this );
|
|
||||||
mHandles << new HandleNorth( this );
|
|
||||||
mHandles << new HandleNorthEast( this );
|
|
||||||
mHandles << new HandleEast( this );
|
|
||||||
mHandles << new HandleSouthEast( this );
|
|
||||||
mHandles << new HandleSouth( this );
|
|
||||||
mHandles << new HandleSouthWest( this );
|
|
||||||
mHandles << new HandleWest( this );
|
|
||||||
|
|
||||||
/* TODO: initialize default line and fill poperties. */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -50,104 +40,6 @@ namespace glabels
|
|||||||
///
|
///
|
||||||
LabelModelBoxObject::~LabelModelBoxObject()
|
LabelModelBoxObject::~LabelModelBoxObject()
|
||||||
{
|
{
|
||||||
foreach( Handle* handle, mHandles )
|
|
||||||
{
|
|
||||||
delete handle;
|
|
||||||
}
|
|
||||||
mHandles.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
/// Line Width Property Getter
|
|
||||||
///
|
|
||||||
double LabelModelBoxObject::lineWidth( void ) const
|
|
||||||
{
|
|
||||||
return mLineWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
/// Line Width Property Setter
|
|
||||||
///
|
|
||||||
void LabelModelBoxObject::setLineWidth( double value )
|
|
||||||
{
|
|
||||||
if ( mLineWidth != value )
|
|
||||||
{
|
|
||||||
mLineWidth = value;
|
|
||||||
emit changed();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
/// Line Color Node Property Getter
|
|
||||||
///
|
|
||||||
ColorNode LabelModelBoxObject::lineColorNode( void ) const
|
|
||||||
{
|
|
||||||
return mLineColorNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
/// Line Color Node Property Setter
|
|
||||||
///
|
|
||||||
void LabelModelBoxObject::setLineColorNode( const ColorNode& value )
|
|
||||||
{
|
|
||||||
if ( mLineColorNode != value )
|
|
||||||
{
|
|
||||||
mLineColorNode = value;
|
|
||||||
emit changed();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
/// Fill Color Node Property Getter
|
|
||||||
///
|
|
||||||
ColorNode LabelModelBoxObject::fillColorNode( void ) const
|
|
||||||
{
|
|
||||||
return mFillColorNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
/// Fill Color Node Property Setter
|
|
||||||
///
|
|
||||||
void LabelModelBoxObject::setFillColorNode( const ColorNode& value )
|
|
||||||
{
|
|
||||||
if ( mFillColorNode != value )
|
|
||||||
{
|
|
||||||
mFillColorNode = value;
|
|
||||||
emit changed();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
/// Can Fill Capability Implementation
|
|
||||||
///
|
|
||||||
bool LabelModelBoxObject::canFill()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
/// Can Line Color Capability Implementation
|
|
||||||
///
|
|
||||||
bool LabelModelBoxObject::canLineColor()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
/// Can Line Width Capability Implementation
|
|
||||||
///
|
|
||||||
bool LabelModelBoxObject::canLineWidth()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,8 @@
|
|||||||
#ifndef glabels_LabelModelBoxObject_h
|
#ifndef glabels_LabelModelBoxObject_h
|
||||||
#define glabels_LabelModelBoxObject_h
|
#define glabels_LabelModelBoxObject_h
|
||||||
|
|
||||||
#include "LabelModelObject.h"
|
|
||||||
|
#include "LabelModelShapeObject.h"
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
namespace glabels
|
||||||
@@ -30,7 +31,7 @@ namespace glabels
|
|||||||
///
|
///
|
||||||
/// Label Model Box Object
|
/// Label Model Box Object
|
||||||
///
|
///
|
||||||
class LabelModelBoxObject : public LabelModelObject
|
class LabelModelBoxObject : public LabelModelShapeObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@@ -42,40 +43,6 @@ namespace glabels
|
|||||||
virtual ~LabelModelBoxObject();
|
virtual ~LabelModelBoxObject();
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////
|
|
||||||
// Property Implementations
|
|
||||||
///////////////////////////////////////////////////////////////
|
|
||||||
public:
|
|
||||||
//
|
|
||||||
// Shape Property: lineWidth
|
|
||||||
//
|
|
||||||
virtual double lineWidth( void ) const;
|
|
||||||
virtual void setLineWidth( double value );
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// Shape Property: lineColorNode
|
|
||||||
//
|
|
||||||
virtual ColorNode lineColorNode( void ) const;
|
|
||||||
virtual void setLineColorNode( const ColorNode& value );
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// Shape Property: fillColorNode
|
|
||||||
//
|
|
||||||
virtual ColorNode fillColorNode( void ) const;
|
|
||||||
virtual void setFillColorNode( const ColorNode& value );
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////
|
|
||||||
// Capability Implementations
|
|
||||||
///////////////////////////////////////////////////////////////
|
|
||||||
public:
|
|
||||||
virtual bool canFill();
|
|
||||||
virtual bool canLineColor();
|
|
||||||
virtual bool canLineWidth();
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
// Drawing operations
|
// Drawing operations
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
@@ -83,15 +50,6 @@ namespace glabels
|
|||||||
virtual void drawShadow( QPainter* painter, bool inEditor, MergeRecord* record ) const;
|
virtual void drawShadow( QPainter* painter, bool inEditor, MergeRecord* record ) const;
|
||||||
virtual void drawObject( QPainter* painter, bool inEditor, MergeRecord* record ) const;
|
virtual void drawObject( QPainter* painter, bool inEditor, MergeRecord* record ) const;
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////
|
|
||||||
// Private Members
|
|
||||||
///////////////////////////////////////////////////////////////
|
|
||||||
private:
|
|
||||||
double mLineWidth;
|
|
||||||
ColorNode mLineColorNode;
|
|
||||||
ColorNode mFillColorNode;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,154 @@
|
|||||||
|
/* LabelModelShapeObject.cpp
|
||||||
|
*
|
||||||
|
* Copyright (C) 2013 Jim Evins <evins@snaught.com>
|
||||||
|
*
|
||||||
|
* This file is part of gLabels-qt.
|
||||||
|
*
|
||||||
|
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* gLabels-qt is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "LabelModelShapeObject.h"
|
||||||
|
|
||||||
|
#include <QBrush>
|
||||||
|
#include <QPen>
|
||||||
|
|
||||||
|
|
||||||
|
namespace glabels
|
||||||
|
{
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Constructor
|
||||||
|
///
|
||||||
|
LabelModelShapeObject::LabelModelShapeObject( QObject* parent ) : LabelModelObject(parent)
|
||||||
|
{
|
||||||
|
mHandles << new HandleNorthWest( this );
|
||||||
|
mHandles << new HandleNorth( this );
|
||||||
|
mHandles << new HandleNorthEast( this );
|
||||||
|
mHandles << new HandleEast( this );
|
||||||
|
mHandles << new HandleSouthEast( this );
|
||||||
|
mHandles << new HandleSouth( this );
|
||||||
|
mHandles << new HandleSouthWest( this );
|
||||||
|
mHandles << new HandleWest( this );
|
||||||
|
|
||||||
|
/* TODO: initialize default line and fill poperties. */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Destructor
|
||||||
|
///
|
||||||
|
LabelModelShapeObject::~LabelModelShapeObject()
|
||||||
|
{
|
||||||
|
foreach( Handle* handle, mHandles )
|
||||||
|
{
|
||||||
|
delete handle;
|
||||||
|
}
|
||||||
|
mHandles.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Line Width Property Getter
|
||||||
|
///
|
||||||
|
double LabelModelShapeObject::lineWidth( void ) const
|
||||||
|
{
|
||||||
|
return mLineWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Line Width Property Setter
|
||||||
|
///
|
||||||
|
void LabelModelShapeObject::setLineWidth( double value )
|
||||||
|
{
|
||||||
|
if ( mLineWidth != value )
|
||||||
|
{
|
||||||
|
mLineWidth = value;
|
||||||
|
emit changed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Line Color Node Property Getter
|
||||||
|
///
|
||||||
|
ColorNode LabelModelShapeObject::lineColorNode( void ) const
|
||||||
|
{
|
||||||
|
return mLineColorNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Line Color Node Property Setter
|
||||||
|
///
|
||||||
|
void LabelModelShapeObject::setLineColorNode( const ColorNode& value )
|
||||||
|
{
|
||||||
|
if ( mLineColorNode != value )
|
||||||
|
{
|
||||||
|
mLineColorNode = value;
|
||||||
|
emit changed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Fill Color Node Property Getter
|
||||||
|
///
|
||||||
|
ColorNode LabelModelShapeObject::fillColorNode( void ) const
|
||||||
|
{
|
||||||
|
return mFillColorNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Fill Color Node Property Setter
|
||||||
|
///
|
||||||
|
void LabelModelShapeObject::setFillColorNode( const ColorNode& value )
|
||||||
|
{
|
||||||
|
if ( mFillColorNode != value )
|
||||||
|
{
|
||||||
|
mFillColorNode = value;
|
||||||
|
emit changed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Can Fill Capability Implementation
|
||||||
|
///
|
||||||
|
bool LabelModelShapeObject::canFill()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Can Line Color Capability Implementation
|
||||||
|
///
|
||||||
|
bool LabelModelShapeObject::canLineColor()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Can Line Width Capability Implementation
|
||||||
|
///
|
||||||
|
bool LabelModelShapeObject::canLineWidth()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
/* LabelModelShapeObject.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 2013 Jim Evins <evins@snaught.com>
|
||||||
|
*
|
||||||
|
* This file is part of gLabels-qt.
|
||||||
|
*
|
||||||
|
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* gLabels-qt is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef glabels_LabelModelShapeObject_h
|
||||||
|
#define glabels_LabelModelShapeObject_h
|
||||||
|
|
||||||
|
#include "LabelModelObject.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace glabels
|
||||||
|
{
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Label Model Shape Object (Box or Ellipse)
|
||||||
|
///
|
||||||
|
class LabelModelShapeObject : public LabelModelObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////
|
||||||
|
// Lifecycle Methods
|
||||||
|
///////////////////////////////////////////////////////////////
|
||||||
|
protected:
|
||||||
|
LabelModelShapeObject( QObject* parent = 0 );
|
||||||
|
public:
|
||||||
|
virtual ~LabelModelShapeObject();
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////
|
||||||
|
// Property Implementations
|
||||||
|
///////////////////////////////////////////////////////////////
|
||||||
|
public:
|
||||||
|
//
|
||||||
|
// Shape Property: lineWidth
|
||||||
|
//
|
||||||
|
virtual double lineWidth( void ) const;
|
||||||
|
virtual void setLineWidth( double value );
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Shape Property: lineColorNode
|
||||||
|
//
|
||||||
|
virtual ColorNode lineColorNode( void ) const;
|
||||||
|
virtual void setLineColorNode( const ColorNode& value );
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Shape Property: fillColorNode
|
||||||
|
//
|
||||||
|
virtual ColorNode fillColorNode( void ) const;
|
||||||
|
virtual void setFillColorNode( const ColorNode& value );
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////
|
||||||
|
// Capability Implementations
|
||||||
|
///////////////////////////////////////////////////////////////
|
||||||
|
public:
|
||||||
|
virtual bool canFill();
|
||||||
|
virtual bool canLineColor();
|
||||||
|
virtual bool canLineWidth();
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////
|
||||||
|
// Private Members
|
||||||
|
///////////////////////////////////////////////////////////////
|
||||||
|
protected:
|
||||||
|
double mLineWidth;
|
||||||
|
ColorNode mLineColorNode;
|
||||||
|
ColorNode mFillColorNode;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // glabels_LabelModelShapeObject_h
|
||||||
Reference in New Issue
Block a user