d_cellType->setText(cell->getType());
DCContainer *container = d_creator->getCurrentContainer();
- if (container->isScriptableCell(cell))
+ if (container->getIsScriptableCell(cell))
{
d_tabWidget->setCurrentTabReadOnly(false);
if (cell->getIsCellCodeAssgined())
}
}
-bool DCContainer::isScriptableCell(DCCell *cell) const
+bool DCContainer::getIsScriptableCell(const DCCell *cell) const
{
- bool noScript = false;
-
- std::string type = cell->getType().toStdString();
-
- if (type == CELLTYPE_JSBASIC || type.length() == 0)
- {
- noScript = false;
- }
- else if (type == CELLTYPE_IN)
- {
- noScript = true;
- }
- else if (type == CELLTYPE_OUT)
- {
- noScript = true;
- }
- else if (type == CELLTYPE_BASICSTORAGE)
- {
- noScript = false;
- }
- else if (type == CELLTYPE_PLUGIN_IN)
- {
- noScript = true;
- }
- else if (type == CELLTYPE_PLUGIN_OUT)
- {
- noScript = true;
- }
- else
- {
- Q_ASSERT(0);
- }
- return !noScript;
+ return getIsScriptable(cell->getType());
}
void DCContainer::setContent(DCContent *content)
QMutexLocker lock(d_scene->getSceneLock());
DCCell *cell = dynamic_cast<DCCell*>(TKContainer::addCell(theLocation, theName, cellCode, customScript));
-
- saveCustomScriptToWorkFile(cell, customScript);
+ if (cell)
+ saveCustomScriptToWorkFile(cell, customScript);
return cell;
}
QMutexLocker lock(d_scene->getSceneLock());
DCCellCode *cellCode = dynamic_cast<DCCellCode*>(TKContainer::addCellCode(theName, theAPIType, code));
-
- saveClassScriptToWorkFile(cellCode, code);
+ if (cellCode)
+ saveClassScriptToWorkFile(cellCode, code);
return cellCode;
}
{
std::string t = type.toStdString();
+ if (t.length() == 0)
+ {
+ return true;
+ }
+
if (t == TKContainer::CELLTYPE_JSBASIC)
{
return true;
virtual float getValue(std::string key) const { Q_UNUSED(key); return 0; }
TKCellCode* getEmptyCellCodeClass() const { return mEmptyCellClass; }
- bool isScriptableCell(DCCell *cell) const;
+ bool getIsScriptableCell(const DCCell *cell) const;
QString getWorkFilePathForCustomScript(const DCCell *cell) const;
QString getWorkFilePathForCellCode(const DCCellCode *cellcode) const;