* ./hurricane/src/hviewer :

- A whole bunch of forgotten files.
This commit is contained in:
Jean-Paul Chaput 2008-11-27 08:14:50 +00:00
parent 88c2d138ad
commit 9c4d322de1
14 changed files with 1919 additions and 0 deletions

View File

@ -0,0 +1,434 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | C O R I O L I S |
// | V L S I B a c k e n d D a t a - B a s e |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Module : "./ControllerWidget.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include <QFrame>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QCheckBox>
#include <QComboBox>
#include <hurricane/DataBase.h>
#include <hurricane/Cell.h>
#include <hurricane/viewer/Graphics.h>
#include <hurricane/viewer/CellWidget.h>
#include <hurricane/viewer/GraphicsWidget.h>
#include <hurricane/viewer/PaletteWidget.h>
#include <hurricane/viewer/DisplayFilterWidget.h>
#include <hurricane/viewer/NetlistWidget.h>
#include <hurricane/viewer/SelectionWidget.h>
#include <hurricane/viewer/InspectorWidget.h>
#include <hurricane/viewer/ControllerWidget.h>
namespace Hurricane {
// -------------------------------------------------------------------
// Class : "Hurricane::ControllerTab".
ControllerTab::ControllerTab ( QWidget* parent )
: QWidget(parent)
, _cellWidget(NULL)
{ }
void ControllerTab::setCellWidget ( CellWidget* cellWidget )
{
_cellWidget = cellWidget;
}
void ControllerTab::setCell ( Cell* )
{ }
void ControllerTab::updateTab ()
{ }
void ControllerTab::cellPreModificate ()
{ }
void ControllerTab::cellPostModificate ()
{ }
// -------------------------------------------------------------------
// Class : "Hurricane::TabNetlist".
TabNetlist::TabNetlist ( QWidget* parent )
: ControllerTab (parent)
, _netlistBrowser(new NetlistWidget())
, _synchronize (new QCheckBox())
{
_netlistBrowser->setObjectName ( "controller.tabNetlist.netlistBrowser" );
QVBoxLayout* wLayout = new QVBoxLayout ();
wLayout->setContentsMargins ( 10, 0, 10, 0 );
wLayout->setSpacing ( 0 );
_synchronize->setText ( tr("Synchronize Netlist") );
_synchronize->setChecked ( false );
_synchronize->setFont ( Graphics::getFixedFont(QFont::Bold,false,false) );
connect ( _synchronize, SIGNAL(toggled(bool)), this, SLOT(setSynchronize(bool)) );
QHBoxLayout* commands = new QHBoxLayout ();
commands->setContentsMargins ( 0, 0, 0, 0 );
commands->addStretch ();
commands->addWidget ( _synchronize );
commands->addStretch ();
wLayout->addLayout ( commands );
QFrame* separator = new QFrame ();
separator->setFrameShape ( QFrame::HLine );
separator->setFrameShadow ( QFrame::Sunken );
wLayout->addWidget ( separator );
wLayout->addWidget ( _netlistBrowser );
setLayout ( wLayout );
}
void TabNetlist::setSynchronize ( bool state )
{
if ( state && getCellWidget() ) {
_netlistBrowser->setCell<SimpleNetInformations> ( getCellWidget()->getCell() );
} else {
_netlistBrowser->setCell<SimpleNetInformations> ( NULL );
}
}
void TabNetlist::setCell ( Cell* cell )
{
setSynchronize ( _synchronize->isChecked() );
}
void TabNetlist::setCellWidget ( CellWidget* cellWidget )
{
if ( getCellWidget() != cellWidget ) {
setCellWidget ( cellWidget );
if ( getCellWidget() ) {
connect ( getCellWidget(), SIGNAL(cellChanged(Cell*)) , this , SLOT(setCell(Cell*)) );
connect ( _netlistBrowser, SIGNAL(netSelected(const Net*)), getCellWidget(), SLOT(select(const Net*)) );
}
setSynchronize ( _synchronize->isChecked() );
}
}
void TabNetlist::cellPreModificate ()
{
_netlistBrowser->setCell<SimpleNetInformations> ( NULL );
}
void TabNetlist::cellPostModificate ()
{
setSynchronize ( _synchronize->isChecked() );
}
// -------------------------------------------------------------------
// Class : "Hurricane::TabSelection".
TabSelection::TabSelection ( QWidget* parent )
: QWidget (parent)
, _cellWidget(NULL)
, _selection (new SelectionWidget())
{
_selection->setObjectName ( "controller.tabSelection.selection" );
QVBoxLayout* wLayout = new QVBoxLayout ();
wLayout->setContentsMargins ( 10, 10, 10, 0 );
wLayout->addWidget ( _selection );
setLayout ( wLayout );
}
void TabSelection::setCell ( Cell* cell )
{
_selection->setSelection ( set<Selector*>() );
}
void TabSelection::setCellWidget ( CellWidget* cellWidget )
{
if ( _cellWidget != cellWidget ) {
_cellWidget = cellWidget;
if ( _cellWidget ) {
connect ( _cellWidget , SIGNAL(cellChanged(Cell*))
, this , SLOT(setCell(Cell*)) );
connect ( _cellWidget , SIGNAL(selectionChanged(const set<Selector*>&,Cell*))
, _selection , SLOT (setSelection (const set<Selector*>&,Cell*)) );
connect ( _selection , SIGNAL(occurrenceToggled(Occurrence,bool))
, _cellWidget , SLOT (toggleSelect (Occurrence,bool)) );
connect ( _cellWidget , SIGNAL(occurrenceToggled(Occurrence))
, _selection , SLOT (toggleSelection (Occurrence)) );
connect ( _selection , SIGNAL(cumulativeToggled (bool))
, _cellWidget , SLOT (setCumulativeSelection(bool)) );
connect ( _selection , SIGNAL(showSelectionToggled(bool))
, _cellWidget , SLOT (setShowSelection (bool)) );
connect ( _cellWidget , SIGNAL(showSelectionToggled(bool))
, _selection , SLOT (setShowSelection (bool)) );
connect ( _selection , SIGNAL(selectionCleared())
, _cellWidget , SLOT (unselectAll ()) );
}
}
}
void TabSelection::updateTab ()
{
// if ( _cellWidget && _cellWidget->getCell() )
// _selection->setSelection ( _cellWidget->getSelectorSet(), _cellWidget->getCell() );
// else
// _selection->setSelection ( set<Selector*>() );
}
void TabSelection::cellPreModificate ()
{
_selection->setSelection ( set<Selector*>() );
}
void TabSelection::cellPostModificate ()
{
//updateTab ();
if ( _cellWidget && _cellWidget->getCell() )
_selection->setSelection ( _cellWidget->getSelectorSet(), _cellWidget->getCell() );
else
_selection->setSelection ( set<Selector*>() );
}
// -------------------------------------------------------------------
// Class : "Hurricane::TabInspector".
TabInspector::TabInspector ( QWidget* parent )
: QWidget (parent)
, _cellWidget (NULL)
, _inspectorWidget (new InspectorWidget())
, _bookmarks (new QComboBox())
, _selectionRecord (NULL)
, _updateFromSelection(false)
{
_inspectorWidget->setObjectName ( "controller.tabInspector.inspectorWidget" );
connect ( _bookmarks, SIGNAL(currentIndexChanged(int)), this, SLOT(bookmarkChanged(int)) );
QVBoxLayout* wLayout = new QVBoxLayout ();
wLayout->setContentsMargins ( 10, 10, 10, 0 );
//wLayout->setSpacing ( 0 );
_bookmarks->addItem ( tr("<Disabled>" ) );
_bookmarks->addItem ( tr("<DataBase>" ) );
_bookmarks->addItem ( tr("<Cell None>") );
_bookmarks->addItem ( tr("<Selection>") );
QHBoxLayout* commands = new QHBoxLayout ();
commands->setContentsMargins ( 0, 0, 0, 0 );
commands->addStretch ();
commands->addWidget ( _bookmarks );
commands->addStretch ();
wLayout->addLayout ( commands );
QFrame* separator = new QFrame ();
separator->setFrameShape ( QFrame::HLine );
separator->setFrameShadow ( QFrame::Sunken );
wLayout->addWidget ( separator );
wLayout->addWidget ( _inspectorWidget );
setLayout ( wLayout );
}
void TabInspector::setCell ( Cell* cell )
{
_bookmarks->setItemText ( 2, getString(cell).c_str() );
if ( _bookmarks->currentIndex() == 2 )
emit bookmarkChanged ( 2 );
}
void TabInspector::setCellWidget ( CellWidget* cellWidget )
{
if ( _cellWidget != cellWidget ) {
_cellWidget = cellWidget;
if ( _cellWidget ) {
connect ( _cellWidget, SIGNAL(cellChanged(Cell*)), this, SLOT(setCell(Cell*)) );
}
}
}
void TabInspector::bookmarkChanged ( int index )
{
switch ( index ) {
case 0: _inspectorWidget->setRootRecord ( NULL ); break;
case 1: _inspectorWidget->setRootRecord ( getRecord(DataBase::getDB()) ); break;
case 2:
if ( _cellWidget && _cellWidget->getCell() )
_inspectorWidget->setRootRecord ( getRecord(_cellWidget->getCell()) );
break;
case 3:
if ( _cellWidget && _cellWidget->getCell() )
_inspectorWidget->setRootRecord ( _selectionRecord );
break;
}
}
void TabInspector::updateTab ()
{
if ( _updateFromSelection && (_bookmarks->currentIndex() == 3) )
_inspectorWidget->setRootRecord ( _selectionRecord );
_updateFromSelection = false;
}
void TabInspector::setSelectionRecord ( Record* record )
{
_updateFromSelection = true;
_selectionRecord = record;
}
void TabInspector::cellPreModificate ()
{
_selectionRecord = NULL;
if ( _bookmarks->currentIndex() > 1 )
_inspectorWidget->setRootRecord ( NULL );
}
void TabInspector::cellPostModificate ()
{
if ( ( _bookmarks->currentIndex() == 2 ) && _cellWidget && _cellWidget->getCell() )
_inspectorWidget->setRootRecord ( getRecord(_cellWidget->getCell()) );
}
// -------------------------------------------------------------------
// Class : "Hurricane::ControllerWidget".
ControllerWidget::ControllerWidget ( QWidget* parent )
: QTabWidget (parent)
, _cellWidget (NULL)
, _graphics (new GraphicsWidget())
, _palette (new PaletteWidget())
, _displayFilter(new DisplayFilterWidget())
, _tabNetlist (new TabNetlist())
, _tabSelection (new TabSelection())
, _tabInspector (new TabInspector())
{
setObjectName ( "controller" );
setAttribute ( Qt::WA_QuitOnClose, false );
setWindowTitle ( tr("Controller") );
//connect ( _netlistBrowser, SIGNAL(destroyed()), this, SLOT(netlistBrowserDestroyed()) );
_graphics ->setObjectName ( "controller.graphics" );
_palette ->setObjectName ( "controller.palette" );
_displayFilter->setObjectName ( "controller.displayFilter" );
_tabNetlist ->setObjectName ( "controller.tabNetlist" );
_tabSelection ->setObjectName ( "controller.tabSelection" );
_tabInspector ->setObjectName ( "controller.tabInspector" );
addTab ( _graphics , "Look" );
addTab ( _displayFilter , "Filter" );
addTab ( _palette , "Layers&&Gos" );
addTab ( _tabNetlist , "Netlist" );
addTab ( _tabSelection , "Selection" );
addTab ( _tabInspector , "Inspector" );
connect ( this, SIGNAL(currentChanged(int)), this, SLOT(updateTab(int)) );
//connect ( _tabNetlist->getNetlistBrowser(), SIGNAL(netSelected(const Net*))
// , _tabSelection , SLOT(setUpdateFromNetlist(const Net*)) );
connect ( _tabSelection->getSelection() , SIGNAL(inspect(Record*))
, _tabInspector , SLOT(setSelectionRecord(Record*)) );
resize ( 540, 540 );
}
void ControllerWidget::setCellWidget ( CellWidget* widget )
{
if ( _cellWidget )
_cellWidget->detachFromPalette ();
_cellWidget = widget;
if ( _cellWidget ) {
_displayFilter->setCellWidget ( _cellWidget );
_tabNetlist ->setCellWidget ( _cellWidget );
_tabSelection ->setCellWidget ( _cellWidget );
_tabInspector ->setCellWidget ( _cellWidget );
_cellWidget ->bindToPalette ( _palette );
connect ( _graphics , SIGNAL(styleChanged()) , _cellWidget, SLOT(redraw()) );
connect ( _cellWidget, SIGNAL(cellChanged(Cell*)) , this , SLOT(cellChanged(Cell*)) );
connect ( _cellWidget, SIGNAL(cellPreModificated()) , this , SLOT(cellPreModificate()) );
connect ( _cellWidget, SIGNAL(cellPostModificated()), this , SLOT(cellPostModificate()) );
}
}
void ControllerWidget::cellChanged ( Cell* cell )
{ }
void ControllerWidget::updateTab ( int index )
{
switch ( index ) {
case 4: _tabSelection->updateTab (); break;
case 5: _tabInspector->updateTab (); break;
}
}
void ControllerWidget::cellPreModificate ()
{
_tabInspector ->cellPreModificate ();
_tabSelection ->cellPreModificate ();
_tabNetlist ->cellPreModificate ();
}
void ControllerWidget::cellPostModificate ()
{
_tabNetlist ->cellPostModificate ();
_tabSelection ->cellPostModificate ();
_tabInspector ->cellPostModificate ();
}
} // End of Hurricane namespace.

