[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: koffice/lib/kofficeui
From: David Faure <faure () kde ! org>
Date: 2003-01-01 9:31:16
[Download RAW message or body]
CVS commit by faure:
Partial support for the new units (done for the numbering, not for the unit
changing yet)
M +25 -33 koRuler.cc 1.111
M +1 -0 koRuler.h 1.57
--- koffice/lib/kofficeui/koRuler.cc #1.110:1.111
@@ -165,4 +165,27 @@ void KoRuler::setMousePos( int mx, int m
}
+// distance between the main lines (those with a number)
+double KoRuler::lineDistance() const
+{
+ switch( m_unit ) {
+ case KoUnit::U_INCH:
+ return INCH_TO_POINT( m_zoom ); // every inch
+ case KoUnit::U_PT:
+ return 100.0 * m_zoom; // every 100 pt
+ case KoUnit::U_MM:
+ case KoUnit::U_CM:
+ case KoUnit::U_DM:
+ return CM_TO_POINT ( m_zoom ); // every cm
+ case KoUnit::U_PI:
+ return PI_TO_POINT ( 10.0 * m_zoom ); // every 10 pica
+ case KoUnit::U_DD:
+ return DD_TO_POINT( m_zoom ); // every diderot
+ case KoUnit::U_CC:
+ return CC_TO_POINT( 10.0 * m_zoom ); // every 10 cicero
+ }
+ // should never end up here
+ return 100.0 * m_zoom;
+}
+
/*================================================================*/
void KoRuler::drawHorizontal( QPainter *_painter )
@@ -172,5 +195,4 @@ void KoRuler::drawHorizontal( QPainter *
p.fillRect( 0, 0, width(), height(), QBrush( colorGroup().brush( QColorGroup::Background ) ) );
- double dist=0.0;
int totalw = qRound( zoomIt(layout.ptWidth) );
QString str;
@@ -198,19 +220,5 @@ void KoRuler::drawHorizontal( QPainter *
// Draw the numbers
- switch( m_unit ) {
- case KoUnit::U_INCH:
- dist = INCH_TO_POINT (m_zoom);
- break;
- case KoUnit::U_PT:
- dist = 100.0 * m_zoom;
- break;
- case KoUnit::U_MM:
- dist = MM_TO_POINT ( 10.0 * m_zoom );
- break;
- case KoUnit::U_CM:
- dist = CM_TO_POINT ( m_zoom );
- break;
- }
-
+ double dist = lineDistance();
int j = 0;
int maxwidth = 0;
@@ -336,5 +344,4 @@ void KoRuler::drawVertical( QPainter *_p
int totalh = qRound( zoomIt(layout.ptHeight) );
if ( ( diffy >= 0 && totalh > diffy ) || ( diffy < 0 && diffy + totalh >= 0 ) ) {
- double dist=0.0;
int j = 0;
QString str;
@@ -362,20 +369,5 @@ void KoRuler::drawVertical( QPainter *_p
// Draw the numbers
- switch( m_unit ) {
- case KoUnit::U_INCH:
- dist = INCH_TO_POINT ( m_zoom );
- break;
- case KoUnit::U_PT:
- dist = 100.0 * m_zoom;
- break;
- case KoUnit::U_MM:
- dist = MM_TO_POINT ( 10.0 * m_zoom );
- break;
- case KoUnit::U_CM:
- dist = CM_TO_POINT ( m_zoom );
- break;
-
- }
-
+ double dist = lineDistance();
int maxheight = 0;
for ( double i = 0.0;i <= (double)totalh;i += dist ) {
--- koffice/lib/kofficeui/koRuler.h #1.56:1.57
@@ -272,4 +272,5 @@ private:
double applyRtlAndZoom( double value ) const;
double unZoomItRtl( int pixValue ) const;
+ double lineDistance() const;
KoRulerPrivate *d;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic