remove obsolete

This commit is contained in:
The Coriolis Project 2008-05-16 15:33:39 +00:00
parent f34b13a292
commit b6d0f68b61
9 changed files with 0 additions and 7288 deletions

View File

@ -1,15 +0,0 @@
include(${QT_USE_FILE})
include_directories(${HURRICANE_SOURCE_DIR}/src/hurricane)
set(includes CellWidget.h LayersWidget.h CellViewer.h)
set(exports CellViewer.h)
set(cpps CellWidget.cpp LayersWidget.cpp CellViewer.cpp)
QT4_WRAP_CPP(MOC_SRCS ${includes})
add_library(hurricaneviewer SHARED ${cpps} ${MOC_SRCS})
target_link_libraries(hurricaneviewer ${QT_LIBRARIES} hurricane)
install(FILES ${exports} DESTINATION /include/hurricane)
install(TARGETS hurricaneviewer DESTINATION /lib)

View File

@ -1,860 +0,0 @@
// ****************************************************************************************************
// File: Cell.cpp
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#include "Cell.h"
#include "DataBase.h"
#include "Library.h"
#include "Instance.h"
#include "Net.h"
#include "Pin.h"
#include "RoutingPad.h"
#include "Layer.h"
#include "Slice.h"
#include "Rubber.h"
#include "Marker.h"
#include "Symbol.h"
#include "Primitive.h"
#include "MapView.h"
#include "DisplaySlot.h"
#include "Component.h"
#include "UpdateSession.h"
#include "Error.h"
namespace Hurricane {
// ****************************************************************************************************
// Cell implementation
// ****************************************************************************************************
Cell::Cell(Library* library, const Name& name)
// *******************************************
: Inherit(),
_library(library),
_name(name),
_instanceMap(),
_quadTree(),
_slaveInstanceSet(),
_netMap(),
_sliceMap(),
_markerSet(),
_viewSet(),
_abutmentBox(),
_boundingBox(),
_isTerminal(true),
_isPad(false),
_symbol(NULL),
_nextOfLibraryCellMap(NULL),
_nextOfSymbolCellSet(NULL),
_slaveEntityMap()
{
if (!_library)
throw Error("Can't create " + _TName("Cell") + " : null library");
if (name.IsEmpty())
throw Error("Can't create " + _TName("Cell") + " : empty name");
if (_library->GetCell(_name))
throw Error("Can't create " + _TName("Cell") + " : already exists");
}
Cell* Cell::Create(Library* library, const Name& name)
// ***************************************************
{
Cell* cell = new Cell(library, name);
cell->_PostCreate();
return cell;
}
Box Cell::GetBoundingBox() const
// *****************************
{
if (_boundingBox.IsEmpty()) {
Box& boundingBox = (Box&)_boundingBox;
boundingBox = _abutmentBox;
boundingBox.Merge(_quadTree.GetBoundingBox());
for_each_slice(slice, GetSlices()) {
boundingBox.Merge(slice->GetBoundingBox());
end_for;
}
}
return _boundingBox;
}
bool Cell::IsLeaf() const
// **********************
{
return _instanceMap.IsEmpty();
}
bool Cell::IsCalledBy(Cell* cell) const
// ************************************
{
for_each_instance(instance, cell->GetInstances()) {
Cell* masterCell = instance->GetMasterCell();
if (masterCell == this) return true;
if (IsCalledBy(masterCell)) return true;
end_for;
}
return false;
}
void Cell::SetName(const Name& name)
// *********************************
{
if (name != _name) {
if (name.IsEmpty())
throw Error("Can't change " + _TName("Cell") + " name : empty name");
if (_library->GetCell(name))
throw Error("Can't change " + _TName("Cell") + " name : already exists");
_library->_GetCellMap()._Remove(this);
_name = name;
_library->_GetCellMap()._Insert(this);
}
}
void Cell::SetAbutmentBox(const Box& abutmentBox)
// **********************************************
{
if (abutmentBox != _abutmentBox) {
if (!_abutmentBox.IsEmpty() &&
(abutmentBox.IsEmpty() || !abutmentBox.Contains(_abutmentBox)))
_Unfit(_abutmentBox);
_abutmentBox = abutmentBox;
_Fit(_abutmentBox);
}
}
void Cell::SetSymbol(Symbol* symbol)
// *********************************
{
if (symbol != _symbol) {
OpenUpdateSession();
if (_symbol) {
_Unfit(_symbol->GetBoundingBox());
for_each_net(net, GetExternalNets()) {
net->SetPosition(Point(0, 0));
end_for;
}
_symbol->_GetCellSet()._Remove(this);
}
_symbol = symbol;
if (_symbol) {
_symbol->_GetCellSet()._Insert(this);
for_each_net(net, GetExternalNets()) {
Port* port = _symbol->GetPort(net->GetName());
if (port) net->SetPosition(port->GetPosition());
end_for;
}
_Fit(_symbol->GetBoundingBox());
}
CloseUpdateSession();
}
}
void Cell::FlattenNets(bool buildRings)
// ************************************
{
OpenUpdateSession ();
for_each_occurrence ( occurrence, GetHyperNetRootNetOccurrences() ) {
HyperNet hyperNet ( occurrence );
if ( !occurrence.GetPath().IsEmpty() ) {
DeepNet* deepNet = DeepNet::Create ( hyperNet );
if (deepNet) deepNet->_CreateRoutingPads ( buildRings );
} else {
RoutingPad* previousRP = NULL;
RoutingPad* currentRP = NULL;
Net* net = static_cast<Net*>(occurrence.GetEntity());
for_each_component ( component, net->GetComponents() ) {
Plug* primaryPlug = dynamic_cast<Plug*>( component );
if ( primaryPlug ) {
if ( !primaryPlug->GetBodyHook()->GetSlaveHooks().IsEmpty() ) {
cerr << "[ERROR] " << primaryPlug << "\n"
<< " has attached components, not managed yet." << endl;
} else {
primaryPlug->GetBodyHook()->Detach ();
}
}
end_for
}
for_each_occurrence ( plugOccurrence, hyperNet.GetLeafPlugOccurrences() ) {
currentRP = CreateRoutingPad ( net, plugOccurrence );
currentRP->Materialize ();
if ( buildRings ) {
if ( previousRP ) {
currentRP->GetBodyHook()->Attach ( previousRP->GetBodyHook() );
}
Plug* plug = static_cast<Plug*>( plugOccurrence.GetEntity() );
if ( plugOccurrence.GetPath().IsEmpty() ) {
plug->GetBodyHook()->Attach ( currentRP->GetBodyHook() );
plug->GetBodyHook()->Detach ();
}
previousRP = currentRP;
}
end_for
}
for_each_component ( component, net->GetComponents() ) {
Pin* pin = dynamic_cast<Pin*>( component );
if ( pin ) {
currentRP = CreateRoutingPad ( pin );
if ( buildRings ) {
if ( previousRP ) {
currentRP->GetBodyHook()->Attach ( previousRP->GetBodyHook() );
}
pin->GetBodyHook()->Attach ( currentRP->GetBodyHook() );
pin->GetBodyHook()->Detach ();
}
previousRP = currentRP;
}
end_for
}
}
end_for
}
CloseUpdateSession ();
}
void Cell::Materialize()
// *********************
{
for_each_instance(instance, GetInstances()) instance->Materialize(); end_for;
for_each_net(net, GetNets()) net->Materialize(); end_for;
for_each_marker(marker, GetMarkers()) marker->Materialize(); end_for;
}
void Cell::Unmaterialize()
// ***********************
{
for_each_instance(instance, GetInstances()) instance->Unmaterialize(); end_for;
for_each_net(net, GetNets()) net->Unmaterialize(); end_for;
for_each_marker(marker, GetMarkers()) marker->Unmaterialize(); end_for;
}
void Cell::_PostCreate()
// *********************
{
_library->_GetCellMap()._Insert(this);
Inherit::_PostCreate();
}
void Cell::_PreDelete()
// ********************
{
Inherit::_PreDelete();
while(_slaveEntityMap.size()) {
_slaveEntityMap.begin()->second->Delete();
}
if (_symbol) SetSymbol(NULL);
for_each_view(view, GetViews()) view->SetCell(NULL); end_for;
for_each_marker(marker, GetMarkers()) marker->Delete(); end_for;
for_each_instance(slaveInstance, GetSlaveInstances()) slaveInstance->Delete(); end_for;
for_each_instance(instance, GetInstances()) instance->Delete(); end_for;
for_each_net(net, GetNets()) net->Delete(); end_for;
for_each_slice(slice, GetSlices()) slice->_Delete(); end_for;
_library->_GetCellMap()._Remove(this);
}
string Cell::_GetString() const
// ****************************
{
string s = Inherit::_GetString();
s.insert(s.length() - 1, " " + GetString(_name));
return s;
}
Record* Cell::_GetRecord() const
// ***********************
{
Record* record = Inherit::_GetRecord();
if (record) {
record->Add(GetSlot("Library", _library));
record->Add(GetSlot("Name", &_name));
record->Add(GetSlot("Instances", &_instanceMap));
record->Add(GetSlot("QuadTree", &_quadTree));
record->Add(GetSlot("SlaveInstances", &_slaveInstanceSet));
record->Add(GetSlot("Nets", &_netMap));
record->Add(GetSlot("Pins", &_pinMap));
record->Add(GetSlot("Slices", &_sliceMap));
record->Add(GetSlot("Markers", &_markerSet));
record->Add(GetSlot("Views", &_viewSet));
record->Add(GetSlot("AbutmentBox", &_abutmentBox));
record->Add(GetSlot("BoundingBox", &_boundingBox));
record->Add(GetSlot("IsTerminal", &_isTerminal));
record->Add(GetSlot("IsFlattenLeaf", &_isFlattenLeaf));
//record->Add(GetSlot("Symbol", _symbol));
}
return record;
}
void Cell::_Fit(const Box& box)
// ****************************
{
if (box.IsEmpty()) return;
if (_boundingBox.IsEmpty()) return;
if (_boundingBox.Contains(box)) return;
_boundingBox.Merge(box);
for_each_instance(instance, GetSlaveInstances()) {
instance->GetCell()->_Fit(instance->GetTransformation().GetBox(box));
end_for;
}
}
void Cell::_Unfit(const Box& box)
// ******************************
{
if (box.IsEmpty()) return;
if (_boundingBox.IsEmpty()) return;
if (!_boundingBox.IsConstrainedBy(box)) return;
_boundingBox.MakeEmpty();
for_each_instance(instance, GetSlaveInstances()) {
instance->GetCell()->_Unfit(instance->GetTransformation().GetBox(box));
end_for;
}
}
void Cell::_AddSlaveEntity(Entity* entity, Entity* slaveEntity)
// ************************************************************************
{
assert(entity->GetCell() == this);
_slaveEntityMap.insert(pair<Entity*,Entity*>(entity,slaveEntity));
}
void Cell::_RemoveSlaveEntity(Entity* entity, Entity* slaveEntity)
// ***************************************************************************
{
assert(entity->GetCell() == this);
pair<SlaveEntityMap::iterator,SlaveEntityMap::iterator>
bounds = _slaveEntityMap.equal_range(entity);
multimap<Entity*,Entity*>::iterator it = bounds.first;
for(; it != bounds.second ; it++ ) {
if (it->second == slaveEntity) {
_slaveEntityMap.erase(it);
break;
}
}
}
void Cell::_GetSlaveEntities(SlaveEntityMap::iterator& begin, SlaveEntityMap::iterator& end)
// *********************************************************************************************************
{
begin = _slaveEntityMap.begin();
end = _slaveEntityMap.end();
}
void Cell::_GetSlaveEntities(Entity* entity, SlaveEntityMap::iterator& begin, SlaveEntityMap::iterator& end)
// *********************************************************************************************************
{
begin = _slaveEntityMap.lower_bound(entity);
end = _slaveEntityMap.upper_bound(entity);
}
bool Cell::_IsDrawable(View* view) const
// *************************************
{
if (view->GetCell() == this) return true;
if (is_a<MapView*>(view)) return true;
return (1 < (double)view->GetScreenSize(_boundingBox.GetHeight()));
// return (100 < ((double)view->GetScreenSize(_boundingBox.GetWidth()) *
// (double)view->GetScreenSize(_boundingBox.GetHeight())));
}
bool Cell::_ContentIsDrawable(View* view) const
// ********************************************
{
if (IsTerminal()) return false;
if (view->GetCell() == this) return true;
if (is_a<MapView*>(view)) return false;
return (40 < (double)view->GetScreenSize(_boundingBox.GetHeight()));
// return (400 < ((double)view->GetScreenSize(_boundingBox.GetWidth()) *
// (double)view->GetScreenSize(_boundingBox.GetHeight())));
}
void Cell::_DrawPhantoms(View* view, const Box& updateArea, const Transformation& transformation)
// **********************************************************************************************
{
if (_IsDrawable(view)) { // To avoid irregular display of instances phantoms
if (!_ContentIsDrawable(view))
view->FillRectangle(transformation.GetBox(GetAbutmentBox()));
else {
for_each_instance(instance, GetInstancesUnder(updateArea)) {
instance->_DrawPhantoms(view, updateArea, transformation);
end_for;
}
}
}
}
void Cell::_DrawBoundaries(View* view, const Box& updateArea, const Transformation& transformation)
// ************************************************************************************************
{
if (_IsDrawable(view)) { // To avoid irregular display of instances phantoms
view->DrawRectangle(transformation.GetBox(GetAbutmentBox()));
if (_ContentIsDrawable(view)) {
for_each_instance(instance, GetInstancesUnder(updateArea)) {
instance->_DrawBoundaries(view, updateArea, transformation);
end_for;
}
}
}
}
void Cell::_DrawContent(View* view, BasicLayer* basicLayer, const Box& updateArea, const Transformation& transformation)
// ****************************************************************************************************
{
if (_IsDrawable(view)) {
if (_ContentIsDrawable(view)) {
view->CheckForDisplayInterruption();
for_each_instance(instance, GetInstancesUnder(updateArea)) {
instance->_Draw(view, basicLayer, updateArea, transformation);
end_for;
}
for_each_slice(slice, GetSlices()) {
slice->_Draw(view, basicLayer, updateArea, transformation);
end_for;
}
}
}
}
void Cell::_DrawRubbers(View* view, const Box& updateArea, const Transformation& transformation)
// *********************************************************************************************
{
if (_IsDrawable(view)) {
if (_ContentIsDrawable(view)) {
for_each_instance(instance, GetInstancesUnder(updateArea)) {
instance->_DrawRubbers(view, updateArea, transformation);
end_for;
}
for_each_rubber(rubber, GetRubbersUnder(updateArea)) {
rubber->_Draw(view, NULL, updateArea, transformation);
end_for;
}
}
}
}
void Cell::_DrawMarkers(View* view, const Box& updateArea, const Transformation& transformation)
// *********************************************************************************************
{
if (_IsDrawable(view)) {
if (_ContentIsDrawable(view)) {
for_each_instance(instance, GetInstancesUnder(updateArea)) {
instance->_DrawMarkers(view, updateArea, transformation);
end_for;
}
for_each_marker(marker, GetMarkersUnder(updateArea)) {
marker->_Draw(view, NULL, updateArea, transformation);
end_for;
}
}
}
}
void Cell::_DrawDisplaySlots(View* view, const Box& area, const Box& updateArea, const Transformation& transformation)
// ********************************************************************************************************************
{
if (_IsDrawable(view)) {
if (_ContentIsDrawable(view)) {
for_each_instance(instance, GetInstancesUnder(updateArea)) {
instance->_DrawDisplaySlots(view, area, updateArea, transformation);
end_for;
}
for_each_display_slot(displaySlot, GetDisplaySlots(this)) {
view->_DrawDisplaySlot(displaySlot, area, updateArea, transformation);
end_for;
}
}
}
}
void Cell::_SaveHeaderTo(OutputFile& outputFile)
// *********************************************
{
outputFile.Register(this);
Inherit::_SaveHeaderTo(outputFile);
outputFile << " " << outputFile.GetId(GetLibrary());
outputFile << " " << GetName();
outputFile << " " << GetValueString(GetAbutmentBox().GetXMin());
outputFile << " " << GetValueString(GetAbutmentBox().GetYMin());
outputFile << " " << GetValueString(GetAbutmentBox().GetXMax());
outputFile << " " << GetValueString(GetAbutmentBox().GetYMax());
outputFile << " " << ((IsTerminal()) ? '1' : '0');
}
void Cell::_SaveContentTo(OutputFile& outputFile)
// **********************************************
{
Inherit::_SaveContentTo(outputFile);
for_each_instance(instance, GetInstances()) {
instance->_SaveTo(outputFile);
end_for;
}
for_each_net(net, GetNets()) {
net->_SaveTo(outputFile);
end_for;
}
}
void Cell::_Realize(Hurricane::Builder* builder, InputFile& inputFile)
// *******************************************************************
{
assert(is_a<Cell::Builder*>(builder));
Cell::Builder* cellBuilder = (Cell::Builder*)builder;
SetAbutmentBox(cellBuilder->GetAbutmentBox());
SetTerminal(cellBuilder->IsTerminal());
// PROVISOIREMENT
string s = GetString(GetName());
Library* library = GetLibrary();
while (library) {
s = GetString(library->GetName()) + "/" + s;
library = library->GetLibrary();
}
cout << " Loading cell " << s << endl;
// PROVISOIREMENT
inputFile.Register(this);
Go::DisableAutoMaterialization();
OpenUpdateSession();
Inherit::_Realize(builder, inputFile);
}
void Cell::_Finalize(InputFile& inputFile)
// ***************************************
{
CloseUpdateSession();
Go::EnableAutoMaterialization();
Materialize();
Inherit::_Finalize(inputFile);
}
// ****************************************************************************************************
// Cell::InstanceMap implementation
// ****************************************************************************************************
Cell::InstanceMap::InstanceMap()
// *****************************
: Inherit()
{
}
Name Cell::InstanceMap::_GetKey(Instance* instance) const
// ******************************************************
{
return instance->GetName();
}
unsigned Cell::InstanceMap::_GetHashValue(Name name) const
// *******************************************************
{
return ( (unsigned int)( (unsigned long)name._GetSharedName() ) ) / 8;
}
Instance* Cell::InstanceMap::_GetNextElement(Instance* instance) const
// *******************************************************************
{
return instance->_GetNextOfCellInstanceMap();
}
void Cell::InstanceMap::_SetNextElement(Instance* instance, Instance* nextInstance) const
// **************************************************************************************
{
instance->_SetNextOfCellInstanceMap(nextInstance);
}
// ****************************************************************************************************
// Cell::SlaveInstanceSet implementation
// ****************************************************************************************************
Cell::SlaveInstanceSet::SlaveInstanceSet()
// ***************************************
: Inherit()
{
}
unsigned Cell::SlaveInstanceSet::_GetHashValue(Instance* slaveInstance) const
// **************************************************************************
{
return ( (unsigned int)( (unsigned long)slaveInstance ) ) / 8;
}
Instance* Cell::SlaveInstanceSet::_GetNextElement(Instance* slaveInstance) const
// *****************************************************************************
{
return slaveInstance->_GetNextOfCellSlaveInstanceSet();
}
void Cell::SlaveInstanceSet::_SetNextElement(Instance* slaveInstance, Instance* nextSlaveInstance) const
// ****************************************************************************************************
{
slaveInstance->_SetNextOfCellSlaveInstanceSet(nextSlaveInstance);
}
// ****************************************************************************************************
// Cell::NetMap implementation
// ****************************************************************************************************
Cell::NetMap::NetMap()
// *******************
: Inherit()
{
}
Name Cell::NetMap::_GetKey(Net* net) const
// ***************************************
{
return net->GetName();
}
unsigned Cell::NetMap::_GetHashValue(Name name) const
// **************************************************
{
return ( (unsigned int)( (unsigned long)name._GetSharedName() ) ) / 8;
}
Net* Cell::NetMap::_GetNextElement(Net* net) const
// ***********************************************
{
return net->_GetNextOfCellNetMap();
}
void Cell::NetMap::_SetNextElement(Net* net, Net* nextNet) const
// *************************************************************
{
net->_SetNextOfCellNetMap(nextNet);
}
// ****************************************************************************************************
// Cell::PinMap implementation
// ****************************************************************************************************
Cell::PinMap::PinMap()
// *******************
: Inherit()
{
}
Name Cell::PinMap::_GetKey(Pin* pin) const
// ***************************************
{
return pin->GetName();
}
unsigned Cell::PinMap::_GetHashValue(Name name) const
// **************************************************
{
return ( (unsigned int)( (unsigned long)name._GetSharedName() ) ) / 8;
}
Pin* Cell::PinMap::_GetNextElement(Pin* pin) const
// ***********************************************
{
return pin->_GetNextOfCellPinMap();
}
void Cell::PinMap::_SetNextElement(Pin* pin, Pin* nextPin) const
// *************************************************************
{
pin->_SetNextOfCellPinMap(nextPin);
}
// ****************************************************************************************************
// Cell::SliceMap implementation
// ****************************************************************************************************
Cell::SliceMap::SliceMap()
// ***********************
: Inherit()
{
}
const Layer* Cell::SliceMap::_GetKey(Slice* slice) const
// *****************************************************
{
return slice->GetLayer();
}
unsigned Cell::SliceMap::_GetHashValue(const Layer* layer) const
// *************************************************************
{
return ( (unsigned int)( (unsigned long)layer ) ) / 8;
}
Slice* Cell::SliceMap::_GetNextElement(Slice* slice) const
// *******************************************************
{
return slice->_GetNextOfCellSliceMap();
}
void Cell::SliceMap::_SetNextElement(Slice* slice, Slice* nextSlice) const
// ***********************************************************************
{
slice->_SetNextOfCellSliceMap(nextSlice);
};
// ****************************************************************************************************
// Cell::MarkerSet implementation
// ****************************************************************************************************
Cell::MarkerSet::MarkerSet()
// *************************
: Inherit()
{
}
unsigned Cell::MarkerSet::_GetHashValue(Marker* marker) const
// **********************************************************
{
return ( (unsigned int)( (unsigned long)marker ) ) / 8;
}
Marker* Cell::MarkerSet::_GetNextElement(Marker* marker) const
// ***********************************************************
{
return marker->_GetNextOfCellMarkerSet();
}
void Cell::MarkerSet::_SetNextElement(Marker* marker, Marker* nextMarker) const
// ****************************************************************************
{
marker->_SetNextOfCellMarkerSet(nextMarker);
}
// ****************************************************************************************************
// Cell::ViewSet implementation
// ****************************************************************************************************
Cell::ViewSet::ViewSet()
// *********************
: Inherit()
{
}
unsigned Cell::ViewSet::_GetHashValue(View* view) const
// ****************************************************
{
return ( (unsigned int)( (unsigned long)view ) ) / 8;
}
View* Cell::ViewSet::_GetNextElement(View* view) const
// ***************************************************
{
return view->_GetNextOfCellViewSet();
}
void Cell::ViewSet::_SetNextElement(View* view, View* nextView) const
// ******************************************************************
{
view->_SetNextOfCellViewSet(nextView);
}
// ****************************************************************************************************
// Cell::Builder declaration
// ****************************************************************************************************
Cell::Builder::Builder(const string& token)
// ****************************************
: Inherit(token),
_library(NULL),
_name(),
_xMin(0),
_yMin(0),
_xMax(0),
_yMax(0),
_isTerminal(0)
{
}
void Cell::Builder::Scan(InputFile& inputFile, char*& arguments)
// *************************************************************
{
DBo* owner = inputFile.GetOwner();
if (!is_a<DataBase*>(owner))
throw Error("Can't create Cell : bad owner");
Inherit::Scan(inputFile, arguments);
unsigned libraryId;
unsigned n;
int r = sscanf(arguments, "%u%s%lf%lf%lf%lf%u%n", &libraryId, _name,
&_xMin, &_yMin, &_xMax, &_yMax, &_isTerminal, &n);
if (r != 7)
throw Error("Can't create Cell : syntax error");
arguments = &arguments[n];
DBo* dbo = inputFile.GetDBo(libraryId);
if (!dbo || !is_a<Library*>(dbo))
throw Error("Can't create Cell : bad library");
_library = (Library*)dbo;
}
DBo* Cell::Builder::CreateDBo()
// ****************************
{
return Cell::Create(GetLibrary(), GetName());
}
Cell::Builder CELL_BUILDER("C");
} // End of Hurricane namespace.
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -1,93 +0,0 @@
#include <QtGui>
#include "CellWidget.h"
#include "LayersWidget.h"
#include "CellViewer.h"
CellViewer::CellViewer(Cell* cell)
: QMainWindow()
{
cellWidget = new CellWidget(cell);
setCentralWidget(cellWidget);
createActions();
createMenus();
setWindowTitle(tr("Cell Viewer"));
resize(1000, 500);
}
CellViewer::~CellViewer() {
delete cellWidget;
delete layersWidget;
}
static int scrollStep = getUnit(200);
void CellViewer::keyPressEvent(QKeyEvent *event) {
switch (event->key()) {
case Qt::Key_Left:
cellWidget->scroll(-scrollStep, 0);
break;
case Qt::Key_Right:
cellWidget->scroll(+scrollStep, 0);
break;
case Qt::Key_Down:
cellWidget->scroll(0, -scrollStep);
break;
case Qt::Key_Up:
cellWidget->scroll(0, +scrollStep);
break;
default:
QWidget::keyPressEvent(event);
}
}
//
//void CellViewer::wheelEvent(QWheelEvent *event) {
// int numDegrees = event->delta() / 8;
// double numSteps = numDegrees / 15.0f;
// zoom(pow(ZoomInFactor, numSteps));
//}
void CellViewer::zoomIn() {
cellWidget->reframe(cellWidget->getScale() * 1.2);
cellWidget->update();
}
void CellViewer::zoomOut() {
cellWidget->reframe(cellWidget->getScale() / 1.2);
cellWidget->update();
}
void CellViewer::fitToWindow() {
cellWidget->fitToContent();
cellWidget->update();
}
void CellViewer::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 CellViewer::createMenus() {
viewMenu = new QMenu(tr("&View"), this);
viewMenu->addAction(zoomInAct);
viewMenu->addAction(zoomOutAct);
viewMenu->addAction(fitToWindowAct);
menuBar()->addMenu(viewMenu);
}