View File

@ -0,0 +1,85 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | H U R R I C A N E |
// | V L S I B a c k e n d D a t a - B a s e |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Module : "./PaletteExtensionGoItem.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include <QCheckBox>
#include <QHBoxLayout>
#include "hurricane/viewer/Graphics.h"
#include "hurricane/viewer/PaletteExtensionGoItem.h"
namespace Hurricane {
PaletteExtensionGoItem::PaletteExtensionGoItem ( const Name& name )
: PaletteItem()
, _name(name)
{ }
PaletteExtensionGoItem* PaletteExtensionGoItem::create ( const Name& name )
{
PaletteExtensionGoItem* item = new PaletteExtensionGoItem ( name );
item->_postCreate ();
return item;
}
void PaletteExtensionGoItem::_postCreate ()
{
QHBoxLayout* layout = new QHBoxLayout ();
layout->setContentsMargins ( 0, 0, 0, 0 );
_checkBox = new QCheckBox ( this );
_checkBox->setChecked ( false );
_checkBox->setText ( getString(getName()).c_str() );
_checkBox->setFont ( Graphics::getFixedFont() );
layout->addWidget ( _checkBox );
setLayout ( layout );
connect ( _checkBox, SIGNAL(clicked()), this, SIGNAL(toggled()) );
}
const Name& PaletteExtensionGoItem::getName () const
{
return _name;
}
bool PaletteExtensionGoItem::isChecked () const
{
return _checkBox->isChecked ();
}
void PaletteExtensionGoItem::setChecked ( bool state )
{
_checkBox->setChecked ( state );
}
} // End of Hurricane namespace.

