[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    border-toolbar
From:       Thomas Zander <zander () planescape ! com>
Date:       2002-06-15 21:40:34
[Download RAW message or body]

[Attachment #2 (multipart/mixed)]


Since the recent addition of the frame-style combo to the above toolbar the 
toolbar has grown huge in width.

Since KPresenter has a nice solution to this problem I copied the idea to KWord.

The code compiles/works but looks ugly since the pixmaps are not copied.

Anyone who 
 a) thinks this should be put in koffice/lib somehow (don't see how honestly)
 b) thinks this should wait for beta2 or 1.2 to be released first
 c) finds bugs in the code :)
please speak up!

If all ok, I'll do the style as well (the stripe/dots etc), I'm just wondering
if the pixmaps should simply be copied or we have a koffice/lib repository 
for this.

Anyway; comments appriciated.

ps. KWord has grown considerately in the last months; I'm impressed :) 1.2 is
going to be really cool!

-- 
Thomas Zander                                           zander@planescape.com
                                                 We are what we pretend to be

["borderwidth-action.diff" (text/plain)]

Index: kwview.cc
===================================================================
RCS file: /home/kde/koffice/kword/kwview.cc,v
retrieving revision 1.711
diff -u -3 -p -b -r1.711 kwview.cc
--- kwview.cc	2002/06/15 19:10:02	1.711
+++ kwview.cc	2002/06/15 21:45:05
@@ -25,6 +25,7 @@
 #include <qprogressdialog.h>
 #include <qlabel.h>
 #include <qgroupbox.h>
+#include <qcursor.h>
 
 #include <koAutoFormat.h>
 #include <koAutoFormatDia.h>
@@ -77,6 +78,7 @@
 #include "configfootnotedia.h"
 #include <qrichtext_p.h>
 #include <kaccel.h>
+#include <kiconloader.h>
 #include <kmessagebox.h>
 #include <kstatusbar.h>
 #include <kstdaccel.h>
@@ -783,7 +785,6 @@ void KWView::setupActions()
                             0,  actionCollection(), "border_style" );
     connect( actionBorderStyle, SIGNAL( activated( const QString & ) ),
              this, SLOT( borderStyle( const QString & ) ) );
-
     QStringList lst;
     lst << KoBorder::getStyle( KoBorder::SOLID );
     lst << KoBorder::getStyle( KoBorder::DASH );
@@ -792,14 +793,24 @@ void KWView::setupActions()
     lst << KoBorder::getStyle( KoBorder::DASH_DOT_DOT );
     lst << KoBorder::getStyle( KoBorder::DOUBLE_LINE );
     actionBorderStyle->setItems( lst );
-    actionBorderWidth = new KSelectAction( i18n( "Border Width" ), 0,
+
+    actionBorderWidth = new KAction( i18n("Border Width"), "border_width", 0,
+                this, SLOT( borderWidth() ),
                                                  actionCollection(), "border_width" \
                );
-    connect( actionBorderWidth, SIGNAL( activated( const QString & ) ),
-             this, SLOT( borderWidth( const QString & ) ) );
-    lst.clear();
-    for ( unsigned int i = 1; i < 10; i++ )
-        lst << QString::number( i );
-    actionBorderWidth->setItems( lst );
+    rb_borderWidthPopup = new QPopupMenu();
+    rb_borderWidthPopup->insertItem( KWBarIcon( "pen_width1" ), this, SLOT( \
borderWidth1() ) ); +    rb_borderWidthPopup->insertSeparator( -1 );
+    rb_borderWidthPopup->insertItem( KWBarIcon( "pen_width2" ), this, SLOT( \
borderWidth2() ) ); +    rb_borderWidthPopup->insertSeparator( -1 );
+    rb_borderWidthPopup->insertItem( KWBarIcon( "pen_width3" ), this, SLOT( \
borderWidth3() ) ); +    rb_borderWidthPopup->insertSeparator( -1 );
+    rb_borderWidthPopup->insertItem( KWBarIcon( "pen_width4" ), this, SLOT( \
borderWidth4() ) ); +    rb_borderWidthPopup->insertSeparator( -1 );
+    rb_borderWidthPopup->insertItem( KWBarIcon( "pen_width5" ), this, SLOT( \
borderWidth5() ) ); +    rb_borderWidthPopup->insertSeparator( -1 );
+    rb_borderWidthPopup->insertItem( KWBarIcon( "pen_width6" ), this, SLOT( \
borderWidth6() ) ); +    rb_borderWidthPopup->setMouseTracking( true );
+    rb_borderWidthPopup->setCheckable( false );
 
     actionBorderColor = new TKSelectColorAction( i18n("Border Color"), \
TKSelectColorAction::LineColor, actionCollection(), "border_color",true );  \
actionBorderColor->setDefaultColor(QColor()); @@ -4444,13 +4455,19 @@ void \
KWView::borderColor()  borderSet();
 }
 
