File indexing completed on 2024-12-22 04:17:28

0001 /***************************************************************************
0002  *                                                                         *
0003  *   copyright : (C) 2007 The University of Toronto                        *
0004  *                   netterfield@astro.utoronto.ca                         *
0005  *                                                                         *
0006  *   This program is free software; you can redistribute it and/or modify  *
0007  *   it under the terms of the GNU General Public License as published by  *
0008  *   the Free Software Foundation; either version 2 of the License, or     *
0009  *   (at your option) any later version.                                   *
0010  *                                                                         *
0011  ***************************************************************************/
0012 
0013 #include "curvedialog.h"
0014 
0015 #include "dialogpage.h"
0016 #include "editmultiplewidget.h"
0017 
0018 #include "curve.h"
0019 
0020 #include "view.h"
0021 #include "plotitem.h"
0022 #include "tabwidget.h"
0023 #include "mainwindow.h"
0024 #include "application.h"
0025 #include "plotrenderitem.h"
0026 
0027 #include "datacollection.h"
0028 #include "document.h"
0029 #include "objectstore.h"
0030 #include "updatemanager.h"
0031 
0032 #include <QPushButton>
0033 
0034 namespace Kst {
0035 
0036 CurveTab::CurveTab(QWidget *parent)
0037   : DataTab(parent) {
0038 
0039   setupUi(this);
0040   setTabTitle(tr("Curve"));
0041 
0042   _xError->setAllowEmptySelection(true);
0043   _yError->setAllowEmptySelection(true);
0044 
0045   _xMinusError->setAllowEmptySelection(true);
0046   _yMinusError->setAllowEmptySelection(true);
0047 
0048   _curvePlacement->setExistingPlots(Data::self()->plotList());
0049 
0050   _xVectorLabel->setBuddy(_xVector->_vector);
0051   _yVectorLabel->setBuddy(_yVector->_vector);
0052   _xErrorLabel->setBuddy(_xError->_vector);
0053   _yErrorLabel->setBuddy(_yError->_vector);
0054   _xMinusErrorLabel->setBuddy(_xMinusError->_vector);
0055   _yMinusErrorLabel->setBuddy(_yMinusError->_vector);
0056 
0057   _xVector->setIsX(true);
0058 
0059   connect(_xVector, SIGNAL(selectionChanged(QString)), this, SIGNAL(vectorsChanged()));
0060   connect(_yVector, SIGNAL(selectionChanged(QString)), this, SIGNAL(vectorsChanged()));
0061   connect(_xMinusSameAsPlus, SIGNAL(toggled(bool)), this, SLOT(xCheckboxClicked()));
0062   connect(_yMinusSameAsPlus, SIGNAL(toggled(bool)), this, SLOT(yCheckboxClicked()));
0063 
0064   connect(_xError, SIGNAL(selectionChanged(QString)), this, SLOT(xErrorChanged()));
0065   connect(_yError, SIGNAL(selectionChanged(QString)), this, SLOT(xErrorChanged()));
0066 
0067   connect(_xVector, SIGNAL(selectionChanged(QString)), this, SIGNAL(modified()));
0068   connect(_yVector, SIGNAL(selectionChanged(QString)), this, SIGNAL(modified()));
0069   connect(_xError, SIGNAL(selectionChanged(QString)), this, SIGNAL(modified()));
0070   connect(_yError, SIGNAL(selectionChanged(QString)), this, SIGNAL(modified()));
0071   connect(_xMinusError, SIGNAL(selectionChanged(QString)), this, SIGNAL(modified()));
0072   connect(_yMinusError, SIGNAL(selectionChanged(QString)), this, SIGNAL(modified()));
0073 
0074   // if the content of any of the vector combos is changed (new or edit), update them all.
0075   connect(_xVector, SIGNAL(contentChanged()), this, SLOT(updateVectorCombos()));
0076   connect(_yVector, SIGNAL(contentChanged()), this, SLOT(updateVectorCombos()));
0077   connect(_xError, SIGNAL(contentChanged()), this, SLOT(updateVectorCombos()));
0078   connect(_yError, SIGNAL(contentChanged()), this, SLOT(updateVectorCombos()));
0079   connect(_xMinusError, SIGNAL(contentChanged()), this, SLOT(updateVectorCombos()));
0080   connect(_yMinusError, SIGNAL(contentChanged()), this, SLOT(updateVectorCombos()));
0081 
0082   connect(_curveAppearance, SIGNAL(modified()), this, SIGNAL(modified()));
0083   connect(_ignoreAutoScale, SIGNAL(stateChanged(int)), this, SIGNAL(modified()));
0084   connect(_xMinusSameAsPlus, SIGNAL(stateChanged(int)), this, SIGNAL(modified()));
0085   connect(_yMinusSameAsPlus, SIGNAL(stateChanged(int)), this, SIGNAL(modified()));
0086   connect(_manualLegendName, SIGNAL(textChanged(QString)), this, SIGNAL(modified()));
0087   connect(_autoLegend, SIGNAL(toggled(bool)), this, SIGNAL(modified()));
0088 }
0089 
0090 
0091 CurveTab::~CurveTab() {
0092 }
0093 
0094 
0095 VectorPtr CurveTab::xVector() const {
0096   return _xVector->selectedVector();
0097 }
0098 
0099 
0100 bool CurveTab::xVectorDirty() const {
0101   return _xVector->selectedVectorDirty();
0102 }
0103 
0104 
0105 void CurveTab::setXVector(VectorPtr vector) {
0106   _xVector->setSelectedVector(vector);
0107 }
0108 
0109 
0110 bool CurveTab::xVectorSelected() const {
0111   return _xVector->vectorSelected();
0112 }
0113 
0114 
0115 VectorPtr CurveTab::yVector() const {
0116   return _yVector->selectedVector();
0117 }
0118 
0119 
0120 bool CurveTab::yVectorDirty() const {
0121   return _yVector->selectedVectorDirty();
0122 }
0123 
0124 
0125 bool CurveTab::yVectorSelected() const {
0126   return _yVector->vectorSelected();
0127 }
0128 
0129 
0130 void CurveTab::setYVector(VectorPtr vector) {
0131   _yVector->setSelectedVector(vector);
0132 }
0133 
0134 
0135 VectorPtr CurveTab::xError() const {
0136   return _xError->selectedVector();
0137 }
0138 
0139 
0140 bool CurveTab::xErrorDirty() const {
0141   return _xError->selectedVectorDirty();
0142 }
0143 
0144 
0145 void CurveTab::setXError(VectorPtr vector) {
0146   _xError->setSelectedVector(vector);
0147 }
0148 
0149 
0150 VectorPtr CurveTab::yError() const {
0151   return _yError->selectedVector();
0152 }
0153 
0154 
0155 bool CurveTab::yErrorDirty() const {
0156   return _yError->selectedVectorDirty();
0157 }
0158 
0159 
0160 void CurveTab::setYError(VectorPtr vector) {
0161   _yError->setSelectedVector(vector);
0162 }
0163 
0164 
0165 VectorPtr CurveTab::xMinusError() const {
0166   return _xMinusError->selectedVector();
0167 }
0168 
0169 
0170 bool CurveTab::xMinusErrorDirty() const {
0171   return _xMinusError->selectedVectorDirty();
0172 }
0173 
0174 
0175 void CurveTab::setXMinusError(VectorPtr vector) {
0176   _xMinusError->setSelectedVector(vector);
0177 }
0178 
0179 
0180 VectorPtr CurveTab::yMinusError() const {
0181   return _yMinusError->selectedVector();
0182 }
0183 
0184 
0185 bool CurveTab::yMinusErrorDirty() const {
0186   return _yMinusError->selectedVectorDirty();
0187 }
0188 
0189 
0190 void CurveTab::setYMinusError(VectorPtr vector) {
0191   _yMinusError->setSelectedVector(vector);
0192 }
0193 
0194 
0195 void CurveTab::xCheckboxClicked() {
0196   _xMinusError->setEnabled(!_xMinusSameAsPlus->isChecked());
0197   _xMinusErrorLabel->setEnabled(!_xMinusSameAsPlus->isChecked());
0198   xErrorChanged();
0199 }
0200 
0201 
0202 void CurveTab::yCheckboxClicked() {
0203   _yMinusError->setEnabled(!_yMinusSameAsPlus->isChecked());
0204   _yMinusErrorLabel->setEnabled(!_yMinusSameAsPlus->isChecked());
0205   yErrorChanged();
0206 }
0207 
0208 
0209 void CurveTab::xErrorChanged() {
0210   if (_xMinusSameAsPlus->isChecked()) {
0211     _xMinusError->setSelectedVector(_xError->selectedVector());
0212   }
0213 }
0214 
0215 
0216 void CurveTab::yErrorChanged() {
0217   if (_yMinusSameAsPlus->isChecked()) {
0218     _yMinusError->setSelectedVector(_yError->selectedVector());
0219   }
0220 }
0221 
0222 
0223 void CurveTab::setObjectStore(ObjectStore *store) {
0224   _xVector->setObjectStore(store);
0225   _yVector->setObjectStore(store);
0226   _xError->setObjectStore(store);
0227   _yError->setObjectStore(store);
0228   _xMinusError->setObjectStore(store);
0229   _yMinusError->setObjectStore(store);
0230 }
0231 
0232 
0233 void CurveTab::hidePlacementOptions() {
0234   _curvePlacement->setVisible(false);
0235 }
0236 
0237 
0238 
0239 CurveAppearance* CurveTab::curveAppearance() const {
0240   return _curveAppearance;
0241 }
0242 
0243 
0244 CurvePlacement* CurveTab::curvePlacement() const {
0245   return _curvePlacement;
0246 }
0247 
0248 
0249 bool CurveTab::ignoreAutoScale() const {
0250   return _ignoreAutoScale->isChecked();
0251 }
0252 
0253 
0254 bool CurveTab::ignoreAutoScaleDirty() const {
0255   return _ignoreAutoScale->checkState() != Qt::PartiallyChecked;
0256 }
0257 
0258 
0259 void CurveTab::setIgnoreAutoScale(bool ignoreAutoScale) {
0260   _ignoreAutoScale->setChecked(ignoreAutoScale);
0261 }
0262 
0263 
0264 void CurveTab::clearTabValues() {
0265   _xVector->clearSelection();
0266   _yVector->clearSelection();
0267   _xError->clearSelection();
0268   _yError->clearSelection();
0269   _xMinusError->clearSelection();
0270   _yMinusError->clearSelection();
0271   _ignoreAutoScale->setCheckState(Qt::PartiallyChecked);
0272   _curveAppearance->clearValues();
0273 }
0274 
0275 void CurveTab::setPlotMode(PlotItem *plot) {
0276 
0277   _curvePlacement->setPlace(CurvePlacement::ExistingPlot);
0278   _curvePlacement->setExistingPlots(Data::self()->plotList());
0279   if (plot) {
0280     _curvePlacement->setCurrentPlot(plot);
0281   }
0282   _curveAppearance->setVisible(true);
0283   _curvePlacement->setVisible(true);
0284   _ignoreAutoScale->setVisible(true);
0285 
0286 }
0287 
0288 QString CurveTab::manualLegendName() const {
0289   if (_autoLegend->isChecked()) {
0290     return QString();
0291   } else {
0292     return _manualLegendName->text();
0293   }
0294 }
0295 
0296 void CurveTab::setManualLegendNameText(const QString &name) {
0297   _manualLegendName->setText(name);
0298 }
0299 
0300 void CurveTab::setLegendAuto(bool is_auto) {
0301   _autoLegend->setChecked(is_auto);
0302 }
0303 
0304 void CurveTab::setLegendNameVisible(bool visible) {
0305   _autoLegend->setVisible(visible);
0306   _manualLegendName->setVisible(visible);
0307   _legendLabel->setVisible(visible);
0308 }
0309 
0310 void CurveTab::updateVectorCombos() {
0311   _xVector->fillVectors();
0312   _yVector->fillVectors();
0313   _xError->fillVectors();
0314   _yError->fillVectors();
0315   _xMinusError->fillVectors();
0316   _yMinusError->fillVectors();
0317 }
0318 
0319 
0320 CurveDialog::CurveDialog(ObjectPtr dataObject, QWidget *parent)
0321   : DataDialog(dataObject, parent) {
0322 
0323   if (editMode() == Edit)
0324     setWindowTitle(tr("Edit Curve"));
0325   else
0326     setWindowTitle(tr("New Curve"));
0327 
0328   _curveTab = new CurveTab(this);
0329   addDataTab(_curveTab);
0330 
0331   if (editMode() == Edit) {
0332     configureTab(dataObject);
0333   } else {
0334     configureTab(0);
0335   }
0336 
0337   connect(_curveTab, SIGNAL(vectorsChanged()), this, SLOT(updateButtons()));
0338   connect(this, SIGNAL(editMultipleMode()), this, SLOT(editMultipleMode()));
0339   connect(this, SIGNAL(editSingleMode()), this, SLOT(editSingleMode()));
0340   connect(_curveTab, SIGNAL(modified()), this, SLOT(modified()));
0341   updateButtons();
0342 }
0343 
0344 
0345 CurveDialog::~CurveDialog() {
0346 }
0347 
0348 
0349 // QString CurveDialog::tagString() const {
0350 //   return DataDialog::tagString();
0351 // }
0352 // 
0353 
0354 void CurveDialog::editMultipleMode() {
0355   _curveTab->setLegendNameVisible(false);
0356   _curveTab->clearTabValues();
0357 }
0358 
0359 void CurveDialog::editSingleMode() {
0360   _curveTab->setLegendNameVisible(true);
0361    configureTab(dataObject());
0362 }
0363 
0364 void CurveDialog::configureTab(ObjectPtr object) {
0365   if (!object) {
0366     _curveTab->curveAppearance()->loadWidgetDefaults();
0367     _curveTab->setToLastX();
0368   } else if (CurvePtr curve = kst_cast<Curve>(object)) {
0369     _curveTab->curveAppearance()->loadWidgetDefaults();
0370     _curveTab->setXVector(curve->xVector());
0371     _curveTab->setYVector(curve->yVector());
0372     if (curve->hasXError()) {
0373       _curveTab->setXError(curve->xErrorVector());
0374     }
0375     if (curve->hasYError()) {
0376     _curveTab->setYError(curve->yErrorVector());
0377     }
0378     if (curve->hasXMinusError()) {
0379     _curveTab->setXMinusError(curve->xMinusErrorVector());
0380     }
0381     if (curve->hasYMinusError()) {
0382       _curveTab->setYMinusError(curve->yMinusErrorVector());
0383     }
0384     _curveTab->setIgnoreAutoScale(curve->ignoreAutoScale());
0385     _curveTab->curveAppearance()->setColor(curve->color());
0386     _curveTab->curveAppearance()->setHeadColor(curve->headColor());
0387     _curveTab->curveAppearance()->setShowPoints(curve->hasPoints());
0388     _curveTab->curveAppearance()->setShowLines(curve->hasLines());
0389     _curveTab->curveAppearance()->setShowBars(curve->hasBars());
0390     _curveTab->curveAppearance()->setShowHead(curve->hasHead());
0391     _curveTab->curveAppearance()->setLineWidth(curve->lineWidth());
0392     _curveTab->curveAppearance()->setPointSize(curve->pointSize());
0393     _curveTab->curveAppearance()->setLineStyle(curve->lineStyle());
0394     _curveTab->curveAppearance()->setPointType(curve->pointType());
0395     _curveTab->curveAppearance()->setPointDensity(curve->pointDensity());
0396     _curveTab->curveAppearance()->setBarFillColor(curve->barFillColor());
0397     _curveTab->curveAppearance()->setHeadType(curve->headType());
0398     _curveTab->setManualLegendNameText(curve->legendName(true, true));
0399     _curveTab->setLegendAuto(curve->manualLegendName().isEmpty());
0400     _curveTab->hidePlacementOptions();
0401     if (_editMultipleWidget) {
0402       CurveList objects = _document->objectStore()->getObjects<Curve>();
0403       _editMultipleWidget->clearObjects();
0404       foreach(CurvePtr object, objects) {
0405         _editMultipleWidget->addObject(object->Name(), object->descriptionTip());
0406       }
0407     }
0408   }
0409 }
0410 
0411 
0412 void CurveDialog::setVector(VectorPtr vector) {
0413   _curveTab->setYVector(vector);
0414 }
0415 
0416 void CurveDialog::setPlotMode(PlotItem *plot) {
0417   _curveTab->setPlotMode(plot);
0418 
0419 }
0420 
0421 
0422 void CurveDialog::updateButtons() {
0423   _buttonBox->button(QDialogButtonBox::Ok)->setEnabled(dialogValid());
0424 }
0425 
0426 
0427 bool CurveDialog::dialogValid() const {
0428   bool valid = (_curveTab->xVectorSelected() && _curveTab->yVectorSelected()) || (editMode() == EditMultiple);
0429   return (valid);
0430 }
0431 
0432 
0433 ObjectPtr CurveDialog::createNewDataObject() {
0434   Q_ASSERT(_document && _document->objectStore());
0435 
0436   ObjectStore *os = _document->objectStore();
0437   CurvePtr curve = os->createObject<Curve>();
0438 
0439   curve->setXVector(_curveTab->xVector());
0440   curve->setYVector(_curveTab->yVector());
0441   curve->setXError(_curveTab->xError());
0442   curve->setYError(_curveTab->yError());
0443   curve->setXMinusError(_curveTab->xMinusError());
0444   curve->setYMinusError(_curveTab->yMinusError());
0445   curve->setColor(_curveTab->curveAppearance()->color());
0446   curve->setHeadColor(_curveTab->curveAppearance()->headColor());
0447   curve->setHasPoints(_curveTab->curveAppearance()->showPoints());
0448   curve->setHasLines(_curveTab->curveAppearance()->showLines());
0449   curve->setHasBars(_curveTab->curveAppearance()->showBars());
0450   curve->setHasHead(_curveTab->curveAppearance()->showHead());
0451   curve->setLineWidth(_curveTab->curveAppearance()->lineWidth());
0452   curve->setPointSize(_curveTab->curveAppearance()->pointSize());
0453   curve->setLineStyle(_curveTab->curveAppearance()->lineStyle());
0454   curve->setPointType(_curveTab->curveAppearance()->pointType());
0455   curve->setPointDensity(_curveTab->curveAppearance()->pointDensity());
0456   curve->setBarFillColor(_curveTab->curveAppearance()->barFillColor());
0457   curve->setHeadType(_curveTab->curveAppearance()->headType());
0458   curve->setIgnoreAutoScale(_curveTab->ignoreAutoScale());
0459   curve->setManualLegendName(_curveTab->manualLegendName());
0460 
0461   if (DataDialog::tagStringAuto()) {
0462      curve->setDescriptiveName(QString());
0463   } else {
0464      curve->setDescriptiveName(DataDialog::tagString());
0465   }
0466 
0467   curve->writeLock();
0468   curve->registerChange();
0469   curve->unlock();
0470 
0471   _curveTab->curveAppearance()->setWidgetDefaults(true);
0472 
0473   if(editMode()==New) {
0474       PlotItem *plotItem = 0;
0475       switch (_curveTab->curvePlacement()->place()) {
0476       case CurvePlacement::NoPlot:
0477           break;
0478       case CurvePlacement::ExistingPlot:
0479       {
0480           plotItem = static_cast<PlotItem*>(_curveTab->curvePlacement()->existingPlot());
0481           break;
0482       }
0483       case CurvePlacement::NewPlotNewTab:
0484           _document->createView();
0485           // fall through to case NewPlot.
0486       case CurvePlacement::NewPlot:
0487       {
0488           CreatePlotForCurve *cmd = new CreatePlotForCurve();
0489           cmd->createItem();
0490 
0491           plotItem = static_cast<PlotItem*>(cmd->item());
0492           if (_curveTab->curvePlacement()->scaleFonts()) {
0493               plotItem->view()->resetPlotFontSizes(plotItem);
0494               plotItem->view()->configurePlotFontDefaults(plotItem); // copy plots already in window
0495           }
0496           break;
0497       }
0498       default:
0499           break;
0500       }
0501 
0502       if (_curveTab->curvePlacement()->place() != CurvePlacement::NoPlot) {
0503           PlotRenderItem *renderItem = plotItem->renderItem(PlotRenderItem::Cartesian);
0504           renderItem->addRelation(kst_cast<Relation>(curve));
0505           plotItem->update();
0506 
0507           if (_curveTab->curvePlacement()->place() != CurvePlacement::ExistingPlot) {
0508               plotItem->view()->appendToLayout(_curveTab->curvePlacement()->layout(), plotItem, _curveTab->curvePlacement()->gridColumns());
0509               if (_curveTab->curvePlacement()->layout() == CurvePlacement::Custom) {
0510                 plotItem->createCustomLayout(_curveTab->curvePlacement()->gridColumns());
0511               }
0512           }
0513       }
0514   }
0515 
0516   return ObjectPtr(curve.data());
0517 }
0518 
0519 
0520 ObjectPtr CurveDialog::editExistingDataObject() const {
0521   if (CurvePtr curve = kst_cast<Curve>(dataObject())) {
0522     if (editMode() == EditMultiple) {
0523       QStringList objects = _editMultipleWidget->selectedObjects();
0524       foreach (const QString &objectName, objects) {
0525         CurvePtr curve = kst_cast<Curve>(_document->objectStore()->retrieveObject(objectName));
0526         if (curve) {
0527           VectorPtr xVector = _curveTab->xVectorDirty() ? _curveTab->xVector() : curve->xVector();
0528           VectorPtr yVector = _curveTab->yVectorDirty() ? _curveTab->yVector() : curve->yVector();
0529 
0530           VectorPtr xError = 0;
0531           if (_curveTab->xErrorDirty()) {
0532             xError = _curveTab->xError();
0533           } else if (curve->hasXError()) {
0534             xError = curve->xErrorVector();
0535           }
0536           VectorPtr yError = 0;
0537           if (_curveTab->yErrorDirty()) {
0538             yError = _curveTab->yError();
0539           } else if (curve->hasYError()) {
0540             yError = curve->yErrorVector();
0541           }
0542           VectorPtr xMinusError = 0;
0543           if (_curveTab->xMinusErrorDirty()) {
0544             xMinusError = _curveTab->xMinusError();
0545           } else if (curve->hasXMinusError()) {
0546             xMinusError = curve->xMinusErrorVector();
0547           }
0548           VectorPtr yMinusError = 0;
0549           if (_curveTab->yMinusErrorDirty()) {
0550             yMinusError = _curveTab->yMinusError();
0551           } else if (curve->hasYMinusError()) {
0552             yMinusError = curve->yMinusErrorVector();
0553           }
0554 
0555           QColor color = _curveTab->curveAppearance()->colorDirty() ? _curveTab->curveAppearance()->color() : curve->color();
0556           QColor headColor = _curveTab->curveAppearance()->headColorDirty() ? _curveTab->curveAppearance()->headColor() : curve->headColor();
0557           QColor barFillColor = _curveTab->curveAppearance()->barFillColorDirty() ? _curveTab->curveAppearance()->barFillColor() : curve->barFillColor();
0558 
0559           int lineWidth = _curveTab->curveAppearance()->lineWidthDirty() ?  _curveTab->curveAppearance()->lineWidth() : curve->lineWidth();
0560           double pointSize = _curveTab->curveAppearance()->pointSizeDirty() ?  _curveTab->curveAppearance()->pointSize() : curve->pointSize();
0561           int lineStyle = _curveTab->curveAppearance()->lineStyleDirty() ?  _curveTab->curveAppearance()->lineStyle() : curve->lineStyle();
0562           int pointType = _curveTab->curveAppearance()->pointTypeDirty() ?  _curveTab->curveAppearance()->pointType() : curve->pointType();
0563           int pointDensity = _curveTab->curveAppearance()->pointDensityDirty() ?  _curveTab->curveAppearance()->pointDensity() : curve->pointDensity();
0564           int headType = _curveTab->curveAppearance()->headTypeDirty() ?  _curveTab->curveAppearance()->headType() : curve->headType();
0565 
0566           bool showPoints = _curveTab->curveAppearance()->showPointsDirty() ?  _curveTab->curveAppearance()->showPoints() : curve->hasPoints();
0567           bool showLines = _curveTab->curveAppearance()->showLinesDirty() ?  _curveTab->curveAppearance()->showLines() : curve->hasLines();
0568           bool showBars = _curveTab->curveAppearance()->showBarsDirty() ?  _curveTab->curveAppearance()->showBars() : curve->hasBars();
0569           bool showHead = _curveTab->curveAppearance()->showHeadDirty() ?  _curveTab->curveAppearance()->showHead() : curve->hasHead();
0570           bool ignoreAutoScale = _curveTab->ignoreAutoScaleDirty() ?  _curveTab->ignoreAutoScale() : curve->ignoreAutoScale();
0571 
0572           curve->writeLock();
0573           curve->setXVector(xVector);
0574           curve->setYVector(yVector);
0575           curve->setXError(xError);
0576           curve->setYError(yError);
0577           curve->setXMinusError(xMinusError);
0578           curve->setYMinusError(yMinusError);
0579           curve->setColor(color);
0580           curve->setHeadColor(headColor);
0581           curve->setBarFillColor(barFillColor);
0582           curve->setHasPoints(showPoints);
0583           curve->setHasLines(showLines);
0584           curve->setHasBars(showBars);
0585           curve->setHasHead(showHead);
0586           curve->setLineWidth(lineWidth);
0587           curve->setPointSize(pointSize);
0588           curve->setLineStyle(lineStyle);
0589           curve->setPointType(pointType);
0590           curve->setPointDensity(pointDensity);
0591           curve->setHeadType(headType);
0592           curve->setIgnoreAutoScale(ignoreAutoScale);
0593           if (DataDialog::tagStringAuto()) {
0594              curve->setDescriptiveName(QString());
0595           } else {
0596              curve->setDescriptiveName(DataDialog::tagString());
0597           }
0598 
0599           curve->registerChange();
0600           curve->unlock();
0601         }
0602       }
0603     } else {
0604       curve->writeLock();
0605       curve->setXVector(_curveTab->xVector());
0606       curve->setYVector(_curveTab->yVector());
0607       curve->setXError(_curveTab->xError());
0608       curve->setYError(_curveTab->yError());
0609       curve->setXMinusError(_curveTab->xMinusError());
0610       curve->setYMinusError(_curveTab->yMinusError());
0611       curve->setColor(_curveTab->curveAppearance()->color());
0612       curve->setHeadColor(_curveTab->curveAppearance()->headColor());
0613       curve->setBarFillColor(_curveTab->curveAppearance()->barFillColor());
0614       curve->setHasPoints(_curveTab->curveAppearance()->showPoints());
0615       curve->setHasLines(_curveTab->curveAppearance()->showLines());
0616       curve->setHasBars(_curveTab->curveAppearance()->showBars());
0617       curve->setHasHead(_curveTab->curveAppearance()->showHead());
0618       curve->setLineWidth(_curveTab->curveAppearance()->lineWidth());
0619       curve->setPointSize(_curveTab->curveAppearance()->pointSize());
0620       curve->setLineStyle(_curveTab->curveAppearance()->lineStyle());
0621       curve->setPointType(_curveTab->curveAppearance()->pointType());
0622       curve->setPointDensity(_curveTab->curveAppearance()->pointDensity());
0623       curve->setHeadType(_curveTab->curveAppearance()->headType());
0624       curve->setIgnoreAutoScale(_curveTab->ignoreAutoScale());
0625       curve->setManualLegendName(_curveTab->manualLegendName());
0626 
0627       if (DataDialog::tagStringAuto()) {
0628          curve->setDescriptiveName(QString());
0629       } else {
0630          curve->setDescriptiveName(DataDialog::tagString());
0631       }
0632 
0633       curve->registerChange();
0634       curve->unlock();
0635 
0636       _curveTab->curveAppearance()->setWidgetDefaults();
0637     }
0638   }
0639 
0640   return dataObject();
0641 }
0642 
0643 }
0644 
0645 // vim: ts=2 sw=2 et