View File

@ -0,0 +1,81 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | H U R R I C A N E |
// | V L S I B a c k e n d D a t a - B a s e |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Module : "./PaletteItem.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
# include <QPainter>
# include "hurricane/viewer/Graphics.h"
# include "hurricane/viewer/PaletteItem.h"
namespace Hurricane {
// -------------------------------------------------------------------
// Class : "Hurricane::DrawingStyleSample".
DrawingStyleSample::DrawingStyleSample ( PaletteItem* entry )
: QWidget()
, _sample(QSize(20,20))
, _entry(entry)
{
setAttribute ( Qt::WA_StaticContents );
setSizePolicy ( QSizePolicy::Fixed, QSizePolicy::Fixed );
setFixedSize ( 20, 20 );
redraw ();
}
void DrawingStyleSample::redraw ()
{
QPainter painter ( &_sample );
painter.setPen ( Qt::NoPen );
painter.setBackground ( Graphics::getBrush("background") );
painter.eraseRect ( 0, 0, 20, 20 );
painter.setPen ( Graphics::getPen (_entry->getName()) );
painter.setBrush ( Graphics::getBrush(_entry->getName()) );
painter.drawRect ( 2, 2, 16, 16 );
}
void DrawingStyleSample::paintEvent ( QPaintEvent* )
{
QPainter painter ( this );
painter.drawPixmap ( 0, 0, _sample );
}
// -------------------------------------------------------------------
// Class : "Hurricane::PaletteItem".
PaletteItem::PaletteItem ()
: QWidget()
{ }
} // End of Hurricane namespace.

View File

