Bug 122381 - labels' context menu includes irrelevant options
Summary: labels' context menu includes irrelevant options
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:47 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:47:02 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

"Transform" and "Style" shouldn't be included in labels' context menu.
Comment 1 Pino Toscano 2006-02-20 23:04:49 UTC
The Transform option is not unuseful, as a transformed label is defined as a new label with the top-left corner transformed from the top-left corner of the original label.
About the style, we could apply it to labels, for example for the border; what do you suggest about that?
Comment 2 Stefan Monov 2006-02-20 23:11:38 UTC
Well, my first thought when submitting the report was to use the style for drawing of the very *text*, but then decided it'd make the text nearly illegible. I like your approach of applying the style to the border better.
Then, if the label doesn't have a frame (i.e. it's not turned on), the "Style" option shouldn't be included.
Comment 3 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 4 Pino Toscano 2006-02-23 22:19:49 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 5 Pino Toscano 2006-02-23 22:19:59 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;
 };
 
 /**