* ./hurricane:

- Bug: In PaletteWidget, do not derive from QScrollArea. Instead uses it
        as a child widget. This solves the refreshing problem of the Palette.
        As a rule now: never derives from anything other than QWidget.
    - New: GotoWidget, not having this feature finally unverved me enough for
        beeing implemented. You can specify an (x,y) on which the view will
        be centered and an aperture which gives the size of the view smallest
        side. It's a way of specifying the zoom level (as the zoom is not
        meaningful for users). An aperture of "zero" disable that feature,
        that is, zoom remains unchanged. The coordinates are integer which
        are implicitly expressed in the current mode used by the viewer
        (Symbolic, Grid, or Physical in micro-meters).
    - Change: Big rewrite of how the Symbolic/Grid/Physical modes are sets
        to/from the CellWidget. Impacted widgets are CellWidget &
        DisplayFilterWidget.
          Main changes are that there is no more "individual" setter/getter for
        modes (setSymbolic(), setGrid(), setPhysical(DbU::UnitPower)) but one
        with two arguments:
              setDbuMode(int mode,DbU::UnitPower)
          Signals & slots of the widgets also evolves into:
              dbuModeChanged(int mode,DbU::UnitPower)
              changeDbuMode (int mode,DbU::UnitPower)
This commit is contained in:
Jean-Paul Chaput 2010-04-26 13:22:23 +00:00
parent 4445209927
commit ddf2fb19bc
17 changed files with 467 additions and 134 deletions

View File

@ -14,6 +14,7 @@
hurricane/viewer/GraphicsWidget.h
hurricane/viewer/ExceptionWidget.h
hurricane/viewer/BreakpointWidget.h
hurricane/viewer/GotoWidget.h
hurricane/viewer/DynamicLabel.h
hurricane/viewer/MousePositionWidget.h
hurricane/viewer/SelectCommand.h
@ -39,6 +40,7 @@
hurricane/viewer/ExceptionWidget.h
hurricane/viewer/BreakpointWidget.h
hurricane/viewer/MousePositionWidget.h
hurricane/viewer/GotoWidget.h
hurricane/viewer/Selector.h
hurricane/viewer/Command.h
hurricane/viewer/AreaCommand.h
@ -71,6 +73,7 @@
GraphicsWidget.cpp
ExceptionWidget.cpp
BreakpointWidget.cpp
GotoWidget.cpp
PaletteItem.cpp
PaletteNamedItem.cpp
PaletteLayerItem.cpp

View File