@ -0,0 +1,84 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | H U R R I C A N E |
// | V L S I B a c k e n d D a t a - B a s e |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Module : "./PaletteLayerItem.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
# include <QCheckBox>
# include <QHBoxLayout>
# include "hurricane/BasicLayer.h"
# include "hurricane/viewer/Graphics.h"
# include "hurricane/viewer/PaletteLayerItem.h"
namespace Hurricane {
PaletteLayerItem::PaletteLayerItem ( BasicLayer* basicLayer, bool checked )
: PaletteItem()
, _basicLayer(basicLayer)
{
QHBoxLayout* layout = new QHBoxLayout ();
layout->setContentsMargins ( 0, 0, 0, 0 );
layout->addWidget ( new DrawingStyleSample(this) );
_checkBox = new QCheckBox ( this );
_checkBox->setChecked ( checked );
_checkBox->setText ( getString(getName()).c_str() );
_checkBox->setFont ( Graphics::getFixedFont() );
layout->addWidget ( _checkBox );
setLayout ( layout );
connect ( _checkBox, SIGNAL(clicked()), this, SIGNAL(toggled()) );
}
PaletteLayerItem* PaletteLayerItem::create ( BasicLayer* basicLayer, bool checked )
{
PaletteLayerItem* item = new PaletteLayerItem ( basicLayer, checked );
return item;
}
const Name& PaletteLayerItem::getName () const
{
return _basicLayer->getName();
}
bool PaletteLayerItem::isChecked () const
{
return _checkBox->isChecked ();
}
void PaletteLayerItem::setChecked ( bool state )
{
_checkBox->setChecked ( state );
}
} // End of Hurricane namespace.

View File

@ -0,0 +1,80 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | H U R R I C A N E |
// | V L S I B a c k e n d D a t a - B a s e |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Module : "./PaletteNamedItem.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include <QCheckBox>
#include <QHBoxLayout>
#include "hurricane/viewer/Graphics.h"
#include "hurricane/viewer/PaletteNamedItem.h"
namespace Hurricane {
PaletteNamedItem::PaletteNamedItem ( const Name& name, bool checked )
: PaletteItem()
, _name(name)
{
QHBoxLayout* layout = new QHBoxLayout ();
layout->setContentsMargins ( 0, 0, 0, 0 );
_checkBox = new QCheckBox ( this );
_checkBox->setChecked ( checked );
_checkBox->setText ( getString(getName()).c_str() );
_checkBox->setFont ( Graphics::getFixedFont() );
layout->addWidget ( _checkBox );
setLayout ( layout );
connect ( _checkBox, SIGNAL(clicked()), this, SIGNAL(toggled()) );
}
PaletteNamedItem* PaletteNamedItem::create ( const Name& name, bool checked )
{
PaletteNamedItem* item = new PaletteNamedItem ( name, checked );
return item;
}
const Name& PaletteNamedItem::getName () const
{
return _name;
}
bool PaletteNamedItem::isChecked () const
{
return _checkBox->isChecked ();
}
void PaletteNamedItem::setChecked ( bool state )
{
_checkBox->setChecked ( state );
}
} // End of Hurricane namespace.

View File

