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

Barth Netterfield netterfield at astro.utoronto.ca
Wed Jan 26 20:52:16 CET 2011


SVN commit 1217336 by netterfield:

-Fix up manually supressed axis labels.  Conceptually, manually supressed axis labels do not
 work well with shared axis boxes, so supressed axis label settings are ignored while
 in a shared axis box.
-Allow data dialogs to not have 'edit multiple' in the UI, and then remove it from the
 vector dialog.  The 'edit multiple' capabilities of the vector dialog are achievable in
 the change file dialog and the change sample range dialog, so perhaps edit multiple is
 never needed for the vector dialog.




 M  +3 -0      axistab.cpp  
 M  +13 -4     datadialog.cpp  
 M  +2 -2      datadialog.h  
 M  +22 -1     plotitem.cpp  
 M  +4 -3      sharedaxisboxitem.cpp  
 M  +2 -1      vectordialog.cpp  


--- branches/work/kst/portto4/kst/src/libkstapp/axistab.cpp #1217335:1217336
@@ -490,6 +490,9 @@
   _axisMajorLineColor->clearSelection();
   _axisMinorLineColor->clearSelection();
   _axisMinorTickCount->clear();
+
+  _hideBottomLeft->setCheckState(Qt::PartiallyChecked);
+  _hideTopRight->setCheckState(Qt::PartiallyChecked);
 }
 
 void AxisTab::setAsYAxis() {
--- branches/work/kst/portto4/kst/src/libkstapp/datadialog.cpp #1217335:1217336
@@ -34,7 +34,7 @@
 
 namespace Kst {
 
-DataDialog::DataDialog(Kst::ObjectPtr dataObject, QWidget *parent)
+DataDialog::DataDialog(Kst::ObjectPtr dataObject, QWidget *parent, bool edit_multiple)
   : Dialog(parent), _dataObject(dataObject), _modified(false) {
 
   _dataObjectName.clear();
@@ -51,14 +51,14 @@
     qFatal("ERROR: can't construct a Data Dialog without a document");
   }
 
-  createGui();
+  createGui(edit_multiple);
 }
 
 
 DataDialog::~DataDialog() {
 }
 
-void DataDialog::createGui() {
+void DataDialog::createGui(bool edit_multiple) {
 
   if (_mode == New) {
     buttonBox()->button(QDialogButtonBox::Apply)->setVisible(false);
@@ -71,8 +71,12 @@
   QVBoxLayout *extensionLayout = new QVBoxLayout(extension);
   extensionLayout->setContentsMargins(0, -1, 0, -1);
 
+  if (edit_multiple) {
   _editMultipleWidget = new EditMultipleWidget();
   extensionLayout->addWidget(_editMultipleWidget);
+  } else {
+    _editMultipleWidget = 0L;
+  }
 
   extension->setLayout(extensionLayout);
 
@@ -90,10 +94,11 @@
   _tagStringAuto = new QCheckBox(tr("&Auto","automatic"), box);
   connect(_tagStringAuto, SIGNAL(toggled(bool)), _tagString, SLOT(setDisabled(bool)));
 
+  if (edit_multiple) {
   _editMultipleButton = new QPushButton(tr("Edit Multiple >>"));
   _editMultipleButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
   connect(_editMultipleButton, SIGNAL(clicked()), this, SLOT(slotEditMultiple()));
-
+  }
   QLabel *spacer = new QLabel();
 
   if (_dataObject) {
@@ -103,15 +108,19 @@
   } else {
     _tagStringAuto->setChecked(true);
     setTagString(QString());
+    if (edit_multiple) {
     _editMultipleButton->setVisible(false);
   }
+  }
 
   layout->addWidget(_nameLabel);
   layout->addWidget(_tagString);
   layout->addWidget(_shortName);
   layout->addWidget(_tagStringAuto);
   layout->addWidget(spacer);
+  if (edit_multiple) {
   layout->addWidget(_editMultipleButton);
+  }
 
   box->setLayout(layout);
 
--- branches/work/kst/portto4/kst/src/libkstapp/datadialog.h #1217335:1217336
@@ -33,7 +33,7 @@
   Q_OBJECT
   public:
     enum EditMode { New, Edit, EditMultiple };
-    explicit DataDialog(ObjectPtr dataObject = 0, QWidget *parent = 0);
+    explicit DataDialog(ObjectPtr dataObject = 0, QWidget *parent = 0, bool edit_multiple = true);
     virtual ~DataDialog();
 
     EditMode editMode() const { return _mode; }
@@ -72,7 +72,7 @@
     void editSingleMode();
 
   private:
-    void createGui();
+    void createGui(bool edit_multiple = true);
     void updateApplyButton();
 
   private:
--- branches/work/kst/portto4/kst/src/libkstapp/plotitem.cpp #1217335:1217336
@@ -1468,6 +1468,12 @@
   qreal top = _topLabelDetails->isVisible() ? topMarginSize() : 0.0;
 
   QPointF topLeft(rect().topLeft() + QPointF(left, top));
+  if (_manuallyHideRightAxisLabel && !_isInSharedAxisBox) {
+    right += 1;
+  }
+  if (_manuallyHideBottomAxisLabel && !_isInSharedAxisBox) {
+    bottom += 1;
+  }
   QPointF bottomRight(rect().bottomRight() - QPointF(right, bottom));
 
   _calculatedPlotAxisRect = QRectF(topLeft, bottomRight);
@@ -1589,26 +1595,33 @@
   }
 }
 
-
 void PlotItem::setManuallyHideLeftAxisLabel(bool hide) {
   _manuallyHideLeftAxisLabel = hide;
+  if (!_isInSharedAxisBox) {
   setLeftSuppressed(hide);
 }
+}
 
 void PlotItem::setManuallyHideRightAxisLabel(bool hide) {
   _manuallyHideRightAxisLabel = hide;
+  if (!_isInSharedAxisBox) {
   setRightSuppressed(hide);
 }
+}
 
 void PlotItem::setManuallyHideTopAxisLabel(bool hide) {
   _manuallyHideTopAxisLabel = hide;
+  if (!_isInSharedAxisBox) {
   setTopSuppressed(hide);
 }
+}
 
 void PlotItem::setManuallyHideBottomAxisLabel(bool hide) {
   _manuallyHideBottomAxisLabel = hide;
+  if (!_isInSharedAxisBox) {
   setBottomSuppressed(hide);
 }
+}
 
 
 QRectF PlotItem::projectionRect() const {
@@ -1956,34 +1969,42 @@
 
 
 void PlotItem::setTopSuppressed(bool suppressed) {
+  if (!_isInSharedAxisBox) {
   if (_manuallyHideTopAxisLabel) {
     suppressed = true;
   }
+  }
   _topLabelDetails->setVisible(!suppressed);
 }
 
 
 void PlotItem::setRightSuppressed(bool suppressed) {
+  if (!_isInSharedAxisBox) {
   if (_manuallyHideRightAxisLabel) {
     suppressed = true;
   }
+  }
   _rightLabelDetails->setVisible(!suppressed);
 }
 
 
 void PlotItem::setLeftSuppressed(bool suppressed) {
+  if (!_isInSharedAxisBox) {
   if (_manuallyHideLeftAxisLabel) {
     suppressed = true;
   }
+  }
   _leftLabelDetails->setVisible(!suppressed);
   _yAxis->setAxisVisible(!suppressed);
 }
 
 
 void PlotItem::setBottomSuppressed(bool suppressed) {
+  if (!_isInSharedAxisBox) {
   if (_manuallyHideBottomAxisLabel) {
     suppressed = true;
   }
+  }
   _bottomLabelDetails->setVisible(!suppressed);
   _xAxis->setAxisVisible(!suppressed);
 }
--- branches/work/kst/portto4/kst/src/libkstapp/sharedaxisboxitem.cpp #1217335:1217336
@@ -211,9 +211,10 @@
   foreach (PlotItem *plotItem, list) {
     plotItem->setPos(mapToParent(plotItem->pos()));
     plotItem->setSharedAxisBox(0);
-    plotItem->setLabelsVisible(true);
-    plotItem->xAxis()->setAxisZoomMode(xAxisZoomMode());
-    plotItem->yAxis()->setAxisZoomMode(yAxisZoomMode());
+    plotItem->setTopSuppressed(false);
+    plotItem->setBottomSuppressed(false);
+    plotItem->setLeftSuppressed(false);
+    plotItem->setRightSuppressed(false);
     plotItem->update();
   }
   if (_layout) {
--- branches/work/kst/portto4/kst/src/libkstapp/vectordialog.cpp #1217335:1217336
@@ -61,6 +61,7 @@
   _updateBox->addItem("Don't update");
   updateUpdateBox();
   connect(_updateBox, SIGNAL(activated(int)), this, SLOT(updateTypeActivated(int)));
+  connect(_updateBox, SIGNAL(activated(int)), this, SIGNAL(modified()));
 }
 
 
@@ -291,7 +292,7 @@
 }
 
 VectorDialog::VectorDialog(ObjectPtr dataObject, QWidget *parent)
-  : DataDialog(dataObject, parent) {
+  : DataDialog(dataObject, parent, false) {
 
   if (editMode() == Edit)
     setWindowTitle(tr("Edit Vector"));


More information about the Kst mailing list