COPASI API  4.16.103
FunctionWidget1.cpp
Go to the documentation of this file.
1 // Copyright (C) 2010 - 2013 by Pedro Mendes, Virginia Tech Intellectual
2 // Properties, Inc., University of Heidelberg, and The University
3 // of Manchester.
4 // All rights reserved.
5 
6 // Copyright (C) 2008 - 2009 by Pedro Mendes, Virginia Tech Intellectual
7 // Properties, Inc., EML Research, gGmbH, University of Heidelberg,
8 // and The University of Manchester.
9 // All rights reserved.
10 
11 // Copyright (C) 2002 - 2007 by Pedro Mendes, Virginia Tech Intellectual
12 // Properties, Inc. and EML Research, gGmbH.
13 // All rights reserved.
14 
15 #include "FunctionWidget1.h"
16 
17 #include "copasi.h"
18 #include "listviews.h"
19 #include "CQMessageBox.h"
20 #include "FunctionWidget1.h"
21 #include "qtUtilities.h"
22 
23 #include "tex/CMathMLToTeX.h"
24 
27 #include "model/CMetab.h"
28 #include "model/CModel.h"
30 #include "function/CFunction.h"
31 #include "function/CFunctionDB.h"
32 #include "function/CKinFunction.h"
33 #include "report/CKeyFactory.h"
34 #include "utilities/CDimension.h"
35 
36 #include "CopasiFileDialog.h"
37 
38 #include <QtGui/QComboBox>
39 #include <QtGui/QToolTip>
40 
41 #define COL_NAME 0
42 #define COL_USAGE 1
43 #define COL_UNIT 2
44 
45 /*
46  * Constructs a CScanWidgetScan as a child of 'parent', with the
47  * name 'name' and widget flags set to 'f'.
48  */
49 FunctionWidget1::FunctionWidget1(QWidget* parent, const char* name, Qt::WindowFlags fl):
50  CopasiWidget(parent, name, fl),
51  flagChanged(false),
52  isValid(false),
53  mIgnoreFcnDescriptionChange(false),
54  mpFunction(NULL),
55  mKeyToCopy("")
56 {
57  setupUi(this);
58 
59  init();
60 }
61 
62 //! Destructor
64 {
65  //pdelete(mMmlWidget);
66  //pdelete(mScrollView);
68 }
69 
71 {
72  // change the default signal-slot connection
73  // disconnect(mpExpressionEMSW->mpExpressionWidget,
74  // SIGNAL(textChanged()),
75  // mpExpressionEMSW->mpExpressionWidget,
76  // SLOT(slotTextChanged()));
77  mpExpressionEMSW->mpExpressionWidget->setFunction("");
78  connect(mpExpressionEMSW->mpExpressionWidget->getValidator(), SIGNAL(stateChanged(bool)), this, SLOT(slotFcnDescriptionChanged(bool)));
79 
80  // hide all unnecessary buttons
81  mpExpressionEMSW->mpBtnExpressionObject->hide();
82  // mpExpressionEMSW->mpBtnViewExpression->hide();
83 
84  // overwrite the tip
85  mpExpressionEMSW->mpBtnSaveExpression->setToolTip(tr("save formula"));
86  mpExpressionEMSW->mpBtnEditExpression->setToolTip(tr("edit formula"));
87 
88  mpFunction = NULL;
89 }
90 
92 {
93  QColor subsColor(255, 210, 210);
94  QColor prodColor(210, 255, 210);
95  QColor modiColor(250, 250, 190);
96  QColor paraColor(210, 210, 255);
97  QColor volColor(210, 210, 255);
98  QColor timeColor(210, 210, 210);
99  QColor color;
100 
101  size_t i, j;
103 
104  // list of usages for combobox
105  QStringList Usages;
106 
107  for (i = 0; CFunctionParameter::RoleNameDisplay[i] != ""; i++)
108  {
109  if (dynamic_cast<CKinFunction *>(mpFunction) &&
111 
113  }
114 
115  //create list of data types (for combobox)
116  QStringList functionType;
117 
118  for (i = 0; CFunctionParameter::DataTypeName[i] != ""; i++)
119  functionType += (FROM_UTF8(CFunctionParameter::DataTypeName[i]));
120 
121  //find parameter units
122  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
124  assert(pDataModel != NULL);
125  CModel * pModel = pDataModel->getModel();
126  assert(pModel != NULL);
127 
133  );
134 
135  ddd.setUseHeuristics(true);
136  std::vector<std::string> units = ddd.findDimensionsBoth(pModel);
137 
139  QString qUsage;
140 
141  //C_INT32 noOffunctParams = functParam.size();
142  Table1->setRowCount((int) params.size());
143 
144  for (j = 0; j < params.size(); j++)
145  {
146  usage = params[j]->getUsage();
147 
148  if (usage == CFunctionParameter::VARIABLE &&
149  dynamic_cast<CKinFunction *>(mpFunction))
150  {
152  params[j]->setUsage(usage);
153  }
154 
156 
157  switch (usage)
158  {
160  color = subsColor;
161  break;
162 
164  color = prodColor;
165  break;
166 
168  color = modiColor;
169  break;
170 
172  color = paraColor;
173  break;
174 
176  color = volColor;
177  break;
178 
180  color = timeColor;
181  break;
182 
184  color = QColor(250, 250, 250);
185  break;
186 
187  default :
188  qUsage = "unknown";
189  color = QColor(255, 20, 20);
190  break;
191  }
192 
193  // col. 0 (name)
194  QString Name = FROM_UTF8(params[j]->getObjectName());
195 
196  if (!params[j]->isUsed())
197  Name += " (unused)";
198 
199  if (Table1->item((int) j, COL_NAME) == NULL)
200  {
201  QTableWidgetItem *newItem = new QTableWidgetItem(Name);
202  newItem->setFlags(Qt::ItemIsDragEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
203  Table1->setItem((int) j, COL_NAME, newItem);
204  }
205  else
206  Table1->item((int) j, COL_NAME)->setText(Name);
207 
208  Table1->item((int) j, COL_NAME)->setBackground(QBrush(color));
209 
210  // col. 1 (description)
211  QTableWidgetItem *newItem2 = new QTableWidgetItem();
212  newItem2->setFlags(Qt::ItemIsDragEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
213  Table1->setItem((int) j, COL_USAGE, newItem2);
214  Table1->item((int) j, COL_USAGE)->setBackground(QBrush(color));
215 
216  QComboBox *comboItem = new QComboBox(Table1);
217  comboItem->addItems(Usages);
218  comboItem->setCurrentIndex(comboItem->findText(qUsage));
219  comboItem->setDisabled(mReadOnly);
220 
221  Table1->setCellWidget((int) j, COL_USAGE, comboItem);
222 
223  // connection between comboItem and its parent, Table1
224  connect(comboItem, SIGNAL(activated(const QString &)), this, SLOT(slotTableValueChanged(const QString &)));
225  comboItem->setObjectName(QString::number(j)); // just need to save the row index
226 
227  //col. 2 (units)
228  QString strUnit = FROM_UTF8(units[j]);
229 
230  if (Table1->item((int) j, COL_UNIT) == NULL)
231  {
232  QTableWidgetItem *newItem = new QTableWidgetItem(strUnit);
233  newItem->setFlags(Qt::ItemIsDragEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
234  Table1->setItem((int) j, COL_UNIT, newItem);
235  }
236  else
237  Table1->item((int) j, COL_UNIT)->setText(strUnit);
238 
239  Table1->item((int) j, COL_UNIT)->setBackground(QBrush(color));
240  }
241 
242  Table1->horizontalHeader()->setStretchLastSection(true);
243  Table1->resizeColumnsToContents();
244  Table1->resizeRowsToContents();
245 
246  /*
247  Table1->setFixedSize(Table1->horizontalHeader()->length() + 10,
248  Table1->verticalHeader()->length() + 30);
249  */
250 
251  return true;
252 }
253 
254 //! Function to generate the text representation of the usage restrictions
256 {
257  std::vector<std::string> stringlist;
258  bool checkSubstrates = false;
259  bool checkProducts = false;
260 
261  if (RadioButton1->isChecked() == true)
262  {
263  stringlist.push_back("Only reversible reactions");
264  checkSubstrates = true;
265  checkProducts = true;
266  }
267  else if (RadioButton2->isChecked() == true)
268  {
269  stringlist.push_back("Only irreversible reactions");
270  checkSubstrates = true;
271  }
272 
273  //substrates
274  if (checkSubstrates)
275  {
277  {
278  stringlist.push_back("At least one substrate");
279  }
280  else if (mpFunction->getObjectName() != "Constant flux (irreversible)" &&
281  mpFunction->getObjectName() != "Constant flux (reversible)")
282  {
283  std::stringstream ss;
284 
286  {
287  ss << "No substrate";
288  }
289  else
290  {
291  ss << "Exactly "
293  << " substrate";
294 
296  ss << "s"; //plural
297  }
298 
299  stringlist.push_back(ss.str());
300  }
301  }
302 
303  //products
304  if (checkProducts)
305  {
307  {
308  stringlist.push_back("At least one product");
309  }
310  else if (mpFunction->getObjectName() != "Constant flux (reversible)")
311  {
312  std::stringstream ss;
313 
315  mpFunction->getObjectName() != "Constant flux (reversible)")
316  {
317  ss << "No product";
318  }
319  else
320  {
321  ss << "Exactly "
323  << " product";
324 
326  ss << "s"; //plural
327  }
328 
329  stringlist.push_back(ss.str());
330  }
331  }
332 
333  if (stringlist.size() == 0)
334  stringlist.push_back("None");
335 
336  size_t row;
337 
338  QString Restrictions("");
339  QString Separator("");
340 
341  for (row = 0; row < stringlist.size(); ++row)
342  {
343  Restrictions += Separator + FROM_UTF8(stringlist[row]);
344  Separator = ", ";
345  }
346 
347  mpEditApplicationRestrictions->setText(Restrictions);
348 
349  return true;
350 }
351 
353 {
354  switch (rev)
355  {
356  case TriUnspecified:
357  RadioButton3->setEnabled(true);
358  RadioButton3->setChecked(true);
359  break;
360 
361  case TriFalse:
362  RadioButton2->setEnabled(true);
363  RadioButton2->setChecked(true);
364  break;
365 
366  case TriTrue:
367  RadioButton1->setEnabled(true);
368  RadioButton1->setChecked(true);
369  break;
370  }
371 
372  return true;
373 }
374 
376 {
377  if (func != NULL)
378  {
380  mpFunction = dynamic_cast<CFunction *>(CEvaluationTree::copy(*func));
381  flagChanged = false;
382  }
383 
384  if (mpFunction == NULL)
385  return false;
386 
387  // function name
388  /* Insert line breaks in the function description */
389  std::string desc = mpFunction->getInfix();
390  size_t l = 0;
391  size_t n = 0;
392  size_t len = desc.length();
393 
394  while (len - l > 65)
395  {
396  n = l;
397  l = l + 65;
398 
399  while (l > n)
400  {
401  char ch = desc.at(l);
402 
403  if ((ch == '+') || (ch == '-') || (ch == '*') || (ch == '/') || (ch == ',') || (ch == ' '))
404  break;
405 
406  l--;
407  }
408 
409  // We did not find a suitable place to break the line
410  if (l == n) l += 65;
411 
412  desc.insert(l, 1, '\n');
413  }
414 
417 
418  RadioButton1->setEnabled(!mReadOnly);
419  RadioButton2->setEnabled(!mReadOnly);
420  RadioButton3->setEnabled(!mReadOnly);
421 
422  mpExpressionEMSW->setReadOnly(mReadOnly);
423 
424  // formula expression
426  mpExpressionEMSW->mpExpressionWidget->setFunction(mpFunction->getInfix());
428 
429  mpExpressionEMSW->updateWidget();
430 
431  //radio buttons
433 
434  //parameter table
436 
437  // application table
438  loadUsageTable(/*pFunction->getVariables().getUsageRanges()*/);
439 
441 
442  flagChanged = false;
443 
444  return true;
445 }
446 
448 {
449  //Parameters
450  CFunctionParameters &functParam = target->getVariables();
451  const CFunctionParameters &pfunctParam = src->getVariables();
453  size_t index;
454  size_t i, j;
455 
456  if (src->getInfix() != target->getInfix())
457  target->setInfix(src->getInfix());
458 
459  for (i = 0; i < pfunctParam.size(); i++)
460  {
461  // check if function parameter exists in pFunctionParameter
462  if ((index = functParam.findParameterByName(pfunctParam[i]->getObjectName(),
463  Type)) != C_INVALID_INDEX)
464  // match found
465  {
466  if (functParam[index]->getUsage() != pfunctParam[i]->getUsage())
467  {
468  //changed = true;
469  // update usage
470  functParam[index]->setUsage(pfunctParam[i]->getUsage());
471  //functParam[pfunctParam[i]->getObjectName()]->setUsage(functParam[i]->getUsage());
472  }
473 
474  if (functParam[index]->getType() != pfunctParam[i]->getType())
475  {
476  //changed = true;
477  // update type
478  functParam[index]->setType(pfunctParam[i]->getType());
479  }
480  }
481  else
482  {
483  // match not found
484  //changed = true;
485  functParam.add(*pfunctParam[i]);
486  }
487  }
488 
489  // remove extra parameters existing in functParam, compare functParam to pfunctParam
490  if (pfunctParam.size() != functParam.size())
491  {
492  for (j = 0; j < functParam.size(); j++)
493  {
494  if ((index = pfunctParam.findParameterByName(functParam[j]->getObjectName(),
495  Type)) == C_INVALID_INDEX)
496  // the lines below occurs if new functionParameter does not exist in pfunctParam
497  {
498  //changed = true;
499  // remove the extra parameter in functParam
500  functParam.remove(functParam[j]->getObjectName());
501  }
502  }
503  } //TODO: this is probably much too complicated
504 
505  return true;
506 }
507 
509 {
510  CFunction* func = dynamic_cast<CFunction*>(CCopasiRootContainer::getKeyFactory()->get(mKey));
511 
512  if (!func) return false;
513 
514  return (!(func->getVariables() == mpFunction->getVariables()));
515 }
516 
518 {
519  CFunction* func = dynamic_cast<CFunction*>(CCopasiRootContainer::getKeyFactory()->get(mKey));
520 
521  if (!func) return false;
522 
523  //radio buttons
524  TriLogic tmpl;
525 
526  if (RadioButton1->isChecked() == true)
527  {
528  tmpl = TriTrue;
529  }
530  else if (RadioButton2->isChecked() == true)
531  {
532  tmpl = TriFalse;
533  }
534  else
535  {
536  tmpl = TriUnspecified;
537  }
538 
539  if (tmpl != func->isReversible())
540  {
541  func->setReversible(tmpl);
542  flagChanged = true;
543  }
544 
545  if (flagChanged)
546  {
548 
550 
551  if (mpDataModel != NULL)
552  {
553  mpDataModel->changed();
554  }
555 
556  flagChanged = false;
557  }
558 
559  func->compile();
560 
561  return true;
562 }
563 
564 //************** slots for changes in the widgets *************************************
565 
566 //! Slot for changing the function description
567 
568 /*!
569  This slot function is called whenever the function description is changed.
570  */
572 {
573 
575  (mpFunction == NULL))
576  return;
577 
578  isValid = valid;
579 
580  if (isValid)
581  {
582  try
583  {
584  if (!mpFunction->setInfix(TO_UTF8(mpExpressionEMSW->getText())) ||
585  !mpFunction->compile())
586  {
587  isValid = true;
588  }
589  }
590  catch (...)
591  {
592  isValid = false;
593  }
594  }
595 
596  if (isValid)
597  {
598  flagChanged = true;
599  //parameter table
601 
602  // application table
603  loadUsageTable();
604  }
605  else
606  {
607  if (CCopasiMessage::peekLastMessage().getNumber() == MCFunction + 4)
608  {
609  CQMessageBox::critical(this, "Function Error",
610  CCopasiMessage::getLastMessage().getText().c_str(),
611  QMessageBox::Ok | QMessageBox::Default,
612  QMessageBox::NoButton);
614  }
615  }
616 }
617 
618 //! Slot for changing the table value
619 void FunctionWidget1::slotTableValueChanged(const QString &string)
620 {
621  int curRow = sender()->objectName().toInt();
622 
623  QComboBox *comboItem = (QComboBox *) sender();
624 
625  flagChanged = true;
626 
628 
629  // surely, we are in COL_USAGE... thus we don't need to check it anymore
630  CFunctionParameter::Role usage = (CFunctionParameter::Role)(comboItem->findText(string));
631  functParam[curRow]->setUsage(usage);
632 
633  //update tables
635  loadUsageTable();
636 }
637 
638 //! Slot for changing the reversibility of the function
640 {
641  loadUsageTable();
642 }
643 
644 //**************** slots for buttons *********************************************
645 
646 //! Slot for being activated wehenver New button is clicked
648 {
649  std::string name = "function_1";
650  int i = 1;
651  CFunction* pFunc;
652  CCopasiVectorN<CFunction>& FunctionList
654 
655  while (FunctionList.getIndex(name) != C_INVALID_INDEX)
656  {
657  i++;
658  name = "function_";
659  name += TO_UTF8(QString::number(i));
660  }
661 
662  CCopasiRootContainer::getFunctionList()->add(pFunc = new CKinFunction(name), true);
663 
664  std::string key = pFunc->getKey();
666  // enter(key);
668 }
669 
671 {
672  mKeyToCopy = mKey;
673 }
674 
675 //! Slot for being activated whenever Delete button is clicked
677 {
679 
680  if (pFunctionDB == NULL)
681  return;
682 
684 
685  if (pFunction == NULL)
686  return;
687 
688  QMessageBox::StandardButton choice =
689  CQMessageBox::confirmDelete(NULL, "function",
690  FROM_UTF8(pFunction->getObjectName()),
691  pFunction->getDeletedObjects());
692 
693  /* Check if user chooses to deleted Functions */
694  switch (choice)
695  {
696  case QMessageBox::Ok: // Yes or Enter
697  {
699 
701  protectedNotify(ListViews::FUNCTION, ListViews::DELETE, "");//Refresh all as there may be dependencies.
702  break;
703  }
704 
705  default: // No or Escape
706  break;
707  }
708 }
709 
710 //*********** slot for editing requests on the function formula (mMmlWidget) *****
711 
712 //************************ standard interface to COPASI widgets ******************
713 
714 //! Function to update the COPASI widgets
716 {
717  if (mIgnoreUpdates) return true;
718 
719  switch (objectType)
720  {
721  case ListViews::MODEL:
722  loadFromFunction(dynamic_cast< CFunction * >(CCopasiRootContainer::getKeyFactory()->get(mKey)));
723  break;
724 
725  case ListViews::FUNCTION:
726 
727  if (key == mKey)
728  {
729  switch (action)
730  {
731  case ListViews::CHANGE:
732  loadFromFunction(dynamic_cast< CFunction * >(CCopasiRootContainer::getKeyFactory()->get(mKey)));
733  break;
734 
735  case ListViews::DELETE:
736  mKey = "";
737  break;
738 
739  default:
740  break;
741  }
742  }
743 
744  break;
745 
746  default:
747  break;
748  }
749 
750  return true;
751 }
752 
754 {
755  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
756  CModel * pModel = (*CCopasiRootContainer::getDatamodelList())[0]->getModel();
757 
758  if (pModel == NULL)
759  return true;
760 
761  // :TODO: We should check what changes have been done to the function //
763 
764  if (pFunctionDB == NULL)
765  return true;
766 
768 
769  if (pFunction == NULL)
770  return true;
771 
772  bool Used = false;
773 
775  {
776  QString msg =
777  QString("Cannot modify function: \n %1\n").arg(FROM_UTF8(pFunction->getObjectName()));
778 
779  std::set< const CCopasiObject * > Functions;
780  std::set< const CCopasiObject * > Reactions;
781  std::set< const CCopasiObject * > Metabolites;
782  std::set< const CCopasiObject * > Values;
783  std::set< const CCopasiObject * > Compartments;
784  std::set< const CCopasiObject * > Events;
785 
786  std::set< const CCopasiObject * > DeletedObjects = pFunction->getDeletedObjects();
787 
788  Used |= pFunctionDB->appendDependentFunctions(DeletedObjects, Functions);
789 
790  if (Functions.size() > 0)
791  {
792  msg.append("Following functions(s) reference above:\n ");
793 
794  std::set< const CCopasiObject * >::const_iterator it = Functions.begin();
795  std::set< const CCopasiObject * >::const_iterator end = Functions.end();
796 
797  for (; it != end; ++it)
798  {
799  msg.append(FROM_UTF8((*it)->getObjectName()));
800  msg.append("\n ");
801  }
802 
803  msg.remove(msg.length() - 2, 2);
804  }
805 
806  Used |= pModel->appendDependentModelObjects(DeletedObjects, Reactions, Metabolites,
807  Compartments, Values, Events);
808 
809  if (Reactions.size() > 0)
810  {
811  msg.append("Following reactions(s) reference above:\n ");
812 
813  std::set< const CCopasiObject * >::const_iterator it = Reactions.begin();
814  std::set< const CCopasiObject * >::const_iterator end = Reactions.end();
815 
816  for (; it != end; ++it)
817  {
818  msg.append(FROM_UTF8((*it)->getObjectName()));
819  msg.append("\n ");
820  }
821 
822  msg.remove(msg.length() - 2, 2);
823  }
824 
825  if (Metabolites.size() > 0)
826  {
827  msg.append("Following species reference above:\n ");
828 
829  std::set< const CCopasiObject * >::const_iterator it = Metabolites.begin();
830  std::set< const CCopasiObject * >::const_iterator end = Metabolites.end();
831 
832  for (; it != end; ++it)
833  {
834  msg.append(FROM_UTF8((*it)->getObjectName()));
835  msg.append("\n ");
836  }
837 
838  msg.remove(msg.length() - 2, 2);
839  }
840 
841  if (Values.size() > 0)
842  {
843  msg.append("Following global quantities reference above:\n ");
844 
845  std::set< const CCopasiObject * >::const_iterator it = Values.begin();
846  std::set< const CCopasiObject * >::const_iterator end = Values.end();
847 
848  for (; it != end; ++it)
849  {
850  msg.append(FROM_UTF8((*it)->getObjectName()));
851  msg.append("\n ");
852  }
853 
854  msg.remove(msg.length() - 2, 2);
855  }
856 
857  if (Compartments.size() > 0)
858  {
859  msg.append("Following compartment(s) reference above:\n ");
860 
861  std::set< const CCopasiObject * >::const_iterator it = Compartments.begin();
862  std::set< const CCopasiObject * >::const_iterator end = Compartments.end();
863 
864  for (; it != end; ++it)
865  {
866  msg.append(FROM_UTF8((*it)->getObjectName()));
867  msg.append("\n ");
868  }
869 
870  msg.remove(msg.length() - 2, 2);
871  }
872 
873  if (Events.size() > 0)
874  {
875  msg.append("Following event(s) reference above:\n ");
876 
877  std::set< const CCopasiObject * >::const_iterator it = Events.begin();
878  std::set< const CCopasiObject * >::const_iterator end = Events.end();
879 
880  for (; it != end; ++it)
881  {
882  msg.append(FROM_UTF8((*it)->getObjectName()));
883  msg.append("\n ");
884  }
885 
886  msg.remove(msg.length() - 2, 2);
887  }
888 
889  if (Used)
890  {
891  CQMessageBox::information(this, "Modification not possible",
892  msg, QMessageBox::Ok, QMessageBox::Ok);
893 
894  return true;
895  }
896  }
897 
898  if (isValid)
899  {
900  saveToFunction();
901  mpExpressionEMSW->updateWidget();
902  }
903 
904  //update pFunction values
905 
906  /* Remove line breaks from the function description */
907  /*std::string desc = TO_UTF8(textBrowser->text());
908  unsigned int loc = 0;
909  while (1)
910  {
911  loc = desc.find('\n', loc);
912  if (loc == std::string::npos)
913  break;
914  desc.erase(loc, 1);
915  }
916  textBrowser->setText(FROM_UTF8(desc));*/
917 
918  //mScrollView->hide();
919  return true;
920 }
921 
923 {
924  CFunction * func = NULL;
925 
926  if (mKeyToCopy != "")
927  {
928  func = dynamic_cast<CFunction*>(CCopasiRootContainer::getKeyFactory()->get(mKeyToCopy));
929  mKeyToCopy = "";
930  }
931  else
932  {
933  func = dynamic_cast<CFunction*>(mpObject);
934  }
935 
936  if (func)
937  return loadFromFunction(func);
938 
940  return false;
941 }
#define COL_USAGE
CModel::AreaUnit getAreaUnitEnum() const
Definition: CModel.cpp:2198
static const CCopasiMessage & peekLastMessage()
bool mIgnoreFcnDescriptionChange
void slotBtnNew()
Slot for being activated wehenver New button is clicked.
virtual bool update(ListViews::ObjectType objectType, ListViews::Action action, const std::string &key)
Function to update the COPASI widgets.
CCopasiVectorN< CFunction > & loadedFunctions()
#define pdelete(p)
Definition: copasi.h:215
virtual void slotFcnDescriptionChanged(bool)
Slot for changing the function description.
objectType
static const std::string DataTypeName[]
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
void switchToOtherWidget(const size_t &id, const std::string &key)
Definition: listviews.cpp:926
#define MCFunction
const std::string & getObjectName() const
CModel::QuantityUnit getQuantityUnitEnum() const
Definition: CModel.cpp:2331
bool loadReversibility(TriLogic rev)
CCopasiObject * get(const std::string &key)
bool isVector(CFunctionParameter::Role role) const
TriLogic
Definition: copasi.h:125
size_t findParameterByName(const std::string &name, CFunctionParameter::DataType &dataType) const
size_t getNumberOfParametersByUsage(CFunctionParameter::Role usage) const
CCopasiObject * mpObject
Definition: copasiWidget.h:64
FunctionWidget1(QWidget *parent, const char *name=0, Qt::WFlags f=0)
const CEvaluationTree::Type & getType() const
static StandardButton information(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
#define C_INVALID_INDEX
Definition: copasi.h:222
virtual size_t getIndex(const std::string &name) const
void changed(const bool &changed=true)
virtual bool setInfix(const std::string &infix)
Definition: CFunction.cpp:73
const std::string & getKey() const
Definition: CFunction.cpp:58
void setUseHeuristics(bool flag)
Definition: CDimension.cpp:330
void setReversible(const TriLogic &reversible)
Definition: CFunction.cpp:142
static void clearDeque()
CFunction * mpFunction
bool mIgnoreUpdates
Definition: copasiWidget.h:67
bool functionParametersChanged()
void add(const CFunctionParameter &parameter)
bool appendDependentModelObjects(const std::set< const CCopasiObject * > &candidates, std::set< const CCopasiObject * > &dependentReactions, std::set< const CCopasiObject * > &dependentMetabolites, std::set< const CCopasiObject * > &dependentCompartments, std::set< const CCopasiObject * > &dependentModelValues, std::set< const CCopasiObject * > &dependentEvents) const
Definition: CModel.cpp:2364
ListViews * mpListView
Definition: copasiWidget.h:62
virtual ~FunctionWidget1()
Destructor.
const TriLogic & isReversible() const
Definition: CFunction.cpp:145
static StandardButton confirmDelete(QWidget *parent, const QString &objectType, const QString &objects, const std::set< const CCopasiObject * > &deletedObjects)
static CEvaluationTree * copy(const CEvaluationTree &src)
void remove(const std::string &name)
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
CModel::LengthUnit getLengthUnitEnum() const
Definition: CModel.cpp:2220
bool appendDependentFunctions(std::set< const CCopasiObject * > candidates, std::set< const CCopasiObject * > &dependentFunctions) const
CCopasiObject::DataObjectSet getDeletedObjects() const
bool isUsable() const
virtual bool leave()
static CFunctionDB * getFunctionList()
virtual bool protectedNotify(ListViews::ObjectType objectType, ListViews::Action action, const std::string &key="")
#define COL_NAME
CCopasiDataModel * mpDataModel
Definition: copasiWidget.h:65
CModel::TimeUnit getTimeUnitEnum() const
Definition: CModel.cpp:2243
static CKeyFactory * getKeyFactory()
bool removeFunction(size_t index)
static StandardButton critical(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
void slotTableValueChanged(const QString &)
Slot for changing the table value.
static const std::string RoleNameDisplay[]
bool fl(const C_FLOAT64 &d1, const C_FLOAT64 &d2)
static CCopasiMessage getLastMessage()
virtual void slotReversibilityChanged()
Slot for changing the reversibility of the function.
virtual bool compile()
The class for handling a chemical kinetic function.
Definition: CFunction.h:29
#define TO_UTF8(__x)
Definition: qtUtilities.h:74
bool loadFromFunction(const CFunction *=NULL)
Definition: CModel.h:50
void slotBtnDelete()
Slot for being activated whenever Delete button is clicked.
virtual bool enterProtected()
CModel::VolumeUnit getVolumeUnitEnum() const
Definition: CModel.cpp:2175
std::string mKeyToCopy
bool copyFunctionContentsToFunction(const CFunction *src, CFunction *target)
std::string mKey
Definition: copasiWidget.h:63
#define COL_UNIT
const std::string & getInfix() const
CFunctionParameters & getVariables()
Definition: CFunction.cpp:148
bool loadUsageTable()
Function to generate the text representation of the usage restrictions.
bool add(CFunction *pFunction, const bool &adopt)