Bug 121165

Summary: Harmonize view object RMB menus in zoom/layout/drawing modes
Product: [Applications] kst Reporter: Nicolas Brisset <nicolas.brisset>
Component: generalAssignee: kst
Status: RESOLVED FIXED    
Severity: wishlist    
Priority: NOR    
Version: 1.x   
Target Milestone: ---   
Platform: unspecified   
OS: Solaris   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Nicolas Brisset 2006-02-01 17:09:53 UTC
Version:           1.2.0_devel (using KDE 3.4.0, compiled sources)
Compiler:          gcc version 3.4.3
OS:                SunOS (sun4u) release 5.8

When right-clicking a view object, there are currently *three* RMB menu versions according to the current mode (drawing/layout/zoom). This is too much, and quite dangerous as for instance:
- in label mode, the first entry is "Modify..."
- in layout mode, the first entry is "Delete" !

In fact, it is even worse than that as the menus are not always the same for all objects !
I understand this came from the wish to keep them short in some cases (like zoom mode), but personally I believe that the current situation is a real chaos. I wouldn't mind having long menus (after all, when you call the menu you expect to see something, it's not like when it's always visible), especially if they're always the same. After some time, you know where to look and save a lot of time (and blunders).
Comment 1 Netterfield 2006-06-17 02:15:12 UTC
The only change that really needs to be done here is that edit... should move to the top of the layout mode menu, above delete, as it is everwhere else.  
Comment 2 George Staikos 2006-06-18 18:07:55 UTC
SVN commit 552634 by staikos:

Moved edit to the top of the layout menu.  I also shuffled a couple other items
that seemed randomly placed.  Importantly, I pushed delete down so it's not too
close to the top where the menu may show.  Destructive commands should be a bit
harder to reach.  Similar commands are grouped together.

BUG: 121165


 M  +12 -12    kstviewobject.cpp  


--- trunk/extragear/graphics/kst/src/libkstapp/kstviewobject.cpp #552633:552634
@@ -1123,8 +1123,8 @@
     menu->insertTitle(tagName());
   }
 
-  if (_layoutActions & Delete) {
-    menu->insertItem(i18n("&Delete"), this, SLOT(deleteObject()));
+  if (_layoutActions & Edit) {
+    menu->insertItem(i18n("&Edit..."), this, SLOT(edit()));
     rc = true;
   }
 
@@ -1133,6 +1133,16 @@
     rc = true;
   }
 
+  if (_layoutActions & Delete) {
+    menu->insertItem(i18n("&Delete"), this, SLOT(deleteObject()));
+    rc = true;
+  }
+
+  if (_layoutActions & Rename) {
+    menu->insertItem(i18n("Re&name..."), this, SLOT(rename()));
+    rc = true;
+  }
+
   if (_layoutActions & Raise) {
     index = menu->insertItem(i18n("&Raise"), this, SLOT(raise()));
     rc = true;
@@ -1165,16 +1175,6 @@
     }
   }
 
