Bug 129283

Summary: Plot dialog is inconsistent with other dialogs, and is therefore confusing
Product: [Applications] kst Reporter: Netterfield <netterfield>
Component: generalAssignee: kst
Status: RESOLVED FIXED    
Severity: wishlist    
Priority: HI    
Version: 1.x   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: patch to regularize the UI of the plot dialog
Updated patch

Description Netterfield 2006-06-17 05:12:32 UTC
Version:           1.3.0_devel (using KDE 3.5.3, Kubuntu Package 4:3.5.3-0ubuntu0.1 dapper)
Compiler:          Target: i486-linux-gnu
OS:                Linux (i686) release 2.6.15-25-686

The plot dialog can be used to both create new plots, and to edit existing dialogs.  It is not like any of the other dialogs.  It should be changed in the following way:

1) A menu entry Plot->new should be made to create a new plot in the current window.

2) the plot dialog should only be used to edit existing plots.

3) the "plot dialog" tool bar and menu tool should go away.

4) the buttons at the bottom should be replaces with the standard "apply, ok, cancel"

5) "re-grid window", the window combo box, and the plot combo box should be removed.

6) Unique plot name: ____ should be moved outside the tabs.

7) Discuss: should the "Apply Setting To" radio group be untied between tabs and changed to "Apply Setting in this tab to:"?
Comment 1 Andrew Walker 2006-06-20 20:34:43 UTC
For 7) the "Apply Settings To" radio group already apply only to the tab in which they are found. The latter part of the question still stands though.
Comment 2 Netterfield 2006-07-26 18:09:05 UTC
SVN commit 566646 by netterfield:

CCBUG: 129283

Add a plot->new action to the menues to create a new plot in 
the current window.

Addresses item 1 of 129283.



 M  +1 -0      kst/kstui.rc  
 M  +2 -1      kst/pics/Makefile.am  
 M  +13 -0     libkstapp/kst.cpp  
 M  +5 -0      libkstapp/kst.h  


--- trunk/extragear/graphics/kst/src/kst/kstui.rc #566645:566646
@@ -49,6 +49,7 @@
   </Menu>
   <Menu name="plots"><text>&amp;Plots</text>
     <Action name="plotdialog_action"/>
+    <Action name="newplot_action"/>
     <Separator/>
     <Action name="zoomtie_action"/>
     <Separator/>
--- trunk/extragear/graphics/kst/src/kst/pics/Makefile.am #566645:566646
@@ -13,7 +13,8 @@
 	kst_gfx_rectangle.png kst_gfx_rounded_rectangle.png \
 	kst_gfx_ellipse.png kst_gfx_polyline.png kst_gfx_polygon.png \
 	kst_gfx_arrow.png kst_gfx_picture.png kst_choosecolor.png \
-	kst_csdnew.png kst_differentiatecurves.png kst_viewmanager.png
+	kst_csdnew.png kst_differentiatecurves.png kst_viewmanager.png \
+	kst_newplot.png
 
 
 
--- trunk/extragear/graphics/kst/src/libkstapp/kst.cpp #566645:566646
@@ -494,6 +494,13 @@
 
 
   /************/
+  NewPlotAction = new KAction(i18n("New Plot..."), "kst_newplot", 0,
+                                 this, SLOT(newPlot()),
+                                 actionCollection(), "newplot_action");
+  NewPlotAction->setWhatsThis(i18n("Create a new plot in the\n"
+                                      "current window."));
+
+  /************/
   PlotDialogAction = new KAction(i18n("Edit &Plot..."), "kst_editplots", 0,
                                  this, SLOT(showPlotDialog()),
                                  actionCollection(), "plotdialog_action");
@@ -1991,7 +1998,13 @@
   }
 }
 
+void KstApp::newPlot() {
+  KstViewWindow *w;
+  w = dynamic_cast<KstViewWindow*>(activeWindow());
+  Kst2DPlotPtr p = kst_cast<Kst2DPlot>(w->view()->findChild(w->createObject<Kst2DPlot>(KST::suggestPlotName(), false)));
 
+}
+
 void KstApp::showPlotDialog(const QString& window, const QString& plot) {
   _plotDialog->show_I(window, plot);
 }
--- trunk/extragear/graphics/kst/src/libkstapp/kst.h #566645:566646
@@ -298,6 +298,9 @@
     void slotUpdateMemoryMsg(const QString &msg);
     void slotUpdateProgress(int total, int step, const QString &msg);
 
+    /** creates a new plot in the current window */
+    void newPlot();
+
     /** just calls plotDialog->show_I(0) */
     void showPlotDialog();
     void showPlotDialog(const QString& strWindow, const QString& strPlot);
@@ -485,6 +488,8 @@
     KAction *MatrixDialogAction;
     /* Image Edit Action */
     KAction *ImageDialogAction;
+    /* New Plot Action */
+    KAction *NewPlotAction;
     /* Plot Edit Action */
     KAction *PlotDialogAction;
     /* Vector Edit Action */
Comment 3 Netterfield 2006-07-28 05:07:46 UTC
Created attachment 17145 [details]
patch to regularize the UI of the plot dialog
Comment 4 Netterfield 2006-07-28 05:08:46 UTC
Attached is a diff which completes this bug.

There were a lot of indentation changes (due to removed 'ifs') as the code was simplified.

Basic Gist:
-the plot dialog is now an OK/Apply/Cancel dialog.
-It can only be called to edit a plot.
-As this was the least invasive approach, it takes a Kst2DPlotPtr of the plot it is going to edit, unlike other view object dialogs (for view object dialogs, the object creates the dialog...) and more like the data object dialogs.  Not sure how important it is to change this now.
-It takes a qstring window name as well, which is used when applying to the current window.
-It applies to all plots using Kst2DPlot::globalPlotList.
Comment 5 George Staikos 2006-07-31 23:27:12 UTC
Created attachment 17188 [details]
Updated patch

This is an update after the branch merges.  It makes only minor changes but now
it applies cleanly to trunk.  However, there are problems with this patch.
First, _plot will hold references to view objects.  This means they won't go
away when they're deleted.  We either have to destroy the dialog or clear the
_plot variable on close.  It will also be hard to keep the dialog in sync with
the display in even a basic way if this variable exists.

In addition, we need a Kst2DPlot::findPlot(const QString& name) instead of
globalPlotList().find() for performance reasons.
Comment 6 Netterfield 2006-07-31 23:30:08 UTC
OK.  So this should be adapted to be a standard kstviewobject dialog.
Comment 7 George Staikos 2006-07-31 23:35:30 UTC
Yes I think that's best.
Comment 8 Netterfield 2007-01-19 15:27:29 UTC
Fixed a while ago...