From: <dhu...@us...> - 2007-02-16 19:32:49
|
Revision: 334 http://svn.sourceforge.net/qcell/?rev=334&view=rev Author: dhubleizh Date: 2007-02-16 11:32:47 -0800 (Fri, 16 Feb 2007) Log Message: ----------- - automatic symbol table adding and removing Modified Paths: -------------- trunk/qcell/baseheaders/simulationwindow.h trunk/qcell/basesources/Renderer.cpp trunk/qcell/basesources/simulationwindow.cpp trunk/qcell/visgui/MainWindow.cpp Modified: trunk/qcell/baseheaders/simulationwindow.h =================================================================== --- trunk/qcell/baseheaders/simulationwindow.h 2007-02-16 18:13:07 UTC (rev 333) +++ trunk/qcell/baseheaders/simulationwindow.h 2007-02-16 19:32:47 UTC (rev 334) @@ -126,6 +126,7 @@ Ui::simulationWindowClass ui; void back1DTable(); + int getSymbolCount(); protected slots: void zPlaneChange(int i); @@ -140,9 +141,6 @@ void symbolTableChange(int row, int column); void symbolTableColorChange(int row, int column); - void addSymbol(void); - void removeSymbol(void); - void perspectiveUpdate(int mode); void GridView2DEdit(int row, int column); @@ -174,6 +172,8 @@ public slots: void NViewModeChange(int mode); void NViewMaskSet(int maskx, int masky, int maskz); + void addSymbol(void); + void removeSymbol(); }; Modified: trunk/qcell/basesources/Renderer.cpp =================================================================== --- trunk/qcell/basesources/Renderer.cpp 2007-02-16 18:13:07 UTC (rev 333) +++ trunk/qcell/basesources/Renderer.cpp 2007-02-16 19:32:47 UTC (rev 334) @@ -373,13 +373,13 @@ baseSymbols.primitiveID = 0; baseSymbols.textSybmol = '.'; addSymbol(baseSymbols); - setSymbolColor(0, QColor(0,0,0)); + setSymbolColor(0, QColor(255,255,255)); baseSymbols.hide = 0; baseSymbols.primitiveID = 0; baseSymbols.textSybmol = '*'; addSymbol(baseSymbols); - setSymbolColor(1, QColor(255,255,255)); + setSymbolColor(1, QColor(0,0,255)); translation.resize(3); rotation.resize(3); Modified: trunk/qcell/basesources/simulationwindow.cpp =================================================================== --- trunk/qcell/basesources/simulationwindow.cpp 2007-02-16 18:13:07 UTC (rev 333) +++ trunk/qcell/basesources/simulationwindow.cpp 2007-02-16 19:32:47 UTC (rev 334) @@ -1055,7 +1055,20 @@ SYMBOL symbol; symbol.primitiveID = 0; symbol.hide = 0; - symbol.textSybmol = '1'; + int symbol_nr = renderer->getSymbolCount(); + + if (symbol_nr < 10) + { + symbol.textSybmol = QChar((int)'0' + symbol_nr); + } + else if (symbol_nr > 9 && symbol_nr < 'Z'-'A') + { + symbol.textSybmol = QChar((int)'A' + (symbol_nr-10)); + } + else if (symbol_nr > 9 && symbol_nr > (int)('Z'-'A') && symbol_nr < (int)('z'-'a')) + { + symbol.textSybmol = QChar((int)'a' + (symbol_nr - 10)); + } renderer->addSymbol(symbol); renderer->setSymbolColor(renderer->getSymbolCount()-1, QColor(255, 255, 255)); @@ -1669,3 +1682,8 @@ table1DMem->removeRow(table1DMem->rowCount()-1); } +int simulationWindow::getSymbolCount() +{ + return symbolTable->rowCount(); +} + Modified: trunk/qcell/visgui/MainWindow.cpp =================================================================== --- trunk/qcell/visgui/MainWindow.cpp 2007-02-16 18:13:07 UTC (rev 333) +++ trunk/qcell/visgui/MainWindow.cpp 2007-02-16 19:32:47 UTC (rev 334) @@ -1560,6 +1560,26 @@ sw->getFunctionTable()->setFunctionPointer(local_function); //************************************************ + int alph_size = local_function->getAlphabetSize(); + int diff = alph_size - sw->getSymbolCount(); + SYMBOL sym; + if (diff > 0) + { + for (int i = 0; i < diff; i++) + { + sym.textSybmol = QChar(sw->getSymbolCount()+ 1 + i); + sw->addSymbol(); + } + } + else if (diff < 0) + { + diff = abs(diff); + for(int i = 0; i < diff; i++) + { + sw->removeSymbol(); + } + } + // Unlock stuff sw->ui.tabWidget->setTabEnabled(5, 1); sw->ui.functionTab->setEnabled(true); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |