[prev in list] [next in list] [prev in thread] [next in thread]
List: koffice-devel
Subject: [PATCH] KWord: ruler's new look
From: Yann Bodson <yann.bodson () online ! fr>
Date: 2005-05-22 23:00:56
Message-ID: 200505230900.56593.yann.bodson () online ! fr
[Download RAW message or body]
Hi all,
I've done some work on kword's rulers this week-end.
Changes:
- FrameStyle changed from Box-Raised to MenuBarPanel (less cluttered IMHO)
- Ruler lines are smaller.
- Using KGlobalSettings::toolBarFont() instead of hardcoded 8 sized font.
- Using KGlobalSettings::textColor() instead of black. So rulers are readable
even with dark colors themes.
- New indents triangles pixmaps
You can see what it looks like here:
http://img288.echo.cx/my.php?image=kwordrulers1ls.png
The patch applies to the directory lib/kofficeui.
You need to change koRulerFirst.png and koRulerLeft.png in the
lib/kofficeui/pics directory.
If there's no objection, I will commit it after the 1.4 release.
Bye,
--
Yann
["koRulerFirst.png" (image/png)]
["koRulerLeft.png" (image/png)]
["koffice_new_ruler.patch" (text/x-diff)]
Index: koRuler.cc
===================================================================
--- koRuler.cc (revision 416298)
+++ koRuler.cc (working copy)
@@ -31,6 +31,8 @@
#include <qtooltip.h>
#include <koPageLayout.h>
+#include <kglobalsettings.h>
+
class KoRulerPrivate {
public:
KoRulerPrivate() {
@@ -84,7 +86,7 @@
m_unit( _unit )
{
setWFlags( WResizeNoErase | WRepaintNoErase );
- setFrameStyle( Box | Raised );
+ setFrameStyle( MenuBarPanel | Sunken );
d=new KoRulerPrivate();
@@ -205,11 +207,11 @@
// Use a double-buffer pixmap
QPainter p( &buffer );
p.fillRect( 0, 0, width(), height(), QBrush( colorGroup().brush( \
QColorGroup::Background ) ) ); + p.setPen( KGlobalSettings::textColor() );
int totalw = qRound( zoomIt(d->layout.ptWidth) );
QString str;
- QFont font; // Use the global KDE font. Let's hope it's appropriate.
- font.setPointSize( 8 );
+ QFont font = KGlobalSettings::toolBarFont();
QFontMetrics fm( font );
p.setBrush( colorGroup().brush( QColorGroup::Base ) );
@@ -260,7 +262,7 @@
{
for ( double i = dist * 0.5;i <= (double)totalw;i += dist ) {
int ii=qRound(i);
- p.drawLine( ii - diffx, 5, ii - diffx, height() - 5 );
+ p.drawLine( ii - diffx, 8, ii - diffx, height() - 8 );
}
}
@@ -270,32 +272,34 @@
{
for ( double i = dist * 0.25;i <= (double)totalw;i += dist * 0.5 ) {
int ii=qRound(i);
- p.drawLine( ii - diffx, 7, ii - diffx, height() - 7 );
+ p.drawLine( ii - diffx, 10, ii - diffx, height() - 10 );
}
}
// Draw ending bar (at page width)
- int constant=zoomIt(1);
- p.drawLine( totalw - diffx + constant, 1, totalw - diffx + constant, height() - \
1 );
- p.setPen( colorGroup().color( QColorGroup::Base ) );
- p.drawLine( totalw - diffx, 1, totalw - diffx, height() - 1 );
+ //int constant=zoomIt(1);
+ //p.drawLine( totalw - diffx + constant, 1, totalw - diffx + constant, height() \
- 1 ); + //p.setPen( colorGroup().color( QColorGroup::Base ) );
+ //p.setPen( Qt::red );
+ //p.drawLine( totalw - diffx, 1, totalw - diffx, height() - 1 );
// Draw starting bar (at 0)
- p.setPen( colorGroup().color( QColorGroup::Text ) );
- p.drawLine( -diffx, 1, -diffx, height() - 1 );
- p.setPen( colorGroup().color( QColorGroup::Base ) );
- p.drawLine( -diffx - constant, 1, -diffx - constant, height() - 1 );
+ //p.setPen( colorGroup().color( QColorGroup::Text ) );
+ //p.drawLine( -diffx, 1, -diffx, height() - 1 );
+ //p.setPen( colorGroup().color( QColorGroup::Base ) );
+ //p.setPen( Qt::red );
+ //p.drawLine( -diffx - constant, 1, -diffx - constant, height() - 1 );
// Draw the indents triangles
if ( d->flags & F_INDENTS ) {
- int top = 2;
+ int top = 1;
double halfPixmapWidth = d->pmFirst.width() * 0.5;
// Cumulate i_first with correct indent
double firstLineIdent = i_first + ( d->rtl ? d->i_right : i_left );
p.drawPixmap( qRound( static_cast<double>(r.left()) + applyRtlAndZoom( \
firstLineIdent ) - halfPixmapWidth ), top, d->pmFirst );
- int bottom = height() - d->pmLeft.height() - 2;
+ int bottom = height() - d->pmLeft.height() - 1;
halfPixmapWidth = d->pmLeft.width() * 0.5;
p.drawPixmap( qRound( static_cast<double>(r.left()) + zoomIt(i_left) - \
halfPixmapWidth ), bottom, d->pmLeft );
@@ -366,6 +370,7 @@
{
QPainter p( &buffer );
p.fillRect( 0, 0, width(), height(), QBrush( colorGroup().brush( \
QColorGroup::Background ) ) ); + p.setPen( KGlobalSettings::textColor() );
int totalh = qRound( zoomIt(d->layout.ptHeight) );
// Clip rect - this gives basically always a rect like (2,2,width-2,height-2)
@@ -375,8 +380,7 @@
if ( paintRect.intersects( rulerRect ) ) {
QString str;
- QFont font; // Use the global KDE font. Let's hope it's appropriate.
- font.setPointSize( 8 ); // Hardcode the size? (Werner)
+ QFont font = KGlobalSettings::toolBarFont();
QFontMetrics fm( font );
p.setBrush( colorGroup().brush( QColorGroup::Base ) );
@@ -430,7 +434,7 @@
{
for ( double i = dist * 0.5;i <= (double)totalh;i += dist ) {
int ii=qRound(i);
- p.drawLine( 5, ii - diffy, width() - 5, ii - diffy );
+ p.drawLine( 8, ii - diffy, width() - 8, ii - diffy );
}
}
@@ -439,20 +443,20 @@
{
for ( double i = dist * 0.25;i <=(double)totalh;i += dist *0.5 ) {
int ii=qRound(i);
- p.drawLine( 7, ii - diffy, width() - 7, ii - diffy );
+ p.drawLine( 10, ii - diffy, width() - 10, ii - diffy );
}
}
// Draw ending bar (at page height)
- p.drawLine( 1, totalh - diffy + 1, width() - 1, totalh - diffy + 1 );
- p.setPen( colorGroup().color( QColorGroup::Base ) );
- p.drawLine( 1, totalh - diffy, width() - 1, totalh - diffy );
+ //p.drawLine( 1, totalh - diffy + 1, width() - 1, totalh - diffy + 1 );
+ //p.setPen( colorGroup().color( QColorGroup::Base ) );
+ //p.drawLine( 1, totalh - diffy, width() - 1, totalh - diffy );
// Draw starting bar (at 0)
- p.setPen( colorGroup().color( QColorGroup::Text ) );
- p.drawLine( 1, -diffy, width() - 1, -diffy );
- p.setPen( colorGroup().color( QColorGroup::Base ) );
- p.drawLine( 1, -diffy - 1, width() - 1, -diffy - 1 );
+ //p.setPen( colorGroup().color( QColorGroup::Text ) );
+ //p.drawLine( 1, -diffy, width() - 1, -diffy );
+ //p.setPen( colorGroup().color( QColorGroup::Base ) );
+ //p.drawLine( 1, -diffy - 1, width() - 1, -diffy - 1 );
}
// Show the mouse position
Index: koTabChooser.cc
===================================================================
--- koTabChooser.cc (revision 416298)
+++ koTabChooser.cc (working copy)
@@ -46,7 +46,7 @@
KoTabChooser::KoTabChooser( QWidget *parent, int _flags )
: QFrame( parent, "" )
{
- setFrameStyle( Box | Raised );
+ setFrameStyle( MenuBarPanel | Sunken );
flags = _flags;
d=new KoTabChooserPrivate();
_______________________________________________
koffice-devel mailing list
koffice-devel@kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic