示例#1
0
bool CQPlotSubwidget::saveToPlotSpec()
{
  CPlotSpecification *pspec = dynamic_cast< CPlotSpecification * >(mpObject);

  if (!pspec) return true;

  pspec->cleanup();

  //title
  if (pspec->getTitle() != TO_UTF8(titleLineEdit->text()))
    {
      pspec->setTitle(TO_UTF8(titleLineEdit->text()));
      protectedNotify(ListViews::ObjectType::PLOT, ListViews::RENAME, mObjectCN);
    }

  //active?
  pspec->setActive(activeCheckBox->isChecked());
  //scales
  pspec->setLogX(checkLogX->isChecked());
  pspec->setLogY(checkLogY->isChecked());
  // task types
  pspec->setTaskTypes(mTaskTypes);

  //curves
  CPlotItem *item;
  storeChanges();
  QMap<QString, CPlotItem *>::iterator it;

  for (it = mList.begin(); it != mList.end(); ++it)
    {
      CPlotItem *currentItem = (*it);

      if (currentItem == NULL) continue;

      item = new CPlotItem(*currentItem, NO_PARENT);
      pspec->getItems().add(item, true);
    }

  // :TODO Bug 322: This should only be called when actual changes have been saved.
  // However we do not check whether the scan item are changed we delete all
  // and create them new.
  if (true)
    {
      if (mpDataModel != NULL)
        {
          mpDataModel->changed();
        }

      // mChanged = false;
    }

  return true;
}
示例#2
0
CPlotSpecification::CPlotSpecification(const CPlotSpecification & src,
                                       const CCopasiContainer * pParent):
    CPlotItem(src, pParent),
    items(src.getItems(), this),
    mActive(src.mActive)
{initObjects();}