From 82949035572338678d9e9210af5100859d60f273 Mon Sep 17 00:00:00 2001 From: mkr Date: Thu, 20 Jan 2005 10:14:15 +0000 Subject: [PATCH] Correct Thread placing if any node was deleted in Full view. --- src/SUPERVGUI/SUPERVGUI_CanvasArray.cxx | 91 ++++--------------------- src/SUPERVGUI/SUPERVGUI_CanvasArray.h | 2 - 2 files changed, 12 insertions(+), 81 deletions(-) diff --git a/src/SUPERVGUI/SUPERVGUI_CanvasArray.cxx b/src/SUPERVGUI/SUPERVGUI_CanvasArray.cxx index a956534..7e18e79 100644 --- a/src/SUPERVGUI/SUPERVGUI_CanvasArray.cxx +++ b/src/SUPERVGUI/SUPERVGUI_CanvasArray.cxx @@ -14,7 +14,6 @@ using namespace std; #include "SUPERVGUI_CanvasCellNodePrs.h" #include -//#include #define TEXT_MARGIN 5 #define ADDNODES(NodesName,LevelHasDiffNT) \ @@ -65,7 +64,7 @@ using namespace std; cell->show(); \ } \ update(); \ - x += (CELL_WIDTH + CELL_SPACE); \ + if (co < (ncols-1)) x += (CELL_WIDTH + CELL_SPACE); \ } @@ -89,7 +88,6 @@ SUPERVGUI_CanvasArray::SUPERVGUI_CanvasArray(SUPERVGUI_Main* m): if( (!aRed.isEmpty()) && (!aGreen.isEmpty()) && (!aBlue.isEmpty()) ) aColor = QColor(aRed.toInt(), aGreen.toInt(), aBlue.toInt()); setBackgroundColor(aColor); - myOldThreadNum = 0; } SUPERVGUI_CanvasArray::~SUPERVGUI_CanvasArray() { @@ -103,18 +101,7 @@ SUPERVGUI_CanvasArray::~SUPERVGUI_CanvasArray() { ++aIt; delete anObj; } - delete aCellList; - - QObjectList* aCellEndList = queryList("SUPERVGUI_CanvasCellEndNode"); - QObjectListIt aItEnd(*aCellEndList); - QObject* anObjEnd; - while ((anObjEnd = aItEnd.current()) != 0) { - ++aItEnd; - delete anObjEnd; - } - - delete aCellEndList; } void SUPERVGUI_CanvasArray::sync() { @@ -128,15 +115,6 @@ void SUPERVGUI_CanvasArray::sync() { ihmNode->sync(); } delete ihmList; - - SUPERVGUI_CanvasCellEndNode* ihmNodeEnd; - QObjectList* ihmListEnd = queryList("SUPERVGUI_CanvasCellEndNode"); - QObjectListIt itEnd(*ihmListEnd); - while ((ihmNodeEnd=(SUPERVGUI_CanvasCellEndNode*)itEnd.current()) != 0) { - ++itEnd; - ihmNodeEnd->sync(); - } - delete ihmListEnd; } bool SUPERVGUI_CanvasArray::create() { @@ -159,34 +137,12 @@ bool SUPERVGUI_CanvasArray::create() { // there is no any calculations if (ncols == 0) return false; - + QPen pen(Qt::SolidLine); pen.setWidth(1); QBrush br(MAIN_TITLE); - if (myOldThreadNum) { //some of threads allready exist on canvas array - QObjectList* aThreadList = queryList("QCanvasRectangle"); - QObjectListIt aItThread(*aThreadList); - QCanvasRectangle* anObjThread; - while ((anObjThread = (QCanvasRectangle*)aItThread.current()) != 0) { - ++aItThread; - if (!anObjThread->isVisible()) - anObjThread->show(); - } - delete aThreadList; - - QObjectList* aTextList = queryList("QCanvasText"); - QObjectListIt aItText(*aTextList); - QCanvasText* anObjText; - while ((anObjText = (QCanvasText*)aItText.current()) != 0) { - ++aItText; - if (!anObjText->isVisible()) - anObjText->show(); - } - delete aTextList; - } - - for (int co = myOldThreadNum; co < ncols; co++) { + for (int co = 0; co < ncols; co++) { aLabel = QString("Thread %1").arg(co); QRect aRect = QRect(50 + co * (CELL_WIDTH + CELL_SPACE), 20, CELL_WIDTH, CELL_HEIGHT); QCanvasRectangle* aThread = new QCanvasRectangle(aRect, this); @@ -203,8 +159,6 @@ bool SUPERVGUI_CanvasArray::create() { aText->show(); } - myOldThreadNum = ncols; - y = 60; bool LevelHasDiffNT = false; for (int li = 0; li <= nligs; li++) { @@ -262,39 +216,18 @@ void SUPERVGUI_CanvasArray::destroy() { ++aIt; ((SUPERVGUI_CanvasCellNode*)anObj)->getPrs()->hide(); } - delete aCellList; - QObjectList* aCellEndList = queryList("SUPERVGUI_CanvasCellEndNode"); - QObjectListIt aItEnd(*aCellEndList); - QObject* anObjEnd; - while ((anObjEnd = aItEnd.current()) != 0) { - ++aItEnd; - ((SUPERVGUI_CanvasCellEndNode*)anObjEnd)->getPrs()->hide(); - } - - delete aCellEndList; - - QObjectList* aThreadList = queryList("QCanvasRectangle"); - QObjectListIt aItThread(*aThreadList); - QCanvasRectangle* anObjThread; - while ((anObjThread = (QCanvasRectangle*)aItThread.current()) != 0) { - ++aItThread; - anObjThread->hide(); - } - - delete aThreadList; - - QObjectList* aTextList = queryList("QCanvasText"); - QObjectListIt aItText(*aTextList); - QCanvasText* anObjText; - while ((anObjText = (QCanvasText*)aItText.current()) != 0) { - ++aItText; - anObjText->hide(); + // mkr : delete QCanvasRectangle and QCanvasText canvas items for each Thread. + // Threads will be recreate when create() function is called + QCanvasItemList aTextList = allItems(); + for (QCanvasItemList::Iterator aItText = aTextList.begin(); aItText != aTextList.end(); ++aItText) { + SUPERVGUI_CanvasCellNodePrs* aPrs = dynamic_cast(*aItText); + if (!aPrs) { + (*aItText)->hide(); + delete *aItText; + } } - - delete aTextList; - } SUPERVGUI_CanvasCellNode* SUPERVGUI_CanvasArray::getCellNode(SUPERV::CNode_ptr theNode) const diff --git a/src/SUPERVGUI/SUPERVGUI_CanvasArray.h b/src/SUPERVGUI/SUPERVGUI_CanvasArray.h index 863b7c5..fc8e3ce 100644 --- a/src/SUPERVGUI/SUPERVGUI_CanvasArray.h +++ b/src/SUPERVGUI/SUPERVGUI_CanvasArray.h @@ -37,8 +37,6 @@ class SUPERVGUI_CanvasArray: public QCanvas { SUPERVGUI_Main* myMain; - int myOldThreadNum; - int nodeX; int nodeY; -- 2.39.2