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

Mike Fenton mike at staikos.net
Thu Jan 22 21:05:49 CET 2009


SVN commit 915330 by fenton:

Auto append .kst to saved files.
Add document changes status updating to all appropriate objects/actions.


 M  +2 -0      changedatasampledialog.cpp  
 M  +2 -0      changefiledialog.cpp  
 M  +2 -0      choosecolordialog.cpp  
 M  +2 -0      datadialog.cpp  
 M  +2 -0      differentiatecurvesdialog.cpp  
 M  +3 -0      document.cpp  
 M  +3 -0      plotitem.cpp  
 M  +6 -0      view.cpp  
 M  +1 -0      view.h  
 M  +4 -1      viewdialog.cpp  
 M  +2 -0      viewitem.cpp  
 M  +4 -2      viewitemdialog.cpp  


--- branches/work/kst/portto4/kst/src/libkstapp/changedatasampledialog.cpp #915329:915330
@@ -16,6 +16,7 @@
 #include "objectstore.h"
 #include "document.h"
 #include "mainwindow.h"
+#include "application.h"
 #include "dialogdefaults.h"
 
 namespace Kst {
@@ -152,6 +153,7 @@
   _dialogDefaults->setValue("vector/doAve", _dataRange->doFilter());
 
   updateCurveListDialog();
+  kstApp->mainWindow()->document()->setChanged(true);
 }
 
 
--- branches/work/kst/portto4/kst/src/libkstapp/changefiledialog.cpp #915329:915330
@@ -20,6 +20,7 @@
 #include "objectstore.h"
 #include "document.h"
 #include "mainwindow.h"
+#include "application.h"
 
 #include <QDir>
 #include <QMessageBox>
@@ -267,6 +268,7 @@
     }
   }
   updatePrimitiveList();
+  kstApp->mainWindow()->document()->setChanged(true);
 }
 
 
--- branches/work/kst/portto4/kst/src/libkstapp/choosecolordialog.cpp #915329:915330
@@ -16,6 +16,7 @@
 #include "objectstore.h"
 #include "mainwindow.h"
 #include "document.h"
+#include "application.h"
 
 #include "colorsequence.h"
 #include <QPushButton>
@@ -145,6 +146,7 @@
     }
   }
   updateColorGroup();
+  kstApp->mainWindow()->document()->setChanged(true);
 }
 
 
--- branches/work/kst/portto4/kst/src/libkstapp/datadialog.cpp #915329:915330
@@ -26,6 +26,7 @@
 #include "dataobject.h"
 #include "document.h"
 #include "mainwindow.h"
+#include "application.h"
 
 namespace Kst {
 
@@ -133,6 +134,7 @@
   else
     ptr = editExistingDataObject();
   setDataObject(ptr);
+  kstApp->mainWindow()->document()->setChanged(true);
   clearModified();
 }
 
--- branches/work/kst/portto4/kst/src/libkstapp/differentiatecurvesdialog.cpp #915329:915330
@@ -17,6 +17,7 @@
 #include "objectstore.h"
 #include "mainwindow.h"
 #include "document.h"
+#include "application.h"
 
 namespace Kst {
 
@@ -192,6 +193,7 @@
     ++sequenceNum;
   }
   resetLists();
+  kstApp->mainWindow()->document()->setChanged(true);
 }
 
 }
--- branches/work/kst/portto4/kst/src/libkstapp/document.cpp #915329:915330
@@ -54,6 +54,9 @@
 bool Document::save(const QString& to) {
 
   QString file = !to.isEmpty() ? to : _fileName;
+  if (!file.endsWith(".kst")) {
+    file.append(".kst");
+  }
   QFile f(file);
   if (!f.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
     _lastError = QObject::tr("File could not be opened for writing.");
--- branches/work/kst/portto4/kst/src/libkstapp/plotitem.cpp #915329:915330
@@ -21,6 +21,7 @@
 
 #include "application.h"
 #include "mainwindow.h"
+#include "document.h"
 #include "tabwidget.h"
 #include "labelrenderer.h"
 
@@ -2818,6 +2819,7 @@
   foreach (ZoomState state, _originalStates) {
     state.item->setCurrentZoomState(state);
   }
+  kstApp->mainWindow()->document()->setChanged(true);
 }
 
 
@@ -2831,6 +2833,7 @@
       ViewGridLayout::resetSharedPlots(plotItem);
     }
   }
+  kstApp->mainWindow()->document()->setChanged(true);
 }
 
 /* 
--- branches/work/kst/portto4/kst/src/libkstapp/view.cpp #915329:915330
@@ -18,6 +18,7 @@
 #include "applicationsettings.h"
 #include "viewdialog.h"
 #include "viewgridlayout.h"
+#include "document.h"
 
 #include <math.h>
 
@@ -548,6 +549,11 @@
   editDialog.exec();
 }
 
+
+void View::viewChanged() {
+  kstApp->mainWindow()->document()->setChanged(true);
 }
 
+}
+
 // vim: ts=2 sw=2 et
--- branches/work/kst/portto4/kst/src/libkstapp/view.h #915329:915330
@@ -106,6 +106,7 @@
     void appendToLayout(CurvePlacement::Layout layout, ViewItem* item, int columns = 0);
     void createCustomLayout();
     void sharePlots();
+    void viewChanged();
 
   protected:
     bool event(QEvent *event);
--- branches/work/kst/portto4/kst/src/libkstapp/viewdialog.cpp #915329:915330
@@ -16,6 +16,9 @@
 #include "gridtab.h"
 #include "childviewoptionstab.h"
 #include "dialogpage.h"
+#include "document.h"
+#include "mainwindow.h"
+#include "application.h"
 
 #include <QBrush>
 #include <QDebug>
@@ -100,7 +103,7 @@
   if (gradient.type() != QGradient::NoGradient) {
     b = QBrush(gradient);
   }
-
+  kstApp->mainWindow()->document()->setChanged(true);
   _view->setBackgroundBrush(b);
 }
 
--- branches/work/kst/portto4/kst/src/libkstapp/viewitem.cpp #915329:915330
@@ -70,6 +70,8 @@
   connect(parent, SIGNAL(viewModeChanged(View::ViewMode)),
           this, SLOT(updateView()));
 
+  connect(this, SIGNAL(geometryChanged()), parent,SLOT(viewChanged()));
+
   setShareAxis(ApplicationSettings::self()->shareAxis());
 
   // Add actions common to all view objects
--- branches/work/kst/portto4/kst/src/libkstapp/viewitemdialog.cpp #915329:915330
@@ -19,6 +19,9 @@
 #include "dimensionstab.h"
 #include "dialogpage.h"
 #include "viewgridlayout.h"
+#include "document.h"
+#include "mainwindow.h"
+#include "application.h"
 
 #include <QPen>
 #include <QBrush>
@@ -141,7 +144,7 @@
   if (gradient.type() != QGradient::NoGradient) {
     b = QBrush(gradient);
   }
-
+  kstApp->mainWindow()->document()->setChanged(true);
   _item->setBrush(b);
 }
 
@@ -160,7 +163,6 @@
   p.setJoinStyle(_strokeTab->joinStyle());
   p.setCapStyle(_strokeTab->capStyle());
   p.setBrush(b);
-
   _item->setPen(p);
 }
 


More information about the Kst mailing list