-  if (_layoutActions & Rename) {
-    menu->insertItem(i18n("Re&name..."), this, SLOT(rename()));
-    rc = true;
-  }
-
-  if (_layoutActions & Edit) {
-    menu->insertItem(i18n("&Edit..."), this, SLOT(edit()));
-    rc = true;
-  }
-
   if (_layoutActions & MoveTo) {
     int i = 0;
     bool hasEntry = false;
Comment 3 Nicolas Brisset 2006-06-20 14:36:48 UTC
I don't know whether it is related, but in view object mode (for box, ellipse, picture, line and arrow) the RMB menus are too short: just "Cleanup layout" !)
They should either be the same as in layout mode, or at least contain "Modify" and "Delete".
Comment 4 Nicolas Brisset 2006-07-05 10:04:36 UTC
Speaking of this, would you mind moving the "Delete" entry from the plot dialog further down ? Everybody misses "Edit..." one day or the other and loses a plot too easily.
Comment 5 Netterfield 2006-11-27 01:03:41 UTC
SVN commit 608177 by netterfield:

-SVG icons for new/edit matrix and new/edit vectors
-Matrix and vector widgets use kiconloader for their icons.
-reorganize context menus
-'edit vector' calls providers dialog if slave vector.
-'edit vector' and 'edit matrix' buttons call dialogs in edit mode.

BUG: 121165



 M  +2 -1      kst/pics/Makefile.am  
 M             kst/pics/kst_matrixedit.png  
 M             kst/pics/kst_matrixnew.png  
 M             kst/pics/kst_vectoredit.png  
 M             kst/pics/kst_vectornew.png  
 M  +1 -16     libkstapp/datamanager.ui  
 M  +3 -0      libkstapp/kstviewarrow.cpp  
 M  +3 -0      libkstapp/kstviewbox.cpp  
 M  +3 -0      libkstapp/kstviewellipse.cpp  
 M  +3 -2      libkstapp/kstviewlabel.cpp  
 M  +3 -0      libkstapp/kstviewline.cpp  
 M  +16 -8     libkstapp/kstviewobject.cpp  
 M  +3 -0      libkstapp/kstviewpicture.cpp  
 M  +7 -17     widgets/matrixselector.ui  
 M  +3 -1      widgets/matrixselector.ui.h  
 M  +9 -18     widgets/vectorselector.ui  
 M  +3 -1      widgets/vectorselector.ui.h  


--- trunk/extragear/graphics/kst/src/kst/pics/Makefile.am #608176:608177
@@ -6,7 +6,8 @@
 	kst_changefile.png kst_changenpts.png kst_editplots.png \
 	kst_datamanager.png kst_back.png kst_advance.png \
 	kst_graphfile.png kst_layoutmode.png kst_datamode.png \
-	kst_datawizard.png kst_vectornew.png kst_matrixnew.png \
+	kst_datawizard.png kst_vectornew.png kst_vectoredit.png \
+	kst_matrixedit.png kst_matrixnew.png \
 	kst_curvenew.png kst_psdnew.png kst_histogramnew.png\
 	kst_equationnew.png kst_imagenew.png kst_pluginnew.png \
 	kst_eventnew.png kst_graphics.png kst_gfx_line.png \
--- trunk/extragear/graphics/kst/src/libkstapp/datamanager.ui #608176:608177
@@ -8,7 +8,7 @@
         <rect>
             <x>0</x>
             <y>0</y>
-            <width>549</width>
+            <width>578</width>
             <height>527</height>
         </rect>
     </property>
@@ -33,20 +33,6 @@
                 <property name="name">
                     <cstring>unnamed</cstring>
                 </property>
-                <widget class="QPushButton">
-                    <property name="name">
-                        <cstring>OpenPlotDialog</cstring>
-                    </property>
-                    <property name="text">
-                        <string>Plot Dialo&amp;g...</string>
-                    </property>
-                    <property name="accel">
-                        <string>Alt+G</string>
-                    </property>
-                    <property name="whatsThis" stdset="0">
-                        <string>Open Plot Dialog</string>
-                    </property>
-                </widget>
                 <spacer>
                     <property name="name">
                         <cstring>Spacer14</cstring>
@@ -229,7 +215,6 @@
 </connections>
 <tabstops>
     <tabstop>DataView</tabstop>
-    <tabstop>OpenPlotDialog</tabstop>
     <tabstop>Purge</tabstop>
     <tabstop>New</tabstop>
     <tabstop>Delete</tabstop>
--- trunk/extragear/graphics/kst/src/libkstapp/kstviewarrow.cpp #608176:608177
@@ -35,6 +35,7 @@
   _hasToArrow = true;
   _fromArrowScaling = 1.0;
   _toArrowScaling = 1.0;
+  _standardActions |= Delete | Edit;
 }
 
 
@@ -57,6 +58,7 @@
   
   // always has this value
   _type = "Arrow";
+  _standardActions |= Delete | Edit;
 }
 
 
@@ -69,6 +71,7 @@
   
   // these always have these values
   _type = "Arrow";
+  _standardActions |= Delete | Edit;
 }
 
 
