* ./hurricane/src/hviewer :

- New Widget policy : a widget do not generate other widget : applied to
       CellWidget which no longer supplies Palette & StatusBar.
         API note: to associate a HPalette to a CellWidget (that is be able
       to select layer) you have to call "bindToPalette()" on the CellWidget.
   - Hurricane reusable widget names prefixed by 'H' : HMousePosition and
       HPalette.
This commit is contained in:
Jean-Paul Chaput 2008-07-04 15:33:11 +00:00
parent 98d3004a22
commit 2607d8d94c
17 changed files with 320 additions and 282 deletions

View File

@ -4,20 +4,21 @@
include_directories ( ${HURRICANE_SOURCE_DIR}/src/hurricane
${HURRICANE_SOURCE_DIR}/src/hviewer )
set ( mocincludes hurricane/viewer/PaletteEntry.h
set ( mocincludes hurricane/viewer/HPaletteEntry.h
hurricane/viewer/LayerPaletteEntry.h
hurricane/viewer/GroupPaletteEntry.h
hurricane/viewer/ViewerPaletteEntry.h
hurricane/viewer/Palette.h
hurricane/viewer/HPalette.h
hurricane/viewer/DynamicLabel.h
hurricane/viewer/HMousePosition.h
hurricane/viewer/CellWidget.h
hurricane/viewer/CellViewer.h
hurricane/viewer/RecordModel.h
hurricane/viewer/HInspectorWidget.h
)
set ( exports hurricane/viewer/ScreenUtilities.h
hurricane/viewer/PaletteEntry.h
hurricane/viewer/Palette.h
hurricane/viewer/HPaletteEntry.h
hurricane/viewer/HPalette.h
hurricane/viewer/DisplayStyle.h
hurricane/viewer/Graphics.h
hurricane/viewer/CellViewer.h
@ -27,12 +28,13 @@
set ( cpps ScreenUtilities.cpp
DisplayStyle.cpp
Graphics.cpp
PaletteEntry.cpp
HPaletteEntry.cpp
LayerPaletteEntry.cpp
GroupPaletteEntry.cpp
ViewerPaletteEntry.cpp
Palette.cpp
HPalette.cpp
DynamicLabel.cpp
HMousePosition.cpp
CellWidget.cpp
CellViewer.cpp
RecordModel.cpp

View File

@ -6,16 +6,18 @@
#include <QAction>
#include <QMenu>
#include <QMenuBar>
#include <QStatusBar>
#include <QDockWidget>
#include "hurricane/DataBase.h"
#include "hurricane/Cell.h"
//#include "MapView.h"
#include "hurricane/viewer/Palette.h"
#include "hurricane/viewer/HPalette.h"
#include "hurricane/viewer/CellWidget.h"
#include "hurricane/viewer/CellViewer.h"
#include "hurricane/viewer/HInspectorWidget.h"
#include "hurricane/viewer/HMousePosition.h"
namespace Hurricane {
@ -37,6 +39,7 @@ namespace Hurricane {
, _toolsMenu(NULL)
//, _mapView(NULL)
, _palette(NULL)
, _mousePosition(NULL)
, _cellWidget(NULL)
{
createMenus ();
@ -118,10 +121,13 @@ namespace Hurricane {
if ( _cellWidget ) return;
_cellWidget = new CellWidget ();
_palette = _cellWidget->getPalette();
_palette = new HPalette ();
//_mapView = _cellWidget->getMapView ();
setStatusBar ( _cellWidget->getStatusBar() );
_cellWidget->bindToPalette ( _palette );
HMousePosition* _mousePosition = new HMousePosition ();
statusBar()->addPermanentWidget ( _mousePosition );
setCorner ( Qt::TopLeftCorner , Qt::LeftDockWidgetArea );
setCorner ( Qt::BottomLeftCorner , Qt::LeftDockWidgetArea );
@ -139,7 +145,7 @@ namespace Hurricane {
| QDockWidget::DockWidgetMovable
| QDockWidget::DockWidgetFloatable
);
layerMapDock->setObjectName ( "Palette" );
layerMapDock->setObjectName ( "HPalette" );
layerMapDock->setWidget ( _palette );
layerMapDock->setAllowedAreas ( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea );
addDockWidget ( Qt::RightDockWidgetArea, layerMapDock );
@ -150,6 +156,8 @@ namespace Hurricane {
connect ( _fitToContentsAction , SIGNAL(triggered()) , _cellWidget, SLOT(fitToContents ()));
connect ( _runInspectorOnDataBase, SIGNAL(triggered()) , this , SLOT(runInspectorOnDataBase()));
connect ( _runInspectorOnCell , SIGNAL(triggered()) , this , SLOT(runInspectorOnCell ()));
connect ( _cellWidget , SIGNAL(mousePositionChanged(const Point&))
, _mousePosition , SLOT(setPosition(const Point&)) );
_cellWidget->redraw ();
}

View File

@ -9,7 +9,6 @@
# include <QStylePainter>
# include <QBitmap>
# include <QLabel>
# include <QStatusBar>
# include "hurricane/DataBase.h"
# include "hurricane/Technology.h"
@ -22,9 +21,8 @@
# include "hurricane/Pad.h"
# include "hurricane/viewer/Graphics.h"
# include "hurricane/viewer/PaletteEntry.h"
# include "hurricane/viewer/Palette.h"
# include "hurricane/viewer/DynamicLabel.h"
# include "hurricane/viewer/HPaletteEntry.h"
# include "hurricane/viewer/HPalette.h"
// # include "MapView.h"
# include "hurricane/viewer/CellWidget.h"
@ -87,10 +85,8 @@ namespace Hurricane {
CellWidget::CellWidget ( QWidget* parent ) : QWidget(parent)
, _statusBar(NULL)
, _technology(NULL)
, _palette(NULL)
, _xPosition(NULL)
, _yPosition(NULL)
, _displayArea(0,0,6*_stripWidth,6*_stripWidth)
, _visibleArea(_stripWidth,_stripWidth,4*_stripWidth,4*_stripWidth)
, _scale(1.0)
@ -115,21 +111,23 @@ namespace Hurricane {
setFocusPolicy ( Qt::StrongFocus );
setMouseTracking ( true );
_statusBar = new QStatusBar ( this );
// _statusBar = new QStatusBar ( this );
_xPosition = new DynamicLabel ();
_xPosition->setStaticText ( "X:" );
_xPosition->setDynamicText ( "0l" );
// _xPosition = new DynamicLabel ();
// _xPosition->setStaticText ( "X:" );
// _xPosition->setDynamicText ( "0l" );
_yPosition = new DynamicLabel ();
_yPosition->setStaticText ( "Y:" );
_yPosition->setDynamicText ( "0l" );
// _yPosition = new DynamicLabel ();
// _yPosition->setStaticText ( "Y:" );
// _yPosition->setDynamicText ( "0l" );
_statusBar->addPermanentWidget ( _xPosition );
_statusBar->addPermanentWidget ( _yPosition );
// _statusBar->addPermanentWidget ( _xPosition );
// _statusBar->addPermanentWidget ( _yPosition );
//_mapView = new MapView ( this );
_palette = new Palette ( this );
DataBase* database = DataBase::getDB();
if ( database )
_technology = database->getTechnology ();
fitToContents ();
}
@ -141,6 +139,25 @@ namespace Hurricane {
}
void CellWidget::bindToPalette ( HPalette* palette )
{
detachFromPalette ();
_palette = palette;
connect ( _palette, SIGNAL(paletteChanged()), this, SLOT(redraw()) );
}
void CellWidget::detachFromPalette ()
{
if ( _palette ) {
disconnect ( _palette, SIGNAL(paletteChanged()), this, SLOT(redraw()) );
_palette = NULL;
}
}
void CellWidget::pushCursor ( Qt::CursorShape cursor )
{
setCursor ( cursor );
@ -181,18 +198,33 @@ namespace Hurricane {
if ( _cell ) {
Box redrawBox = displayToDbuBox ( redrawArea );
vector<PaletteEntry*>& paletteEntries = _palette->getEntries ();
for ( size_t i=0 ; i<paletteEntries.size() ; i++ ) {
_drawingPainter.setPen ( Graphics::getPen (paletteEntries[i]->getName()) );
_drawingPainter.setBrush ( Graphics::getBrush(paletteEntries[i]->getName()) );
for_each_basic_layer ( basicLayer, _technology->getBasicLayers() ) {
_drawingPainter.setPen ( Graphics::getPen (basicLayer->getName()) );
_drawingPainter.setBrush ( Graphics::getBrush(basicLayer->getName()) );
if ( paletteEntries[i]->isBasicLayer() && isDrawable(paletteEntries[i]) ) {
drawCell ( _cell, paletteEntries[i]->getBasicLayer(), redrawBox, Transformation() );
} else if ( (paletteEntries[i]->getName() == DisplayStyle::Boundaries)
&& paletteEntries[i]->isChecked() ) {
drawBoundaries ( _cell, redrawBox, Transformation() );
}
if ( isDrawable(basicLayer->getName()) )
drawCell ( _cell, basicLayer, redrawBox, Transformation() );
end_for;
}
if ( isDrawable("boundaries") ) {
_drawingPainter.setPen ( Graphics::getPen ("boundaries") );
_drawingPainter.setBrush ( Graphics::getBrush("boundaries") );
drawBoundaries ( _cell, redrawBox, Transformation() );
}
// vector<HPaletteEntry*>& paletteEntries = _palette->getEntries ();
// for ( size_t i=0 ; i<paletteEntries.size() ; i++ ) {
// _drawingPainter.setPen ( Graphics::getPen (paletteEntries[i]->getName()) );
// _drawingPainter.setBrush ( Graphics::getBrush(paletteEntries[i]->getName()) );
// if ( paletteEntries[i]->isBasicLayer() && isDrawable(paletteEntries[i]) ) {
// drawCell ( _cell, paletteEntries[i]->getBasicLayer(), redrawBox, Transformation() );
// } else if ( (paletteEntries[i]->getName() == DisplayStyle::Boundaries)
// && paletteEntries[i]->isChecked() ) {
// drawBoundaries ( _cell, redrawBox, Transformation() );
// }
// }
}
_drawingPainter.end ();
@ -232,10 +264,12 @@ namespace Hurricane {
}
bool CellWidget::isDrawable ( PaletteEntry* entry )
bool CellWidget::isDrawable ( const Name& entryName )
{
return entry->isChecked()
&& ( Graphics::getThreshold(entry->getName())/DbU::lambda(1.0) < _scale );
HPaletteEntry* entry = (_palette) ? _palette->find(entryName) : NULL;
return (!entry || entry->isChecked())
&& ( Graphics::getThreshold(entryName)/DbU::lambda(1.0) < _scale );
}
@ -648,8 +682,8 @@ namespace Hurricane {
copyToScreen ();
if ( isDrawable(_palette->find("grid")) ) drawGrid ();
if ( isDrawable(_palette->find("spot")) ) _spot.moveTo ( _lastMousePosition );
if ( isDrawable("grid") ) drawGrid ();
if ( isDrawable("spot") ) _spot.moveTo ( _lastMousePosition );
_screenPainter.end ();
}
@ -720,11 +754,8 @@ namespace Hurricane {
_lastMousePosition = event->pos();
} else {
//cerr << "x:" << event->x() << " y:" << event->y() << endl;
_xPosition->setDynamicText ( screenToDbuX(event->x()) );
_yPosition->setDynamicText ( screenToDbuY(event->y()) );
_lastMousePosition = event->pos();
emit mousePositionChanged ( screenToDbuPoint(event->pos()) );
update ();
}

View File

@ -7,14 +7,14 @@
# include "hurricane/viewer/Graphics.h"
# include "hurricane/viewer/GroupPaletteEntry.h"
# include "hurricane/viewer/Palette.h"
# include "hurricane/viewer/HPalette.h"
namespace Hurricane {
GroupPaletteEntry::GroupPaletteEntry ( Palette* palette, const Name& name )
: PaletteEntry(palette)
GroupPaletteEntry::GroupPaletteEntry ( HPalette* palette, const Name& name )
: HPaletteEntry(palette)
, _name(name)
, _button(NULL)
, _index(0)
@ -23,7 +23,7 @@ namespace Hurricane {
}
GroupPaletteEntry* GroupPaletteEntry::create ( Palette* palette, const Name& name )
GroupPaletteEntry* GroupPaletteEntry::create ( HPalette* palette, const Name& name )
{
GroupPaletteEntry* entry = new GroupPaletteEntry ( palette, name );
@ -103,7 +103,7 @@ namespace Hurricane {
void GroupPaletteEntry::hideShow ()
{
vector<PaletteEntry*> entries = _palette->getEntries ();
vector<HPaletteEntry*> entries = _palette->getEntries ();
if ( entries[_index] != this )
cerr << "[ERROR] Incoherent index for group \"" << getString(getName()) << "\"." << endl;

View File

@ -16,11 +16,11 @@
# include "hurricane/BasicLayers.h"
# include "hurricane/viewer/Graphics.h"
# include "hurricane/viewer/PaletteEntry.h"
# include "hurricane/viewer/HPaletteEntry.h"
# include "hurricane/viewer/LayerPaletteEntry.h"
# include "hurricane/viewer/GroupPaletteEntry.h"
# include "hurricane/viewer/ViewerPaletteEntry.h"
# include "hurricane/viewer/Palette.h"
# include "hurricane/viewer/HPalette.h"
# include "hurricane/viewer/CellWidget.h"
@ -28,11 +28,10 @@ namespace Hurricane {
Palette::Palette ( CellWidget* cellWidget ) : QScrollArea()
, _cellWidget(cellWidget)
, _entries()
, _showAll(NULL)
, _hideAll(NULL)
HPalette::HPalette ( QWidget* parent ) : QScrollArea(parent)
, _entries()
, _showAll(NULL)
, _hideAll(NULL)
{
setWidgetResizable ( true );
@ -135,7 +134,7 @@ namespace Hurricane {
}
bool Palette::isDrawable ( size_t index )
bool HPalette::isDrawable ( size_t index )
{
if ( index < _entries.size() )
return _entries[index]->isChecked ();
@ -144,33 +143,33 @@ namespace Hurricane {
}
void Palette::showAll ()
void HPalette::showAll ()
{
for ( size_t i=0 ; i<_entries.size() ; i++ )
if ( !_entries[i]->isGroup() )
_entries[i]->setChecked ( true );
_cellWidget->redraw ();
emit paletteChanged();
}
void Palette::hideAll ()
void HPalette::hideAll ()
{
for ( size_t i=0 ; i<_entries.size() ; i++ )
if ( !_entries[i]->isGroup() )
_entries[i]->setChecked ( false );
_cellWidget->redraw ();
emit paletteChanged();
}
void Palette::redrawCellWidget ()
void HPalette::redrawCellWidget ()
{
_cellWidget->redraw ();
emit paletteChanged();
}
PaletteEntry* Palette::find ( const Name& name )
HPaletteEntry* HPalette::find ( const Name& name )
{
for ( size_t i=0 ; i<_entries.size() ; i++ ) {
if ( _entries[i]->getName() == name )

View File

@ -5,13 +5,13 @@
# include <QPainter>
# include "hurricane/viewer/Graphics.h"
# include "hurricane/viewer/PaletteEntry.h"
# include "hurricane/viewer/HPaletteEntry.h"
namespace Hurricane {
PaletteSample::PaletteSample ( PaletteEntry* entry )
HPaletteSample::HPaletteSample ( HPaletteEntry* entry )
: QWidget()
, _sample(QSize(20,20))
, _entry(entry)
@ -24,7 +24,7 @@ namespace Hurricane {
}
void PaletteSample::redraw ()
void HPaletteSample::redraw ()
{
QPainter painter ( &_sample );
@ -37,14 +37,14 @@ namespace Hurricane {
}
void PaletteSample::paintEvent ( QPaintEvent* )
void HPaletteSample::paintEvent ( QPaintEvent* )
{
QPainter painter ( this );
painter.drawPixmap ( 0, 0, _sample );
}
PaletteEntry::PaletteEntry ( Palette* palette )
HPaletteEntry::HPaletteEntry ( HPalette* palette )
: QWidget()
, _palette(palette)
{

View File

@ -9,20 +9,20 @@
# include "hurricane/viewer/Graphics.h"
# include "hurricane/viewer/LayerPaletteEntry.h"
# include "hurricane/viewer/Palette.h"
# include "hurricane/viewer/HPalette.h"
namespace Hurricane {
LayerPaletteEntry::LayerPaletteEntry ( Palette* entry, BasicLayer* basicLayer )
: PaletteEntry(entry)
LayerPaletteEntry::LayerPaletteEntry ( HPalette* entry, BasicLayer* basicLayer )
: HPaletteEntry(entry)
, _basicLayer(basicLayer)
{
}
LayerPaletteEntry* LayerPaletteEntry::create ( Palette* palette, BasicLayer* basicLayer )
LayerPaletteEntry* LayerPaletteEntry::create ( HPalette* palette, BasicLayer* basicLayer )
{
LayerPaletteEntry* entry = new LayerPaletteEntry ( palette, basicLayer );
@ -37,7 +37,7 @@ namespace Hurricane {
QHBoxLayout* layout = new QHBoxLayout ();
layout->setContentsMargins ( 0, 0, 0, 0 );
layout->addWidget ( new PaletteSample(this) );
layout->addWidget ( new HPaletteSample(this) );
_checkBox = new QCheckBox ( this );
_checkBox->setChecked ( true );

View File

@ -9,20 +9,20 @@
# include "hurricane/viewer/Graphics.h"
# include "hurricane/viewer/ViewerPaletteEntry.h"
# include "hurricane/viewer/Palette.h"
# include "hurricane/viewer/HPalette.h"
namespace Hurricane {
ViewerPaletteEntry::ViewerPaletteEntry ( Palette* entry, const Name& name )
: PaletteEntry(entry)
ViewerPaletteEntry::ViewerPaletteEntry ( HPalette* entry, const Name& name )
: HPaletteEntry(entry)
, _name(name)
{
}
ViewerPaletteEntry* ViewerPaletteEntry::create ( Palette* palette, const Name& name )
ViewerPaletteEntry* ViewerPaletteEntry::create ( HPalette* palette, const Name& name )
{
ViewerPaletteEntry* entry = new ViewerPaletteEntry ( palette, name );
@ -37,7 +37,7 @@ namespace Hurricane {
QHBoxLayout* layout = new QHBoxLayout ();
layout->setContentsMargins ( 0, 0, 0, 0 );
layout->addWidget ( new PaletteSample(this) );
layout->addWidget ( new HPaletteSample(this) );
_checkBox = new QCheckBox ( this );
_checkBox->setChecked ( true );

View File

@ -23,44 +23,46 @@ namespace Hurricane {
class Cell;
class Palette;
class HPalette;
//class MapView;
class CellWidget;
class HMousePosition;
class CellViewer : public QMainWindow {
Q_OBJECT;
public:
CellViewer ( QWidget* parent=NULL );
void setCell ( Cell* cell );
CellViewer ( QWidget* parent=NULL );
void setCell ( Cell* cell );
public slots:
void runInspectorOnDataBase ();
void runInspectorOnCell ();
void runInspectorOnDataBase ();
void runInspectorOnCell ();
protected:
QAction* _openAction;
QAction* _nextCellAction;
QAction* _previousCellAction;
QAction* _nextAction;
QAction* _saveAction;
QAction* _exitAction;
QAction* _refreshAction;
QAction* _fitToContentsAction;
QAction* _runInspectorOnDataBase;
QAction* _runInspectorOnCell;
QMenu* _fileMenu;
QMenu* _viewMenu;
QMenu* _toolsMenu;
//MapView* _mapView;
Palette* _palette;
CellWidget* _cellWidget;
QAction* _openAction;
QAction* _nextCellAction;
QAction* _previousCellAction;
QAction* _nextAction;
QAction* _saveAction;
QAction* _exitAction;
QAction* _refreshAction;
QAction* _fitToContentsAction;
QAction* _runInspectorOnDataBase;
QAction* _runInspectorOnCell;
QMenu* _fileMenu;
QMenu* _viewMenu;
QMenu* _toolsMenu;
//MapView* _mapView;
HPalette* _palette;
HMousePosition* _mousePosition;
CellWidget* _cellWidget;
protected:
void createActions ();
void createMenus ();
void createLayout ();
void runInspector ( Record* record );
void createActions ();
void createMenus ();
void createLayout ();
void runInspector ( Record* record );
};

View File

@ -20,7 +20,6 @@ class QResizeEvent;
class QMouseEvent;
class QKeyEvent;
class QAction;
class QStatusBar;
# include "hurricane/Commons.h"
@ -35,6 +34,7 @@ class QStatusBar;
namespace Hurricane {
class Technology;
class BasicLayer;
class Go;
class Cell;
@ -44,9 +44,8 @@ namespace Hurricane {
class Contact;
class Pad;
class PaletteEntry;
class Palette;
class DynamicLabel;
class HPaletteEntry;
class HPalette;
//class MapView;
@ -55,79 +54,82 @@ namespace Hurricane {
public:
// Constructor & Destructor.
CellWidget ( QWidget* parent=NULL );
virtual ~CellWidget ();
CellWidget ( QWidget* parent=NULL );
virtual ~CellWidget ();
// Accessors.
// MapView* getMapView () { return _mapView; };
void setCell ( Cell* cell );
inline Cell* getCell () const;
inline Palette* getPalette ();
inline QStatusBar* getStatusBar ();
inline bool showBoundaries () const;
// MapView* getMapView () { return _mapView; };
void setCell ( Cell* cell );
inline Cell* getCell () const;
inline HPalette* getPalette ();
void bindToPalette ( HPalette* palette );
void detachFromPalette ();
inline bool showBoundaries () const;
// Painter control & Hurricane objects drawing primitives.
void drawBoundaries ( const Cell* , const Box&, const Transformation& );
void drawBoundaries ( const Instance*, const Box&, const Transformation& );
bool isDrawable ( PaletteEntry* entry );
void drawCell ( const Cell* , const BasicLayer*, const Box&, const Transformation& );
void drawInstance ( const Instance*, const BasicLayer*, const Box&, const Transformation& );
void drawSlice ( const Slice* , const BasicLayer*, const Box&, const Transformation& );
void drawGo ( const Go* , const BasicLayer*, const Box&, const Transformation& );
void drawSegment ( const Segment* , const BasicLayer*, const Box&, const Transformation& );
void drawContact ( const Contact* , const BasicLayer*, const Box&, const Transformation& );
void drawPad ( const Pad* , const BasicLayer*, const Box&, const Transformation& );
void drawBox ( const Box& );
void drawLine ( const Point&, const Point& );
void drawGrid ();
void drawSpot ();
void drawBoundaries ( const Cell* , const Box&, const Transformation& );
void drawBoundaries ( const Instance*, const Box&, const Transformation& );
bool isDrawable ( const Name& entryName );
void drawCell ( const Cell* , const BasicLayer*, const Box&, const Transformation& );
void drawInstance ( const Instance*, const BasicLayer*, const Box&, const Transformation& );
void drawSlice ( const Slice* , const BasicLayer*, const Box&, const Transformation& );
void drawGo ( const Go* , const BasicLayer*, const Box&, const Transformation& );
void drawSegment ( const Segment* , const BasicLayer*, const Box&, const Transformation& );
void drawContact ( const Contact* , const BasicLayer*, const Box&, const Transformation& );
void drawPad ( const Pad* , const BasicLayer*, const Box&, const Transformation& );
void drawBox ( const Box& );
void drawLine ( const Point&, const Point& );
void drawGrid ();
void drawSpot ();
// Geometric conversions.
QRect dbuToDisplayRect ( DbU::Unit x1, DbU::Unit y1, DbU::Unit x2, DbU::Unit y2 ) const;
QRect dbuToDisplayRect ( const Box& box ) const;
QPoint dbuToDisplayPoint ( DbU::Unit x, DbU::Unit y ) const;
QPoint dbuToDisplayPoint ( const Point& point ) const;
inline int dbuToDisplayX ( DbU::Unit x ) const;
inline int dbuToDisplayY ( DbU::Unit y ) const;
inline int dbuToDisplayLength ( DbU::Unit length ) const;
inline int dbuToScreenX ( DbU::Unit x ) const;
inline int dbuToScreenY ( DbU::Unit y ) const;
QPoint dbuToScreenPoint ( DbU::Unit x, DbU::Unit y ) const;
inline QPoint dbuToScreenPoint ( const Point& point ) const;
inline DbU::Unit displayToDbuX ( int x ) const;
inline DbU::Unit displayToDbuY ( int y ) const;
inline DbU::Unit displayToDbuLength ( int length ) const;
inline Box displayToDbuBox ( const QRect& rect ) const;
inline DbU::Unit screenToDbuX ( int x ) const;
inline DbU::Unit screenToDbuY ( int y ) const;
inline Point screenToDbuPoint ( const QPoint& point ) const;
QRect dbuToDisplayRect ( DbU::Unit x1, DbU::Unit y1, DbU::Unit x2, DbU::Unit y2 ) const;
QRect dbuToDisplayRect ( const Box& box ) const;
QPoint dbuToDisplayPoint ( DbU::Unit x, DbU::Unit y ) const;
QPoint dbuToDisplayPoint ( const Point& point ) const;
inline int dbuToDisplayX ( DbU::Unit x ) const;
inline int dbuToDisplayY ( DbU::Unit y ) const;
inline int dbuToDisplayLength ( DbU::Unit length ) const;
inline int dbuToScreenX ( DbU::Unit x ) const;
inline int dbuToScreenY ( DbU::Unit y ) const;
QPoint dbuToScreenPoint ( DbU::Unit x, DbU::Unit y ) const;
inline QPoint dbuToScreenPoint ( const Point& point ) const;
inline DbU::Unit displayToDbuX ( int x ) const;
inline DbU::Unit displayToDbuY ( int y ) const;
inline DbU::Unit displayToDbuLength ( int length ) const;
inline Box displayToDbuBox ( const QRect& rect ) const;
inline DbU::Unit screenToDbuX ( int x ) const;
inline DbU::Unit screenToDbuY ( int y ) const;
inline Point screenToDbuPoint ( const QPoint& point ) const;
// Qt QWidget Functions Overloads.
void pushCursor ( Qt::CursorShape cursor );
void popCursor ();
QSize minimumSizeHint () const;
void paintEvent ( QPaintEvent* );
void resizeEvent ( QResizeEvent* );
void keyPressEvent ( QKeyEvent* );
void mouseMoveEvent ( QMouseEvent* );
void mousePressEvent ( QMouseEvent* );
void mouseReleaseEvent ( QMouseEvent* );
void pushCursor ( Qt::CursorShape cursor );
void popCursor ();
QSize minimumSizeHint () const;
void paintEvent ( QPaintEvent* );
void resizeEvent ( QResizeEvent* );
void keyPressEvent ( QKeyEvent* );
void mouseMoveEvent ( QMouseEvent* );
void mousePressEvent ( QMouseEvent* );
void mouseReleaseEvent ( QMouseEvent* );
signals:
void mousePositionChanged ( const Point& position );
public slots:
// Qt QWidget Slots Overload & CellWidget Specifics.
inline QPainter& getScreenPainter ();
void redraw ( QRect redrawArea );
inline void redraw ();
inline void copyToScreen ( int sx, int sy, int h, int w );
inline void copyToScreen ();
void goLeft ( int dx = 0 );
void goRight ( int dx = 0 );
void goUp ( int dy = 0 );
void goDown ( int dy = 0 );
void fitToContents ();
void setScale ( float scale );
void setShowBoundaries ( bool state );
void reframe ( const Box& box );
void displayReframe ();
void shiftLeft ( int dx );
void shiftRight ( int dx );
void shiftUp ( int dy );
void shiftDown ( int dy );
inline QPainter& getScreenPainter ();
void redraw ( QRect redrawArea );
inline void redraw ();
inline void copyToScreen ( int sx, int sy, int h, int w );
inline void copyToScreen ();
void goLeft ( int dx = 0 );
void goRight ( int dx = 0 );
void goUp ( int dy = 0 );
void goDown ( int dy = 0 );
void fitToContents ();
void setScale ( float scale );
void setShowBoundaries ( bool state );
void reframe ( const Box& box );
void displayReframe ();
void shiftLeft ( int dx );
void shiftRight ( int dx );
void shiftUp ( int dy );
void shiftDown ( int dy );
private:
class Spot {
@ -146,11 +148,9 @@ namespace Hurricane {
// Internal: Attributes.
static const int _stripWidth;
vector<Qt::CursorShape> _cursors;
QStatusBar* _statusBar;
// MapView* _mapView;
Palette* _palette;
DynamicLabel* _xPosition;
DynamicLabel* _yPosition;
Technology* _technology;
HPalette* _palette;
Box _displayArea;
Box _visibleArea;
float _scale;
@ -247,14 +247,10 @@ inline Cell* CellWidget::getCell () const
{ return _cell; }
inline Palette* CellWidget::getPalette ()
inline HPalette* CellWidget::getPalette ()
{ return _palette; }
inline QStatusBar* CellWidget::getStatusBar ()
{ return _statusBar; }
inline bool CellWidget::showBoundaries () const
{ return _showBoundaries; }

View File

@ -38,7 +38,6 @@ namespace Hurricane {
// Internal - Constructor.
DynamicLabel ( const DynamicLabel& );
DynamicLabel& operator= ( const DynamicLabel& );
};

View File

@ -2,26 +2,26 @@
// -*- C++ -*-
# ifndef __GROUP_PALETTE_ENTRY_H__
# define __GROUP_PALETTE_ENTRY_H__
# ifndef __GROUP_HPALETTE_ENTRY_H__
# define __GROUP_HPALETTE_ENTRY_H__
class QPushButton;
# include "hurricane/Name.h"
# include "hurricane/viewer/PaletteEntry.h"
# include "hurricane/viewer/HPaletteEntry.h"
namespace Hurricane {
class GroupPaletteEntry : public PaletteEntry {
class GroupPaletteEntry : public HPaletteEntry {
Q_OBJECT;
// Constructor.
public:
static GroupPaletteEntry* create ( Palette* palette, const Name& name );
static GroupPaletteEntry* create ( HPalette* palette, const Name& name );
// Methods.
public:
@ -44,7 +44,7 @@ namespace Hurricane {
bool _expanded;
// Internal - Constructor.
GroupPaletteEntry ( Palette* palette, const Name& name );
GroupPaletteEntry ( HPalette* palette, const Name& name );
GroupPaletteEntry ( const GroupPaletteEntry& );
GroupPaletteEntry& operator= ( const GroupPaletteEntry& );
virtual void _postCreate ();

View File

@ -0,0 +1,71 @@
// -*- C++ -*-
# ifndef __HPALETTE__
# define __HPALETTE__
# include <vector>
# include <QWidget>
# include <QScrollArea>
# include <QPixmap>
# include "hurricane/Commons.h"
class QCheckBox;
class QPushButton;
namespace Hurricane {
using namespace std;
class Name;
class BasicLayer;
class HPaletteEntry;
class CellWidget;
class HPalette : public QScrollArea {
Q_OBJECT;
public:
// Constructor.
HPalette ( QWidget* parent=NULL );
// Methods.
bool isDrawable ( size_t index );
inline CellWidget* getCellWidget ();
inline vector<HPaletteEntry*>& getEntries ();
void redrawCellWidget ();
HPaletteEntry* find ( const Name& name );
signals:
// Signals.
void paletteChanged ();
public slots:
// Slots.
void showAll ();
void hideAll ();
protected:
// Internal - Attributes.
vector<HPaletteEntry*> _entries;
QPushButton* _showAll;
QPushButton* _hideAll;
// Internal - Constructors.
HPalette ( const HPalette& );
HPalette& operator= ( const HPalette& );
};
// Inline Functions.
inline vector<HPaletteEntry*>& HPalette::getEntries () { return _entries; }
} // End of Hurricane namespace.
# endif

View File

@ -20,21 +20,21 @@ namespace Hurricane {
class Name;
class BasicLayer;
class Palette;
class PaletteEntry;
class HPalette;
class HPaletteEntry;
class PaletteSample : public QWidget {
class HPaletteSample : public QWidget {
Q_OBJECT;
// Constructor.
public:
PaletteSample ( PaletteEntry* entry );
HPaletteSample ( HPaletteEntry* entry );
// Internals - Attributes.
protected:
QPixmap _sample;
PaletteEntry* _entry;
HPaletteEntry* _entry;
// Internals - Methods.
void redraw ();
@ -43,7 +43,7 @@ namespace Hurricane {
};
class PaletteEntry : public QWidget {
class HPaletteEntry : public QWidget {
Q_OBJECT;
// Methods.
@ -61,13 +61,13 @@ namespace Hurricane {
// Internal - Attributes.
protected:
Palette* _palette;
HPalette* _palette;
// Internal - Constructor.
PaletteEntry ( Palette* palette );
PaletteEntry ( const PaletteEntry& );
PaletteEntry& operator= ( const PaletteEntry& );
virtual void _postCreate () = 0;
HPaletteEntry ( HPalette* palette );
HPaletteEntry ( const HPaletteEntry& );
HPaletteEntry& operator= ( const HPaletteEntry& );
virtual void _postCreate () = 0;
};

View File

@ -8,18 +8,18 @@
class QCheckBox;
# include "hurricane/viewer/PaletteEntry.h"
# include "hurricane/viewer/HPaletteEntry.h"
namespace Hurricane {
class LayerPaletteEntry : public PaletteEntry {
class LayerPaletteEntry : public HPaletteEntry {
Q_OBJECT;
// Constructor.
public:
static LayerPaletteEntry* create ( Palette* palette, BasicLayer* basicLayer );
static LayerPaletteEntry* create ( HPalette* palette, BasicLayer* basicLayer );
// Methods.
public:
@ -40,7 +40,7 @@ namespace Hurricane {
QCheckBox* _checkBox;
// Internal - Constructor.
LayerPaletteEntry ( Palette* palette, BasicLayer* basicLayer );
LayerPaletteEntry ( HPalette* palette, BasicLayer* basicLayer );
LayerPaletteEntry ( const LayerPaletteEntry& );
LayerPaletteEntry& operator= ( const LayerPaletteEntry& );
virtual void _postCreate ();

View File

@ -1,70 +0,0 @@
// -*- C++ -*-
# ifndef __PALETTE__
# define __PALETTE__
# include <vector>
# include <QWidget>
# include <QScrollArea>
# include <QPixmap>
# include "hurricane/Commons.h"
class QCheckBox;
class QPushButton;
namespace Hurricane {
using namespace std;
class Name;
class BasicLayer;
class PaletteEntry;
class CellWidget;
class Palette : public QScrollArea {
Q_OBJECT;
// Constructor.
public:
Palette ( CellWidget* cellWidget );
// Methods.
bool isDrawable ( size_t index );
inline CellWidget* getCellWidget ();
inline vector<PaletteEntry*>& getEntries ();
void redrawCellWidget ();
PaletteEntry* find ( const Name& name );
// Slots.
public slots:
void showAll ();
void hideAll ();
// Internal - Attributes.
protected:
CellWidget* _cellWidget;
vector<PaletteEntry*> _entries;
QPushButton* _showAll;
QPushButton* _hideAll;
// Internal - Constructors.
Palette ( const Palette& );
Palette& operator= ( const Palette& );
};
// Inline Functions.
inline CellWidget* Palette::getCellWidget () { return _cellWidget; }
inline vector<PaletteEntry*>& Palette::getEntries () { return _entries; }
} // End of Hurricane namespace.
# endif

View File

@ -9,18 +9,18 @@
class QCheckBox;
# include "hurricane/Name.h"
# include "hurricane/viewer/PaletteEntry.h"
# include "hurricane/viewer/HPaletteEntry.h"
namespace Hurricane {
class ViewerPaletteEntry : public PaletteEntry {
class ViewerPaletteEntry : public HPaletteEntry {
Q_OBJECT;
// Constructor.
public:
static ViewerPaletteEntry* create ( Palette* palette, const Name& name );
static ViewerPaletteEntry* create ( HPalette* palette, const Name& name );
// Methods.
public:
@ -41,7 +41,7 @@ namespace Hurricane {
QCheckBox* _checkBox;
// Internal - Constructor.
ViewerPaletteEntry ( Palette* palette, const Name& name );
ViewerPaletteEntry ( HPalette* palette, const Name& name );
ViewerPaletteEntry ( const ViewerPaletteEntry& );
ViewerPaletteEntry& operator= ( const ViewerPaletteEntry& );
virtual void _postCreate ();