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

Barth Netterfield netterfield at astro.utoronto.ca
Wed Jan 6 17:42:26 CET 2010


SVN commit 1070733 by netterfield:

Improve font size in multi-tab datawizard generated plots
Add 'New' action.
Add change sample range and change datasource icons to the toolbar
Add create [curve/psd/equation/histograms/image/spectogram] to the Data menue

BUG: 219852



 M  +0 -6      devel-docs/Kst2Specs/Wishlist  
 M  +7 -4      src/libkstapp/datawizard.cpp  
 M  +76 -0     src/libkstapp/mainwindow.cpp  
 M  +17 -0     src/libkstapp/mainwindow.h  
 M  +22 -18    src/libkstmath/csd.cpp  


--- branches/work/kst/portto4/kst/devel-docs/Kst2Specs/Wishlist #1070732:1070733
@@ -74,12 +74,6 @@
 
 --------------------
 
-When looking at dirfile data, if the symlink changes, kst doesn't notice
-and one has to hit reload to get it to update.  This is annoying at
-best.
-
---------------------
-
 Perhaps unrelated to kst, but the new symbolic link name in defile
 (replacing the defile.cur indirect file) is retarded.  It slows me down
 and the double extension is pointless.  
--- branches/work/kst/portto4/kst/src/libkstapp/datawizard.cpp #1070732:1070733
@@ -718,6 +718,10 @@
   PlotItem *plotItem = 0;
   bool relayout = true;
   int plotsInPage = _document->currentView()->scene()->items().count();