--- trunk/extragear/graphics/kst/src/libkstapp/kstviewbox.cpp #608176:608177
@@ -38,6 +38,7 @@
   setTransparent(true);
   _transparentFill = false;
   setFollowsFlow(true);
+  _standardActions |= Delete | Edit;
 }
 
 
@@ -57,6 +58,7 @@
   
   // these always have these values
   _type = "Box";
+  _standardActions |= Delete | Edit;
   _layoutActions |= Delete | Raise | Lower | RaiseToTop | LowerToBottom | Rename | MoveTo | Copy | CopyTo;
   _fallThroughTransparency = false;
   setTransparent(true);
@@ -66,6 +68,7 @@
 
 KstViewBox::KstViewBox(const KstViewBox& box)
 : KstViewObject(box) {
+  _standardActions |= Delete | Edit;
   _xRound = box._xRound;
   _yRound = box._xRound;
   _cornerStyle = box._cornerStyle;
--- trunk/extragear/graphics/kst/src/libkstapp/kstviewellipse.cpp #608176:608177
@@ -30,6 +30,7 @@
 : KstViewObject("Ellipse"), _borderWidth(1) {
   setTransparent(true);
   _transparentFill = false;
+  _standardActions |= Delete | Edit;
 }
 
 
@@ -50,6 +51,7 @@
   // always have these values
   _type = "Ellipse";
   setTransparent(true);
+  _standardActions |= Delete | Edit;
   _layoutActions |= Delete | Raise | Lower | RaiseToTop | LowerToBottom | Rename | MoveTo | Copy | CopyTo;
 }
 
@@ -62,6 +64,7 @@
   
   // these always have these values
   _type = "Ellipse";
+  _standardActions |= Delete | Edit;
 }
 
 
--- trunk/extragear/graphics/kst/src/libkstapp/kstviewlabel.cpp #608176:608177
@@ -68,7 +68,7 @@
   _fontName = KstApp::inst()->defaultFont();
   _fontSize = -1;
   setFontSize(0);
-  _standardActions |= Delete | Edit;
+  _standardActions |= Delete | Edit | Rename;
   _parsed = 0L;
   _labelMargin = 0;
   _isResizable = false;
@@ -92,7 +92,7 @@
   _fontName = KstApp::inst()->defaultFont();
   _fontSize = -1;
   setFontSize(0);
-  _standardActions |= Delete | Edit;
+  _standardActions |= Delete | Edit | Rename;
   _parsed = 0L;
   _isResizable = false;
   reparse();
@@ -124,6 +124,7 @@
   _fontSize = label._fontSize;
   _absFontSize = label._absFontSize;
   _txt = label._txt;
+  _standardActions |= Delete | Edit | Rename;
 
   _parsed = 0L;
   reparse();
--- trunk/extragear/graphics/kst/src/libkstapp/kstviewline.cpp #608176:608177
@@ -35,6 +35,7 @@
   _capStyle = Qt::FlatCap; 
   _penStyle = Qt::SolidLine; 
   setMinimumSize(QSize(1, 1));
+  _standardActions |= Delete | Edit;
 }
 
 
@@ -77,6 +78,7 @@
   setTransparent(true);
   _type = "Line";
   setMinimumSize(QSize(1, 1));
+  _standardActions |= Delete | Edit;
 }
 
 
@@ -89,6 +91,7 @@
   
   // these always have these values
   _type = "Line";
+  _standardActions |= Delete | Edit;
 }
 
 
--- trunk/extragear/graphics/kst/src/libkstapp/kstviewobject.cpp #608176:608177
@@ -1103,11 +1103,19 @@
     rc = true;
   }
 
