OSDN Git Service

[denncoCreator] Implemented change cell and cell code type command functionality.
authortkawata <tkawata@users.sourceforge.jp>
Mon, 15 Oct 2012 23:46:29 +0000 (08:46 +0900)
committertkawata <tkawata@users.sourceforge.jp>
Mon, 15 Oct 2012 23:46:29 +0000 (08:46 +0900)
25 files changed:
Source/command/dceditcommands.cpp
Source/command/dceditcommands.h
Source/dccell.cpp
Source/dccell.h
Source/dccellcode.cpp
Source/dccellcode.h
Source/dccontainer.cpp
Source/dccontainer.h
Source/dccontainersaver.cpp
Source/dccreator.cpp
Source/dccreator.h
Source/denncoCreator.pro
Source/dialog/dcaddcellcodeclassdialog.cpp
Source/dialog/dcaddcelldialog.cpp
Source/utils/dccommandutil.cpp
Source/utils/dccommandutil.h
Source/visualizer/toolwindow/dccellcodetypecombobox.cpp [new file with mode: 0644]
Source/visualizer/toolwindow/dccellcodetypecombobox.h [new file with mode: 0644]
Source/visualizer/toolwindow/dccelltypecombobox.cpp [new file with mode: 0644]
Source/visualizer/toolwindow/dccelltypecombobox.h [new file with mode: 0644]
Source/visualizer/toolwindow/dctoolwindowbase.cpp
Source/visualizer/toolwindow/dctoolwindowcellcodeeditor.cpp
Source/visualizer/toolwindow/dctoolwindowcellcodeeditor.h
Source/visualizer/toolwindow/dctoolwindowcelleditor.cpp
Source/visualizer/toolwindow/dctoolwindowcelleditor.h

index a4a9e9a..cfd0e5f 100644 (file)
@@ -317,6 +317,31 @@ void DCMoveCellCodeClassCommand::undo()
 
 }
 
+
+/*--------------------------------*/
+
+DCChangeCellCodeClassTypeCommand::DCChangeCellCodeClassTypeCommand(const void *requester, DCCreator *creator, DCCellCode *cellCode, const QString& newType)
+    : DCCommand(requester, creator), d_cellCode(cellCode), d_type(newType)
+{
+
+}
+
+void DCChangeCellCodeClassTypeCommand::redo()
+{
+    bool r = false;
+    if (getContainer()->getIsScriptable(d_type))
+    {
+        d_cellCode->changeType(d_type);
+    }
+    setCommandResult(r ? DCCommand::DCCOMMAND_SUCCEEDED : DCCommand::DCCOMMAND_FAILED);
+}
+
+void DCChangeCellCodeClassTypeCommand::undo()
+{
+
+}
+
+
 /*--------------------------------*/
 
 DCRemoveCellCodeClassCommand::DCRemoveCellCodeClassCommand(const void *requester, DCCreator *creator, DCContainer *container, DCCellCode *cellCode)
@@ -387,6 +412,43 @@ void DCAddCellCommand::undo()
 
 /*--------------------------------*/
 