@ -0,0 +1,360 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | H U R R I C A N E |
// | V L S I B a c k e n d D a t a - B a s e |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Module : "./PaletteWidget.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include <QLabel>
#include <QCheckBox>
#include <QPushButton>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QGridLayout>
#include "hurricane/DataBase.h"
#include "hurricane/Technology.h"
#include "hurricane/BasicLayer.h"
#include "hurricane/BasicLayers.h"
#include "hurricane/ExtensionSlice.h"
#include "hurricane/Cell.h"
#include "hurricane/viewer/Graphics.h"
#include "hurricane/viewer/PaletteItem.h"
#include "hurricane/viewer/PaletteLayerItem.h"
#include "hurricane/viewer/PaletteNamedItem.h"
#include "hurricane/viewer/PaletteWidget.h"
namespace {
using namespace std;
using namespace Hurricane;
class GridBuffer {
public:
GridBuffer ( QGridLayout*, int rowMax, int startRow=0, int startColumn=0 );
inline int getRow () const;
inline int getColumn () const;
inline int getCurrentRow () const;
void addSection ( QWidget*, Qt::Alignment align=0 );
void addWidget ( QWidget*, Qt::Alignment align=0 );
void newColumn ();
void flushWidgets ();
inline bool columnOverload () const;
protected:
QGridLayout* _grid;
int _rowMax;
int _row;
int _column;
vector<QWidget*> _widgets;
vector<Qt::Alignment> _aligns;
};
GridBuffer::GridBuffer ( QGridLayout* grid, int maxRow, int startRow, int startColumn )
: _grid(grid)
, _rowMax(maxRow)
, _row(startRow)
, _column(startColumn)
, _widgets()
, _aligns()
{ }
inline int GridBuffer::getRow () const { return _row; }
inline int GridBuffer::getColumn () const { return _column; }
inline int GridBuffer::getCurrentRow () const { return _widgets.size() + _row; }
inline bool GridBuffer::columnOverload () const { return getCurrentRow() > _rowMax; }
void GridBuffer::flushWidgets ()
{
if ( columnOverload() ) {
_column++;
_row = 0;
}
for ( size_t i=0 ; i < _widgets.size() ; ++i )
_grid->addWidget ( _widgets[i], _row++, _column, _aligns[i] );
_widgets.clear ();
_aligns.clear ();
}
void GridBuffer::newColumn ()
{
if ( columnOverload() ) return;
flushWidgets ();
_column++;
_row = 0;
}
void GridBuffer::addWidget ( QWidget* widget, Qt::Alignment align )
{
_widgets.push_back ( widget );
_aligns .push_back ( align );
}
void GridBuffer::addSection ( QWidget* widget, Qt::Alignment align )
{
flushWidgets ();
_widgets.push_back ( widget );
_aligns .push_back ( align );
}
} // End of anonymous namespace.
namespace Hurricane {
QWidget* PaletteWidget::_createGroupItem ( const Name& name )
{
QLabel* groupLabel = new QLabel ();
groupLabel->setText ( getString(name).c_str() );
groupLabel->setFont ( Graphics::getFixedFont(QFont::Bold,false,false) );
return groupLabel;
}
PaletteNamedItem* PaletteWidget::_createNamedItem ( const Name& name, bool checked )
{
PaletteNamedItem* item = PaletteNamedItem::create ( name, checked );
connect ( item, SIGNAL(toggled()), this, SIGNAL(paletteChanged()) );
return item;
}
PaletteLayerItem* PaletteWidget::_createLayerItem ( BasicLayer* layer, bool checked )
{
PaletteLayerItem* item = PaletteLayerItem::create ( layer, checked );
connect ( item, SIGNAL(toggled()), this, SIGNAL(paletteChanged()) );
return item;
}
PaletteWidget::PaletteWidget ( QWidget* parent ) : QScrollArea(parent)
, _layerItems()
, _extensionGoItems()
, _showAll(new QPushButton(this))
, _hideAll(new QPushButton(this))
, _grid(new QGridLayout())
, _extensionRow(0)
, _extensionColumn(0)
, _extensionGroup(NULL)
{
setWidgetResizable ( true );
QVBoxLayout* vLayout = new QVBoxLayout ();
QHBoxLayout* hLayout = new QHBoxLayout ();
_showAll->setIcon ( QIcon(":/images/palette_show_all.png") );
_showAll->setFlat ( true );
_hideAll->setIcon ( QIcon(":/images/palette_hide_all.png") );
_hideAll->setFlat ( true );
connect ( _showAll, SIGNAL(clicked()), this, SLOT(showAll()) );
connect ( _hideAll, SIGNAL(clicked()), this, SLOT(hideAll()) );
hLayout->addStretch ();
hLayout->addWidget ( _showAll );
hLayout->addStretch ();
hLayout->addWidget ( _hideAll );
hLayout->addStretch ();
QFrame* separator = new QFrame ();
separator->setFrameShape ( QFrame::HLine );
separator->setFrameShadow ( QFrame::Sunken );
vLayout->setSpacing ( 0 );
vLayout->addLayout ( hLayout );
vLayout->addWidget ( separator );
vLayout->addSpacing ( 5 );
vLayout->addLayout ( _grid );
GridBuffer gridBuffer ( _grid, 22 );
_grid->setHorizontalSpacing ( 10 );
_grid->setVerticalSpacing ( 0 );
//_grid->setSizeConstraint ( QLayout::SetFixedSize );
size_t gi = 0;
const vector<DrawingGroup*>& groups = Graphics::getStyle()->getDrawingGroups();
const vector<DrawingStyle*>& styles = groups[gi]->getDrawingStyles();
gridBuffer.addSection ( _createGroupItem(groups[gi]->getName()), Qt::AlignHCenter );
for ( size_t si=0 ; si<styles.size() ; si++ ) {
if ( styles[si]->getName() == DisplayStyle::Foreground ) continue;
if ( styles[si]->getName() == DisplayStyle::Background ) continue;
if ( styles[si]->getName() == DisplayStyle::Foreground ) continue;
if ( styles[si]->getName() == DisplayStyle::SelectionDraw ) continue;
if ( styles[si]->getName() == DisplayStyle::SelectionFill ) continue;
if ( styles[si]->getName() == DisplayStyle::Foreground ) continue;
PaletteNamedItem* item = _createNamedItem ( styles[si]->getName() );
gridBuffer.addWidget ( item );
_layerItems [ item->getName() ] = item;
}
gridBuffer.newColumn ();
DataBase* database = DataBase::getDB();
if ( database ) {
Technology* technology = database->getTechnology();
if ( technology ) {
for ( gi=1 ; gi<groups.size() ; gi++ ) {
gridBuffer.addSection ( _createGroupItem(groups[gi]->getName()), Qt::AlignHCenter );
const vector<DrawingStyle*>& styles = groups[gi]->getDrawingStyles();
for ( size_t si=0 ; si<styles.size() ; si++ ) {
BasicLayer* basicLayer = technology->getBasicLayer ( styles[si]->getName() );
if ( basicLayer ) {
PaletteLayerItem* item = _createLayerItem ( basicLayer );
gridBuffer.addWidget ( item );
_layerItems [ item->getName() ] = item;
}
}
}
size_t si = 0;
forEach ( BasicLayer*, basicLayer, technology->getBasicLayers() ) {
if ( !find((*basicLayer)->getName()) ) {
if ( !si )
gridBuffer.addSection ( _createGroupItem("Unmatcheds"), Qt::AlignHCenter );
PaletteLayerItem* item = _createLayerItem ( *basicLayer );
gridBuffer.addWidget ( item );
_layerItems [ item->getName() ] = item;
cerr << "[WARNING] BasicLayer \"" << (*basicLayer)->getName()
<< "\" has no associated DisplayStyle." << endl;
si++;
}
}
if ( si ) gi++;
}
}
gridBuffer.newColumn ();
_extensionRow = gridBuffer.getRow();
_extensionColumn = gridBuffer.getColumn();
_extensionGroup = _createGroupItem ( "Extensions" );
gridBuffer.addSection ( _extensionGroup, Qt::AlignHCenter );
gridBuffer.flushWidgets ();
vLayout->addStretch ();
QWidget* adaptator = new QWidget ();
adaptator->setLayout ( vLayout );
setWidget ( adaptator );
setHorizontalScrollBarPolicy ( Qt::ScrollBarAsNeeded );
setVerticalScrollBarPolicy ( Qt::ScrollBarAsNeeded );
setFrameStyle ( QFrame::Plain );
}
void PaletteWidget::updateExtensions ( Cell* cell )
{
_grid->removeWidget ( _extensionGroup );
_extensionGroup->deleteLater ();
_extensionGroup = NULL;
PaletteItems::iterator iextension = _extensionGoItems.begin();
for ( ; iextension != _extensionGoItems.end() ; ++iextension ) {
_grid->removeWidget ( iextension->second );
iextension->second->deleteLater ();
}
_extensionGoItems.clear ();
if ( !cell ) return;
GridBuffer gridBuffer ( _grid, 22, _extensionRow, _extensionColumn );
_extensionGroup = _createGroupItem ( "Extensions" );
gridBuffer.addSection ( _extensionGroup, Qt::AlignHCenter );
forEach ( ExtensionSlice*, extension, cell->getExtensionSlices() ) {
PaletteNamedItem* item = _createNamedItem ( (*extension)->getName(), false );
gridBuffer.addWidget ( item );
_extensionGoItems [ item->getName() ] = item;
}
gridBuffer.flushWidgets ();
}
bool PaletteWidget::isDrawable ( const Name& name ) const
{
PaletteItem* item = find ( name );
if ( item )
return item->isChecked ();
return false;
}
void PaletteWidget::showAll ()
{
PaletteItems::iterator iitem = _layerItems.begin();
for ( ; iitem != _layerItems.end() ; iitem++ )
iitem->second->setChecked ( true );
iitem = _extensionGoItems.begin();
for ( ; iitem != _extensionGoItems.end() ; iitem++ )
iitem->second->setChecked ( true );
emit paletteChanged();
}
void PaletteWidget::hideAll ()
{
PaletteItems::iterator iitem = _layerItems.begin();
for ( ; iitem != _layerItems.end() ; iitem++ )
iitem->second->setChecked ( false );
iitem = _extensionGoItems.begin();
for ( ; iitem != _extensionGoItems.end() ; iitem++ )
iitem->second->setChecked ( false );
emit paletteChanged();
}
PaletteItem* PaletteWidget::find ( const Name& name ) const
{
PaletteItems::const_iterator iitem = _layerItems.find(name);
if ( iitem != _layerItems.end() )
return iitem->second;
iitem = _extensionGoItems.find(name);
if ( iitem != _extensionGoItems.end() )
return iitem->second;
return NULL;
}
} // End of Hurricane namespace.