-  if (_standardActions & Copy) {
-    menu->insertItem(i18n("&Copy"), this, SLOT(copyObject()));
+
+// Copy doesn't do anything yet, so don't put it in the UI...
+//   if (_standardActions & Copy) {
+//     menu->insertItem(i18n("&Copy"), this, SLOT(copyObject()));
+//     rc = true;
+//   }
+  
+  if (_layoutActions & Rename) {
+    menu->insertItem(i18n("Re&name..."), this, SLOT(rename()));
     rc = true;
   }
 
+
   if (_standardActions & Zoom) {
     id = menu->insertItem(i18n("Maximi&ze"), this, SLOT(zoomToggle()));
     if (_maximized) {
@@ -1147,17 +1155,17 @@
     menu->insertItem(i18n("&Edit..."), this, SLOT(edit()));
     rc = true;
   }
-
-  if (_layoutActions & Copy) {
-    menu->insertItem(i18n("&Copy"), this, SLOT(copyObject()));
-    rc = true;
-  }
-
+  
   if (_layoutActions & Delete) {
     menu->insertItem(i18n("&Delete"), this, SLOT(deleteObject()));
     rc = true;
   }
 
+//   if (_layoutActions & Copy) {
+//     menu->insertItem(i18n("&Copy"), this, SLOT(copyObject()));
+//     rc = true;
+//   }
+
   if (_layoutActions & Rename) {
     menu->insertItem(i18n("Re&name..."), this, SLOT(rename()));
     rc = true;
--- trunk/extragear/graphics/kst/src/libkstapp/kstviewpicture.cpp #608176:608177
@@ -41,6 +41,7 @@
   _timer = 0L;
   setTransparent(true);
   _maintainAspect = true;
+  _standardActions |= Delete | Edit;
 }
 
 
@@ -63,6 +64,7 @@
   // always have these values
   _type = "Picture";
   setTransparent(true);
+  _standardActions |= Delete | Edit;
 }
 
 
@@ -74,6 +76,7 @@
   
   // always have these values
   _type = "Picture";
+  _standardActions |= Delete | Edit;
 }
 
 
--- trunk/extragear/graphics/kst/src/widgets/matrixselector.ui #608176:608177
@@ -1,4 +1,4 @@
-<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
 <class>MatrixSelector</class>
 <widget class="QWidget">
     <property name="name">
@@ -12,6 +12,9 @@
             <height>40</height>
         </rect>
     </property>
+    <property name="caption">
+        <string>MatrixSelector</string>
+    </property>
     <property name="whatsThis" stdset="0">
         <string>Select a matrix to utilize.  If you wish to create a new matrix, click on the icon to the right.</string>
     </property>
@@ -42,9 +45,6 @@
             <property name="text">
                 <string></string>
             </property>
-            <property name="pixmap">
-                <pixmap>image0</pixmap>
-            </property>
             <property name="toolTip" stdset="0">
                 <string>Create a new matrix</string>
             </property>
@@ -67,23 +67,12 @@
             <property name="text">
                 <string></string>
             </property>
-            <property name="pixmap">
-                <pixmap>image1</pixmap>
-            </property>
             <property name="toolTip" stdset="0">
                 <string>Edit selected matrix</string>
             </property>
         </widget>
     </grid>
 </widget>
-<images>
-    <image name="image0">
-        <data format="XPM.GZ" length="812">789cad91cb4ec3301045f7f90a2bde45951ba7a5a4427c02a8cb4a88c58d1f79540509ca02a1fe7b336e474d832942c272c63eb993f1cd789a89f5ea4164d3e47d875d6b8469f02632fbb1dd7e3e3ddf7f256951887eea99d0e924499530e2f1f5c5d15ef67b59e6795ee68420f4b7cbb9b684ee88561fd106ec870661c5382b086bc69b906c18170bc286b134849e715912b68c5548ee184d48de307a1ffc47c76f8a941214e4209c14850a92d673080aa0602081b102ebe07cff588caba16edaae6d6a7c7700d76d3a878883931271c0d5fee220b8a625d203fad3780f1454ac07e39743e5b2d0a0dad55bf8e19b2be7fc9783fd5d720069d3a62e</data>
-    </image>
-    <image name="image1">
-        <data format="XPM.GZ" length="824">789c7d91cf4e84301087ef3c45436fc4745916d86ecc3e82c6a389f130ccb4fcdb75135d0fc6f8ee76060f0ac59634fdf2d1df4c6193a9c7873b956d92b72b5c7b54d8c1abcae8fd7cfe787a3e7e266951a8f06c4bb54d6f92d42854f79717c7fbf1d7be0d7bbdcb7932768c655ee6b9e0c058599e8c0da30dce8a3d4d687f50331ecaaada49c59eb1214b3530122386a452d03392ab0fb92403a3af9b62df303a416f69b2382115807297e89016560de8260c335b241cc898c07f17e90289568c4380689a73001cb8ec800d62ec8cf76c3052a7d5b4624ca735b15aa48572a2961d187e49f7fdb038334a70db0ea7799dc998a02266ca6897696b7f619c5f7fd641ec5bff6b56d3a21d7cdd26df0e20ca0a</data>
-    </image>
-</images>
 <connections>
     <connection>
         <sender>MatrixSelector</sender>
