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

Barth Netterfield netterfield at astro.utoronto.ca
Sun Aug 1 01:28:01 CEST 2010


SVN commit 1157708 by netterfield:

Reload tab names from .kst files
integral and differentiation should be filters
Fix some annoying bugish things in filter dialogs
Add curve placement widget to filter and fit dialogs



 M  +0 -1      libkstapp/datadialog.cpp  
 M  +6 -0      libkstapp/dialoglaunchergui.cpp  
 M  +1 -0      libkstapp/document.cpp  
 M  +47 -9     libkstapp/filterfitdialog.cpp  
 M  +2 -2      libkstapp/filterfitdialog.h  
 M  +26 -3     libkstapp/filterfittab.ui  
 M  +4 -0      libkstapp/tabwidget.cpp  
 M  +1 -0      libkstapp/tabwidget.h  
 D             plugins/dataobject/cumulativesum (directory)  
 M  +4 -4      plugins/dataobject/dataobject.pro  
 A             plugins/filters/cumulativesum (directory)  
 A             plugins/filters/cumulativesum/cumulativesum.cpp   [License: GPL (v2+)]
 A             plugins/filters/cumulativesum/cumulativesum.h   [License: GPL (v2+)]
 A             plugins/filters/cumulativesum/cumulativesum.pro  
 A             plugins/filters/cumulativesum/cumulativesumconfig.ui  
 A             plugins/filters/cumulativesum/kstplugin_cumulativesum.desktop  
 A             plugins/filters/differentiation (directory)  
 A             plugins/filters/differentiation/differentiation.cpp   [License: GPL (v2+)]
 A             plugins/filters/differentiation/differentiation.h   [License: GPL (v2+)]
 A             plugins/filters/differentiation/differentiation.pro  
 A             plugins/filters/differentiation/differentiationconfig.ui  
 A             plugins/filters/differentiation/kstplugin_differentiation.desktop  
 M  +3 -1      plugins/filters/filters.pro  
 M  +3 -1      plugins/plugins.pro  
 M  +8 -0      widgets/curveplacement.cpp  
 M  +1 -0      widgets/curveplacement.h  


--- branches/work/kst/portto4/kst/src/libkstapp/datadialog.cpp #1157707:1157708
@@ -56,7 +56,6 @@
 DataDialog::~DataDialog() {
 }
 
-
 void DataDialog::createGui() {
 
   if (_mode == New) {
--- branches/work/kst/portto4/kst/src/libkstapp/dialoglaunchergui.cpp #1157707:1157708
@@ -177,6 +177,12 @@
       }
     }
     dialog->show();
+    // FIXME: Total hack to make the window appear at a good place.
+    // This is not necessary for other dialogs, and I can't figure out why (!)
+    QRect r = kstApp->mainWindow()->rect();
+    int x = r.x() + 30;
+    int y = r.y() + 30;
+    dialog->move(x,y);
   }
 }
 
--- branches/work/kst/portto4/kst/src/libkstapp/document.cpp #1157707:1157708
@@ -233,6 +233,7 @@
                 _win->tabWidget()->addView(loadedView);
                 QXmlStreamAttributes attrs = xml.attributes();
                 loadedView->setObjectName(attrs.value("name").toString());
+                _win->tabWidget()->setCurrentViewName(attrs.value("name").toString());
                 qreal width = 1.0, height = 1.0;
                 QStringRef string = attrs.value("width");
                 if (!string.isNull()) {
--- branches/work/kst/portto4/kst/src/libkstapp/filterfitdialog.cpp #1157707:1157708
@@ -37,9 +37,10 @@
     _pluginCombo->addItems(DataObject::fitsPluginList());
   }
 
+  _curveAppearance->setVisible(false);
+  _curvePlacement->setVisible(false);
+  _ignoreAutoScale->setVisible(false);
   connect(_pluginCombo, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(pluginChanged(const QString&)));
-  _curveAppearance->setVisible(false);
-
   pluginChanged(pluginName);
 }
 
@@ -72,8 +73,15 @@
 }
 
 