View File

@ -0,0 +1,125 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | C O R I O L I S |
// | V L S I B a c k e n d D a t a - B a s e |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Header : "./SelectorCommand.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include "hurricane/viewer/CellWidget.h"
#include "hurricane/viewer/SelectorCommand.h"
namespace Hurricane {
// -------------------------------------------------------------------
// Class : "Hurricane::SelectorCommand".
SelectorCommand::~SelectorCommand ()
{ }
// -------------------------------------------------------------------
// Class : "Hurricane::NetSelectorCommand".
NetSelectorCommand::NetSelectorCommand ( const Net* net )
: _net(net)
{ }
NetSelectorCommand::~NetSelectorCommand ()
{ }
const Net* NetSelectorCommand::getNet () const
{ return _net; }
void NetSelectorCommand::doSelection ( CellWidget* cw, bool delayRedraw )
{
cw->_select ( _net, delayRedraw );
}
string NetSelectorCommand::_getTypeName () const
{ return "NetSelectorCommand"; }
string NetSelectorCommand::_getString () const
{
string s = "<" + _getTypeName() + " " + getString(_net) + ">";
return s;
}
Record* NetSelectorCommand::_getRecord () const
{
Record* record = new Record ( _getString() );
record->add ( getSlot("_net",_net) );
return record;
}
// -------------------------------------------------------------------
// Class : "Hurricane::AreaSelectorCommand".
AreaSelectorCommand::AreaSelectorCommand ( const Box& area )
: _area(area)
{ }
AreaSelectorCommand::~AreaSelectorCommand ()
{ }
const Box& AreaSelectorCommand::getArea () const
{ return _area; }
void AreaSelectorCommand::doSelection ( CellWidget* cw, bool delayRedraw )
{
cw->_selectOccurrencesUnder ( _area );
}
string AreaSelectorCommand::_getTypeName () const
{ return "AreaSelectorCommand"; }
string AreaSelectorCommand::_getString () const
{
string s = "<" + _getTypeName() + " " + getString(_area) + ">";
return s;
}
Record* AreaSelectorCommand::_getRecord () const
{
Record* record = new Record ( _getString() );
record->add ( getSlot("_area",&_area) );
return record;
}
} // End of Hurricane namespace.

View File

