From b774770407d95109ddf1da96d38bc262a00b5130 Mon Sep 17 00:00:00 2001 From: The Coriolis Project Date: Mon, 14 Apr 2008 14:31:33 +0000 Subject: [PATCH] OpenUpdateSession() -> UpdateSession::open() remove hurricane editor (QGraphicsView framework) --- hurricane/cmake_modules/FindHURRICANE.cmake | 22 --- hurricane/src/CMakeLists.txt | 1 - hurricane/src/editor/CMakeLists.txt | 16 --- hurricane/src/editor/CellEditor.cpp | 103 --------------- hurricane/src/editor/CellEditor.h | 37 ------ hurricane/src/editor/CellGraphicsItem.cpp | 80 ----------- hurricane/src/editor/CellGraphicsItem.h | 26 ---- hurricane/src/editor/CellScene.cpp | 11 -- hurricane/src/editor/CellScene.h | 18 --- hurricane/src/editor/GoFigure.cpp | 19 --- hurricane/src/editor/GoFigure.h | 20 --- hurricane/src/editor/InstanceGraphicsItem.cpp | 112 ---------------- hurricane/src/editor/InstanceGraphicsItem.h | 29 ---- hurricane/src/editor/SegmentFigure.cpp | 125 ------------------ hurricane/src/editor/SegmentFigure.h | 24 ---- hurricane/src/editor/SliceFigure.cpp | 53 -------- hurricane/src/editor/SliceFigure.h | 24 ---- hurricane/src/editor/Utils.h | 44 ------ hurricane/src/hurricane/Cell.cpp | 4 +- hurricane/src/hurricane/DataBase.cpp | 4 +- hurricane/src/hurricane/DisplaySlot.cpp | 4 +- hurricane/src/hurricane/Net.cpp | 4 +- hurricane/src/hurricane/UpdateSession.cpp | 14 +- hurricane/src/hurricane/UpdateSession.h | 12 +- hurricane/src/pyext/PyHurricane.cpp | 4 +- hurricane/src/pyext/PyUpdateSession.cpp | 16 +-- hurricane/src/pyext/PyUpdateSession.h | 4 +- 27 files changed, 30 insertions(+), 800 deletions(-) delete mode 100644 hurricane/src/editor/CMakeLists.txt delete mode 100644 hurricane/src/editor/CellEditor.cpp delete mode 100644 hurricane/src/editor/CellEditor.h delete mode 100644 hurricane/src/editor/CellGraphicsItem.cpp delete mode 100644 hurricane/src/editor/CellGraphicsItem.h delete mode 100644 hurricane/src/editor/CellScene.cpp delete mode 100644 hurricane/src/editor/CellScene.h delete mode 100644 hurricane/src/editor/GoFigure.cpp delete mode 100644 hurricane/src/editor/GoFigure.h delete mode 100644 hurricane/src/editor/InstanceGraphicsItem.cpp delete mode 100644 hurricane/src/editor/InstanceGraphicsItem.h delete mode 100644 hurricane/src/editor/SegmentFigure.cpp delete mode 100644 hurricane/src/editor/SegmentFigure.h delete mode 100644 hurricane/src/editor/SliceFigure.cpp delete mode 100644 hurricane/src/editor/SliceFigure.h delete mode 100644 hurricane/src/editor/Utils.h diff --git a/hurricane/cmake_modules/FindHURRICANE.cmake b/hurricane/cmake_modules/FindHURRICANE.cmake index 262e2dea..49be51ba 100644 --- a/hurricane/cmake_modules/FindHURRICANE.cmake +++ b/hurricane/cmake_modules/FindHURRICANE.cmake @@ -53,22 +53,6 @@ IF(UNIX) DOC "The ${HURRICANE_INCLUDE_PATH_DESCRIPTION}" ) - FIND_PATH(HURRICANE_EDITOR_INCLUDE_PATH - NAMES CellEditor.h - PATHS ${HURRICANE_DIR_SEARCH} - PATH_SUFFIXES include/hurricane - # Help the user find it if we cannot. - DOC "The ${HURRICANE_INCLUDE_PATH_DESCRIPTION}" - ) - - FIND_LIBRARY(HURRICANE_EDITOR_LIBRARY_PATH - NAMES hurricaneeditor - PATHS ${HURRICANE_DIR_SEARCH} - PATH_SUFFIXES lib - # Help the user find it if we cannot. - DOC "The ${HURRICANE_INCLUDE_PATH_DESCRIPTION}" - ) - # Assume we didn't find it. SET(HURRICANE_FOUND 0) SET(HURRICANE_GRAPHICAL_FOUND 0) @@ -87,19 +71,13 @@ IF(UNIX) IF(HURRICANE_VIEWER_INCLUDE_PATH) IF(HURRICANE_VIEWER_LIBRARY_PATH) - IF(HURRICANE_EDITOR_INCLUDE_PATH) - IF(HURRICANE_EDITOR_LIBRARY_PATH) SET(HURRICANE_GRAPHICAL_FOUND "YES") SET(HURRICANE_GRAPHICAL_INCLUDE_DIR ${HURRICANE_VIEWER_INCLUDE_PATH} - ${HURRICANE_EDITOR_INCLUDE_PATH} ) SET(HURRICANE_GRAPHICAL_LIBRARIES ${HURRICANE_VIEWER_LIBRARY_PATH} - ${HURRICANE_EDITOR_LIBRARY_PATH} ) - ENDIF(HURRICANE_EDITOR_LIBRARY_PATH) - ENDIF(HURRICANE_EDITOR_INCLUDE_PATH) ENDIF(HURRICANE_VIEWER_LIBRARY_PATH) ENDIF(HURRICANE_VIEWER_INCLUDE_PATH) diff --git a/hurricane/src/CMakeLists.txt b/hurricane/src/CMakeLists.txt index fe3526a6..c73a1e03 100644 --- a/hurricane/src/CMakeLists.txt +++ b/hurricane/src/CMakeLists.txt @@ -1,4 +1,3 @@ ADD_SUBDIRECTORY(hurricane) ADD_SUBDIRECTORY(viewer) -ADD_SUBDIRECTORY(editor) ADD_SUBDIRECTORY(pyext) diff --git a/hurricane/src/editor/CMakeLists.txt b/hurricane/src/editor/CMakeLists.txt deleted file mode 100644 index 1c8a0e28..00000000 --- a/hurricane/src/editor/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -include(${QT_USE_FILE}) - -include_directories(${HURRICANE_SOURCE_DIR}/src/hurricane) - -set(includes CellEditor.h CellScene.h) -set(exports CellEditor.h) -set(cpps CellGraphicsItem.cpp InstanceGraphicsItem.cpp SegmentFigure.cpp - CellScene.cpp CellEditor.cpp) - -QT4_WRAP_CPP(MOC_SRCS ${includes}) - -add_library(hurricaneeditor SHARED ${cpps} ${MOC_SRCS}) -target_link_libraries(hurricaneeditor ${QT_LIBRARIES} hurricane) - -install(FILES ${exports} DESTINATION /include/hurricane) -install(TARGETS hurricaneeditor DESTINATION /lib) diff --git a/hurricane/src/editor/CellEditor.cpp b/hurricane/src/editor/CellEditor.cpp deleted file mode 100644 index 76ae31fd..00000000 --- a/hurricane/src/editor/CellEditor.cpp +++ /dev/null @@ -1,103 +0,0 @@ -#include - -#include "Utils.h" -#include "CellScene.h" - -#include "CellEditor.h" - -CellEditor::CellEditor(Cell* c) - : QMainWindow(), - cell(c) -{ - - createActions(); - createMenus(); - - scene = new CellScene(cell); - view = new QGraphicsView(scene); - - setCentralWidget(view); - - setWindowTitle(tr("Cell Editor")); - resize(1000, 500); - fitToWindow(); -} - -CellEditor::~CellEditor() { - delete view; - delete scene; -} - -//void CellEditor::keyPressEvent(QKeyEvent *event) { -// switch (event->key()) { -// case Qt::Key_Plus: -// zoom(ZoomInFactor); -// break; -// case Qt::Key_Minus: -// zoom(ZoomOutFactor); -// break; -// case Qt::Key_Left: -// scroll(-ScrollStep, 0); -// break; -// case Qt::Key_Right: -// scroll(+ScrollStep, 0); -// break; -// case Qt::Key_Down: -// scroll(0, -ScrollStep); -// break; -// case Qt::Key_Up: -// scroll(0, +ScrollStep); -// break; -// default: -// QWidget::keyPressEvent(event); -// } -//} -// -//void CellEditor::wheelEvent(QWheelEvent *event) { -// int numDegrees = event->delta() / 8; -// double numSteps = numDegrees / 15.0f; -// zoom(pow(ZoomInFactor, numSteps)); -//} - -void CellEditor::zoomIn() { - view->scale(1.2, 1.2); -} - -void CellEditor::zoomOut() { - view->scale(0.8, 0.8); -} - -void CellEditor::fitToWindow() { - if (cell) { - Box area(cell->getBoundingBox()); - QRectF rect; - boxToRectangle(area, rect); - view->fitInView(rect); - } -} - -void CellEditor::createActions() { - zoomInAct = new QAction(tr("Zoom &In (25%)"), this); - zoomInAct->setShortcut(tr("Ctrl++")); - zoomInAct->setEnabled(true); - connect(zoomInAct, SIGNAL(triggered()), this, SLOT(zoomIn())); - - zoomOutAct = new QAction(tr("Zoom &Out (25%)"), this); - zoomOutAct->setShortcut(tr("Ctrl+-")); - zoomOutAct->setEnabled(true); - connect(zoomOutAct, SIGNAL(triggered()), this, SLOT(zoomOut())); - - fitToWindowAct = new QAction(tr("Fit &To &Window"), this); - fitToWindowAct->setShortcut(tr("f")); - fitToWindowAct->setEnabled(true); - connect(fitToWindowAct, SIGNAL(triggered()), this, SLOT(fitToWindow())); -} - -void CellEditor::createMenus() { - viewMenu = new QMenu(tr("&View"), this); - viewMenu->addAction(zoomInAct); - viewMenu->addAction(zoomOutAct); - viewMenu->addAction(fitToWindowAct); - - menuBar()->addMenu(viewMenu); -} diff --git a/hurricane/src/editor/CellEditor.h b/hurricane/src/editor/CellEditor.h deleted file mode 100644 index 863bccf8..00000000 --- a/hurricane/src/editor/CellEditor.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef __CELL_EDITOR_H -#define __CELL_EDITOR_H - -#include "Cell.h" -using namespace Hurricane; - -#include - -class QGraphicsView; -class CellScene; - -class CellEditor : public QMainWindow { - Q_OBJECT - - public: - CellEditor(Cell* cell); - ~CellEditor(); - private: - Cell* cell; - CellScene *scene; - QGraphicsView *view; - - QAction *zoomInAct; - QAction *zoomOutAct; - QAction *fitToWindowAct; - QMenu *viewMenu; - - void createActions(); - void createMenus(); - - private slots: - void zoomIn(); - void zoomOut(); - void fitToWindow(); -}; - -#endif diff --git a/hurricane/src/editor/CellGraphicsItem.cpp b/hurricane/src/editor/CellGraphicsItem.cpp deleted file mode 100644 index abee8e6f..00000000 --- a/hurricane/src/editor/CellGraphicsItem.cpp +++ /dev/null @@ -1,80 +0,0 @@ -#include - -#include -#include - -#include "Slice.h" -using namespace Hurricane; - -#include "Utils.h" -#include "InstanceGraphicsItem.h" -#include "SegmentFigure.h" -#include "CellGraphicsItem.h" - -CellGraphicsItem::CellGraphicsItem(Cell* c): - QGraphicsItem(), - cell(c) { - //QTransform transform; - //transform.setMatrix(1.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 0.0, 1.0); - //setTransform(transform); - //for_each_instance(instance, cell->getInstances()) { - // new InstanceGraphicsItem(this, instance); - // end_for; - //} - - unsigned zValue = 10; - for_each_slice(slice, cell->getSlices()) { - for_each_go(go, slice->getGos()) { - Segment* segment = dynamic_cast(go); - if (segment) { - SegmentGraphicsItem* segmentItem = new SegmentGraphicsItem(this, segment); - segmentItem->setZValue(zValue); - } - end_for; - } - zValue += 10; - end_for; - } -} - -CellGraphicsItem::CellGraphicsItem(InstanceGraphicsItem* master, Cell* c) : QGraphicsItem(master), cell(c) { - //for_each_instance(instance, cell->getInstances()) { - // new InstanceGraphicsItem(this, instance); - // end_for; - //} - //for_each_slice(slice, cell->getSlices()) { - // new SliceFigure(this, slice); - // end_for; - //} -} - -QRectF CellGraphicsItem::boundingRect() const { - Box box = cell->getBoundingBox(); - QRectF rect; - boxToRectangle(box, rect); - //rect = transform().mapRect(rect); - return rect; -} - -void CellGraphicsItem::paint(QPainter *painter, const QStyleOptionGraphicsItem* option, QWidget *) { - painter->setClipRect(option->exposedRect); - drawBoundary(painter); - //drawPhantom(painter); -} - -void CellGraphicsItem::drawBoundary(QPainter* painter) { - QPen pen(Qt::black); - painter->setPen(pen); - Box box = cell->getAbutmentBox(); - QRectF rect; - boxToRectangle(box, rect); - painter->drawRect(rect); -} - -void CellGraphicsItem::drawPhantom(QPainter* painter) { - painter->setBrush(Qt::red); - Box box = cell->getAbutmentBox(); - QRectF rect; - boxToRectangle(box, rect); - painter->drawRect(rect); -} diff --git a/hurricane/src/editor/CellGraphicsItem.h b/hurricane/src/editor/CellGraphicsItem.h deleted file mode 100644 index ef1ac402..00000000 --- a/hurricane/src/editor/CellGraphicsItem.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef __CELL_GRAPHICS_ITEM_H -#define __CELL_GRAPHICS_ITEM_H - -#include -#include - -#include "Cell.h" -using namespace Hurricane; - -class InstanceGraphicsItem; - -class CellGraphicsItem : public QGraphicsItem { - public: - CellGraphicsItem(Cell* cell); - CellGraphicsItem(InstanceGraphicsItem* master, Cell* cell); - QRectF boundingRect() const; - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, - QWidget *widget); - - private: - Cell* cell; - void drawBoundary(QPainter* painter); - void drawPhantom(QPainter* painter); -}; - -#endif /* __CELL_GRAPHICS_ITEM_H */ diff --git a/hurricane/src/editor/CellScene.cpp b/hurricane/src/editor/CellScene.cpp deleted file mode 100644 index c9ca3a94..00000000 --- a/hurricane/src/editor/CellScene.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "CellGraphicsItem.h" - -#include "CellScene.h" - -CellScene::CellScene(Cell* c) - : QGraphicsScene() - , cell(c) -{ - CellGraphicsItem* cellItem = new CellGraphicsItem(cell); - addItem(cellItem); -} diff --git a/hurricane/src/editor/CellScene.h b/hurricane/src/editor/CellScene.h deleted file mode 100644 index c86f88ce..00000000 --- a/hurricane/src/editor/CellScene.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef __CELL_SCENE_H -#define __CELL_SCENE_H - -#include - -#include "Cell.h" -using namespace Hurricane; - -class CellScene : public QGraphicsScene { - Q_OBJECT - - public: - CellScene(Cell* cell); - private: - Cell* cell; -}; - -#endif /* __CELL_SCENE_H */ diff --git a/hurricane/src/editor/GoFigure.cpp b/hurricane/src/editor/GoFigure.cpp deleted file mode 100644 index c01cb326..00000000 --- a/hurricane/src/editor/GoFigure.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include - -#include - -#include "SliceFigure.h" - -#include "Utils.h" -#include "GoFigure.h" - -GoFigure::GoFigure(SliceFigure* master): - QGraphicsItem(master) -{} - -QRectF GoFigure::boundingRect() const { - Box box = getGo()->GetBoundingBox(); - QRectF rect; - BoxToRectangle(box, rect); - return rect; -} diff --git a/hurricane/src/editor/GoFigure.h b/hurricane/src/editor/GoFigure.h deleted file mode 100644 index 2b7e9b75..00000000 --- a/hurricane/src/editor/GoFigure.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef __GO_FIGURE_H -#define __GO_FIGURE_H - -#include -#include - -#include "Go.h" -using namespace H; - -class SliceFigure; - -class GoFigure : public QGraphicsItem { - public: - GoFigure(SliceFigure* parent); - QRectF boundingRect() const; - protected: - virtual Go* getGo() const = 0; -}; - -#endif /* __GO_FIGURE_H */ diff --git a/hurricane/src/editor/InstanceGraphicsItem.cpp b/hurricane/src/editor/InstanceGraphicsItem.cpp deleted file mode 100644 index 3d4d5bdb..00000000 --- a/hurricane/src/editor/InstanceGraphicsItem.cpp +++ /dev/null @@ -1,112 +0,0 @@ -#include -#include -#include - -#include "Cell.h" -#include "Slice.h" -#include "Segment.h" -#include "BasicLayer.h" -using namespace Hurricane; - -#include "Utils.h" -#include "InstanceGraphicsItem.h" - -//InstanceGraphicsItem::InstanceGraphicsItem(Instance* inst) -// : instance(inst), -// cell(instance->getMasterCell()) -//{ -// Transformation transformation = instance->getTransformation(); -// QTransform transform; -// QPoint pos; -// HurricanePositionToQtPosition(transformation, transform, pos); -// setTransform(transform); -// setPos(pos); -// constructSubInstances(); -//} - -InstanceGraphicsItem::InstanceGraphicsItem(Cell* c) - : instance(NULL), - cell(c) -{ - constructSubInstances(); -} - -//InstanceGraphicsItem::InstanceGraphicsItem(InstanceGraphicsItem* parent, Instance* inst) -// : QGraphicsItem(parent), -// instance(inst), -// cell(instance->getMasterCell()) -//{ -// Transformation transformation = instance->getTransformation(); -// QTransform transform; -// QPoint pos; -// HurricanePositionToQtPosition(transformation, transform, pos); -// setTransform(transform); -// setPos(pos); -// constructSubInstances(); -//} - -void InstanceGraphicsItem::constructSubInstances() { - for_each_instance(instance, cell->getInstances()) { - //new InstanceGraphicsItem(this, instance); - end_for; - } -} - -QRectF InstanceGraphicsItem::boundingRect() const { - Box box = cell->getAbutmentBox(); - QRectF rect; - boxToRectangle(box, rect); - return rect; -} - -void InstanceGraphicsItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { - painter->setClipRect(option->exposedRect.adjusted(-1.0, -1.0, 1.0, 1.0)); - if (option->levelOfDetail > 1.0) { - drawBoundary(painter); - drawElements(painter); - } else { - drawPhantom(painter); - } -} - -void InstanceGraphicsItem::drawElements(QPainter* painter) { - for_each_slice(slice, cell->getSlices()) { - painter->save(); - BasicLayer* layer = dynamic_cast(slice->getLayer()); - if (layer) { - painter->setBrush(QColor(layer->getRedValue(), layer->getGreenValue(), layer->getBlueValue())); - } else { - painter->setBrush(Qt::blue); - } - for_each_go(go, slice->getGos()) { - Segment* segment = dynamic_cast(go); - if (segment) { - Box box = segment->getBoundingBox(); - QRectF rect; - boxToRectangle(box, rect); - painter->drawRect(rect); - - } - end_for; - } - painter->restore(); - end_for; - } -} - -void InstanceGraphicsItem::drawBoundary(QPainter* painter) { - QPen pen(Qt::black); - painter->setPen(pen); - Box box = cell->getAbutmentBox(); - QRectF rect; - boxToRectangle(box, rect); - painter->drawRect(rect); -} - -void InstanceGraphicsItem::drawPhantom(QPainter* painter) { - painter->setBrush(Qt::red); - Box box = cell->getAbutmentBox(); - QRectF rect; - boxToRectangle(box, rect); - painter->drawRect(rect); -} diff --git a/hurricane/src/editor/InstanceGraphicsItem.h b/hurricane/src/editor/InstanceGraphicsItem.h deleted file mode 100644 index 9c45602e..00000000 --- a/hurricane/src/editor/InstanceGraphicsItem.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef __INSTANCE_GRAPHICS_ITEM_H -#define __INSTANCE_GRAPHICS_ITEM_H - -#include -#include - -#include "Instance.h" -#include "Cell.h" -using namespace Hurricane; - -class InstanceGraphicsItem : public QGraphicsItem { - public: - //InstanceGraphicsItem(InstanceGraphicsItem* parent, Instance* instance); - InstanceGraphicsItem(Cell* cell); - QRectF boundingRect() const; - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, - QWidget *widget); - - private: - Instance* instance; - Cell* cell; - void drawPhantom(QPainter* painter); - void drawBoundary(QPainter* painter); - void drawElements(QPainter* painter); - void constructSubInstances(); - -}; - -#endif /* __INSTANCE_GRAPHICS_ITEM_H */ diff --git a/hurricane/src/editor/SegmentFigure.cpp b/hurricane/src/editor/SegmentFigure.cpp deleted file mode 100644 index ddcadc76..00000000 --- a/hurricane/src/editor/SegmentFigure.cpp +++ /dev/null @@ -1,125 +0,0 @@ -#include - -#include -#include -#include - -#include "CompositeLayer.h" -#include "BasicLayer.h" -using namespace Hurricane; - -#include "Utils.h" -#include "CellGraphicsItem.h" -#include "SegmentFigure.h" - -namespace { - -QBrush getBrush(const string &pattern, int redValue, int greenValue, int blueValue) { - if (pattern == "FFFFFFFFFFFFFFFF") { - return QBrush(QColor(redValue, greenValue, blueValue)); - } else { - uchar bits[8]; - for (int i = 0; i < 8; i++) { - int high = pattern[i * 2]; - if (('0' <= high) && (high <= '9')) { - high = high - '0'; - } else { - if (('a' <= high) && (high <= 'f')) { - high = 10 + high - 'a'; - } else { - if (('A' <= high) && (high <= 'F')) { - high = 10 + high - 'A'; - } else { - high = '0'; - } - } - } - int low = pattern[(i * 2) + 1]; - if (('0' <= low) && (low <= '9')) { - low = low - '0'; - } else { - if (('a' <= low) && (low <= 'f')) { - low = 10 + low - 'a'; - } else { - if (('A' <= low) && (low <= 'F')) { - low = 10 + low - 'A'; - } else { - low = '0'; - } - } - } - bits[i] = (uchar)((high * 16) + low); - } - return QBrush(QColor(redValue, greenValue, blueValue), QBitmap::fromData(QSize(8,8), bits, QImage::Format_Mono)); - } -} - -} - -SegmentGraphicsItem::SegmentGraphicsItem(CellGraphicsItem* master, Segment* s): - QGraphicsItem(master), - segment(s) -{ - setFlag(ItemIsMovable); - setFlag(ItemIsSelectable); - setFlag(ItemIsFocusable); -} - -QRectF SegmentGraphicsItem::boundingRect() const { - Box box = segment->getBoundingBox(); - QRectF rect; - boxToRectangle(box, rect); - return rect; -} - -void SegmentGraphicsItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { - //if (option->levelOfDetail > 1.0) { - painter->setClipRect(option->exposedRect); - Box box = segment->getBoundingBox(); - QRectF rect; - boxToRectangle(box, rect); - BasicLayer* blayer = dynamic_cast(segment->getLayer()); - if (blayer) { - QColor layerColor(blayer->getRedValue(), - blayer->getGreenValue(), - blayer->getBlueValue()); - QBrush brush(layerColor); - brush.setStyle(Qt::Dense1Pattern); - painter->setBrush(brush); - //painter->setBrush(getBrush(blayer->getFillPattern(), - // blayer->getRedValue(), - // blayer->getGreenValue(), - // blayer->getBlueValue())); - painter->setPen(layerColor); - painter->drawRect(rect); - } else { - CompositeLayer* clayer = dynamic_cast(segment->getLayer()); - if (clayer) { - for_each_basic_layer(basiclayer, clayer->getBasicLayers()) { - QColor layerColor(basiclayer->getRedValue(), - basiclayer->getGreenValue(), - basiclayer->getBlueValue()); - QBrush brush(layerColor); - brush.setStyle(Qt::Dense1Pattern); - painter->setBrush(brush); - //painter->setBrush(getBrush(basiclayer->getFillPattern(), - // basiclayer->getRedValue(), - // basiclayer->getGreenValue(), - // basiclayer->getBlueValue())); - painter->setPen(layerColor); - painter->drawRect(rect); - end_for; - } - } - } -} - -void SegmentGraphicsItem::mousePressEvent(QGraphicsSceneMouseEvent *event) { - update(); - QGraphicsItem::mousePressEvent(event); -} - -void SegmentGraphicsItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { - update(); - QGraphicsItem::mouseReleaseEvent(event); -} diff --git a/hurricane/src/editor/SegmentFigure.h b/hurricane/src/editor/SegmentFigure.h deleted file mode 100644 index 21bd722b..00000000 --- a/hurricane/src/editor/SegmentFigure.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef __SEGMENT_GRAPHICS_ITEM_H -#define __SEGMENT_GRAPHICS_ITEM_H - -#include -#include - -#include "Segment.h" -using namespace Hurricane; - -class CellGraphicsItem; - -class SegmentGraphicsItem : public QGraphicsItem { - public: - SegmentGraphicsItem(CellGraphicsItem* parent, Segment* segment); - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); - QRectF boundingRect() const; - private: - Segment* segment; - protected: - void mousePressEvent(QGraphicsSceneMouseEvent *event); - void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); -}; - -#endif /* __SEGMENT_GRAPHICS_ITEM_H */ diff --git a/hurricane/src/editor/SliceFigure.cpp b/hurricane/src/editor/SliceFigure.cpp deleted file mode 100644 index c3c5ad20..00000000 --- a/hurricane/src/editor/SliceFigure.cpp +++ /dev/null @@ -1,53 +0,0 @@ -#include -#include - -#include "BasicLayer.h" -using namespace H; - -#include "SegmentGraphicsItem.h" -#include "Utils.h" -#include "SliceFigure.h" - -SliceFigure::SliceFigure(CellFigure* parent, Slice* sli): - QGraphicsItem(parent), - slice(sli) -{ -// constructGoFigures(); -} - -QRectF SliceFigure::boundingRect() const { - Box box = slice->GetBoundingBox(); - return QRectF(box.GetXMin(), box.GetXMax(), box.GetYMin(), box.GetYMax()); -} - -void SliceFigure::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { -// if (option->levelOfDetail > 1.0) { -//// painter->setClipRect(option->exposedRect); -// BasicLayer* layer = dynamic_cast(slice->GetLayer()); -// if (layer) { -// painter->setBrush(QColor(layer->GetRedValue(), layer->GetGreenValue(), layer->GetBlueValue())); -// } else { -// painter->setBrush(Qt::blue); -// } -// for_each_go(go, slice->GetGos()) { -// Segment* segment = dynamic_cast(go); -// if (segment) { -// Box box = segment->GetBoundingBox(); -// QRectF rect; -// BoxToRectangle(box, rect); -// painter->drawRect(rect); -// } -// end_for; -// } -// } -} - -void SliceFigure::constructGoFigures() { - for_each_go(go, slice->GetGos()) { - Segment* segment = dynamic_cast(go); - if (segment) { - new SegmentGraphicsItem(this, segment); - } - end_for; - } -} diff --git a/hurricane/src/editor/SliceFigure.h b/hurricane/src/editor/SliceFigure.h deleted file mode 100644 index 61f89859..00000000 --- a/hurricane/src/editor/SliceFigure.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef __SLICE_FIGURE_H -#define __SLICE_FIGURE_H - -#include -#include - -#include "CellGraphicsItem.h" - -#include "Slice.h" -using namespace Hurricane; - -class SliceFigure : public QGraphicsItem { - public: - SliceFigure(CellGraphicsItem* parent, Slice* slice); - QRectF boundingRect() const; - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, - QWidget *widget); - - private: - Slice* slice; - void constructGoFigures(); -}; - -#endif /* __SLICE_FIGURE_H */ diff --git a/hurricane/src/editor/Utils.h b/hurricane/src/editor/Utils.h deleted file mode 100644 index 3645b9a5..00000000 --- a/hurricane/src/editor/Utils.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef __UTILS_H -#define __UTILS_H - -#include -#include -#include "Box.h" -#include "Transformation.h" -using namespace Hurricane; - -inline void boxToRectangle(const Box& box, QRectF& rec) { - double xmin = getValue(box.getXMin()); - double xmax = getValue(box.getXMax()); - double ymin = getValue(box.getYMin()); - double ymax = getValue(box.getYMax()); - rec.setCoords(xmin, ymin, xmax, ymax); -} - -inline void hurricanePositionToQtPosition(const Transformation& transformation, QTransform& transform, QPoint& position) { - double tx = getValue(transformation.getTx()); - double ty = getValue(transformation.getTy()); - - position.setX((int)tx); - position.setY((int)ty); - - switch (transformation.getOrientation()) { - case Transformation::Orientation::ID: - transform.setMatrix(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0); - break; - case Transformation::Orientation::MX: - transform.setMatrix(-1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0); - break; - case Transformation::Orientation::MY: - transform.setMatrix(1.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 0.0, 1.0); - break; - case Transformation::Orientation::R2: - transform.setMatrix(-1.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 0.0, 1.0); - break; - default: - break; - } -} - - -#endif /* __UTILS_H */ diff --git a/hurricane/src/hurricane/Cell.cpp b/hurricane/src/hurricane/Cell.cpp index 4ecc1992..f90fef06 100644 --- a/hurricane/src/hurricane/Cell.cpp +++ b/hurricane/src/hurricane/Cell.cpp @@ -130,7 +130,7 @@ void Cell::setAbutmentBox(const Box& abutmentBox) void Cell::flattenNets(bool buildRings) // ************************************ { - openUpdateSession (); + UpdateSession::open(); for_each_occurrence ( occurrence, getHyperNetRootNetOccurrences() ) { HyperNet hyperNet ( occurrence ); @@ -193,7 +193,7 @@ void Cell::flattenNets(bool buildRings) end_for } - closeUpdateSession (); + UpdateSession::close(); } void Cell::materialize() diff --git a/hurricane/src/hurricane/DataBase.cpp b/hurricane/src/hurricane/DataBase.cpp index 690ec33c..29cdcffc 100644 --- a/hurricane/src/hurricane/DataBase.cpp +++ b/hurricane/src/hurricane/DataBase.cpp @@ -53,12 +53,12 @@ void DataBase::_postCreate() void DataBase::_preDestroy() // ************************ { - openUpdateSession(); + UpdateSession::open(); Inherit::_preDestroy(); if (_rootLibrary) _rootLibrary->destroy(); if (_technology) _technology->destroy(); - closeUpdateSession (); + UpdateSession::close(); DATA_BASE = NULL; } diff --git a/hurricane/src/hurricane/DisplaySlot.cpp b/hurricane/src/hurricane/DisplaySlot.cpp index 7d808425..14d0af83 100644 --- a/hurricane/src/hurricane/DisplaySlot.cpp +++ b/hurricane/src/hurricane/DisplaySlot.cpp @@ -96,13 +96,13 @@ void DisplaySlot::hide() void DisplaySlot::flush() // ********************** { - openUpdateSession(); + UpdateSession::open(); vector govect; _quadTree.getGos().fill(govect); for (unsigned i = 0 ; i < govect.size() ; i++) { govect[i]->destroy(); } - closeUpdateSession(); + UpdateSession::close(); } UserGos DisplaySlot::getUserGos() const diff --git a/hurricane/src/hurricane/Net.cpp b/hurricane/src/hurricane/Net.cpp index ef2a9dea..0741875c 100644 --- a/hurricane/src/hurricane/Net.cpp +++ b/hurricane/src/hurricane/Net.cpp @@ -449,13 +449,13 @@ void Net::setExternal(bool isExternal) } _isExternal = isExternal; if (_isExternal) { - openUpdateSession(); + UpdateSession::open(); setPosition(Point(0, 0)); for_each_instance(instance, _cell->getSlaveInstances()) { Plug::_create(instance, this); end_for; } - closeUpdateSession(); + UpdateSession::close(); } } } diff --git a/hurricane/src/hurricane/UpdateSession.cpp b/hurricane/src/hurricane/UpdateSession.cpp index 137ba5ad..6ccee92e 100644 --- a/hurricane/src/hurricane/UpdateSession.cpp +++ b/hurricane/src/hurricane/UpdateSession.cpp @@ -151,23 +151,13 @@ void Go::invalidate(bool propagateFlag) // trace_out(); } - - -// **************************************************************************************************** -// Generic functions -// **************************************************************************************************** - -void openUpdateSession() -// ********************* -{ +void UpdateSession::open() { // trace << "OpenUpdateSession()" << endl; // trace_in(); UpdateSession::_create(); } -void closeUpdateSession() -// ********************** -{ +void UpdateSession::close() { // trace << "CloseUpdateSession()" << endl; // trace_in(); diff --git a/hurricane/src/hurricane/UpdateSession.h b/hurricane/src/hurricane/UpdateSession.h index 862614fc..c3943e88 100644 --- a/hurricane/src/hurricane/UpdateSession.h +++ b/hurricane/src/hurricane/UpdateSession.h @@ -59,6 +59,10 @@ class UpdateSession : public SharedProperty { public: virtual string _getString() const; public: virtual Record* _getRecord() const; + public: static void open(); + public: static void close(); + + }; @@ -66,10 +70,10 @@ class UpdateSession : public SharedProperty { // Generic functions // **************************************************************************************************** -void openUpdateSession(); - -void closeUpdateSession(); - +//void openUpdateSession(); +// +//void closeUpdateSession(); +// } // End of Hurricane namespace. diff --git a/hurricane/src/pyext/PyHurricane.cpp b/hurricane/src/pyext/PyHurricane.cpp index e97c2c60..4a534397 100644 --- a/hurricane/src/pyext/PyHurricane.cpp +++ b/hurricane/src/pyext/PyHurricane.cpp @@ -526,8 +526,8 @@ extern "C" { { { "getUnit" , PyUnit_getUnit , METH_VARARGS, "Convert to Unit." } , { "getValue" , PyUnit_getValue , METH_VARARGS, "Convert a Unit to a value." } , { "getDataBase" , (PyCFunction)PyDataBase_getDataBase , METH_NOARGS , "Get the current DataBase." } - , { "openUpdateSession" , (PyCFunction)PyUpdateSession_openUpdateSession , METH_NOARGS , "Open an UpdateSession." } - , { "closeUpdateSession" , (PyCFunction)PyUpdateSession_closeUpdateSession, METH_NOARGS , "Close an UpdateSession." } + //, { "openUpdateSession" , (PyCFunction)PyUpdateSession_openUpdateSession , METH_NOARGS , "Open an UpdateSession." } + //, { "closeUpdateSession" , (PyCFunction)PyUpdateSession_closeUpdateSession, METH_NOARGS , "Close an UpdateSession." } , { "getExternalComponents" , (PyCFunction)PyNetExternalComponents_getExternalComponents, METH_VARARGS, "Returns the components collection of an external net" } , {NULL, NULL, 0, NULL} /* sentinel */ }; diff --git a/hurricane/src/pyext/PyUpdateSession.cpp b/hurricane/src/pyext/PyUpdateSession.cpp index f2b1f59d..1e739aa5 100644 --- a/hurricane/src/pyext/PyUpdateSession.cpp +++ b/hurricane/src/pyext/PyUpdateSession.cpp @@ -72,13 +72,13 @@ extern "C" { // --------------------------------------------------------------- - // Attribute Method : "PyUpdateSession_openUpdateSession ()" + // Attribute Method : "PyUpdateSession_open ()" - extern PyObject* PyUpdateSession_openUpdateSession ( PyObject* module ) { - trace << "PyUpdateSession_openUpdateSession ()" << endl; + extern PyObject* PyUpdateSession_open ( PyObject* module ) { + trace << "PyUpdateSession_open()" << endl; HTRY - openUpdateSession (); + UpdateSession::open (); HCATCH Py_RETURN_NONE; @@ -88,14 +88,14 @@ extern "C" { // --------------------------------------------------------------- - // Attribute Method : "PyUpdateSession_closeUpdateSession ()" + // Attribute Method : "PyUpdateSession_close()" - extern PyObject* PyUpdateSession_closeUpdateSession ( PyObject* module ) + extern PyObject* PyUpdateSession_close( PyObject* module ) { - trace << "PyUpdateSession_closeUpdateSession ()" << endl; + trace << "PyUpdateSession_close()" << endl; HTRY - closeUpdateSession (); + UpdateSession::close(); HCATCH Py_RETURN_NONE; diff --git a/hurricane/src/pyext/PyUpdateSession.h b/hurricane/src/pyext/PyUpdateSession.h index 94b7ce3a..8feab7bf 100644 --- a/hurricane/src/pyext/PyUpdateSession.h +++ b/hurricane/src/pyext/PyUpdateSession.h @@ -77,8 +77,8 @@ extern "C" { // ------------------------------------------------------------------- // Functions & Types exported to "PyHurricane.ccp". - extern PyObject* PyUpdateSession_openUpdateSession ( PyObject* module ); - extern PyObject* PyUpdateSession_closeUpdateSession ( PyObject* module ); + extern PyObject* PyUpdateSession_open ( PyObject* module ); + extern PyObject* PyUpdateSession_close ( PyObject* module ); } // End of extern "C".