-void FilterFitTab::setPlotMode() {
+void FilterFitTab::setPlotMode(PlotItem* plot) {
+
+  _curvePlacement->setPlace(CurvePlacement::ExistingPlot);
+  _curvePlacement->setExistingPlots(Data::self()->plotList());
+  _curvePlacement->setCurrentPlot(plot);
+
   _curveAppearance->setVisible(true);
+  _curvePlacement->setVisible(true);
+  _ignoreAutoScale->setVisible(true);
   lockVectors();
 }
 
@@ -92,7 +100,11 @@
   return _curveAppearance;
 }
 
+CurvePlacement* FilterFitTab::curvePlacement() const {
+  return _curvePlacement;
+}
 
+
 QString FilterFitTab::pluginName() {
   return _pluginCombo->currentText();
 }
@@ -133,7 +145,7 @@
 
 
 FilterFitDialog::FilterFitDialog(QString& pluginName, ObjectPtr dataObject, QWidget *parent)
-  : DataDialog(dataObject, parent), _plotItem(0), _vectorX(0), _vectorY(0) {
+  : DataDialog(dataObject, parent), _vectorX(0), _vectorY(0) {
 
   QString title;
   if (editMode() == Edit)
@@ -181,8 +193,7 @@
 
 
 void FilterFitDialog::setPlotMode(PlotItem* plot) {
-  _plotItem = plot;
-  _filterFitTab->setPlotMode();
+  _filterFitTab->setPlotMode(plot);
 }
 
 
@@ -199,7 +210,34 @@
     return 0;
   }
 
-  if (_plotItem) {
+  PlotItem *plotItem = 0;
+  switch (_filterFitTab->curvePlacement()->place()) {
+  case CurvePlacement::NoPlot:
+    break;
+  case CurvePlacement::ExistingPlot:
+    {
+      plotItem = static_cast<PlotItem*>(_filterFitTab->curvePlacement()->existingPlot());
+      break;
+    }
+  case CurvePlacement::NewPlotNewTab:
+    _document->createView();
+    // fall through to case NewPlot.
+  case CurvePlacement::NewPlot:
+    {
+      CreatePlotForCurve *cmd = new CreatePlotForCurve();
+      cmd->createItem();
+
+      plotItem = static_cast<PlotItem*>(cmd->item());
+      if (_filterFitTab->curvePlacement()->scaleFonts()) {
+        plotItem->parentView()->resetPlotFontSizes();
+      }
+      break;
+    }
+  default:
+    break;
+  }
+
+  if (plotItem) {
     CurvePtr curve = _document->objectStore()->createObject<Curve>();
 
     Q_ASSERT(curve);
@@ -226,7 +264,7 @@
 
     _filterFitTab->curveAppearance()->setWidgetDefaults();
 
-    PlotRenderItem *renderItem = _plotItem->renderItem(PlotRenderItem::Cartesian);
+    PlotRenderItem *renderItem = plotItem->renderItem(PlotRenderItem::Cartesian);
     renderItem->addRelation(kst_cast<Relation>(curve));
 
     dataObject->writeLock();
@@ -239,7 +277,7 @@
 
       cmd->createItem(tmpstring);
     }
-    _plotItem->update();
+    plotItem->update();
   }
 
   _filterFitTab->configWidget()->save();
--- branches/work/kst/portto4/kst/src/libkstapp/filterfitdialog.h #1157707:1157708
@@ -34,13 +34,14 @@
     void setVectorY(VectorPtr vector);
 
     CurveAppearance* curveAppearance() const;
+    CurvePlacement* curvePlacement() const;
 
     DataObjectConfigWidget* configWidget() { return _configWidget; }
 
     void loadSettings();
     void saveSettings();
 
-    void setPlotMode();
+    void setPlotMode(PlotItem* plot);
     void lockVectors();
 
     QString pluginName();
@@ -76,7 +77,6 @@
   private:
     void configureTab();
     FilterFitTab *_filterFitTab;
-    PlotItem* _plotItem;
     VectorPtr _vectorX;
     VectorPtr _vectorY;
 };
--- branches/work/kst/portto4/kst/src/libkstapp/filterfittab.ui #1157707:1157708
@@ -6,11 +6,11 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>441</width>
-    <height>338</height>
+    <width>1020</width>
+    <height>619</height>
    </rect>
   </property>
-  <layout class="QVBoxLayout" name="verticalLayout">
+  <layout class="QVBoxLayout" name="verticalLayout_3">
    <item>
     <widget class="QGroupBox" name="GroupBox9_3">
      <property name="sizePolicy">