@@ -110,10 +99,10 @@
     <include location="local" impldecl="in declaration">kstdatacollection.h</include>
     <include location="local" impldecl="in declaration">kstmatrix.h</include>
     <include location="local" impldecl="in implementation">dialoglauncher.h</include>
-    <include location="local" impldecl="in implementation">matrixselector.ui.h</include>
+    <include location="local" impldecl="in implementation">kiconloader.h</include>
     <include location="global" impldecl="in declaration">kst_export.h</include>
+    <include location="local" impldecl="in implementation">matrixselector.ui.h</include>
 </includes>
-<exportmacro>KST_EXPORT</exportmacro>
 <variables>
     <variable access="private">bool _provideNoneMatrix;</variable>
 </variables>
@@ -138,5 +127,6 @@
     <function returnType="QString">selectedMatrix()</function>
     <function access="private">init()</function>
 </functions>
+<exportmacro>KST_EXPORT</exportmacro>
 <layoutdefaults spacing="6" margin="11"/>
 </UI>
--- trunk/extragear/graphics/kst/src/widgets/matrixselector.ui.h #608176:608177
@@ -59,6 +59,8 @@
 
 void MatrixSelector::init()
 {
+    _newMatrix->setPixmap(BarIcon("kst_matrixnew"));
+    _editMatrix->setPixmap(BarIcon("kst_matrixedit"));
     _provideNoneMatrix = false;
     update();
     connect(_matrix, SIGNAL(activated(const QString&)), this, SIGNAL(selectionChanged(const QString&)));
@@ -127,7 +129,7 @@
 
 void MatrixSelector::editMatrix()
 {
-    KstDialogs::self()->showMatrixDialog(_matrix->currentText());
+    KstDialogs::self()->showMatrixDialog(_matrix->currentText(), true);
 }
 
 
--- trunk/extragear/graphics/kst/src/widgets/vectorselector.ui #608176:608177
@@ -1,4 +1,4 @@
-<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
 <class>VectorSelector</class>
 <widget class="QWidget">
     <property name="name">
@@ -12,6 +12,9 @@
             <height>38</height>
         </rect>
     </property>
+    <property name="caption">
+        <string>VectorSelector</string>
+    </property>
     <property name="whatsThis" stdset="0">
         <string>Select a vector to utilize.  If you wish to create a new vector, click on the icon to the right.</string>
     </property>
@@ -42,9 +45,6 @@
             <property name="text">
                 <string></string>
             </property>
-            <property name="pixmap">
-                <pixmap>image0</pixmap>
-            </property>
             <property name="toolTip" stdset="0">
                 <string>Create a new vector.</string>
             </property>
@@ -70,9 +70,6 @@
             <property name="text">
                 <string></string>
             </property>
-            <property name="pixmap">
-                <pixmap>image1</pixmap>
-            </property>
             <property name="toolTip" stdset="0">
                 <string>Edit selected vector.</string>
             </property>
@@ -82,14 +79,6 @@
         </widget>
     </hbox>
 </widget>
-<images>
-    <image name="image0">
-        <data format="XPM.GZ" length="812">789ca590cd4ec3300c80ef7d8aa8be55285bba313a211e01b42312dac1cd4f7fa63109c601a1bd3b718ab7262b5cb05a355fbe38763d2bc4f3e65114b3ecfd88c74e0bdde29b28ccc77efff9b27df8caf2b214fe510ba1f29b2c97428ba7c3aba535fa3554730a42207477eba532847640a30634017d2824ac19172561c3781b0e6bc6d58ab065ac34a1635c57841d631d0ef78c3a1cde313a17fa9f8cff1918ede2d8400d380a36001234d027c90163c13aff1a48eb40d3767dd736830897711db0fdaeb7803f465e1b3c8bf4363c8bab0e5062dc01778d9c11ffe9a5fac474f092144fd46fff6664d2db288527101be4116062b83a46739b883fcce93efb069b78b136</data>
-    </image>
-    <image name="image1">
-        <data format="XPM.GZ" length="812">789c7590cb4ec3301045f7f90a2bd945c875f32255c5278058222116638ff3aa4a25280b84f8773c133789db6067e19313df99cc26152fcf8f22dd449f6738f746980e3e448a5fc7e3f7ebdbc34f14679970cf3617dbf82e8aa530e2e9f46ee9dcba73922bda841d61a10aa51807c2b2a64d8884b552de1e46a44d9810ee8ab2ccb94a4fa8b1c60a080da1714905634388b6da294e06c2a6d2d9bd26b48c4d8da3d523620686fb5f5ddcc2bf0656158783b97a8bde586d9cc260796335c0fa1d0b70133819ade5182239d79ba621a3e56c2e77dac4b0f1ca7b9e419724c6ab49483f1d56e3f72803e35cdf0f722ab534b26d87c39cb534a4e6ce03e31c95593572d17468fcefe08d0986b33497ea38cfed7aca6b1d04e6771ffd01d2c1b227</data>
-    </image>
-</images>
 <connections>
     <connection>
         <sender>_newVector</sender>
@@ -115,12 +104,13 @@
     <include location="local" impldecl="in implementation">kstrvector.h</include>
     <include location="local" impldecl="in implementation">kstsvector.h</include>
     <include location="local" impldecl="in implementation">dialoglauncher.h</include>
+    <include location="local" impldecl="in implementation">kstdataobject.h</include>
     <include location="global" impldecl="in implementation">qlistbox.h</include>
+    <include location="global" impldecl="in implementation">kiconloader.h</include>
     <include location="global" impldecl="in implementation">qtimer.h</include>
-    <include location="local" impldecl="in implementation">vectorselector.ui.h</include>
     <include location="global" impldecl="in declaration">kst_export.h</include>
+    <include location="local" impldecl="in implementation">vectorselector.ui.h</include>
 </includes>
-<exportmacro>KST_EXPORT</exportmacro>
 <variables>
     <variable access="private">bool _provideNoneVector;</variable>
 </variables>
@@ -142,8 +132,9 @@
     <slot>setEdit( const QString&amp; tag )</slot>
 </slots>
 <functions>
-    <function returnType="QString">selectedVector()</function>
     <function access="private">init()</function>
+    <function returnType="QString">selectedVector()</function>
 </functions>
+<exportmacro>KST_EXPORT</exportmacro>
 <layoutdefaults spacing="6" margin="11"/>
 </UI>
--- trunk/extragear/graphics/kst/src/widgets/vectorselector.ui.h #608176:608177
@@ -10,6 +10,8 @@
 
 void VectorSelector::init()
 {
+    _newVector->setPixmap(BarIcon("kst_vectornew"));
+    _editVector->setPixmap(BarIcon("kst_vectoredit"));
     _provideNoneVector = false;
     update();
     connect(_vector, SIGNAL(activated(const QString&)), this, SIGNAL(selectionChanged(const QString&))); // annoying that signal->signal doesn't seem to work in .ui files
@@ -143,7 +145,7 @@
       pro->showDialog(true);
       pro->unlock();
     } else {
-      KstDialogs::self()->showVectorDialog(_vector->currentText());
+      KstDialogs::self()->showVectorDialog(_vector->currentText(), true);
     }
 }