-void KWView::borderWidth( const QString &width )
-{
-    m_border.common.setPenWidth( width.toInt());
-    m_border.left.setPenWidth(m_border.common.penWidth());
-    m_border.right.setPenWidth(m_border.common.penWidth());
-    m_border.top.setPenWidth(m_border.common.penWidth());
-    m_border.bottom.setPenWidth(m_border.common.penWidth());
+void KWView::borderWidth( ) {
+    //m_canvas->setToolEditMode( TEM_MOUSE );
+    QPoint pnt( QCursor::pos() );
+    rb_borderWidthPopup->popup( pnt );
+}
+
+void KWView::borderWidth( int width )
+{
+    m_border.common.setPenWidth( width );
+    m_border.left.setPenWidth( width );
+    m_border.right.setPenWidth( width );
+    m_border.top.setPenWidth( width );
+    m_border.bottom.setPenWidth( width );
     borderSet();
     m_gui->canvasWidget()->setFocus();
 }
@@ -4570,7 +4587,6 @@ void KWView::guiActivateEvent( KParts::G
 
 void KWView::borderShowValues()
 {
-    actionBorderWidth->setCurrentItem( (int)m_border.common.penWidth() - 1 );
     actionBorderStyle->setCurrentItem( (int)m_border.common.getStyle() );
 }
 
Index: kwview.h
===================================================================
RCS file: /home/kde/koffice/kword/kwview.h,v
retrieving revision 1.194
diff -u -3 -p -b -r1.194 kwview.h
--- kwview.h	2002/06/12 16:20:54	1.194
+++ kwview.h	2002/06/15 21:45:06
@@ -265,7 +265,14 @@ public slots:
     void borderTop();
     void borderBottom();
     void borderColor();
-    void borderWidth( const QString &width );
+    void borderWidth();     // show popup
+    void borderWidth1() { borderWidth(1); };  // call from popup
+    void borderWidth2() { borderWidth(2); };  // call from popup
+    void borderWidth3() { borderWidth(3); };  // call from popup
+    void borderWidth4() { borderWidth(4); };  // call from popup
+    void borderWidth5() { borderWidth(5); };  // call from popup
+    void borderWidth6() { borderWidth(6); };  // call from popup
+    void borderWidth( int width );
     void borderStyle( const QString &style );
     void backgroundColor();
 
@@ -518,7 +525,8 @@ private:
     KToggleAction *actionBorderBottom;
     KToggleAction *actionBorderOutline;
     TKSelectColorAction *actionBorderColor;
-    KSelectAction *actionBorderWidth;
+    KAction *actionBorderWidth;
+    QPopupMenu *rb_borderWidthPopup;
     KSelectAction *actionBorderStyle;
     TKSelectColorAction *actionBackgroundColor;
     struct


[Attachment #6 (application/pgp-signature)]
_______________________________________________
koffice-devel mailing list
koffice-devel@mail.kde.org
http://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