+DCChangeCellTypeCommand::DCChangeCellTypeCommand(const void *requester, DCCreator *creator, DCCell* cell, const QString &newType)
+    : DCCommand(requester, creator), d_cell(cell), d_type(newType)
+{
+
+}
+
+void DCChangeCellTypeCommand::redo()
+{
+    bool r = false;
+    if (d_cell)
+    {
+        if (!getContainer()->getIsScriptable(d_type))
+        {
+            d_cell->setCellCode(getContainer()->getEmptyCellCodeClass(), NULL);
+            d_cell->saveCustomScript("");
+        }
+
+        if (d_cell->getIsCellCodeClassAssgined())
+        {
+            //TODO
+        }
+        else
+        {
+            d_cell->changeType(d_type);
+            r = true;
+        }
+    }
+    setCommandResult(r ? DCCommand::DCCOMMAND_SUCCEEDED : DCCommand::DCCOMMAND_FAILED);
+}
+
+void DCChangeCellTypeCommand::undo()
+{
+
+}
+
+/*--------------------------------*/
+
 DCRenameCellCommand::DCRenameCellCommand(const void *requester, DCCreator *creator, DCCell *cell, const QString &newName)
     : DCCommand(requester, creator), d_cell(cell), d_name(newName)
 {
index 6c91521..6cf4fe2 100644 (file)
@@ -169,6 +169,20 @@ public:
 
 //------------------------------------------
 
+class DCChangeCellCodeClassTypeCommand : public DCCommand
+{
+    DCCellCode* d_cellCode;
+    QString     d_type;
+
+public:
+    DCChangeCellCodeClassTypeCommand(const void *requester, DCCreator *creator, DCCellCode* cellCode, const QString& newType);
+    virtual ~DCChangeCellCodeClassTypeCommand() {}
+    void undo();
+    void redo();
+};
+
+//------------------------------------------
+
 class DCRemoveCellCodeClassCommand : public DCCommand
 {
     DCContainer         *d_container;
@@ -201,6 +215,20 @@ public:
 
 //------------------------------------------
 
+class DCChangeCellTypeCommand : public DCCommand
+{
+    DCCell      *d_cell;
+    QString     d_type;
+
+public:
+    DCChangeCellTypeCommand(const void *requester, DCCreator *creator, DCCell *cell, const QString& newType);
+    virtual ~DCChangeCellTypeCommand() {}
+    void undo();
+    void redo();
+};
+
+//------------------------------------------
+
 class DCRenameCellCommand : public DCCommand
 {
     DCCell      *d_cell;
index 3242cb6..1cb2b4e 100644 (file)
@@ -104,6 +104,13 @@ DCVCPage* DCCell::getPageBelonging() const
     return d_vComponent->getPageBelonging();
 }
 
+bool DCCell::getIsCellCodeClassAssgined() const
+{
+    DCContainer *container = dynamic_cast<DCContainer*>(getContainer());
+
+    return d_cellCode && (container && d_cellCode != container->getEmptyCellCodeClass());
+}
+
 DCAxon* DCCell::getAxon() const
 {
     return dynamic_cast<DCAxon*>(mAxon);
@@ -121,7 +128,16 @@ bool DCCell::saveCustomScript(const QString &script)
 
 QString DCCell::getType() const
 {
-    return d_type;
+    DCContainer *container = dynamic_cast<DCContainer*>(getContainer());
+
+    if (d_cellCode && (container && d_cellCode != container->getEmptyCellCodeClass()))
+    {
+        return QString::fromStdString(d_cellCode->getCellAPIName());
+    }
+    else
+    {
+        return d_type;
+    }
 }
 
 float DCCell::getViewPageX() const
@@ -300,9 +316,17 @@ bool DCCell::removeAllConnections()
 void DCCell::changeName(const QString &newName)
 {
     mName = newName.toStdString();
+    d_vComponent->updateShape();
 }
 
 void DCCell::changePath(const QString &newPath)
 {
     mLocation = newPath.toStdString();
+    d_vComponent->updateShape();
+}
+
+void DCCell::changeType(const QString &type)
+{
+    d_type = type;
+    d_vComponent->updateShape();
 }
index 3899bb9..d21894a 100644 (file)
@@ -78,6 +78,7 @@ public:
     DCVPageComponent *  getVComponent() const { return d_vComponent; }
     DCVCPage*           getPageBelonging() const;
     DCCellCode*         getCellCode() const { return d_cellCode; }
+    bool                getIsCellCodeClassAssgined() const;
     DCAxon*             getAxon() const;
     std::string         getReceptorName(DCReceptor *receptor) const;
     DCReceptor*         getReceptor(const QString& receptorName);
@@ -125,6 +126,13 @@ public:
      */
     virtual DCReceptor* createReceptor(const QString &receptorName);
 
+    /**
+     * Change cell code type.
+     * change of cell's own type attribute only take effort when no cell code class is assined to this cell.
+     * In the case a cell code class is assiend to this cell, type of this cell rely on the cell code class's API type.
+     */
+    void                changeType(const QString& type);
+
 signals:
     void    cellCodeChanged();
 
index 89dcc9e..70cd81f 100644 (file)
@@ -59,3 +59,8 @@ void DCCellCode::changePath(const QString& newPath)
     mFQNName = fqnString.toStdString();
 }
 
+void DCCellCode::changeType(const QString &newType)
+{
+    mCellAPIName = newType.toStdString();
+}
+
index 6524579..1b322f3 100644 (file)
@@ -61,6 +61,12 @@ public:
     DCVCPage*           getPageBelonging() const;
     QString             getOwnScript() const;
     DCContainer*        getContainer() const { return d_container; }
+
+    /**
+      * Change the API type of this cell.
+      *
+      */
+    void                changeType(const QString& newType);
 };
 
 #endif // DCCELLCODE_H
index 29e43bd..278cb59 100644 (file)
@@ -506,3 +506,66 @@ DCVCPage* DCContainer::movePage(const QString &oldContainerBasedPathName, const
 
     return r ? newPage : NULL;
 }
+
+
+QList<QString> DCContainer::getAvailableCellTypes() const
+{
+    QList<QString> list;
+
+    list.append(QString::fromStdString(TKContainer::CELLTYPE_JSBASIC));
+    list.append(QString::fromStdString(TKContainer::CELLTYPE_BASICSTORAGE));
+    list.append(QString::fromStdString(TKContainer::CELLTYPE_IN));
+    list.append(QString::fromStdString(TKContainer::CELLTYPE_OUT));
+
+    return list;
+}
+
+bool DCContainer::getIsScriptable(const QString& type) const
+{
+    std::string t = type.toStdString();
+
+    if (t == TKContainer::CELLTYPE_JSBASIC)
+    {
+        return true;
+    }
+    else if (t == TKContainer::CELLTYPE_BASICSTORAGE)
+    {
+        return true;
+    }
+    else if (t == TKContainer::CELLTYPE_IN)
+    {
+        return false;
+    }
+    else if (t == TKContainer::CELLTYPE_OUT)
+    {
+        return false;
+    }
+
+    return false;
+}
+
+
+bool DCContainer::getIsReceptorAvailable(const QString& type) const
+{
+    std::string t = type.toStdString();
+
+    if (t == TKContainer::CELLTYPE_JSBASIC)
+    {
+        return true;
+    }
+    else if (t == TKContainer::CELLTYPE_BASICSTORAGE)
+    {
+        return true;
+    }
+    else if (t == TKContainer::CELLTYPE_IN)
+    {
+        return false;
+    }
+    else if (t == TKContainer::CELLTYPE_OUT)
+    {
+        return true;
+    }
+
+    return false;
+}
+
index 2d83520..c298994 100644 (file)
@@ -154,6 +154,32 @@ public:
     QString                 readCustomScriptFromWorkFile(const DCCell *cell);
     QString                 readCellCodeScriptFromFile(const DCCellCode *cellcode);
 
+
+    /***************************************************************************
+     * Cell type rules
+     **************************************************************************/
+
+    /**
+     * @brief return the avaiable cell types as the list of QString
+     * @return
+     */
+    QList<QString>          getAvailableCellTypes() const;
+
+    /**
+     * @brief check if given cell type can have script
+     * @param type
+     * @return true if the given cell type can have script, false if no script avaiable for the cell type.
+     */
+    bool                    getIsScriptable(const QString& type) const;
+
+    /**
+     * @brief return if the cell type can accept receptors.
+     *        The cell which inputs value from external can not receive value from internal cells.
+     * @param type
+     * @return
+     */
+    bool                    getIsReceptorAvailable(const QString& type) const;
+
 };
 
 #endif // DCCONTAINER_H
index c7efdc0..01f00f3 100644 (file)
@@ -88,7 +88,7 @@ bool DCContainerSaver::saveForPage(const QString& containerRootPath, DCVCPage *p
 
         QDomElement aCellCodeTag = doc.createElement("a");
         aCellCodeTag.setAttribute("parameter", "cellcode");
-        if (cell->getCellCode() && cell->getCellCode() != d_container->getEmptyCellCodeClass())
+        if (cell->getIsCellCodeClassAssgined())
         {
             aCellCodeTag.setAttribute("href", QString::fromStdString(cell->getCellCode()->getFQNName()));
         }
index b92ff8d..4dd03c5 100644 (file)
@@ -465,11 +465,21 @@ void DCCreator::doCommandAddCellCodeClass(const void *requester, DCContainer *co
     DCCommandUtil::postAddCellCodeClassCommand(requester, this, container, name, type);
 }
 
+void DCCreator::doCommandChangeCellCodeClassType(const void *requester, DCCellCode* cellCode, const QString &newType)
+{
+    DCCommandUtil::postChangeCellCodeClassTypeCommand(requester, this, cellCode, newType);
+}
+
 void DCCreator::doCommandAddCell(const void *requester, DCContainer *container, const QString& containerBasedPath, const QString& name, const QString& type)
 {
     DCCommandUtil::postAddCellCommand(requester, this, container, containerBasedPath, name, type);
 }
 
+void DCCreator::doCommandChangeCellType(const void *requester, DCCell *cell, const QString &newType)
+{
+    DCCommandUtil::postChangeCellTypeCommand(requester, this, cell, newType);
+}
+
 void DCCreator::doCommandRemoveCells(const void *requester, DCContainer *container, const QList<DCCell*> &cells)
 {
     DCCommandUtil::postRemoveCellsCommand(requester, this, container, cells);
index e30d7f0..1d6b1a0 100644 (file)
@@ -108,7 +108,9 @@ public:
     void doCommandUnassignCellCodeClassFromCell(const void *requester, DCCell *cell);
 
     void doCommandAddCellCodeClass(const void *requester, DCContainer *container, const QString& name, const QString& type);
+    void doCommandChangeCellCodeClassType(const void *requester, DCCellCode *cellCode, const QString& newType);
     void doCommandAddCell(const void *requester, DCContainer *container, const QString& containerBasedPath, const QString& name, const QString& type);
+    void doCommandChangeCellType(const void *requester, DCCell *cell, const QString& newType);
     void doCommandRemoveCells(const void *requester, DCContainer *container, const QList<DCCell*> &cells);
     void doCommandAddPage(const void *requester, const QString& containerBasedPath);
     void doCommandMovePage(const void *requester, const QString &oldContainerBasedPath, const QString &newContainerBasedPath);
index 1979e5f..0fb4672 100644 (file)
@@ -88,7 +88,9 @@ HEADERS       = mainwindow.h \
     dialog/dcaddcelldialog.h \
     utils/dcskeltoncreatorutil.h \
     utils/dcutil.h \
-    dccontainersaver.h
+    dccontainersaver.h \
+    visualizer/toolwindow/dccelltypecombobox.h \
+    visualizer/toolwindow/dccellcodetypecombobox.h
 
 SOURCES       = main.cpp \
                 mainwindow.cpp \
@@ -171,7 +173,9 @@ SOURCES       = main.cpp \
     dialog/dcaddcelldialog.cpp \
     utils/dcskeltoncreatorutil.cpp \
     utils/dcutil.cpp \
-    dccontainersaver.cpp
+    dccontainersaver.cpp \
+    visualizer/toolwindow/dccelltypecombobox.cpp \
+    visualizer/toolwindow/dccellcodetypecombobox.cpp
 
 RESOURCES     = denncoCreator.qrc
 
index 30d9cee..1148a04 100644 (file)
@@ -44,10 +44,7 @@ DCAddCellCodeClassDialog::DCAddCellCodeClassDialog(DCContainer *container, DCCre
     d_tableModel->setReadOnly(0,true);
 
     d_comboBox = new QComboBox;
-    d_comboBox->addItem(QString::fromStdString(TKContainer::CELLTYPE_JSBASIC), QString::fromStdString(TKContainer::CELLTYPE_JSBASIC));
-    d_comboBox->addItem(QString::fromStdString(TKContainer::CELLTYPE_BASICSTORAGE), QString::fromStdString(TKContainer::CELLTYPE_BASICSTORAGE));
-    d_comboBox->addItem(QString::fromStdString(TKContainer::CELLTYPE_IN), QString::fromStdString(TKContainer::CELLTYPE_IN));
-    d_comboBox->addItem(QString::fromStdString(TKContainer::CELLTYPE_OUT), QString::fromStdString(TKContainer::CELLTYPE_OUT));
+    d_comboBox->addItems(QStringList(d_container->getAvailableCellTypes()));
 
     DCScene *scene = container->getScene();
     const QMap<QString,DCVCPage*> *pages = scene->getPages();
index 1987efb..60e6f63 100644 (file)
     d_tableModel->setReadOnly(0,true);
 
     d_comboBox = new QComboBox;
-    d_comboBox->addItem(QString::fromStdString(TKContainer::CELLTYPE_JSBASIC), QString::fromStdString(TKContainer::CELLTYPE_JSBASIC));
-    d_comboBox->addItem(QString::fromStdString(TKContainer::CELLTYPE_BASICSTORAGE), QString::fromStdString(TKContainer::CELLTYPE_BASICSTORAGE));
-    d_comboBox->addItem(QString::fromStdString(TKContainer::CELLTYPE_IN), QString::fromStdString(TKContainer::CELLTYPE_IN));
-    d_comboBox->addItem(QString::fromStdString(TKContainer::CELLTYPE_OUT), QString::fromStdString(TKContainer::CELLTYPE_OUT));
+    d_comboBox->addItems(QStringList(d_container->getAvailableCellTypes()));
 
     DCScene *scene = container->getScene();
     const QMap<QString,DCVCPage*> *pages = scene->getPages();
index 53e288f..7abdd3f 100644 (file)
@@ -105,12 +105,24 @@ void DCCommandUtil::postAddCellCodeClassCommand(const void *requester, DCCreator
 }
 
 //static
+void DCCommandUtil::postChangeCellCodeClassTypeCommand(const void *requester, DCCreator *creator, DCCellCode *cellCode, const QString &newType)
+{
+    postEvent(creator, new DCChangeCellCodeClassTypeCommand(requester, creator, cellCode, newType));
+}
+
+//static
 void DCCommandUtil::postAddCellCommand(const void *requester, DCCreator *creator, DCContainer *container, const QString &containerBasedPath, const QString &name, const QString &type)
 {
     postEvent(creator, new DCAddCellCommand(requester, creator, container, containerBasedPath, name, type));
 }
 
 //static
+void DCCommandUtil::postChangeCellTypeCommand(const void *requester, DCCreator *creator, DCCell *cell, const QString &newType)
+{
+    postEvent(creator, new DCChangeCellTypeCommand(requester, creator, cell, newType));
+}
+
+//static
 void DCCommandUtil::postRemoveCellsCommand(const void *requester, DCCreator *creator, DCContainer *container, const QList<DCCell*> &cells)
 {
     postEvent(creator, new DCRemoveCellCommand(requester, creator, container, cells));
index 46a17c2..78922d9 100644 (file)
@@ -49,7 +49,9 @@ struct DCCommandUtil
     static void postUnassignCellCodeClassFromCellCommand(const void *requester,  DCCreator *creator, DCCell *cell);
 
     static void postAddCellCodeClassCommand(const void *requester, DCCreator *creator, DCContainer *container, const QString& name, const QString& type);
+    static void postChangeCellCodeClassTypeCommand(const void *requester, DCCreator *creator, DCCellCode *cellCode, const QString& newType);
     static void postAddCellCommand(const void *requester, DCCreator *creator, DCContainer *container, const QString& containerBasedPath, const QString& name, const QString& type);
+    static void postChangeCellTypeCommand(const void* requester, DCCreator *creator, DCCell *cell, const QString& newType);
     static void postRemoveCellsCommand(const void *requester, DCCreator *creator, DCContainer *container, const QList<DCCell*> &cells);
     static void postAddPageCommand(const void *requester, DCCreator *creator, const QString& containerBasedPath);
     static void postMovePageCommand(const void *requester, DCCreator *creator, const QString &oldContainerBasedPath, const QString& newContainerBasedPath);
diff --git a/Source/visualizer/toolwindow/dccellcodetypecombobox.cpp b/Source/visualizer/toolwindow/dccellcodetypecombobox.cpp
new file mode 100644 (file)
index 0000000..2dae202
--- /dev/null
@@ -0,0 +1,80 @@
+//  Copyright (c) 2012 Dennco Project
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+//
+//  Created by tkawata on Oct-15, 2012.
+//
+
+#include "dccellcodetypecombobox.h"
+
+#include "dccreator.h"
+#include "dccontainer.h"
+#include "dccellcode.h"
+
+DCCellCodeTypeComboBox::DCCellCodeTypeComboBox(DCCreator *creator, QWidget *parent) :
+    QComboBox(parent), d_creator(creator), d_cellCode(NULL)
+{
+    DCContainer *container = d_creator->getCurrentContainer();
+
+    QList<QString> list = creator->getCurrentContainer()->getAvailableCellTypes();
+    for (int i = 0; i < list.length(); i++)
+    {
+        if (container->getIsScriptable(list.at(i)))
+        {
+            addItem(list.at(i));
+        }
+    }
+    connect(this, SIGNAL(currentIndexChanged(QString)), this, SLOT(slotCurrentIndexChanged(QString)));
+}
+
+DCCellCodeTypeComboBox::~DCCellCodeTypeComboBox()
+{
+
+}
+
+void DCCellCodeTypeComboBox::changeType(const QString &newType)
+{
+    for (int i = 0; i < count(); i++)
+    {
+        if (itemText(i) == newType)
+        {
+            setCurrentIndex(i);
+            break;
+        }
+    }
+}
+
+void DCCellCodeTypeComboBox::setEditingCellCode(DCCellCode *cellcode)
+{
+    d_cellCode = cellcode;
+    updateSelection();
+}
+
+void DCCellCodeTypeComboBox::updateSelection()
+{
+    if (d_cellCode)
+    {
+        changeType(QString::fromStdString(d_cellCode->getCellAPIName()));
+    }
+}
+
+void DCCellCodeTypeComboBox::slotCurrentIndexChanged(const QString &newType)
+{
+    if (QString::fromStdString(d_cellCode->getCellAPIName()) != newType)
+    {
+        d_creator->doCommandChangeCellCodeClassType(this, d_cellCode, newType);
+        emit typeChanged(newType);
+    }
+}
diff --git a/Source/visualizer/toolwindow/dccellcodetypecombobox.h b/Source/visualizer/toolwindow/dccellcodetypecombobox.h
new file mode 100644 (file)
index 0000000..3427c1a
--- /dev/null
@@ -0,0 +1,52 @@
+//  Copyright (c) 2012 Dennco Project
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+//
+//  Created by tkawata on Oct-15, 2012.
+//
+
+#ifndef DCCELLCODETYPECOMBOBOX_H
+#define DCCELLCODETYPECOMBOBOX_H
+
+#include <QComboBox>
+
+class DCCreator;
+class DCCellCode;
+
+class DCCellCodeTypeComboBox : public QComboBox
+{
+    Q_OBJECT
+
+    DCCreator   *d_creator;
+    DCCellCode  *d_cellCode;
+
+    void    changeType(const QString& newType);
+
+public:
+    DCCellCodeTypeComboBox(DCCreator *creator, QWidget *parent = 0);
+    virtual ~DCCellCodeTypeComboBox();
+
+    void setEditingCellCode(DCCellCode* cellcode);
+    void updateSelection();
+
+signals:
+    void typeChanged(const QString& newType);
+
+public slots:
+    void slotCurrentIndexChanged(const QString& newType);
+    
+};
+
+#endif // DCCELLCODETYPECOMBOBOX_H
diff --git a/Source/visualizer/toolwindow/dccelltypecombobox.cpp b/Source/visualizer/toolwindow/dccelltypecombobox.cpp
new file mode 100644 (file)
index 0000000..a89ab55
--- /dev/null
@@ -0,0 +1,86 @@
+//  Copyright (c) 2012 Dennco Project
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+//
+//  Created by tkawata on Oct-15, 2012.
+//
+
+#include "dccelltypecombobox.h"
+
+#include "dccreator.h"
+#include "dccontainer.h"
+#include "dccell.h"
+
+DCCellTypeComboBox::DCCellTypeComboBox(DCCreator *creator, QWidget *parent) :
+    QComboBox(parent), d_creator(creator), d_cell(NULL)
+{
+    addItems(QStringList(creator->getCurrentContainer()->getAvailableCellTypes()));
+    connect(this, SIGNAL(currentIndexChanged(QString)), this, SLOT(slotCurrentIndexChanged(QString)));
+}
+
+DCCellTypeComboBox::~DCCellTypeComboBox()
+{
+
+}
+
+void DCCellTypeComboBox::changeType(const QString &newType)
+{
+    for (int i = 0; i < count(); i++)
+    {
+        if (itemText(i) == newType)
+        {
+            setCurrentIndex(i);
+            break;
+        }
+    }
+}
+
+void DCCellTypeComboBox::setEditingCell(DCCell *cell)
+{
+    d_cell = cell;
+    updateSelection();
+}
+
+void DCCellTypeComboBox::updateSelection()
+{
+    if (d_cell)
+    {
+        changeType(d_cell->getType());
+    }
+}
+
+void DCCellTypeComboBox::slotCurrentIndexChanged(const QString &newType)
+{
+    DCContainer *container = d_creator->getCurrentContainer();
+
+    if (d_cell->getType() != newType)
+    {
+        bool isCurrentScriptable = container->getIsScriptable(d_cell->getType());
+        bool isNewScriptable = container->getIsScriptable(newType);
+        if (isCurrentScriptable && !isNewScriptable)
+        {
+            int r = QMessageBox::warning(NULL, tr("Change cell type"),
+                                 tr("This cell type doesn't support cell code scripts. All script attached to this cell will be removed when you change this type. Do you proceed?"),
+                                 QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Cancel);
+            if (r == QMessageBox::Cancel)
+            {
+                changeType(d_cell->getType());
+                return;
+            }
+        }
+        d_creator->doCommandChangeCellType(this, d_cell, newType);
+    }
+    emit typeChanged(newType);
+}
diff --git a/Source/visualizer/toolwindow/dccelltypecombobox.h b/Source/visualizer/toolwindow/dccelltypecombobox.h
new file mode 100644 (file)
index 0000000..bc90331
--- /dev/null
@@ -0,0 +1,51 @@
+//  Copyright (c) 2012 Dennco Project
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+//
+//  Created by tkawata on Oct-15, 2012.
+//
+
+#ifndef DCCELLTYPECOMBOBOX_H
+#define DCCELLTYPECOMBOBOX_H
+
+#include <QComboBox>
+
+class DCCreator;
+class DCCell;
+
+class DCCellTypeComboBox : public QComboBox
+{
+    Q_OBJECT
+
+    DCCreator   *d_creator;
+    DCCell      *d_cell;
+
+    void    changeType(const QString& newType);
+
+public:
+    DCCellTypeComboBox(DCCreator *creator, QWidget *parent = 0);
+    virtual ~DCCellTypeComboBox();
+
+    void setEditingCell(DCCell* cell);
+    void updateSelection();
+
+signals:
+    void typeChanged(const QString& newType);
+
+public slots:
+    void slotCurrentIndexChanged(const QString& newType);
+};
+
+#endif // DCCELLTYPECOMBOBOX_H
index 22ff0cd..4b73374 100644 (file)
@@ -25,7 +25,17 @@ const static QString DialogContentStyle =
         "QPlainTextEdit {background: black;} "
         "QGroupBox { border: 1px solid gray; border-radius: 3px;} "
         "QTableView { background: black;} "
-        "QPushButton { background-color: rgb(128,128,128);} ";
+        "QPushButton { background-color: rgb(128,128,128);} "
+        "QComboBox { background-color: rgb(128,128,128); "
+        "       border: 1px solid gray;"
+        "       border-radius: 3px;"
+        "       padding: 1px 18px 1px 3px;"
+        "       }"
+        "QComboBox QAbstractItemView {"
+        "       background: rgb(128,128,128);"
+        "       color: white;"
+        "       selection-background-color: rgb(128,128,255);"
+        "}";
 
 DCToolWindowBase::DCToolWindowBase(const QString &windowTitle,DCCreator *creator)
     : QDialog(0,Qt::CustomizeWindowHint | Qt::FramelessWindowHint), d_collapsed(false), d_creator(creator)
index 716ba7b..f641a34 100644 (file)
@@ -28,6 +28,8 @@
 #include "dccreator.h"
 #include "dceditablelabel.h"
 #include "dceditabletreeview.h"
+#include "dccellcodetypecombobox.h"
+#include "dccelltypecombobox.h"
 #include "utils/dcqtitemmodel.h"
 #include "dialog/dcassigncellcodeclassdialog.h"
 
@@ -54,7 +56,7 @@ DCToolWindowCellCodeEditor::DCToolWindowCellCodeEditor(DCCreator *creator) :
     cellclassGroupBoxLayoutInnder1->addWidget(new QLabel(tr("type")), 1,0);
 
     d_uiClassName = new DCEditableLabel(this, "");
-    d_uiClassType = new DCEditableLabel(this, "");
+    d_uiClassType = new DCCellCodeTypeComboBox(creator, this);
     d_uiClassUnsetButton = new QPushButton(tr("Unset class"));
     d_uiClassUserList = new QTableView;
     cellclassGroupBoxLayoutInnder1->addWidget(d_uiClassName, 0,1);
@@ -90,7 +92,7 @@ DCToolWindowCellCodeEditor::DCToolWindowCellCodeEditor(DCCreator *creator) :
 
     d_uiCellName = new DCEditableLabel(this, "");
     d_uiCellPath = new DCEditableLabel(this, "");
-    d_uiCellType = new DCEditableLabel(this, "");
+    d_uiCellType = new DCCellTypeComboBox(creator, this);
     d_uiSwitchEditorButton = new QPushButton(tr("Open custom script"));
     cellGroupBoxLayout->addWidget(d_uiCellName, 0,1);
     cellGroupBoxLayout->addWidget(d_uiCellPath, 1,1);
@@ -136,12 +138,14 @@ DCToolWindowCellCodeEditor::DCToolWindowCellCodeEditor(DCCreator *creator) :
     connect(d_uiSwitchEditorButton, SIGNAL(clicked()), this, SLOT(switchEditor()));
     connect(d_uiClassUnsetButton, SIGNAL(clicked()), this, SLOT(unsetCellCodeButtonClicked()));
     connect(d_uiClassAssignButton, SIGNAL(clicked()), this, SLOT(assignCellCodeButtonClicked()));
+    connect(getController(), SIGNAL(commandExecuted(const QUndoCommand*)), this, SLOT(commandExecuted(const QUndoCommand*)));
 }
 
 DCToolWindowCellCodeEditor::~DCToolWindowCellCodeEditor()
 {
     d_receptors->disconnect(this);
     d_axonTerminals->disconnect(this);
+    getController()->disconnect(this);
 
     if (d_receptorItemModel)
         d_receptorItemModel->deleteLater();
@@ -163,60 +167,10 @@ void DCToolWindowCellCodeEditor::setData(DCContainer *container, DCCellCode *cel
     d_cellCodeClass = cellCodeClass;
     d_ownerCell = ownerCell;
 
-    QString titleString = "";
-
-    bool cellCodeAvaiable = true;
-
-    if (ownerCell)
-    {
-        titleString.append("CELL : ");
-        titleString.append(QString::fromStdString(d_ownerCell->getName()));
-        titleString.append("  ");
-
-        updateCellInformation();
-        d_uiCellGroupBox->setVisible(true);
-
-        cellCodeAvaiable = d_container->isScriptableCell(ownerCell);
-    }
-    else
-    {
-        d_uiCellGroupBox->setVisible(false);
-    }
+    d_uiClassType->setEditingCellCode(cellCodeClass);
+    d_uiCellType->setEditingCell(ownerCell);
+    updateInformation();
 
-
-    if (cellCodeClass && cellCodeAvaiable)
-    {
-        if (d_container->getEmptyCellCodeClass() != cellCodeClass)
-        {
-            updateClassInformation();
-            d_uiClassGroupBox->setVisible(true);
-            titleString.append("CELL CODE : ");
-            titleString.append(QString::fromStdString(cellCodeClass->getFQNName()));
-            titleString.append(" (");
-            titleString.append(QString::fromStdString(cellCodeClass->getCellAPIName()));
-            titleString.append(")");
-            d_uiClassGroupBox->layout()->itemAt(0)->widget()->setVisible(true);
-            d_uiClassGroupBox->layout()->itemAt(1)->widget()->setVisible(false);
-            d_uiClassGroupBox->adjustSize();
-        }
-        else
-        {
-            d_uiClassGroupBox->setVisible(true);
-            d_uiClassGroupBox->layout()->itemAt(0)->widget()->setVisible(false);
-            d_uiClassGroupBox->layout()->itemAt(1)->widget()->setVisible(true);
-            d_uiClassGroupBox->adjustSize();
-        }
-    }
-    else
-    {
-        d_uiClassGroupBox->setVisible(false);
-        d_uiClassGroupBox->layout()->itemAt(0)->widget()->setVisible(false);
-        d_uiClassGroupBox->layout()->itemAt(1)->widget()->setVisible(false);
-        d_editor->setPlainText("");
-        d_editor->setReadOnly(true);
-    }
-
-    setButtonedWindowTitle(titleString);
     showClassScript();
 }
 
@@ -237,42 +191,10 @@ void DCToolWindowCellCodeEditor::setData(DCContainer *container, DCCell *ownerCe
         d_cellCodeClass = ownerCell->getCellCode();
     }
 
+    d_uiClassType->setEditingCellCode(d_cellCodeClass);
+    d_uiCellType->setEditingCell(d_ownerCell);
+    updateInformation();
 
-    QString titleString = "";
-
-    if (ownerCell)
-    {
-        titleString.append("CELL : ");
-        titleString.append(QString::fromStdString(d_ownerCell->getName()));
-        titleString.append("  ");
-
-        updateCellInformation();
-        d_uiCellGroupBox->setVisible(true);
-    }
-    else
-    {
-        d_uiCellGroupBox->setVisible(false);
-    }
-
-    if (d_cellCodeClass && d_cellCodeClass != d_container->getEmptyCellCodeClass())
-    {
-        updateClassInformation();
-        d_uiClassGroupBox->setVisible(true);
-        titleString.append("CELL CODE : ");
-        titleString.append(QString::fromStdString(d_cellCodeClass->getFQNName()));
-        titleString.append(" (");
-        titleString.append(QString::fromStdString(d_cellCodeClass->getCellAPIName()));
-        titleString.append(")");
-
-    }
-    else
-    {
-        d_uiClassGroupBox->setVisible(false);
-        d_editor->setPlainText("");
-        d_editor->setReadOnly(true);
-    }
-
-    setButtonedWindowTitle(titleString);
     showCustomScript();
 }
 
@@ -281,7 +203,7 @@ void DCToolWindowCellCodeEditor::showClassScript()
     d_mode = CELLCLASS_EDIT_MODE;
     d_uiClassGroupBox->setVisible(true);
     d_uiSwitchEditorButton->setText(tr("Switch to Custom Script"));
-    if (d_cellCodeClass && d_cellCodeClass != d_container->getEmptyCellCodeClass() && d_container)
+    if (d_ownerCell->getIsCellCodeClassAssgined() && d_container)
     {
         d_editor->setPlainText(d_cellCodeClass->getOwnScript());
         d_editor->setReadOnly(false);
@@ -310,30 +232,18 @@ void DCToolWindowCellCodeEditor::showCustomScript()
     }
 }
 
-void DCToolWindowCellCodeEditor::updateClassInformation()
-{
-    if (d_cellCodeClass)
-    {
-        d_uiClassName->setText(QString::fromStdString(d_cellCodeClass->getFQNName()));
-        d_uiClassType->setText(QString::fromStdString(d_cellCodeClass->getCellAPIName()));
-    }
-    else
-    {
-        d_uiClassName->setText("");
-        d_uiClassType->setText("");
-    }
-}
-
-void DCToolWindowCellCodeEditor::updateCellInformation()
+void DCToolWindowCellCodeEditor::updateInformation()
 {
     d_receptorItemModel->removeAllItems();
     d_axonTerminalItemModel->removeAllItems();
 
+    //update cell information
     if (d_ownerCell)
     {
         d_uiCellName->setText(QString::fromStdString(d_ownerCell->getName()));
         d_uiCellPath->setText(QString::fromStdString(d_ownerCell->getLocation()));
-        d_uiCellType->setText(d_ownerCell->getType());
+        d_uiCellType->updateSelection();
+        d_uiCellType->setEnabled(!d_ownerCell->getIsCellCodeClassAssgined());
 
         d_receptorItemModel->insertString("receptors");
         d_receptorItemModel->setReadOnly(0,true);
@@ -394,10 +304,78 @@ void DCToolWindowCellCodeEditor::updateCellInformation()
     {
         d_uiCellName->setText("");
         d_uiCellPath->setText("");
-        d_uiCellType->setText("");
+        d_uiCellType->updateSelection();
+    }
+
+    //update cell code information
+    if (d_cellCodeClass)
+    {
+        d_uiClassName->setText(QString::fromStdString(d_cellCodeClass->getFQNName()));
+        d_uiClassType->updateSelection();
+    }
+    else
+    {
+        d_uiClassName->setText("");
+        d_uiClassType->updateSelection();
+    }
+
+
+    // update title and tool visibility
+    QString titleString = "";
+    if (d_ownerCell)
+    {
+        titleString.append("CELL : ");
+        titleString.append(QString::fromStdString(d_ownerCell->getName()));
+        titleString.append("  ");
+
+        d_uiCellGroupBox->setVisible(true);
+        if (d_container->isScriptableCell(d_ownerCell))
+        {
+            if (d_ownerCell->getIsCellCodeClassAssgined())
+            {
+                titleString.append("CELL CODE : ");
+                titleString.append(QString::fromStdString(d_cellCodeClass->getFQNName()));
+                titleString.append(" (");
+                titleString.append(QString::fromStdString(d_cellCodeClass->getCellAPIName()));
+                titleString.append(")");
+                d_uiClassGroupBox->setVisible(true);
+                d_uiClassGroupBox->layout()->itemAt(0)->widget()->setVisible(true);
+                d_uiClassGroupBox->layout()->itemAt(1)->widget()->setVisible(false);
+                d_uiClassGroupBox->adjustSize();
+            }
+            else
+            {
+                d_uiClassGroupBox->setVisible(true);
+                d_uiClassGroupBox->layout()->itemAt(0)->widget()->setVisible(false);
+                d_uiClassGroupBox->layout()->itemAt(1)->widget()->setVisible(true);
+                d_uiClassGroupBox->adjustSize();
+            }
+        }
+        else
+        {
+            d_uiClassGroupBox->setVisible(false);
+            d_uiClassGroupBox->layout()->itemAt(0)->widget()->setVisible(false);
+            d_uiClassGroupBox->layout()->itemAt(1)->widget()->setVisible(false);
+        }
     }
+    else
+    {
+        titleString.append("CELL CODE : ");
+        titleString.append(QString::fromStdString(d_cellCodeClass->getFQNName()));
+        titleString.append(" (");
+        titleString.append(QString::fromStdString(d_cellCodeClass->getCellAPIName()));
+        titleString.append(")");
+        d_uiCellGroupBox->setVisible(false);
+        d_uiClassGroupBox->setVisible(true);
+        d_uiClassGroupBox->layout()->itemAt(0)->widget()->setVisible(true);
+        d_uiClassGroupBox->layout()->itemAt(1)->widget()->setVisible(false);
+        d_uiClassGroupBox->adjustSize();
+    }
+    setButtonedWindowTitle(titleString);
+
 }
 
+
 void DCToolWindowCellCodeEditor::switchEditor()
 {
     saveScriptToFile();
@@ -455,3 +433,9 @@ void DCToolWindowCellCodeEditor::classForCellChanged()
 {
     setData(d_container, d_ownerCell->getCellCode(), d_ownerCell);
 }
+
+void DCToolWindowCellCodeEditor::commandExecuted(const QUndoCommand *executedCommand)
+{
+    if (getIsOnStage())
+        updateInformation();
+}
index d1703cc..ec4d36d 100644 (file)
@@ -29,6 +29,8 @@ class DCContainer;
 class DCEditableLabel;
 class DCEditableTreeView;
 class DCQtItemModel;
+class DCCellCodeTypeComboBox;
+class DCCellTypeComboBox;
 
 class DCToolWindowCellCodeEditor : public DCToolWindowBase
 {
@@ -36,35 +38,34 @@ class DCToolWindowCellCodeEditor : public DCToolWindowBase
 private:
     enum DCScriptEditMode { CELLCLASS_EDIT_MODE, CUSTOMSCRIPT_EDIT_MODE };
 
-    DCScriptEditMode    d_mode;
-    DCContainer         *d_container;
-    DCCodeEditor        *d_editor;
-    DCCellCode          *d_cellCodeClass;
-    DCCell              *d_ownerCell;
-
-    QGroupBox           *d_uiClassGroupBox;
-    DCEditableLabel     *d_uiClassName;
-    DCEditableLabel     *d_uiClassType;
-    QTableView          *d_uiClassUserList;
-    QPushButton         *d_uiClassUnsetButton;
-    QPushButton         *d_uiClassAssignButton;
-
-    QGroupBox           *d_uiCellGroupBox;
-    DCEditableLabel     *d_uiCellName;
-    DCEditableLabel     *d_uiCellPath;
-    DCEditableLabel     *d_uiCellType;
-    DCEditableTreeView  *d_receptors;
-    DCQtItemModel       *d_receptorItemModel;
-    DCEditableTreeView  *d_axonTerminals;
-    DCQtItemModel       *d_axonTerminalItemModel;
-    QPushButton         *d_uiSwitchEditorButton;
-
-    QPushButton         *d_uiCloseButton;
-
-    void                updateCellInformation();
-    void                updateClassInformation();
-    void                showClassScript();
-    void                showCustomScript();
+    DCScriptEditMode        d_mode;
+    DCContainer             *d_container;
+    DCCodeEditor            *d_editor;
+    DCCellCode              *d_cellCodeClass;
+    DCCell                  *d_ownerCell;
+
+    QGroupBox               *d_uiClassGroupBox;
+    DCEditableLabel         *d_uiClassName;
+    DCCellCodeTypeComboBox  *d_uiClassType;
+    QTableView              *d_uiClassUserList;
+    QPushButton             *d_uiClassUnsetButton;
+    QPushButton             *d_uiClassAssignButton;
+
+    QGroupBox               *d_uiCellGroupBox;
+    DCEditableLabel         *d_uiCellName;
+    DCEditableLabel         *d_uiCellPath;
+    DCCellTypeComboBox      *d_uiCellType;
+    DCEditableTreeView      *d_receptors;
+    DCQtItemModel           *d_receptorItemModel;
+    DCEditableTreeView      *d_axonTerminals;
+    DCQtItemModel           *d_axonTerminalItemModel;
+    QPushButton             *d_uiSwitchEditorButton;
+
+    QPushButton             *d_uiCloseButton;
+
+    void updateInformation();
+    void showClassScript();
+    void showCustomScript();
 
 public:
     DCToolWindowCellCodeEditor(DCCreator *creator);
@@ -86,6 +87,7 @@ private slots:
     void unsetCellCodeButtonClicked();
     void assignCellCodeButtonClicked();
     void classForCellChanged();
+    void commandExecuted(const QUndoCommand *executedCommand);
 
 };
 
index 388ecda..9e89579 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "dceditablelabel.h"
 #include "dceditabletreeview.h"
+#include "dccelltypecombobox.h"
 #include "dccell.h"
 #include "dccreator.h"
 #include "dcreceptor.h"
@@ -251,15 +252,15 @@ DCToolWindowCellEditor::DCToolWindowCellEditor(DCCreator *creator) :
     d_layout->addWidget(d_detailButton,6,0,1,2);
 
     d_textPage = new DCEditableLabel(this, "");
-    d_textType = new DCEditableLabel(this, "");
+    d_comboType = new DCCellTypeComboBox(creator, this);
     d_layout->addWidget(d_textPage, 0,1);
-    d_layout->addWidget(d_textType, 1,1);
+    d_layout->addWidget(d_comboType, 1,1);
 
     d_classButton = new QPushButton("...");
-    QPushButton *customScriptEditButton = new QPushButton(tr("edit..."));
+    d_customScriptButton = new QPushButton(tr("edit..."));
 
     d_layout->addWidget(d_classButton, 2,1);
-    d_layout->addWidget(customScriptEditButton, 3,1);
+    d_layout->addWidget(d_customScriptButton, 3,1);
 
     d_receptors = new DCEditableTreeView(this);
     d_receptors->setHeaderHidden(true);
@@ -293,8 +294,7 @@ DCToolWindowCellEditor::DCToolWindowCellEditor(DCCreator *creator) :
     connect(d_axonTerminals, SIGNAL(vscrollbarHidden()), this, SLOT(adjustTreeColumnWidth()));
 
     connect(d_classButton, SIGNAL(clicked()), this, SLOT(slotCellCodeEditButtonPressed()));
-    connect(customScriptEditButton, SIGNAL(clicked()), this, SLOT(slotCustomScriptEditButtonPressed()));
-
+    connect(d_customScriptButton, SIGNAL(clicked()), this, SLOT(slotCustomScriptEditButtonPressed()));
 }
 
 DCToolWindowCellEditor::~DCToolWindowCellEditor()
@@ -311,20 +311,16 @@ DCToolWindowCellEditor::~DCToolWindowCellEditor()
 
 void DCToolWindowCellEditor::setCell(DCCell *cell)
 {
+    if (d_cell)
+        d_cell->disconnect(this);
+
     d_cell = cell;
     QString title = "CELL:";
     if (cell)
     {
         title.append(QString::fromStdString(cell->getName()));
-        if (cell->getCellCode() && cell->getCellCode() != getController()->getCurrentContainer()->getEmptyCellCodeClass())
-        {
-            d_classButton->setText(QString::fromStdString(cell->getCellCode()->getFQNName()));
-        }
-        else
-        {
-            d_classButton->setText("...");
-        }
         connect(cell, SIGNAL(destroyed(QObject*)), this, SLOT(slotCellDestroyed()));
+        d_comboType->setEditingCell(cell);
     }
 
     setButtonedWindowTitle(title);
@@ -338,10 +334,37 @@ void DCToolWindowCellEditor::updateView()
     d_receptorItemModel->removeAllItems();
     d_axonTerminalItemModel->removeAllItems();
 
-    if (d_cell)
+    DCContainer *container = getController()->getCurrentContainer();
+
+    if (d_cell && container)
     {
+        if (container->getIsScriptable(d_cell->getType()))
+        {
+            if (d_cell->getIsCellCodeClassAssgined())
+            {
+                d_classButton->setText(QString::fromStdString(d_cell->getCellCode()->getFQNName()));
+            }
+            else
+            {
+                d_classButton->setText("...");
+            }
+            d_classButton->setEnabled(true);
+
+            d_customScriptButton->setText("Edit...");
+            d_customScriptButton->setEnabled(true);
+        }
+        else
+        {
+            d_classButton->setText("N/A");
+            d_classButton->setEnabled(false);
+            d_customScriptButton->setText("N/A");
+            d_customScriptButton->setEnabled(false);
+        }
+
+        d_comboType->updateSelection();
+        d_comboType->setEnabled(!d_cell->getIsCellCodeClassAssgined());
+
         d_textPage->setText(QString::fromStdString(d_cell->getLocation()));
-        d_textType->setText(d_cell->getType());
 
         d_receptorItemModel->insertString("receptors");
         d_receptorItemModel->insertColumns(1,2);
index a0bfebe..39bc6ac 100644 (file)
@@ -27,6 +27,7 @@ class DCCell;
 class DCEditableTreeView;
 class DCQtItemModel;
 class DCEditableLabel;
+class DCCellTypeComboBox;
 
 class DCToolWindowCellEditor : public DCToolWindowBase
 {
@@ -34,8 +35,9 @@ class DCToolWindowCellEditor : public DCToolWindowBase
 private:
     DCCell              *d_cell;
     DCEditableLabel     *d_textPage;
-    DCEditableLabel     *d_textType;
+    DCCellTypeComboBox  *d_comboType;
     QPushButton         *d_classButton;
+    QPushButton         *d_customScriptButton;
     QPushButton         *d_detailButton;
     DCEditableTreeView  *d_receptors;
     DCQtItemModel       *d_receptorItemModel;