@ -0,0 +1,213 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | C O R I O L I S |
// | V L S I B a c k e n d D a t a - B a s e |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Header : "./ControllerWidget.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __HURRICANE_CONTROLLER_WIDGET__
#define __HURRICANE_CONTROLLER_WIDGET__
#include <QTabWidget>
class QCheckBox;
class QComboBox;
namespace Hurricane {
class Record;
class Net;
class Cell;
class CellWidget;
class PaletteWidget;
class GraphicsWidget;
class DisplayFilterWidget;
class NetlistWidget;
class SelectionWidget;
class InspectorWidget;
// -------------------------------------------------------------------
// Class : "Hurricane::ControllerTab".
class ControllerTab : public QWidget {
Q_OBJECT;
public:
ControllerTab ( QWidget* parent=NULL );
inline CellWidget* getCellWidget ();
public slots:
virtual void setCellWidget ( CellWidget* );
virtual void setCell ( Cell* );
virtual void updateTab ();
virtual void cellPreModificate ();
virtual void cellPostModificate ();
protected:
CellWidget* _cellWidget;
};
inline CellWidget* ControllerTab::getCellWidget () { return _cellWidget; }
// -------------------------------------------------------------------
// Class : "Hurricane::TabNetlist".
class TabNetlist : public ControllerTab {
Q_OBJECT;
public:
TabNetlist ( QWidget* parent=NULL );
inline NetlistWidget* getNetlistBrowser ();
inline QCheckBox* getSyncButton ();
virtual void cellPreModificate ();
virtual void cellPostModificate ();
public slots:
virtual void setCell ( Cell* );
virtual void setCellWidget ( CellWidget* );
virtual void setSynchronize ( bool );
protected:
NetlistWidget* _netlistBrowser;
QCheckBox* _synchronize;
};
inline NetlistWidget* TabNetlist::getNetlistBrowser () { return _netlistBrowser; }
inline QCheckBox* TabNetlist::getSyncButton () { return _synchronize; }
// -------------------------------------------------------------------
// Class : "Hurricane::TabSelection".
class TabSelection : public QWidget {
Q_OBJECT;
public:
TabSelection ( QWidget* parent=NULL );
inline CellWidget* getCellWidget ();
inline SelectionWidget* getSelection ();
void updateTab ();
void cellPreModificate ();
void cellPostModificate ();
public slots:
void setCell ( Cell* );
void setCellWidget ( CellWidget* );
protected:
CellWidget* _cellWidget;
SelectionWidget* _selection;
bool _selectionChanged;
};
inline CellWidget* TabSelection::getCellWidget () { return _cellWidget; }
inline SelectionWidget* TabSelection::getSelection () { return _selection; }
// -------------------------------------------------------------------
// Class : "Hurricane::TabInspector".
class TabInspector : public QWidget {
Q_OBJECT;
public:
TabInspector ( QWidget* parent=NULL );
inline CellWidget* getCellWidget ();
inline InspectorWidget* getInspectorWidget ();
inline QComboBox* getBookmarks ();
void updateTab ();
void cellPreModificate ();
void cellPostModificate ();
public slots:
void setCell ( Cell* );
void setCellWidget ( CellWidget* );
void setSelectionRecord ( Record* );
void bookmarkChanged ( int index );
protected:
CellWidget* _cellWidget;
InspectorWidget* _inspectorWidget;
QComboBox* _bookmarks;
Record* _selectionRecord;
bool _updateFromSelection;
};
inline CellWidget* TabInspector::getCellWidget () { return _cellWidget; }
inline InspectorWidget* TabInspector::getInspectorWidget () { return _inspectorWidget; }
inline QComboBox* TabInspector::getBookmarks () { return _bookmarks; }
// -------------------------------------------------------------------
// Class : "Hurricane::ControllerWidget".
class ControllerWidget : public QTabWidget {
Q_OBJECT;
public:
ControllerWidget ( QWidget* parent=NULL );
inline CellWidget* getCellWidget ();
inline GraphicsWidget* getGraphics ();
inline PaletteWidget* getPalette ();
inline DisplayFilterWidget* getDisplayFilter ();
inline NetlistWidget* getNetlistBrowser ();
inline SelectionWidget* getSelection ();
inline InspectorWidget* getInspectorWidget ();
void setCellWidget ( CellWidget* );
public slots:
void cellPreModificate ();
void cellPostModificate ();
void cellChanged ( Cell* );
void updateTab ( int index );
protected:
CellWidget* _cellWidget;
GraphicsWidget* _graphics;
PaletteWidget* _palette;
DisplayFilterWidget* _displayFilter;
TabNetlist* _tabNetlist;
TabSelection* _tabSelection;
TabInspector* _tabInspector;
};
inline CellWidget* ControllerWidget::getCellWidget () { return _cellWidget; }
inline GraphicsWidget* ControllerWidget::getGraphics () { return _graphics; }
inline PaletteWidget* ControllerWidget::getPalette () { return _palette; }
inline DisplayFilterWidget* ControllerWidget::getDisplayFilter () { return _displayFilter; }
inline NetlistWidget* ControllerWidget::getNetlistBrowser () { return _tabNetlist->getNetlistBrowser(); }
inline SelectionWidget* ControllerWidget::getSelection () { return _tabSelection->getSelection(); }
inline InspectorWidget* ControllerWidget::getInspectorWidget () { return _tabInspector->getInspectorWidget(); }
} // End of Hurricane namespace.
#endif // __HURRICANE_CONTROLLER_WIDGET__

View File

@ -0,0 +1,64 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | H U R R I C A N E |
// | V L S I B a c k e n d D a t a - B a s e |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Header : "./PaletteExtensionGoItem.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __HURRICANE_PALETTE_EXTENSION_GO_ITEM__
#define __HURRICANE_PALETTE_EXTENSION_GO_ITEM__
class QCheckBox;
#include "hurricane/Name.h"
#include "hurricane/viewer/PaletteItem.h"
namespace Hurricane {
class PaletteExtensionGoItem : public PaletteItem {
Q_OBJECT;
// Constructor.
public:
static PaletteExtensionGoItem* create ( const Name& );
virtual const Name& getName () const;
virtual bool isChecked () const;
virtual void setChecked ( bool );
protected:
QCheckBox* _checkBox;
Name _name;
protected:
PaletteExtensionGoItem ( const Name& );
PaletteExtensionGoItem ( const PaletteExtensionGoItem& );
PaletteExtensionGoItem& operator= ( const PaletteExtensionGoItem& );
virtual void _postCreate ();
};
} // End of Hurricane namespace.
#endif // __LAYER_PALETTE_ENTRY__

View File

@ -0,0 +1,88 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | H U R R I C A N E |
// | V L S I B a c k e n d D a t a - B a s e |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Header : "./PaletteItem.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __HURRICANE_PALETTE_ITEM__
#define __HURRICANE_PALETTE_ITEM__
#include <QPixmap>
#include <QWidget>
#include <QFont>
class QPaintEvent;
class QCheckBox;
#include "hurricane/Commons.h"
namespace Hurricane {
class Name;
class PaletteItem;
// -------------------------------------------------------------------
// Class : "Hurricane::DrawingStyleSample".
class DrawingStyleSample : public QWidget {
Q_OBJECT;
public:
DrawingStyleSample ( PaletteItem* );
protected:
QPixmap _sample;
PaletteItem* _entry;
protected:
void redraw ();
void paintEvent ( QPaintEvent* );
};
// -------------------------------------------------------------------
// Class : "Hurricane::PaletteItem".
class PaletteItem : public QWidget {
Q_OBJECT;
public:
virtual const Name& getName () const = 0;
virtual bool isChecked () const = 0;
virtual void setChecked ( bool state ) = 0;
signals:
virtual void toggled ();
protected:
PaletteItem ();
PaletteItem ( const PaletteItem& );
PaletteItem& operator= ( const PaletteItem& );
};
} // End of Hurricane namespace.
# endif // __HURRICANE_PALETTE_ITEM__

