From: <le...@us...> - 2007-01-20 12:33:57
|
Revision: 203 http://svn.sourceforge.net/qcell/?rev=203&view=rev Author: lessm Date: 2007-01-20 04:33:55 -0800 (Sat, 20 Jan 2007) Log Message: ----------- - CalculationData have toXmlString string method Modified Paths: -------------- trunk/qcell/baseheaders/CalculationData.h trunk/qcell/basesources/CalculationData.cpp trunk/qcell/parsers/KI/KIParserPlugin.cpp trunk/qcell/visgui/MainWindow.cpp Modified: trunk/qcell/baseheaders/CalculationData.h =================================================================== --- trunk/qcell/baseheaders/CalculationData.h 2007-01-20 12:33:20 UTC (rev 202) +++ trunk/qcell/baseheaders/CalculationData.h 2007-01-20 12:33:55 UTC (rev 203) @@ -7,6 +7,7 @@ #include <QVector> #include <QDomDocument> #include <QDomElement> +#include <QStringList> #include "BaseDataTypes.h" class CalculationData : public baseDataTypes @@ -75,9 +76,10 @@ /*const*/ char *getDataPointer(void); void fillData(char *dataPointer); + void fillData(int value); void setForeignDataPointer(char *dataPointer, bool silent=0); - QString createXmlHeader(void); + QString toXmlString(void); bool setFromXmlString(QString *xmlString); bool parseXmlElement(QDomElement *root); Modified: trunk/qcell/basesources/CalculationData.cpp =================================================================== --- trunk/qcell/basesources/CalculationData.cpp 2007-01-20 12:33:20 UTC (rev 202) +++ trunk/qcell/basesources/CalculationData.cpp 2007-01-20 12:33:55 UTC (rev 203) @@ -725,6 +725,45 @@ } } +void CalculationData::fillData(int value) +{ + int counter = 0; + if(data) + { + switch(dimension) + { + case 1: + counter = sizeX; + break; + case 2: + counter = sizeX * sizeY; + break; + case 3: + counter = sizeX * sizeY * sizeZ; + break; + case 4: + counter = sizeX * sizeY * sizeZ * sizeT; + break; + } + + switch(dataType) + { + case baseDataTypes::CHAR: + for(int i=0;i<counter;++i) + *((char *)data + i) = (char)value; + break; + case baseDataTypes::SHORT: + for(int i=0;i<counter;++i) + *((short *)data + i) = (short)value; + break; + case baseDataTypes::INT: + for(int i=0;i<counter;++i) + *((int *)data + i) = value; + break; + } + } +} + void CalculationData::setForeignDataPointer(char *dataPointer, bool silent) { clearData(); @@ -734,19 +773,160 @@ emit dataUpdated(); } -QString CalculationData::createXmlHeader(void) +QString CalculationData::toXmlString(void) { - return QString::number((int)this); + QDomDocument doc; + QVector<QString> elements; + QVector<int> counters; + QDomElement root, element; + QDomText text; + int maxValue=-1; + int curent, prev = -1; + int higest=-1, hindex=0; + root = doc.createElement("CalculationData"); + switch(dataType) + { + case baseDataTypes::CHAR: + root.setAttribute("DataType", "char"); + break; + + case baseDataTypes::SHORT: + root.setAttribute("DataType", "short"); + break; + + case baseDataTypes::INT: + root.setAttribute("DataType", "int"); + break; + } + + switch(dimension) + { + case 4: + root.setAttribute("time", sizeT); + case 3: + root.setAttribute("depth", sizeZ); + case 2: + root.setAttribute("hight", sizeY); + case 1: + root.setAttribute("width", sizeX); + break; + } + + for(int i=0;i<getSizeInByte() / dataSize;++i) + { + curent = getValueAt_i(i); + if(curent>maxValue) + { + maxValue = curent; + elements.resize(maxValue+1); + counters.resize(maxValue+1); + counters[curent] = 1; + elements[curent] += tr("%1;").arg(i); + } + else + { + counters[curent] += 1; + elements[curent] += tr("%1;").arg(i); + } + } + for(int i=0;i<counters.size();++i) + { + if(counters[i]>higest) + { + higest = counters[i]; + hindex = i; + } + } + + root.setAttribute("fill", hindex); + + for(int i=0;i<elements.size();++i) + { + if(i!=hindex) + { + element = doc.createElement("Section"); + element.setAttribute("value", i); + element.appendChild(doc.createTextNode(elements[i])); + root.appendChild(element); + } + } + + doc.appendChild(root); + return doc.toString(); } bool CalculationData::setFromXmlString(QString *xmlString) { - - return 1; + QDomDocument doc; + doc.setContent(*xmlString); + QDomElement element = doc.firstChildElement(); + return parseXmlElement(&element); } bool CalculationData::parseXmlElement(QDomElement *root) { + QDomNode node; + QDomElement element; + QString temp; + QStringList sList; + int value; + if(root->tagName()=="CalculationData") + { + if(root->attribute("DataType")=="char") + setDataType(baseDataTypes::CHAR); + else + if(root->attribute("DataType")=="short") + setDataType(baseDataTypes::SHORT); + else + if(root->attribute("DataType")=="int") + setDataType(baseDataTypes::INT); + else + return 0; + + if(root->hasAttribute("time")) + { + resizeData(root->attribute("width").toInt(), root->attribute("hight").toInt(), root->attribute("depth").toInt(), root->attribute("time").toInt()); + } + else + if(root->hasAttribute("depth")) + { + resizeData(root->attribute("width").toInt(), root->attribute("hight").toInt(), root->attribute("depth").toInt()); + + } + else + if(root->hasAttribute("hight")) + { + resizeData(root->attribute("width").toInt(), root->attribute("hight").toInt()); + + } + else + if(root->hasAttribute("width")) + { + resizeData(root->attribute("width").toInt()); + } + else + return 0; + + if(root->hasAttribute("fill")) + fillData(root->attribute("fill").toInt()); + + node = root->firstChild(); + while(!node.isNull()) + { + element = node.toElement(); + if(element.tagName()=="Section") + { + value = element.attribute("value").toInt(); + sList = element.text().split(';', QString::SkipEmptyParts); + foreach(temp, sList) + { + setValueAt(value, temp.toInt()); + + } + } + node = node.nextSibling(); + } + } return 1; } Modified: trunk/qcell/parsers/KI/KIParserPlugin.cpp =================================================================== --- trunk/qcell/parsers/KI/KIParserPlugin.cpp 2007-01-20 12:33:20 UTC (rev 202) +++ trunk/qcell/parsers/KI/KIParserPlugin.cpp 2007-01-20 12:33:55 UTC (rev 203) @@ -160,7 +160,7 @@ } - return cd->createXmlHeader(); + return cd->toXmlString(); } QByteArray KIParserPlugin::parseOut(QString content, const QString type, const QString subtype) Modified: trunk/qcell/visgui/MainWindow.cpp =================================================================== --- trunk/qcell/visgui/MainWindow.cpp 2007-01-20 12:33:20 UTC (rev 202) +++ trunk/qcell/visgui/MainWindow.cpp 2007-01-20 12:33:55 UTC (rev 203) @@ -351,7 +351,10 @@ } // Internal data settings - data.append((CalculationData*)world_parsers[subtype]->parse(file_content, type, subtype).toInt()); + //data.append((CalculationData*)world_parsers[subtype]->parse(file_content, type, subtype).toInt()); + CalculationData *tempCD = new CalculationData(); + tempCD->setFromXmlString(&XMLString); + data.append(tempCD); *(CalculationData*)&calc = *data.last(); iteration=0; @@ -427,7 +430,7 @@ } /// @todo Wait for toXmlString - file.write(world_parsers[subtype]->parseOut(sw->getStorage()->createXmlHeader(), type, subtype)); + file.write(world_parsers[subtype]->parseOut(sw->getStorage()->toXmlString(), type, subtype)); } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <le...@us...> - 2007-01-20 13:52:52
|
Revision: 209 http://svn.sourceforge.net/qcell/?rev=209&view=rev Author: lessm Date: 2007-01-20 05:52:50 -0800 (Sat, 20 Jan 2007) Log Message: ----------- - LocalFunction table allocation bug resolved Modified Paths: -------------- trunk/qcell/basesources/LocalFunction.cpp trunk/qcell/parsers/LTFL/LTFLParserPlugin.cpp trunk/qcell/parsers/REAK/REAKParserPlugin.cpp trunk/qcell/parsers/ZIFW/ZIFWParserPlugin.cpp trunk/qcell/parsers/ZIFWP/ZIFWPParserPlugin.cpp trunk/qcell/visgui/main.cpp Modified: trunk/qcell/basesources/LocalFunction.cpp =================================================================== --- trunk/qcell/basesources/LocalFunction.cpp 2007-01-20 13:48:34 UTC (rev 208) +++ trunk/qcell/basesources/LocalFunction.cpp 2007-01-20 13:52:50 UTC (rev 209) @@ -15,7 +15,7 @@ numElements = 1; for(int i=0;i<sumArguments.size();++i) numElements *= sumArguments[i].size() * (maxArgVal - 1) + 1; - numElements *= freeArguments.size() * maxArgVal; + numElements *= pow(maxArgVal, freeArguments.size()); break; case LocalFunction::SWITCH: Modified: trunk/qcell/parsers/LTFL/LTFLParserPlugin.cpp =================================================================== --- trunk/qcell/parsers/LTFL/LTFLParserPlugin.cpp 2007-01-20 13:48:34 UTC (rev 208) +++ trunk/qcell/parsers/LTFL/LTFLParserPlugin.cpp 2007-01-20 13:52:50 UTC (rev 209) @@ -358,7 +358,7 @@ // } // } // -// return result; + return QByteArray(); } Modified: trunk/qcell/parsers/REAK/REAKParserPlugin.cpp =================================================================== --- trunk/qcell/parsers/REAK/REAKParserPlugin.cpp 2007-01-20 13:48:34 UTC (rev 208) +++ trunk/qcell/parsers/REAK/REAKParserPlugin.cpp 2007-01-20 13:52:50 UTC (rev 209) @@ -360,7 +360,7 @@ // } // } // -// return result; + return QByteArray(); } Modified: trunk/qcell/parsers/ZIFW/ZIFWParserPlugin.cpp =================================================================== --- trunk/qcell/parsers/ZIFW/ZIFWParserPlugin.cpp 2007-01-20 13:48:34 UTC (rev 208) +++ trunk/qcell/parsers/ZIFW/ZIFWParserPlugin.cpp 2007-01-20 13:52:50 UTC (rev 209) @@ -284,7 +284,7 @@ // // /// @todo Main function writing // -// return result; + return QByteArray(); } Q_EXPORT_PLUGIN2(ZIFWFileParser, ZIFWParserPlugin) Modified: trunk/qcell/parsers/ZIFWP/ZIFWPParserPlugin.cpp =================================================================== --- trunk/qcell/parsers/ZIFWP/ZIFWPParserPlugin.cpp 2007-01-20 13:48:34 UTC (rev 208) +++ trunk/qcell/parsers/ZIFWP/ZIFWPParserPlugin.cpp 2007-01-20 13:52:50 UTC (rev 209) @@ -343,7 +343,7 @@ // // /// @todo Main function writing // -// return result; + return QByteArray(); } Q_EXPORT_PLUGIN2(ZIFWPFileParser, ZIFWPParserPlugin) Modified: trunk/qcell/visgui/main.cpp =================================================================== --- trunk/qcell/visgui/main.cpp 2007-01-20 13:48:34 UTC (rev 208) +++ trunk/qcell/visgui/main.cpp 2007-01-20 13:52:50 UTC (rev 209) @@ -15,7 +15,7 @@ Q_IMPORT_PLUGIN(REAKFileParser); Q_IMPORT_PLUGIN(LTFLFileParser); Q_IMPORT_PLUGIN(ZIFWFileParser); -Q_IMPORT_PLUGIN(ZIFWPFileParser); +//Q_IMPORT_PLUGIN(ZIFWPFileParser); /** * @brief Displays all debug messages in GUI This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <le...@us...> - 2007-01-20 19:37:32
|
Revision: 214 http://svn.sourceforge.net/qcell/?rev=214&view=rev Author: lessm Date: 2007-01-20 11:37:30 -0800 (Sat, 20 Jan 2007) Log Message: ----------- - some methods add for LocalFunction visualization Modified Paths: -------------- trunk/qcell/baseheaders/CalculationData.h trunk/qcell/baseheaders/LocalFunction.h trunk/qcell/baseheaders/Neighbourhood.h trunk/qcell/basesources/CalculationData.cpp trunk/qcell/basesources/LocalFunction.cpp trunk/qcell/parsers/ZIFWP/ZIFWPParserPlugin.cpp Modified: trunk/qcell/baseheaders/CalculationData.h =================================================================== --- trunk/qcell/baseheaders/CalculationData.h 2007-01-20 17:52:00 UTC (rev 213) +++ trunk/qcell/baseheaders/CalculationData.h 2007-01-20 19:37:30 UTC (rev 214) @@ -9,6 +9,7 @@ #include <QDomElement> #include <QStringList> #include "BaseDataTypes.h" +#include "Neighbourhood.h" class CalculationData : public baseDataTypes { @@ -85,6 +86,7 @@ CalculationData & operator = (CalculationData &cData); + CalculationData & operator = (Neighbourhood &neighbourhood); signals: void dataUpdated(); Modified: trunk/qcell/baseheaders/LocalFunction.h =================================================================== --- trunk/qcell/baseheaders/LocalFunction.h 2007-01-20 17:52:00 UTC (rev 213) +++ trunk/qcell/baseheaders/LocalFunction.h 2007-01-20 19:37:30 UTC (rev 214) @@ -1,6 +1,7 @@ #ifndef _LOCAL_FUNCTION_H #define _LOCAL_FUNCTION_H +#include <QObject> #include <QVector> #include <QString> #include <QDomDocument> @@ -50,11 +51,11 @@ */ -class LocalFunction +class LocalFunction : public QObject { + Q_OBJECT public: - enum FUNCTION_TYPE { SWITCH, @@ -69,8 +70,9 @@ QVector<int> freeArguments; FUNCTION_TYPE functionMode; int numArg, maxArgVal, numElements, maxRetVal; - QString script; + QString script, coment; + protected: //public: void resizeValueTable(void); @@ -138,6 +140,21 @@ QString toXmlString(void); bool fromXmlString(QString *xmlString); bool fromDomElement(QDomElement *xmlElement); + + // this for value table + int getValueTableSize(void); + int getRowNumber(void); + int getColumnNumber(void); + int getValueAt(int index); + void setValueAt(int value, int index); + + // coment for function + void setComent(QString &text); + QString getComent(void); + +signals: + // signal emit when resolv used + void valueCalculate(QVector<int> args); }; #endif Modified: trunk/qcell/baseheaders/Neighbourhood.h =================================================================== --- trunk/qcell/baseheaders/Neighbourhood.h 2007-01-20 17:52:00 UTC (rev 213) +++ trunk/qcell/baseheaders/Neighbourhood.h 2007-01-20 19:37:30 UTC (rev 214) @@ -67,6 +67,7 @@ QVector<int> getMaxNeighbourhoodValues(void); QVector<int> getMinNeighbourhoodValues(void); + }; #endif Modified: trunk/qcell/basesources/CalculationData.cpp =================================================================== --- trunk/qcell/basesources/CalculationData.cpp 2007-01-20 17:52:00 UTC (rev 213) +++ trunk/qcell/basesources/CalculationData.cpp 2007-01-20 19:37:30 UTC (rev 214) @@ -953,3 +953,16 @@ fillData(cData.getDataPointer()); return *this; } + +CalculationData & CalculationData::operator = (Neighbourhood &neighbourhood) +{ + clearData(); + int mx, my, mz; + QVector<int> nmin = neighbourhood.getMinNeighbourhoodValues(); + QVector<int> nmax = neighbourhood.getMaxNeighbourhoodValues(); + mx = nmax[0] - nmax[0]; + mz = nmax[2] - nmax[2]; + my = nmax[1] - nmax[1]; + + return *this; +} Modified: trunk/qcell/basesources/LocalFunction.cpp =================================================================== --- trunk/qcell/basesources/LocalFunction.cpp 2007-01-20 17:52:00 UTC (rev 213) +++ trunk/qcell/basesources/LocalFunction.cpp 2007-01-20 19:37:30 UTC (rev 214) @@ -19,7 +19,7 @@ break; case LocalFunction::SWITCH: - numElements = numArg * maxArgVal; + numElements = pow(maxArgVal, numArg); break; } @@ -531,6 +531,7 @@ index = calculateSumsIndex(sums) + calculateSwitchIndex(freeArgs); break; } + emit valueCalculate(args); return valueTable[index]; } @@ -646,3 +647,43 @@ } return 0; } + +int LocalFunction::getValueTableSize(void) +{ + return valueTable.size(); +} + +int LocalFunction::getRowNumber(void) +{ + return pow(maxArgVal, numArg); +} + +int LocalFunction::getColumnNumber(void) +{ + int out = 1; + if(sumArguments.size()==0) + return 0; + for(int i=0;i<sumArguments.size();++i) + out *= sumArguments[i].size() * (maxArgVal - 1) + 1; + return out; +} + +int LocalFunction::getValueAt(int index) +{ + return valueTable[index]; +} + +void LocalFunction::setValueAt(int value, int index) +{ + valueTable[index] = value; +} + +void LocalFunction::setComent(QString &text) +{ + coment = text; +} + +QString LocalFunction::getComent(void) +{ + return coment; +} \ No newline at end of file Modified: trunk/qcell/parsers/ZIFWP/ZIFWPParserPlugin.cpp =================================================================== --- trunk/qcell/parsers/ZIFWP/ZIFWPParserPlugin.cpp 2007-01-20 17:52:00 UTC (rev 213) +++ trunk/qcell/parsers/ZIFWP/ZIFWPParserPlugin.cpp 2007-01-20 19:37:30 UTC (rev 214) @@ -113,7 +113,7 @@ // Variants division lines[0] = lines[0].trimmed(); - int split_nr; +// int split_nr; QStringList tmp_division; format = QRegExp("^\\{(\\d(,|:)){" + QString::number(arguments_nr-1) + "}(\\d)\\}$"); if((format.exactMatch(lines[0])) && (lines[0].count(':') == 1)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dhu...@us...> - 2007-01-20 19:56:46
|
Revision: 215 http://svn.sourceforge.net/qcell/?rev=215&view=rev Author: dhubleizh Date: 2007-01-20 11:56:44 -0800 (Sat, 20 Jan 2007) Log Message: ----------- - new ElementalRules Modified Paths: -------------- trunk/qcell/visgui/visgui.pro Added Paths: ----------- trunk/qcell/baseheaders/ElementalRules.h trunk/qcell/basesources/ElementalRules.cpp Added: trunk/qcell/baseheaders/ElementalRules.h =================================================================== --- trunk/qcell/baseheaders/ElementalRules.h (rev 0) +++ trunk/qcell/baseheaders/ElementalRules.h 2007-01-20 19:56:44 UTC (rev 215) @@ -0,0 +1,42 @@ +/**@file ElementalRules.h + * @author czarny + * @date + * Created: sob 20 sty 2007 17:53:58 CET \n + * Last Update: sob 20 sty 2007 17:53:58 CET + * @brief A containter combining neighbours values with output + */ + +#ifndef __ELEMENTALRULES_H__ +#define __ELEMENTALRULES_H__ + +#include <QObject> +#include <QVector> +#include <QMultiHash> +#include <QPair> + +template<class Type> +class ElementalRules: public QObject +{ +protected: + int neighbours_count; + int index; + + QVector<Type> return_values; + QVector<QVector<Type> > neighbours; + // To ease later creations + typedef QPair<Type*, QVector<Type>*> rulePair; + // Rule maps a rule number to a rule. + // A rule is really a pair of return value and neighbours + QMultiHash<int, QPair<Type*, QVector<Type>*> > rules; + +public: + ElementalRules(); + + void setNeighoursCount(const int neighbours); + inline int getNeighbourCount(); + + void addRule(QVector<Type> neighbours, Type return_value); + +}; + +#endif // __ELEMENTALRULES_H__ Added: trunk/qcell/basesources/ElementalRules.cpp =================================================================== --- trunk/qcell/basesources/ElementalRules.cpp (rev 0) +++ trunk/qcell/basesources/ElementalRules.cpp 2007-01-20 19:56:44 UTC (rev 215) @@ -0,0 +1,49 @@ +/**@file ElementalRules.cpp + * @author czarny + * @date + * Created: sob 20 sty 2007 17:57:01 CET \n + * Last Update: sob 20 sty 2007 17:57:01 CET + */ + +#include <ElementalRules.h> + +template<class Type> +ElementalRules<Type>::ElementalRules() + : QObject() +{ + index = 0; +} + +template<class Type> +void ElementalRules<Type>::addRule(QVector<Type> neighbours, Type return_value) +{ + // where do things reside + int value_index, neighbour_index; + // Is this a new rule case? + bool newRule = false; + + // search if we haven't already have this return value + // or this neighbours configuration in databse + value_index = return_values.indexOf(return_value); + this->neighbours.indexOf(neighbours); + + // if we don't have the return vale, let's add it + // and modify the value_index accordingly + if (value_index == -1) + { + return_values.append(return_value); + value_index = return_values.count() - 1; + newRule = true; + } + + // same thing with neighbours + if (neighbour_index == -1) + { + this->neighbours.append(neighbours); + neighbour_index = this->neighbours.count() - 1; + newRule = true; + } + + rules[index] = rulePair(&return_values[value_index], &this->neighbours[neighbour_index]); +} + Modified: trunk/qcell/visgui/visgui.pro =================================================================== --- trunk/qcell/visgui/visgui.pro 2007-01-20 19:37:30 UTC (rev 214) +++ trunk/qcell/visgui/visgui.pro 2007-01-20 19:56:44 UTC (rev 215) @@ -29,7 +29,8 @@ ../baseheaders/basetools.h \ ../baseheaders/view3dtools.h \ ../baseheaders/view2dtexttools.h \ - ../baseheaders/view1dtexttools.h + ../baseheaders/view1dtexttools.h \ + ../baseheaders/ElementalRules.h SOURCES = ../basesources/GenericParserPlugin.cpp \ main.cpp \ @@ -46,7 +47,8 @@ ../basesources/basetools.cpp \ ../basesources/view3dtools.cpp \ ../basesources/view2dtexttools.cpp \ - ../basesources/view1dtexttools.cpp + ../basesources/view1dtexttools.cpp \ + ../basesources/ElementalRules.cpp LIBS = -L../libs -lN -lFQT -lKI -lREAK -lLTFL -lZIFW -lZIFWP This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <le...@us...> - 2007-01-20 21:17:34
|
Revision: 216 http://svn.sourceforge.net/qcell/?rev=216&view=rev Author: lessm Date: 2007-01-20 13:17:33 -0800 (Sat, 20 Jan 2007) Log Message: ----------- - new methods in LocalFunction Modified Paths: -------------- trunk/qcell/baseheaders/LocalFunction.h trunk/qcell/basesources/Calculator.cpp trunk/qcell/basesources/LocalFunction.cpp Modified: trunk/qcell/baseheaders/LocalFunction.h =================================================================== --- trunk/qcell/baseheaders/LocalFunction.h 2007-01-20 19:56:44 UTC (rev 215) +++ trunk/qcell/baseheaders/LocalFunction.h 2007-01-20 21:17:33 UTC (rev 216) @@ -96,6 +96,9 @@ void setValuesFromString(QString values); void getArgumentsFromString(QString argString, QVector<int> &sums, QVector<int> &freeArgs); + QVector<int> indexToFreeArgs(int index); + QVector<int> indexToSums(int index); + public: LocalFunction(); @@ -148,6 +151,9 @@ int getValueAt(int index); void setValueAt(int value, int index); + QStringList rowsHeaders(void); + QStringList columnHeaders(void); + // coment for function void setComent(QString &text); QString getComent(void); Modified: trunk/qcell/basesources/Calculator.cpp =================================================================== --- trunk/qcell/basesources/Calculator.cpp 2007-01-20 19:56:44 UTC (rev 215) +++ trunk/qcell/basesources/Calculator.cpp 2007-01-20 21:17:33 UTC (rev 216) @@ -142,6 +142,7 @@ void Calculator::setLocalFunction(LocalFunction *f) { localfunction = f; + f->rowsHeaders(); } int Calculator::getTempDataSizeInByte(void) Modified: trunk/qcell/basesources/LocalFunction.cpp =================================================================== --- trunk/qcell/basesources/LocalFunction.cpp 2007-01-20 19:56:44 UTC (rev 215) +++ trunk/qcell/basesources/LocalFunction.cpp 2007-01-20 21:17:33 UTC (rev 216) @@ -271,6 +271,58 @@ } } +QVector<int> LocalFunction::indexToFreeArgs(int index) +{ + QVector<int> out; + if(freeArguments.size()>0) + { + out.resize(freeArguments.size()); + out.fill(0); + + for(int i=0;i<out.size();++i) + { + if(index<maxArgVal) + { + out[i] = index; + break; + } + else + { + out[i] = index % maxArgVal; + index /= maxArgVal; + } + } + } + return out; +} + +QVector<int> LocalFunction::indexToSums(int index) +{ + QVector<int> out; + int temp; + if(sumArguments.size()>0) + { + out.resize(sumArguments.size()); + out.fill(0); + + for(int i=0;i<out.size();++i) + { + temp = sumArguments[i].size() * (maxArgVal - 1) + 2; + if(index<temp) + { + out[i] = index; + break; + } + else + { + out[i] = index % temp; + index /= temp; + } + } + } + return out; +} + LocalFunction::LocalFunction() { functionMode = LocalFunction::SWITCH; @@ -678,6 +730,48 @@ valueTable[index] = value; } +QStringList LocalFunction::rowsHeaders(void) +{ + QStringList out; + QString temp; + int tmp; + QVector<int> calcVector; + int rows = 1; + for(int i=0;i<sumArguments.size();++i) + rows *= sumArguments[i].size() * (maxArgVal - 1) + 2; + + for(int i=0;i<rows;++i) + { + temp.clear(); + calcVector = indexToSums(i); + foreach(tmp, calcVector) + temp.append(tr("%1;").arg(tmp)); + + out<<temp; + } + return out; +} + +QStringList LocalFunction::columnHeaders(void) +{ + QStringList out; + QString temp; + int tmp; + QVector<int> calcVector; + int column = pow(maxArgVal, freeArguments.size()); + + for(int i=0;i<column;++i) + { + temp.clear(); + calcVector = indexToFreeArgs(i); + foreach(tmp, calcVector) + temp.append(tr("%1;").arg(tmp)); + + out<<temp; + } + return out; +} + void LocalFunction::setComent(QString &text) { coment = text; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dhu...@us...> - 2007-01-20 21:55:07
|
Revision: 217 http://svn.sourceforge.net/qcell/?rev=217&view=rev Author: dhubleizh Date: 2007-01-20 13:55:04 -0800 (Sat, 20 Jan 2007) Log Message: ----------- - ElementalRules started Modified Paths: -------------- trunk/qcell/baseheaders/ElementalRules.h trunk/qcell/basesources/ElementalRules.cpp trunk/qcell/visgui/MainWindow.cpp trunk/qcell/visgui/MainWindow.h Modified: trunk/qcell/baseheaders/ElementalRules.h =================================================================== --- trunk/qcell/baseheaders/ElementalRules.h 2007-01-20 21:17:33 UTC (rev 216) +++ trunk/qcell/baseheaders/ElementalRules.h 2007-01-20 21:55:04 UTC (rev 217) @@ -14,20 +14,24 @@ #include <QMultiHash> #include <QPair> -template<class Type> -class ElementalRules: public QObject +class ElementalRules : public QObject { + Q_OBJECT +public slots: + void possibleRule(QVector<int> coordinates, QVector<int> neighbours, int result); protected: int neighbours_count; int index; - QVector<Type> return_values; - QVector<QVector<Type> > neighbours; + QVector<int> return_values; + QVector<QVector<int> > neighbours; // To ease later creations - typedef QPair<Type*, QVector<Type>*> rulePair; + typedef QPair<int*, QVector<int>*> rulePair; // Rule maps a rule number to a rule. // A rule is really a pair of return value and neighbours - QMultiHash<int, QPair<Type*, QVector<Type>*> > rules; + QMultiHash<int, QPair<int*, QVector<int>*> > rules; + // This hash holds coordinates, that have a certain rule + QMultiHash<int, QVector<int> > rules_mask; public: ElementalRules(); @@ -35,8 +39,9 @@ void setNeighoursCount(const int neighbours); inline int getNeighbourCount(); - void addRule(QVector<Type> neighbours, Type return_value); + void addRule(QVector<int> coodrinates, QVector<int> neighbours, int return_value); }; + #endif // __ELEMENTALRULES_H__ Modified: trunk/qcell/basesources/ElementalRules.cpp =================================================================== --- trunk/qcell/basesources/ElementalRules.cpp 2007-01-20 21:17:33 UTC (rev 216) +++ trunk/qcell/basesources/ElementalRules.cpp 2007-01-20 21:55:04 UTC (rev 217) @@ -5,20 +5,18 @@ * Last Update: sob 20 sty 2007 17:57:01 CET */ -#include <ElementalRules.h> +#include "ElementalRules.h" -template<class Type> -ElementalRules<Type>::ElementalRules() +ElementalRules::ElementalRules() : QObject() { index = 0; } -template<class Type> -void ElementalRules<Type>::addRule(QVector<Type> neighbours, Type return_value) +void ElementalRules::addRule(QVector<int> coordinates, QVector<int> neighbours, int return_value) { // where do things reside - int value_index, neighbour_index; + int value_index, neighbour_index, rule_index; // Is this a new rule case? bool newRule = false; @@ -44,6 +42,31 @@ newRule = true; } - rules[index] = rulePair(&return_values[value_index], &this->neighbours[neighbour_index]); + // If neighbours or return_value is new + if (newRule) + { + // bumb the index + rule_index = ++index; + // and insert a new rule + rules.insert(rule_index, rulePair(&return_values[value_index], &this->neighbours[neighbour_index])); + } + // If both were present + else + { + // Find indexes, take out pointers and make a new rule + rule_index = rules.key(rulePair( + &return_values[return_values.indexOf(return_value)], + &this->neighbours[this->neighbours.indexOf(neighbours)] + ) + ); + } + + // At the end we note the coordinates + rules_mask.insert(rule_index, coordinates); } +void ElementalRules::possibleRule(QVector<int> coordinates, QVector<int> neighbours, int result) +{ + addRule(coordinates, neighbours, result); +} + Modified: trunk/qcell/visgui/MainWindow.cpp =================================================================== --- trunk/qcell/visgui/MainWindow.cpp 2007-01-20 21:17:33 UTC (rev 216) +++ trunk/qcell/visgui/MainWindow.cpp 2007-01-20 21:55:04 UTC (rev 217) @@ -371,6 +371,9 @@ tempCD->setFromXmlString(&XMLString); data.append(tempCD); *(CalculationData*)&calc = *data.last(); + // Creating elemental rules accroding to DATA_TYPE + elemental_rules = new ElementalRules; + iteration=0; // visualization update Modified: trunk/qcell/visgui/MainWindow.h =================================================================== --- trunk/qcell/visgui/MainWindow.h 2007-01-20 21:17:33 UTC (rev 216) +++ trunk/qcell/visgui/MainWindow.h 2007-01-20 21:55:04 UTC (rev 217) @@ -12,6 +12,7 @@ #include "ui_MainWindow.h" #include "ui_AboutDialog.h" #include "ExperimentSetup.h" +#include "ElementalRules.h" #include <QPluginLoader> #include "GenericParserPlugin.h" #include <QFileDialog> @@ -90,6 +91,7 @@ uint msec_delay; Calculator calc; + ElementalRules* elemental_rules; QList<CalculationData*> data; LocalFunction* local_function; Neighbourhood* neighbourhood; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <le...@us...> - 2007-01-21 13:41:23
|
Revision: 218 http://svn.sourceforge.net/qcell/?rev=218&view=rev Author: lessm Date: 2007-01-21 05:41:18 -0800 (Sun, 21 Jan 2007) Log Message: ----------- - functiontable widget add Modified Paths: -------------- trunk/qcell/baseheaders/simulationwindow.h trunk/qcell/baseheaders/simulationwindow.ui trunk/qcell/basesources/LocalFunction.cpp trunk/qcell/basesources/simulationwindow.cpp trunk/qcell/visgui/MainWindow.cpp trunk/qcell/visgui/visgui.pro Added Paths: ----------- trunk/qcell/baseheaders/functiontable.h trunk/qcell/baseheaders/functiontable.ui trunk/qcell/basesources/functiontable.cpp Added: trunk/qcell/baseheaders/functiontable.h =================================================================== --- trunk/qcell/baseheaders/functiontable.h (rev 0) +++ trunk/qcell/baseheaders/functiontable.h 2007-01-21 13:41:18 UTC (rev 218) @@ -0,0 +1,32 @@ +#ifndef FUNCTIONTABLE_H +#define FUNCTIONTABLE_H + +#include <QWidget> +#include <QTableWidget> +#include <QTableWidgetItem> +#include <QString> +#include <QStringList> +#include "LocalFunction.h" +#include "ui_functiontable.h" + +class FunctionTable : public QWidget +{ + Q_OBJECT + + +private: + Ui::FunctionTableClass ui; + +protected: + LocalFunction *function; + void init(void); + +public: + FunctionTable(QWidget *parent = 0); + ~FunctionTable(); + + void setFunctionPointer(LocalFunction *f); + +}; + +#endif // FUNCTIONTABLE_H Added: trunk/qcell/baseheaders/functiontable.ui =================================================================== --- trunk/qcell/baseheaders/functiontable.ui (rev 0) +++ trunk/qcell/baseheaders/functiontable.ui 2007-01-21 13:41:18 UTC (rev 218) @@ -0,0 +1,30 @@ +<ui version="4.0" > + <class>FunctionTableClass</class> + <widget class="QWidget" name="FunctionTableClass" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>388</width> + <height>310</height> + </rect> + </property> + <property name="windowTitle" > + <string>FunctionTable</string> + </property> + <layout class="QGridLayout" > + <property name="margin" > + <number>9</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item row="0" column="0" > + <widget class="QTableWidget" name="functionTable" /> + </item> + </layout> + </widget> + <layoutdefault spacing="6" margin="11" /> + <resources/> + <connections/> +</ui> Modified: trunk/qcell/baseheaders/simulationwindow.h =================================================================== --- trunk/qcell/baseheaders/simulationwindow.h 2007-01-20 21:55:04 UTC (rev 217) +++ trunk/qcell/baseheaders/simulationwindow.h 2007-01-21 13:41:18 UTC (rev 218) @@ -20,6 +20,9 @@ #include "view1dtexttools.h" #include "math.h" +//************** test ***************** +#include "functiontable.h" + #include <QToolBox> // this is widget make visualization of world data @@ -32,6 +35,9 @@ Ui::simulationWindowClass ui; protected: + // only for test + FunctionTable *ft; + Renderer *renderer; int cursor_x, cursor_y; int z_plane; @@ -129,6 +135,9 @@ void storeSelectedData(void); void pasteStoredData(void); + //for test only + FunctionTable * getFunctionTable(void); + }; #endif // SIMULATIONWINDOW_H Modified: trunk/qcell/baseheaders/simulationwindow.ui =================================================================== --- trunk/qcell/baseheaders/simulationwindow.ui 2007-01-20 21:55:04 UTC (rev 217) +++ trunk/qcell/baseheaders/simulationwindow.ui 2007-01-21 13:41:18 UTC (rev 218) @@ -25,8 +25,8 @@ <rect> <x>10</x> <y>10</y> - <width>251</width> - <height>78</height> + <width>381</width> + <height>281</height> </rect> </property> <property name="tabPosition" > @@ -36,7 +36,7 @@ <enum>QTabWidget::Rounded</enum> </property> <property name="currentIndex" > - <number>0</number> + <number>5</number> </property> <widget class="QWidget" name="view3D" > <attribute name="title" > @@ -108,6 +108,11 @@ </item> </layout> </widget> + <widget class="QWidget" name="functionTab" > + <attribute name="title" > + <string>Function</string> + </attribute> + </widget> </widget> </widget> <layoutdefault spacing="6" margin="11" /> Modified: trunk/qcell/basesources/LocalFunction.cpp =================================================================== --- trunk/qcell/basesources/LocalFunction.cpp 2007-01-20 21:55:04 UTC (rev 217) +++ trunk/qcell/basesources/LocalFunction.cpp 2007-01-21 13:41:18 UTC (rev 218) @@ -707,11 +707,6 @@ int LocalFunction::getRowNumber(void) { - return pow(maxArgVal, numArg); -} - -int LocalFunction::getColumnNumber(void) -{ int out = 1; if(sumArguments.size()==0) return 0; @@ -720,6 +715,11 @@ return out; } +int LocalFunction::getColumnNumber(void) +{ + return pow(maxArgVal, freeArguments.size()); +} + int LocalFunction::getValueAt(int index) { return valueTable[index]; @@ -738,7 +738,7 @@ QVector<int> calcVector; int rows = 1; for(int i=0;i<sumArguments.size();++i) - rows *= sumArguments[i].size() * (maxArgVal - 1) + 2; + rows *= sumArguments[i].size() * (maxArgVal - 1) + 1; for(int i=0;i<rows;++i) { Added: trunk/qcell/basesources/functiontable.cpp =================================================================== --- trunk/qcell/basesources/functiontable.cpp (rev 0) +++ trunk/qcell/basesources/functiontable.cpp 2007-01-21 13:41:18 UTC (rev 218) @@ -0,0 +1,48 @@ +#include "../baseheaders/functiontable.h" + +void FunctionTable::init(void) +{ + QTableWidgetItem *item; + int counter=0; + QStringList headers; + if(function) + { + ui.functionTable->clear(); + ui.functionTable->setRowCount(function->getRowNumber()); + ui.functionTable->setColumnCount(function->getColumnNumber()); + for(int i=0;i<ui.functionTable->rowCount();++i) + { + for(int j=0;j<ui.functionTable->columnCount();++j) + { + item = new QTableWidgetItem; + item->setText(tr("%1").arg(function->getValueAt(counter))); + item->setTextAlignment(Qt::AlignCenter); + ui.functionTable->setItem(i, j, item); + ++counter; + } + } + headers = function->rowsHeaders(); + ui.functionTable->setVerticalHeaderLabels(headers); + headers = function->columnHeaders(); + ui.functionTable->setHorizontalHeaderLabels(headers); + ui.functionTable->resizeColumnsToContents(); + ui.functionTable->resizeRowsToContents(); + } +} + +FunctionTable::FunctionTable(QWidget *parent) + : QWidget(parent) +{ + ui.setupUi(this); +} + +FunctionTable::~FunctionTable() +{ + +} + +void FunctionTable::setFunctionPointer(LocalFunction *f) +{ + function = f; + init(); +} \ No newline at end of file Modified: trunk/qcell/basesources/simulationwindow.cpp =================================================================== --- trunk/qcell/basesources/simulationwindow.cpp 2007-01-20 21:55:04 UTC (rev 217) +++ trunk/qcell/basesources/simulationwindow.cpp 2007-01-21 13:41:18 UTC (rev 218) @@ -665,6 +665,9 @@ ui.tabWidget->setTabEnabled(1, 0); ui.tabWidget->setTabEnabled(2, 0); ui.tabWidget->setTabEnabled(3, 0); + + // for test only + ft = new FunctionTable(ui.functionTab); } simulationWindow::~simulationWindow() @@ -1314,3 +1317,8 @@ repaint(); } } +// for test only +FunctionTable * simulationWindow::getFunctionTable(void) +{ + return ft; +} Modified: trunk/qcell/visgui/MainWindow.cpp =================================================================== --- trunk/qcell/visgui/MainWindow.cpp 2007-01-20 21:55:04 UTC (rev 217) +++ trunk/qcell/visgui/MainWindow.cpp 2007-01-21 13:41:18 UTC (rev 218) @@ -339,6 +339,9 @@ action_Function_save->setEnabled(true); calc.setLocalFunction(local_function); + // for test only ********************************* + sw->getFunctionTable()->setFunctionPointer(local_function); + //************************************************ } else if (type == "World") { Modified: trunk/qcell/visgui/visgui.pro =================================================================== --- trunk/qcell/visgui/visgui.pro 2007-01-20 21:55:04 UTC (rev 217) +++ trunk/qcell/visgui/visgui.pro 2007-01-21 13:41:18 UTC (rev 218) @@ -12,7 +12,8 @@ ../baseheaders/basetools.ui \ ../baseheaders/view3dtools.ui \ ../baseheaders/view2dtexttools.ui \ - ../baseheaders/view1dtexttools.ui + ../baseheaders/view1dtexttools.ui \ + ../baseheaders/functiontable.ui HEADERS = MainWindow.h \ ExperimentSetup.h \ ../baseheaders/Client.h \ @@ -30,7 +31,8 @@ ../baseheaders/view3dtools.h \ ../baseheaders/view2dtexttools.h \ ../baseheaders/view1dtexttools.h \ - ../baseheaders/ElementalRules.h + ../baseheaders/ElementalRules.h \ + ../baseheaders/functiontable.h SOURCES = ../basesources/GenericParserPlugin.cpp \ main.cpp \ @@ -48,7 +50,8 @@ ../basesources/view3dtools.cpp \ ../basesources/view2dtexttools.cpp \ ../basesources/view1dtexttools.cpp \ - ../basesources/ElementalRules.cpp + ../basesources/ElementalRules.cpp \ + ../basesources/functiontable.cpp LIBS = -L../libs -lN -lFQT -lKI -lREAK -lLTFL -lZIFW -lZIFWP This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dhu...@us...> - 2007-01-21 17:21:17
|
Revision: 219 http://svn.sourceforge.net/qcell/?rev=219&view=rev Author: dhubleizh Date: 2007-01-21 09:21:10 -0800 (Sun, 21 Jan 2007) Log Message: ----------- - new ElementalRulesWidget to display rules - MainWindow uses the new widget - Calculator signals bout results Modified Paths: -------------- trunk/qcell/baseheaders/Calculator.h trunk/qcell/baseheaders/ElementalRules.h trunk/qcell/basesources/Calculator.cpp trunk/qcell/basesources/ElementalRules.cpp trunk/qcell/visgui/MainWindow.cpp trunk/qcell/visgui/MainWindow.h trunk/qcell/visgui/MainWindow.ui trunk/qcell/visgui/visgui.pro Added Paths: ----------- trunk/qcell/visgui/ElementalRulesWidget.cpp trunk/qcell/visgui/ElementalRulesWidget.h trunk/qcell/visgui/ElementalRulesWidget.ui Modified: trunk/qcell/baseheaders/Calculator.h =================================================================== --- trunk/qcell/baseheaders/Calculator.h 2007-01-21 13:41:18 UTC (rev 218) +++ trunk/qcell/baseheaders/Calculator.h 2007-01-21 17:21:10 UTC (rev 219) @@ -55,6 +55,8 @@ protected slots: void setupSpace(void); +signals: + void calculated(QVector<int> coordinates, QVector<int> arguments, int result); }; #endif Modified: trunk/qcell/baseheaders/ElementalRules.h =================================================================== --- trunk/qcell/baseheaders/ElementalRules.h 2007-01-21 13:41:18 UTC (rev 218) +++ trunk/qcell/baseheaders/ElementalRules.h 2007-01-21 17:21:10 UTC (rev 219) @@ -17,6 +17,9 @@ class ElementalRules : public QObject { Q_OBJECT +signals: + void newRule(int id, QVector<int> coordinates); + void newOccurance(int id, QVector<int> coordinates); public slots: void possibleRule(QVector<int> coordinates, QVector<int> neighbours, int result); protected: Modified: trunk/qcell/basesources/Calculator.cpp =================================================================== --- trunk/qcell/basesources/Calculator.cpp 2007-01-21 13:41:18 UTC (rev 218) +++ trunk/qcell/basesources/Calculator.cpp 2007-01-21 17:21:10 UTC (rev 219) @@ -225,6 +225,7 @@ int counter = 0; char temp[8] = {0,0,0,0,0,0,0,0}; int sx = sizeX, sy = sizeY, sz = sizeZ, st = sizeT; + QVector<int> coordinates(4, 0); if(sy==0) sy=1; @@ -239,12 +240,16 @@ for(int t=0;t<st;++t) { + coordinates[3] = t; for(int z=0;z<sz;++z) { + coordinates[2] = z; for(int y=0;y<sy;++y) { + coordinates[1] = y; for(int x=0;x<sx;++x) { + coordinates[0] = x; neighbourhood->resolveValues(tempData + (x - minBorder[0]) + ((y - minBorder[1]) * tempDataSize[0]) + (z - minBorder[2]) * (tempDataSize[0] * tempDataSize[1]) + (t - minBorder[3]) * (tempDataSize[0] * tempDataSize[1] * tempDataSize[2]) * dataSize); switch(dataType) { @@ -262,7 +267,8 @@ *((double *)temp) = localfunction->resolve(neighbourhood->valuesToVector_d()); break; } - + + emit calculated(coordinates, neighbourhood->valuesToVector_i(), (int)temp); memcpy(data + counter, temp, dataSize); counter += dataSize; } Modified: trunk/qcell/basesources/ElementalRules.cpp =================================================================== --- trunk/qcell/basesources/ElementalRules.cpp 2007-01-21 13:41:18 UTC (rev 218) +++ trunk/qcell/basesources/ElementalRules.cpp 2007-01-21 17:21:10 UTC (rev 219) @@ -18,12 +18,12 @@ // where do things reside int value_index, neighbour_index, rule_index; // Is this a new rule case? - bool newRule = false; + bool isNewRule = false; // search if we haven't already have this return value // or this neighbours configuration in databse value_index = return_values.indexOf(return_value); - this->neighbours.indexOf(neighbours); + neighbour_index = this->neighbours.indexOf(neighbours); // if we don't have the return vale, let's add it // and modify the value_index accordingly @@ -31,7 +31,7 @@ { return_values.append(return_value); value_index = return_values.count() - 1; - newRule = true; + isNewRule = true; } // same thing with neighbours @@ -39,16 +39,19 @@ { this->neighbours.append(neighbours); neighbour_index = this->neighbours.count() - 1; - newRule = true; + isNewRule = true; } // If neighbours or return_value is new - if (newRule) + if (isNewRule) { // bumb the index rule_index = ++index; // and insert a new rule rules.insert(rule_index, rulePair(&return_values[value_index], &this->neighbours[neighbour_index])); + + // Notify the GUI + emit newRule(rule_index, coordinates); } // If both were present else @@ -59,10 +62,14 @@ &this->neighbours[this->neighbours.indexOf(neighbours)] ) ); + + // Notify the GUI + emit newOccurance(rule_index, coordinates); } // At the end we note the coordinates rules_mask.insert(rule_index, coordinates); + emit } void ElementalRules::possibleRule(QVector<int> coordinates, QVector<int> neighbours, int result) Added: trunk/qcell/visgui/ElementalRulesWidget.cpp =================================================================== --- trunk/qcell/visgui/ElementalRulesWidget.cpp (rev 0) +++ trunk/qcell/visgui/ElementalRulesWidget.cpp 2007-01-21 17:21:10 UTC (rev 219) @@ -0,0 +1,57 @@ +/**@file ElementalRulesWidget.cpp + * @author czarny + * @date + * Created: nie 21 sty 2007 16:48:37 CET \n + * Last Update: nie 21 sty 2007 16:48:37 CET + */ + +#include "ElementalRulesWidget.h" + +ElementalRulesWidget::ElementalRulesWidget() +{ + setupUi(this); + treeWidget->setColumnCount(2); + QStringList labels; + labels << tr("Rule") << tr("Occur"); + treeWidget->setHeaderLabels(labels); +} + +void ElementalRulesWidget::addRule(int id, QVector<int> coordinates) +{ + // Values to be added + QStringList values; + + values << ""; + // Add coordinates + values << parserCoordinates(coordinates); + + // Add top-level id + QTreeWidgetItem* item = new QTreeWidgetItem(QStringList(QString::number(id))); + item->addChild(new QTreeWidgetItem(values)); + treeWidget->addTopLevelItem(item); +} + +void ElementalRulesWidget::addOccurance(int id, QVector<int> coordinates) +{ + QTreeWidgetItem* item = treeWidget->findItems( + QString::number(id), + Qt::MatchExactly) + .first(); + + item->addChild(new QTreeWidgetItem(QStringList(parserCoordinates(coordinates)))); +} + +QString ElementalRulesWidget::parserCoordinates(QVector<int> coordinates) +{ + // Construct a string with coordinates + // (x, y, z, t) + QString coord_string('('); + foreach(int value, coordinates) + { + coord_string.append(QString::number(value)+','); + } + // Remove pending `,' + coord_string.chop(1); + return coord_string.append(')'); +} + Added: trunk/qcell/visgui/ElementalRulesWidget.h =================================================================== --- trunk/qcell/visgui/ElementalRulesWidget.h (rev 0) +++ trunk/qcell/visgui/ElementalRulesWidget.h 2007-01-21 17:21:10 UTC (rev 219) @@ -0,0 +1,29 @@ +/**@file ElementalRulesWidget.h + * @author czarny + * @date + * Created: nie 21 sty 2007 16:44:42 CET \n + * Last Update: nie 21 sty 2007 16:44:42 CET + * @brief Widget containing elemantal rules list + */ + +#ifndef __ELEMENTALRULESWIDGET_H__ +#define __ELEMENTALRULESWIDGET_H__ + +#include "ui_ElementalRules.h" +#include <QDockWidget> +#include <QStringList> + +class ElementalRulesWidget: public QWidget, public Ui::ElementalRulesForm +{ + Q_OBJECT +protected: + QString parserCoordinates(QVector<int> coordinates); +public slots: + void addRule(int id, QVector<int> coordinates); + void addOccurance(int id, QVector<int> coordinates); +public: + ElementalRulesWidget(); + +}; + +#endif // __ELEMENTALRULESWIDGET_H__ Added: trunk/qcell/visgui/ElementalRulesWidget.ui =================================================================== --- trunk/qcell/visgui/ElementalRulesWidget.ui (rev 0) +++ trunk/qcell/visgui/ElementalRulesWidget.ui 2007-01-21 17:21:10 UTC (rev 219) @@ -0,0 +1,43 @@ +<ui version="4.0" > + <class>ElementalRulesForm</class> + <widget class="QWidget" name="ElementalRulesForm" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>467</width> + <height>300</height> + </rect> + </property> + <property name="windowTitle" > + <string>Form</string> + </property> + <layout class="QVBoxLayout" > + <property name="margin" > + <number>9</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QTreeWidget" name="rulesTree" > + <property name="columnCount" > + <number>2</number> + </property> + <column> + <property name="text" > + <string>1</string> + </property> + </column> + <column> + <property name="text" > + <string>1</string> + </property> + </column> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> Modified: trunk/qcell/visgui/MainWindow.cpp =================================================================== --- trunk/qcell/visgui/MainWindow.cpp 2007-01-21 13:41:18 UTC (rev 218) +++ trunk/qcell/visgui/MainWindow.cpp 2007-01-21 17:21:10 UTC (rev 219) @@ -56,6 +56,22 @@ ParserInterface* iParser; QStringList parser_types, file_types; + elemental_dock = new QDockWidget(this); + elemental_dock->setWidget(new ElementalRulesWidget()); + addDockWidget(Qt::LeftDockWidgetArea, elemental_dock); + elemental_dock->hide(); +// // Setting up content +// QWidget* w = new QWidget(); +// Ui::elemntalRulesForm ui; +// ui.setupUi(w); +// +// // Creating new dock widget +// elemental_dock = new QDockWidget(); +// elemental_dock->setWidget(w); +// +// // Place the widget on the lef +// addDockWidget(Qt::LeftDockWidgetArea, elemental_dock); + // We check each static plugin if it is a parser plugin // and if it is we register each parsing fucntion // according to supported types and file extensions @@ -376,7 +392,16 @@ *(CalculationData*)&calc = *data.last(); // Creating elemental rules accroding to DATA_TYPE elemental_rules = new ElementalRules; + connect(&calc, SIGNAL(calculated(QVector<int>, QVector<int>, int)), + elemental_rules, SLOT(possibleRule(QVector<int>, QVector<int>, int)) + ); + connect(elemental_rules, SIGNAL(newRule(int, QVector<int>)), + ((ElementalRulesWidget*)elemental_dock->widget()), SLOT(addRule(int, QVector<int>)) + ); + +// void newOccurance(int id, QVector<int> coordinates); + iteration=0; // visualization update @@ -938,3 +963,15 @@ delaySlider->blockSignals(false); } +void MainWindow::on_action_Elemental_rules_toggled(bool checked) +{ + if (checked) + { + elemental_dock->show(); + } + else + { + elemental_dock->hide(); + } +} + Modified: trunk/qcell/visgui/MainWindow.h =================================================================== --- trunk/qcell/visgui/MainWindow.h 2007-01-21 13:41:18 UTC (rev 218) +++ trunk/qcell/visgui/MainWindow.h 2007-01-21 17:21:10 UTC (rev 219) @@ -12,6 +12,7 @@ #include "ui_MainWindow.h" #include "ui_AboutDialog.h" #include "ExperimentSetup.h" +#include "ElementalRulesWidget.h" #include "ElementalRules.h" #include <QPluginLoader> #include "GenericParserPlugin.h" @@ -55,6 +56,7 @@ void sliderChanged(int value); void spinBoxChanged(double value); + void update(); /// @todo not here! void on_action_Forward_activated(); @@ -64,6 +66,8 @@ void on_action_Stop_activated(); void on_action_Restart_activated(); + void on_action_Elemental_rules_toggled(bool checked); + void loadingSuccess(QString filetype); private: simulationWindow* sw; @@ -92,6 +96,7 @@ Calculator calc; ElementalRules* elemental_rules; + QDockWidget* elemental_dock; QList<CalculationData*> data; LocalFunction* local_function; Neighbourhood* neighbourhood; Modified: trunk/qcell/visgui/MainWindow.ui =================================================================== --- trunk/qcell/visgui/MainWindow.ui 2007-01-21 13:41:18 UTC (rev 218) +++ trunk/qcell/visgui/MainWindow.ui 2007-01-21 17:21:10 UTC (rev 219) @@ -89,7 +89,14 @@ <addaction name="separator" /> <addaction name="action_Quit" /> </widget> + <widget class="QMenu" name="menu_View" > + <property name="title" > + <string>&View</string> + </property> + <addaction name="action_Elemental_rules" /> + </widget> <addaction name="menu_File" /> + <addaction name="menu_View" /> <addaction name="menu_Experiment" /> <addaction name="menu_Help" /> </widget> @@ -281,6 +288,14 @@ <string>Saves the whole experiment with history for later continuation.</string> </property> </action> + <action name="action_Elemental_rules" > + <property name="checkable" > + <bool>true</bool> + </property> + <property name="text" > + <string>&Elemental rules</string> + </property> + </action> </widget> <resources/> <connections/> Modified: trunk/qcell/visgui/visgui.pro =================================================================== --- trunk/qcell/visgui/visgui.pro 2007-01-21 13:41:18 UTC (rev 218) +++ trunk/qcell/visgui/visgui.pro 2007-01-21 17:21:10 UTC (rev 219) @@ -8,14 +8,17 @@ FORMS = MainWindow.ui \ AboutDialog.ui \ ExperimentSetup.ui \ + ElementalRulesWidget.ui \ ../baseheaders/simulationwindow.ui \ ../baseheaders/basetools.ui \ ../baseheaders/view3dtools.ui \ ../baseheaders/view2dtexttools.ui \ ../baseheaders/view1dtexttools.ui \ ../baseheaders/functiontable.ui + HEADERS = MainWindow.h \ ExperimentSetup.h \ + ElementalRulesWidget.h \ ../baseheaders/Client.h \ ../baseheaders/ClientInfo.h \ ../baseheaders/BaseDataTypes.h \ @@ -38,6 +41,7 @@ main.cpp \ MainWindow.cpp \ ExperimentSetup.cpp \ + ElementalRulesWidget.cpp \ ../basesources/Client.cpp \ ../basesources/ClientInfo.cpp \ ../basesources/Neighbourhood.cpp \ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <le...@us...> - 2007-01-21 17:23:52
|
Revision: 220 http://svn.sourceforge.net/qcell/?rev=220&view=rev Author: lessm Date: 2007-01-21 09:23:50 -0800 (Sun, 21 Jan 2007) Log Message: ----------- - FunctionTable class can edit loaded function Modified Paths: -------------- trunk/qcell/baseheaders/functiontable.h trunk/qcell/baseheaders/functiontable.ui trunk/qcell/basesources/functiontable.cpp trunk/qcell/basesources/simulationwindow.cpp Modified: trunk/qcell/baseheaders/functiontable.h =================================================================== --- trunk/qcell/baseheaders/functiontable.h 2007-01-21 17:21:10 UTC (rev 219) +++ trunk/qcell/baseheaders/functiontable.h 2007-01-21 17:23:50 UTC (rev 220) @@ -27,6 +27,9 @@ void setFunctionPointer(LocalFunction *f); +protected slots: + void functionEdit(int row, int column); + }; #endif // FUNCTIONTABLE_H Modified: trunk/qcell/baseheaders/functiontable.ui =================================================================== --- trunk/qcell/baseheaders/functiontable.ui 2007-01-21 17:21:10 UTC (rev 219) +++ trunk/qcell/baseheaders/functiontable.ui 2007-01-21 17:23:50 UTC (rev 220) @@ -5,8 +5,8 @@ <rect> <x>0</x> <y>0</y> - <width>388</width> - <height>310</height> + <width>400</width> + <height>300</height> </rect> </property> <property name="windowTitle" > Modified: trunk/qcell/basesources/functiontable.cpp =================================================================== --- trunk/qcell/basesources/functiontable.cpp 2007-01-21 17:21:10 UTC (rev 219) +++ trunk/qcell/basesources/functiontable.cpp 2007-01-21 17:23:50 UTC (rev 220) @@ -34,15 +34,25 @@ : QWidget(parent) { ui.setupUi(this); + connect(ui.functionTable, SIGNAL(cellChanged (int, int)), SLOT(functionEdit(int, int))); } FunctionTable::~FunctionTable() { - } void FunctionTable::setFunctionPointer(LocalFunction *f) { function = f; init(); -} \ No newline at end of file +} + +void FunctionTable::functionEdit(int row, int column) +{ + QString temp; + QTableWidgetItem *item; + item = ui.functionTable->item(row, column); + temp.setNum(item->text().toInt()); + item->setText(temp); + function->setValueAt(temp.toInt(), row * ui.functionTable->columnCount() + column); +} Modified: trunk/qcell/basesources/simulationwindow.cpp =================================================================== --- trunk/qcell/basesources/simulationwindow.cpp 2007-01-21 17:21:10 UTC (rev 219) +++ trunk/qcell/basesources/simulationwindow.cpp 2007-01-21 17:23:50 UTC (rev 220) @@ -82,6 +82,7 @@ ui.view3D->resize(ui.tabWidget->width(), ui.tabWidget->height() - 20); ui.view2DGraph->resize(ui.tabWidget->width(), ui.tabWidget->height() - 20); ui.symbolConfig->resize(ui.tabWidget->width(), ui.tabWidget->height() - 20); + ui.functionTab->resize(ui.tabWidget->width(), ui.tabWidget->height() - 20); renderer->move(1, 1); renderer->resize(ui.view3D->width() - 1, ui.view3D->height() - 1); @@ -103,9 +104,6 @@ view3DTools->move(width() - 116, basetools->height() + 1); view2DTextTools->move(width() - 116, basetools->height() + 1); view1DTextTools->move(width() - 116, basetools->height() + 1); - - - } void simulationWindow::paintEvent(QPaintEvent * event) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dhu...@us...> - 2007-01-21 18:17:53
|
Revision: 221 http://svn.sourceforge.net/qcell/?rev=221&view=rev Author: dhubleizh Date: 2007-01-21 10:17:50 -0800 (Sun, 21 Jan 2007) Log Message: ----------- - occurances adding Modified Paths: -------------- trunk/qcell/baseheaders/ElementalRules.h trunk/qcell/basesources/ElementalRules.cpp trunk/qcell/visgui/ElementalRulesWidget.cpp trunk/qcell/visgui/ElementalRulesWidget.h trunk/qcell/visgui/MainWindow.cpp Modified: trunk/qcell/baseheaders/ElementalRules.h =================================================================== --- trunk/qcell/baseheaders/ElementalRules.h 2007-01-21 17:23:50 UTC (rev 220) +++ trunk/qcell/baseheaders/ElementalRules.h 2007-01-21 18:17:50 UTC (rev 221) @@ -32,7 +32,7 @@ typedef QPair<int*, QVector<int>*> rulePair; // Rule maps a rule number to a rule. // A rule is really a pair of return value and neighbours - QMultiHash<int, QPair<int*, QVector<int>*> > rules; + QMultiHash<int, rulePair > rules; // This hash holds coordinates, that have a certain rule QMultiHash<int, QVector<int> > rules_mask; Modified: trunk/qcell/basesources/ElementalRules.cpp =================================================================== --- trunk/qcell/basesources/ElementalRules.cpp 2007-01-21 17:23:50 UTC (rev 220) +++ trunk/qcell/basesources/ElementalRules.cpp 2007-01-21 18:17:50 UTC (rev 221) @@ -46,7 +46,7 @@ if (isNewRule) { // bumb the index - rule_index = ++index; + rule_index = index++; // and insert a new rule rules.insert(rule_index, rulePair(&return_values[value_index], &this->neighbours[neighbour_index])); @@ -56,10 +56,11 @@ // If both were present else { + /// @todo This needs a redo. Adding new occurances is more common then adding new rules // Find indexes, take out pointers and make a new rule rule_index = rules.key(rulePair( - &return_values[return_values.indexOf(return_value)], - &this->neighbours[this->neighbours.indexOf(neighbours)] + &return_values[value_index], + &this->neighbours[neighbour_index] ) ); @@ -69,7 +70,6 @@ // At the end we note the coordinates rules_mask.insert(rule_index, coordinates); - emit } void ElementalRules::possibleRule(QVector<int> coordinates, QVector<int> neighbours, int result) Modified: trunk/qcell/visgui/ElementalRulesWidget.cpp =================================================================== --- trunk/qcell/visgui/ElementalRulesWidget.cpp 2007-01-21 17:23:50 UTC (rev 220) +++ trunk/qcell/visgui/ElementalRulesWidget.cpp 2007-01-21 18:17:50 UTC (rev 221) @@ -21,9 +21,9 @@ // Values to be added QStringList values; - values << ""; + values << "-"; // Add coordinates - values << parserCoordinates(coordinates); + values << parseCoordinates(coordinates); // Add top-level id QTreeWidgetItem* item = new QTreeWidgetItem(QStringList(QString::number(id))); @@ -38,10 +38,12 @@ Qt::MatchExactly) .first(); - item->addChild(new QTreeWidgetItem(QStringList(parserCoordinates(coordinates)))); + QStringList values("-"); + values << parseCoordinates(coordinates); + item->addChild(new QTreeWidgetItem(values)); } -QString ElementalRulesWidget::parserCoordinates(QVector<int> coordinates) +QString ElementalRulesWidget::parseCoordinates(QVector<int> coordinates) { // Construct a string with coordinates // (x, y, z, t) Modified: trunk/qcell/visgui/ElementalRulesWidget.h =================================================================== --- trunk/qcell/visgui/ElementalRulesWidget.h 2007-01-21 17:23:50 UTC (rev 220) +++ trunk/qcell/visgui/ElementalRulesWidget.h 2007-01-21 18:17:50 UTC (rev 221) @@ -17,7 +17,7 @@ { Q_OBJECT protected: - QString parserCoordinates(QVector<int> coordinates); + QString parseCoordinates(QVector<int> coordinates); public slots: void addRule(int id, QVector<int> coordinates); void addOccurance(int id, QVector<int> coordinates); Modified: trunk/qcell/visgui/MainWindow.cpp =================================================================== --- trunk/qcell/visgui/MainWindow.cpp 2007-01-21 17:23:50 UTC (rev 220) +++ trunk/qcell/visgui/MainWindow.cpp 2007-01-21 18:17:50 UTC (rev 221) @@ -398,10 +398,10 @@ connect(elemental_rules, SIGNAL(newRule(int, QVector<int>)), ((ElementalRulesWidget*)elemental_dock->widget()), SLOT(addRule(int, QVector<int>)) ); - + connect(elemental_rules, SIGNAL(newOccurance(int, QVector<int>)), + ((ElementalRulesWidget*)elemental_dock->widget()), SLOT(addOccurance(int, QVector<int>)) + ); -// void newOccurance(int id, QVector<int> coordinates); - iteration=0; // visualization update This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dhu...@us...> - 2007-01-21 19:24:06
|
Revision: 223 http://svn.sourceforge.net/qcell/?rev=223&view=rev Author: dhubleizh Date: 2007-01-21 11:24:03 -0800 (Sun, 21 Jan 2007) Log Message: ----------- - more elaborate ElementalRules display Modified Paths: -------------- trunk/qcell/baseheaders/ElementalRules.h trunk/qcell/basesources/Calculator.cpp trunk/qcell/basesources/ElementalRules.cpp trunk/qcell/visgui/ElementalRulesWidget.cpp trunk/qcell/visgui/ElementalRulesWidget.h trunk/qcell/visgui/MainWindow.cpp Modified: trunk/qcell/baseheaders/ElementalRules.h =================================================================== --- trunk/qcell/baseheaders/ElementalRules.h 2007-01-21 18:35:01 UTC (rev 222) +++ trunk/qcell/baseheaders/ElementalRules.h 2007-01-21 19:24:03 UTC (rev 223) @@ -18,10 +18,10 @@ { Q_OBJECT signals: - void newRule(int id, QVector<int> coordinates); + void newRule(int id, QVector<int> neighbours, int result, QVector<int> coordinates); void newOccurance(int id, QVector<int> coordinates); public slots: - void possibleRule(QVector<int> coordinates, QVector<int> neighbours, int result); + void possibleRule(QVector<int> coordinates, QVector<int> neighbours, int return_value); protected: int neighbours_count; int index; @@ -42,8 +42,6 @@ void setNeighoursCount(const int neighbours); inline int getNeighbourCount(); - void addRule(QVector<int> coodrinates, QVector<int> neighbours, int return_value); - }; Modified: trunk/qcell/basesources/Calculator.cpp =================================================================== --- trunk/qcell/basesources/Calculator.cpp 2007-01-21 18:35:01 UTC (rev 222) +++ trunk/qcell/basesources/Calculator.cpp 2007-01-21 19:24:03 UTC (rev 223) @@ -267,7 +267,7 @@ break; } - emit calculated(coordinates, neighbourhood->valuesToVector_i(), (int)temp); + emit calculated(coordinates, neighbourhood->valuesToVector_i(), (int)*temp); memcpy(data + counter, temp, dataSize); counter += dataSize; } Modified: trunk/qcell/basesources/ElementalRules.cpp =================================================================== --- trunk/qcell/basesources/ElementalRules.cpp 2007-01-21 18:35:01 UTC (rev 222) +++ trunk/qcell/basesources/ElementalRules.cpp 2007-01-21 19:24:03 UTC (rev 223) @@ -13,7 +13,7 @@ index = 0; } -void ElementalRules::addRule(QVector<int> coordinates, QVector<int> neighbours, int return_value) +void ElementalRules::possibleRule(QVector<int> coordinates, QVector<int> neighbours, int return_value) { // where do things reside int value_index, neighbour_index, rule_index; @@ -51,7 +51,7 @@ rules.insert(rule_index, rulePair(&return_values[value_index], &this->neighbours[neighbour_index])); // Notify the GUI - emit newRule(rule_index, coordinates); + emit newRule(rule_index, neighbours, return_value, coordinates); } // If both were present else @@ -72,8 +72,3 @@ rules_mask.insert(rule_index, coordinates); } -void ElementalRules::possibleRule(QVector<int> coordinates, QVector<int> neighbours, int result) -{ - addRule(coordinates, neighbours, result); -} - Modified: trunk/qcell/visgui/ElementalRulesWidget.cpp =================================================================== --- trunk/qcell/visgui/ElementalRulesWidget.cpp 2007-01-21 18:35:01 UTC (rev 222) +++ trunk/qcell/visgui/ElementalRulesWidget.cpp 2007-01-21 19:24:03 UTC (rev 223) @@ -16,17 +16,20 @@ rulesTree->setHeaderLabels(labels); } -void ElementalRulesWidget::addRule(int id, QVector<int> coordinates) +void ElementalRulesWidget::addRule(int id, QVector<int> neighbrous, int result, QVector<int> coordinates) { // Values to be added QStringList values; - values << "-"; + values << QString(); // Add coordinates values << parseCoordinates(coordinates); // Add top-level id - QTreeWidgetItem* item = new QTreeWidgetItem(QStringList(QString::number(id))); + QStringList rule(QString::number(id)); + rule << + QString("%1 => %2").arg(parseCoordinates(neighbrous)).arg(QString::number(result)); + QTreeWidgetItem* item = new QTreeWidgetItem(rule); item->addChild(new QTreeWidgetItem(values)); rulesTree->addTopLevelItem(item); } @@ -34,7 +37,7 @@ void ElementalRulesWidget::addOccurance(int id, QVector<int> coordinates) { QTreeWidgetItem* item = rulesTree->findItems( QString::number(id), Qt::MatchExactly).first(); - QStringList values("-"); + QStringList values(""); values << parseCoordinates(coordinates); item->addChild(new QTreeWidgetItem(values)); } Modified: trunk/qcell/visgui/ElementalRulesWidget.h =================================================================== --- trunk/qcell/visgui/ElementalRulesWidget.h 2007-01-21 18:35:01 UTC (rev 222) +++ trunk/qcell/visgui/ElementalRulesWidget.h 2007-01-21 19:24:03 UTC (rev 223) @@ -20,7 +20,7 @@ protected: QString parseCoordinates(QVector<int> coordinates); public slots: - void addRule(int id, QVector<int> coordinates); + void addRule(int id, QVector<int> neighbours, int result, QVector<int> coordinates); void addOccurance(int id, QVector<int> coordinates); public: ElementalRulesWidget(); Modified: trunk/qcell/visgui/MainWindow.cpp =================================================================== --- trunk/qcell/visgui/MainWindow.cpp 2007-01-21 18:35:01 UTC (rev 222) +++ trunk/qcell/visgui/MainWindow.cpp 2007-01-21 19:24:03 UTC (rev 223) @@ -395,8 +395,8 @@ connect(&calc, SIGNAL(calculated(QVector<int>, QVector<int>, int)), elemental_rules, SLOT(possibleRule(QVector<int>, QVector<int>, int)) ); - connect(elemental_rules, SIGNAL(newRule(int, QVector<int>)), - ((ElementalRulesWidget*)elemental_dock->widget()), SLOT(addRule(int, QVector<int>)) + connect(elemental_rules, SIGNAL(newRule(int, QVector<int>, int, QVector<int>)), + ((ElementalRulesWidget*)elemental_dock->widget()), SLOT(addRule(int, QVector<int>, int, QVector<int>)) ); connect(elemental_rules, SIGNAL(newOccurance(int, QVector<int>)), ((ElementalRulesWidget*)elemental_dock->widget()), SLOT(addOccurance(int, QVector<int>)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dhu...@us...> - 2007-01-21 19:35:18
|
Revision: 224 http://svn.sourceforge.net/qcell/?rev=224&view=rev Author: dhubleizh Date: 2007-01-21 11:35:16 -0800 (Sun, 21 Jan 2007) Log Message: ----------- - debug from FQT parser removed - no more ElementalWidget display bug Modified Paths: -------------- trunk/qcell/parsers/FQT/FQTParserPlugin.cpp trunk/qcell/visgui/MainWindow.cpp Modified: trunk/qcell/parsers/FQT/FQTParserPlugin.cpp =================================================================== --- trunk/qcell/parsers/FQT/FQTParserPlugin.cpp 2007-01-21 19:24:03 UTC (rev 223) +++ trunk/qcell/parsers/FQT/FQTParserPlugin.cpp 2007-01-21 19:35:16 UTC (rev 224) @@ -6,7 +6,6 @@ * Last Update: czw lis 30 14:19:22 CET 2006 */ #include "FQTParserPlugin.h" -#include <QDebug> FQTParserPlugin::FQTParserPlugin() { @@ -289,8 +288,6 @@ test.append(','); } - qDebug() << sum << " : " << test; - } switch(lf.getFunctonType()) Modified: trunk/qcell/visgui/MainWindow.cpp =================================================================== --- trunk/qcell/visgui/MainWindow.cpp 2007-01-21 19:24:03 UTC (rev 223) +++ trunk/qcell/visgui/MainWindow.cpp 2007-01-21 19:35:16 UTC (rev 224) @@ -56,25 +56,13 @@ ParserInterface* iParser; QStringList parser_types, file_types; + // Elemental dock widget elemental_dock = new QDockWidget(this); + // We don't want it appear at the beginning + elemental_dock->hide(); elemental_dock->setWidget(new ElementalRulesWidget()); addDockWidget(Qt::LeftDockWidgetArea, elemental_dock); - elemental_dock->hide(); -// // Setting up content -// QWidget* w = new QWidget(); -// Ui::elemntalRulesForm ui; -// ui.setupUi(w); -// -// // Creating new dock widget -// elemental_dock = new QDockWidget(); -// elemental_dock->setWidget(w); -// -// // Place the widget on the lef -// addDockWidget(Qt::LeftDockWidgetArea, elemental_dock); - // We check each static plugin if it is a parser plugin - // and if it is we register each parsing fucntion - // according to supported types and file extensions foreach(QObject* plugin, QPluginLoader::staticInstances()) { iParser = qobject_cast<ParserInterface*>(plugin); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <le...@us...> - 2007-01-21 19:37:16
|
Revision: 225 http://svn.sourceforge.net/qcell/?rev=225&view=rev Author: lessm Date: 2007-01-21 11:37:08 -0800 (Sun, 21 Jan 2007) Log Message: ----------- - 1D view updated Modified Paths: -------------- trunk/qcell/baseheaders/Calculator.h trunk/qcell/baseheaders/LocalFunction.h trunk/qcell/basesources/Calculator.cpp trunk/qcell/basesources/LocalFunction.cpp trunk/qcell/basesources/simulationwindow.cpp Modified: trunk/qcell/baseheaders/Calculator.h =================================================================== --- trunk/qcell/baseheaders/Calculator.h 2007-01-21 19:35:16 UTC (rev 224) +++ trunk/qcell/baseheaders/Calculator.h 2007-01-21 19:37:08 UTC (rev 225) @@ -33,12 +33,18 @@ BORDER borderType; + // kuska + int startX, startY, startZ, startT; + int storedCounter; + protected: void clearTempData(void); void copyData(void); bool resizeTempDataBuffer(bool dataCopy=0, char *dataPointer=NULL); void updateBorder(void); - + // for kozka + void storeSetings(void); + //************************************************* public: Calculator(); @@ -49,14 +55,21 @@ int getTempDataSizeInByte(void); + // for kozka void calculate(void); + bool isFreezed(void); + void resumeCalculation(void); + // ************************************************ Calculator & operator = (CalculationData &cData); protected slots: void setupSpace(void); + signals: void calculated(QVector<int> coordinates, QVector<int> arguments, int result); + + void freeze(Calculator *calculator, int index); }; #endif Modified: trunk/qcell/baseheaders/LocalFunction.h =================================================================== --- trunk/qcell/baseheaders/LocalFunction.h 2007-01-21 19:35:16 UTC (rev 224) +++ trunk/qcell/baseheaders/LocalFunction.h 2007-01-21 19:37:08 UTC (rev 225) @@ -161,6 +161,7 @@ signals: // signal emit when resolv used void valueCalculate(QVector<int> args); + void unknownValue(int index); }; #endif Modified: trunk/qcell/basesources/Calculator.cpp =================================================================== --- trunk/qcell/basesources/Calculator.cpp 2007-01-21 19:35:16 UTC (rev 224) +++ trunk/qcell/basesources/Calculator.cpp 2007-01-21 19:37:08 UTC (rev 225) @@ -110,6 +110,11 @@ } +void Calculator::storeSetings(void) +{ + +} + Calculator::Calculator() { tempData = NULL; @@ -122,6 +127,9 @@ borderType = Calculator::TORUS; connect(this, SIGNAL(dataResized()), SLOT(setupSpace())); + + startX = startY = startZ = startT = 0; + storedCounter = 0; } Calculator::~Calculator() @@ -238,16 +246,16 @@ copyData(); - for(int t=0;t<st;++t) + for(int t=startT;t<st;++t) { coordinates[3] = t; - for(int z=0;z<sz;++z) + for(int z=startZ;z<sz;++z) { coordinates[2] = z; - for(int y=0;y<sy;++y) + for(int y=startY;y<sy;++y) { coordinates[1] = y; - for(int x=0;x<sx;++x) + for(int x=startX;x<sx;++x) { coordinates[0] = x; neighbourhood->resolveValues(tempData + (x - minBorder[0]) + ((y - minBorder[1]) * tempDataSize[0]) + (z - minBorder[2]) * (tempDataSize[0] * tempDataSize[1]) + (t - minBorder[3]) * (tempDataSize[0] * tempDataSize[1] * tempDataSize[2]) * dataSize); @@ -266,7 +274,11 @@ *((double *)temp) = localfunction->resolve(neighbourhood->valuesToVector_d()); break; } - + if(*((int *)temp)<0) + { + //kuska + return; + } emit calculated(coordinates, neighbourhood->valuesToVector_i(), (int)*temp); memcpy(data + counter, temp, dataSize); counter += dataSize; @@ -277,6 +289,15 @@ } +bool Calculator::isFreezed(void) +{ + return 0; +} + +void Calculator::resumeCalculation(void) +{ +} + Calculator & Calculator::operator = (CalculationData &cData) { if(cData.getDimension()!=getDimension() || cData.getSizeX() != getSizeX() || cData.getSizeY() != getSizeY() || cData.getSizeZ() != getSizeZ() || cData.getSizeT() != getSizeT()) Modified: trunk/qcell/basesources/LocalFunction.cpp =================================================================== --- trunk/qcell/basesources/LocalFunction.cpp 2007-01-21 19:35:16 UTC (rev 224) +++ trunk/qcell/basesources/LocalFunction.cpp 2007-01-21 19:37:08 UTC (rev 225) @@ -584,6 +584,12 @@ break; } emit valueCalculate(args); + + // for kuska + if(valueTable[index]<0) + emit unknownValue(index); + //*********************** + return valueTable[index]; } Modified: trunk/qcell/basesources/simulationwindow.cpp =================================================================== --- trunk/qcell/basesources/simulationwindow.cpp 2007-01-21 19:35:16 UTC (rev 224) +++ trunk/qcell/basesources/simulationwindow.cpp 2007-01-21 19:37:08 UTC (rev 225) @@ -782,7 +782,9 @@ ui.tabWidget->setTabEnabled(1, 0); ui.tabWidget->setTabEnabled(2, 0); ui.tabWidget->setTabEnabled(3, 1); - table1DUpdateRequest = 2; + //table1DUpdateRequest = 2; + update1DTable(); + update1DTableMem(); maxTime = sqrt((float)(getStorage()->getSizeX() * getStorage()->getSizeX())); //maxTime = getStorage()->getSizeX() + 1; loclaViewMemory.resize(maxTime); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <le...@us...> - 2007-01-21 23:36:02
|
Revision: 228 http://svn.sourceforge.net/qcell/?rev=228&view=rev Author: lessm Date: 2007-01-21 15:35:58 -0800 (Sun, 21 Jan 2007) Log Message: ----------- - local function is editable - k?\195?\147zka work for 1D and 2D(3D not tested) Modified Paths: -------------- trunk/qcell/baseheaders/Calculator.h trunk/qcell/baseheaders/LocalFunction.h trunk/qcell/baseheaders/Renderer.h trunk/qcell/baseheaders/functiontable.h trunk/qcell/baseheaders/functiontable.ui trunk/qcell/baseheaders/simulationwindow.h trunk/qcell/baseheaders/simulationwindow.ui trunk/qcell/basesources/Calculator.cpp trunk/qcell/basesources/LocalFunction.cpp trunk/qcell/basesources/Renderer.cpp trunk/qcell/basesources/functiontable.cpp trunk/qcell/basesources/simulationwindow.cpp trunk/qcell/visgui/MainWindow.cpp Modified: trunk/qcell/baseheaders/Calculator.h =================================================================== --- trunk/qcell/baseheaders/Calculator.h 2007-01-21 19:45:41 UTC (rev 227) +++ trunk/qcell/baseheaders/Calculator.h 2007-01-21 23:35:58 UTC (rev 228) @@ -22,7 +22,7 @@ private: protected: - char *tempData; + char *tempData, *calcBuffer; bool haveForeignOutputDataPointer; QVector<int> tempDataSize, calculationSpaceStart, calculationSpaceEnd; Neighbourhood *neighbourhood; @@ -33,16 +33,18 @@ BORDER borderType; - // kuska + // k\xD3Zka int startX, startY, startZ, startT; int storedCounter; + bool wasFreezed; + int functionIndex; protected: void clearTempData(void); void copyData(void); bool resizeTempDataBuffer(bool dataCopy=0, char *dataPointer=NULL); void updateBorder(void); - // for kozka + // for k\xD3Zka void storeSetings(void); //************************************************* public: @@ -54,11 +56,13 @@ void setLocalFunction(LocalFunction *f); int getTempDataSizeInByte(void); + + bool calculate(void); - // for kozka - void calculate(void); + // for k\xD3Zka bool isFreezed(void); - void resumeCalculation(void); + QVector<int> freezedCoords(void); + int getUnknowFunctionRuleIndex(void); // ************************************************ Calculator & operator = (CalculationData &cData); Modified: trunk/qcell/baseheaders/LocalFunction.h =================================================================== --- trunk/qcell/baseheaders/LocalFunction.h 2007-01-21 19:45:41 UTC (rev 227) +++ trunk/qcell/baseheaders/LocalFunction.h 2007-01-21 23:35:58 UTC (rev 228) @@ -72,6 +72,7 @@ int numArg, maxArgVal, numElements, maxRetVal; QString script, coment; + int unknowValueIndex; protected: //public: @@ -99,6 +100,8 @@ QVector<int> indexToFreeArgs(int index); QVector<int> indexToSums(int index); + + public: LocalFunction(); @@ -158,6 +161,9 @@ void setComent(QString &text); QString getComent(void); + //k\xD3zka + int lastUnknownValueIndex(void); + signals: // signal emit when resolv used void valueCalculate(QVector<int> args); Modified: trunk/qcell/baseheaders/Renderer.h =================================================================== --- trunk/qcell/baseheaders/Renderer.h 2007-01-21 19:45:41 UTC (rev 227) +++ trunk/qcell/baseheaders/Renderer.h 2007-01-21 23:35:58 UTC (rev 228) @@ -140,6 +140,8 @@ void showObserver(bool flag); void setObserverPosition(int x, int y, int z); + void selectCell(int x, int y, int z); + QList< QVector<int> > getSelectData(void); void maskSet(int x, int y, int z); Modified: trunk/qcell/baseheaders/functiontable.h =================================================================== --- trunk/qcell/baseheaders/functiontable.h 2007-01-21 19:45:41 UTC (rev 227) +++ trunk/qcell/baseheaders/functiontable.h 2007-01-21 23:35:58 UTC (rev 228) @@ -26,6 +26,7 @@ ~FunctionTable(); void setFunctionPointer(LocalFunction *f); + void selectCell(int index); protected slots: void functionEdit(int row, int column); Modified: trunk/qcell/baseheaders/functiontable.ui =================================================================== --- trunk/qcell/baseheaders/functiontable.ui 2007-01-21 19:45:41 UTC (rev 227) +++ trunk/qcell/baseheaders/functiontable.ui 2007-01-21 23:35:58 UTC (rev 228) @@ -5,8 +5,8 @@ <rect> <x>0</x> <y>0</y> - <width>400</width> - <height>300</height> + <width>491</width> + <height>376</height> </rect> </property> <property name="windowTitle" > Modified: trunk/qcell/baseheaders/simulationwindow.h =================================================================== --- trunk/qcell/baseheaders/simulationwindow.h 2007-01-21 19:45:41 UTC (rev 227) +++ trunk/qcell/baseheaders/simulationwindow.h 2007-01-21 23:35:58 UTC (rev 228) @@ -138,6 +138,8 @@ //for test only FunctionTable * getFunctionTable(void); + void setSelectedCell(QVector<int> coord); + void setSelectedFunctionRule(int index); }; #endif // SIMULATIONWINDOW_H Modified: trunk/qcell/baseheaders/simulationwindow.ui =================================================================== --- trunk/qcell/baseheaders/simulationwindow.ui 2007-01-21 19:45:41 UTC (rev 227) +++ trunk/qcell/baseheaders/simulationwindow.ui 2007-01-21 23:35:58 UTC (rev 228) @@ -36,7 +36,7 @@ <enum>QTabWidget::Rounded</enum> </property> <property name="currentIndex" > - <number>5</number> + <number>4</number> </property> <widget class="QWidget" name="view3D" > <attribute name="title" > Modified: trunk/qcell/basesources/Calculator.cpp =================================================================== --- trunk/qcell/basesources/Calculator.cpp 2007-01-21 19:45:41 UTC (rev 227) +++ trunk/qcell/basesources/Calculator.cpp 2007-01-21 23:35:58 UTC (rev 228) @@ -130,6 +130,9 @@ startX = startY = startZ = startT = 0; storedCounter = 0; + wasFreezed = 0; + functionIndex = -1; + calcBuffer = NULL; } Calculator::~Calculator() @@ -138,6 +141,8 @@ haveForeignOutputDataPointer = 0; neighbourhood = NULL; localfunction = NULL; + if(calcBuffer) + delete calcBuffer; } void Calculator::setNeighbourhood(Neighbourhood *n) @@ -228,9 +233,9 @@ return 0; } -void Calculator::calculate(void) +bool Calculator::calculate(void) { - int counter = 0; + int counter = storedCounter; char temp[8] = {0,0,0,0,0,0,0,0}; int sx = sizeX, sy = sizeY, sz = sizeZ, st = sizeT; QVector<int> coordinates(dimension, 0); @@ -244,11 +249,12 @@ if(st==0) st=1; - copyData(); + if(!wasFreezed) + copyData(); for(int t=startT;t<st;++t) { - if (dimension = 4) + if (dimension == 4) { coordinates[3] = t; } @@ -286,27 +292,47 @@ if(*((int *)temp)<0) { /// @todo k\xD3Zka - return; + startX = x; + startY = y; + startZ = z; + startT = t; + wasFreezed = 1; + storedCounter = counter; + functionIndex = localfunction->lastUnknownValueIndex(); + return 0; } emit calculated(coordinates, neighbourhood->valuesToVector_i(), (int)*temp); - memcpy(data + counter, temp, dataSize); + //memcpy(data + counter, temp, dataSize); + memcpy(calcBuffer + counter, temp, dataSize); counter += dataSize; } } } } - + storedCounter = 0; + startT = startZ = startY = startX = 0; + wasFreezed = 0; + memcpy(data, calcBuffer, getSizeInByte()); + return 1; } bool Calculator::isFreezed(void) { - return 0; + return wasFreezed; } -void Calculator::resumeCalculation(void) +QVector<int> Calculator::freezedCoords(void) { + QVector<int> out; + out<<startX<<startY<<startZ<<startT; + return out; } +int Calculator::getUnknowFunctionRuleIndex(void) +{ + return functionIndex; +} + Calculator & Calculator::operator = (CalculationData &cData) { if(cData.getDimension()!=getDimension() || cData.getSizeX() != getSizeX() || cData.getSizeY() != getSizeY() || cData.getSizeZ() != getSizeZ() || cData.getSizeT() != getSizeT()) @@ -336,6 +362,7 @@ void Calculator::setupSpace(void) { + if(neighbourhood) { minBorder = neighbourhood->getMinNeighbourhoodValues(); @@ -355,6 +382,15 @@ tempDataSize[3] = -minBorder[3] + maxBorder[3] + sizeT; resizeTempDataBuffer(); neighbourhood->calculateOffsets(tempDataSize[0], tempDataSize[1], tempDataSize[2], tempDataSize[3], getDataType()); + } - } + // 2nd buffer + + if(calcBuffer) + delete calcBuffer; + calcBuffer = new char[getSizeInByte()]; + + storedCounter = 0; + startT = startZ = startY = startX = 0; + wasFreezed = 0; } Modified: trunk/qcell/basesources/LocalFunction.cpp =================================================================== --- trunk/qcell/basesources/LocalFunction.cpp 2007-01-21 19:45:41 UTC (rev 227) +++ trunk/qcell/basesources/LocalFunction.cpp 2007-01-21 23:35:58 UTC (rev 228) @@ -326,6 +326,7 @@ LocalFunction::LocalFunction() { functionMode = LocalFunction::SWITCH; + unknowValueIndex = -1; } LocalFunction::~LocalFunction() @@ -588,6 +589,7 @@ // for kuska if(valueTable[index]<0) emit unknownValue(index); + unknowValueIndex = index; //*********************** return valueTable[index]; @@ -786,4 +788,9 @@ QString LocalFunction::getComent(void) { return coment; -} \ No newline at end of file +} + +int LocalFunction::lastUnknownValueIndex(void) +{ + return unknowValueIndex; +} Modified: trunk/qcell/basesources/Renderer.cpp =================================================================== --- trunk/qcell/basesources/Renderer.cpp 2007-01-21 19:45:41 UTC (rev 227) +++ trunk/qcell/basesources/Renderer.cpp 2007-01-21 23:35:58 UTC (rev 228) @@ -1046,6 +1046,12 @@ localObserverCoords[2] = z; } +void Renderer::selectCell(int x, int y, int z) +{ + selectetObjects.clear(); + selectetObjects<<(x + y * storage.getSizeX() + z * storage.getSizeX() * storage.getSizeY()); +} + QList< QVector<int> > Renderer::getSelectData(void) { int index; Modified: trunk/qcell/basesources/functiontable.cpp =================================================================== --- trunk/qcell/basesources/functiontable.cpp 2007-01-21 19:45:41 UTC (rev 227) +++ trunk/qcell/basesources/functiontable.cpp 2007-01-21 23:35:58 UTC (rev 228) @@ -15,7 +15,14 @@ for(int j=0;j<ui.functionTable->columnCount();++j) { item = new QTableWidgetItem; - item->setText(tr("%1").arg(function->getValueAt(counter))); + if(function->getValueAt(counter)<0) + { + item->setText("?"); + } + else + { + item->setText(tr("%1").arg(function->getValueAt(counter))); + } item->setTextAlignment(Qt::AlignCenter); ui.functionTable->setItem(i, j, item); ++counter; @@ -47,12 +54,43 @@ init(); } +void FunctionTable::selectCell(int index) +{ + int counter = 0; + QTableWidgetItem *item; + for(int i=0;i<ui.functionTable->rowCount();++i) + { + for(int j=0;j<ui.functionTable->columnCount();++j) + { + item = ui.functionTable->item(i, j); + if(counter==index) + item->setSelected(1); + else + item->setSelected(0); + counter++; + } + } +} + void FunctionTable::functionEdit(int row, int column) { QString temp; QTableWidgetItem *item; item = ui.functionTable->item(row, column); - temp.setNum(item->text().toInt()); - item->setText(temp); - function->setValueAt(temp.toInt(), row * ui.functionTable->columnCount() + column); + if(item->text()=="?") + function->setValueAt(-1, row * ui.functionTable->columnCount() + column); + else + { + temp.setNum(item->text().toInt()); + if(temp.toInt()<0) + { + function->setValueAt(-1, row * ui.functionTable->columnCount() + column); + item->setText("?"); + } + else + { + item->setText(temp); + function->setValueAt(temp.toInt(), row * ui.functionTable->columnCount() + column); + } + } } Modified: trunk/qcell/basesources/simulationwindow.cpp =================================================================== --- trunk/qcell/basesources/simulationwindow.cpp 2007-01-21 19:45:41 UTC (rev 227) +++ trunk/qcell/basesources/simulationwindow.cpp 2007-01-21 23:35:58 UTC (rev 228) @@ -104,6 +104,8 @@ view3DTools->move(width() - 116, basetools->height() + 1); view2DTextTools->move(width() - 116, basetools->height() + 1); view1DTextTools->move(width() - 116, basetools->height() + 1); + + ft->resize(ui.functionTab->width() - 10 , ui.functionTab->height() - 10); } void simulationWindow::paintEvent(QPaintEvent * event) @@ -1328,3 +1330,44 @@ { return ft; } + + +void simulationWindow::setSelectedCell(QVector<int> coord) +{ + QTableWidgetItem *item; + switch(getStorage()->getDimension()) + { + case 1: + + for(int i=0;i<table1D->columnCount();++i) + { + item = table1D->item(0, i); + if(i==coord[0]) + item->setSelected(1); + else + item->setSelected(0); + } + break; + case 3: + renderer->selectCell(coord[0], coord[1], coord[2]); + case 2: + for(int i=0;i<table2D->rowCount();++i) + { + for(int j=0;j<table2D->columnCount();++j) + { + item = table2D->item(i, j); + if(i==coord[1] && j==coord[0] && z_plane==coord[2]) + item->setSelected(1); + else + item->setSelected(0); + } + } + break; + } +} + +void simulationWindow::setSelectedFunctionRule(int index) +{ + ft->selectCell(index); + ui.tabWidget->setCurrentIndex(5); +} Modified: trunk/qcell/visgui/MainWindow.cpp =================================================================== --- trunk/qcell/visgui/MainWindow.cpp 2007-01-21 19:45:41 UTC (rev 227) +++ trunk/qcell/visgui/MainWindow.cpp 2007-01-21 23:35:58 UTC (rev 228) @@ -526,10 +526,17 @@ { /// @todo Use the updated API of Calculator /// @todo Pass the calculated CalculationData to the data list - calc.calculate(); - CalculationData *temp = new CalculationData; - *temp = calc; - data<<temp; + if(calc.calculate()) + { + CalculationData *temp = new CalculationData; + *temp = calc; + data<<temp; + } + else + { + sw->setSelectedCell(calc.freezedCoords()); + sw->setSelectedFunctionRule(calc.getUnknowFunctionRuleIndex()); + } } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dhu...@us...> - 2007-01-22 15:01:10
|
Revision: 229 http://svn.sourceforge.net/qcell/?rev=229&view=rev Author: dhubleizh Date: 2007-01-22 07:01:07 -0800 (Mon, 22 Jan 2007) Log Message: ----------- - ElementalRules limited only to one iteration - selecting rules handled - a lot of tweaking to optimize the flow Modified Paths: -------------- trunk/qcell/baseheaders/Calculator.h trunk/qcell/baseheaders/ElementalRules.h trunk/qcell/basesources/Calculator.cpp trunk/qcell/basesources/ElementalRules.cpp trunk/qcell/visgui/ElementalRulesWidget.cpp trunk/qcell/visgui/ElementalRulesWidget.h trunk/qcell/visgui/ElementalRulesWidget.ui trunk/qcell/visgui/MainWindow.cpp Modified: trunk/qcell/baseheaders/Calculator.h =================================================================== --- trunk/qcell/baseheaders/Calculator.h 2007-01-21 23:35:58 UTC (rev 228) +++ trunk/qcell/baseheaders/Calculator.h 2007-01-22 15:01:07 UTC (rev 229) @@ -71,6 +71,8 @@ void setupSpace(void); signals: + void calculationBegin(); + void calculationEnd(); void calculated(QVector<int> coordinates, QVector<int> arguments, int result); void freeze(Calculator *calculator, int index); Modified: trunk/qcell/baseheaders/ElementalRules.h =================================================================== --- trunk/qcell/baseheaders/ElementalRules.h 2007-01-21 23:35:58 UTC (rev 228) +++ trunk/qcell/baseheaders/ElementalRules.h 2007-01-22 15:01:07 UTC (rev 229) @@ -22,6 +22,8 @@ void newOccurance(int id, QVector<int> coordinates); public slots: void possibleRule(QVector<int> coordinates, QVector<int> neighbours, int return_value); + void resetList(); + void rulesSelected(QVector<int>); protected: int neighbours_count; int index; Modified: trunk/qcell/basesources/Calculator.cpp =================================================================== --- trunk/qcell/basesources/Calculator.cpp 2007-01-21 23:35:58 UTC (rev 228) +++ trunk/qcell/basesources/Calculator.cpp 2007-01-22 15:01:07 UTC (rev 229) @@ -79,6 +79,8 @@ } } } + + emit calculationEnd(); } bool Calculator::resizeTempDataBuffer(bool dataCopy, char *dataPointer) @@ -239,6 +241,7 @@ char temp[8] = {0,0,0,0,0,0,0,0}; int sx = sizeX, sy = sizeY, sz = sizeZ, st = sizeT; QVector<int> coordinates(dimension, 0); + emit calculationBegin(); if(sy==0) sy=1; Modified: trunk/qcell/basesources/ElementalRules.cpp =================================================================== --- trunk/qcell/basesources/ElementalRules.cpp 2007-01-21 23:35:58 UTC (rev 228) +++ trunk/qcell/basesources/ElementalRules.cpp 2007-01-22 15:01:07 UTC (rev 229) @@ -72,3 +72,18 @@ rules_mask.insert(rule_index, coordinates); } +void ElementalRules::resetList() +{ + /// @todo Actually write this + index = 0; + return_values.clear(); + neighbours.clear(); + rules.clear(); + rules_mask.clear(); +} + +void ElementalRules::rulesSelected(QVector<int>) +{ + /// @todo Search the database bout these rules +} + Modified: trunk/qcell/visgui/ElementalRulesWidget.cpp =================================================================== --- trunk/qcell/visgui/ElementalRulesWidget.cpp 2007-01-21 23:35:58 UTC (rev 228) +++ trunk/qcell/visgui/ElementalRulesWidget.cpp 2007-01-22 15:01:07 UTC (rev 229) @@ -6,6 +6,7 @@ */ #include "ElementalRulesWidget.h" +#include <QDebug> ElementalRulesWidget::ElementalRulesWidget() { @@ -14,6 +15,9 @@ QStringList labels; labels << tr("Rule") << tr("Occur"); rulesTree->setHeaderLabels(labels); + connect(rulesTree, SIGNAL(itemSelectionChanged()), + this, SLOT(selectionChanged()) + ); } void ElementalRulesWidget::addRule(int id, QVector<int> neighbrous, int result, QVector<int> coordinates) @@ -56,3 +60,30 @@ return coord_string.append(')'); } +void ElementalRulesWidget::resetList() +{ + rulesTree->clear(); +// rulesTree->blockSignals(true); +} + +void ElementalRulesWidget::display() +{ +// rulesTree->blockSignals(false); +// for (int i = 0; i < rulesTree->columnCount(); i++) +// { +// rulesTree->resizeColumnToContents(i); +// } +} + +void ElementalRulesWidget::selectionChanged() +{ + QVector<int> rules; + foreach(QTreeWidgetItem* item, rulesTree->selectedItems()) + { + rules.append(item->text(0).toInt()); + } + + emit rulesSelected(rules); +} + + Modified: trunk/qcell/visgui/ElementalRulesWidget.h =================================================================== --- trunk/qcell/visgui/ElementalRulesWidget.h 2007-01-21 23:35:58 UTC (rev 228) +++ trunk/qcell/visgui/ElementalRulesWidget.h 2007-01-22 15:01:07 UTC (rev 229) @@ -17,11 +17,16 @@ class ElementalRulesWidget: public QWidget, public Ui::ElementalRulesForm { Q_OBJECT -protected: - QString parseCoordinates(QVector<int> coordinates); +signals: + void rulesSelected(QVector<int> rules); public slots: + void resetList(); + void display(); void addRule(int id, QVector<int> neighbours, int result, QVector<int> coordinates); void addOccurance(int id, QVector<int> coordinates); + void selectionChanged(); +protected: + QString parseCoordinates(QVector<int> coordinates); public: ElementalRulesWidget(); Modified: trunk/qcell/visgui/ElementalRulesWidget.ui =================================================================== --- trunk/qcell/visgui/ElementalRulesWidget.ui 2007-01-21 23:35:58 UTC (rev 228) +++ trunk/qcell/visgui/ElementalRulesWidget.ui 2007-01-22 15:01:07 UTC (rev 229) @@ -21,19 +21,23 @@ </property> <item> <widget class="QTreeWidget" name="rulesTree" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="selectionBehavior" > + <enum>QAbstractItemView::SelectRows</enum> + </property> + <property name="horizontalScrollMode" > + <enum>QAbstractItemView::ScrollPerItem</enum> + </property> <property name="columnCount" > - <number>2</number> + <number>0</number> </property> - <column> - <property name="text" > - <string>1</string> - </property> - </column> - <column> - <property name="text" > - <string>1</string> - </property> - </column> </widget> </item> </layout> Modified: trunk/qcell/visgui/MainWindow.cpp =================================================================== --- trunk/qcell/visgui/MainWindow.cpp 2007-01-21 23:35:58 UTC (rev 228) +++ trunk/qcell/visgui/MainWindow.cpp 2007-01-22 15:01:07 UTC (rev 229) @@ -380,9 +380,28 @@ *(CalculationData*)&calc = *data.last(); // Creating elemental rules accroding to DATA_TYPE elemental_rules = new ElementalRules; + + // Pass the calculation result to rules selection connect(&calc, SIGNAL(calculated(QVector<int>, QVector<int>, int)), elemental_rules, SLOT(possibleRule(QVector<int>, QVector<int>, int)) ); + + // Notify things connected with rules to reset the list + // as we hold only one iteration rules + connect(&calc, SIGNAL(calculationBegin()), + elemental_rules, SLOT(resetList()) + ); + connect(&calc, SIGNAL(calculationBegin()), + ((ElementalRulesWidget*)elemental_dock->widget()), SLOT(resetList()) + ); + + // Display the results (there is no need to refresh the table before + // the end of one iteration) + connect(&calc, SIGNAL(calculationEnd()), + ((ElementalRulesWidget*)elemental_dock->widget()), SLOT(display()) + ); + + // Notify the GUI 'bout new items connect(elemental_rules, SIGNAL(newRule(int, QVector<int>, int, QVector<int>)), ((ElementalRulesWidget*)elemental_dock->widget()), SLOT(addRule(int, QVector<int>, int, QVector<int>)) ); @@ -390,6 +409,11 @@ ((ElementalRulesWidget*)elemental_dock->widget()), SLOT(addOccurance(int, QVector<int>)) ); + // Pass rules selection from GUI to engine + connect(((ElementalRulesWidget*)elemental_dock->widget()), SIGNAL(rulesSelected()), + elemental_rules, SLOT(rulesSelected(QVector<int>)) + ); + iteration=0; // visualization update This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <le...@us...> - 2007-01-22 17:38:11
|
Revision: 230 http://svn.sourceforge.net/qcell/?rev=230&view=rev Author: lessm Date: 2007-01-22 09:38:02 -0800 (Mon, 22 Jan 2007) Log Message: ----------- - resume bug resolved Modified Paths: -------------- trunk/qcell/basesources/Calculator.cpp trunk/qcell/basesources/simulationwindow.cpp trunk/qcell/visgui/MainWindow.cpp Modified: trunk/qcell/basesources/Calculator.cpp =================================================================== --- trunk/qcell/basesources/Calculator.cpp 2007-01-22 15:01:07 UTC (rev 229) +++ trunk/qcell/basesources/Calculator.cpp 2007-01-22 17:38:02 UTC (rev 230) @@ -255,25 +255,25 @@ if(!wasFreezed) copyData(); - for(int t=startT;t<st;++t) + for(int t=startT;t<st;t++) { if (dimension == 4) { coordinates[3] = t; } - for(int z=startZ;z<sz;++z) + for(int z=startZ;z<sz;z++) { if (dimension >= 3) { coordinates[2] = z; } - for(int y=startY;y<sy;++y) + for(int y=startY;y<sy;y++) { if (dimension >= 2) { coordinates[1] = y; } - for(int x=startX;x<sx;++x) + for(int x=startX;x<sx;x++) { coordinates[0] = x; neighbourhood->resolveValues(tempData + (x - minBorder[0]) + ((y - minBorder[1]) * tempDataSize[0]) + (z - minBorder[2]) * (tempDataSize[0] * tempDataSize[1]) + (t - minBorder[3]) * (tempDataSize[0] * tempDataSize[1] * tempDataSize[2]) * dataSize); @@ -295,12 +295,12 @@ if(*((int *)temp)<0) { /// @todo k\xD3Zka - startX = x; - startY = y; - startZ = z; - startT = t; + //startX = x; + //startY = y; + //startZ = z; + //startT = t; wasFreezed = 1; - storedCounter = counter; + //storedCounter = counter; functionIndex = localfunction->lastUnknownValueIndex(); return 0; } Modified: trunk/qcell/basesources/simulationwindow.cpp =================================================================== --- trunk/qcell/basesources/simulationwindow.cpp 2007-01-22 15:01:07 UTC (rev 229) +++ trunk/qcell/basesources/simulationwindow.cpp 2007-01-22 17:38:02 UTC (rev 230) @@ -1350,6 +1350,7 @@ break; case 3: renderer->selectCell(coord[0], coord[1], coord[2]); + z_plane = coord[2]; case 2: for(int i=0;i<table2D->rowCount();++i) { Modified: trunk/qcell/visgui/MainWindow.cpp =================================================================== --- trunk/qcell/visgui/MainWindow.cpp 2007-01-22 15:01:07 UTC (rev 229) +++ trunk/qcell/visgui/MainWindow.cpp 2007-01-22 17:38:02 UTC (rev 230) @@ -560,6 +560,7 @@ { sw->setSelectedCell(calc.freezedCoords()); sw->setSelectedFunctionRule(calc.getUnknowFunctionRuleIndex()); + //iteration--; } } else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <le...@us...> - 2007-01-23 09:07:01
|
Revision: 234 http://svn.sourceforge.net/qcell/?rev=234&view=rev Author: lessm Date: 2007-01-23 01:06:58 -0800 (Tue, 23 Jan 2007) Log Message: ----------- - k?\195?\179zka work now Modified Paths: -------------- trunk/qcell/baseheaders/Renderer.h trunk/qcell/basesources/simulationwindow.cpp Modified: trunk/qcell/baseheaders/Renderer.h =================================================================== --- trunk/qcell/baseheaders/Renderer.h 2007-01-23 08:42:53 UTC (rev 233) +++ trunk/qcell/baseheaders/Renderer.h 2007-01-23 09:06:58 UTC (rev 234) @@ -14,7 +14,7 @@ #include <QPixmap> #include <QChar> -#define SELECT_BUFFER_SIZE 64000 +#define SELECT_BUFFER_SIZE 256000 struct SYMBOL { Modified: trunk/qcell/basesources/simulationwindow.cpp =================================================================== --- trunk/qcell/basesources/simulationwindow.cpp 2007-01-23 08:42:53 UTC (rev 233) +++ trunk/qcell/basesources/simulationwindow.cpp 2007-01-23 09:06:58 UTC (rev 234) @@ -1077,6 +1077,7 @@ { if(mode==3) { + cycleTable = usedSpace = 0; loclaViewMemory[cycleTable] = *getStorage(); //localViewFlag = 1; storeCurentTable = getStorage()->getDataPointer(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dhu...@us...> - 2007-01-23 10:21:11
|
Revision: 236 http://svn.sourceforge.net/qcell/?rev=236&view=rev Author: dhubleizh Date: 2007-01-23 02:21:09 -0800 (Tue, 23 Jan 2007) Log Message: ----------- - tried to make ER work only on demand Modified Paths: -------------- trunk/qcell/baseheaders/ElementalRules.h trunk/qcell/basesources/ElementalRules.cpp trunk/qcell/visgui/ElementalRulesWidget.cpp trunk/qcell/visgui/ElementalRulesWidget.h trunk/qcell/visgui/MainWindow.cpp trunk/qcell/visgui/MainWindow.h trunk/qcell/visgui/MainWindow.ui Modified: trunk/qcell/baseheaders/ElementalRules.h =================================================================== --- trunk/qcell/baseheaders/ElementalRules.h 2007-01-23 09:37:16 UTC (rev 235) +++ trunk/qcell/baseheaders/ElementalRules.h 2007-01-23 10:21:09 UTC (rev 236) @@ -24,9 +24,11 @@ void possibleRule(QVector<int> coordinates, QVector<int> neighbours, int return_value); void resetList(); void rulesSelected(QVector<int>); + void work(bool flag); protected: int neighbours_count; int index; + bool should_work; QVector<int> return_values; QVector<QVector<int> > neighbours; Modified: trunk/qcell/basesources/ElementalRules.cpp =================================================================== --- trunk/qcell/basesources/ElementalRules.cpp 2007-01-23 09:37:16 UTC (rev 235) +++ trunk/qcell/basesources/ElementalRules.cpp 2007-01-23 10:21:09 UTC (rev 236) @@ -6,15 +6,23 @@ */ #include "ElementalRules.h" +#include <QDebug> ElementalRules::ElementalRules() : QObject() { index = 0; + should_work = false; } void ElementalRules::possibleRule(QVector<int> coordinates, QVector<int> neighbours, int return_value) { + // Only work if the user wants to + if (!should_work) + { + return; + } + // where do things reside int value_index, neighbour_index, rule_index; // Is this a new rule case? @@ -74,6 +82,12 @@ void ElementalRules::resetList() { + // Only process when the user wants + if (!should_work) + { + return; + } + /// @todo Actually write this index = 0; return_values.clear(); @@ -87,3 +101,9 @@ /// @todo Search the database bout these rules } +void ElementalRules::work(bool flag) +{ + qDebug() << "Should work: " << flag; + should_work = flag; +} + Modified: trunk/qcell/visgui/ElementalRulesWidget.cpp =================================================================== --- trunk/qcell/visgui/ElementalRulesWidget.cpp 2007-01-23 09:37:16 UTC (rev 235) +++ trunk/qcell/visgui/ElementalRulesWidget.cpp 2007-01-23 10:21:09 UTC (rev 236) @@ -63,12 +63,12 @@ void ElementalRulesWidget::resetList() { rulesTree->clear(); -// rulesTree->blockSignals(true); + rulesTree->setUpdatesEnabled(false); } void ElementalRulesWidget::display() { -// rulesTree->blockSignals(false); + rulesTree->setUpdatesEnabled(true); // for (int i = 0; i < rulesTree->columnCount(); i++) // { // rulesTree->resizeColumnToContents(i); @@ -86,4 +86,22 @@ emit rulesSelected(rules); } +void ElementalRulesWidget::setVisible(bool visible) +{ + emit ElementalRulesWidget::visible(visible); + QWidget::setVisible(visible); +} +void ElementalRulesWidget::show() +{ + emit visible(true); + QWidget::show(); +} + +void ElementalRulesWidget::hide() +{ + emit visible(false); + QWidget::hide(); +} + + Modified: trunk/qcell/visgui/ElementalRulesWidget.h =================================================================== --- trunk/qcell/visgui/ElementalRulesWidget.h 2007-01-23 09:37:16 UTC (rev 235) +++ trunk/qcell/visgui/ElementalRulesWidget.h 2007-01-23 10:21:09 UTC (rev 236) @@ -18,8 +18,13 @@ { Q_OBJECT signals: + void visible(bool visible); void rulesSelected(QVector<int> rules); public slots: + void setVisible(bool visible); + void show(); + void hide(); +public slots: void resetList(); void display(); void addRule(int id, QVector<int> neighbours, int result, QVector<int> coordinates); Modified: trunk/qcell/visgui/MainWindow.cpp =================================================================== --- trunk/qcell/visgui/MainWindow.cpp 2007-01-23 09:37:16 UTC (rev 235) +++ trunk/qcell/visgui/MainWindow.cpp 2007-01-23 10:21:09 UTC (rev 236) @@ -61,7 +61,13 @@ // We don't want it appear at the beginning elemental_dock->hide(); elemental_dock->setWidget(new ElementalRulesWidget()); + elemental_dock->setWindowTitle(tr("Elemental rules")); + addDockWidget(Qt::LeftDockWidgetArea, elemental_dock); + // We want to be able to show or hide the widget from View menu + QAction* elemental_action = elemental_dock->toggleViewAction(); + elemental_action->setText("&" + elemental_dock->windowTitle()); + menu_View->addAction(elemental_action); foreach(QObject* plugin, QPluginLoader::staticInstances()) { @@ -410,10 +416,16 @@ ); // Pass rules selection from GUI to engine - connect(((ElementalRulesWidget*)elemental_dock->widget()), SIGNAL(rulesSelected()), + connect(((ElementalRulesWidget*)elemental_dock->widget()), SIGNAL(rulesSelected(QVector<int>)), elemental_rules, SLOT(rulesSelected(QVector<int>)) ); + // We should only work when the rules list is visible, as it slows + // the calculation considerably + connect(((ElementalRulesWidget*)elemental_dock->widget()), SIGNAL(visible(bool)), + elemental_rules, SLOT(work(bool)) + ); + iteration=0; // visualization update @@ -983,15 +995,3 @@ delaySlider->blockSignals(false); } -void MainWindow::on_action_Elemental_rules_toggled(bool checked) -{ - if (checked) - { - elemental_dock->show(); - } - else - { - elemental_dock->hide(); - } -} - Modified: trunk/qcell/visgui/MainWindow.h =================================================================== --- trunk/qcell/visgui/MainWindow.h 2007-01-23 09:37:16 UTC (rev 235) +++ trunk/qcell/visgui/MainWindow.h 2007-01-23 10:21:09 UTC (rev 236) @@ -66,8 +66,6 @@ void on_action_Stop_activated(); void on_action_Restart_activated(); - void on_action_Elemental_rules_toggled(bool checked); - void loadingSuccess(QString filetype); private: simulationWindow* sw; Modified: trunk/qcell/visgui/MainWindow.ui =================================================================== --- trunk/qcell/visgui/MainWindow.ui 2007-01-23 09:37:16 UTC (rev 235) +++ trunk/qcell/visgui/MainWindow.ui 2007-01-23 10:21:09 UTC (rev 236) @@ -93,7 +93,6 @@ <property name="title" > <string>&View</string> </property> - <addaction name="action_Elemental_rules" /> </widget> <addaction name="menu_File" /> <addaction name="menu_View" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dhu...@us...> - 2007-01-23 18:36:38
|
Revision: 237 http://svn.sourceforge.net/qcell/?rev=237&view=rev Author: dhubleizh Date: 2007-01-23 10:36:35 -0800 (Tue, 23 Jan 2007) Log Message: ----------- - RuleProperties dialog to setup symbol and color - ElementalRules widget is able to set everything now Modified Paths: -------------- trunk/qcell/basesources/ElementalRules.cpp trunk/qcell/visgui/ElementalRulesWidget.cpp trunk/qcell/visgui/ElementalRulesWidget.h trunk/qcell/visgui/ExperimentSetup.cpp trunk/qcell/visgui/MainWindow.cpp trunk/qcell/visgui/visgui.pro Added Paths: ----------- trunk/qcell/visgui/RuleProperties.cpp trunk/qcell/visgui/RuleProperties.h trunk/qcell/visgui/RulePropertiesDialog.ui Modified: trunk/qcell/basesources/ElementalRules.cpp =================================================================== --- trunk/qcell/basesources/ElementalRules.cpp 2007-01-23 10:21:09 UTC (rev 236) +++ trunk/qcell/basesources/ElementalRules.cpp 2007-01-23 18:36:35 UTC (rev 237) @@ -6,7 +6,6 @@ */ #include "ElementalRules.h" -#include <QDebug> ElementalRules::ElementalRules() : QObject() @@ -103,7 +102,6 @@ void ElementalRules::work(bool flag) { - qDebug() << "Should work: " << flag; should_work = flag; } Modified: trunk/qcell/visgui/ElementalRulesWidget.cpp =================================================================== --- trunk/qcell/visgui/ElementalRulesWidget.cpp 2007-01-23 10:21:09 UTC (rev 236) +++ trunk/qcell/visgui/ElementalRulesWidget.cpp 2007-01-23 18:36:35 UTC (rev 237) @@ -11,13 +11,17 @@ ElementalRulesWidget::ElementalRulesWidget() { setupUi(this); - rulesTree->setColumnCount(2); + rulesTree->setColumnCount(3); QStringList labels; - labels << tr("Rule") << tr("Occur"); + labels << tr("Rule") << tr("Symbol") << tr("Coordinates"); rulesTree->setHeaderLabels(labels); + rulesTree->resizeColumnToContents(1); connect(rulesTree, SIGNAL(itemSelectionChanged()), this, SLOT(selectionChanged()) ); + connect(rulesTree, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), + this, SLOT(ruleDoubleClicked(QTreeWidgetItem*, int)) + ); } void ElementalRulesWidget::addRule(int id, QVector<int> neighbrous, int result, QVector<int> coordinates) @@ -25,14 +29,18 @@ // Values to be added QStringList values; - values << QString(); + values + << QString() + << QString(); // Add coordinates values << parseCoordinates(coordinates); // Add top-level id - QStringList rule(QString::number(id)); - rule << - QString("%1 => %2").arg(parseCoordinates(neighbrous)).arg(QString::number(result)); + QStringList rule; + rule + << QString::number(id) + << QString() + << QString("%1 => %2").arg(parseCoordinates(neighbrous)).arg(QString::number(result)); QTreeWidgetItem* item = new QTreeWidgetItem(rule); item->addChild(new QTreeWidgetItem(values)); rulesTree->addTopLevelItem(item); @@ -41,8 +49,11 @@ void ElementalRulesWidget::addOccurance(int id, QVector<int> coordinates) { QTreeWidgetItem* item = rulesTree->findItems( QString::number(id), Qt::MatchExactly).first(); - QStringList values(""); - values << parseCoordinates(coordinates); + QStringList values; + values + << QString() + << QString() + << parseCoordinates(coordinates); item->addChild(new QTreeWidgetItem(values)); } @@ -104,4 +115,39 @@ QWidget::hide(); } +void ElementalRulesWidget::ruleDoubleClicked(QTreeWidgetItem* item, int column) +{ + RuleProperties rp; + QTableWidgetItem* field; + // Rule number + field = new QTableWidgetItem(QString(item->text(0))); + field->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); + rp.rulePropertiesTable->setItem(0, 0, field); + // Symbol + field = new QTableWidgetItem(QString(item->text(1))); + rp.rulePropertiesTable->setItem(0, 1, field); + // Colour + field = new QTableWidgetItem(); + field->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); + field->setBackground(item->background(1)); + rp.rulePropertiesTable->setItem(0, 2, field); + // Actual rule + field = new QTableWidgetItem(QString(item->text(2))); + field->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); + rp.rulePropertiesTable->setItem(0, 3, field); + + // Make it look good + rp.rulePropertiesTable->resizeColumnsToContents(); + + // Finally if the dialog is accepted, set the resulg + // in the tree + if (rp.exec() == QDialog::Accepted) + { + item->setText(1, rp.rulePropertiesTable->item(0, 1)->text()); + QColor color = rp.rulePropertiesTable->item(0, 2)->background().color(); + item->setBackground(1, QBrush(color)); + item->setTextAlignment(1, Qt::AlignCenter); + } +} + Modified: trunk/qcell/visgui/ElementalRulesWidget.h =================================================================== --- trunk/qcell/visgui/ElementalRulesWidget.h 2007-01-23 10:21:09 UTC (rev 236) +++ trunk/qcell/visgui/ElementalRulesWidget.h 2007-01-23 18:36:35 UTC (rev 237) @@ -12,7 +12,9 @@ #include <QDockWidget> #include <QStringList> #include <QTreeWidgetItem> +#include <QTableWidgetItem> #include "ui_ElementalRulesWidget.h" +#include "RuleProperties.h" class ElementalRulesWidget: public QWidget, public Ui::ElementalRulesForm { @@ -24,12 +26,12 @@ void setVisible(bool visible); void show(); void hide(); -public slots: void resetList(); void display(); void addRule(int id, QVector<int> neighbours, int result, QVector<int> coordinates); void addOccurance(int id, QVector<int> coordinates); void selectionChanged(); + void ruleDoubleClicked(QTreeWidgetItem* item, int column); protected: QString parseCoordinates(QVector<int> coordinates); public: Modified: trunk/qcell/visgui/ExperimentSetup.cpp =================================================================== --- trunk/qcell/visgui/ExperimentSetup.cpp 2007-01-23 10:21:09 UTC (rev 236) +++ trunk/qcell/visgui/ExperimentSetup.cpp 2007-01-23 18:36:35 UTC (rev 237) @@ -10,6 +10,7 @@ ExperimentSetup::ExperimentSetup() { setupUi(this); + speedBox->hide(); connect(delaySlider, SIGNAL(valueChanged(int)), SLOT(sliderChanged(int)) ); Modified: trunk/qcell/visgui/MainWindow.cpp =================================================================== --- trunk/qcell/visgui/MainWindow.cpp 2007-01-23 10:21:09 UTC (rev 236) +++ trunk/qcell/visgui/MainWindow.cpp 2007-01-23 18:36:35 UTC (rev 237) @@ -32,7 +32,13 @@ statusBar()->addPermanentWidget(tmp_label); statusBar()->addPermanentWidget(delaySlider); statusBar()->addPermanentWidget(delaySpinBox); - statusBar()->addPermanentWidget(new QLabel("ms")); +// statusBar()->addPermanentWidget(new QLabel("ms")); + + /// @todo I won't make it in time, so commenting this out + delaySlider->hide(); + delaySpinBox->hide(); + tmp_label->hide(); + // Interconnect both widgets - change in one will change the other as well connect(delaySlider, SIGNAL(valueChanged(int)), SLOT(sliderChanged(int)) @@ -422,7 +428,7 @@ // We should only work when the rules list is visible, as it slows // the calculation considerably - connect(((ElementalRulesWidget*)elemental_dock->widget()), SIGNAL(visible(bool)), + connect(elemental_dock->toggleViewAction(), SIGNAL(toggled(bool)), elemental_rules, SLOT(work(bool)) ); Added: trunk/qcell/visgui/RuleProperties.cpp =================================================================== --- trunk/qcell/visgui/RuleProperties.cpp (rev 0) +++ trunk/qcell/visgui/RuleProperties.cpp 2007-01-23 18:36:35 UTC (rev 237) @@ -0,0 +1,26 @@ +/**@file RuleProperties.cpp + * @author czarny + * @date + * Created: wto 23 sty 2007 17:36:11 CET \n + * Last Update: wto 23 sty 2007 17:36:11 CET + */ + +#include "RuleProperties.h" + +RuleProperties::RuleProperties() + : QDialog(), ElementalRuleSetupDialog() +{ + setupUi(this); + connect(rulePropertiesTable, SIGNAL(itemDoubleClicked(QTableWidgetItem*)), + this, SLOT(colourDoubleClicked(QTableWidgetItem*)) + ); +} + +void RuleProperties::colourDoubleClicked(QTableWidgetItem* item) +{ + if (item->column() == 2) + { + item->setBackground(QColorDialog::getColor(Qt::white, this)); + } +} + Added: trunk/qcell/visgui/RuleProperties.h =================================================================== --- trunk/qcell/visgui/RuleProperties.h (rev 0) +++ trunk/qcell/visgui/RuleProperties.h 2007-01-23 18:36:35 UTC (rev 237) @@ -0,0 +1,26 @@ +/**@file RuleProperties.h + * @author czarny + * @date + * Created: wto 23 sty 2007 17:34:54 CET \n + * Last Update: wto 23 sty 2007 17:34:54 CET + * @brief Minimal dialog to set up ElementalRules properties + */ + +#ifndef __RULEPROPERTIES_H__ +#define __RULEPROPERTIES_H__ + +#include "ui_RulePropertiesDialog.h" +#include <QDialog> +#include <QColorDialog> + +class RuleProperties: public QDialog, public Ui::ElementalRuleSetupDialog +{ + Q_OBJECT +public slots: + void colourDoubleClicked(QTableWidgetItem* item); +public: + RuleProperties(); + +}; + +#endif // __RULEPROPERTIES_H__ Added: trunk/qcell/visgui/RulePropertiesDialog.ui =================================================================== --- trunk/qcell/visgui/RulePropertiesDialog.ui (rev 0) +++ trunk/qcell/visgui/RulePropertiesDialog.ui 2007-01-23 18:36:35 UTC (rev 237) @@ -0,0 +1,141 @@ +<ui version="4.0" > + <class>ElementalRuleSetupDialog</class> + <widget class="QDialog" name="ElementalRuleSetupDialog" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>300</height> + </rect> + </property> + <property name="windowTitle" > + <string>Rule properties</string> + </property> + <layout class="QVBoxLayout" > + <property name="margin" > + <number>9</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QLabel" name="label" > + <property name="text" > + <string>Choose a symbol or colour to represent the rule with.</string> + </property> + </widget> + </item> + <item> + <spacer> + <property name="orientation" > + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" > + <size> + <width>382</width> + <height>16</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QTableWidget" name="rulePropertiesTable" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="rowCount" > + <number>1</number> + </property> + <property name="columnCount" > + <number>4</number> + </property> + <row/> + <column> + <property name="text" > + <string>Rule nr</string> + </property> + </column> + <column> + <property name="text" > + <string>Symbol</string> + </property> + </column> + <column> + <property name="text" > + <string>Colour</string> + </property> + </column> + <column> + <property name="text" > + <string>Rule</string> + </property> + </column> + </widget> + </item> + <item> + <spacer> + <property name="orientation" > + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" > + <size> + <width>20</width> + <height>16</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QDialogButtonBox" name="buttonBox" > + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="standardButtons" > + <set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections> + <connection> + <sender>buttonBox</sender> + <signal>accepted()</signal> + <receiver>ElementalRuleSetupDialog</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel" > + <x>248</x> + <y>254</y> + </hint> + <hint type="destinationlabel" > + <x>157</x> + <y>274</y> + </hint> + </hints> + </connection> + <connection> + <sender>buttonBox</sender> + <signal>rejected()</signal> + <receiver>ElementalRuleSetupDialog</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel" > + <x>316</x> + <y>260</y> + </hint> + <hint type="destinationlabel" > + <x>286</x> + <y>274</y> + </hint> + </hints> + </connection> + </connections> +</ui> Modified: trunk/qcell/visgui/visgui.pro =================================================================== --- trunk/qcell/visgui/visgui.pro 2007-01-23 10:21:09 UTC (rev 236) +++ trunk/qcell/visgui/visgui.pro 2007-01-23 18:36:35 UTC (rev 237) @@ -9,6 +9,7 @@ AboutDialog.ui \ ExperimentSetup.ui \ ElementalRulesWidget.ui \ + RulePropertiesDialog.ui \ ../baseheaders/simulationwindow.ui \ ../baseheaders/basetools.ui \ ../baseheaders/view3dtools.ui \ @@ -19,6 +20,7 @@ HEADERS = MainWindow.h \ ExperimentSetup.h \ ElementalRulesWidget.h \ + RuleProperties.h \ ../baseheaders/Client.h \ ../baseheaders/ClientInfo.h \ ../baseheaders/BaseDataTypes.h \ @@ -42,6 +44,7 @@ MainWindow.cpp \ ExperimentSetup.cpp \ ElementalRulesWidget.cpp \ + RuleProperties.cpp \ ../basesources/Client.cpp \ ../basesources/ClientInfo.cpp \ ../basesources/Neighbourhood.cpp \ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dhu...@us...> - 2007-01-23 21:07:26
|
Revision: 240 http://svn.sourceforge.net/qcell/?rev=240&view=rev Author: dhubleizh Date: 2007-01-23 13:07:21 -0800 (Tue, 23 Jan 2007) Log Message: ----------- - disable all nonessential GUI-s at the begining - GUI enabling on full experiment loading Modified Paths: -------------- trunk/qcell/baseheaders/basetools.h trunk/qcell/baseheaders/basetools.ui trunk/qcell/baseheaders/functiontable.h trunk/qcell/baseheaders/simulationwindow.h trunk/qcell/baseheaders/simulationwindow.ui trunk/qcell/basesources/basetools.cpp trunk/qcell/basesources/functiontable.cpp trunk/qcell/basesources/simulationwindow.cpp trunk/qcell/visgui/MainWindow.cpp trunk/qcell/visgui/MainWindow.h Modified: trunk/qcell/baseheaders/basetools.h =================================================================== --- trunk/qcell/baseheaders/basetools.h 2007-01-23 20:23:28 UTC (rev 239) +++ trunk/qcell/baseheaders/basetools.h 2007-01-23 21:07:21 UTC (rev 240) @@ -19,6 +19,9 @@ Ui::BaseToolsClass ui; int editMode; +public slots: + void unlockGUI(); + protected slots: void modeChangeSelect(void); void modeChangeEdit(void); Modified: trunk/qcell/baseheaders/basetools.ui =================================================================== --- trunk/qcell/baseheaders/basetools.ui 2007-01-23 20:23:28 UTC (rev 239) +++ trunk/qcell/baseheaders/basetools.ui 2007-01-23 21:07:21 UTC (rev 240) @@ -1,6 +1,9 @@ <ui version="4.0" > <class>BaseToolsClass</class> <widget class="QWidget" name="BaseToolsClass" > + <property name="enabled" > + <bool>false</bool> + </property> <property name="geometry" > <rect> <x>0</x> @@ -112,6 +115,29 @@ </property> </widget> </widget> + <widget class="QGroupBox" name="ValuesGroup" > + <property name="geometry" > + <rect> + <x>1</x> + <y>240</y> + <width>113</width> + <height>131</height> + </rect> + </property> + <property name="title" > + <string>Values</string> + </property> + <widget class="QTableWidget" name="valueTable" > + <property name="geometry" > + <rect> + <x>5</x> + <y>20</y> + <width>101</width> + <height>101</height> + </rect> + </property> + </widget> + </widget> <widget class="QGroupBox" name="ViewModeGroup" > <property name="geometry" > <rect> @@ -160,29 +186,6 @@ </property> </widget> </widget> - <widget class="QGroupBox" name="ValuesGroup" > - <property name="geometry" > - <rect> - <x>1</x> - <y>240</y> - <width>113</width> - <height>131</height> - </rect> - </property> - <property name="title" > - <string>Values</string> - </property> - <widget class="QTableWidget" name="valueTable" > - <property name="geometry" > - <rect> - <x>5</x> - <y>20</y> - <width>101</width> - <height>101</height> - </rect> - </property> - </widget> - </widget> </widget> <layoutdefault spacing="6" margin="11" /> <resources/> Modified: trunk/qcell/baseheaders/functiontable.h =================================================================== --- trunk/qcell/baseheaders/functiontable.h 2007-01-23 20:23:28 UTC (rev 239) +++ trunk/qcell/baseheaders/functiontable.h 2007-01-23 21:07:21 UTC (rev 240) @@ -13,7 +13,8 @@ { Q_OBJECT - +public slots: + void unlockGUI(); private: Ui::FunctionTableClass ui; Modified: trunk/qcell/baseheaders/simulationwindow.h =================================================================== --- trunk/qcell/baseheaders/simulationwindow.h 2007-01-23 20:23:28 UTC (rev 239) +++ trunk/qcell/baseheaders/simulationwindow.h 2007-01-23 21:07:21 UTC (rev 240) @@ -131,6 +131,8 @@ void maskChange(int x, int y, int z); + void unlockGUI(); + public: void storeSelectedData(void); void pasteStoredData(void); Modified: trunk/qcell/baseheaders/simulationwindow.ui =================================================================== --- trunk/qcell/baseheaders/simulationwindow.ui 2007-01-23 20:23:28 UTC (rev 239) +++ trunk/qcell/baseheaders/simulationwindow.ui 2007-01-23 21:07:21 UTC (rev 240) @@ -36,7 +36,7 @@ <enum>QTabWidget::Rounded</enum> </property> <property name="currentIndex" > - <number>4</number> + <number>5</number> </property> <widget class="QWidget" name="view3D" > <attribute name="title" > @@ -109,6 +109,9 @@ </layout> </widget> <widget class="QWidget" name="functionTab" > + <property name="enabled" > + <bool>false</bool> + </property> <attribute name="title" > <string>Function</string> </attribute> Modified: trunk/qcell/basesources/basetools.cpp =================================================================== --- trunk/qcell/basesources/basetools.cpp 2007-01-23 20:23:28 UTC (rev 239) +++ trunk/qcell/basesources/basetools.cpp 2007-01-23 21:07:21 UTC (rev 240) @@ -107,4 +107,10 @@ void BaseTools::updateSelectedSymbol(int row, int column) { emit symbolSelected(row); -} \ No newline at end of file +} + +void BaseTools::unlockGUI() +{ + setEnabled(true); +} + Modified: trunk/qcell/basesources/functiontable.cpp =================================================================== --- trunk/qcell/basesources/functiontable.cpp 2007-01-23 20:23:28 UTC (rev 239) +++ trunk/qcell/basesources/functiontable.cpp 2007-01-23 21:07:21 UTC (rev 240) @@ -94,3 +94,9 @@ } } } + +void FunctionTable::unlockGUI() +{ + setEnabled(true); +} + Modified: trunk/qcell/basesources/simulationwindow.cpp =================================================================== --- trunk/qcell/basesources/simulationwindow.cpp 2007-01-23 20:23:28 UTC (rev 239) +++ trunk/qcell/basesources/simulationwindow.cpp 2007-01-23 21:07:21 UTC (rev 240) @@ -671,6 +671,7 @@ ui.tabWidget->setTabEnabled(1, 0); ui.tabWidget->setTabEnabled(2, 0); ui.tabWidget->setTabEnabled(3, 0); + ui.tabWidget->setTabEnabled(5, 0); // for test only ft = new FunctionTable(ui.functionTab); @@ -1373,3 +1374,12 @@ ft->selectCell(index); ui.tabWidget->setCurrentIndex(5); } + +void simulationWindow::unlockGUI() +{ + basetools->unlockGUI(); + ui.tabWidget->setTabEnabled(5, true); + ui.functionTab->setEnabled(true); + ft->unlockGUI(); +} + Modified: trunk/qcell/visgui/MainWindow.cpp =================================================================== --- trunk/qcell/visgui/MainWindow.cpp 2007-01-23 20:23:28 UTC (rev 239) +++ trunk/qcell/visgui/MainWindow.cpp 2007-01-23 21:07:21 UTC (rev 240) @@ -16,6 +16,9 @@ sw = new simulationWindow(this); centralWidget()->layout()->addWidget(sw); + connect(this, SIGNAL(unlockGUI()), + sw, SLOT(unlockGUI()) + ); // Adding delay setup // An interlinked pair of QDoubleSpinBox and a QSlider @@ -530,6 +533,8 @@ // Whole experiment saving action_Save_experiment->setEnabled(true); + + emit unlockGUI(); } } Modified: trunk/qcell/visgui/MainWindow.h =================================================================== --- trunk/qcell/visgui/MainWindow.h 2007-01-23 20:23:28 UTC (rev 239) +++ trunk/qcell/visgui/MainWindow.h 2007-01-23 21:07:21 UTC (rev 240) @@ -37,7 +37,8 @@ class MainWindow : public QMainWindow, private Ui::MainWindow { Q_OBJECT - +signals: + void unlockGUI(); public: MainWindow(QWidget* parent = 0); @@ -81,7 +82,6 @@ QMap<QString, ParserInterface*> function_parsers; QMap<QString, ParserInterface*> world_parsers; - void callParser(QString filename, QString type); void callSaver(const QString filename, const QString type); void unlockExperiment(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dhu...@us...> - 2007-01-23 21:41:43
|
Revision: 241 http://svn.sourceforge.net/qcell/?rev=241&view=rev Author: dhubleizh Date: 2007-01-23 13:41:37 -0800 (Tue, 23 Jan 2007) Log Message: ----------- - geez - how can one torture onself in such way?? Why count dimensions and place widgets manually by pixel?? geez - tried to fix that - basetools partially placed in QDockWidget - this GUI needs A LOT of work Modified Paths: -------------- trunk/qcell/baseheaders/basetools.ui trunk/qcell/baseheaders/simulationwindow.h trunk/qcell/basesources/simulationwindow.cpp trunk/qcell/visgui/MainWindow.h Modified: trunk/qcell/baseheaders/basetools.ui =================================================================== --- trunk/qcell/baseheaders/basetools.ui 2007-01-23 21:07:21 UTC (rev 240) +++ trunk/qcell/baseheaders/basetools.ui 2007-01-23 21:41:37 UTC (rev 241) @@ -8,184 +8,207 @@ <rect> <x>0</x> <y>0</y> - <width>115</width> - <height>375</height> + <width>150</width> + <height>503</height> </rect> </property> <property name="windowTitle" > <string>BaseTools</string> </property> - <widget class="QGroupBox" name="EditToolsGroup" > - <property name="geometry" > - <rect> - <x>1</x> - <y>140</y> - <width>113</width> - <height>91</height> - </rect> + <layout class="QVBoxLayout" > + <property name="margin" > + <number>9</number> </property> - <property name="title" > - <string>Edit Tools</string> + <property name="spacing" > + <number>6</number> </property> - <widget class="QToolButton" name="PasteButton" > - <property name="geometry" > - <rect> - <x>10</x> - <y>40</y> - <width>91</width> - <height>20</height> - </rect> - </property> - <property name="text" > - <string>Paste</string> - </property> - </widget> - <widget class="QToolButton" name="FillButton" > - <property name="geometry" > - <rect> - <x>10</x> - <y>60</y> - <width>91</width> - <height>20</height> - </rect> - </property> - <property name="text" > - <string>Fill</string> - </property> - </widget> - <widget class="QToolButton" name="CopyButton" > - <property name="geometry" > - <rect> - <x>10</x> - <y>20</y> - <width>91</width> - <height>20</height> - </rect> - </property> - <property name="text" > - <string>Copy</string> - </property> - </widget> - </widget> - <widget class="QGroupBox" name="EditModeGroup" > - <property name="geometry" > - <rect> - <x>1</x> - <y>70</y> - <width>113</width> - <height>71</height> - </rect> - </property> - <property name="title" > - <string>Edit Mode</string> - </property> - <widget class="QToolButton" name="ModeEditButton" > - <property name="geometry" > - <rect> - <x>10</x> - <y>40</y> - <width>91</width> - <height>20</height> - </rect> - </property> - <property name="text" > - <string>Edit</string> - </property> - <property name="checkable" > - <bool>true</bool> - </property> - </widget> - <widget class="QToolButton" name="ModeSelectButton" > - <property name="geometry" > - <rect> - <x>10</x> - <y>20</y> - <width>91</width> - <height>20</height> - </rect> - </property> - <property name="text" > - <string>Select</string> - </property> - <property name="checkable" > - <bool>true</bool> - </property> - <property name="checked" > - <bool>true</bool> - </property> - </widget> - </widget> - <widget class="QGroupBox" name="ValuesGroup" > - <property name="geometry" > - <rect> - <x>1</x> - <y>240</y> - <width>113</width> - <height>131</height> - </rect> - </property> - <property name="title" > - <string>Values</string> - </property> - <widget class="QTableWidget" name="valueTable" > - <property name="geometry" > - <rect> - <x>5</x> - <y>20</y> - <width>101</width> - <height>101</height> - </rect> - </property> - </widget> - </widget> - <widget class="QGroupBox" name="ViewModeGroup" > - <property name="geometry" > - <rect> - <x>1</x> - <y>0</y> - <width>113</width> - <height>71</height> - </rect> - </property> - <property name="title" > - <string>View Mode</string> - </property> - <widget class="QToolButton" name="LocalViewButton" > - <property name="geometry" > - <rect> - <x>10</x> - <y>40</y> - <width>91</width> - <height>20</height> - </rect> - </property> - <property name="text" > - <string>Local</string> - </property> - <property name="checkable" > - <bool>true</bool> - </property> - </widget> - <widget class="QToolButton" name="GlobalVievButton" > - <property name="geometry" > - <rect> - <x>10</x> - <y>20</y> - <width>91</width> - <height>20</height> - </rect> - </property> - <property name="text" > - <string>Global</string> - </property> - <property name="checkable" > - <bool>true</bool> - </property> - <property name="checked" > - <bool>true</bool> - </property> - </widget> - </widget> + <item> + <widget class="QGroupBox" name="ViewModeGroup" > + <property name="title" > + <string>View Mode</string> + </property> + <layout class="QVBoxLayout" > + <property name="margin" > + <number>9</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QToolButton" name="GlobalVievButton" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>Global</string> + </property> + <property name="checkable" > + <bool>true</bool> + </property> + <property name="checked" > + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="LocalViewButton" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>Local</string> + </property> + <property name="checkable" > + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="EditModeGroup" > + <property name="title" > + <string>Edit Mode</string> + </property> + <layout class="QVBoxLayout" > + <property name="margin" > + <number>9</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QToolButton" name="ModeSelectButton" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>Select</string> + </property> + <property name="checkable" > + <bool>true</bool> + </property> + <property name="checked" > + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="ModeEditButton" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>Edit</string> + </property> + <property name="checkable" > + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="EditToolsGroup" > + <property name="title" > + <string>Edit Tools</string> + </property> + <layout class="QVBoxLayout" > + <property name="margin" > + <number>9</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QToolButton" name="CopyButton" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>Copy</string> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="PasteButton" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>Paste</string> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="FillButton" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>Fill</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="ValuesGroup" > + <property name="title" > + <string>Values</string> + </property> + <layout class="QVBoxLayout" > + <property name="margin" > + <number>9</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QTableWidget" name="valueTable" /> + </item> + </layout> + </widget> + </item> + </layout> </widget> <layoutdefault spacing="6" margin="11" /> <resources/> Modified: trunk/qcell/baseheaders/simulationwindow.h =================================================================== --- trunk/qcell/baseheaders/simulationwindow.h 2007-01-23 21:07:21 UTC (rev 240) +++ trunk/qcell/baseheaders/simulationwindow.h 2007-01-23 21:41:37 UTC (rev 241) @@ -19,6 +19,7 @@ #include "view2dtexttools.h" #include "view1dtexttools.h" #include "math.h" +#include "MainWindow.h" //************** test ***************** #include "functiontable.h" Modified: trunk/qcell/basesources/simulationwindow.cpp =================================================================== --- trunk/qcell/basesources/simulationwindow.cpp 2007-01-23 21:07:21 UTC (rev 240) +++ trunk/qcell/basesources/simulationwindow.cpp 2007-01-23 21:41:37 UTC (rev 241) @@ -100,10 +100,10 @@ symbolTable->move(0, 35); symbolTable->resize(ui.symbolConfig->width() - 7, ui.symbolConfig->height() -42); - basetools->move(width() - 116, 0); - view3DTools->move(width() - 116, basetools->height() + 1); - view2DTextTools->move(width() - 116, basetools->height() + 1); - view1DTextTools->move(width() - 116, basetools->height() + 1); +// basetools->move(width() - 116, 0); +// view3DTools->move(width() - 116, basetools->height() + 1); +// view2DTextTools->move(width() - 116, basetools->height() + 1); +// view1DTextTools->move(width() - 116, basetools->height() + 1); ft->resize(ui.functionTab->width() - 10 , ui.functionTab->height() - 10); } @@ -626,10 +626,22 @@ table2DUpdateRequest = 0; table1DUpdateRequest = 0; - basetools = new BaseTools(this); + basetools = new BaseTools(parent); basetools->getValueTablePointer()->setColumnCount(1); basetools->getValueTablePointer()->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Value"))); + // Let's make that basic tools widget into QDockWidget + QDockWidget* dw = new QDockWidget(parent); + dw->setWidget(basetools); +// dw->hide(); + dw->setWindowTitle(tr("Base tools")); + ((MainWindow*)parent)->addDockWidget(Qt::RightDockWidgetArea, dw); + + // Let's make it accessible from the `View' menu + QAction* bt_action = dw->toggleViewAction(); + bt_action->setText("&" + dw->windowTitle()); + ((Ui_MainWindow*)parent)->menu_View->addAction(bt_action); + selectedSymbol = 0; workMode = 0; Modified: trunk/qcell/visgui/MainWindow.h =================================================================== --- trunk/qcell/visgui/MainWindow.h 2007-01-23 21:07:21 UTC (rev 240) +++ trunk/qcell/visgui/MainWindow.h 2007-01-23 21:41:37 UTC (rev 241) @@ -34,6 +34,8 @@ typedef QString (*parser_fun)(QByteArray content, QString type, QString subtype); +class simulationWindow; + class MainWindow : public QMainWindow, private Ui::MainWindow { Q_OBJECT This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <le...@us...> - 2007-01-24 14:37:45
|
Revision: 245 http://svn.sourceforge.net/qcell/?rev=245&view=rev Author: lessm Date: 2007-01-24 06:28:34 -0800 (Wed, 24 Jan 2007) Log Message: ----------- - Neighbourhood tab add Modified Paths: -------------- trunk/qcell/baseheaders/CalculationData.h trunk/qcell/baseheaders/Neighbourhood.h trunk/qcell/baseheaders/Renderer.h trunk/qcell/baseheaders/simulationwindow.h trunk/qcell/baseheaders/simulationwindow.ui trunk/qcell/basesources/CalculationData.cpp trunk/qcell/basesources/Calculator.cpp trunk/qcell/basesources/Neighbourhood.cpp trunk/qcell/basesources/Renderer.cpp trunk/qcell/basesources/simulationwindow.cpp trunk/qcell/visgui/MainWindow.cpp Modified: trunk/qcell/baseheaders/CalculationData.h =================================================================== --- trunk/qcell/baseheaders/CalculationData.h 2007-01-24 13:47:27 UTC (rev 244) +++ trunk/qcell/baseheaders/CalculationData.h 2007-01-24 14:28:34 UTC (rev 245) @@ -9,7 +9,6 @@ #include <QDomElement> #include <QStringList> #include "BaseDataTypes.h" -#include "Neighbourhood.h" class CalculationData : public baseDataTypes { @@ -86,7 +85,7 @@ CalculationData & operator = (CalculationData &cData); - CalculationData & operator = (Neighbourhood &neighbourhood); + //CalculationData & operator = (Neighbourhood &neighbourhood); signals: void dataUpdated(); Modified: trunk/qcell/baseheaders/Neighbourhood.h =================================================================== --- trunk/qcell/baseheaders/Neighbourhood.h 2007-01-24 13:47:27 UTC (rev 244) +++ trunk/qcell/baseheaders/Neighbourhood.h 2007-01-24 14:28:34 UTC (rev 245) @@ -5,6 +5,7 @@ #include <QVector> #include <QDomElement> #include <QDomDocument> +#include "CalculationData.h" #include "BaseDataTypes.h" struct NContainer @@ -17,6 +18,8 @@ bool bValue; }value; int offset; + + //NContainer & operator = (NContainer &con); }; @@ -68,6 +71,8 @@ QVector<int> getMaxNeighbourhoodValues(void); QVector<int> getMinNeighbourhoodValues(void); + CalculationData toCalculationData(void); + }; #endif Modified: trunk/qcell/baseheaders/Renderer.h =================================================================== --- trunk/qcell/baseheaders/Renderer.h 2007-01-24 13:47:27 UTC (rev 244) +++ trunk/qcell/baseheaders/Renderer.h 2007-01-24 14:28:34 UTC (rev 245) @@ -72,6 +72,8 @@ QVector<int> maskValue; + bool showValues; + protected: void initializeGL(); void paintGL(); @@ -145,6 +147,8 @@ QList< QVector<int> > getSelectData(void); void maskSet(int x, int y, int z); + void showCellValues(bool show = 1); + protected slots: void resizeDataEvent(void); Modified: trunk/qcell/baseheaders/simulationwindow.h =================================================================== --- trunk/qcell/baseheaders/simulationwindow.h 2007-01-24 13:47:27 UTC (rev 244) +++ trunk/qcell/baseheaders/simulationwindow.h 2007-01-24 14:28:34 UTC (rev 245) @@ -101,6 +101,8 @@ void localViewReinterprete(void); int calculateDistans(int x, int y, int z, bool box=1); + Renderer *nRrenderer; + protected: void update2DTable(bool forceUpdate=0); void update2DGraph(void); @@ -115,6 +117,7 @@ Renderer *getRenderer(); CalculationData *getStorage(); + Renderer *getNeighbourhoodEditor(void); protected slots: void zPlaneChange(int i); Modified: trunk/qcell/baseheaders/simulationwindow.ui =================================================================== --- trunk/qcell/baseheaders/simulationwindow.ui 2007-01-24 13:47:27 UTC (rev 244) +++ trunk/qcell/baseheaders/simulationwindow.ui 2007-01-24 14:28:34 UTC (rev 245) @@ -36,7 +36,7 @@ <enum>QTabWidget::Rounded</enum> </property> <property name="currentIndex" > - <number>0</number> + <number>6</number> </property> <widget class="QWidget" name="view3D" > <attribute name="title" > @@ -116,6 +116,11 @@ <string>Function</string> </attribute> </widget> + <widget class="QWidget" name="NeighbourhoodTab" > + <attribute name="title" > + <string>Neighbourhood</string> + </attribute> + </widget> </widget> </item> </layout> Modified: trunk/qcell/basesources/CalculationData.cpp =================================================================== --- trunk/qcell/basesources/CalculationData.cpp 2007-01-24 13:47:27 UTC (rev 244) +++ trunk/qcell/basesources/CalculationData.cpp 2007-01-24 14:28:34 UTC (rev 245) @@ -953,7 +953,7 @@ fillData(cData.getDataPointer()); return *this; } - +/* CalculationData & CalculationData::operator = (Neighbourhood &neighbourhood) { clearData(); @@ -966,3 +966,4 @@ return *this; } +*/ \ No newline at end of file Modified: trunk/qcell/basesources/Calculator.cpp =================================================================== --- trunk/qcell/basesources/Calculator.cpp 2007-01-24 13:47:27 UTC (rev 244) +++ trunk/qcell/basesources/Calculator.cpp 2007-01-24 14:28:34 UTC (rev 245) @@ -252,28 +252,27 @@ if(st==0) st=1; - if(!wasFreezed) - copyData(); + copyData(); - for(int t=startT;t<st;t++) + for(int t=0;t<st;t++) { if (dimension == 4) { coordinates[3] = t; } - for(int z=startZ;z<sz;z++) + for(int z=0;z<sz;z++) { if (dimension >= 3) { coordinates[2] = z; } - for(int y=startY;y<sy;y++) + for(int y=0;y<sy;y++) { if (dimension >= 2) { coordinates[1] = y; } - for(int x=startX;x<sx;x++) + for(int x=0;x<sx;x++) { coordinates[0] = x; neighbourhood->resolveValues(tempData + (x - minBorder[0]) + ((y - minBorder[1]) * tempDataSize[0]) + (z - minBorder[2]) * (tempDataSize[0] * tempDataSize[1]) + (t - minBorder[3]) * (tempDataSize[0] * tempDataSize[1] * tempDataSize[2]) * dataSize); @@ -295,12 +294,10 @@ if(*((int *)temp)<0) { /// @todo k\xD3Zka - //startX = x; - //startY = y; - //startZ = z; - //startT = t; - wasFreezed = 1; - //storedCounter = counter; + startX = x; + startY = y; + startZ = z; + startT = t; functionIndex = localfunction->lastUnknownValueIndex(); return 0; } @@ -312,9 +309,6 @@ } } } - storedCounter = 0; - startT = startZ = startY = startX = 0; - wasFreezed = 0; memcpy(data, calcBuffer, getSizeInByte()); return 1; } Modified: trunk/qcell/basesources/Neighbourhood.cpp =================================================================== --- trunk/qcell/basesources/Neighbourhood.cpp 2007-01-24 13:47:27 UTC (rev 244) +++ trunk/qcell/basesources/Neighbourhood.cpp 2007-01-24 14:28:34 UTC (rev 245) @@ -1,5 +1,16 @@ #include "../baseheaders/Neighbourhood.h" - +/* +NContainer & NContainer::operator =(NContainer &con) +{ + x = con.x; + y = con.y; + z = con.z; + t = con.t; + value = con.value; + offset = con.offset; + return *this; +} +*/ Neighbourhood::Neighbourhood() { dimension = 666; @@ -472,3 +483,51 @@ { return minValues; } + +CalculationData Neighbourhood::toCalculationData(void) +{ + CalculationData out; + QVector<int> minv, maxv; + + minv = getMinNeighbourhoodValues(); + maxv = getMaxNeighbourhoodValues(); + + QVector<NContainer> ng = getNeighbours(); + + int sx = maxv[0] - minv[0], sy = maxv[1] - minv[1], sz = maxv[2] - minv[2]; + if(minv[0]<0) + sx++; + if(minv[1]<0) + sy++; + if(minv[2]<0) + sz++; + + switch(getDimension()) + { + case 1: + out.resizeData(sx); + out.fillData(0); + for(int i=0;i<ng.size();++i) + { + out.setValueAt(i+1, ng[i].x - minv[0]); + } + break; + case 2: + out.resizeData(sx, sy); + out.fillData(0); + for(int i=0;i<ng.size();++i) + { + out.setValueAt(i+1, ng[i].x - minv[0], ng[i].y - minv[1]); + } + break; + case 3: + out.resizeData(sx, sy, sz); + out.fillData(0); + for(int i=0;i<ng.size();++i) + { + out.setValueAt(i+1, ng[i].x - minv[0], ng[i].y - minv[1], ng[i].z - minv[2]); + } + break; + } + return out; +} Modified: trunk/qcell/basesources/Renderer.cpp =================================================================== --- trunk/qcell/basesources/Renderer.cpp 2007-01-24 13:47:27 UTC (rev 244) +++ trunk/qcell/basesources/Renderer.cpp 2007-01-24 14:28:34 UTC (rev 245) @@ -317,7 +317,8 @@ if(workMode==1) getStorage()->setValueAt(editValue, selectetObjects[0]); QVector<int> sCoord = getSelectedCoord(); - emit objectSelected(sCoord[0], sCoord[1], sCoord[2]); + if(sCoord.size()>0) + emit objectSelected(sCoord[0], sCoord[1], sCoord[2]); } } @@ -402,15 +403,18 @@ QVector<int> out; out.resize(3); - out[0] = index % getStorage()->getSizeX(); + int sx = getStorage()->getSizeX(); + int sy = getStorage()->getSizeY()==0 ? 1 : getStorage()->getSizeY(); + + out[0] = index % sx; index /= getStorage()->getSizeX(); - if(index<getStorage()->getSizeY()) + if(index<sy) { out[1] = index; return out; } - out[1] = index % getStorage()->getSizeY(); - index /= getStorage()->getSizeY(); + out[1] = index % sy; + index /= sy; out[2] = index; return out; @@ -454,6 +458,7 @@ maskValue.resize(3); maskValue[0] = maskValue[1] = maskValue[2] = -1; + showValues = 0; } Renderer::~Renderer() @@ -495,7 +500,7 @@ minValIndex = selectBuffer[i + 3]; } } - if(minValIndex!=1) + if(minValIndex!=-1) { selectetObjects<<minValIndex; updateGL(); @@ -678,6 +683,7 @@ int counter = 0, index; bool selectTest; float mx = -(float)storage.getSizeX(), my = -(float)storage.getSizeY(), mz = -(float)storage.getSizeZ(); + makeCurrent(); if(renderGreed) { glDisable(GL_LIGHTING); @@ -686,7 +692,13 @@ } SYMBOL symbol; - for(int z=0;z<storage.getSizeZ();++z) + int sx = storage.getSizeX(); + int sy = storage.getSizeY()==0 ? 1 : storage.getSizeY(); + int sz = storage.getSizeZ()==0 ? 1 : storage.getSizeZ(); + + + + for(int z=0;z<sz;++z) { if(maskValue[2]>-1) if(maskValue[2]!=z) @@ -694,7 +706,7 @@ counter += storage.getSizeY() * storage.getSizeX(); continue; } - for(int y=storage.getSizeY();y>0;--y) + for(int y=sy;y>0;--y) { if(maskValue[1]>-1) if(maskValue[1]!=storage.getSizeY() - y) @@ -702,7 +714,7 @@ counter += storage.getSizeY(); continue; } - for(int x=0;x<storage.getSizeX();++x) + for(int x=0;x<sx;++x) { if(maskValue[0]>-1) if(maskValue[0]!=x) @@ -776,24 +788,47 @@ } } } - if(showLocalObserver && !selectionMode) + if(!selectionMode) { + if(showLocalObserver) + { - glPushMatrix(); - glTranslatef(mx + (float)localObserverCoords[0] * 2.0f , my + (storage.getSizeY() - (float)localObserverCoords[1]) * 2.0f, mz + (float)localObserverCoords[2] * 2.0f); - glRotatef(rotation[2], 0.0f, 0.0f, -1.0f); - glRotatef(rotation[1], 0.0f, -1.0f, 0.0f); - glRotatef(rotation[0], -1.0f, 0.0f, 0.0f); + glPushMatrix(); + glTranslatef(mx + (float)localObserverCoords[0] * 2.0f , my + (storage.getSizeY() - (float)localObserverCoords[1]) * 2.0f, mz + (float)localObserverCoords[2] * 2.0f); + glRotatef(rotation[2], 0.0f, 0.0f, -1.0f); + glRotatef(rotation[1], 0.0f, -1.0f, 0.0f); + glRotatef(rotation[0], -1.0f, 0.0f, 0.0f); - glBlendFunc(GL_ONE, GL_ONE); - glEnable(GL_BLEND); + glBlendFunc(GL_ONE, GL_ONE); + glEnable(GL_BLEND); + glDisable(GL_LIGHTING); + glEnable(GL_TEXTURE_2D); + glCallList(observer); + glDisable(GL_TEXTURE_2D); + glEnable(GL_LIGHTING); + glDisable(GL_BLEND); + glPopMatrix(); + } + if(showValues) + { glDisable(GL_LIGHTING); - glEnable(GL_TEXTURE_2D); - glCallList(observer); - glDisable(GL_TEXTURE_2D); + glDisable(GL_DEPTH_TEST); + QFont font("Curier New"); + font.setStyleHint(QFont::AnyStyle, QFont::PreferBitmap); + + for(int z=0;z<sz;++z) + { + for(int y=sy;y>0;--y) + { + for(int x=0;x<sx;++x) + { + renderText(mx + (float)x * 2.0f , my + (float)y * 2.0f, mz + (float)z * 2.0f, tr("%1").arg(storage.getValueAt_i(x, y-1, z)), font); + } + } + } glEnable(GL_LIGHTING); - glDisable(GL_BLEND); - glPopMatrix(); + glEnable(GL_DEPTH_TEST); + } } } @@ -984,6 +1019,11 @@ maskValue[2] = z; } +void Renderer::showCellValues(bool show) +{ + showValues = show; +} + void Renderer::setOrtoPerspective(bool noClear) { float aspect = (float)width()/(float)height(); Modified: trunk/qcell/basesources/simulationwindow.cpp =================================================================== --- trunk/qcell/basesources/simulationwindow.cpp 2007-01-24 13:47:27 UTC (rev 244) +++ trunk/qcell/basesources/simulationwindow.cpp 2007-01-24 14:28:34 UTC (rev 245) @@ -107,6 +107,8 @@ // view1DTextTools->move(width() - 116, basetools->height() + 1); // ft->resize(ui.functionTab->width() - 10 , ui.functionTab->height() - 10); + +// nRrenderer->resize(ui.NeighbourhoodTab->width(), ui.NeighbourhoodTab->height()); } void simulationWindow::paintEvent(QPaintEvent * event) @@ -719,6 +721,11 @@ ui.functionTab->setLayout(new QVBoxLayout(ui.functionTab)); ft = new FunctionTable(ui.functionTab); ui.functionTab->layout()->addWidget(ft); + + ui.NeighbourhoodTab->setLayout(new QVBoxLayout(ui.NeighbourhoodTab)); + nRrenderer = new Renderer(ui.NeighbourhoodTab); + ui.NeighbourhoodTab->layout()->addWidget(nRrenderer); + nRrenderer->showCellValues(); } simulationWindow::~simulationWindow() @@ -743,6 +750,11 @@ return renderer->getStorage(); } +Renderer *simulationWindow::getNeighbourhoodEditor(void) +{ + return nRrenderer; +} + void simulationWindow::zPlaneChange(int i) { z_plane = i; Modified: trunk/qcell/visgui/MainWindow.cpp =================================================================== --- trunk/qcell/visgui/MainWindow.cpp 2007-01-24 13:47:27 UTC (rev 244) +++ trunk/qcell/visgui/MainWindow.cpp 2007-01-24 14:28:34 UTC (rev 245) @@ -438,6 +438,11 @@ return; } + //*************************************************** + *sw->getNeighbourhoodEditor()->getStorage() = neighbourhood->toCalculationData(); + sw->getNeighbourhoodEditor()->setTranslation(0.0f, 0.0f, -10.0f); + sw->getNeighbourhoodEditor()->setSymbolColor(1, QColor(128, 128, 128)); + //*************************************************** calc.setNeighbourhood(neighbourhood); // Enable saving menu for Neighbourhood @@ -701,7 +706,7 @@ { sw->setSelectedCell(calc.freezedCoords()); sw->setSelectedFunctionRule(calc.getUnknowFunctionRuleIndex()); - //iteration--; + iteration--; } } else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dhu...@us...> - 2007-01-24 14:55:48
|
Revision: 246 http://svn.sourceforge.net/qcell/?rev=246&view=rev Author: dhubleizh Date: 2007-01-24 06:55:44 -0800 (Wed, 24 Jan 2007) Log Message: ----------- - Base Tools back in action - table width in docking area bug resolved Modified Paths: -------------- trunk/qcell/baseheaders/basetools.h trunk/qcell/baseheaders/basetools.ui trunk/qcell/baseheaders/view3dtools.h trunk/qcell/basesources/basetools.cpp trunk/qcell/basesources/view3dtools.cpp trunk/qcell/visgui/MainWindow.cpp trunk/qcell/visgui/MainWindow.h Modified: trunk/qcell/baseheaders/basetools.h =================================================================== --- trunk/qcell/baseheaders/basetools.h 2007-01-24 14:28:34 UTC (rev 245) +++ trunk/qcell/baseheaders/basetools.h 2007-01-24 14:55:44 UTC (rev 246) @@ -10,13 +10,13 @@ Q_OBJECT public: + Ui::BaseToolsClass ui; BaseTools(QWidget *parent = 0); ~BaseTools(); QTableWidget * getValueTablePointer(void); private: - Ui::BaseToolsClass ui; int editMode; public slots: Modified: trunk/qcell/baseheaders/basetools.ui =================================================================== --- trunk/qcell/baseheaders/basetools.ui 2007-01-24 14:28:34 UTC (rev 245) +++ trunk/qcell/baseheaders/basetools.ui 2007-01-24 14:55:44 UTC (rev 246) @@ -8,8 +8,8 @@ <rect> <x>0</x> <y>0</y> - <width>118</width> - <height>438</height> + <width>148</width> + <height>519</height> </rect> </property> <property name="windowTitle" > @@ -215,25 +215,65 @@ </widget> </item> <item> - <widget class="QTableWidget" name="valueTable" > + <widget class="QGroupBox" name="ValuesGroup" > <property name="sizePolicy" > <sizepolicy> - <hsizetype>0</hsizetype> - <vsizetype>0</vsizetype> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <row> - <property name="text" > - <string>1</string> + <property name="maximumSize" > + <size> + <width>130</width> + <height>150</height> + </size> + </property> + <property name="title" > + <string>Values</string> + </property> + <layout class="QVBoxLayout" > + <property name="margin" > + <number>9</number> </property> - </row> - <column> - <property name="text" > - <string>Value</string> + <property name="spacing" > + <number>6</number> </property> - </column> + <item> + <widget class="QTableWidget" name="valueTable" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize" > + <size> + <width>120</width> + <height>110</height> + </size> + </property> + <row> + <property name="text" > + <string>1</string> + </property> + </row> + <row> + <property name="text" > + <string>2</string> + </property> + </row> + <column> + <property name="text" > + <string>Value</string> + </property> + </column> + </widget> + </item> + </layout> </widget> </item> </layout> Modified: trunk/qcell/baseheaders/view3dtools.h =================================================================== --- trunk/qcell/baseheaders/view3dtools.h 2007-01-24 14:28:34 UTC (rev 245) +++ trunk/qcell/baseheaders/view3dtools.h 2007-01-24 14:55:44 UTC (rev 246) @@ -12,6 +12,8 @@ View3DTools(QWidget *parent = 0); ~View3DTools(); +protected: + void setFloating(bool floating); private: Ui::View3DToolsClass ui; int viewMode; Modified: trunk/qcell/basesources/basetools.cpp =================================================================== --- trunk/qcell/basesources/basetools.cpp 2007-01-24 14:28:34 UTC (rev 245) +++ trunk/qcell/basesources/basetools.cpp 2007-01-24 14:55:44 UTC (rev 246) @@ -1,4 +1,5 @@ #include "../baseheaders/basetools.h" +#include <QDebug> BaseTools::BaseTools(QWidget *parent) : QWidget(parent) @@ -6,7 +7,6 @@ ui.setupUi(this); ui.valueTable->resizeColumnsToContents(); ui.valueTable->resizeRowsToContents(); -// ui.valueTable->adjustSize(); editMode = 0; connect(ui.CopyButton, SIGNAL(clicked(bool)), SLOT(commandCopy())); connect(ui.PasteButton, SIGNAL(clicked(bool)), SLOT(commandPaste())); @@ -60,7 +60,7 @@ ui.LocalViewButton->setChecked(0); ui.EditModeGroup->show(); ui.EditToolsGroup->show(); -// ui.ValuesGroup->show(); + ui.ValuesGroup->show(); if(editMode!=2) { editMode=2; @@ -84,7 +84,7 @@ ui.LocalViewButton->setChecked(1); ui.EditModeGroup->hide(); ui.EditToolsGroup->hide(); -// ui.ValuesGroup->hide(); + ui.ValuesGroup->hide(); if(editMode!=3) { editMode=3; @@ -125,5 +125,15 @@ void BaseTools::setItem(int row, int column, QTableWidgetItem* item) { ui.valueTable->setItem(row, column, item); + qDebug() << "BaseSize: " << ui.valueTable->baseSize() + << " FrameSize: " << ui.valueTable->frameSize() + << " MaximumSize: " << ui.valueTable->maximumSize() + << " MaximumViewportSize: " << ui.valueTable->maximumViewportSize() + << " MinimumSize: " << ui.valueTable->minimumSize() + << " MinimumSizeHint: " << ui.valueTable->minimumSizeHint() + << " Size: " << ui.valueTable->size() + << " SizeHint: " << ui.valueTable->sizeHint() + << " SizeIncrement: " << ui.valueTable->sizeIncrement() + << " sizePolicy: " << ui.valueTable->sizePolicy(); } Modified: trunk/qcell/basesources/view3dtools.cpp =================================================================== --- trunk/qcell/basesources/view3dtools.cpp 2007-01-24 14:28:34 UTC (rev 245) +++ trunk/qcell/basesources/view3dtools.cpp 2007-01-24 14:55:44 UTC (rev 246) @@ -127,4 +127,11 @@ emit maskSet(-1, value, -1); } } -} \ No newline at end of file +} + +void View3DTools::setFloating(bool floating) +{ + qDebug("Tutaj!"); + this->adjustSize(); +} + Modified: trunk/qcell/visgui/MainWindow.cpp =================================================================== --- trunk/qcell/visgui/MainWindow.cpp 2007-01-24 14:28:34 UTC (rev 245) +++ trunk/qcell/visgui/MainWindow.cpp 2007-01-24 14:55:44 UTC (rev 246) @@ -20,40 +20,39 @@ sw, SLOT(unlockGUI()) ); -// QDockWidget* dw = new QDockWidget(this); -// BaseTools* basetools = new BaseTools(dw); -// dw->setWidget(basetools); -// dw->setWindowTitle(tr("Base tools")); -// ((QVBoxLayout*)dw->layout())->addStretch(); -// addDockWidget(Qt::RightDockWidgetArea, dw); -// -// // Let's make it accessible from the `View' menu -// QAction* bt_action = dw->toggleViewAction(); -// bt_action->setText("&" + dw->windowTitle()); -// menu_View->addAction(bt_action); -// -// connect(basetools, SIGNAL(toolsModeUpdate(int)), -// sw, SLOT(workModeChange(int)) -// ); -// connect(basetools, SIGNAL(symbolSelected(int)), -// sw, SLOT(selectSymbol(int)) -// ); -// connect(basetools, SIGNAL(command(int)), -// sw, SLOT(commandExecute(int)) -// ); -// connect(sw, SIGNAL(setRowCount(int)), -// basetools, SLOT(setRowCount(int)) -// ); -// connect(sw, SIGNAL(setItem(int, int, QTableWidgetItem*)), -// basetools, SLOT(setItem(int, int, QTableWidgetItem*)) -// ); + setDockNestingEnabled(true); + baseDock = new BetterDockWidget(this); + BaseTools* basetools = new BaseTools(baseDock); + baseDock->setWindowTitle(tr("Base tools")); + baseDock->setWidget(basetools); + ((QVBoxLayout*)baseDock->layout())->addStretch(); + addDockWidget(Qt::RightDockWidgetArea, baseDock); -// QSizePolicy sp(QSizePolicy::Minimum, QSizePolicy::Minimum); + // Let's make it accessible from the `View' menu + QAction* bt_action = baseDock->toggleViewAction(); + bt_action->setText("&" + baseDock->windowTitle()); + menu_View->addAction(bt_action); + + connect(basetools, SIGNAL(toolsModeUpdate(int)), + sw, SLOT(workModeChange(int)) + ); + connect(basetools, SIGNAL(symbolSelected(int)), + sw, SLOT(selectSymbol(int)) + ); + connect(basetools, SIGNAL(command(int)), + sw, SLOT(commandExecute(int)) + ); + connect(sw, SIGNAL(setRowCount(int)), + basetools, SLOT(setRowCount(int)) + ); + connect(sw, SIGNAL(setItem(int, int, QTableWidgetItem*)), + basetools, SLOT(setItem(int, int, QTableWidgetItem*)) + ); + // View 3D Tools dock3D = new BetterDockWidget(this); dock3D->hide(); dock3D->setDisabled(true); -// dock3D->setSizePolicy(sp); View3DTools* view3DTools = new View3DTools(this); dock3D->setWindowTitle(tr("3D Tools")); dock3D->setWidget(view3DTools); @@ -65,9 +64,6 @@ v3d_action->setText(tr("&3D Tools")); menu_View->addAction(v3d_action); -// connect(dock3D, SIGNAL(topLevelChanged(bool)), -// this, SLOT(test()) -// ); connect(view3DTools, SIGNAL(ViewModeUpdated(int)), sw, SLOT(perspectiveUpdate(int))); connect(view3DTools, SIGNAL(maskSet(int, int, int)), @@ -1147,8 +1143,3 @@ } } -void MainWindow::test() -{ - dock3D->adjustSize(); -} - Modified: trunk/qcell/visgui/MainWindow.h =================================================================== --- trunk/qcell/visgui/MainWindow.h 2007-01-24 14:28:34 UTC (rev 245) +++ trunk/qcell/visgui/MainWindow.h 2007-01-24 14:55:44 UTC (rev 246) @@ -46,10 +46,9 @@ Q_OBJECT signals: void unlockGUI(); -public slots: - void test(); public: MainWindow(QWidget* parent = 0); + void addDockWidget(Qt::DockWidgetArea area, QDockWidget* dockwidget); private slots: void on_action_About_activated(); @@ -112,6 +111,7 @@ BetterDockWidget* dock3D; BetterDockWidget* dock2D; BetterDockWidget* dock1D; + BetterDockWidget* baseDock; QList<CalculationData*> data; LocalFunction* local_function; Neighbourhood* neighbourhood; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dhu...@us...> - 2007-01-24 12:38:59
|
Revision: 242 http://svn.sourceforge.net/qcell/?rev=242&view=rev Author: dhubleizh Date: 2007-01-24 04:38:54 -0800 (Wed, 24 Jan 2007) Log Message: ----------- - totally rewritten the GUI to QDockWidgets Modified Paths: -------------- trunk/qcell/baseheaders/basetools.h trunk/qcell/baseheaders/basetools.ui trunk/qcell/baseheaders/simulationwindow.h trunk/qcell/baseheaders/simulationwindow.ui trunk/qcell/baseheaders/view1dtexttools.ui trunk/qcell/baseheaders/view2dtexttools.h trunk/qcell/baseheaders/view2dtexttools.ui trunk/qcell/baseheaders/view3dtools.h trunk/qcell/baseheaders/view3dtools.ui trunk/qcell/basesources/basetools.cpp trunk/qcell/basesources/simulationwindow.cpp trunk/qcell/basesources/view2dtexttools.cpp trunk/qcell/visgui/MainWindow.cpp trunk/qcell/visgui/MainWindow.h Modified: trunk/qcell/baseheaders/basetools.h =================================================================== --- trunk/qcell/baseheaders/basetools.h 2007-01-23 21:41:37 UTC (rev 241) +++ trunk/qcell/baseheaders/basetools.h 2007-01-24 12:38:54 UTC (rev 242) @@ -21,6 +21,8 @@ public slots: void unlockGUI(); + void setRowCount(int count); + void setItem(int row, int column, QTableWidgetItem* item); protected slots: void modeChangeSelect(void); Modified: trunk/qcell/baseheaders/basetools.ui =================================================================== --- trunk/qcell/baseheaders/basetools.ui 2007-01-23 21:41:37 UTC (rev 241) +++ trunk/qcell/baseheaders/basetools.ui 2007-01-24 12:38:54 UTC (rev 242) @@ -2,14 +2,14 @@ <class>BaseToolsClass</class> <widget class="QWidget" name="BaseToolsClass" > <property name="enabled" > - <bool>false</bool> + <bool>true</bool> </property> <property name="geometry" > <rect> <x>0</x> <y>0</y> - <width>150</width> - <height>503</height> + <width>118</width> + <height>438</height> </rect> </property> <property name="windowTitle" > @@ -24,6 +24,14 @@ </property> <item> <widget class="QGroupBox" name="ViewModeGroup" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <property name="title" > <string>View Mode</string> </property> @@ -78,6 +86,14 @@ </item> <item> <widget class="QGroupBox" name="EditModeGroup" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <property name="title" > <string>Edit Mode</string> </property> @@ -132,6 +148,14 @@ </item> <item> <widget class="QGroupBox" name="EditToolsGroup" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <property name="title" > <string>Edit Tools</string> </property> @@ -191,21 +215,25 @@ </widget> </item> <item> - <widget class="QGroupBox" name="ValuesGroup" > - <property name="title" > - <string>Values</string> + <widget class="QTableWidget" name="valueTable" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> - <layout class="QVBoxLayout" > - <property name="margin" > - <number>9</number> + <row> + <property name="text" > + <string>1</string> </property> - <property name="spacing" > - <number>6</number> + </row> + <column> + <property name="text" > + <string>Value</string> </property> - <item> - <widget class="QTableWidget" name="valueTable" /> - </item> - </layout> + </column> </widget> </item> </layout> Modified: trunk/qcell/baseheaders/simulationwindow.h =================================================================== --- trunk/qcell/baseheaders/simulationwindow.h 2007-01-23 21:41:37 UTC (rev 241) +++ trunk/qcell/baseheaders/simulationwindow.h 2007-01-24 12:38:54 UTC (rev 242) @@ -31,7 +31,19 @@ class simulationWindow : public QWidget { Q_OBJECT +signals: + void setRowCount(int count); + void setItem(int row, int column, QTableWidgetItem* item); + void set3DToolsRange(int x, int y, int z); + void set3DToolsVisible(bool visible); + + void setZPlaneMax(int value); + void pure2DMode(bool flag); + void showZPlaneOnly(bool flag); + void set2DTextToolsVisible(bool visible); + + void set1DTextToolsVisible(bool visible); private: Ui::simulationWindowClass ui; @@ -51,8 +63,8 @@ QToolBox *tools; BaseTools *basetools; - View3DTools *view3DTools; - View2DTextTools *view2DTextTools; +// View3DTools *view3DTools; +// View2DTextTools *view2DTextTools; int view2DTextInterpretationMode; @@ -78,6 +90,8 @@ QList< QVector<int> > dataToCopy; + int last_tab_index; + virtual void mouseMoveEvent(QMouseEvent * event); virtual void mousePressEvent(QMouseEvent * event); virtual void wheelEvent(QWheelEvent * event); @@ -133,6 +147,7 @@ void maskChange(int x, int y, int z); void unlockGUI(); + void tabChanged(int index); public: void storeSelectedData(void); Modified: trunk/qcell/baseheaders/simulationwindow.ui =================================================================== --- trunk/qcell/baseheaders/simulationwindow.ui 2007-01-23 21:41:37 UTC (rev 241) +++ trunk/qcell/baseheaders/simulationwindow.ui 2007-01-24 12:38:54 UTC (rev 242) @@ -20,103 +20,105 @@ <property name="windowTitle" > <string>simulationWindow</string> </property> - <widget class="QTabWidget" name="tabWidget" > - <property name="geometry" > - <rect> - <x>10</x> - <y>10</y> - <width>381</width> - <height>281</height> - </rect> + <layout class="QVBoxLayout" > + <property name="margin" > + <number>9</number> </property> - <property name="tabPosition" > - <enum>QTabWidget::North</enum> + <property name="spacing" > + <number>6</number> </property> - <property name="tabShape" > - <enum>QTabWidget::Rounded</enum> - </property> - <property name="currentIndex" > - <number>5</number> - </property> - <widget class="QWidget" name="view3D" > - <attribute name="title" > - <string>3D View</string> - </attribute> - </widget> - <widget class="QWidget" name="view2D" > - <attribute name="title" > - <string>2D Text View</string> - </attribute> - </widget> - <widget class="QWidget" name="view2DGraph" > - <attribute name="title" > - <string>2D Graphics View</string> - </attribute> - </widget> - <widget class="QWidget" name="view1D" > - <attribute name="title" > - <string>1D Text View</string> - </attribute> - </widget> - <widget class="QWidget" name="symbolConfig" > - <attribute name="title" > - <string>Symbols Configuration</string> - </attribute> - <layout class="QVBoxLayout" > - <property name="margin" > - <number>9</number> + <item> + <widget class="QTabWidget" name="tabWidget" > + <property name="tabPosition" > + <enum>QTabWidget::North</enum> </property> - <property name="spacing" > - <number>6</number> + <property name="tabShape" > + <enum>QTabWidget::Rounded</enum> </property> - <item> - <layout class="QHBoxLayout" > + <property name="currentIndex" > + <number>0</number> + </property> + <widget class="QWidget" name="view3D" > + <attribute name="title" > + <string>3D View</string> + </attribute> + </widget> + <widget class="QWidget" name="view2D" > + <attribute name="title" > + <string>2D Text View</string> + </attribute> + </widget> + <widget class="QWidget" name="view2DGraph" > + <attribute name="title" > + <string>2D Graphics View</string> + </attribute> + </widget> + <widget class="QWidget" name="view1D" > + <attribute name="title" > + <string>1D Text View</string> + </attribute> + </widget> + <widget class="QWidget" name="symbolConfig" > + <attribute name="title" > + <string>Symbols Configuration</string> + </attribute> + <layout class="QVBoxLayout" > <property name="margin" > - <number>0</number> + <number>9</number> </property> <property name="spacing" > <number>6</number> </property> <item> - <widget class="QPushButton" name="addSymbol" > - <property name="text" > - <string>Add Symbol</string> + <layout class="QHBoxLayout" > + <property name="margin" > + <number>0</number> </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="removeSymbol" > - <property name="text" > - <string>Remove Symbol</string> + <property name="spacing" > + <number>6</number> </property> - </widget> + <item> + <widget class="QPushButton" name="addSymbol" > + <property name="text" > + <string>Add Symbol</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="removeSymbol" > + <property name="text" > + <string>Remove Symbol</string> + </property> + </widget> + </item> + <item> + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" > + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> </item> - <item> - <spacer> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" > - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> </layout> - </item> - </layout> - </widget> - <widget class="QWidget" name="functionTab" > - <property name="enabled" > - <bool>false</bool> - </property> - <attribute name="title" > - <string>Function</string> - </attribute> - </widget> - </widget> + </widget> + <widget class="QWidget" name="functionTab" > + <property name="enabled" > + <bool>false</bool> + </property> + <attribute name="title" > + <string>Function</string> + </attribute> + </widget> + </widget> + </item> + </layout> </widget> <layoutdefault spacing="6" margin="11" /> <resources/> Modified: trunk/qcell/baseheaders/view1dtexttools.ui =================================================================== --- trunk/qcell/baseheaders/view1dtexttools.ui 2007-01-23 21:41:37 UTC (rev 241) +++ trunk/qcell/baseheaders/view1dtexttools.ui 2007-01-24 12:38:54 UTC (rev 242) @@ -5,103 +5,123 @@ <rect> <x>0</x> <y>0</y> - <width>115</width> - <height>145</height> + <width>119</width> + <height>224</height> </rect> </property> <property name="windowTitle" > <string>View1DTextTools</string> </property> - <widget class="QGroupBox" name="groupBox" > - <property name="geometry" > - <rect> - <x>1</x> - <y>1</y> - <width>113</width> - <height>91</height> - </rect> + <layout class="QVBoxLayout" > + <property name="margin" > + <number>9</number> </property> - <property name="title" > - <string>View 1D Text</string> + <property name="spacing" > + <number>6</number> </property> - <widget class="QToolButton" name="SymbolsButton" > - <property name="geometry" > - <rect> - <x>10</x> - <y>60</y> - <width>91</width> - <height>20</height> - </rect> - </property> - <property name="text" > - <string>Symbols</string> - </property> - <property name="checkable" > - <bool>true</bool> - </property> - </widget> - <widget class="QToolButton" name="ValuesButton" > - <property name="geometry" > - <rect> - <x>10</x> - <y>40</y> - <width>91</width> - <height>20</height> - </rect> - </property> - <property name="text" > - <string>Values</string> - </property> - <property name="checkable" > - <bool>true</bool> - </property> - <property name="checked" > - <bool>true</bool> - </property> - </widget> - <widget class="QToolButton" name="ColorsButton" > - <property name="geometry" > - <rect> - <x>10</x> - <y>20</y> - <width>91</width> - <height>20</height> - </rect> - </property> - <property name="text" > - <string>Colors</string> - </property> - <property name="checkable" > - <bool>true</bool> - </property> - </widget> - </widget> - <widget class="QGroupBox" name="groupBox_2" > - <property name="geometry" > - <rect> - <x>1</x> - <y>90</y> - <width>113</width> - <height>51</height> - </rect> - </property> - <property name="title" > - <string>Memory</string> - </property> - <widget class="QToolButton" name="MemoryClearButton" > - <property name="geometry" > - <rect> - <x>10</x> - <y>20</y> - <width>91</width> - <height>20</height> - </rect> - </property> - <property name="text" > - <string>Clear</string> - </property> - </widget> - </widget> + <item> + <widget class="QGroupBox" name="groupBox" > + <property name="title" > + <string>View 1D Text</string> + </property> + <layout class="QVBoxLayout" > + <property name="margin" > + <number>9</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QToolButton" name="ColorsButton" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>Colors</string> + </property> + <property name="checkable" > + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="ValuesButton" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>Values</string> + </property> + <property name="checkable" > + <bool>true</bool> + </property> + <property name="checked" > + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="SymbolsButton" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>Symbols</string> + </property> + <property name="checkable" > + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox_2" > + <property name="title" > + <string>Memory</string> + </property> + <layout class="QVBoxLayout" > + <property name="margin" > + <number>9</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QToolButton" name="MemoryClearButton" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>Clear</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + </layout> </widget> <layoutdefault spacing="6" margin="11" /> <resources/> Modified: trunk/qcell/baseheaders/view2dtexttools.h =================================================================== --- trunk/qcell/baseheaders/view2dtexttools.h 2007-01-23 21:41:37 UTC (rev 241) +++ trunk/qcell/baseheaders/view2dtexttools.h 2007-01-24 12:38:54 UTC (rev 242) @@ -8,12 +8,13 @@ { Q_OBJECT +public slots: + void pure2DMode(bool flag=0); + void setZPlaneMax(int max); + void showZPlaneOnly(bool flag=0); public: View2DTextTools(QWidget *parent = 0); ~View2DTextTools(); - void Pure2DMode(bool flag=0); - void setZPlaneMax(int max); - void showZplaneOnly(bool flag=0); private: Ui::View2DTextToolsClass ui; Modified: trunk/qcell/baseheaders/view2dtexttools.ui =================================================================== --- trunk/qcell/baseheaders/view2dtexttools.ui 2007-01-23 21:41:37 UTC (rev 241) +++ trunk/qcell/baseheaders/view2dtexttools.ui 2007-01-24 12:38:54 UTC (rev 242) @@ -5,100 +5,111 @@ <rect> <x>0</x> <y>0</y> - <width>115</width> - <height>157</height> + <width>119</width> + <height>222</height> </rect> </property> <property name="windowTitle" > <string>View2DTextTools</string> </property> - <widget class="QGroupBox" name="ZPlaneGroup" > - <property name="geometry" > - <rect> - <x>1</x> - <y>100</y> - <width>113</width> - <height>51</height> - </rect> + <layout class="QVBoxLayout" > + <property name="margin" > + <number>9</number> </property> - <property name="title" > - <string>Z Plane</string> + <property name="spacing" > + <number>6</number> </property> - <widget class="QSpinBox" name="Zplane" > - <property name="geometry" > - <rect> - <x>10</x> - <y>20</y> - <width>91</width> - <height>22</height> - </rect> - </property> - </widget> - </widget> - <widget class="QGroupBox" name="View2DGroup" > - <property name="geometry" > - <rect> - <x>1</x> - <y>1</y> - <width>113</width> - <height>91</height> - </rect> - </property> - <property name="title" > - <string>View 2D Text</string> - </property> - <widget class="QToolButton" name="ColorsButton" > - <property name="geometry" > - <rect> - <x>10</x> - <y>20</y> - <width>91</width> - <height>20</height> - </rect> - </property> - <property name="text" > - <string>Colors</string> - </property> - <property name="checkable" > - <bool>true</bool> - </property> - </widget> - <widget class="QToolButton" name="ValuesButton" > - <property name="geometry" > - <rect> - <x>10</x> - <y>40</y> - <width>91</width> - <height>20</height> - </rect> - </property> - <property name="text" > - <string>Values</string> - </property> - <property name="checkable" > - <bool>true</bool> - </property> - <property name="checked" > - <bool>true</bool> - </property> - </widget> - <widget class="QToolButton" name="SymbolsButton" > - <property name="geometry" > - <rect> - <x>10</x> - <y>60</y> - <width>91</width> - <height>20</height> - </rect> - </property> - <property name="text" > - <string>Symbols</string> - </property> - <property name="checkable" > - <bool>true</bool> - </property> - </widget> - </widget> + <item> + <widget class="QGroupBox" name="View2DGroup" > + <property name="title" > + <string>View 2D Text</string> + </property> + <layout class="QVBoxLayout" > + <property name="margin" > + <number>9</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QToolButton" name="ColorsButton" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>Colors</string> + </property> + <property name="checkable" > + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="ValuesButton" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>Values</string> + </property> + <property name="checkable" > + <bool>true</bool> + </property> + <property name="checked" > + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="SymbolsButton" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>Symbols</string> + </property> + <property name="checkable" > + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="ZPlaneGroup" > + <property name="title" > + <string>Z Plane</string> + </property> + <layout class="QVBoxLayout" > + <property name="margin" > + <number>9</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QSpinBox" name="Zplane" /> + </item> + </layout> + </widget> + </item> + </layout> </widget> <layoutdefault spacing="6" margin="11" /> <resources/> Modified: trunk/qcell/baseheaders/view3dtools.h =================================================================== --- trunk/qcell/baseheaders/view3dtools.h 2007-01-23 21:41:37 UTC (rev 241) +++ trunk/qcell/baseheaders/view3dtools.h 2007-01-24 12:38:54 UTC (rev 242) @@ -11,7 +11,6 @@ public: View3DTools(QWidget *parent = 0); ~View3DTools(); - void setRange(int x, int y, int z); private: Ui::View3DToolsClass ui; @@ -31,6 +30,8 @@ signals: void ViewModeUpdated(int mode); void maskSet(int x, int y, int z); +public slots: + void setRange(int x, int y, int z); }; #endif // VIEW3DTOOLS_H Modified: trunk/qcell/baseheaders/view3dtools.ui =================================================================== --- trunk/qcell/baseheaders/view3dtools.ui 2007-01-23 21:41:37 UTC (rev 241) +++ trunk/qcell/baseheaders/view3dtools.ui 2007-01-24 12:38:54 UTC (rev 242) @@ -5,151 +5,168 @@ <rect> <x>0</x> <y>0</y> - <width>115</width> - <height>205</height> + <width>136</width> + <height>321</height> </rect> </property> <property name="windowTitle" > <string>View3DTools</string> </property> - <widget class="QGroupBox" name="ViewsTools" > - <property name="geometry" > - <rect> - <x>1</x> - <y>1</y> - <width>113</width> - <height>71</height> - </rect> + <layout class="QVBoxLayout" > + <property name="margin" > + <number>9</number> </property> - <property name="title" > - <string>View 3D</string> + <property name="spacing" > + <number>6</number> </property> - <widget class="QToolButton" name="PerspectiveButton" > - <property name="geometry" > - <rect> - <x>10</x> - <y>20</y> - <width>91</width> - <height>20</height> - </rect> - </property> - <property name="text" > - <string>Perspective</string> - </property> - <property name="checkable" > - <bool>true</bool> - </property> - <property name="checked" > - <bool>true</bool> - </property> - </widget> - <widget class="QToolButton" name="OrthoButton" > - <property name="geometry" > - <rect> - <x>10</x> - <y>40</y> - <width>91</width> - <height>20</height> - </rect> - </property> - <property name="text" > - <string>Ortho</string> - </property> - <property name="checkable" > - <bool>true</bool> - </property> - </widget> - </widget> - <widget class="QGroupBox" name="SectionGroup" > - <property name="geometry" > - <rect> - <x>1</x> - <y>70</y> - <width>113</width> - <height>131</height> - </rect> - </property> - <property name="title" > - <string>Section</string> - </property> - <widget class="QToolButton" name="EnableButton" > - <property name="geometry" > - <rect> - <x>10</x> - <y>20</y> - <width>91</width> - <height>20</height> - </rect> - </property> - <property name="text" > - <string>Enable</string> - </property> - <property name="checkable" > - <bool>true</bool> - </property> - </widget> - <widget class="QToolButton" name="xyButton" > - <property name="geometry" > - <rect> - <x>10</x> - <y>40</y> - <width>91</width> - <height>20</height> - </rect> - </property> - <property name="text" > - <string>xy</string> - </property> - <property name="checkable" > - <bool>true</bool> - </property> - <property name="checked" > - <bool>true</bool> - </property> - </widget> - <widget class="QToolButton" name="zyButton" > - <property name="geometry" > - <rect> - <x>10</x> - <y>60</y> - <width>91</width> - <height>20</height> - </rect> - </property> - <property name="text" > - <string>zy</string> - </property> - <property name="checkable" > - <bool>true</bool> - </property> - </widget> - <widget class="QToolButton" name="xzButton" > - <property name="geometry" > - <rect> - <x>10</x> - <y>80</y> - <width>91</width> - <height>20</height> - </rect> - </property> - <property name="text" > - <string>xz</string> - </property> - <property name="checkable" > - <bool>true</bool> - </property> - </widget> - <widget class="QSpinBox" name="maskValue" > - <property name="geometry" > - <rect> - <x>10</x> - <y>100</y> - <width>91</width> - <height>22</height> - </rect> - </property> - </widget> - </widget> + <item> + <widget class="QGroupBox" name="ViewsTools" > + <property name="title" > + <string>View 3D</string> + </property> + <layout class="QVBoxLayout" > + <property name="margin" > + <number>9</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QToolButton" name="PerspectiveButton" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>Perspective</string> + </property> + <property name="checkable" > + <bool>true</bool> + </property> + <property name="checked" > + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="OrthoButton" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>Ortho</string> + </property> + <property name="checkable" > + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="SectionGroup" > + <property name="title" > + <string>Section</string> + </property> + <layout class="QVBoxLayout" > + <property name="margin" > + <number>9</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QToolButton" name="EnableButton" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>Enable</string> + </property> + <property name="checkable" > + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="xyButton" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>xy</string> + </property> + <property name="checkable" > + <bool>true</bool> + </property> + <property name="checked" > + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="zyButton" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>zy</string> + </property> + <property name="checkable" > + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="xzButton" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>xz</string> + </property> + <property name="checkable" > + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="maskValue" /> + </item> + </layout> + </widget> + </item> + </layout> </widget> <layoutdefault spacing="6" margin="11" /> <resources/> Modified: trunk/qcell/basesources/basetools.cpp =================================================================== --- trunk/qcell/basesources/basetools.cpp 2007-01-23 21:41:37 UTC (rev 241) +++ trunk/qcell/basesources/basetools.cpp 2007-01-24 12:38:54 UTC (rev 242) @@ -4,6 +4,9 @@ : QWidget(parent) { ui.setupUi(this); + ui.valueTable->resizeColumnsToContents(); + ui.valueTable->resizeRowsToContents(); +// ui.valueTable->adjustSize(); editMode = 0; connect(ui.CopyButton, SIGNAL(clicked(bool)), SLOT(commandCopy())); connect(ui.PasteButton, SIGNAL(clicked(bool)), SLOT(commandPaste())); @@ -57,7 +60,7 @@ ui.LocalViewButton->setChecked(0); ui.EditModeGroup->show(); ui.EditToolsGroup->show(); - ui.ValuesGroup->show(); +// ui.ValuesGroup->show(); if(editMode!=2) { editMode=2; @@ -81,7 +84,7 @@ ui.LocalViewButton->setChecked(1); ui.EditModeGroup->hide(); ui.EditToolsGroup->hide(); - ui.ValuesGroup->hide(); +// ui.ValuesGroup->hide(); if(editMode!=3) { editMode=3; @@ -114,3 +117,13 @@ setEnabled(true); } +void BaseTools::setRowCount(int count) +{ + ui.valueTable->setRowCount(count); +} + +void BaseTools::setItem(int row, int column, QTableWidgetItem* item) +{ + ui.valueTable->setItem(row, column, item); +} + Modified: trunk/qcell/basesources/simulationwindow.cpp =================================================================== --- trunk/qcell/basesources/simulationwindow.cpp 2007-01-23 21:41:37 UTC (rev 241) +++ trunk/qcell/basesources/simulationwindow.cpp 2007-01-24 12:38:54 UTC (rev 242) @@ -1,4 +1,5 @@ #include "../baseheaders/simulationwindow.h" +#include <QDebug> void simulationWindow::mouseMoveEvent(QMouseEvent * event) { @@ -75,103 +76,121 @@ void simulationWindow::resizeEvent(QResizeEvent * event) { +// +// ui.tabWidget->resize(width() - 140, height() - 10); +// ui.view1D->resize(ui.tabWidget->width(), ui.tabWidget->height() - 20); +// ui.view2D->resize(ui.tabWidget->width(), ui.tabWidget->height() - 20); +// ui.view3D->resize(ui.tabWidget->width(), ui.tabWidget->height() - 20); +// ui.view2DGraph->resize(ui.tabWidget->width(), ui.tabWidget->height() - 20); +// ui.symbolConfig->resize(ui.tabWidget->width(), ui.tabWidget->height() - 20); +// ui.functionTab->resize(ui.tabWidget->width(), ui.tabWidget->height() - 20); +// +// renderer->move(1, 1); +// renderer->resize(ui.view3D->width() - 1, ui.view3D->height() - 1); +// +// table2D->move(1, 1); +// table2D->resize(ui.view2D->width() - 10 , ui.view2D->height() - 10); +// graphicsView2D->resize(ui.view2DGraph->width() - 7, ui.view2DGraph->height() - 7); +// +// table1D->move(1, 1); +// table1D->resize(ui.view1D->width() - 10, 75); +// +// table1DMem->move(0, 100); +// table1DMem->resize(ui.view1D->width() - 7, ui.view1D->height() - 157); +// +// symbolTable->move(0, 35); +// symbolTable->resize(ui.symbolConfig->width() - 7, ui.symbolConfig->height() -42); - ui.tabWidget->resize(width() - 140, height() - 10); - ui.view1D->resize(ui.tabWidget->width(), ui.tabWidget->height() - 20); - ui.view2D->resize(ui.tabWidget->width(), ui.tabWidget->height() - 20); - ui.view3D->resize(ui.tabWidget->width(), ui.tabWidget->height() - 20); - ui.view2DGraph->resize(ui.tabWidget->width(), ui.tabWidget->height() - 20); - ui.symbolConfig->resize(ui.tabWidget->width(), ui.tabWidget->height() - 20); - ui.functionTab->resize(ui.tabWidget->width(), ui.tabWidget->height() - 20); - - renderer->move(1, 1); - renderer->resize(ui.view3D->width() - 1, ui.view3D->height() - 1); - - table2D->move(1, 1); - table2D->resize(ui.view2D->width() - 10 , ui.view2D->height() - 10); - graphicsView2D->resize(ui.view2DGraph->width() - 7, ui.view2DGraph->height() - 7); - - table1D->move(1, 1); - table1D->resize(ui.view1D->width() - 10, 75); - - table1DMem->move(0, 100); - table1DMem->resize(ui.view1D->width() - 7, ui.view1D->height() - 157); - - symbolTable->move(0, 35); - symbolTable->resize(ui.symbolConfig->width() - 7, ui.symbolConfig->height() -42); - // basetools->move(width() - 116, 0); // view3DTools->move(width() - 116, basetools->height() + 1); // view2DTextTools->move(width() - 116, basetools->height() + 1); // view1DTextTools->move(width() - 116, basetools->height() + 1); - ft->resize(ui.functionTab->width() - 10 , ui.functionTab->height() - 10); +// ft->resize(ui.functionTab->width() - 10 , ui.functionTab->height() - 10); } void simulationWindow::paintEvent(QPaintEvent * event) { - if(ui.view3D->isVisible()) - { - view3DTools->show(); - } - else - view3DTools->hide(); + // This is VERY bad, as is checked every repaint (veeery often) + // Moved to tabChanged slot +// if(ui.view3D->isVisible()) +// { +// emit set3DToolsVisible(true); +// } +// else +// { +// emit set3DToolsVisible(false); +// } - if(ui.view2D->isVisible()) - { - view2DTextTools->show(); - view2DTextTools->showZplaneOnly(0); - if(table2DUpdateRequest>0) - { - if(table2DUpdateRequest==1) - update2DTable(); - else - update2DTable(1); - table2DUpdateRequest = 0; - } - } - else - { - if(!ui.view2DGraph->isVisible()) - view2DTextTools->hide(); - } + // Same as above + // Moved to tabChanged (with additional functionality) +// if(ui.view2D->isVisible()) +// { +// emit set2DTextToolsVisible(true); +//// view2DTextTools->show(); +// emit showZPlaneOnly(false); +//// view2DTextTools->showZplaneOnly(0); +// if(table2DUpdateRequest>0) +// { +// if(table2DUpdateRequest==1) +// update2DTable(); +// else +// update2DTable(1); +// table2DUpdateRequest = 0; +// } +// } +// else +// { +// if(!ui.view2DGraph->isVisible()) +// emit set2DTextToolsVisible(false); +//// view2DTextTools->hide(); +// } - if(ui.view2DGraph->isVisible()) - { - view2DTextTools->show(); - view2DTextTools->showZplaneOnly(1); - if(graph2DUpdateRequest) - { - update2DGraph(); - graph2DUpdateRequest = 0; - } - } - else - { - if(!ui.view2D->isVisible()) - view2DTextTools->hide(); - } + // Moved with functionality to tabChanged +// if(ui.view2DGraph->isVisible()) +// { +// emit set2DTextToolsVisible(true); +//// view2DTextTools->show(); +// emit showZPlaneOnly(true); +//// view2DTextTools->showZplaneOnly(1); +// if(graph2DUpdateRequest) +// { +// update2DGraph(); +// graph2DUpdateRequest = 0; +// } +// } +// else +// { +// if(!ui.view2D->isVisible()) +// emit set2DTextToolsVisible(false); +//// view2DTextTools->hide(); +// } - if(ui.view1D->isVisible()) - { - view1DTextTools->show(); - if(table1DUpdateRequest) - { - if(table1DUpdateRequest==1) - update1DTable(); - else - update1DTable(1); - table1DUpdateRequest = 0; - } - } - else - view1DTextTools->hide(); +// if(ui.view1D->isVisible()) +// { +// emit set1DTextToolsVisible(true); +//// view1DTextTools->show(); +// if(table1DUpdateRequest) +// { +// if(table1DUpdateRequest==1) +// update1DTable(); +// else +// update1DTable(1); +// table1DUpdateRequest = 0; +// } +// } +// else +// emit set1DTextToolsVisible(false); +//// view1DTextTools->hide(); - if(ui.symbolConfig->isVisible()) - { - updateSymbolTable(); - } + // I fear to think about what would happen to speed + // when the symbol table would grow a little + // Moved to tabChanged +// if(ui.symbolConfig->isVisible()) +// { +// updateSymbolTable(); +// } } void simulationWindow::localViewReinterprete(void) @@ -498,8 +517,9 @@ { symbolTable->setRowCount(renderer->getSymbolCount()); - basetools->getValueTablePointer()->setRowCount(renderer->getSymbolCount()); - basetools->getValueTablePointer()->setColumnWidth(0, 53); + emit setRowCount(renderer->getSymbolCount()); +// basetools->getValueTablePointer()->setRowCount(renderer->getSymbolCount()); +// basetools->getValueTablePointer()->setColumnWidth(0, 53); for(int i=0;i<symbolTable->rowCount();++i) { @@ -512,7 +532,8 @@ item = new QTableWidgetItem(*item); item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); - basetools->getValueTablePointer()->setItem(i, 0, item); + emit setItem(i, 0, item); +// basetools->getValueTablePointer()->setItem(i, 0, item); item = new QTableWidgetItem; item->setTextAlignment(Qt::AlignCenter); @@ -580,11 +601,19 @@ z_plane = 0; zoom = 1.0; ui.setupUi(this); + last_tab_index = 0; + connect(ui.tabWidget, SIGNAL(currentChanged(int)), + this, SLOT(tabChanged(int)) + ); + ui.view3D->setLayout(new QVBoxLayout(ui.view3D)); renderer = new Renderer(ui.view3D); - renderer->resize(ui.view3D->width(), ui.view3D->height()); + ui.view3D->layout()->addWidget(renderer); +// renderer->resize(ui.view3D->width(), ui.view3D->height()); + ui.view2DGraph->setLayout(new QVBoxLayout(ui.view2DGraph)); graphicsView2D = new QGraphicsView(ui.view2DGraph); + ui.view2DGraph->layout()->addWidget(graphicsView2D); graphicsScene2D = new QGraphicsScene; pixmap = new QPixmap(0, 0); @@ -592,12 +621,14 @@ graphicsScene2DPixmap = graphicsScene2D->addPixmap(*pixmap); graphicsScene2DPixmap->setFlag(QGraphicsItem::ItemIsMovable); graphicsView2D->setScene(graphicsScene2D); - + ui.view1D->setLayout(new QVBoxLayout(ui.view1D)); table1D = new QTableWidget(ui.view1D); + ui.view1D->layout()->addWidget(table1D); table1D->setRowCount(1); table1DMem = new QTableWidget(ui.view1D); + ui.view1D->layout()->addWidget(table1DMem); symbolTable = new QTableWidget(ui.symbolConfig); ui.symbolConfig->layout()->addWidget(symbolTable); @@ -608,7 +639,9 @@ symbolTable->setHorizontalHeaderItem(3, new QTableWidgetItem(tr("Model"))); symbolTable->setHorizontalHeaderItem(4, new QTableWidgetItem(tr("Hide Flag"))); + ui.view2D->setLayout(new QVBoxLayout(ui.view2D)); table2D = new QTableWidget(ui.view2D); + ui.view2D->layout()->addWidget(table2D); bool ret = connect(renderer->getStorage(), SIGNAL(dataUpdated()), SLOT(dataUpdateRequest())); @@ -626,47 +659,43 @@ table2DUpdateRequest = 0; table1DUpdateRequest = 0; - basetools = new BaseTools(parent); - basetools->getValueTablePointer()->setColumnCount(1); - basetools->getValueTablePointer()->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Value"))); + // Done in Designer. Widget set up in MainWindow, as it should be +// basetools = new BaseTools(parent); +// basetools->getValueTablePointer()->setColumnCount(1); +// basetools->getValueTablePointer()->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Value"))); - // Let's make that basic tools widget into QDockWidget - QDockWidget* dw = new QDockWidget(parent); - dw->setWidget(basetools); -// dw->hide(); - dw->setWindowTitle(tr("Base tools")); - ((MainWindow*)parent)->addDockWidget(Qt::RightDockWidgetArea, dw); - - // Let's make it accessible from the `View' menu - QAction* bt_action = dw->toggleViewAction(); - bt_action->setText("&" + dw->windowTitle()); - ((Ui_MainWindow*)parent)->menu_View->addAction(bt_action); - selectedSymbol = 0; workMode = 0; connect(table2D, SIGNAL(cellClicked(int, int)), SLOT(GridView2DEdit(int, int))); connect(table1D, SIGNAL(cellClicked(int, int)), SLOT(GridView1DEdit(int, int))); - connect(basetools, SIGNAL(toolsModeUpdate(int)), SLOT(workModeChange(int))); - connect(basetools, SIGNAL(symbolSelected(int)), SLOT(selectSymbol(int))); + // Connects moved to MainWindow +// connect(basetools, SIGNAL(toolsModeUpdate(int)), SLOT(workModeChange(int))); +// connect(basetools, SIGNAL(symbolSelected(int)), SLOT(selectSymbol(int))); - view3DTools = new View3DTools(this); - connect(view3DTools, SIGNAL(ViewModeUpdated(int)), SLOT(perspectiveUpdate(int))); +// // Widget creation moved to MainWindow +// view3DTools = new View3DTools(this); +// connect(view3DTools, SIGNAL(ViewModeUpdated(int)), SLOT(perspectiveUpdate(int))); view2DTextInterpretationMode = 0; - view2DTextTools = new View2DTextTools(this); + // Widget creation moved to MainWindow +// view2DTextTools = new View2DTextTools(this); - connect(view2DTextTools, SIGNAL(newZPlaneSet(int)), SLOT(zPlaneChange(int))); - connect(view2DTextTools, SIGNAL(viewModeChenged(int)), SLOT(GrigView2DInterpretationMode(int))); +// // Moved to MainWindow +// connect(view2DTextTools, SIGNAL(newZPlaneSet(int)), SLOT(zPlaneChange(int))); +// connect(view2DTextTools, SIGNAL(viewModeChenged(int)), SLOT(GrigView2DInterpretationMode(int))); view1DTextInterpretationMode = 0; - view1DTextTools = new View1DTextTools(this); + // Widget moved to MainWindow +// view1DTextTools = new View1DTextTools(this); - connect(view1DTextTools, SIGNAL(viewModeChenged(int)), SLOT(GrigView1DInterpretationMode(int))); - connect(view1DTextTools, SIGNAL(memoryClear()), SLOT(GridView1DMemClear())); + // Moved to MainWindow +// connect(view1DTextTools, SIGNAL(viewModeChenged(int)), SLOT(GrigView1DInterpretationMode(int))); +// connect(view1DTextTools, SIGNAL(memoryClear()), SLOT(GridView1DMemClear())); - connect(basetools, SIGNAL(command(int)), SLOT(commandExecute(int))); + // Moved to MainWindow +// connect(basetools, SIGNAL(command(int)), SLOT(commandExecute(int))); localObserverPosition.resize(3); maxTime = 0; @@ -677,7 +706,8 @@ connect(renderer, SIGNAL(objectSelected(int, int, int)), SLOT(view3DselectedObject(int, int, int))); storeCurentTable = NULL; - connect(view3DTools, SIGNAL(maskSet(int, int, int)), SLOT(maskChange(int, int, int))); + // Moved to MainWindow +// connect(view3DTools, SIGNAL(maskSet(int, int, int)), SLOT(maskChange(int, int, int))); ui.tabWidget->setTabEnabled(0, 0); ui.tabWidget->setTabEnabled(1, 0); @@ -686,7 +716,9 @@ ui.tabWidget->setTabEnabled(5, 0); // for test only + ui.functionTab->setLayout(new QVBoxLayout(ui.functionTab)); ft = new FunctionTable(ui.functionTab); + ui.functionTab->layout()->addWidget(ft); } simulationWindow::~simulationWindow() @@ -812,8 +844,10 @@ ui.tabWidget->setTabEnabled(3, 0); table2DUpdateRequest = 2; graph2DUpdateRequest = 1; - view2DTextTools->setZPlaneMax(0); - view2DTextTools->Pure2DMode(1); + emit setZPlaneMax(0); +// view2DTextTools->setZPlaneMax(0); + emit pure2DMode(true); +// view2DTextTools->Pure2DMode(1); maxTime = sqrt((float)(getStorage()->getSizeX() * getStorage()->getSizeX()) + (float)(getStorage()->getSizeY() * getStorage()->getSizeY())); //maxTime = max(getStorage()->getSizeX(), getStorage()->getSizeY()) + 1; loclaViewMemory.resize(maxTime); @@ -827,8 +861,10 @@ ui.tabWidget->setTabEnabled(3, 0); table2DUpdateRequest = 2; graph2DUpdateRequest = 1; - view2DTextTools->setZPlaneMax(getStorage()->getSizeZ()-1); - view2DTextTools->Pure2DMode(0); + emit setZPlaneMax(getStorage()->getSizeZ()-1); +// view2DTextTools->setZPlaneMax(getStorage()->getSizeZ()-1); + emit pure2DMode(false); +// view2DTextTools->Pure2DMode(0); maxTime = sqrt((float)(getStorage()->getSizeX() * getStorage()->getSizeX()) + (float)(getStorage()->getSizeY() * getStorage()->getSizeY()) + (float)(getStorage()->getSizeZ() * getStorage()->getSizeZ())); //maxTime = max(getStorage()->getSizeZ(), max(getStorage()->getSizeX(), getStorage()->getSizeY())) + 1; loclaViewMemory.resize(maxTime); @@ -850,7 +886,7 @@ getStorage()->setForeignDataPointer(localView.getDataPointer(), 1); } - view3DTools->setRange(getStorage()->getSizeX()-1, getStorage()->getSizeY()-1, getStorage()->getSizeZ()-1); + emit set3DToolsRange(getStorage()->getSizeX()-1, getStorage()->getSizeY()-1, getStorage()->getSizeZ()-1); //**************************************************** repaint(); @@ -1389,9 +1425,94 @@ void simulationWindow::unlockGUI() { - basetools->unlockGUI(); +// basetools->unlockGUI(); ui.tabWidget->setTabEnabled(5, true); ui.functionTab->setEnabled(true); ft->unlockGUI(); } +void simulationWindow::tabChanged(int index) +{ + switch (last_tab_index) + { + case 0: + { + emit set3DToolsVisible(false); + break; + } + case 1: + { + emit set2DTextToolsVisible(false); + break; + } + case 2: + { + emit set2DTextToolsVisible(false); + break; + } + case 3: + { + emit set1DTextToolsVisible(false); + break; + } + } + + switch (index) + { + case 0: + { + emit set3DToolsVisible(true); + break; + } + case 1: + { + emit set2DTextToolsVisible(true); + emit showZPlaneOnly(false); + if(table2DUpdateRequest>0) + { + if(table2DUpdateRequest==1) + update2DTable(); + else + update2DTable(1); + table2DUpdateRequest = 0; + } + break; + } + case 2: + { + emit set2DTextToolsVisible(true); + emit showZPlaneOnly(true); + + if(graph2DUpdateRequest) + { + update2DGraph(); + graph2DUpdateRequest = 0; + } + break; + } + case 3: + { + emit set1DTextToolsVisible(true); + if(table1DUpdateRequest) + { + if(table1DUpdateRequest==1) + update1DTable(); + else + update1DTable(1); + table1DUpdateRequest = 0; + } + break; + } + case 4: + { + if(ui.symbolConfig->isVisible()) + { + updateSymbolTable(); + } + break; + } + } + + last_tab_index = index; +} + Modified: trunk/qcell/basesources/view2dtexttools.cpp =================================================================== --- trunk/qcell/basesources/view2dtexttools.cpp 2007-01-23 21:41:37 UTC (rev 241) +++ trunk/qcell/basesources/view2dtexttools.cpp 2007-01-24 12:38:54 UTC (rev 242) @@ -18,7 +18,7 @@ { } -void View2DTextTools::Pure2DMode(bool flag) +void View2DTextTools::pure2DMode(bool flag) { if(!flag) ui.ZPlaneGroup->show(); @@ -31,7 +31,7 @@ ui.Zplane->setRange(0, max); } -void View2DTextTools::showZplaneOnly(bool flag) +void View2DTextTools::showZPlaneOnly(bool flag) { if(!flag) ui.View2DGroup->show(); Modified: trunk/qcell/visgui/MainWindow.cpp =================================================================== --- trunk/qcell/visgui/MainWindow.cpp 2007-01-23 21:41:37 UTC (rev 241) +++ trunk/qcell/visgui/MainWindow.cpp 2007-01-24 12:38:54 UTC (rev 242) @@ -20,40 +20,141 @@ sw, SLOT(unlockGUI()) ); +// QDockWidget* dw = new QDockWidget(this); +// BaseTools* basetools = new BaseTools(dw); +// dw->setWidget(basetools); +// dw->setWindowTitle(tr("Base tools")); +// ((QVBoxLayout*)dw->layout())->addStretch(); +// addDockWidget(Qt::RightDockWidgetArea, dw); +// +// // Let's make it accessible from the `View' menu +// QAction* bt_action = dw->toggleViewAction(); +// bt_action->setText("&" + dw->windowTitle()); +// menu_View->addAction(bt_action); +// +// connect(basetools, SIGNAL(toolsModeUpdate(int)), +// sw, SLOT(workModeChange(int)) +// ); +// connect(basetools, SIGNAL(symbolSelected(int)), +// sw, SLOT(selectSymbol(int)) +// ); +// connect(basetools, SIGNAL(command(int)), +// sw, SLOT(commandExecute(int)) +// ); +// connect(sw, SIGNAL(setRowCount(int)), +// basetools, SLOT(setRowCount(int)) +// ); +// connect(sw, SIGNAL(setItem(int, int, QTableWidgetItem*)), +// basetools, SLOT(setItem(int, int, QTableWidgetItem*)) +// ); + + // View 3D Tools + QDockWidget* dw = new QDockWidget(this); + dw->hide(); + View3DTools* view3DTools = new View3DTools(this); + dw->setWindowTitle(tr("3D Tools")); + dw->setWidget(view3DTools); + ((QVBoxLayout*)dw->layout())->addStretch(); + addDockWidget(Qt::RightDockWidgetArea, dw); + + QAction* v3d_action = dw->toggleViewAction(); + v3d_action->setText(tr("&3D Tools")); + menu_View->addAction(v3d_action); + + connect(view3DTools, SIGNAL(ViewModeUpdated(int)), + sw, SLOT(perspectiveUpdate(int))); + connect(view3DTools, SIGNAL(maskSet(int, int, int)), + sw, SLOT(maskChange(int, int, int))); + connect(sw, SIGNAL(set3DToolsRange(int, int, int)), + view3DTools, SLOT(setRange(int, int, int)) + ); + connect(sw, SIGNAL(set3DToolsVisible(bool)), + dw, SLOT(setVisible(bool)) + ); + + // View 2D Tools + dw = new QDockWidget(this); + dw->hide(); + View2DTextTools* view2DTextTools = new View2DTextTools(this); + dw->setWindowTitle(tr("2D Text Tools")); + dw->setWidget(view2DTextTools); + ((QVBoxLayout*)dw->layout())->addStretch(); + addDockWidget(Qt::RightDockWidgetArea, dw); + + QAction* v2d_action = dw->toggleViewAction(); + v2d_action->setText(tr("&2D Text Tools")); + menu_View->addAction(v2d_action); + + connect(view2DTextTools, SIGNAL(newZPlaneSet(int)), + sw, SLOT(zPlaneChange(int))); + connect(view2DTextTools, SIGNAL(viewModeChenged(int)), + sw, SLOT(GrigView2DInterpretationMode(int))); + connect(sw, SIGNAL(setZPlaneMax(int)), + view2DTextTools, SLOT(setZPlaneMax(int)) + ); + connect(sw, SIGNAL(pure2DMode(bool)), + view2DTextTools, SLOT(pure2DMode(bool)) + ); + connect(sw, SIGNAL(showZPlaneOnly(bool)), + view2DTextTools, SLOT(showZPlaneOnly(bool)) + ); + connect(sw, SIGNAL(set2DTextToolsVisible(bool)), + dw, SLOT(setVisible(bool)) + ); + + // View 1D Tools + dw = new QDockWidget(this); + dw->hide(); + View1DTextTools* view1DTextTools = new View1DTextTools(this); + dw->setWindowTitle(tr("1D Text Tools")); + dw->setWidget(view1DTextTools); + ((QVBoxLayout*)dw->layout())->addStretch(); + addDockWidget(Qt::RightDockWidgetArea, dw); + + QAction* v1d_action = dw->toggleViewAction(); + v1d_action->setText(tr("1D Text Tools")); + menu_View->addAction(v1d_action); + + connect(view1DTextTools, SIGNAL(viewModeChenged(int)), + sw, SLOT(GrigView1DInterpretationMode(int)) + ); + connect(view1DTextTools, SIGNAL(memoryClear()), + sw, SLOT(GridView1DMemClear()) + ); + connect(sw, SIGNAL(set1DTextToolsVisible(bool)), + dw, SLOT(setVisible(bool)) + ); + // Adding delay setup // An interlinked pair of QDoubleSpinBox and a QSlider - delaySlider = new QSlider(Qt::Horizontal); - delaySlider->setStatusTip(tr("Sets the delay between iteration steps in ms.")); - delaySlider->setFixedWidth(100); - delaySpinBox = new QDoubleSpinBox(); - delaySpinBox->setStatusTip(delaySlider->statusTip()); - delaySpinBox->setMinimum(MIN_DELAY); - delaySpinBox->setMaximum(MAX_DELAY); - delaySpinBox->setSingleStep(DELAY_STEP); - QLabel* tmp_label = new QLabel(tr("Delay")); - tmp_label->setStatusTip(delaySlider->statusTip()); - statusBar()->addPermanentWidget(tmp_label); - statusBar()->addPermanentWidget(delaySlider); - statusBar()->addPermanentWidget(delaySpinBox); +// delaySlider = new QSlider(Qt::Horizontal); +// delaySlider->setStatusTip(tr("Sets the delay between iteration steps in ms.")); +// delaySlider->setFixedWidth(100); +// delaySpinBox = new QDoubleSpinBox(); +// delaySpinBox->setStatusTip(delaySlider->statusTip()); +// delaySpinBox->setMinimum(MIN_DELAY); +// delaySpinBox->setMaximum(MAX_DELAY); +// delaySpinBox->setSingleStep(DELAY_STEP); +// tmp_label->setStatusTip(delaySlider->statusTip()); +// statusBar()->addPermanentWidget(tmp_label); +// statusBar()->addPermanentWidget(delaySlider); +// statusBar()->addPermanentWidget(delaySpinBox); // statusBar()->addPermanentWidget(new QLabel("ms")); - /// @todo I won't make it in time, so commenting this out - delaySlider->hide(); - delaySpinBox->hide(); - tmp_label->hide(); - // Interconnect both widgets - change in one will change the other as well - connect(delaySlider, SIGNAL(valueChanged(int)), - SLOT(sliderChanged(int)) - ); - connect(delaySpinBox, SIGNAL(valueChanged(double)), - this, SLOT(spinBoxChanged(double))); +// // Interconnect both widgets - change in one will change the other as well +// connect(delaySlider, SIGNAL(valueChanged(int)), +// SLOT(sliderChanged(int)) +// ); +// connect(delaySpinBox, SIGNAL(valueChanged(double)), +// this, SLOT(spinBoxChanged(double))); // Adding iteration counter // Creating LCD counter iterationLCD = new QLCDNumber(); iterationLCD->setSegmentStyle(QLCDNumber::Flat); iterationLCD->setStatusTip(tr("Shows the current iteration number.")); + QLabel* tmp_label = new QLabel(tr("Delay")); tmp_label = new QLabel(tr("Iteration")); tmp_label->setBuddy(iterationLCD); tmp_label->setStatusTip(iterationLCD->statusTip()); Modified: trunk/qcell/visgui/MainWindow.h =================================================================== --- trunk/qcell/visgui/MainWindow.h 2007-01-23 21:41:37 UTC (rev 241) +++ trunk/qcell/visgui/MainWindow.h 2007-01-24 12:38:54 UTC (rev 242) @@ -16,6 +16,10 @@ #include "ElementalRules.h" #include "NewWorldWizard.h" #include "NewNeighbourhoodWizard.h" +#include <view3dtools.h> +#include <view2dtexttools.h> +#include <view1dtexttools.h> +#include <basetools.h> #include <QPluginLoader> #include "GenericParserPlugin.h" #include <QFileDialog> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dhu...@us...> - 2007-01-24 15:12:57
|
Revision: 247 http://svn.sourceforge.net/qcell/?rev=247&view=rev Author: dhubleizh Date: 2007-01-24 07:12:54 -0800 (Wed, 24 Jan 2007) Log Message: ----------- - removed pending debug from basetools - tabified dock widgets, to see antyhing clearly there Modified Paths: -------------- trunk/qcell/basesources/basetools.cpp trunk/qcell/visgui/MainWindow.cpp trunk/qcell/visgui/MainWindow.h Modified: trunk/qcell/basesources/basetools.cpp =================================================================== --- trunk/qcell/basesources/basetools.cpp 2007-01-24 14:55:44 UTC (rev 246) +++ trunk/qcell/basesources/basetools.cpp 2007-01-24 15:12:54 UTC (rev 247) @@ -125,15 +125,5 @@ void BaseTools::setItem(int row, int column, QTableWidgetItem* item) { ui.valueTable->setItem(row, column, item); - qDebug() << "BaseSize: " << ui.valueTable->baseSize() - << " FrameSize: " << ui.valueTable->frameSize() - << " MaximumSize: " << ui.valueTable->maximumSize() - << " MaximumViewportSize: " << ui.valueTable->maximumViewportSize() - << " MinimumSize: " << ui.valueTable->minimumSize() - << " MinimumSizeHint: " << ui.valueTable->minimumSizeHint() - << " Size: " << ui.valueTable->size() - << " SizeHint: " << ui.valueTable->sizeHint() - << " SizeIncrement: " << ui.valueTable->sizeIncrement() - << " sizePolicy: " << ui.valueTable->sizePolicy(); } Modified: trunk/qcell/visgui/MainWindow.cpp =================================================================== --- trunk/qcell/visgui/MainWindow.cpp 2007-01-24 14:55:44 UTC (rev 246) +++ trunk/qcell/visgui/MainWindow.cpp 2007-01-24 15:12:54 UTC (rev 247) @@ -58,7 +58,8 @@ dock3D->setWidget(view3DTools); ((QVBoxLayout*)dock3D->layout())->addStretch(); dock3D->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); - addDockWidget(Qt::RightDockWidgetArea, dock3D); + tabifyDockWidget(baseDock, dock3D); +// addDockWidget(Qt::RightDockWidgetArea, dock3D); QAction* v3d_action = dock3D->toggleViewAction(); v3d_action->setText(tr("&3D Tools")); @@ -84,7 +85,8 @@ dock2D->setWidget(view2DTextTools); ((QVBoxLayout*)dock2D->layout())->addStretch(); dock2D->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); - addDockWidget(Qt::RightDockWidgetArea, dock2D); +// addDockWidget(Qt::RightDockWidgetArea, dock2D); + tabifyDockWidget(baseDock, dock2D); QAction* v2d_action = dock2D->toggleViewAction(); v2d_action->setText(tr("&2D Text Tools")); @@ -116,7 +118,8 @@ dock1D->setWidget(view1DTextTools); ((QVBoxLayout*)dock1D->layout())->addStretch(); dock1D->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); - addDockWidget(Qt::RightDockWidgetArea, dock1D); +// addDockWidget(Qt::RightDockWidgetArea, dock1D); + tabifyDockWidget(baseDock, dock1D); QAction* v1d_action = dock1D->toggleViewAction(); v1d_action->setText(tr("&1D Text Tools")); @@ -435,7 +438,7 @@ } //*************************************************** - *sw->getNeighbourhoodEditor()->getStorage() = neighbourhood->toCalculationData(); +// *sw->getNeighbourhoodEditor()->getStorage() = neighbourhood->toCalculationData(); sw->getNeighbourhoodEditor()->setTranslation(0.0f, 0.0f, -10.0f); sw->getNeighbourhoodEditor()->setSymbolColor(1, QColor(128, 128, 128)); //*************************************************** Modified: trunk/qcell/visgui/MainWindow.h =================================================================== --- trunk/qcell/visgui/MainWindow.h 2007-01-24 14:55:44 UTC (rev 246) +++ trunk/qcell/visgui/MainWindow.h 2007-01-24 15:12:54 UTC (rev 247) @@ -48,7 +48,6 @@ void unlockGUI(); public: MainWindow(QWidget* parent = 0); - void addDockWidget(Qt::DockWidgetArea area, QDockWidget* dockwidget); private slots: void on_action_About_activated(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |