Bug 122382 - labels' context menu's "size" doesn't work and isn't what it should be
Summary: labels' context menu's "size" doesn't work and isn't what it should be
Status: RESOLVED FIXED
Alias: None
Product: kig
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Pino Toscano
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-20 22:49 UTC by Stefan Monov
Modified: 2006-02-23 22:19 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Monov 2006-02-20 22:49:12 UTC
Version:           v0.10.5 (using KDE 3.5.1 Level "a" , SUSE 10.0 UNSUPPORTED)
Compiler:          Target: i586-suse-linux
OS:                Linux (i686) release 2.6.13-15.8-default

In the context menu of labels, the "Size" submenu should be used for setting the font size. Right now it's does nothing and is the same as for a line.
Comment 1 Pino Toscano 2006-02-23 22:19:26 UTC
SVN commit 512879 by pino:

Do not show the Style and the Size submenus in the object popup if the selection
contains only labels.
CCBUGS: 122381, 122382


 M  +15 -3     popup.cc  
 M  +5 -0      popup.h  


--- branches/KDE/3.5/kdeedu/kig/modes/popup.cc #512878:512879
@@ -33,6 +33,7 @@
 #include "../objects/other_type.h"
 #include "../objects/object_factory.h"
 #include "../objects/polygon_imp.h"
+#include "../objects/text_imp.h"
 #include "../misc/lists.h"
 #include "../misc/argsparser.h"
 #include "../misc/kigpainter.h"
@@ -184,7 +185,7 @@
                                                 const std::vector<ObjectHolder*>& objs,
 						const QPoint& plc )
   : KPopupMenu( &view ), mplc( plc ), mpart( part ), mview( view ), mobjs( objs ),
-    mmode( mode )
+    mmode( mode ), monlylabels( false )
 {
   bool empty = objs.empty();
   bool single = objs.size() == 1;
@@ -204,6 +205,17 @@
     title = i18n( "%1 Objects" ).arg( objs.size() );
   insertTitle( title, 1 );
 
+  if ( !empty )
+  {
+    monlylabels = true;
+    uint i = 0;
+    while ( i < objs.size() && monlylabels )
+    {
+      monlylabels &= objs[i]->imp()->inherits( TextImp::stype() );
+      ++i;
+    }
+  }
+
   if ( empty )
   {
     // provides some diverse stuff like "unhide all", set coordinate
@@ -399,7 +411,7 @@
     }
     popup.addAction( menu, i18n( "&Custom Color" ), nextfree++ );
   }
-  else if ( menu == NormalModePopupObjects::SetSizeMenu )
+  else if ( menu == NormalModePopupObjects::SetSizeMenu && !popup.onlyLabels() )
   {
     bool point = true;
     bool samecolor = true;
@@ -434,7 +446,7 @@
       popup.addAction( menu, p, nextfree++ );
     };
   }