View File

@ -1,39 +0,0 @@
#ifndef __CELL_VIEWER_H
#define __CELL_VIEWER_H
#include "Cell.h"
using namespace Hurricane;
#include <QMainWindow>
class CellWidget;
class LayersWidget;
class CellViewer : public QMainWindow {
Q_OBJECT
public:
CellViewer(Cell* cell);
~CellViewer();
private:
CellWidget* cellWidget;
LayersWidget* layersWidget;
QAction *zoomInAct;
QAction *zoomOutAct;
QAction *fitToWindowAct;
QMenu *viewMenu;
void createActions();
void createMenus();
private slots:
void zoomIn();
void zoomOut();
void fitToWindow();
protected:
void keyPressEvent(QKeyEvent *event);
};
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,45 +0,0 @@
#include "DataBase.h"
#include "Technology.h"
#include "BasicLayer.h"
using namespace Hurricane;
#include <QCheckBox>
#include <QLabel>
#include <QGridLayout>
#include "LayersWidget.h"
LayersWidget::LayersWidget(QWidget* parent)
: QWidget(parent),
widgets()
{
DataBase* db = getDataBase();
Technology* techno = db->getTechnology();
QGridLayout* mainLayout = new QGridLayout;
int line = 0;
for_each_basic_layer(basicLayer, techno->getBasicLayers()) {
QCheckBox* checkBox = new QCheckBox();
widgets.insert(checkBox);
mainLayout->addWidget(checkBox, line, 0, Qt::AlignRight);
//connect(checkBox, SIGNAL(toggled(bool)),
// renderArea, SLOT(setAntialiased(bool)));
string layerName = getString(basicLayer->getName());
QLabel* label = new QLabel(tr(layerName.c_str()));
widgets.insert(label);
mainLayout->addWidget(label, line, 1, Qt::AlignRight);
++line;
end_for;
}
setLayout(mainLayout);
setWindowTitle(tr("Layers"));
}
LayersWidget::~LayersWidget() {
for (set<QWidget*>::iterator wsit = widgets.begin();
wsit != widgets.end();
wsit++) {
delete *wsit;
}
}

View File

@ -1,19 +0,0 @@
#ifndef LAYERS_WIDGET_H
#define LAYERS_WIDGET_H
#include <set>
using namespace std;
#include <QWidget>
class LayersWidget : public QWidget {
Q_OBJECT
public :
LayersWidget(QWidget *parent = 0);
~LayersWidget();
private:
set<QWidget*> widgets;
};
#endif

File diff suppressed because it is too large Load Diff