[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: koffice/libs/main
From: Jan Hambrecht <jaham () gmx ! net>
Date: 2008-06-30 22:47:54
Message-ID: 1214866074.802248.22952.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 826546 by jaham:
added color member usewd for painting the guide lines
added d-pointer
M +41 -14 KoGuidesData.cpp
M +13 -5 KoGuidesData.h
--- trunk/koffice/libs/main/KoGuidesData.cpp #826545:826546
@@ -23,57 +23,74 @@
#include <QtGui/QPainter>
+class KoGuidesData::Private
+{
+public:
+ Private() : showGuideLines(true), guidesColor( Qt::lightGray ) {}
+ /// list of positions of horizontal guide lines
+ QList<double> horzGuideLines;
+ /// list of positions of vertical guide lines
+ QList<double> vertGuideLines;
+ bool showGuideLines;
+ QColor guidesColor;
+};
+
KoGuidesData::KoGuidesData()
- :m_bShowGuideLines(true)
+ : d( new Private() )
{
}
+KoGuidesData::~KoGuidesData()
+{
+ delete d;
+}
+
void KoGuidesData::setHorizontalGuideLines( const QList<double> &lines )
{
- m_hGuideLines = lines;
+ d->horzGuideLines = lines;
}
void KoGuidesData::setVerticalGuideLines( const QList<double> &lines )
{
- m_vGuideLines = lines;
+ d->vertGuideLines = lines;
}
void KoGuidesData::setGuideLines( const QList<double> &horizontalLines, const \
QList<double> &verticalLines) {
- m_hGuideLines = horizontalLines;
- m_vGuideLines = verticalLines;
+ d->horzGuideLines = horizontalLines;
+ d->vertGuideLines = verticalLines;
}
void KoGuidesData::addGuideLine( Qt::Orientation o, double pos )
{
if ( o == Qt::Horizontal )
{
- m_hGuideLines.append( pos );
+ d->horzGuideLines.append( pos );
}
else
{
- m_vGuideLines.append( pos );
+ d->vertGuideLines.append( pos );
}
}
bool KoGuidesData::showGuideLines() const
{
- return m_bShowGuideLines;
+ return d->showGuideLines;
}
void KoGuidesData::setShowGuideLines( bool show )
{
- m_bShowGuideLines=show;
+ d->showGuideLines=show;
}
QList<double> KoGuidesData::horizontalGuideLines() const
{
- return m_hGuideLines;
+ return d->horzGuideLines;
}
QList<double> KoGuidesData::verticalGuideLines() const
{
- return m_vGuideLines;
+ return d->vertGuideLines;
}
void KoGuidesData::paintGuides(QPainter &painter, const KoViewConverter &converter, \
const QRectF &area) const @@ -81,15 +98,15 @@
if( ! showGuideLines() )
return;
- painter.setPen( Qt::lightGray ); /// TODO: make member of guides data?
- foreach( double guide, m_hGuideLines )
+ painter.setPen( d->guidesColor );
+ foreach( double guide, d->horzGuideLines )
{
if( guide < area.top() || guide > area.bottom() )
continue;
painter.drawLine( converter.documentToView( QPointF( area.left(), guide ) ),
converter.documentToView( QPointF( area.right(), guide ) ) \
); }
- foreach( double guide, m_vGuideLines )
+ foreach( double guide, d->vertGuideLines )
{
if( guide < area.left() || guide > area.right() )
continue;
@@ -97,3 +114,13 @@
converter.documentToView( QPointF( guide, area.bottom() ) \
) ); }
}
+
+void KoGuidesData::setGuidesColor( const QColor &color )
+{
+ d->guidesColor = color;
+}
+
+QColor KoGuidesData::guidesColor() const
+{
+ return d->guidesColor;
+}
--- trunk/koffice/libs/main/KoGuidesData.h #826545:826546
@@ -28,11 +28,13 @@
class QPainter;
class KoViewConverter;
class QRectF;
+class QColor;
class KOMAIN_EXPORT KoGuidesData
{
public:
KoGuidesData();
+ ~KoGuidesData();
/**
* @brief Set the positions of the horizontal and vertical guide lines
@@ -88,17 +90,23 @@
*/
void paintGuides(QPainter &painter, const KoViewConverter &converter, const \
QRectF &area) const;
+ /**
+ * Sets the color of the guide lines.
+ * @param color the new guides color
+ */
+ void setGuidesColor( const QColor &color );
+
+ /// Returns the color of the guide lines.
+ QColor guidesColor() const;
+
#if 0 //TODO
void saveOasisSettings( KoXmlWriter &settingsWriter );
void loadOasisSettings(const QDomDocument&settingsDoc);
#endif
private:
- /// list of positions of horizontal guide lines
- QList<double> m_hGuideLines;
- /// list of positions of vertical guide lines
- QList<double> m_vGuideLines;
- bool m_bShowGuideLines;
+ class Private;
+ Private * const d;
};
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic