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. |