+  bool separate_plots =
+      ((_pagePlot->plotTabPlacement() == DataWizardPagePlot::SeparateTabs) && _pageDataPresentation->plotPSD()
+       && _pageDataPresentation->plotData());
+
   switch (_pagePlot->curvePlacement()) {
     case DataWizardPagePlot::ExistingPlot:
     {
@@ -744,10 +748,6 @@
     }
     case DataWizardPagePlot::MultiplePlots:
     {
-      bool separate_plots =
-          ((_pagePlot->plotTabPlacement() == DataWizardPagePlot::SeparateTabs) && _pageDataPresentation->plotPSD()
-           && _pageDataPresentation->plotData());
-
       int nplots = vectors.count() * (_pageDataPresentation->plotPSD() + _pageDataPresentation->plotData());
 
       if (separate_plots)
@@ -949,6 +949,9 @@
   double fontScale;
   if (plotsInPage==0) {
     plotsInPage = plotList.count();
+    if (separate_plots) {
+      plotsInPage/=2;
+    }
     if (plotsInPage==0) plotsInPage = 1;
     fontScale = ApplicationSettings::self()->referenceFontSize()/sqrt((double)plotsInPage)-
                        ApplicationSettings::self()->referenceFontSize() +
--- branches/work/kst/portto4/kst/src/libkstapp/mainwindow.cpp #1070732:1070733
@@ -50,6 +50,8 @@
 #include "datavector.h"
 #include "commandlineparser.h"
 
+#include "dialoglauncher.h"
+
 #include <QtGui>
 
 // Enable Demo Vector Model 0 Disabled 1 Enabled.
@@ -213,6 +215,20 @@
 }
 
 
+void MainWindow::newDoc() {
+  if (!_doc->isChanged() || promptSave()) {
+    delete _doc;
+    _doc = new Document(this);
+  }
+  tabWidget()->createView();
+
+  int i=tabWidget()->count()-1;
+  while (i>=0) {
+    tabWidget()->closeCurrentView();
+    i--;
+  }
+}
+
 void MainWindow::open() {
   if (_doc->isChanged() && !promptSave()) {
     return;
@@ -557,7 +573,30 @@
   }
 }
 
+void MainWindow::createCurve() {
+  DialogLauncher::self()->showCurveDialog();
+}
 
+void MainWindow::createPSD() {
+  DialogLauncher::self()->showPowerSpectrumDialog();
+}
+
+void MainWindow::createEquation() {
+  DialogLauncher::self()->showEquationDialog();
+}
+
+void MainWindow::createHistogram() {
+  DialogLauncher::self()->showHistogramDialog();
+}
+
+void MainWindow::createImage() {
+  DialogLauncher::self()->showImageDialog();
+}
+
+void MainWindow::createSpectogram() {
+  DialogLauncher::self()->showCSDDialog();
+}
+
 void MainWindow::demoModel() {
 #if DEMO_VECTOR_MODEL
   Q_ASSERT(document() && document()->objectStore());
@@ -727,6 +766,11 @@
   _openAct->setShortcut(tr("Ctrl+O"));
   connect(_openAct, SIGNAL(triggered()), this, SLOT(open()));
 
+  _newAct = new QAction(tr("&New..."), this);
+  _newAct->setStatusTip(tr("Clear current session"));
+  _newAct->setShortcut(tr("Ctrl+N"));
+  connect(_newAct, SIGNAL(triggered()), this, SLOT(newDoc()));
+
   _printAct = new QAction(tr("&Print..."), this);
   _printAct->setStatusTip(tr("Print the current view"));
   connect(_printAct, SIGNAL(triggered()), this, SLOT(print()));
@@ -813,11 +857,33 @@
   _closeTabAct->setIcon(QPixmap(":kst_closetab.png"));
   connect(_closeTabAct, SIGNAL(triggered()), tabWidget(), SLOT(closeCurrentView()));
 
+  // ****************************************************************************** //
+
+  // ************************ New Data Object Actions ************************** //
+  _newCurveAct = new QAction(tr("New &Curve"), this);
+  connect(_newCurveAct, SIGNAL(triggered()), this, SLOT(createCurve()));
+
+  _newPSDAct = new QAction(tr("New &Spectrum"), this);
+  connect(_newPSDAct, SIGNAL(triggered()), this, SLOT(createPSD()));
+
+  _newEquationAct = new QAction(tr("New &Equation"), this);
+  connect(_newEquationAct, SIGNAL(triggered()), this, SLOT(createEquation()));
+
+  _newHistogramAct = new QAction(tr("New &Histogram"), this);
+  connect(_newHistogramAct, SIGNAL(triggered()), this, SLOT(createHistogram()));
+
+  _newImageAct = new QAction(tr("New &Image"), this);
+  connect(_newImageAct, SIGNAL(triggered()), this, SLOT(createImage()));
+
+  _newSpectrogramAct = new QAction(tr("New &Spectrogram"), this);
+  connect(_newSpectrogramAct, SIGNAL(triggered()), this, SLOT(createSpectogram()));
+
 }
 
 
 void MainWindow::createMenus() {
   _fileMenu = menuBar()->addMenu(tr("&File"));
+  _fileMenu->addAction(_newAct);
   _fileMenu->addAction(_newTabAct);
   _fileMenu->addAction(_openAct);
   _fileMenu->addAction(_saveAct);
@@ -836,6 +902,13 @@
   _dataMenu = menuBar()->addMenu(tr("&Data"));
   _dataMenu->addAction(_dataManagerAct);
   _dataMenu->addSeparator();
+  _dataMenu->addAction(_newCurveAct);
+  _dataMenu->addAction(_newEquationAct);
+  _dataMenu->addAction(_newPSDAct);
+  _dataMenu->addAction(_newHistogramAct);
+  _dataMenu->addAction(_newImageAct);
+  _dataMenu->addAction(_newSpectrogramAct);
+  _dataMenu->addSeparator();
   _dataMenu->addAction(_vectorEditorAct);
   _dataMenu->addAction(_scalarEditorAct);
   _dataMenu->addAction(_matrixEditorAct);
@@ -898,7 +971,10 @@
   _dataToolBar->addAction(_pauseAct);
   _dataToolBar->addAction(_readFromEndAct);
   _dataToolBar->addAction(_reloadAct);
+  _dataToolBar->addAction(_changeDataSampleDialogAct);
+  _dataToolBar->addAction(_changeFileDialogAct);
 
+
 //   _layoutToggleToolBar = addToolBar(tr("Mode"));
 
   _zoomToolBar = addToolBar(tr("Zoom"));
--- branches/work/kst/portto4/kst/src/libkstapp/mainwindow.h #1070732:1070733
@@ -79,6 +79,7 @@
     void save();
     void saveAs();
     void open();
+    void newDoc();
     void openFile(const QString &file);
     void print();
     void printToPrinter(QPrinter *printer);
@@ -106,6 +107,13 @@
     void createLayout();
     void createSharedAxisBox();
 
+    void createCurve();
+    void createPSD();
+    void createEquation();
+    void createHistogram();
+    void createImage();
+    void createSpectogram();
+
     void demoModel();
 
     void performHeavyStartupActions();
@@ -185,6 +193,7 @@
     QAction *_exitAct;
     QAction *_exportGraphicsAct;
     QAction *_newTabAct;
+    QAction *_newAct;
     QAction *_openAct;
     QAction *_printAct;
     QAction *_saveAct;
@@ -211,6 +220,14 @@
     QAction *_backAct;
     QAction *_forwardAct;
     QAction *_reloadAct;
+
+    QAction *_newCurveAct;
+    QAction *_newEquationAct;
+    QAction *_newPSDAct;
+    QAction *_newHistogramAct;
+    QAction *_newImageAct;
+    QAction *_newSpectrogramAct;
+
 };
 
 }
--- branches/work/kst/portto4/kst/src/libkstmath/csd.cpp #1070732:1070733
@@ -85,9 +85,9 @@
     _frequency = 1.0;
   }
 
-  _outMatrix->setLabel(i18n("Power [%1/%2^{1/2}]").arg(_vectorUnits).arg(_rateUnits));
-  _outMatrix->setXLabel(i18n("%1 [%2]").arg(vecName).arg(_vectorUnits));
-  _outMatrix->setYLabel(i18n("Frequency [%1]").arg(_rateUnits));
+  _outMatrix->setLabel(i18n("Power \\[%1/%2^{1/2 }\\]").arg(_vectorUnits).arg(_rateUnits));
+  _outMatrix->setXLabel(i18n("Time \\[s\\]"));
+  _outMatrix->setYLabel(i18n("Frequency \\[%1\\]").arg(_rateUnits));
 
   updateMatrixLabels();
 }
@@ -139,7 +139,7 @@
 
   double frequencyStep = .5*_frequency/(double)(tempOutputLen-1);
 
-  _outMatrix->change(xSize, tempOutputLen, 0, 0, _windowSize, frequencyStep);
+  _outMatrix->change(xSize, tempOutputLen, 0, 0, _windowSize/_frequency, frequencyStep);
 
   unlockInputsAndOutputs();
 
@@ -348,21 +348,25 @@
 }
 
 void CSD::updateMatrixLabels(void) {
-    switch (_outputType) {
-    default:
-    case 0: // amplitude spectral density (default) [V/Hz^1/2]
-      _outMatrix->setLabel(i18n("ASD [%1/%2^{1/2}]").arg(_vectorUnits).arg(_rateUnits));
-      break;
-    case 1: // power spectral density [V^2/Hz]
-      _outMatrix->setLabel(i18n("PSD [%1^2/%2]").arg(_vectorUnits).arg(_rateUnits));
-      break;
-    case 2: // amplitude spectrum [V]
-      _outMatrix->setLabel(i18n("Amplitude Spectrum [%1]").arg(_vectorUnits));
-      break;
-    case 3: // power spectrum [V^2]
-      _outMatrix->setLabel(i18n("Power Spectrum [%1^2]").arg(_vectorUnits));
-      break;
+  QString label;
+  switch (_outputType) {
+  default:
+  case 0: // amplitude spectral density (default) [V/Hz^1/2]
+    label = i18n("ASD \\[%1/%2^{1/2} \\]").arg(_vectorUnits).arg(_rateUnits);
+    break;
+  case 1: // power spectral density [V^2/Hz]
+    label = i18n("PSD \\[%1^2/%2\\]").arg(_vectorUnits).arg(_rateUnits);
+    break;
+  case 2: // amplitude spectrum [V]
+    label = i18n("Amplitude Spectrum \\[%1\\]").arg(_vectorUnits);
+    break;
+  case 3: // power spectrum [V^2]
+    label = i18n("Power Spectrum \\[%1^2\\]").arg(_vectorUnits);
+    break;
   }
+  label += " of " + _inputVectors[INVECTOR]->descriptiveName();
+  _outMatrix->setLabel(label);
+
 }
 
 QString CSD::_automaticDescriptiveName() const {


More information about the Kst mailing list