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

Mike Fenton mike at staikos.net
Wed Dec 5 17:33:37 CET 2007


SVN commit 745171 by fenton:

Move editMultipleMode flag logic into EditMode of DataDialog.


 M  +3 -5      curvedialog.cpp  
 M  +0 -1      curvedialog.h  
 M  +2 -0      datadialog.cpp  
 M  +1 -1      datadialog.h  
 M  +3 -5      matrixdialog.cpp  
 M  +0 -1      matrixdialog.h  
 M  +3 -5      vectordialog.cpp  
 M  +0 -1      vectordialog.h  


--- branches/work/kst/portto4/kst/src/libkstapp/curvedialog.cpp #745170:745171
@@ -240,7 +240,7 @@
 
 
 CurveDialog::CurveDialog(ObjectPtr dataObject, QWidget *parent)
-  : DataDialog(dataObject, parent), _editMultipleMode(false) {
+  : DataDialog(dataObject, parent) {
 
   if (editMode() == Edit)
     setWindowTitle(tr("Edit Curve"));
@@ -273,13 +273,11 @@
 
 
 void CurveDialog::editMultipleMode() {
-  _editMultipleMode = true;
   _curveTab->clearTabValues();
 }
 
 
 void CurveDialog::editSingleMode() {
-  _editMultipleMode = false;
    configureTab(dataObject());
 }
 
@@ -331,7 +329,7 @@
 
 
 void CurveDialog::updateButtons() {
-  _buttonBox->button(QDialogButtonBox::Ok)->setEnabled((_curveTab->xVector() && _curveTab->yVector()) || _editMultipleMode);
+  _buttonBox->button(QDialogButtonBox::Ok)->setEnabled((_curveTab->xVector() && _curveTab->yVector()) || (editMode() == EditMultiple));
 }
 
 
@@ -406,7 +404,7 @@
 
 ObjectPtr CurveDialog::editExistingDataObject() const {
   if (CurvePtr curve = kst_cast<Curve>(dataObject())) {
-    if (_editMultipleMode) {
+    if (editMode() == EditMultiple) {
       QStringList objects = _editMultipleWidget->selectedObjects();
       foreach (QString objectTag, objects) {
         CurvePtr curve = kst_cast<Curve>(_document->objectStore()->retrieveObject(ObjectTag::fromString(objectTag)));
--- branches/work/kst/portto4/kst/src/libkstapp/curvedialog.h #745170:745171
@@ -98,7 +98,6 @@
     void configureTab(ObjectPtr curve=0);
 
     CurveTab *_curveTab;
-    bool _editMultipleMode;
 };
 
 }
--- branches/work/kst/portto4/kst/src/libkstapp/datadialog.cpp #745170:745171
@@ -134,10 +134,12 @@
   if (!extensionWidget()->isVisible()) {
     setMaximumWidth(currentWidth - extensionWidth);
     setMinimumWidth(currentWidth - extensionWidth);
+    _mode = Edit;
     emit editSingleMode();
   } else {
     setMinimumWidth(currentWidth + extensionWidth);
     setMaximumWidth(currentWidth + extensionWidth);
+    _mode = EditMultiple;
     emit editMultipleMode();
   }
 }
--- branches/work/kst/portto4/kst/src/libkstapp/datadialog.h #745170:745171
@@ -29,7 +29,7 @@
 class KST_EXPORT DataDialog : public Dialog {
   Q_OBJECT
   public:
-    enum EditMode { New, Edit };
+    enum EditMode { New, Edit, EditMultiple };
     DataDialog(ObjectPtr dataObject = 0, QWidget *parent = 0);
     virtual ~DataDialog();
 
--- branches/work/kst/portto4/kst/src/libkstapp/matrixdialog.cpp #745170:745171
@@ -540,7 +540,7 @@
 
 
 MatrixDialog::MatrixDialog(ObjectPtr dataObject, QWidget *parent)
-  : DataDialog(dataObject, parent), _editMultipleMode(false) {
+  : DataDialog(dataObject, parent) {
 
   if (editMode() == Edit)
     setWindowTitle(tr("Edit Matrix"));
@@ -640,14 +640,12 @@
 void MatrixDialog::editMultipleMode() {
   _matrixTab->enableSingleEditOptions(false);
   _matrixTab->clearTabValues();
-  _editMultipleMode = true;
 }
 
 
 void MatrixDialog::editSingleMode() {
   _matrixTab->enableSingleEditOptions(true);
    configureTab(dataObject());
-  _editMultipleMode = false;
 }
 
 
@@ -768,7 +766,7 @@
 
 ObjectPtr MatrixDialog::editExistingDataObject() const {
   if (DataMatrixPtr dataMatrix = kst_cast<DataMatrix>(dataObject())) {
-    if (_editMultipleMode) {
+    if (editMode() == EditMultiple) {
       QStringList objects = _editMultipleWidget->selectedObjects();
       foreach (QString objectTag, objects) {
         DataMatrixPtr matrix = kst_cast<DataMatrix>(_document->objectStore()->retrieveObject(ObjectTag::fromString(objectTag)));
@@ -821,7 +819,7 @@
       setDataMatrixDefaults(dataMatrix);
     }
   } else if (GeneratedMatrixPtr generatedMatrix = kst_cast<GeneratedMatrix>(dataObject())) {
-    if (_editMultipleMode) {
+    if (editMode() == EditMultiple) {
       QStringList objects = _editMultipleWidget->selectedObjects();
       foreach (QString objectTag, objects) {
         GeneratedMatrixPtr matrix = kst_cast<GeneratedMatrix>(_document->objectStore()->retrieveObject(ObjectTag::fromString(objectTag)));
--- branches/work/kst/portto4/kst/src/libkstapp/matrixdialog.h #745170:745171
@@ -177,7 +177,6 @@
 
   private:
     MatrixTab *_matrixTab;
-    bool _editMultipleMode;
 };
 
 }
--- branches/work/kst/portto4/kst/src/libkstapp/vectordialog.cpp #745170:745171
@@ -230,7 +230,7 @@
 
 
 VectorDialog::VectorDialog(ObjectPtr dataObject, QWidget *parent)
-  : DataDialog(dataObject, parent), _editMultipleMode(false) {
+  : DataDialog(dataObject, parent) {
 
   if (editMode() == Edit)
     setWindowTitle(tr("Edit Vector"));
@@ -283,14 +283,12 @@
 void VectorDialog::editMultipleMode() {
   _vectorTab->enableSingleEditOptions(false);
   _vectorTab->clearTabValues();
-  _editMultipleMode = true;
 }
 
 
 void VectorDialog::editSingleMode() {
   _vectorTab->enableSingleEditOptions(true);
    configureTab(dataObject());
-  _editMultipleMode = false;
 }
 
 
@@ -440,7 +438,7 @@
 
 ObjectPtr VectorDialog::editExistingDataObject() const {
   if (DataVectorPtr dataVector = kst_cast<DataVector>(dataObject())) {
-    if (_editMultipleMode) {
+    if (editMode() == EditMultiple) {
       const DataRange *dataRange = _vectorTab->dataRange();
       QStringList objects = _editMultipleWidget->selectedObjects();
       foreach (QString objectTag, objects) {
@@ -487,7 +485,7 @@
       _vectorTab->dataRange()->setWidgetDefaults();
     }
   } else if (GeneratedVectorPtr generatedVector = kst_cast<GeneratedVector>(dataObject())) {
-    if (_editMultipleMode) {
+    if (editMode() == EditMultiple) {
       QStringList objects = _editMultipleWidget->selectedObjects();
       foreach (QString objectTag, objects) {
         GeneratedVectorPtr vector = kst_cast<GeneratedVector>(_document->objectStore()->retrieveObject(ObjectTag::fromString(objectTag)));
--- branches/work/kst/portto4/kst/src/libkstapp/vectordialog.h #745170:745171
@@ -108,7 +108,6 @@
 
   private:
     VectorTab *_vectorTab;
-    bool _editMultipleMode;
 
 };
 


More information about the Kst mailing list