@ -2,7 +2,7 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved
//
// ===================================================================
//
@ -44,6 +44,7 @@
#include "hurricane/viewer/CellViewer.h"
#include "hurricane/viewer/MousePositionWidget.h"
#include "hurricane/viewer/ControllerWidget.h"
#include "hurricane/viewer/GotoWidget.h"
namespace Hurricane {
@ -61,6 +62,7 @@ namespace Hurricane {
, _exitAction (NULL)
, _refreshAction (NULL)
, _fitToContentsAction (NULL)
, _gotoAction (NULL)
, _showSelectionAction (NULL)
, _rubberChangeAction (NULL)
, _clearRulersAction (NULL)
@ -70,9 +72,9 @@ namespace Hurricane {
, _toolsMenu (NULL)
, _debugMenu (NULL)
//, _mapView (NULL)
, _palette (NULL)
, _mousePosition (NULL)
, _controller (NULL)
, _goto (NULL)
, _cellWidget (NULL)
, _moveCommand ()
, _zoomCommand ()
@ -94,6 +96,7 @@ namespace Hurricane {
CellViewer::~CellViewer ()
{
_controller->deleteLater ();
_goto->deleteLater ();
}
@ -171,6 +174,11 @@ namespace Hurricane {
_fitToContentsAction->setStatusTip ( tr("Adjust zoom to fit the whole cell's contents") );
_fitToContentsAction->setShortcut ( Qt::Key_F );
_gotoAction = new QAction ( tr("&Goto"), this );
_gotoAction->setObjectName ( "viewer.menuBar.view.goto" );
_gotoAction->setStatusTip ( tr("Center view on that point, with zoom adjustment") );
_gotoAction->setShortcut ( Qt::Key_G );
_showSelectionAction = new QAction ( tr("&Show Selection"), this );
_showSelectionAction->setObjectName ( "viewer.menuBar.view.showSelection" );
_showSelectionAction->setStatusTip ( tr("Highlight the selected items (darken others)") );
@ -222,6 +230,7 @@ namespace Hurricane {
_viewMenu->setObjectName ( "viewer.menuBar.view" );
_viewMenu->addAction ( _refreshAction );
_viewMenu->addAction ( _fitToContentsAction );
_viewMenu->addAction ( _gotoAction );
_viewMenu->addAction ( _showSelectionAction );
_viewMenu->addAction ( _rubberChangeAction );
_viewMenu->addAction ( _clearRulersAction );
@ -248,6 +257,8 @@ namespace Hurricane {
_cellWidget = new CellWidget ();
_controller = new ControllerWidget ();
_goto = new GotoWidget ();
_goto->changeDbuMode ( _cellWidget->getDbuMode(), _cellWidget->getUnitPower() );
//_mapView = _cellWidget->getMapView ();
_cellWidget->bindCommand ( &_moveCommand );
@ -284,6 +295,10 @@ namespace Hurricane {
connect ( _rubberChangeAction , SIGNAL(triggered()) , _cellWidget, SLOT(rubberChange()) );
connect ( _clearRulersAction , SIGNAL(triggered()) , _cellWidget, SLOT(clearRulers()) );
connect ( _controllerAction , SIGNAL(triggered()) , _controller, SLOT(toggleShow()) );
connect ( _gotoAction , SIGNAL(triggered()) , this , SLOT(doGoto()) );
connect ( _cellWidget , SIGNAL(dbuModeChanged(int,DbU::UnitPower))
, _goto , SLOT (changeDbuMode (int,DbU::UnitPower)) );
connect ( _cellWidget , SIGNAL(mousePositionChanged(const Point&))
, _mousePosition , SLOT (setPosition(const Point&)) );
@ -389,6 +404,29 @@ namespace Hurricane {
}
void CellViewer::doGoto ()
{
if ( _goto->exec() == QDialog::Accepted ) {
if ( not _goto->hasXy() ) return;
Box gotoArea ( _goto->getX(), _goto->getY() );
DbU::Unit width;
DbU::Unit height;
if ( _goto->hasAperture() ) {
width = height = _goto->getAperture() / 2;
} else {
Box visibleArea = _cellWidget->getVisibleArea ();
width = visibleArea.getWidth ()/2;
height = visibleArea.getHeight()/2;
}
gotoArea.inflate ( width, height );
_cellWidget->reframe ( gotoArea );
}
}
void CellViewer::changeSelectionMode ()
{
if ( _updateState != InternalEmit ) {

View File

@ -1286,56 +1286,18 @@ namespace Hurricane {
}
void CellWidget::changeLayoutMode ()
void CellWidget::changeDbuMode ( int mode, DbU::UnitPower p )
{
if ( symbolicMode() ) {
setSymbolicMode ();
} else if ( gridMode() ) {
setGridMode ();
} else {
setPhysicalMode(_state->getUnitPower());
}
}
if ( (_state->getDbuMode() != mode) or (_state->getUnitPower() != p) ) {
_state->setDbuMode ( mode );
_state->setUnitPower ( p );
void CellWidget::setGridMode ()
{
if ( not gridMode() ) {
_state->setGridMode ();
DbU::setStringMode ( DbU::Grid );
DbU::setStringMode ( mode, p );
updateMousePosition ();
refresh ();
emit layoutModeChanged ();
}
}
void CellWidget::setSymbolicMode ()
{
if ( not symbolicMode() ) {
_state->setSymbolicMode ();
DbU::setStringMode ( DbU::Symbolic );
updateMousePosition ();
refresh ();
emit layoutModeChanged ();
}
}
void CellWidget::setPhysicalMode ( DbU::UnitPower p )
{
if ( not physicalMode() or (_state->getUnitPower() != p) ) {
_state->setPhysicalMode ( p );
DbU::setStringMode ( DbU::Physical, p );
updateMousePosition ();
refresh ();
emit layoutModeChanged ();
emit dbuModeChanged ( _state->getDbuMode(), _state->getUnitPower() );
}
}

View File

@ -2,7 +2,7 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved
//
// ===================================================================
//
@ -475,7 +475,7 @@ namespace Hurricane {
connect ( _tabSelection->getSelection(), SIGNAL(inspect(Occurrence&))
, _tabInspector , SLOT (setSelectionOccurrence(Occurrence&)) );
resize ( 540, 540 );
resize ( 600, 560 );
}

View File

@ -2,7 +2,7 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved
// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved
//
// ===================================================================
//
@ -197,8 +197,10 @@ namespace Hurricane {
if ( _cellWidget ) {
disconnect ( this , SIGNAL(queryFilterChanged()), _cellWidget, SLOT(changeQueryFilter()) );
disconnect ( _cellWidget , SIGNAL(queryFilterChanged()), this , SLOT(changeQueryFilter()) );
disconnect ( this , SIGNAL(layoutModeChanged ()), _cellWidget, SLOT(changeLayoutMode ()) );
disconnect ( _cellWidget , SIGNAL(layoutModeChanged ()), this , SLOT(changeLayoutMode ()) );
disconnect ( this , SIGNAL(dbuModeChanged (int,DbU::UnitPower))
, _cellWidget , SLOT (changeDbuMode (int,DbU::UnitPower)) );
disconnect ( _cellWidget , SIGNAL(dbuModeChanged (int,DbU::UnitPower))
, this , SLOT (changeDbuMode (int,DbU::UnitPower)) );
}
_cellWidget = cw;
@ -206,35 +208,37 @@ namespace Hurricane {
connect ( this , SIGNAL(queryFilterChanged()), _cellWidget, SLOT(changeQueryFilter()) );
connect ( _cellWidget , SIGNAL(queryFilterChanged()), this , SLOT(changeQueryFilter()) );
connect ( this , SIGNAL(layoutModeChanged ()), _cellWidget, SLOT(changeLayoutMode ()) );
connect ( _cellWidget , SIGNAL(layoutModeChanged ()), this , SLOT(changeLayoutMode ()) );
connect ( this , SIGNAL(dbuModeChanged (int,DbU::UnitPower))
, _cellWidget , SLOT (changeDbuMode (int,DbU::UnitPower)) );
connect ( _cellWidget , SIGNAL(dbuModeChanged (int,DbU::UnitPower))
, this , SLOT (changeDbuMode (int,DbU::UnitPower)) );
_updateState = ExternalEmit;
changeQueryFilter ();
changeLayoutMode ();
changeDbuMode ( _cellWidget->getDbuMode(), _cellWidget->getUnitPower() );
}
void DisplayFilterWidget::changeLayoutMode ()
void DisplayFilterWidget::changeDbuMode ( int mode, DbU::UnitPower p )
{
if ( !_cellWidget ) return;
if ( _cellWidget == NULL ) return;
if ( _updateState == InternalEmit ) {
_updateState = InternalReceive;
emit layoutModeChanged ();
emit dbuModeChanged ( mode, p );
} else {
if ( _updateState == ExternalEmit ) {
blockAllSignals ( true );
if ( _cellWidget->symbolicMode() )
_symbolicMode->setChecked(true);
else if ( _cellWidget->gridMode() )
_gridMode->setChecked(true);
else if ( _cellWidget->physicalMode() ) {
switch ( _cellWidget->getUnitPower() ) {
case DbU::Nano: _nanoMode->setChecked(true); break;
case DbU::Micro: _microMode->setChecked(true); break;
}
switch ( _cellWidget->getDbuMode() ) {
case DbU::Symbolic: _symbolicMode->setChecked(true); break;
case DbU::Grid: _gridMode ->setChecked(true); break;
case DbU::Physical:
switch ( _cellWidget->getUnitPower() ) {
case DbU::Nano: _nanoMode ->setChecked(true); break;
case DbU::Micro: _microMode->setChecked(true); break;
}
break;
}
blockAllSignals ( false );
@ -400,7 +404,7 @@ namespace Hurricane {
if ( _cellWidget ) {
if ( !_cellWidget->symbolicMode() ) {
_updateState = InternalEmit;
_cellWidget->setSymbolicMode ();
_cellWidget->changeDbuMode ( DbU::Symbolic, _cellWidget->getUnitPower() );
}
}
}
@ -409,9 +413,9 @@ namespace Hurricane {
void DisplayFilterWidget::setGridMode ()
{
if ( _cellWidget ) {
if ( !_cellWidget->gridMode() ) {
if ( not _cellWidget->gridMode() ) {
_updateState = InternalEmit;
_cellWidget->setGridMode ();
_cellWidget->changeDbuMode ( DbU::Grid, _cellWidget->getUnitPower() );
}
}
}
@ -422,7 +426,7 @@ namespace Hurricane {
if ( _cellWidget ) {
if ( not _cellWidget->physicalMode() or (_cellWidget->getUnitPower() != DbU::Nano) ) {
_updateState = InternalEmit;
_cellWidget->setPhysicalMode ( DbU::Nano );
_cellWidget->changeDbuMode ( DbU::Physical, DbU::Nano );
}
}
}
@ -433,7 +437,7 @@ namespace Hurricane {
if ( _cellWidget ) {
if ( not _cellWidget->physicalMode() or (_cellWidget->getUnitPower() != DbU::Micro) ) {
_updateState = InternalEmit;
_cellWidget->setPhysicalMode ( DbU::Micro );
_cellWidget->changeDbuMode ( DbU::Physical, DbU::Micro );
}
}
}

View File

@ -0,0 +1,199 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2010, 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 : "./GotoWidget.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include <iostream>
#include <sstream>
using namespace std;
#include <QApplication>
#include <QLabel>
#include <QFrame>
#include <QLineEdit>
#include <QRegExpValidator>
#include <QComboBox>
#include <QPushButton>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include "hurricane/viewer/GotoWidget.h"
namespace Hurricane {
GotoWidget::GotoWidget ( QWidget* parent )
: QDialog (parent)
, _xyRegexp ("(\\d+),(\\d+)")
, _xyEdit (new QLineEdit())
, _apertureEdit(new QLineEdit())
, _dbuMode (new QComboBox())
, _x (0)
, _y (0)
, _aperture (0)
, _hasXy (false)
, _hasAperture (false)
{
setModal ( true );
setWindowTitle ( "<Goto>" );
setToolTip ( "Center the view on that coordinates" );
QRegExpValidator* xyValidator = new QRegExpValidator ( _xyRegexp, this );
_xyEdit->setValidator ( xyValidator );
QRegExp apertureRegexp ( "\\d+" );
QRegExpValidator* apertureValidator = new QRegExpValidator ( apertureRegexp, this );
_apertureEdit->setValidator ( apertureValidator );
QHBoxLayout* hLayout1 = new QHBoxLayout ();
QLabel* label = new QLabel ();
label->setTextFormat ( Qt::RichText );
label->setText ( "<b>X,Y:</b>" );
hLayout1->addWidget ( label );
hLayout1->addWidget ( _xyEdit );
label = new QLabel ();
label->setTextFormat ( Qt::RichText );
label->setText ( "<b>Aperture:</b>(Zoom)" );
hLayout1->addWidget ( label );
hLayout1->addWidget ( _apertureEdit );
_dbuMode->addItem ( "DataBase" , DbU::Db /*0x01*/ );
_dbuMode->addItem ( "Grid" , DbU::Grid /*0x02*/ );
_dbuMode->addItem ( "Symbolic" , DbU::Symbolic /*0x04*/ );
_dbuMode->addItem ( "Micrometer", DbU::Physical /*0x08*/ );
_dbuMode->addItem ( "Nanometer" , 0x10 );
_dbuMode->setCurrentIndex ( 2 );
hLayout1->addWidget ( _dbuMode );
QPushButton* cancelButton = new QPushButton ();
cancelButton->setSizePolicy ( QSizePolicy::Fixed, QSizePolicy::Fixed );
cancelButton->setText ( tr("Cancel") );
QPushButton* okButton = new QPushButton ();
okButton->setSizePolicy ( QSizePolicy::Fixed, QSizePolicy::Fixed );
okButton->setText ( tr("Goto") );
QHBoxLayout* hLayout2 = new QHBoxLayout ();
hLayout2->addStretch ( 1 );
hLayout2->addWidget ( okButton, 0, Qt::AlignCenter );
hLayout2->addStretch ( 4 );
hLayout2->addWidget ( cancelButton, 0, Qt::AlignCenter );
hLayout2->addStretch ( 1 );
QFrame* hLine = new QFrame ();
hLine->setFrameShape ( QFrame::HLine );
hLine->setFrameShadow ( QFrame::Sunken );
QVBoxLayout* vLayout = new QVBoxLayout ();
//vLayout->setSizeConstraint ( QLayout::SetFixedSize );
vLayout->addLayout ( hLayout1 );
vLayout->addWidget ( hLine );
vLayout->addLayout ( hLayout2 );
setLayout ( vLayout );
connect ( okButton , SIGNAL(clicked()), this, SLOT(acceptAndUpdate()) );
connect ( cancelButton, SIGNAL(clicked()), this, SLOT(reject()) );
}
void GotoWidget::acceptAndUpdate ()
{
if ( (_hasXy = _xyEdit->hasAcceptableInput()) ) {
_xyRegexp.indexIn ( _xyEdit->displayText() );
_x = toDbu ( _xyRegexp.cap(1).toDouble() );
_y = toDbu ( _xyRegexp.cap(2).toDouble() );
}
if ( (_hasAperture = _apertureEdit->hasAcceptableInput()) ) {
_aperture = toDbu ( _apertureEdit->displayText().toDouble() );
_hasAperture = (_aperture != 0 );
}
emit accept();
}
void GotoWidget::changeDbuMode ( int mode, DbU::UnitPower p )
{
if ( mode == DbU::Physical ) {
switch ( p ) {
case DbU::Nano: mode = Nanometer; break;
defult:
case DbU::Micro: mode = Micrometer; break;
}
}
int index = _dbuMode->findData ( mode );
switch ( index ) {
case Nanometer:
case Micrometer:
case Grid:
case Db: _dbuMode->setCurrentIndex(index); break;
default:
case Symbolic: _dbuMode->setCurrentIndex(2); break;
}
ostringstream s;
s << (long)fromDbu(_x) << "," << (long)fromDbu(_y);
_xyEdit->setText ( s.str().c_str() );
s.str("");
s << (long)fromDbu(_aperture);
_apertureEdit->setText ( s.str().c_str() );
}
DbU::Unit GotoWidget::toDbu ( double d ) const
{
DbU::Unit unit;
switch ( _dbuMode->currentIndex() ) {
case Nanometer: unit = DbU::grid(DbU::physicalToGrid(d,DbU::Nano )); break;
case Micrometer: unit = DbU::grid(DbU::physicalToGrid(d,DbU::Micro)); break;
default:
case Symbolic: unit = DbU::lambda(d); break;
case Grid: unit = DbU::grid (d); break;
case Db: unit = DbU::db ((long)d); break;
}
return unit;
}
double GotoWidget::fromDbu ( DbU::Unit u ) const
{
double d;
switch ( _dbuMode->currentIndex() ) {
case Nanometer: d = DbU::getPhysical(u,DbU::Nano); break;
case Micrometer: d = DbU::getPhysical(u,DbU::Micro); break;
default:
case Symbolic: d = DbU::getLambda(u); break;
case Grid: d = DbU::getGrid (u); break;
case Db: d = DbU::getDb (u); break;
}
return d;
}
} // End of Hurricane Namespace.

View File

@ -2,7 +2,7 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved
// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved
//
// ===================================================================
//

View File

@ -2,7 +2,7 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved
// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved
//
// ===================================================================
//

View File

@ -2,7 +2,7 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved
//
// ===================================================================
//
@ -170,18 +170,20 @@ namespace Hurricane {
PaletteWidget::PaletteWidget ( QWidget* parent )
: QScrollArea (parent)
: QWidget (parent)
, _scrollArea (new QScrollArea(this))
, _layerItems ()
, _extensionGoItems()
, _showAll (new QPushButton(this))
, _hideAll (new QPushButton(this))
, _showAll (new QPushButton(_scrollArea))
, _hideAll (new QPushButton(_scrollArea))
, _grid (new QGridLayout())
, _columnHeight (22)
, _extensionRow (0)
, _extensionColumn (0)
, _extensionGroup (NULL)
{
setWidgetResizable ( true );
setContentsMargins ( 0, 0, 0, 0 );
_scrollArea->setWidgetResizable ( true );
QVBoxLayout* vLayout = new QVBoxLayout ();
QHBoxLayout* hLayout = new QHBoxLayout ();
@ -216,12 +218,19 @@ namespace Hurricane {
vLayout->addStretch ();
QWidget* adaptator = new QWidget ();
adaptator->setLayout ( vLayout );
setWidget ( adaptator );
setHorizontalScrollBarPolicy ( Qt::ScrollBarAsNeeded );
setVerticalScrollBarPolicy ( Qt::ScrollBarAsNeeded );
setFrameStyle ( QFrame::Plain );
QWidget* scrollAdaptator = new QWidget ();
scrollAdaptator->setLayout ( vLayout );
_scrollArea->setContentsMargins ( 0, 0, 0, 0 );
_scrollArea->setWidget ( scrollAdaptator );
_scrollArea->setHorizontalScrollBarPolicy ( Qt::ScrollBarAsNeeded );
_scrollArea->setVerticalScrollBarPolicy ( Qt::ScrollBarAsNeeded );
_scrollArea->setFrameStyle ( QFrame::Plain );
vLayout = new QVBoxLayout ();
vLayout->setSpacing ( 0 );
vLayout->addWidget ( _scrollArea );
setLayout ( vLayout );
}

View File

@ -2,7 +2,7 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved
//
// ===================================================================
//
@ -26,6 +26,7 @@
#include <algorithm>
#include <QFont>
#include <QFontMetrics>
#include "hurricane/Path.h"
#include "hurricane/Entity.h"
@ -125,8 +126,9 @@ namespace Hurricane {
QVariant SelectionModel::data ( const QModelIndex& index, int role ) const
{
static QFont occurrenceFont = Graphics::getFixedFont ( QFont::Normal );
static QFont entityFont = Graphics::getFixedFont ( QFont::Bold, false );
static QFont occurrenceFont = Graphics::getFixedFont ( QFont::Normal );
static QFont entityFont = Graphics::getFixedFont ( QFont::Bold, false );
static QFontMetrics entityMetrics = QFontMetrics(entityFont);
if ( !index.isValid() ) return QVariant ();
@ -134,7 +136,9 @@ namespace Hurricane {
if ( index.row() == 0 ) return QVariant();
switch (index.column()) {
case 0: return 200;
default: return -1;
default:
if ( index.row() > (int)_selection.size() ) return 0;
return entityMetrics.width(getString(_selection[index.row()]._occurrence.getEntity()).c_str());
}
}

View File

@ -2,7 +2,7 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved
//
// ===================================================================
//
@ -100,17 +100,19 @@ namespace Hurricane {
_view->setShowGrid(false);
_view->setAlternatingRowColors(true);
_view->setSelectionBehavior(QAbstractItemView::SelectRows);
//_view->setTextElideMode(Qt::ElideNone);
_view->setSortingEnabled(true);
_view->setModel ( _sortModel );
_view->horizontalHeader()->setStretchLastSection ( true );
_view->installEventFilter(this);
QHeaderView* horizontalHeader = _view->horizontalHeader ();
horizontalHeader->setStretchLastSection ( true );
//horizontalHeader->setMinimumSectionSize ( 200 );
//horizontalHeader->setResizeMode ( QHeaderView::ResizeToContents );
horizontalHeader->setMinimumSectionSize ( 200 );
QHeaderView* verticalHeader = _view->verticalHeader ();
verticalHeader->setVisible ( false );
verticalHeader->setDefaultSectionSize ( _rowHeight );
QVBoxLayout* vLayout = new QVBoxLayout ();
//vLayout->setSpacing ( 0 );

View File

@ -1,7 +1,7 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved
//
// ===================================================================
//
@ -53,12 +53,9 @@ namespace Hurricane {
class Cell;
class HPalette;
class HGraphics;
class HDisplayFilter;
//class MapView;
class GotoWidget;
class MousePositionWidget;
class HSelection;
class ControllerWidget;
@ -83,6 +80,7 @@ namespace Hurricane {
void unselect ( Occurrence& );
void unselectAll ();
public slots:
void doGoto ();
void changeSelectionMode ();
void setShowSelection ( bool );
void setState ( shared_ptr<CellWidget::State>& );
@ -115,6 +113,7 @@ namespace Hurricane {
QAction* _exitAction;
QAction* _refreshAction;
QAction* _fitToContentsAction;
QAction* _gotoAction;
QAction* _showSelectionAction;
QAction* _rubberChangeAction;
QAction* _clearRulersAction;
@ -124,9 +123,9 @@ namespace Hurricane {
QMenu* _toolsMenu;
QMenu* _debugMenu;
//MapView* _mapView;
HPalette* _palette;
MousePositionWidget* _mousePosition;
ControllerWidget* _controller;
GotoWidget* _goto;
CellWidget* _cellWidget;
MoveCommand _moveCommand;
ZoomCommand _zoomCommand;

View File

@ -2,7 +2,7 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved
//
// ===================================================================
//
@ -148,6 +148,7 @@ namespace Hurricane {
inline void resetActiveCommand ();
inline void setCursorStep ( DbU::Unit );
inline void setRealSnapGridStep ( DbU::Unit step );
inline unsigned int getDbuMode () const;
inline bool gridMode () const;
inline bool symbolicMode () const;
inline bool physicalMode () const;
@ -155,6 +156,8 @@ namespace Hurricane {
inline bool showBoundaries () const;
inline bool showSelection () const;
inline bool cumulativeSelection () const;
inline void setDbuMode ( int );
inline void setUnitPower ( DbU::UnitPower );
inline void setRubberShape ( RubberShape );
inline void setStartLevel ( int );
inline void setStopLevel ( int );
@ -195,6 +198,7 @@ namespace Hurricane {
void drawScreenRect ( const QRect& , size_t plane=PlaneId::Working );
void drawScreenPolyline ( const QPoint*, int, int, size_t plane=PlaneId::Working );
// Geometric conversions.
inline DbU::Unit toDbu ( float ) const;
QRect dbuToDisplayRect ( DbU::Unit x1, DbU::Unit y1, DbU::Unit x2, DbU::Unit y2, bool usePoint=true ) const;
QRect dbuToDisplayRect ( const Box& box , bool usePoint=true ) const;
QPoint dbuToDisplayPoint ( DbU::Unit x, DbU::Unit y ) const;
@ -216,6 +220,7 @@ namespace Hurricane {
inline Box screenToDbuBox ( const QRect& rect ) const;
inline Box& pixelInflate ( Box&, int pixels ) const;
inline Point getTopLeft () const;
inline Box getVisibleArea () const;
Box computeVisibleArea ( float scale ) const;
Box computeVisibleArea ( float scale, const Point& topLeft ) const;
Box computeVisibleArea ( const Box&, float& scale ) const;
@ -246,7 +251,7 @@ namespace Hurricane {
void stateChanged ( shared_ptr<CellWidget::State>& );
void styleChanged ();
void queryFilterChanged ();
void layoutModeChanged ();
void dbuModeChanged ( int mode, DbU::UnitPower );
void updatePalette ( Cell* );
void mousePositionChanged ( const Point& position );
void selectionModeChanged ();
@ -279,7 +284,7 @@ namespace Hurricane {
inline void clearRulers ();
void changeQueryFilter ();
void rubberChange ();
void changeLayoutMode ();
void changeDbuMode ( int mode, DbU::UnitPower );
void setStyle ( int id );
void updatePalette ();
void cellPreModificate ();
@ -297,9 +302,9 @@ namespace Hurricane {
void setScale ( float );
void scaleHistoryUp ();
void scaleHistoryDown ();
void setGridMode ();
void setSymbolicMode ();
void setPhysicalMode ( DbU::UnitPower );
// void setGridMode ();
// void setSymbolicMode ();
// void setPhysicalMode ( DbU::UnitPower );
void setShowBoundaries ( bool state );
void reframe ();
void reframe ( const Box& box, bool historyEnable=true );
@ -553,9 +558,8 @@ namespace Hurricane {
inline void setCursorStep ( DbU::Unit );
inline DbU::Unit getCursorStep () const;
inline DbU::UnitPower getUnitPower () const;
inline void setGridMode ();
inline void setSymbolicMode ();
inline void setPhysicalMode ( DbU::UnitPower );
inline void setDbuMode ( int );
inline void setUnitPower ( DbU::UnitPower );
inline void setShowBoundaries ( bool );
inline void setShowSelection ( bool );
inline void setCumulativeSelection ( bool );
@ -574,6 +578,7 @@ namespace Hurricane {
inline SelectorCriterions& getSelection ();
inline RulerSet& getRulers ();
inline DbU::Unit cursorStep () const;
inline unsigned int getDbuMode () const;
inline bool gridMode () const;
inline bool symbolicMode () const;
inline bool physicalMode () const;
@ -606,7 +611,7 @@ namespace Hurricane {
SelectorCriterions _selection;
RulerSet _rulers;
DbU::Unit _cursorStep;
unsigned int _displayMode;
unsigned int _dbuMode;
DbU::UnitPower _unitPower;
bool _showBoundaries;
bool _showSelection;
@ -895,7 +900,7 @@ namespace Hurricane {
, _selection ()
, _rulers ()
, _cursorStep (DbU::lambda(0.5))
, _displayMode (DbU::Symbolic)
, _dbuMode (DbU::Symbolic)
, _unitPower (DbU::Nano)
, _showBoundaries (true)
, _showSelection (false)
@ -912,16 +917,20 @@ namespace Hurricane {
}
inline unsigned int CellWidget::State::getDbuMode () const
{ return _dbuMode; }
inline bool CellWidget::State::symbolicMode () const
{ return (_displayMode == DbU::Symbolic); }
{ return (_dbuMode == DbU::Symbolic); }
inline bool CellWidget::State::gridMode () const
{ return (_displayMode == DbU::Grid); }
{ return (_dbuMode == DbU::Grid); }
inline bool CellWidget::State::physicalMode () const
{ return (_displayMode == DbU::Physical); }
{ return (_dbuMode == DbU::Physical); }
inline void CellWidget::State::setCell ( Cell* cell )
@ -946,26 +955,19 @@ namespace Hurricane {
{ return _unitPower; }
inline void CellWidget::State::setGridMode ()
inline void CellWidget::State::setDbuMode ( int mode )
{
_displayMode = DbU::Grid;
_cursorStep = DbU::grid ( 1.0 );
_dbuMode = mode;
switch ( _dbuMode ) {
case DbU::Symbolic: _cursorStep = DbU::lambda(0.5); break;
case DbU::Grid: _cursorStep = DbU::grid (1.0); break;
case DbU::Physical: _cursorStep = DbU::grid (1.0); break;
}
}
inline void CellWidget::State::setSymbolicMode ()
{
_displayMode = DbU::Symbolic;
_cursorStep = DbU::lambda ( 0.5 );
}
inline void CellWidget::State::setPhysicalMode ( DbU::UnitPower p )
{
_displayMode = DbU::Physical;
_cursorStep = DbU::grid ( 1.0 );
_unitPower = p;
}
inline void CellWidget::State::setUnitPower ( DbU::UnitPower p )
{ _unitPower = p; }
inline void CellWidget::State::setShowBoundaries ( bool state )
@ -1189,6 +1191,20 @@ namespace Hurricane {
{ _drawingPlanes.copyToImage ( image, noScale ); }
inline DbU::Unit CellWidget::toDbu ( float d ) const
{
DbU::Unit unit;
switch ( getDbuMode() ) {
case DbU::Physical: unit = DbU::grid(DbU::physicalToGrid(d,DbU::Micro)); break;
case DbU::Grid: unit = DbU::grid(d); break;
case DbU::Db: unit = DbU::db((long)d); break;
default:
case DbU::Symbolic: unit = DbU::lambda(d); break;
}
return unit;
}
inline int CellWidget::dbuToDisplayX ( DbU::Unit x ) const
{ return (int)rint ( (float)( x - _displayArea.getXMin() ) * getScale() ); }
@ -1265,6 +1281,10 @@ namespace Hurricane {
{ return Point(_visibleArea.getXMin(),_visibleArea.getYMax()); }
inline Box CellWidget::getVisibleArea () const
{ return computeVisibleArea(getScale()); }
inline Cell* CellWidget::getCell () const
{ return _state->getCell(); }
@ -1277,6 +1297,10 @@ namespace Hurricane {
{ return _state->cursorStep(); }
inline unsigned int CellWidget::getDbuMode () const
{ return _state->getDbuMode(); }
inline bool CellWidget::gridMode () const
{ return _state->gridMode(); }
@ -1339,6 +1363,14 @@ namespace Hurricane {
{ return _state->getQueryFilter(); }
inline void CellWidget::setDbuMode ( int mode )
{ _state->setDbuMode(mode); }
inline void CellWidget::setUnitPower ( DbU::UnitPower p )
{ _state->setUnitPower(p); }
inline void CellWidget::setRubberShape ( RubberShape shape )
{
_state->setRubberShape ( shape );

View File

@ -2,7 +2,7 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved
// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved
//
// ===================================================================
//

View File

@ -2,7 +2,7 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved
// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved
//
// ===================================================================
//
@ -47,10 +47,10 @@ namespace Hurricane {
void setCellWidget ( CellWidget* );
signals:
void queryFilterChanged ();
void layoutModeChanged ();
void dbuModeChanged ( int mode, DbU::UnitPower );
public slots:
void changeQueryFilter ();
void changeLayoutMode ();
void changeDbuMode ( int mode, DbU::UnitPower );
void startLevelChanged ( int level );
void stopLevelChanged ( int level );
void setDoMasterCells ( int state );

View File

@ -0,0 +1,80 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2010, 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 : "./GotoWidget.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __HURRICANE_GOTO_WIDGET__
#define __HURRICANE_GOTO_WIDGET__
#include <QDialog>
#include <QRegExp>
class QLineEdit;
class QComboBox;
#include "hurricane/DbU.h"
namespace Hurricane {
class GotoWidget : public QDialog {
Q_OBJECT;
public:
enum DbuMode { Db=0, Grid=1, Symbolic=2, Micrometer=3, Nanometer=4 };
public:
GotoWidget ( QWidget* parent=NULL);
inline bool hasXy () const;
inline bool hasAperture () const;
inline DbU::Unit getX () const;
inline DbU::Unit getY () const;
inline DbU::Unit getAperture () const;
DbU::Unit toDbu ( double ) const;
double fromDbu ( DbU::Unit ) const;
public slots:
void acceptAndUpdate ();
void changeDbuMode ( int, DbU::UnitPower );
private:
QRegExp _xyRegexp;
QLineEdit* _xyEdit;
QLineEdit* _apertureEdit;
QComboBox* _dbuMode;
DbU::Unit _x;
DbU::Unit _y;
DbU::Unit _aperture;
bool _hasXy;
bool _hasAperture;
};
inline bool GotoWidget::hasXy () const { return _hasXy; }
inline bool GotoWidget::hasAperture () const { return _hasAperture; }
inline DbU::Unit GotoWidget::getX () const { return _x; }
inline DbU::Unit GotoWidget::getY () const { return _y; }
inline DbU::Unit GotoWidget::getAperture () const { return _aperture; }
} // End of Hurricane namespace.
#endif // __HURRICANE_GOTO_WIDGET__

View File

@ -2,7 +2,7 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved
// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved
//
// ===================================================================
//
@ -54,7 +54,7 @@ namespace Hurricane {
class PaletteExtensionGoItem;
class PaletteWidget : public QScrollArea {
class PaletteWidget : public QWidget {
Q_OBJECT;
public:
@ -80,6 +80,7 @@ namespace Hurricane {
void setItemVisible ( const Name& name, bool visible );
protected:
QScrollArea* _scrollArea;
PaletteItems _layerItems;
PaletteItems _extensionGoItems;
QPushButton* _showAll;