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

List:       koffice-devel
Subject:    Patch for KPresenter (Color tool bar Button)
From:       Toshitaka Fujioka <toshitaka () kde ! gr ! jp>
Date:       2001-06-14 15:59:00
[Download RAW message or body]

Hello,

This patch changes color tool bar in "Brush Color" icon and "Pen Color" icon.
And I change "Text Color" icon. (like a KSpread)

Please review.

PS: I commit to 19/06 if patch is not wrong. Deep down, I want to commit
      on tomorrow. ;)

-- 
Toshitaka Fujioka
http://www.kde.org                The K Desktop Environment Project
                                                    fujioka@kde.org
http://www.kde.gr.jp               Japan KDE User's Group
                                                    toshitaka@kde.gr.jp

-- We offer the best Desktop Environment to you.  (This is my goal. ;-)) --     


["koffice-kpresenter-color-tool-bar-20010615.diff" (text/plain)]

diff -ur koffice.orig/kpresenter/kpresenter.rc koffice/kpresenter/kpresenter.rc
--- koffice.orig/kpresenter/kpresenter.rc	Thu Jun 14 23:55:57 2001
+++ koffice/kpresenter/kpresenter.rc	Fri Jun 15 00:01:02 2001
@@ -192,7 +192,7 @@
   <Action name="text_depthMinus"/>
   <Action name="text_depthPlus"/>
   <Separator/>
-  <Action name="text_color"/>
+  <Action name="tb_text_color"/>
 </ToolBar>
 <ToolBar name="screenToolBar" position="top" fullWidth="false"><Text>Presentation</Text>
   <Action name="screen_assigneffect"/>
@@ -208,6 +208,7 @@
   <Action name="screen_pencolor"/>
 </ToolBar>
 <ToolBar name="colorBar" position="right" fullWidth="false"><Text>Color</Text>
-  <Action name="colorbar"/>
+  <Action name="brush_color"/>
+  <Action name="pen_color"/>
 </ToolBar>
 </kpartgui>
diff -ur koffice.orig/kpresenter/kpresenter_view.cc koffice/kpresenter/kpresenter_view.cc
--- koffice.orig/kpresenter/kpresenter_view.cc	Thu Jun 14 23:55:57 2001
+++ koffice/kpresenter/kpresenter_view.cc	Fri Jun 15 00:17:28 2001
@@ -81,6 +81,7 @@
 #include <koRuler.h>
 #include <koTemplateCreateDia.h>
 #include <kcoloractions.h>
+#include <tkcoloractions.h>
 #include <kaction.h>
 #include <qspinbox.h>
 #include <qcombobox.h>
@@ -1226,6 +1227,16 @@
     }
 }
 
+ /*===============================================================*/
+void KPresenterView::toolBarTextColor()
+{
+    tbColor = m_textColor->color();
+    page->setTextColor( tbColor );
+    ( (KColorAction*)actionTextColor )->blockSignals( true );
+    ( (KColorAction*)actionTextColor )->setColor( tbColor );
+    ( (KColorAction*)actionTextColor )->blockSignals( false );
+}
+
 /*===============================================================*/
 void KPresenterView::textAlignLeft()
 {
@@ -1432,8 +1443,9 @@
 }
 
 /*===============================================================*/
-void KPresenterView::penChosen( const QColor &c )
+void KPresenterView::penChosen()
 {
+    QColor c = m_penColor->color();
     if ( !page->kTxtObj() ) {
 	bool fill = true;
 
@@ -1453,8 +1465,9 @@
 }
 
 /*===============================================================*/
-void KPresenterView::brushChosen( const QColor &c )
+void KPresenterView::brushChosen()
 {
+    QColor c = m_brushColor->color();
     if ( !page->kTxtObj() ) {
 	bool fill = true;
 
@@ -1802,6 +1815,10 @@
 					this, SLOT( textColor() ),
 					actionCollection(), "text_color" );
 
+    m_textColor = new TKSelectColorAction( i18n( "Text Color" ), TKSelectColorAction::TextColor,
+                                           actionCollection(), "tb_text_color" );
+    connect( m_textColor, SIGNAL( activated() ), SLOT( toolBarTextColor() ) );
+
     actionTextAlignLeft = new KToggleAction( i18n( "Align &Left" ), "text_left", ALT + Key_L,
 				       this, SLOT( textAlignLeft() ),
 				       actionCollection(), "text_alignleft" );
@@ -2028,18 +2045,13 @@
 
     // ----------------- colorbar action
 
-    QValueList<QColor> colorList;
-    colorList << white << red << green << blue << cyan << magenta << yellow
-	      << darkRed << darkGreen << darkBlue << darkCyan
-	      << darkMagenta << darkYellow << white << lightGray
-	      << gray << darkGray << black;
-
-    actionColorBar = new KColorBarAction( i18n( "Colorbar" ), 0,
-					  this,
-					  SLOT( brushChosen( const QColor & ) ),
-					  SLOT( penChosen( const QColor & ) ),
-					  colorList,
-					  actionCollection(), "colorbar" );
+    m_brushColor = new TKSelectColorAction( i18n( "Brush Color" ), TKSelectColorAction::FillColor,
+                                            actionCollection(), "brush_color" );
+    connect( m_brushColor, SIGNAL( activated() ), SLOT( brushChosen() ) );
+
+    m_penColor = new TKSelectColorAction( i18n( "Pen Color" ), TKSelectColorAction::LineColor,
+                                          actionCollection(), "pen_color" );
+    connect( m_penColor, SIGNAL( activated() ), SLOT( penChosen() ) );
 }
 
 
@@ -2065,6 +2077,7 @@
     actionTextFontSize->setEnabled(isText);
     actionTextFontFamily->setEnabled(isText);
     actionTextColor->setEnabled(isText);
+    m_textColor->setEnabled(isText);
     actionTextAlignLeft->setEnabled(isText);
     actionTextAlignCenter->setEnabled(isText);
     actionTextAlignRight->setEnabled(isText);
diff -ur koffice.orig/kpresenter/kpresenter_view.h koffice/kpresenter/kpresenter_view.h
--- koffice.orig/kpresenter/kpresenter_view.h	Thu Jun 14 23:55:57 2001
+++ koffice/kpresenter/kpresenter_view.h	Fri Jun 15 00:19:51 2001
@@ -46,6 +46,7 @@
 
 class KAction;
 class KToggleAction;
+class TKSelectColorAction;
 
 class PageBase : public QWidget
 {
@@ -181,6 +182,7 @@
     void textItalic();
     void textUnderline();
     void textColor();
+    void toolBarTextColor();
     void textAlignLeft();
     void textAlignCenter();
     void textAlignRight();
@@ -196,8 +198,8 @@
     void textInsertPageNum();
 
     // color bar
-    void penChosen( const QColor &c );
-    void brushChosen( const QColor &c );
+    void penChosen();
+    void brushChosen();
 
     void skipToPage( int _num );
     void nextPage();
@@ -526,8 +528,11 @@
     KAction *actionScreenPenColor;
     KAction *actionScreenPenWidth;
 
-    KAction *actionColorBar;
     KAction *actionExtraDefaultTemplate;
+
+    TKSelectColorAction* m_brushColor;
+    TKSelectColorAction* m_penColor;
+    TKSelectColorAction* m_textColor;
 
     DCOPObject *dcop;
 

_______________________________________________
Koffice-devel mailing list
Koffice-devel@master.kde.org
http://master.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