24 #include <QtGui/QWidget>
60 setObjectName(
"ReactionsWidget1");
62 setWindowTitle(trUtf8(
"ReactionsWidget1"));
80 if (!reaction)
return false;
97 mpFast->setChecked(reaction->
isFast());
106 if (reac == NULL)
return true;
108 if (!LineEdit2->isValid())
return false;
110 LineEdit2->slotForceUpdate();
116 assert(pDataModel != NULL);
120 if (pModel == NULL)
return false;
122 if (reac->
isFast() != mpFast->isChecked())
124 reac->
setFast(mpFast->isChecked());
133 if (DeletedParameters.size() != 0)
135 QString ObjectType =
"parameter(s)";
138 std::set< const CCopasiObject * >::const_iterator itParameter, endParameter = DeletedParameters.end();
139 std::set< const CCopasiObject * > DeletedObjects;
141 for (itParameter = DeletedParameters.begin(); itParameter != endParameter; ++itParameter)
143 Objects.append(
FROM_UTF8((*itParameter)->getObjectName()) +
", ");
144 DeletedObjects.insert(static_cast< const CCopasiObject * >((*itParameter)->getObject(
CCopasiObjectName(
"Reference=Value"))));
147 Objects.remove(Objects.length() - 2, 2);
149 QMessageBox::StandardButton choice =
151 Objects, DeletedObjects);
155 case QMessageBox::Ok:
157 for (itParameter = DeletedParameters.begin(); itParameter != endParameter; ++itParameter)
200 if (!this->isHidden())
207 if (!this->isHidden())
215 LineEdit2->slotForceUpdate();
239 std::string eq =
TO_UTF8(LineEdit2->text());
259 std::string name =
"reaction_1";
263 assert(pDataModel != NULL);
269 name +=
TO_UTF8(QString::number(i));
282 if (reac == NULL)
return;
288 if (pModel == NULL)
return;
292 pDialog->resize(350, pDialog->height());
293 pDialog->setToolTip(
"Cancel to re-use original species");
294 pDialog->mpLblName->setText(
"compartment");
295 pDialog->mpSelectionBox->clear();
296 pDialog->mpSelectionBox->setDuplicatesEnabled(
false);
297 pDialog->mpSelectionBox->setEditable(
false);
309 QStringList SelectionList;
312 for (; Compartment_it != end; ++Compartment_it)
314 SelectionList.append(
FROM_UTF8((*Compartment_it)->getObjectName()));
321 int origCompartmentIndex;
327 for (MetabIt = substratesToCopy.
begin(); MetabIt != substratesToCopy.
end(); MetabIt++)
329 pDialog->setWindowTitle(
"Create copy of " +
FROM_UTF8((*MetabIt)->getMetabolite()->getObjectName()) +
"?");
330 origCompartment = (*MetabIt)->getMetabolite()->getCompartment();
332 pDialog->mpSelectionBox->setCurrentIndex(origCompartmentIndex);
334 Compartment_it = Compartments.
begin();
336 if (pDialog->exec() != QDialog::Rejected)
340 if (origCompartmentIndex != pDialog->mpSelectionBox->currentIndex())
343 origToCopyMapping.
add(origCompartment, *(Compartment_it + pDialog->mpSelectionBox->currentIndex()));
346 sourceObjects.
addMetab((*MetabIt)->getMetabolite());
347 cModelExpObj.
duplicateMetab((*MetabIt)->getMetabolite(),
"_copy", sourceObjects, origToCopyMapping);
353 for (MetabIt = productsToCopy.
begin(); MetabIt != productsToCopy.
end(); MetabIt++)
355 pDialog->setWindowTitle(
"Create copy of " +
FROM_UTF8((*MetabIt)->getMetabolite()->getObjectName()) +
"?");
356 origCompartment = (*MetabIt)->getMetabolite()->getCompartment();
358 pDialog->mpSelectionBox->setCurrentIndex(origCompartmentIndex);
360 Compartment_it = Compartments.
begin();
362 if (pDialog->exec() != QDialog::Rejected)
364 if (origCompartmentIndex != pDialog->mpSelectionBox->currentIndex())
367 origToCopyMapping.
add(origCompartment, *(Compartment_it + pDialog->mpSelectionBox->currentIndex()));
370 sourceObjects.
addMetab((*MetabIt)->getMetabolite());
371 cModelExpObj.
duplicateMetab((*MetabIt)->getMetabolite(),
"_copy", sourceObjects, origToCopyMapping);
377 for (MetabIt = modifiersToCopy.
begin(); MetabIt != modifiersToCopy.
end(); MetabIt++)
379 pDialog->setWindowTitle(
"Create copy of " +
FROM_UTF8((*MetabIt)->getMetabolite()->getObjectName()) +
"?");
380 origCompartment = (*MetabIt)->getMetabolite()->getCompartment();
382 pDialog->mpSelectionBox->setCurrentIndex(origCompartmentIndex);
384 Compartment_it = Compartments.
begin();
386 if (pDialog->exec() != QDialog::Rejected)
388 if (origCompartmentIndex != pDialog->mpSelectionBox->currentIndex())
391 origToCopyMapping.
add(origCompartment, *(Compartment_it + pDialog->mpSelectionBox->currentIndex()));
394 sourceObjects.
addMetab((*MetabIt)->getMetabolite());
395 cModelExpObj.
duplicateMetab((*MetabIt)->getMetabolite(),
"_copy", sourceObjects, origToCopyMapping);
415 assert(pDataModel != NULL);
424 if (pReaction == NULL)
return;
426 QMessageBox::StandardButton choice =
433 case QMessageBox::Ok:
456 CheckBox->setChecked(
false);
460 CheckBox->setChecked(
true);
466 QStringList comboEntries;
470 ComboBox1->insertItems(0, comboEntries);
482 table->updateTable(*
mpRi, dynamic_cast< CReaction * >(
mpObject));
486 ComboBox1->insertItem(0,
"undefined");
487 ComboBox1->setCurrentIndex(0);
494 size_t Index = index;
495 bool SkipFillWidget =
false;
500 if (sub != 0)
return;
505 SkipFillWidget =
true;
512 if (sub != 0)
return;
534 int rrr = table->currentRow();
535 int ccc = table->currentColumn();
536 table->setCurrentCell(rrr, ccc);
561 if (pReaction == NULL)
return;
565 if (pFunc == NULL)
return;
577 std::string nname = name;
587 nname +=
TO_UTF8(QString::number(i));
641 const CModel * pModel = NULL;
643 if (pReaction != NULL)
655 if (!Units.isEmpty())
656 Units =
" (" + Units +
")";
658 TextLabel8->setText(
"Flux" + Units);
660 if (pReaction != NULL)
661 LineEdit3->setText(QString::number(pReaction->
getFlux(),
'g', 10));
670 if (!Units.isEmpty())
671 Units =
" (" + Units +
")";
673 TextLabel8->setText(
"Particle Flux" + Units);
675 if (pReaction != NULL)
676 LineEdit3->setText(QString::number(pReaction->
getParticleFlux(),
'g', 10));
void setSelectionList(const QStringList &selectionList)
CCopasiContainer * getObjectAncestor(const std::string &type) const
void setChemEqString(const std::string &eq, const std::string &newFunction)
CCopasiVectorN< CFunction > & loadedFunctions()
bool createOtherObjects() const
const C_FLOAT64 & getParticleFlux() const
void switchToOtherWidget(const size_t &id, const std::string &key)
void addReaction(const CReaction *x)
const std::string & getObjectName() const
std::string getFrequencyUnitsDisplayString() const
CCopasiObject * get(const std::string &key)
virtual const std::string & getKey() const
std::string getQuantityRateUnitsDisplayString() const
void initFromReaction(const std::string &key)
virtual size_t getIndex(const std::string &name) const
const C_FLOAT64 & getFlux() const
void setLocal(size_t index)
void duplicateMetab(const CMetab *source, const std::string &index, const SetOfModelElements &sourceSet, ElementsMap &emap)
const std::string & getKey() const
virtual std::set< const CCopasiObject * > getDeletedObjects() const
virtual const std::string & getKey() const
static bool isValidEq(const std::string &eq)
const CCopasiVector< CChemEqElement > & getProducts() const
const std::string & getFunctionDescription() const
const CFunction * getFunction() const
void addMetab(const CMetab *x)
CFunctionParameter::Role getUsage(size_t index) const
void vectorOfStrings2QStringList(std::vector< std::string > vs, QStringList &qsl)
CReaction * createReaction(const std::string &name)
static StandardButton confirmDelete(QWidget *parent, const QString &objectType, const QString &objects, const std::set< const CCopasiObject * > &deletedObjects)
void add(const CCopasiObject *source, CCopasiObject *copy)
add a source->duplicate mapping
bool isReversible() const
void setMapping(size_t index, std::string mn)
std::string getDuplicateKey(const std::string &sourceKey) const
find the key of the duplicated object from the source object (if it exists)
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
void duplicateReaction(const CReaction *source, const std::string &index, const SetOfModelElements &sourceSet, ElementsMap &emap)
const CCopasiVector< CChemEqElement > & getSubstrates() const
static CFunctionDB * getFunctionList()
const bool & isFast() const
CCopasiVectorNS< CCompartment > & getCompartments()
void setLocalValue(size_t index, C_FLOAT64 value)
std::set< const CCopasiObject * > getDeletedParameters() const
void addCompartment(const CCompartment *x)
static CKeyFactory * getKeyFactory()
const CCopasiVector< CChemEqElement > & getModifiers() const
The class for handling a chemical kinetic function.
CCopasiVectorNS< CReaction > & getReactions()
std::string getChemEqString() const
const std::string & getFunctionName() const
void setFast(const bool &fast)
bool writeBackToReaction(CReaction *rea)
bool isLocalValue(size_t index) const
std::vector< std::string > getListOfPossibleFunctions() const
bool isMulticompartment() const
void setFunctionAndDoMapping(const std::string &fn)
const CChemEq & getChemEq() const
bool removeLocalReactionParameter(const std::string &key, const bool &recursive=true)
void setReversibility(bool rev, const std::string &newFunction)
bool removeReaction(const CReaction *pReaction, const bool &recursive=true)
void setFunctionWithEmptyMapping(const std::string &fn)
bool add(CFunction *pFunction, const bool &adopt)