OSDN Git Service

[denncoCreator] reworked the code editor. Its now opened on a separate window.
[dennco/denncoCreator.git] / Source / dccellcode.cpp
index cc95a2e..7a1cfaa 100644 (file)
 
 #include "dcvccellcode.h"
 #include "dccontainer.h"
+#include "utils/dcutil.h"
 
-DCCellCode::DCCellCode(std::string theName, std::string theCellAPIName)
-    : TKCellCode(theName, theCellAPIName)
+DCCellCode::DCCellCode(DCContainer *container, std::string theName, std::string theCellAPIName)
+    : TKCellCode(theName, theCellAPIName), d_container(container)
 {
 }
 
@@ -30,12 +31,36 @@ DCCellCode::~DCCellCode()
 {
 }
 
-QString DCCellCode::getOwnScript(DCContainer *container) const
+QString DCCellCode::getOwnScript() const
 {
-    return container->readCellCodeScriptFromFile(this);
+    return d_container->readCellCodeScriptFromFile(this);
 }
 
-void DCCellCode::saveScript(DCContainer *container, const QString &script)
+bool DCCellCode::saveScript(const QString &script)
 {
-    container->saveClassScriptToWorkFile(this, script.toStdString());
+    return d_container->saveClassScriptToWorkFile(this, script.toStdString());
 }
+
+DCVCPage* DCCellCode::getPageBelonging() const
+{
+    return d_vComponent->getPageBelonging();
+}
+
+void DCCellCode::changeName(const QString &newName)
+{
+    QString fqnString = DCUtil::getFQNPath(getPageBelonging()->getLocationPath(), newName);
+    mFQNName = fqnString.toStdString();
+}
+
+void DCCellCode::changePath(const QString& newPath)
+{
+    QString name = DCUtil::getNameFromFQNPath(QString::fromStdString(mFQNName));
+    QString fqnString = DCUtil::getFQNPath(newPath, name);
+    mFQNName = fqnString.toStdString();
+}
+
+void DCCellCode::changeType(const QString &newType)
+{
+    mCellAPIName = newType.toStdString();
+}
+