-  else if ( menu == NormalModePopupObjects::SetStyleMenu )
+  else if ( menu == NormalModePopupObjects::SetStyleMenu && !popup.onlyLabels() )
   {
     bool samecolor = true;
     int npoints = 0;
--- branches/KDE/3.5/kdeedu/kig/modes/popup.h #512878:512879
@@ -75,6 +75,8 @@
   KigWidget& widget() { return mview; };
   QPoint plc() { return mplc; };
 
+  bool onlyLabels() const { return monlylabels; };
+
 protected:
   void activateAction( int menu, int action );
 
@@ -100,6 +102,9 @@
   std::vector<PopupActionProvider*> mproviders;
 
   QPopupMenu* mmenus[NumberOfMenus];
+
+private:
+  bool monlylabels;
 };
 
 /**
Comment 2 Pino Toscano 2006-02-23 22:19:48 UTC
SVN commit 512881 by pino:

Do not show the Style and the Size submenus in the object popup if the selection
contains only labels.
BUGS: 122381, 122382


 M  +15 -3     popup.cc  
 M  +5 -0      popup.h  


--- trunk/KDE/kdeedu/kig/modes/popup.cc #512880:512881
@@ -33,6 +33,7 @@
 #include "../objects/other_type.h"
 #include "../objects/object_factory.h"
 #include "../objects/polygon_imp.h"
+#include "../objects/text_imp.h"
 #include "../objects/text_type.h"
 #include "../misc/lists.h"
 #include "../misc/argsparser.h"
@@ -186,7 +187,7 @@
                                                 const std::vector<ObjectHolder*>& objs,
                                                 const QPoint& plc )
   : KMenu( &view ), mplc( plc ), mpart( part ), mview( view ), mobjs( objs ),
-    mmode( mode )
+    mmode( mode ), monlylabels( false )
 {
   bool empty = objs.empty();
   bool single = objs.size() == 1;
@@ -205,6 +206,17 @@
     title = i18n( "%1 Objects" ).arg( objs.size() );
   addTitle( title );
 
+  if ( !empty )
+  {
+    monlylabels = true;
+    uint i = 0;
+    while ( i < objs.size() && monlylabels )
+    {
+      monlylabels &= objs[i]->imp()->inherits( TextImp::stype() );
+      ++i;
+    }
+  }
+
   if ( empty )
   {
     // provides some diverse stuff like "unhide all", set coordinate
@@ -378,7 +390,7 @@
     QPixmap icon = l->loadIcon( "colorize", KIcon::Small, 22, KIcon::DefaultState, 0L, true );
     popup.addInternalAction( menu, icon, i18n( "&Custom Color" ), nextfree++ );
   }
-  else if ( menu == NormalModePopupObjects::SetSizeMenu )
+  else if ( menu == NormalModePopupObjects::SetSizeMenu && !popup.onlyLabels() )
   {
     bool point = true;
     bool samecolor = true;
@@ -413,7 +425,7 @@
       popup.addInternalAction( menu, p, nextfree++ );
     };
   }
-  else if ( menu == NormalModePopupObjects::SetStyleMenu )
+  else if ( menu == NormalModePopupObjects::SetStyleMenu && !popup.onlyLabels() )
   {
     bool samecolor = true;
     int npoints = 0;
--- trunk/KDE/kdeedu/kig/modes/popup.h #512880:512881
@@ -73,6 +73,8 @@
   KigWidget& widget() { return mview; };
   QPoint plc() { return mplc; };
 
+  bool onlyLabels() const { return monlylabels; };
+
 protected:
   void activateAction( int menu, int action );
 
@@ -89,6 +91,9 @@
   std::vector<PopupActionProvider*> mproviders;
 
   QMenu* mmenus[NumberOfMenus];
+
+private:
+  bool monlylabels;
 };
 
 /**
Comment 3 Pino Toscano 2006-02-23 22:19:58 UTC
SVN commit 512880 by pino:

Do not show the Style and the Size submenus in the object popup if the selection
contains only labels.
CCBUGS: 122381, 122382


 M  +15 -3     popup.cc  
 M  +5 -0      popup.h  


--- branches/kig/post-kde-3.5/kig/modes/popup.cc #512879:512880
@@ -33,6 +33,7 @@
 #include "../objects/other_type.h"
 #include "../objects/object_factory.h"
 #include "../objects/polygon_imp.h"
+#include "../objects/text_imp.h"
 #include "../objects/text_type.h"
 #include "../misc/lists.h"
 #include "../misc/argsparser.h"
@@ -186,7 +187,7 @@
                                                 const std::vector<ObjectHolder*>& objs,
 						const QPoint& plc )
   : KPopupMenu( &view ), mplc( plc ), mpart( part ), mview( view ), mobjs( objs ),
-    mmode( mode )
+    mmode( mode ), monlylabels( false )
 {
   bool empty = objs.empty();
   bool single = objs.size() == 1;
@@ -206,6 +207,17 @@
     title = i18n( "%1 Objects" ).arg( objs.size() );
   insertTitle( title, 1 );
 
+  if ( !empty )
+  {
+    monlylabels = true;
+    uint i = 0;
+    while ( i < objs.size() && monlylabels )
+    {
+      monlylabels &= objs[i]->imp()->inherits( TextImp::stype() );
+      ++i;
+    }
+  }
+
   if ( empty )
   {
     // provides some diverse stuff like "unhide all", set coordinate
@@ -401,7 +413,7 @@
     }
     popup.addAction( menu, i18n( "&Custom Color" ), nextfree++ );
   }
-  else if ( menu == NormalModePopupObjects::SetSizeMenu )
+  else if ( menu == NormalModePopupObjects::SetSizeMenu && !popup.onlyLabels() )
   {
     bool point = true;
     bool samecolor = true;
@@ -436,7 +448,7 @@
       popup.addAction( menu, p, nextfree++ );
     };
   }
-  else if ( menu == NormalModePopupObjects::SetStyleMenu )
+  else if ( menu == NormalModePopupObjects::SetStyleMenu && !popup.onlyLabels() )
   {
     bool samecolor = true;
     int npoints = 0;
--- branches/kig/post-kde-3.5/kig/modes/popup.h #512879:512880
@@ -75,6 +75,8 @@
   KigWidget& widget() { return mview; };
   QPoint plc() { return mplc; };
 
+  bool onlyLabels() const { return monlylabels; };
+
 protected:
   void activateAction( int menu, int action );
 
@@ -100,6 +102,9 @@
   std::vector<PopupActionProvider*> mproviders;
 
   QPopupMenu* mmenus[NumberOfMenus];
+
+private:
+  bool monlylabels;
 };
 
 /**