View File

@ -0,0 +1,64 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | H U R R I C A N E |
// | V L S I B a c k e n d D a t a - B a s e |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Header : "./PaletteLayerItem.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __HURRICANE_PALETTE_LAYER_ITEM__
#define __HURRICANE_PALETTE_LAYER_ITEM__
class QCheckBox;
#include "hurricane/viewer/PaletteItem.h"
namespace Hurricane {
class BasicLayer;
class PaletteLayerItem : public PaletteItem {
Q_OBJECT;
public:
static PaletteLayerItem* create ( BasicLayer*, bool checked=true );
virtual const Name& getName () const;
virtual bool isChecked () const;
virtual void setChecked ( bool state );
protected:
BasicLayer* _basicLayer;
QCheckBox* _checkBox;
protected:
PaletteLayerItem ( BasicLayer*, bool checked );
PaletteLayerItem ( const PaletteLayerItem& );
PaletteLayerItem& operator= ( const PaletteLayerItem& );
};
} // End of Hurricane namespace.
#endif // __HURRICANE_PALETTE_LAYER_ITEM__

View File

@ -0,0 +1,63 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | H U R R I C A N E |
// | V L S I B a c k e n d D a t a - B a s e |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Header : "./PaletteNamedItem.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __HURRICANE_PALETTE_NAMED_ITEM__
#define __HURRICANE_PALETTE_NAMED_ITEM__
class QCheckBox;
#include "hurricane/Name.h"
#include "hurricane/viewer/PaletteItem.h"
namespace Hurricane {
class PaletteNamedItem : public PaletteItem {
Q_OBJECT;
// Constructor.
public:
static PaletteNamedItem* create ( const Name&, bool checked=true );
virtual const Name& getName () const;
virtual bool isChecked () const;
virtual void setChecked ( bool );
protected:
QCheckBox* _checkBox;
Name _name;
protected:
PaletteNamedItem ( const Name&, bool checked );
PaletteNamedItem ( const PaletteNamedItem& );
PaletteNamedItem& operator= ( const PaletteNamedItem& );
};
} // End of Hurricane namespace.
#endif // __HURRICANE_PALETTE_NAMED_ITEM__

View File

@ -0,0 +1,93 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | H U R R I C A N E |
// | V L S I B a c k e n d D a t a - B a s e |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Header : "./PaletteWidget.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __HURRICANE_PALETTE_WIDGET__
#define __HURRICANE_PALETTE_WIDGET__
#include <map>
#include <QScrollArea>
#include "hurricane/Commons.h"
#include "hurricane/Name.h"
class QCheckBox;
class QPushButton;
class QGridLayout;
namespace Hurricane {
using std::map;
class BasicLayer;
class Cell;
class CellWidget;
class PaletteItem;
class PaletteNamedItem;
class PaletteLayerItem;
class PaletteWidget : public QScrollArea {
Q_OBJECT;
public:
typedef map<const Name,PaletteItem*> PaletteItems;
public:
PaletteWidget ( QWidget* parent=NULL );
PaletteItem* find ( const Name& name ) const;
bool isDrawable ( const Name& name ) const;
signals:
void paletteChanged ();
public slots:
void updateExtensions ( Cell* cell );
void showAll ();
void hideAll ();
protected:
PaletteItems _layerItems;
PaletteItems _extensionGoItems;
QPushButton* _showAll;
QPushButton* _hideAll;
QGridLayout* _grid;
int _extensionRow;
int _extensionColumn;
QWidget* _extensionGroup;
protected:
PaletteWidget ( const PaletteWidget& );
PaletteWidget& operator= ( const PaletteWidget& );
protected:
QWidget* _createGroupItem ( const Name& );
PaletteNamedItem* _createNamedItem ( const Name&, bool checked=true );
PaletteLayerItem* _createLayerItem ( BasicLayer*, bool checked=true );
};
} // End of Hurricane namespace.
#endif // __HURRICANE_PALETTE_WIDGET__

View File

@ -0,0 +1,85 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | C O R I O L I S |
// | V L S I B a c k e n d D a t a - B a s e |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Header : "./SelectorCommand.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __HURRICANE_SELECTOR_COMMAND__
#define __HURRICANE_SELECTOR_COMMAND__
#include <string>
#include "hurricane/Commons.h"
namespace Hurricane {
using std::string;
class CellWidget;
class SelectorCommand {
public:
virtual ~SelectorCommand ();
virtual void doSelection ( CellWidget*, bool delayRedraw ) = 0;
virtual Record* _getRecord () const = 0;
virtual string _getString () const = 0;
virtual string _getTypeName () const = 0;
};
class NetSelectorCommand : public SelectorCommand {
public:
NetSelectorCommand ( const Net* );
virtual ~NetSelectorCommand ();
const Net* getNet () const;
virtual void doSelection ( CellWidget*, bool delayRedraw );
virtual Record* _getRecord () const;
virtual string _getString () const;
virtual string _getTypeName () const;
protected:
const Net* _net;
};
class AreaSelectorCommand : public SelectorCommand {
public:
AreaSelectorCommand ( const Box& );
virtual ~AreaSelectorCommand ();
const Box& getArea () const;
virtual void doSelection ( CellWidget*, bool delayRedraw );
virtual Record* _getRecord () const;
virtual string _getString () const;
virtual string _getTypeName () const;
protected:
const Box _area;
};
}
INSPECTOR_P_SUPPORT(Hurricane::SelectorCommand);
#endif // __HURRICANE_SELECTOR_COMMAND__