@@ -84,13 +84,36 @@
     </widget>
    </item>
    <item>
+    <layout class="QHBoxLayout" name="horizontalLayout_4">
+     <item>
+      <layout class="QVBoxLayout" name="verticalLayout">
+       <item>
     <widget class="Kst::CurveAppearance" name="_curveAppearance" native="true"/>
    </item>
+       <item>
+        <widget class="QCheckBox" name="_ignoreAutoScale">
+         <property name="text">
+          <string>I&amp;gnore in automatic axes range calculations</string>
+         </property>
+        </widget>
+       </item>
   </layout>
+     </item>
+     <item>
+      <widget class="Kst::CurvePlacement" name="_curvePlacement" native="true"/>
+     </item>
+    </layout>
+   </item>
+  </layout>
  </widget>
  <layoutdefault spacing="6" margin="11"/>
  <customwidgets>
   <customwidget>
+   <class>Kst::CurvePlacement</class>
+   <extends>QWidget</extends>
+   <header>curveplacement.h</header>
+  </customwidget>
+  <customwidget>
    <class>Kst::CurveAppearance</class>
    <extends>QWidget</extends>
    <header>curveappearance.h</header>
--- branches/work/kst/portto4/kst/src/libkstapp/tabwidget.cpp #1157707:1157708
@@ -106,6 +106,10 @@
   }
 }
 
+void TabWidget::setCurrentViewName(QString name) {
+  int idx = tabBar()->currentIndex();
+  tabBar()->setTabText(idx, name);
+}
 
 void TabWidget::contextMenu(const QPoint& pos) {
   QTabBar *tb = tabBar();
--- branches/work/kst/portto4/kst/src/libkstapp/tabwidget.h #1157707:1157708
@@ -37,6 +37,7 @@
     View *createView();
     void renameCurrentView();
     void closeCurrentView();
+    void setCurrentViewName(QString name);
 
     private Q_SLOTS:
     void contextMenu(const QPoint&);
--- branches/work/kst/portto4/kst/src/plugins/dataobject/dataobject.pro #1157707:1157708
@@ -3,15 +3,15 @@
 TEMPLATE = subdirs
 CONFIG += ordered
 
+DEMOS += \
+    linefit \
+    genericfilter 
+
 SUBDIRS += \
     bin \
     chop \
     crossspectrum \
-    cumulativesum \
-    differentiation \
     effectivebandwidth \
-    genericfilter \
-    linefit \
     periodogram \
     phase \
     shift \
--- branches/work/kst/portto4/kst/src/plugins/filters/filters.pro #1157707:1157708
@@ -4,7 +4,9 @@
 CONFIG += ordered
 
 SUBDIRS += \
-    despike
+    despike \
+    cumulativesum \
+    differentiation
 
 LibExists(gsl) {
      message(GSL configured.  Filter plugins will be built.)
--- branches/work/kst/portto4/kst/src/plugins/plugins.pro #1157707:1157708
@@ -3,8 +3,10 @@
 TEMPLATE = subdirs
 CONFIG += ordered
 
+DEMOS += \
+    sampleplugin 
+
 SUBDIRS += \
-    sampleplugin \
     filters \
     dataobject
 
--- branches/work/kst/portto4/kst/src/widgets/curveplacement.cpp #1157707:1157708
@@ -112,6 +112,14 @@
   }
 }
 
+void CurvePlacement::setCurrentPlot(const PlotItemInterface *currentPlot) {
+  if (currentPlot) {
+    int index = _plotList->findText(currentPlot->plotName());
+    if (index >= 0) {
+      _plotList->setCurrentIndex(index);
+    }
+  }
+}
 
 int CurvePlacement::gridColumns() const {
   return _gridColumns->value();
--- branches/work/kst/portto4/kst/src/widgets/curveplacement.h #1157707:1157708
@@ -36,6 +36,7 @@
 
     PlotItemInterface *existingPlot() const;
     void setExistingPlots(const QList<PlotItemInterface*> &existingPlots);
+    void setCurrentPlot(const PlotItemInterface *currentPlot);
 
     Layout layout() const;
     void setLayout(Layout layout);


More information about the Kst mailing list