Some style cleanup.
This commit is contained in:
@@ -19,3 +19,113 @@
|
||||
*/
|
||||
|
||||
#include "BarcodeStyle.h"
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
|
||||
|
||||
BarcodeStyle::BarcodeStyle ()
|
||||
: mId( "" ),
|
||||
mName( "" ),
|
||||
mCanText( false ),
|
||||
mTextOptional( false ),
|
||||
mCanChecksum( false ),
|
||||
mChecksumOptional( false ),
|
||||
mDefaultDigits( "" ),
|
||||
mCanFreeform( false ),
|
||||
mPreferedN( 0 )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BarcodeStyle::BarcodeStyle ( const QString& id,
|
||||
const QString& name,
|
||||
bool canText,
|
||||
bool textOptional,
|
||||
bool canChecksum,
|
||||
bool checksumOptional,
|
||||
const QString& defaultDigits,
|
||||
bool canFreeform,
|
||||
int preferedN )
|
||||
: mId( id ),
|
||||
mName( name ),
|
||||
mCanText( canText ),
|
||||
mTextOptional( textOptional ),
|
||||
mCanChecksum( canChecksum ),
|
||||
mChecksumOptional( checksumOptional ),
|
||||
mDefaultDigits( defaultDigits ),
|
||||
mCanFreeform( canFreeform ),
|
||||
mPreferedN( preferedN )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
const QString& BarcodeStyle::id() const
|
||||
{
|
||||
return mId;
|
||||
}
|
||||
|
||||
|
||||
const QString& BarcodeStyle::name() const
|
||||
{
|
||||
return mName;
|
||||
}
|
||||
|
||||
|
||||
bool BarcodeStyle::canText() const
|
||||
{
|
||||
return mCanText;
|
||||
}
|
||||
|
||||
|
||||
bool BarcodeStyle::textOptional() const
|
||||
{
|
||||
return mTextOptional;
|
||||
}
|
||||
|
||||
|
||||
bool BarcodeStyle::canChecksum() const
|
||||
{
|
||||
return mCanChecksum;
|
||||
}
|
||||
|
||||
|
||||
bool BarcodeStyle::checksumOptional() const
|
||||
{
|
||||
return mChecksumOptional;
|
||||
}
|
||||
|
||||
|
||||
const QString& BarcodeStyle::defaultDigits() const
|
||||
{
|
||||
return mDefaultDigits;
|
||||
}
|
||||
|
||||
|
||||
bool BarcodeStyle::canFreeform() const
|
||||
{
|
||||
return mCanFreeform;
|
||||
}
|
||||
|
||||
|
||||
int BarcodeStyle::preferedN() const
|
||||
{
|
||||
return mPreferedN;
|
||||
}
|
||||
|
||||
|
||||
QString BarcodeStyle::exampleDigits( int n ) const
|
||||
{
|
||||
if ( mCanFreeform )
|
||||
{
|
||||
return QString( std::max( n, 1 ), QChar('0') );
|
||||
}
|
||||
else
|
||||
{
|
||||
return mDefaultDigits;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
+38
-70
@@ -31,83 +31,51 @@ namespace glabels
|
||||
{
|
||||
|
||||
public:
|
||||
BarcodeStyle ()
|
||||
: m_id( "" ),
|
||||
m_name( "" ),
|
||||
m_can_text( false ),
|
||||
m_text_optional( false ),
|
||||
m_can_checksum( false ),
|
||||
m_checksum_optional( false ),
|
||||
m_default_digits( "" ),
|
||||
m_can_freeform( false ),
|
||||
m_prefered_n( 0 )
|
||||
{
|
||||
}
|
||||
BarcodeStyle ();
|
||||
|
||||
BarcodeStyle ( const QString& id,
|
||||
const QString& name,
|
||||
bool canText,
|
||||
bool textOptional,
|
||||
bool canChecksum,
|
||||
bool checksumOptional,
|
||||
const QString& defaultDigits,
|
||||
bool canFreeform,
|
||||
int preferedN );
|
||||
|
||||
|
||||
BarcodeStyle ( const QString &id,
|
||||
const QString &name,
|
||||
bool can_text,
|
||||
bool text_optional,
|
||||
bool can_checksum,
|
||||
bool checksum_optional,
|
||||
const QString &default_digits,
|
||||
bool can_freeform,
|
||||
int prefered_n )
|
||||
: m_id( id ),
|
||||
m_name( name ),
|
||||
m_can_text( can_text ),
|
||||
m_text_optional( text_optional ),
|
||||
m_can_checksum( can_checksum ),
|
||||
m_checksum_optional( checksum_optional ),
|
||||
m_default_digits( default_digits ),
|
||||
m_can_freeform( can_freeform ),
|
||||
m_prefered_n( prefered_n )
|
||||
{
|
||||
}
|
||||
const QString& id() const;
|
||||
|
||||
const QString& name() const;
|
||||
|
||||
bool canText() const;
|
||||
|
||||
bool textOptional() const;
|
||||
|
||||
bool canChecksum() const;
|
||||
|
||||
bool checksumOptional() const;
|
||||
|
||||
const QString& defaultDigits() const;
|
||||
|
||||
bool canFreeform() const;
|
||||
|
||||
int preferedN() const;
|
||||
|
||||
|
||||
QString id() { return m_id; }
|
||||
QString exampleDigits( int n ) const;
|
||||
|
||||
QString name() { return m_name; }
|
||||
|
||||
bool can_text() { return m_can_text; }
|
||||
|
||||
bool text_optional() { return m_text_optional; }
|
||||
|
||||
bool can_checksum() { return m_can_checksum; }
|
||||
|
||||
bool checksum_optional() { return m_checksum_optional; }
|
||||
|
||||
QString default_digits() { return m_default_digits; }
|
||||
|
||||
bool can_freeform() { return m_can_freeform; }
|
||||
|
||||
int prefered_n() { return m_prefered_n; }
|
||||
|
||||
|
||||
QString example_digits( int n )
|
||||
{
|
||||
if ( m_can_freeform )
|
||||
{
|
||||
return QString( std::max( n, 1 ), QChar('0') );
|
||||
}
|
||||
else
|
||||
{
|
||||
return m_default_digits;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
QString m_id;
|
||||
QString m_name;
|
||||
bool m_can_text;
|
||||
bool m_text_optional;
|
||||
bool m_can_checksum;
|
||||
bool m_checksum_optional;
|
||||
QString m_default_digits;
|
||||
bool m_can_freeform;
|
||||
int m_prefered_n;
|
||||
QString mId;
|
||||
QString mName;
|
||||
bool mCanText;
|
||||
bool mTextOptional;
|
||||
bool mCanChecksum;
|
||||
bool mChecksumOptional;
|
||||
QString mDefaultDigits;
|
||||
bool mCanFreeform;
|
||||
int mPreferedN;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -20,3 +20,105 @@
|
||||
|
||||
#include "ColorNode.h"
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
|
||||
ColorNode::ColorNode()
|
||||
: mFieldFlag(false), mColor(QColor::fromRgba(0x00000000)), mKey("")
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
ColorNode::ColorNode( bool fieldFlag, const QColor& color, const QString& key )
|
||||
: mFieldFlag(fieldFlag), mColor(color), mKey(key)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
ColorNode::ColorNode( const QColor& color )
|
||||
: mFieldFlag(false), mColor(color), mKey("")
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
ColorNode::ColorNode( const QString& key )
|
||||
: mFieldFlag(true), mColor(QColor::fromRgba(0x00000000)), mKey(key)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool ColorNode::operator==( const ColorNode& cn )
|
||||
{
|
||||
return ( (mFieldFlag == cn.mFieldFlag) &&
|
||||
(mColor == cn.mColor) &&
|
||||
(mKey == cn.mKey) );
|
||||
}
|
||||
|
||||
|
||||
bool ColorNode::operator!=( const ColorNode& cn )
|
||||
{
|
||||
return ( (mFieldFlag != cn.mFieldFlag) ||
|
||||
(mColor != cn.mColor) ||
|
||||
(mKey != cn.mKey) );
|
||||
}
|
||||
|
||||
|
||||
#if TODO
|
||||
QColor ColorNode::expand( MergeRecord? record )
|
||||
{
|
||||
if ( fieldFlag )
|
||||
{
|
||||
if ( record == null )
|
||||
{
|
||||
return QColor.fromRgba(0x00000000);
|
||||
}
|
||||
else
|
||||
{
|
||||
string? text = record.evalKey( key );
|
||||
if ( text != null )
|
||||
{
|
||||
Gdk.Color gdkColor = Gdk.Color();
|
||||
if ( Gdk.Color.parse( text, out gdkColor ) )
|
||||
{
|
||||
Color color = Color.from_gdkColor( gdkColor );
|
||||
return color;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Color.fromRgba(0x00000000);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return Color.fromRgba(0x00000000);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return color;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
bool ColorNode::fieldFlag( void ) const
|
||||
{
|
||||
return mFieldFlag;
|
||||
}
|
||||
|
||||
|
||||
const QColor& ColorNode::color( void ) const
|
||||
{
|
||||
return mColor;
|
||||
}
|
||||
|
||||
|
||||
const QString& ColorNode::key( void ) const
|
||||
{
|
||||
return mKey;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
+16
-84
@@ -32,107 +32,39 @@ namespace glabels
|
||||
{
|
||||
|
||||
public:
|
||||
ColorNode()
|
||||
: m_field_flag(false), m_color(QColor::fromRgba(0x00000000)), m_key("")
|
||||
{
|
||||
}
|
||||
ColorNode();
|
||||
|
||||
ColorNode( bool fieldFlag, const QColor& color, const QString& key );
|
||||
|
||||
ColorNode( bool field_flag, QColor &color, QString &key )
|
||||
: m_field_flag(field_flag), m_color(color), m_key(key)
|
||||
{
|
||||
}
|
||||
ColorNode( const QColor& color );
|
||||
|
||||
ColorNode( const QString& key );
|
||||
|
||||
ColorNode( const QColor &color )
|
||||
: m_field_flag(false), m_color(color), m_key("")
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
ColorNode( QString &key )
|
||||
: m_field_flag(true), m_color(QColor::fromRgba(0x00000000)), m_key(key)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool operator==( const ColorNode &cn )
|
||||
{
|
||||
return ( (m_field_flag == cn.m_field_flag) &&
|
||||
(m_color == cn.m_color) &&
|
||||
(m_key == cn.m_key) );
|
||||
}
|
||||
|
||||
|
||||
bool operator!=( const ColorNode &cn )
|
||||
{
|
||||
return ( (m_field_flag != cn.m_field_flag) ||
|
||||
(m_color != cn.m_color) ||
|
||||
(m_key != cn.m_key) );
|
||||
}
|
||||
bool operator==( const ColorNode& cn );
|
||||
|
||||
bool operator!=( const ColorNode& cn );
|
||||
|
||||
#if TODO
|
||||
QColor expand( MergeRecord? record )
|
||||
{
|
||||
if ( field_flag )
|
||||
{
|
||||
if ( record == null )
|
||||
{
|
||||
return QColor.fromRgba(0x00000000);
|
||||
}
|
||||
else
|
||||
{
|
||||
string? text = record.eval_key( key );
|
||||
if ( text != null )
|
||||
{
|
||||
Gdk.Color gdk_color = Gdk.Color();
|
||||
if ( Gdk.Color.parse( text, out gdk_color ) )
|
||||
{
|
||||
Color color = Color.from_gdk_color( gdk_color );
|
||||
return color;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Color.fromRgba(0x00000000);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return Color.fromRgba(0x00000000);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return color;
|
||||
}
|
||||
}
|
||||
QColor expand( MergeRecord? record );
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* field flag property
|
||||
*/
|
||||
bool field_flag( void ) { return m_field_flag; }
|
||||
// field flag property
|
||||
bool fieldFlag( void ) const;
|
||||
|
||||
|
||||
/*
|
||||
* color property
|
||||
*/
|
||||
QColor color( void ) { return m_color; }
|
||||
// color property
|
||||
const QColor& color( void ) const;
|
||||
|
||||
|
||||
/*
|
||||
* key property
|
||||
*/
|
||||
QString key( void ) { return m_key; }
|
||||
// key property
|
||||
const QString& key( void ) const;
|
||||
|
||||
|
||||
private:
|
||||
bool m_field_flag;
|
||||
QColor m_color;
|
||||
QString m_key;
|
||||
bool mFieldFlag;
|
||||
QColor mColor;
|
||||
QString mKey;
|
||||
|
||||
};
|
||||
|
||||
|
||||
+1
-6
@@ -26,16 +26,11 @@
|
||||
namespace glabels
|
||||
{
|
||||
|
||||
namespace File
|
||||
{
|
||||
|
||||
void newLabel( QWidget *parent )
|
||||
void File::newLabel( QWidget *parent )
|
||||
{
|
||||
NewLabelDialog newDialog( parent );
|
||||
newDialog.exec();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
+2
-7
@@ -28,16 +28,13 @@
|
||||
namespace glabels
|
||||
{
|
||||
|
||||
namespace Help
|
||||
{
|
||||
|
||||
void displayContents( QWidget *parent )
|
||||
void Help::displayContents( QWidget *parent )
|
||||
{
|
||||
std::cout << "TODO: Help::displayContents" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
void displayAbout( QWidget *parent )
|
||||
void Help::displayAbout( QWidget *parent )
|
||||
{
|
||||
QMessageBox aboutBox( QMessageBox::NoIcon,
|
||||
QMessageBox::tr("About gLabels"),
|
||||
@@ -55,7 +52,5 @@ namespace glabels
|
||||
aboutBox.exec();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,9 @@
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include "LabelModelObject.h"
|
||||
#include "LabelRegion.h"
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
|
||||
+9
-1
@@ -25,13 +25,21 @@
|
||||
#include <QList>
|
||||
|
||||
#include "libglabels/Template.h"
|
||||
#include "LabelModelObject.h"
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
// Forward References
|
||||
class LabelModelObject;
|
||||
class LabelRegion;
|
||||
class ColorNode;
|
||||
|
||||
|
||||
//////////////////////////////////////////////
|
||||
//////////////////////////////////////////////
|
||||
// LabelModel
|
||||
//////////////////////////////////////////////
|
||||
//////////////////////////////////////////////
|
||||
class LabelModel : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -28,6 +28,83 @@
|
||||
namespace glabels
|
||||
{
|
||||
|
||||
LabelModelBoxObject::LabelModelBoxObject( QObject* parent ) : LabelModelObject(parent)
|
||||
{
|
||||
/* TODO: initialize default line and fill poperties. */
|
||||
}
|
||||
|
||||
|
||||
LabelModelBoxObject::~LabelModelBoxObject()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
double LabelModelBoxObject::lineWidth( void ) const
|
||||
{
|
||||
return mLineWidth;
|
||||
}
|
||||
|
||||
|
||||
void LabelModelBoxObject::setLineWidth( double value )
|
||||
{
|
||||
if ( mLineWidth != value )
|
||||
{
|
||||
mLineWidth = value;
|
||||
emit changed();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ColorNode LabelModelBoxObject::lineColorNode( void ) const
|
||||
{
|
||||
return mLineColorNode;
|
||||
}
|
||||
|
||||
|
||||
void LabelModelBoxObject::setLineColorNode( const ColorNode& value )
|
||||
{
|
||||
if ( mLineColorNode != value )
|
||||
{
|
||||
mLineColorNode = value;
|
||||
emit changed();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ColorNode LabelModelBoxObject::fillColorNode( void ) const
|
||||
{
|
||||
return mFillColorNode;
|
||||
}
|
||||
|
||||
|
||||
void LabelModelBoxObject::setFillColorNode( const ColorNode& value )
|
||||
{
|
||||
if ( mFillColorNode != value )
|
||||
{
|
||||
mFillColorNode = value;
|
||||
emit changed();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool LabelModelBoxObject::canFill()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool LabelModelBoxObject::canLineColor()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool LabelModelBoxObject::canLineWidth()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Create QGraphicsItem suitable for representing this object
|
||||
QGraphicsItem* LabelModelBoxObject::createGraphicsItem()
|
||||
{
|
||||
|
||||
+11
-13
@@ -35,8 +35,8 @@ namespace glabels
|
||||
// Lifecycle Methods
|
||||
///////////////////////////////////////////////////////////////
|
||||
public:
|
||||
LabelModelBoxObject( QObject *parent = 0 ) : LabelModelObject(parent) { /* TODO: initialize default line and fill poperties. */ };
|
||||
virtual ~LabelModelBoxObject() {}
|
||||
LabelModelBoxObject( QObject* parent = 0 );
|
||||
virtual ~LabelModelBoxObject();
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
@@ -46,33 +46,31 @@ namespace glabels
|
||||
/*
|
||||
* Virtual Shape Property: lineWidth
|
||||
*/
|
||||
double lineWidth( void ) const { return mLineWidth; }
|
||||
void setLineWidth( double value ) { mLineWidth = value; }
|
||||
virtual double lineWidth( void ) const;
|
||||
virtual void setLineWidth( double value );
|
||||
|
||||
|
||||
/*
|
||||
* Virtual Shape Property: lineColorNode
|
||||
*/
|
||||
ColorNode lineColorNode( void ) { return mLineColorNode; }
|
||||
void setLineColorNode( const ColorNode &value ) { mLineColorNode = value; }
|
||||
virtual ColorNode lineColorNode( void ) const;
|
||||
virtual void setLineColorNode( const ColorNode& value );
|
||||
|
||||
|
||||
/*
|
||||
* Virtual Shape Property: fillColorNode
|
||||
*/
|
||||
ColorNode fillColorNode( void ) { return mFillColorNode; }
|
||||
void setFillColorNode( const ColorNode &value ) { mFillColorNode = value; }
|
||||
virtual ColorNode fillColorNode( void ) const;
|
||||
virtual void setFillColorNode( const ColorNode& value );
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
// Capabilities
|
||||
///////////////////////////////////////////////////////////////
|
||||
public:
|
||||
bool canFill() { return true; }
|
||||
|
||||
bool canLineColor() { return true; }
|
||||
|
||||
bool canLineWidth() { return true; }
|
||||
virtual bool canFill();
|
||||
virtual bool canLineColor();
|
||||
virtual bool canLineWidth();
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -21,6 +21,15 @@
|
||||
#include "LabelModelObject.h"
|
||||
|
||||
#include <QGraphicsDropShadowEffect>
|
||||
#include <QTransform>
|
||||
#include <QFont>
|
||||
#include <QGraphicsItem>
|
||||
|
||||
#include "ColorNode.h"
|
||||
#include "TextNode.h"
|
||||
#include "BarcodeStyle.h"
|
||||
#include "LabelRegion.h"
|
||||
#include "MergeRecord.h"
|
||||
|
||||
|
||||
namespace glabels
|
||||
@@ -51,6 +60,428 @@ namespace glabels
|
||||
}
|
||||
|
||||
|
||||
LabelModelObject::~LabelModelObject()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
int LabelModelObject::id() const
|
||||
{
|
||||
return mId;
|
||||
}
|
||||
|
||||
|
||||
bool LabelModelObject::isSelected() const
|
||||
{
|
||||
return mSelectedFlag;
|
||||
}
|
||||
|
||||
|
||||
void LabelModelObject::select( bool value )
|
||||
{
|
||||
mSelectedFlag = value;
|
||||
}
|
||||
|
||||
|
||||
void LabelModelObject::unselect()
|
||||
{
|
||||
mSelectedFlag = false;
|
||||
}
|
||||
|
||||
|
||||
double LabelModelObject::x0() const
|
||||
{
|
||||
return mX0;
|
||||
}
|
||||
|
||||
|
||||
void LabelModelObject::setX0( double value )
|
||||
{
|
||||
if ( mX0 != value )
|
||||
{
|
||||
mX0 = value;
|
||||
emit moved();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
double LabelModelObject::y0() const
|
||||
{
|
||||
return mY0;
|
||||
}
|
||||
|
||||
|
||||
void LabelModelObject::setY0( double value )
|
||||
{
|
||||
if ( mY0 != value )
|
||||
{
|
||||
mY0 = value;
|
||||
emit moved();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
double LabelModelObject::w() const
|
||||
{
|
||||
return mW;
|
||||
}
|
||||
|
||||
|
||||
void LabelModelObject::setW( double value )
|
||||
{
|
||||
if ( mW != value )
|
||||
{
|
||||
mW = value;
|
||||
emit moved();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
double LabelModelObject::h() const
|
||||
{
|
||||
return mH;
|
||||
}
|
||||
|
||||
|
||||
void LabelModelObject::setH( double value )
|
||||
{
|
||||
if ( mH != value )
|
||||
{
|
||||
mH = value;
|
||||
emit moved();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QTransform LabelModelObject::matrix() const
|
||||
{
|
||||
return mMatrix;
|
||||
}
|
||||
|
||||
|
||||
void LabelModelObject::setMatrix( const QTransform& value )
|
||||
{
|
||||
if ( mMatrix != value )
|
||||
{
|
||||
mMatrix = value;
|
||||
emit changed();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool LabelModelObject::shadow() const
|
||||
{
|
||||
return mShadowState;
|
||||
}
|
||||
|
||||
|
||||
void LabelModelObject::setShadow( bool value )
|
||||
{
|
||||
if ( mShadowState != value )
|
||||
{
|
||||
mShadowState = value;
|
||||
emit changed();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
double LabelModelObject::shadowX() const
|
||||
{
|
||||
return mShadowX;
|
||||
}
|
||||
|
||||
|
||||
void LabelModelObject::setShadowX( double value )
|
||||
{
|
||||
if ( mShadowX != value )
|
||||
{
|
||||
mShadowX = value;
|
||||
emit changed();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
double LabelModelObject::shadowY() const
|
||||
{
|
||||
return mShadowY;
|
||||
}
|
||||
|
||||
|
||||
void LabelModelObject::setShadowY( double value )
|
||||
{
|
||||
if ( mShadowY != value )
|
||||
{
|
||||
mShadowY = value;
|
||||
emit changed();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
double LabelModelObject::shadowOpacity() const
|
||||
{
|
||||
return mShadowOpacity;
|
||||
}
|
||||
|
||||
|
||||
void LabelModelObject::setShadowOpacity( double value )
|
||||
{
|
||||
if ( mShadowOpacity != value )
|
||||
{
|
||||
mShadowOpacity = value;
|
||||
emit changed();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ColorNode LabelModelObject::shadowColorNode() const
|
||||
{
|
||||
return mShadowColorNode;
|
||||
}
|
||||
|
||||
|
||||
void LabelModelObject::setShadowColorNode( const ColorNode& value )
|
||||
{
|
||||
if ( mShadowColorNode != value )
|
||||
{
|
||||
mShadowColorNode = value;
|
||||
emit changed();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QString LabelModelObject::fontFamily() const
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
void LabelModelObject::setFontFamily( const QString& value )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
double LabelModelObject::fontSize() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void LabelModelObject::setFontSize( double value )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
QFont::Weight LabelModelObject::fontWeight() const
|
||||
{
|
||||
return QFont::Normal;
|
||||
}
|
||||
|
||||
|
||||
void LabelModelObject::setFontWeight( QFont::Weight value )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool LabelModelObject::fontItalicFlag() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void LabelModelObject::setFontItalicFlag( bool value )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool LabelModelObject::fontUnderlineFlag() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void LabelModelObject::setFontUnderlineFlag( bool value )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
ColorNode LabelModelObject::textColorNode() const
|
||||
{
|
||||
return ColorNode( QColor::fromRgba(0x00000000) );
|
||||
}
|
||||
|
||||
|
||||
void LabelModelObject::setTextColorNode( const ColorNode &value )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Qt::Alignment LabelModelObject::textHAlign() const
|
||||
{
|
||||
return Qt::AlignLeft;
|
||||
}
|
||||
|
||||
|
||||
void LabelModelObject::setTextHAlign( Qt::Alignment value )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Qt::Alignment LabelModelObject::textVAlign() const
|
||||
{
|
||||
return Qt::AlignTop;
|
||||
}
|
||||
|
||||
|
||||
void LabelModelObject::setTextVAlign( Qt::Alignment value )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
double LabelModelObject::textLineSpacing() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void LabelModelObject::setTextLineSpacing( double value )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
TextNode LabelModelObject::filenameNode() const
|
||||
{
|
||||
return TextNode();
|
||||
}
|
||||
|
||||
|
||||
void LabelModelObject::setFilenameNode( const TextNode& value )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
double LabelModelObject::lineWidth() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void LabelModelObject::setLineWidth( double value )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
ColorNode LabelModelObject::lineColorNode() const
|
||||
{
|
||||
return ColorNode( QColor::fromRgba(0x00000000) );
|
||||
}
|
||||
|
||||
|
||||
void LabelModelObject::setLineColorNode( const ColorNode &value )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
ColorNode LabelModelObject::fillColorNode() const
|
||||
{
|
||||
return ColorNode( QColor::fromRgba(0x00000000) );
|
||||
}
|
||||
|
||||
|
||||
void LabelModelObject::setFillColorNode( const ColorNode &value )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
TextNode LabelModelObject::bcDataNode() const
|
||||
{
|
||||
return TextNode();
|
||||
}
|
||||
|
||||
|
||||
void LabelModelObject::setBcDataNode( const TextNode &value )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool LabelModelObject::bcTextFlag() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void LabelModelObject::setBcTextFlag( bool value )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool LabelModelObject::bcChecksumFlag() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void LabelModelObject::setBcChecksumFlag( bool value )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
ColorNode LabelModelObject::bcColorNode() const
|
||||
{
|
||||
return ColorNode( QColor::fromRgba(0x00000000) );
|
||||
}
|
||||
|
||||
|
||||
void LabelModelObject::setBcColorNode( const ColorNode &value )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BarcodeStyle LabelModelObject::bcStyle() const
|
||||
{
|
||||
return BarcodeStyle();
|
||||
}
|
||||
|
||||
|
||||
void LabelModelObject::setBcStyle( const BarcodeStyle &value )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
int LabelModelObject::bcFormatDigits() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void LabelModelObject::setBcFormatDigits( int value )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool LabelModelObject::canText() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool LabelModelObject::canFill() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool LabelModelObject::canLineColor() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool LabelModelObject::canLineWidth() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void LabelModelObject::setPosition( double x0, double y0 )
|
||||
{
|
||||
if ( ( mX0 != x0 ) || ( mY0 != y0 ) )
|
||||
|
||||
+74
-113
@@ -22,19 +22,22 @@
|
||||
#define glabels_LabelModelObject_h
|
||||
|
||||
#include <QObject>
|
||||
#include <QTransform>
|
||||
#include <QFont>
|
||||
#include <QGraphicsItem>
|
||||
#include <QTransform>
|
||||
|
||||
#include "ColorNode.h"
|
||||
#include "TextNode.h"
|
||||
#include "BarcodeStyle.h"
|
||||
#include "LabelRegion.h"
|
||||
#include "MergeRecord.h"
|
||||
|
||||
class QGraphicsItem;
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
// Forward References
|
||||
class LabelRegion;
|
||||
class MergeRecord;
|
||||
|
||||
|
||||
class LabelModelObject : public QObject
|
||||
{
|
||||
@@ -45,7 +48,7 @@ namespace glabels
|
||||
///////////////////////////////////////////////////////////////
|
||||
public:
|
||||
LabelModelObject( QObject *parent );
|
||||
virtual ~LabelModelObject() {}
|
||||
virtual ~LabelModelObject();
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
@@ -65,16 +68,16 @@ namespace glabels
|
||||
*/
|
||||
Q_PROPERTY( int id READ id )
|
||||
|
||||
int id() const { return mId; }
|
||||
int id() const;
|
||||
|
||||
/*
|
||||
* Selected Property.
|
||||
*/
|
||||
Q_PROPERTY( bool selected READ isSelected WRITE select RESET unselect )
|
||||
|
||||
bool isSelected() { return mSelectedFlag; }
|
||||
void select( bool value = true ) { mSelectedFlag = value; }
|
||||
void unselect() { mSelectedFlag = false; }
|
||||
bool isSelected() const;
|
||||
void select( bool value = true );
|
||||
void unselect();
|
||||
|
||||
|
||||
/*
|
||||
@@ -82,11 +85,8 @@ namespace glabels
|
||||
*/
|
||||
Q_PROPERTY( double x0 READ x0 WRITE setX0 );
|
||||
|
||||
double x0() { return mX0; }
|
||||
void setX0( double value )
|
||||
{
|
||||
if ( mX0 != value ) { mX0 = value; emit moved(); }
|
||||
}
|
||||
double x0() const;
|
||||
void setX0( double value );
|
||||
|
||||
|
||||
/*
|
||||
@@ -94,11 +94,8 @@ namespace glabels
|
||||
*/
|
||||
Q_PROPERTY( double y0 READ y0 WRITE setY0 );
|
||||
|
||||
double y0() { return mY0; }
|
||||
void setY0( double value )
|
||||
{
|
||||
if ( mY0 != value ) { mY0 = value; emit moved(); }
|
||||
}
|
||||
double y0() const;
|
||||
void setY0( double value );
|
||||
|
||||
|
||||
/*
|
||||
@@ -106,11 +103,8 @@ namespace glabels
|
||||
*/
|
||||
Q_PROPERTY( double w READ w WRITE setW );
|
||||
|
||||
double w() { return mW; }
|
||||
void setW( double value )
|
||||
{
|
||||
if ( mW != value ) { mW = value; emit moved(); }
|
||||
}
|
||||
double w() const;
|
||||
void setW( double value );
|
||||
|
||||
|
||||
/*
|
||||
@@ -118,11 +112,8 @@ namespace glabels
|
||||
*/
|
||||
Q_PROPERTY( double h READ h WRITE setH );
|
||||
|
||||
double h() { return mH; }
|
||||
void setH( double value )
|
||||
{
|
||||
if ( mH != value ) { mH = value; emit moved(); }
|
||||
}
|
||||
double h() const;
|
||||
void setH( double value );
|
||||
|
||||
|
||||
/*
|
||||
@@ -130,11 +121,8 @@ namespace glabels
|
||||
*/
|
||||
Q_PROPERTY( QTransform matrix READ matrix WRITE setMatrix );
|
||||
|
||||
QTransform matrix() { return mMatrix; }
|
||||
void setMatrix( const QTransform &value )
|
||||
{
|
||||
if ( mMatrix != value ) { mMatrix = value; emit changed(); }
|
||||
}
|
||||
QTransform matrix() const;
|
||||
void setMatrix( const QTransform& value );
|
||||
|
||||
|
||||
/*
|
||||
@@ -142,11 +130,8 @@ namespace glabels
|
||||
*/
|
||||
Q_PROPERTY( bool shadow READ shadow WRITE setShadow );
|
||||
|
||||
bool shadow() { return mShadowState; }
|
||||
void setShadow( bool value )
|
||||
{
|
||||
if ( mShadowState != value ) { mShadowState = value; emit changed(); }
|
||||
}
|
||||
bool shadow() const;
|
||||
void setShadow( bool value );
|
||||
|
||||
|
||||
/*
|
||||
@@ -154,11 +139,8 @@ namespace glabels
|
||||
*/
|
||||
Q_PROPERTY( double shadowX READ shadowX WRITE setShadowX );
|
||||
|
||||
double shadowX() { return mShadowX; }
|
||||
void setShadowX( double value )
|
||||
{
|
||||
if ( mShadowX != value ) { mShadowX = value; emit changed(); }
|
||||
}
|
||||
double shadowX() const;
|
||||
void setShadowX( double value );
|
||||
|
||||
|
||||
/*
|
||||
@@ -166,11 +148,8 @@ namespace glabels
|
||||
*/
|
||||
Q_PROPERTY( double shadowY READ shadowY WRITE setShadowY );
|
||||
|
||||
double shadowY() { return mShadowY; }
|
||||
void setShadowY( double value )
|
||||
{
|
||||
if ( mShadowY != value ) { mShadowY = value; emit changed(); }
|
||||
}
|
||||
double shadowY() const;
|
||||
void setShadowY( double value );
|
||||
|
||||
|
||||
/*
|
||||
@@ -178,11 +157,8 @@ namespace glabels
|
||||
*/
|
||||
Q_PROPERTY( double shadowOpacity READ shadowOpacity WRITE setShadowOpacity );
|
||||
|
||||
double shadowOpacity() { return mShadowOpacity; }
|
||||
void setShadowOpacity( double value )
|
||||
{
|
||||
if ( mShadowOpacity != value ) { mShadowOpacity = value; emit changed(); }
|
||||
}
|
||||
double shadowOpacity() const;
|
||||
void setShadowOpacity( double value );
|
||||
|
||||
|
||||
/*
|
||||
@@ -190,11 +166,8 @@ namespace glabels
|
||||
*/
|
||||
Q_PROPERTY( ColorNode shadowColorNode READ shadowColorNode WRITE setShadowColorNode );
|
||||
|
||||
ColorNode shadowColorNode() { return mShadowColorNode; }
|
||||
void setShadowColorNode( const ColorNode &value )
|
||||
{
|
||||
if ( mShadowColorNode != value ) { mShadowColorNode = value; emit changed(); }
|
||||
}
|
||||
ColorNode shadowColorNode() const;
|
||||
void setShadowColorNode( const ColorNode& value );
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
@@ -206,8 +179,8 @@ namespace glabels
|
||||
*/
|
||||
Q_PROPERTY( QString fontFamily READ fontFamily WRITE setFontFamily );
|
||||
|
||||
virtual QString fontFamily() { return ""; }
|
||||
virtual void setFontFamily( const QString &value ) { }
|
||||
virtual QString fontFamily() const;
|
||||
virtual void setFontFamily( const QString &value );
|
||||
|
||||
|
||||
/*
|
||||
@@ -215,8 +188,8 @@ namespace glabels
|
||||
*/
|
||||
Q_PROPERTY( double fontSize READ fontSize WRITE setFontSize );
|
||||
|
||||
virtual double fontSize() { return 0; }
|
||||
virtual void setFontSize( double value ) { }
|
||||
virtual double fontSize() const;
|
||||
virtual void setFontSize( double value );
|
||||
|
||||
|
||||
/*
|
||||
@@ -224,8 +197,8 @@ namespace glabels
|
||||
*/
|
||||
Q_PROPERTY( QFont::Weight fontWeight READ fontWeight WRITE setFontWeight );
|
||||
|
||||
virtual QFont::Weight fontWeight() { return QFont::Normal; }
|
||||
virtual void setFontWeight( QFont::Weight value ) { }
|
||||
virtual QFont::Weight fontWeight() const;
|
||||
virtual void setFontWeight( QFont::Weight value );
|
||||
|
||||
|
||||
/*
|
||||
@@ -233,8 +206,8 @@ namespace glabels
|
||||
*/
|
||||
Q_PROPERTY( bool fontItalicFlag READ fontItalicFlag WRITE setFontItalicFlag );
|
||||
|
||||
virtual bool fontItalicFlag() { return false; }
|
||||
virtual void setFontItalicFlag( bool value ) { }
|
||||
virtual bool fontItalicFlag() const;
|
||||
virtual void setFontItalicFlag( bool value );
|
||||
|
||||
|
||||
/*
|
||||
@@ -242,8 +215,8 @@ namespace glabels
|
||||
*/
|
||||
Q_PROPERTY( bool fontUnderlineFlag READ fontUnderlineFlag WRITE setFontUnderlineFlag );
|
||||
|
||||
virtual bool fontUnderlineFlag() { return false; }
|
||||
virtual void setFontUnderlineFlag( bool value ) { }
|
||||
virtual bool fontUnderlineFlag() const;
|
||||
virtual void setFontUnderlineFlag( bool value );
|
||||
|
||||
|
||||
/*
|
||||
@@ -251,8 +224,8 @@ namespace glabels
|
||||
*/
|
||||
Q_PROPERTY( ColorNode textColorNode READ textColorNode WRITE setTextColorNode );
|
||||
|
||||
virtual ColorNode textColorNode() { return ColorNode( QColor::fromRgba(0x00000000) ); }
|
||||
virtual void setTextColorNode( const ColorNode &value ) { }
|
||||
virtual ColorNode textColorNode() const;
|
||||
virtual void setTextColorNode( const ColorNode &value );
|
||||
|
||||
|
||||
/*
|
||||
@@ -260,8 +233,8 @@ namespace glabels
|
||||
*/
|
||||
Q_PROPERTY( Qt::Alignment textHAlign READ textHAlign WRITE setTextHAlign );
|
||||
|
||||
virtual Qt::Alignment textHAlign() { return Qt::AlignLeft; }
|
||||
virtual void setTextHAlign( Qt::Alignment value ) { }
|
||||
virtual Qt::Alignment textHAlign() const;
|
||||
virtual void setTextHAlign( Qt::Alignment value );
|
||||
|
||||
|
||||
/*
|
||||
@@ -269,8 +242,8 @@ namespace glabels
|
||||
*/
|
||||
Q_PROPERTY( Qt::Alignment textVAlign READ textVAlign WRITE setTextVAlign );
|
||||
|
||||
virtual Qt::Alignment textVAlign() { return Qt::AlignTop; }
|
||||
virtual void setTextVAlign( Qt::Alignment value ) { }
|
||||
virtual Qt::Alignment textVAlign() const;
|
||||
virtual void setTextVAlign( Qt::Alignment value );
|
||||
|
||||
|
||||
/*
|
||||
@@ -278,8 +251,8 @@ namespace glabels
|
||||
*/
|
||||
Q_PROPERTY( double textLineSpacing READ textLineSpacing WRITE setTextLineSpacing );
|
||||
|
||||
virtual double textLineSpacing() { return 0; }
|
||||
virtual void setTextLineSpacing( double value ) { }
|
||||
virtual double textLineSpacing() const;
|
||||
virtual void setTextLineSpacing( double value );
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
@@ -291,8 +264,8 @@ namespace glabels
|
||||
*/
|
||||
Q_PROPERTY( TextNode filenameNode READ filenameNode WRITE setFilenameNode );
|
||||
|
||||
virtual TextNode filenameNode() { return TextNode(); }
|
||||
virtual void setFilenameNode( const TextNode &value ) { }
|
||||
virtual TextNode filenameNode() const;
|
||||
virtual void setFilenameNode( const TextNode &value );
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
@@ -304,8 +277,8 @@ namespace glabels
|
||||
*/
|
||||
Q_PROPERTY( double lineWidth READ lineWidth WRITE setLineWidth );
|
||||
|
||||
virtual double lineWidth() { return 0; }
|
||||
virtual void setLineWidth( double value ) { }
|
||||
virtual double lineWidth() const;
|
||||
virtual void setLineWidth( double value );
|
||||
|
||||
|
||||
/*
|
||||
@@ -313,8 +286,8 @@ namespace glabels
|
||||
*/
|
||||
Q_PROPERTY( ColorNode lineColorNode READ lineColorNode WRITE setLineColorNode );
|
||||
|
||||
virtual ColorNode lineColorNode() { return ColorNode( QColor::fromRgba(0x00000000) ); }
|
||||
virtual void setLineColorNode( const ColorNode &value ) { }
|
||||
virtual ColorNode lineColorNode() const;
|
||||
virtual void setLineColorNode( const ColorNode &value );
|
||||
|
||||
|
||||
/*
|
||||
@@ -322,8 +295,8 @@ namespace glabels
|
||||
*/
|
||||
Q_PROPERTY( ColorNode fillColorNode READ fillColorNode WRITE setFillColorNode );
|
||||
|
||||
virtual ColorNode fillColorNode() { return ColorNode( QColor::fromRgba(0x00000000) ); }
|
||||
virtual void setFillColorNode( const ColorNode &value ) { }
|
||||
virtual ColorNode fillColorNode() const;
|
||||
virtual void setFillColorNode( const ColorNode &value );
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
@@ -335,8 +308,8 @@ namespace glabels
|
||||
*/
|
||||
Q_PROPERTY( TextNode bcDataNode READ bcDataNode WRITE setBcDataNode );
|
||||
|
||||
virtual TextNode bcDataNode() { return TextNode(); }
|
||||
virtual void setBcDataNode( const TextNode &value ) { }
|
||||
virtual TextNode bcDataNode() const;
|
||||
virtual void setBcDataNode( const TextNode &value );
|
||||
|
||||
|
||||
/*
|
||||
@@ -344,8 +317,8 @@ namespace glabels
|
||||
*/
|
||||
Q_PROPERTY( bool bcTextFlag READ bcTextFlag WRITE setBcTextFlag );
|
||||
|
||||
virtual bool bcTextFlag() { return false; }
|
||||
virtual void setBcTextFlag( bool value ) { }
|
||||
virtual bool bcTextFlag() const;
|
||||
virtual void setBcTextFlag( bool value );
|
||||
|
||||
|
||||
/*
|
||||
@@ -353,8 +326,8 @@ namespace glabels
|
||||
*/
|
||||
Q_PROPERTY( bool bcChecksumFlag READ bcChecksumFlag WRITE setBcChecksumFlag );
|
||||
|
||||
virtual bool bcChecksumFlag() { return false; }
|
||||
virtual void setBcChecksumFlag( bool value ) { }
|
||||
virtual bool bcChecksumFlag() const;
|
||||
virtual void setBcChecksumFlag( bool value );
|
||||
|
||||
|
||||
/*
|
||||
@@ -362,8 +335,8 @@ namespace glabels
|
||||
*/
|
||||
Q_PROPERTY( ColorNode bcColorNode READ bcColorNode WRITE setBcColorNode );
|
||||
|
||||
virtual ColorNode bcColorNode() { return ColorNode( QColor::fromRgba(0x00000000) ); }
|
||||
virtual void setBcColorNode( const ColorNode &value ) { }
|
||||
virtual ColorNode bcColorNode() const;
|
||||
virtual void setBcColorNode( const ColorNode &value );
|
||||
|
||||
|
||||
/*
|
||||
@@ -371,8 +344,8 @@ namespace glabels
|
||||
*/
|
||||
Q_PROPERTY( BarcodeStyle bcStyle READ bcStyle WRITE setBcStyle );
|
||||
|
||||
virtual BarcodeStyle bcStyle() { return BarcodeStyle(); }
|
||||
virtual void setBcStyle( const BarcodeStyle &value ) { }
|
||||
virtual BarcodeStyle bcStyle() const;
|
||||
virtual void setBcStyle( const BarcodeStyle &value );
|
||||
|
||||
|
||||
/*
|
||||
@@ -380,21 +353,18 @@ namespace glabels
|
||||
*/
|
||||
Q_PROPERTY( int bcFormatDigits READ bcFormatDigits WRITE setBcFormatDigits );
|
||||
|
||||
virtual int bcFormatDigits() { return false; }
|
||||
virtual void setBcFormatDigits( int value ) { }
|
||||
virtual int bcFormatDigits() const;
|
||||
virtual void setBcFormatDigits( int value );
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
// Capabilities (Overridden by concrete classes.)
|
||||
///////////////////////////////////////////////////////////////
|
||||
public:
|
||||
virtual bool canText() { return false; }
|
||||
|
||||
virtual bool canFill() { return false; }
|
||||
|
||||
virtual bool canLineColor() { return false; }
|
||||
|
||||
virtual bool canLineWidth() { return false; }
|
||||
virtual bool canText() const;
|
||||
virtual bool canFill() const;
|
||||
virtual bool canLineColor() const;
|
||||
virtual bool canLineWidth() const;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
@@ -402,23 +372,14 @@ namespace glabels
|
||||
///////////////////////////////////////////////////////////////
|
||||
public:
|
||||
void setPosition( double x0, double y0 );
|
||||
|
||||
void setPositionRelative( double dx, double dy );
|
||||
|
||||
void setSize( double w, double h );
|
||||
|
||||
void setSizeHonorAspect( double w, double h );
|
||||
|
||||
void setWHonorAspect( double w );
|
||||
|
||||
void setHHonorAspect( double h );
|
||||
|
||||
LabelRegion getExtent();
|
||||
|
||||
void rotate( double thetaDegs );
|
||||
|
||||
void flipHoriz();
|
||||
|
||||
void flipVert();
|
||||
|
||||
|
||||
|
||||
+8
-1
@@ -23,10 +23,17 @@
|
||||
#include <QSettings>
|
||||
#include <QStatusBar>
|
||||
#include <QFrame>
|
||||
|
||||
#include <QAction>
|
||||
#include <QCloseEvent>
|
||||
#include <QMenuBar>
|
||||
#include <QMenu>
|
||||
#include <QToolBar>
|
||||
#include <QLabel>
|
||||
#include <iostream>
|
||||
|
||||
#include "libglabels/Db.h"
|
||||
#include "View.h"
|
||||
#include "LabelModel.h"
|
||||
#include "LabelModelBoxObject.h"
|
||||
#include "Icons.h"
|
||||
#include "File.h"
|
||||
|
||||
+32
-7
@@ -22,31 +22,48 @@
|
||||
#define glabels_MainWindow_h
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QAction>
|
||||
#include <QCloseEvent>
|
||||
#include <QMenuBar>
|
||||
#include <QMenu>
|
||||
#include <QToolBar>
|
||||
#include <QLabel>
|
||||
|
||||
#include "View.h"
|
||||
class QAction;
|
||||
class QCloseEvent;
|
||||
class QMenuBar;
|
||||
class QMenu;
|
||||
class QToolBar;
|
||||
class QLabel;
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
// Forward References
|
||||
class View;
|
||||
|
||||
|
||||
//////////////////////////////////////////////
|
||||
//////////////////////////////////////////////
|
||||
// MainWindow
|
||||
//////////////////////////////////////////////
|
||||
//////////////////////////////////////////////
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
/////////////////////////////////////
|
||||
// Lifecycle
|
||||
/////////////////////////////////////
|
||||
public:
|
||||
MainWindow();
|
||||
|
||||
|
||||
/////////////////////////////////////
|
||||
// Events
|
||||
/////////////////////////////////////
|
||||
protected:
|
||||
void closeEvent( QCloseEvent *event );
|
||||
|
||||
|
||||
/////////////////////////////////////
|
||||
// Slots
|
||||
/////////////////////////////////////
|
||||
private slots:
|
||||
void fileNew();
|
||||
void fileOpen();
|
||||
@@ -110,6 +127,9 @@ namespace glabels
|
||||
void updateCursorInfo( double, double );
|
||||
|
||||
|
||||
/////////////////////////////////////
|
||||
// Internal Private Methods
|
||||
/////////////////////////////////////
|
||||
private:
|
||||
void createActions();
|
||||
void createMenus();
|
||||
@@ -125,6 +145,11 @@ namespace glabels
|
||||
void readSettings();
|
||||
void writeSettings();
|
||||
|
||||
|
||||
/////////////////////////////////////
|
||||
// Private Data
|
||||
/////////////////////////////////////
|
||||
private:
|
||||
QMenu* fileMenu;
|
||||
QMenu* editMenu;
|
||||
QMenu* viewMenu;
|
||||
|
||||
+8
-3
@@ -20,12 +20,17 @@
|
||||
|
||||
#include "View.h"
|
||||
|
||||
#include <QGraphicsScene>
|
||||
#include <QGraphicsItemGroup>
|
||||
#include <QMouseEvent>
|
||||
#include <QGraphicsLineItem>
|
||||
#include <QGraphicsDropShadowEffect>
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
|
||||
#include "LabelModel.h"
|
||||
#include "LabelModelObject.h"
|
||||
|
||||
#include "libglabels/Markup.h"
|
||||
#include "libglabels/FrameRect.h"
|
||||
#include "libglabels/FrameRound.h"
|
||||
@@ -164,11 +169,11 @@ namespace glabels
|
||||
{
|
||||
double x_scale = (72.0/physicalDpiX()) * ( width() - ZOOM_TO_FIT_PAD ) / mModel->w();
|
||||
double y_scale = (72.0/physicalDpiY()) * ( height() - ZOOM_TO_FIT_PAD ) / mModel->h();
|
||||
double newZoom = min( x_scale, y_scale );
|
||||
double newZoom = std::min( x_scale, y_scale );
|
||||
|
||||
// Limits
|
||||
newZoom = min( newZoom, zoomLevels[0] );
|
||||
newZoom = max( newZoom, zoomLevels[nZoomLevels-1] );
|
||||
newZoom = std::min( newZoom, zoomLevels[0] );
|
||||
newZoom = std::max( newZoom, zoomLevels[nZoomLevels-1] );
|
||||
|
||||
setZoomReal( newZoom, true );
|
||||
}
|
||||
|
||||
+11
-3
@@ -22,15 +22,23 @@
|
||||
#define glabels_View_h
|
||||
|
||||
#include <QGraphicsView>
|
||||
#include <QGraphicsScene>
|
||||
#include <QGraphicsItemGroup>
|
||||
|
||||
#include "LabelModel.h"
|
||||
class QGraphicsScene;
|
||||
class QGraphicsItemGroup;
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
// Forward References
|
||||
class LabelModel;
|
||||
class LabelModelObject;
|
||||
|
||||
|
||||
//////////////////////////////////////////////
|
||||
//////////////////////////////////////////////
|
||||
// View
|
||||
//////////////////////////////////////////////
|
||||
//////////////////////////////////////////////
|
||||
class View : public QGraphicsView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Reference in New Issue
Block a user