[Kst] branches/work/kst/portto4/kst

Mike Fenton mike at staikos.net
Tue Jan 20 16:06:32 CET 2009


SVN commit 914172 by fenton:

Clean up of Tied Zoom status markers.


 M  +0 -7      devel-docs/Kst2Specs/Bugs  
 M  +8 -0      devel-docs/Kst2Specs/FixedBugs  
 M  +13 -1     src/libkstapp/mainwindow.cpp  
 M  +2 -0      src/libkstapp/mainwindow.h  
 M  +2 -2      src/libkstapp/plotitem.cpp  
 M  +1 -1      src/libkstapp/plotitem.h  
 M  +7 -1      src/libkstapp/plotitemmanager.cpp  
 M  +6 -2      src/libkstapp/plotitemmanager.h  


--- branches/work/kst/portto4/kst/devel-docs/Kst2Specs/Bugs #914171:914172
@@ -91,13 +91,6 @@
 
 --------
 
-Tied zoom behavior oddness:
-Tied zoom has been implemented as a toggle button, setting or unsetting
-all of the zoom ties.  However, when in tied zoom, it is still possible to un-tie
-individual plots (which is good).  But: when you un-tie one of several plots, perhaps
-the tied zoom button should become disabled, as you are no longer in all-tied zoom mode.
-*Mike*
---------
 
 
 
--- branches/work/kst/portto4/kst/devel-docs/Kst2Specs/FixedBugs #914171:914172
@@ -310,4 +310,12 @@
 This is happening during completion processing as the objects are drawn currently during
 creation.
 *Mike*
+--------
+
+Tied zoom behavior oddness:
+Tied zoom has been implemented as a toggle button, setting or unsetting
+all of the zoom ties.  However, when in tied zoom, it is still possible to un-tie
+individual plots (which is good).  But: when you un-tie one of several plots, perhaps
+the tied zoom button should become disabled, as you are no longer in all-tied zoom mode.
+*Mike*
 --------
\ No newline at end of file
--- branches/work/kst/portto4/kst/src/libkstapp/mainwindow.cpp #914171:914172
@@ -79,6 +79,8 @@
   _tabWidget->createView();
   setCentralWidget(_tabWidget);
   connect(_tabWidget, SIGNAL(currentChanged(int)), this, SLOT(currentViewChanged()));
+  connect(PlotItemManager::self(), SIGNAL(tiedZoomRemoved()), this, SLOT(tiedZoomRemoved()));
+  connect(PlotItemManager::self(), SIGNAL(allPlotsTiedZoom()), this, SLOT(allPlotsTiedZoom()));
 
   readSettings();
   QTimer::singleShot(0, this, SLOT(performHeavyStartupActions()));
@@ -124,11 +126,21 @@
   View *v = tabWidget()->currentView();
   QList<PlotItem*> plots = PlotItemManager::plotsForView(v);
   foreach (PlotItem *plotItem, plots) {
-    plotItem->setTiedZoom(tiedZoom);
+    plotItem->setTiedZoom(tiedZoom, false);
   }
 }
 
 
+void MainWindow::tiedZoomRemoved() {
+  _tiedZoomAct->setChecked(false);
+}
+
+
+void MainWindow::allPlotsTiedZoom() {
+  _tiedZoomAct->setChecked(true);
+}
+
+
 bool MainWindow::promptSave() {
   int rc = QMessageBox::warning(this, tr("Kst"), tr("Your document has been modified.\nSave changes?"), QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Save);
   if (rc == QMessageBox::Save) {
--- branches/work/kst/portto4/kst/src/libkstapp/mainwindow.h #914171:914172
@@ -73,6 +73,8 @@
     void exportGraphicsFile(const QString &filename, const QString &format, int w, int h, int display);
 
     void clearDrawingMarker();
+    void tiedZoomRemoved();
+    void allPlotsTiedZoom();
 
   private Q_SLOTS:
     void aboutToQuit();
--- branches/work/kst/portto4/kst/src/libkstapp/plotitem.cpp #914171:914172
@@ -959,14 +959,14 @@
 }
 
 
-void PlotItem::setTiedZoom(bool tiedZoom) {
+void PlotItem::setTiedZoom(bool tiedZoom, bool checkAllTied) {
   if ((_isInSharedAxisBox && !tiedZoom) || (_isTiedZoom == tiedZoom))
     return;
 
   _isTiedZoom = tiedZoom;
 
   if (_isTiedZoom)
-    PlotItemManager::self()->addTiedZoomPlot(this);
+    PlotItemManager::self()->addTiedZoomPlot(this, checkAllTied);
   else
     PlotItemManager::self()->removeTiedZoomPlot(this);
 
--- branches/work/kst/portto4/kst/src/libkstapp/plotitem.h #914171:914172
@@ -79,7 +79,7 @@
     PlotAxis* yAxis() { return _yAxis; }
 
     bool isTiedZoom() const;
-    void setTiedZoom(bool tiedZoom);
+    void setTiedZoom(bool tiedZoom, bool checkAllTied = true);
 
     bool isInSharedAxisBox() const;
     void setInSharedAxisBox(bool inSharedBox);
--- branches/work/kst/portto4/kst/src/libkstapp/plotitemmanager.cpp #914171:914172
@@ -64,7 +64,7 @@
 }
 
 
-void PlotItemManager::addTiedZoomPlot(PlotItem *plotItem) {
+void PlotItemManager::addTiedZoomPlot(PlotItem *plotItem, bool checkAllTied) {
   if (!_tiedZoomPlotLists.contains(plotItem->parentView())) {
     _tiedZoomPlotLists.insert(plotItem->parentView(), QList<PlotItem*>() << plotItem);
   } else {
@@ -72,6 +72,11 @@
     list << plotItem;
     _tiedZoomPlotLists.insert(plotItem->parentView(), list);
   }
+  if (checkAllTied) {
+    if (_tiedZoomPlotLists[plotItem->parentView()] == _plotLists[plotItem->parentView()]) {
+      emit allPlotsTiedZoom();
+    }
+  }
 }
 
 
@@ -82,6 +87,7 @@
   QList<PlotItem*> list = _tiedZoomPlotLists.value(plotItem->parentView());
   list.removeAll(plotItem);
   _tiedZoomPlotLists.insert(plotItem->parentView(), list);
+  emit tiedZoomRemoved();
 }
 
 
--- branches/work/kst/portto4/kst/src/libkstapp/plotitemmanager.h #914171:914172
@@ -28,9 +28,13 @@
   public:
     static QList<PlotItem*> plotsForView(View *view);
     static QList<PlotItem*> tiedZoomPlotsForView(View *view);
+    static PlotItemManager *self();
 
+  Q_SIGNALS:
+    void tiedZoomRemoved();
+    void allPlotsTiedZoom();
+
   private:
-    static PlotItemManager *self();
     static void cleanup();
 
     PlotItemManager();
@@ -39,7 +43,7 @@
     void addPlot(PlotItem *plotItem);
     void removePlot(PlotItem *plotItem);
 
-    void addTiedZoomPlot(PlotItem *plotItem);
+    void addTiedZoomPlot(PlotItem *plotItem, bool checkAll = true);
     void removeTiedZoomPlot(PlotItem *plotItem);
 
   private:


More information about the Kst mailing list