* ./hurricane/src/hviewer :
- Change: simpler implementation of the occurence selection mechanims between SelectionPopup, SelectCommand, SelectionWidget & CellWidget. Consistent (identical) names of signal/slots : selectionToggled() and toggleSelection(). - Change: disable QApplication::processEvent() has it seems to slow down display refreshment on Mac OS. This may be a side effect of another problem not yet diagnosed. - New feature: CellWidget internal state enhancement : now manage an history of scales (through 'u' & 'd'). - New feature: hierarchical exploration through 'CTRL+u' & 'CTRL+d'. On second though, what a bad key mapping. To be corrected soon...
This commit is contained in:
parent
8961968b8b
commit
3d6ebdda92
|
@ -18,7 +18,8 @@ ELSE(BUILD_STATIC)
|
|||
MESSAGE(STATUS "Building dynamic libraries.")
|
||||
ENDIF(BUILD_STATIC)
|
||||
|
||||
SET(QT_USE_QTXML "true")
|
||||
SET(QT_USE_QTXML "true")
|
||||
#SET(QT_USE_QTOPENGL "true")
|
||||
|
||||
FIND_PACKAGE(Qt4 REQUIRED) # find and setup Qt4 for this project
|
||||
FIND_PACKAGE(BISON REQUIRED)
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
hurricane/viewer/MoveCommand.h
|
||||
hurricane/viewer/ZoomCommand.h
|
||||
hurricane/viewer/SelectCommand.h
|
||||
hurricane/viewer/HierarchyCommand.h
|
||||
hurricane/viewer/SelectorCriterion.h
|
||||
hurricane/viewer/CellWidget.h
|
||||
hurricane/viewer/CellWidgets.h
|
||||
|
@ -78,6 +79,7 @@
|
|||
MoveCommand.cpp
|
||||
ZoomCommand.cpp
|
||||
SelectCommand.cpp
|
||||
HierarchyCommand.cpp
|
||||
SelectorCriterion.cpp
|
||||
CellWidget.cpp
|
||||
CellViewer.cpp
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
// x-----------------------------------------------------------------x
|
||||
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <QAction>
|
||||
#include <QMenu>
|
||||
#include <QMenuBar>
|
||||
|
@ -37,7 +39,6 @@
|
|||
|
||||
//#include "MapView.h"
|
||||
#include "hurricane/viewer/Graphics.h"
|
||||
#include "hurricane/viewer/CellWidget.h"
|
||||
#include "hurricane/viewer/CellViewer.h"
|
||||
#include "hurricane/viewer/MousePositionWidget.h"
|
||||
#include "hurricane/viewer/ControllerWidget.h"
|
||||
|
@ -71,6 +72,7 @@ namespace Hurricane {
|
|||
, _moveCommand()
|
||||
, _zoomCommand()
|
||||
, _selectCommand()
|
||||
, _hierarchyCommand()
|
||||
, _cellHistory()
|
||||
, _firstShow(false)
|
||||
{
|
||||
|
@ -222,6 +224,7 @@ namespace Hurricane {
|
|||
_cellWidget->bindCommand ( &_moveCommand );
|
||||
_cellWidget->bindCommand ( &_zoomCommand );
|
||||
_cellWidget->bindCommand ( &_selectCommand );
|
||||
_cellWidget->bindCommand ( &_hierarchyCommand );
|
||||
_controller->setCellWidget ( _cellWidget );
|
||||
|
||||
_selectCommand.bindToAction ( _showSelectionAction );
|
||||
|
@ -252,37 +255,55 @@ namespace Hurricane {
|
|||
connect ( _showSelectionAction , SIGNAL(toggled(bool)) , this , SLOT(setShowSelection(bool)) );
|
||||
connect ( _rubberChangeAction , SIGNAL(triggered()) , _cellWidget, SLOT(rubberChange()) );
|
||||
connect ( _controllerAction , SIGNAL(triggered()) , this , SLOT(showController()) );
|
||||
|
||||
connect ( _cellWidget , SIGNAL(mousePositionChanged(const Point&))
|
||||
, _mousePosition , SLOT(setPosition(const Point&)) );
|
||||
|
||||
connect ( this , SIGNAL(showSelectionToggled(bool))
|
||||
, _cellWidget , SLOT (setShowSelection (bool)) );
|
||||
connect ( _cellWidget , SIGNAL(showSelectionToggled(bool))
|
||||
, this , SLOT (setShowSelection (bool)) );
|
||||
connect ( &_selectCommand , SIGNAL(selectionToggled (Occurrence,bool))
|
||||
, _cellWidget , SLOT (toggleSelect (Occurrence,bool)) );
|
||||
connect ( &_selectCommand , SIGNAL(selectionToggled (Occurrence))
|
||||
, _cellWidget , SLOT (toggleSelection (Occurrence)) );
|
||||
|
||||
connect ( _cellWidget , SIGNAL(stateChanged(shared_ptr<CellWidget::State>&))
|
||||
, this , SLOT (setState (shared_ptr<CellWidget::State>&)) );
|
||||
connect ( this , SIGNAL(stateChanged(shared_ptr<CellWidget::State>&))
|
||||
, _cellWidget , SLOT (setState (shared_ptr<CellWidget::State>&)) );
|
||||
|
||||
_cellWidget->refresh ();
|
||||
}
|
||||
|
||||
|
||||
void CellViewer::refreshTitle ()
|
||||
{
|
||||
QString cellName = "None";
|
||||
if ( getCell() )
|
||||
cellName = getString(getCell()->getName()).c_str();
|
||||
|
||||
QString title = QString("%1:<%2>").arg(_applicationName).arg(cellName);
|
||||
setWindowTitle ( title );
|
||||
}
|
||||
|
||||
|
||||
void CellViewer::refreshHistory ()
|
||||
{
|
||||
if ( !getCell() ) return;
|
||||
|
||||
Cell* activeCell = getCell();
|
||||
_cellHistory.remove ( activeCell );
|
||||
shared_ptr<CellWidget::State> activeState = _cellWidget->getState();
|
||||
_cellHistory.remove ( activeState );
|
||||
|
||||
if ( _cellHistory.size() > CellHistorySize-1 )
|
||||
_cellHistory.pop_front ();
|
||||
_cellHistory.push_back ( activeCell );
|
||||
_cellHistory.push_back ( activeState );
|
||||
|
||||
list<Cell*>::iterator iname = _cellHistory.begin();
|
||||
list< shared_ptr<CellWidget::State> >::iterator istate = _cellHistory.begin();
|
||||
for ( size_t i=0 ; i<CellHistorySize ; i++ ) {
|
||||
if ( iname != _cellHistory.end() ) {
|
||||
QString entry = tr("&%1: %2").arg(i+1).arg( getString((*iname)->getName()).c_str() );
|
||||
if ( istate != _cellHistory.end() ) {
|
||||
QString entry = tr("&%1: %2").arg(i+1).arg( getString((*istate)->getName()).c_str() );
|
||||
_cellHistoryAction[i]->setText ( entry );
|
||||
_cellHistoryAction[i]->setVisible ( true );
|
||||
iname++;
|
||||
istate++;
|
||||
} else {
|
||||
_cellHistoryAction[i]->setVisible ( false );
|
||||
}
|
||||
|
@ -290,18 +311,38 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
void CellViewer::setState ( shared_ptr<CellWidget::State>& state )
|
||||
{
|
||||
static bool isEmitter = false;
|
||||
|
||||
if ( sender() == this ) {
|
||||
isEmitter = true;
|
||||
emit stateChanged ( state );
|
||||
} else {
|
||||
if ( !isEmitter ) {
|
||||
blockSignals ( true );
|
||||
|
||||
refreshTitle ();
|
||||
refreshHistory ();
|
||||
|
||||
blockSignals ( false );
|
||||
} else
|
||||
isEmitter = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CellViewer::setCell ( Cell* cell )
|
||||
{
|
||||
list< shared_ptr<CellWidget::State> >::iterator istate
|
||||
= find_if ( _cellHistory.begin(), _cellHistory.end(), CellWidget::FindStateName(cell->getName()) );
|
||||
|
||||
if ( istate != _cellHistory.end() ) {
|
||||
emit stateChanged ( *istate );
|
||||
return;
|
||||
}
|
||||
|
||||
_cellWidget->setCell ( cell );
|
||||
|
||||
QString cellName = "None";
|
||||
if ( cell )
|
||||
cellName = getString(cell->getName()).c_str();
|
||||
|
||||
QString title = QString("%1:<%2>").arg(_applicationName).arg(cellName);
|
||||
setWindowTitle ( title );
|
||||
|
||||
refreshHistory ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -347,13 +388,13 @@ namespace Hurricane {
|
|||
{
|
||||
QAction* historyAction = qobject_cast<QAction*> ( sender() );
|
||||
if ( historyAction ) {
|
||||
list<Cell*>::iterator icell = _cellHistory.begin();
|
||||
size_t index = historyAction->data().toUInt();
|
||||
list< shared_ptr<CellWidget::State> >::iterator istate = _cellHistory.begin();
|
||||
size_t index = historyAction->data().toUInt();
|
||||
|
||||
for ( ; index>0 ; index--, icell++ );
|
||||
for ( ; index>0 ; index--, istate++ );
|
||||
|
||||
cerr << "History: " << *icell << endl;
|
||||
setCell ( *icell );
|
||||
//cerr << "History: " << (*istate)->getName() << endl;
|
||||
emit stateChanged ( *istate );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -847,6 +847,52 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "Hurricane::CellWidget::State".
|
||||
|
||||
|
||||
void CellWidget::State::setScale ( float scale )
|
||||
{
|
||||
_scaleHistory.erase ( _scaleHistory.begin()+_ihistory+1,_scaleHistory.end() );
|
||||
if ( _historyEnable ) {
|
||||
_scaleHistory.push_back ( ScaleEntry(scale,Point(0,0)) );
|
||||
_ihistory++;
|
||||
} else {
|
||||
_scaleHistory[_ihistory]._scale = scale;
|
||||
_scaleHistory[_ihistory]._topLeft = Point(0,0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool CellWidget::State::scaleHistoryUp ()
|
||||
{
|
||||
if ( _ihistory == 0 ) return false;
|
||||
|
||||
_ihistory--;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool CellWidget::State::scaleHistoryDown ()
|
||||
{
|
||||
if ( _ihistory+2 > _scaleHistory.size() ) return false;
|
||||
|
||||
_ihistory++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
const Name& CellWidget::State::getName () const
|
||||
{
|
||||
static const Name noCell = "None";
|
||||
|
||||
if ( !_cell ) return noCell;
|
||||
return _cell->getName();
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "Hurricane::CellWidget".
|
||||
|
||||
|
@ -861,7 +907,6 @@ namespace Hurricane {
|
|||
, _palette (NULL)
|
||||
, _displayArea (0,0,_initialSide+2*_stripWidth,_initialSide+2*_stripWidth)
|
||||
, _visibleArea (_stripWidth,_stripWidth,_initialSide,_initialSide)
|
||||
, _scale (1.0)
|
||||
, _offsetVA (_stripWidth,_stripWidth)
|
||||
, _redrawManager (this)
|
||||
, _drawingPlanes (QSize(_initialSide+2*_stripWidth,_initialSide+2*_stripWidth),this)
|
||||
|
@ -875,6 +920,7 @@ namespace Hurricane {
|
|||
, _cellChanged (true)
|
||||
, _selectionHasChanged (false)
|
||||
, _delaySelectionChanged(0)
|
||||
, _enableRedrawInterrupt(false)
|
||||
, _cellModificated (true)
|
||||
, _selectors ()
|
||||
, _commands ()
|
||||
|
@ -1029,7 +1075,7 @@ namespace Hurricane {
|
|||
{
|
||||
if ( _state->showBoundaries() != state ) {
|
||||
_state->setShowBoundaries ( state );
|
||||
refresh ();
|
||||
_redrawManager.refresh ();
|
||||
|
||||
emit showBoundariesToggled ( state );
|
||||
}
|
||||
|
@ -1064,7 +1110,6 @@ namespace Hurricane {
|
|||
_drawingPlanes.painter().setBackground ( Graphics::getBrush("background") );
|
||||
_drawingPlanes.painter().setClipRect ( redrawArea );
|
||||
_drawingPlanes.painter().eraseRect ( redrawArea );
|
||||
//repaint ();
|
||||
|
||||
setDarkening ( (_state->showSelection()) ? Graphics::getDarkening() : 100 );
|
||||
|
||||
|
@ -1087,10 +1132,8 @@ namespace Hurricane {
|
|||
_drawingQuery.setBasicLayer ( *iLayer );
|
||||
_drawingQuery.setFilter ( _queryFilter & ~(Query::DoMasterCells|Query::DoRubbers) );
|
||||
_drawingQuery.doQuery ();
|
||||
//_drawingPlanes.copyToSelect ( redrawArea );
|
||||
//repaint ();
|
||||
}
|
||||
QApplication::processEvents();
|
||||
if ( _enableRedrawInterrupt ) QApplication::processEvents();
|
||||
if ( _redrawManager.interrupted() ) {
|
||||
//cerr << "CellWidget::redraw() - interrupt after " << (*iLayer)->getName() << endl;
|
||||
break;
|
||||
|
@ -1106,8 +1149,6 @@ namespace Hurricane {
|
|||
_drawingQuery.setBasicLayer ( NULL );
|
||||
_drawingQuery.setFilter ( _queryFilter & ~(Query::DoComponents|Query::DoRubbers) );
|
||||
_drawingQuery.doQuery ();
|
||||
//_drawingPlanes.copyToSelect ( redrawArea );
|
||||
//repaint ();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1119,12 +1160,10 @@ namespace Hurricane {
|
|||
_drawingQuery.setBasicLayer ( NULL );
|
||||
_drawingQuery.setFilter ( _queryFilter & ~(Query::DoComponents|Query::DoMasterCells) );
|
||||
_drawingQuery.doQuery ();
|
||||
//_drawingPlanes.copyToSelect ( redrawArea );
|
||||
//repaint ();
|
||||
}
|
||||
}
|
||||
|
||||
QApplication::processEvents();
|
||||
if ( _enableRedrawInterrupt ) QApplication::processEvents();
|
||||
if ( /*!timeout("redraw [text.instances]",timer,10.0,timedout) &&*/ (!_redrawManager.interrupted()) ) {
|
||||
if ( isDrawable("text.instance") ) {
|
||||
_drawingPlanes.setPen ( Graphics::getPen ("text.instance",getDarkening()) );
|
||||
|
@ -1133,14 +1172,12 @@ namespace Hurricane {
|
|||
_textDrawingQuery.setArea ( redrawBox );
|
||||
_textDrawingQuery.setTransformation ( Transformation() );
|
||||
_textDrawingQuery.doQuery ();
|
||||
//_drawingPlanes.copyToSelect ( redrawArea );
|
||||
//repaint ();
|
||||
}
|
||||
}
|
||||
|
||||
//_drawingQuery.setFilter ( _queryFilter & ~Query::DoMasterCells );
|
||||
forEach ( ExtensionSlice*, islice, getCell()->getExtensionSlices() ) {
|
||||
QApplication::processEvents();
|
||||
if ( _enableRedrawInterrupt ) QApplication::processEvents();
|
||||
if ( /*timeout("redraw [extension]",timer,10.0,timedout) ||*/ (_redrawManager.interrupted()) ) break;
|
||||
|
||||
if ( isDrawableExtension((*islice)->getName()) ) {
|
||||
|
@ -1148,8 +1185,6 @@ namespace Hurricane {
|
|||
_drawingQuery.setDrawExtensionGo ( (*islice)->getName() );
|
||||
_drawingQuery.setFilter ( Query::DoExtensionGos );
|
||||
_drawingQuery.doQuery ();
|
||||
//_drawingPlanes.copyToSelect ( redrawArea );
|
||||
//repaint ();
|
||||
}
|
||||
}
|
||||
repaint ();
|
||||
|
@ -1282,7 +1317,7 @@ namespace Hurricane {
|
|||
PaletteItem* item = (_palette) ? _palette->find(name) : NULL;
|
||||
|
||||
return (!item || item->isItemVisible())
|
||||
&& ( Graphics::getThreshold(name)/DbU::lambda(1.0) < _scale );
|
||||
&& ( Graphics::getThreshold(name)/DbU::lambda(1.0) < getScale() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -1411,7 +1446,7 @@ namespace Hurricane {
|
|||
Box redrawBox = displayToDbuBox ( redrawArea ).inflate ( DbU::lambda(1.0) );
|
||||
|
||||
bool lambdaGrid = false;
|
||||
if ( Graphics::getThreshold("grid")/DbU::lambda(1.0) < _scale/5 )
|
||||
if ( Graphics::getThreshold("grid")/DbU::lambda(1.0) < getScale()/5 )
|
||||
lambdaGrid = true;
|
||||
|
||||
DbU::Unit gridStep = DbU::getSnapGridStep();
|
||||
|
@ -1487,10 +1522,10 @@ namespace Hurricane {
|
|||
_offsetVA.rx() = _stripWidth;
|
||||
_offsetVA.ry() = _stripWidth;
|
||||
|
||||
DbU::Unit xmin = (DbU::Unit)( _visibleArea.getXMin() - ((float)_offsetVA.x()/_scale) );
|
||||
DbU::Unit xmax = (DbU::Unit)( xmin + ((float)_drawingPlanes.width()/_scale) ) ;
|
||||
DbU::Unit ymax = (DbU::Unit)( _visibleArea.getYMax() + ((float)_offsetVA.y()/_scale) );
|
||||
DbU::Unit ymin = (DbU::Unit)( ymax - ((float)_drawingPlanes.height()/_scale) ) ;
|
||||
DbU::Unit xmin = (DbU::Unit)( _visibleArea.getXMin() - ((float)_offsetVA.x()/getScale()) );
|
||||
DbU::Unit xmax = (DbU::Unit)( xmin + ((float)_drawingPlanes.width()/getScale()) ) ;
|
||||
DbU::Unit ymax = (DbU::Unit)( _visibleArea.getYMax() + ((float)_offsetVA.y()/getScale()) );
|
||||
DbU::Unit ymin = (DbU::Unit)( ymax - ((float)_drawingPlanes.height()/getScale()) ) ;
|
||||
|
||||
_displayArea = Box ( xmin, ymin, xmax, ymax );
|
||||
|
||||
|
@ -1498,18 +1533,57 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
void CellWidget::setScale ( float scale )
|
||||
Box CellWidget::computeVisibleArea ( float scale ) const
|
||||
{
|
||||
_scale = scale;
|
||||
|
||||
Point center = _visibleArea.getCenter();
|
||||
|
||||
_visibleArea.makeEmpty ();
|
||||
_visibleArea.merge ( (DbU::Unit)( center.getX() - width () / (_scale*2) )
|
||||
, (DbU::Unit)( center.getY() - height() / (_scale*2) )
|
||||
, (DbU::Unit)( center.getX() + width () / (_scale*2) )
|
||||
, (DbU::Unit)( center.getY() + height() / (_scale*2) )
|
||||
);
|
||||
return Box ( (DbU::Unit)( center.getX() - width () / (scale*2) )
|
||||
, (DbU::Unit)( center.getY() - height() / (scale*2) )
|
||||
, (DbU::Unit)( center.getX() + width () / (scale*2) )
|
||||
, (DbU::Unit)( center.getY() + height() / (scale*2) )
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Box CellWidget::computeVisibleArea ( float scale, const Point& topLeft ) const
|
||||
{
|
||||
return Box ( topLeft.getX()
|
||||
, (DbU::Unit)( topLeft.getY() - height() / scale )
|
||||
, (DbU::Unit)( topLeft.getX() + width () / scale )
|
||||
, topLeft.getY()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Box CellWidget::computeVisibleArea ( const Box& area, float& scale ) const
|
||||
{
|
||||
int widgetWidth = width ();
|
||||
int widgetHeight = height ();
|
||||
|
||||
float scaleX = widgetWidth / (float)area.getWidth ();
|
||||
float scaleY = widgetHeight / (float)area.getHeight();
|
||||
scale = min ( scaleX, scaleY );
|
||||
|
||||
Point center = area.getCenter();
|
||||
|
||||
widgetWidth /= 2;
|
||||
widgetHeight /= 2;
|
||||
|
||||
return Box ( (DbU::Unit)( center.getX() - widgetWidth / scale )
|
||||
, (DbU::Unit)( center.getY() - widgetHeight / scale )
|
||||
, (DbU::Unit)( center.getX() + widgetWidth / scale )
|
||||
, (DbU::Unit)( center.getY() + widgetHeight / scale )
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
void CellWidget::setScale ( float scale )
|
||||
{
|
||||
//cerr << "CellWidget::setScale() - " << scale << endl;
|
||||
|
||||
_state->setTopLeft ( getTopLeft() );
|
||||
_visibleArea = computeVisibleArea ( scale );
|
||||
_state->setScale ( scale );
|
||||
|
||||
//cerr << "_visibleArea: " << _visibleArea << " (offset: " << _offsetVA.x() << ")" << endl;
|
||||
//cerr << " " << center << endl;
|
||||
|
@ -1518,37 +1592,61 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
void CellWidget::scaleHistoryUp ()
|
||||
{
|
||||
_state->setTopLeft ( getTopLeft() );
|
||||
if ( _state->scaleHistoryUp () ) {
|
||||
_visibleArea = computeVisibleArea ( _state->getScale(), _state->getTopLeft() );
|
||||
displayReframe ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CellWidget::scaleHistoryDown ()
|
||||
{
|
||||
_state->setTopLeft ( getTopLeft() );
|
||||
if ( _state->scaleHistoryDown () ) {
|
||||
_visibleArea = computeVisibleArea ( _state->getScale(), _state->getTopLeft() );
|
||||
displayReframe ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CellWidget::reframe ( bool delayed )
|
||||
{
|
||||
//cerr << "CellWidget::reframe() - scale:" << _state->getScale()
|
||||
// << " topLeft:" << _state->getTopLeft() << endl;
|
||||
|
||||
_visibleArea = computeVisibleArea ( _state->getScale(), _state->getTopLeft() );
|
||||
displayReframe ( delayed );
|
||||
}
|
||||
|
||||
|
||||
void CellWidget::reframe ( const Box& box, bool delayed )
|
||||
{
|
||||
//cerr << "CellWidget::reframe() - " << box << endl;
|
||||
//cerr << " widget size := " << _drawingPlanes.width() << "x" << _drawingPlanes.height() << endl;
|
||||
|
||||
//cerr << " CellWidget::reframe() - widget size := " << width() << "x" << height() << endl;
|
||||
int width = this->width ();
|
||||
int height = this->height ();
|
||||
|
||||
float scaleX = width / (float)box.getWidth ();
|
||||
float scaleY = height / (float)box.getHeight();
|
||||
_scale = min ( scaleX, scaleY );
|
||||
float scale;
|
||||
|
||||
Point center = box.getCenter();
|
||||
|
||||
width /= 2;
|
||||
height /= 2;
|
||||
|
||||
_visibleArea = Box ( (DbU::Unit)( center.getX() - width / _scale )
|
||||
, (DbU::Unit)( center.getY() - height / _scale )
|
||||
, (DbU::Unit)( center.getX() + width / _scale )
|
||||
, (DbU::Unit)( center.getY() + height / _scale )
|
||||
);
|
||||
_state->setTopLeft ( getTopLeft() );
|
||||
_visibleArea = computeVisibleArea ( box, scale );
|
||||
_state->setScale ( scale );
|
||||
displayReframe ( delayed );
|
||||
|
||||
//cerr << " _displayArea: " << _displayArea << " (offset: " << _offsetVA.x() << ")" << endl;
|
||||
}
|
||||
|
||||
|
||||
void CellWidget::fitToContents ( bool delayed )
|
||||
void CellWidget::fitToContents ( bool delayed, bool historyEnable )
|
||||
{
|
||||
//cerr << "CellWidget::fitToContents()" << endl;
|
||||
|
||||
bool backupHistoryEnable = _state->getHistoryEnable ();
|
||||
_state->setHistoryEnable ( historyEnable );
|
||||
|
||||
Box boundingBox = Box ( DbU::lambda(0)
|
||||
, DbU::lambda(0)
|
||||
, DbU::lambda(10)
|
||||
|
@ -1557,12 +1655,14 @@ namespace Hurricane {
|
|||
|
||||
if ( getCell() ) boundingBox = getCell()->getBoundingBox();
|
||||
reframe ( boundingBox, delayed );
|
||||
|
||||
_state->setHistoryEnable ( backupHistoryEnable );
|
||||
}
|
||||
|
||||
|
||||
void CellWidget::_goLeft ( int dx )
|
||||
{
|
||||
_visibleArea.translate ( - (DbU::Unit)( dx / _scale ) , 0 );
|
||||
_visibleArea.translate ( - (DbU::Unit)( dx / getScale() ) , 0 );
|
||||
|
||||
if ( _offsetVA.rx() - dx >= 0 ) {
|
||||
_offsetVA.rx() -= dx;
|
||||
|
@ -1572,7 +1672,7 @@ namespace Hurricane {
|
|||
|
||||
int shift = ( 1 + ( dx - _offsetVA.rx() ) / _stripWidth ) * _stripWidth;
|
||||
|
||||
_displayArea.translate ( - (DbU::Unit)( shift / _scale ) , 0 );
|
||||
_displayArea.translate ( - (DbU::Unit)( shift / getScale() ) , 0 );
|
||||
_offsetVA.rx() -= dx - shift;
|
||||
|
||||
if ( shift >= _drawingPlanes.width() )
|
||||
|
@ -1590,7 +1690,7 @@ namespace Hurricane {
|
|||
{
|
||||
//cerr << "CellWidget::goRight() - dx: " << dx << " (offset: " << _offsetVA.rx() << ")" << endl;
|
||||
|
||||
_visibleArea.translate ( (DbU::Unit)( dx / _scale ) , 0 );
|
||||
_visibleArea.translate ( (DbU::Unit)( dx / getScale() ) , 0 );
|
||||
|
||||
if ( _offsetVA.rx() + dx < 2*_stripWidth ) {
|
||||
_offsetVA.rx() += dx;
|
||||
|
@ -1600,7 +1700,7 @@ namespace Hurricane {
|
|||
|
||||
int shift = ( ( _offsetVA.rx() + dx ) / _stripWidth ) * _stripWidth;
|
||||
|
||||
_displayArea.translate ( (DbU::Unit)( shift / _scale ) , 0 );
|
||||
_displayArea.translate ( (DbU::Unit)( shift / getScale() ) , 0 );
|
||||
_offsetVA.rx() += dx - shift;
|
||||
|
||||
if ( shift >= _drawingPlanes.width() )
|
||||
|
@ -1619,7 +1719,7 @@ namespace Hurricane {
|
|||
{
|
||||
//cerr << "CellWidget::shiftUp() - " << dy << " (offset: " << _offsetVA.ry() << ")" << endl;
|
||||
|
||||
_visibleArea.translate ( 0, (DbU::Unit)( dy / _scale ) );
|
||||
_visibleArea.translate ( 0, (DbU::Unit)( dy / getScale() ) );
|
||||
|
||||
if ( _offsetVA.ry() - dy >= 0 ) {
|
||||
_offsetVA.ry() -= dy;
|
||||
|
@ -1629,7 +1729,7 @@ namespace Hurricane {
|
|||
|
||||
int shift = ( 1 + ( dy - _offsetVA.ry() ) / _stripWidth ) * _stripWidth;
|
||||
|
||||
_displayArea.translate ( 0, (DbU::Unit)( shift / _scale ) );
|
||||
_displayArea.translate ( 0, (DbU::Unit)( shift / getScale() ) );
|
||||
_offsetVA.ry() -= dy - shift;
|
||||
|
||||
if ( shift >= _drawingPlanes.height() )
|
||||
|
@ -1647,7 +1747,7 @@ namespace Hurricane {
|
|||
{
|
||||
//cerr << "CellWidget::shiftDown() - " << dy << " (offset: " << _offsetVA.ry() << ")" << endl;
|
||||
|
||||
_visibleArea.translate ( 0, - (DbU::Unit)( dy / _scale ) );
|
||||
_visibleArea.translate ( 0, - (DbU::Unit)( dy / getScale() ) );
|
||||
|
||||
if ( _offsetVA.ry() + dy < 2*_stripWidth ) {
|
||||
_offsetVA.ry() += dy;
|
||||
|
@ -1657,7 +1757,7 @@ namespace Hurricane {
|
|||
|
||||
int shift = ( ( _offsetVA.ry() + dy ) / _stripWidth ) * _stripWidth;
|
||||
|
||||
_displayArea.translate ( 0, - (DbU::Unit)( shift / _scale ) );
|
||||
_displayArea.translate ( 0, - (DbU::Unit)( shift / getScale() ) );
|
||||
_offsetVA.ry() += dy - shift;
|
||||
|
||||
if ( shift >= _drawingPlanes.height() )
|
||||
|
@ -1681,7 +1781,8 @@ namespace Hurricane {
|
|||
void CellWidget::showEvent ( QShowEvent* )
|
||||
{
|
||||
//cerr << "CellWidget::showEvent() - size: " << geometry().width() << "x" << geometry().height() << endl;
|
||||
if ( _cellChanged ) fitToContents();
|
||||
if ( _cellChanged )
|
||||
fitToContents ( false, false );
|
||||
}
|
||||
|
||||
|
||||
|
@ -1728,8 +1829,8 @@ namespace Hurricane {
|
|||
uaDelta.rheight() = uaSize.height() - _drawingPlanes.height();
|
||||
|
||||
if ( uaDelta.width() || uaDelta.height() ) {
|
||||
_displayArea.inflate ( 0, 0, (DbU::Unit)(uaDelta.width()/_scale), (DbU::Unit)(uaDelta.height()/_scale) );
|
||||
_visibleArea.inflate ( 0, 0, (DbU::Unit)(uaDelta.width()/_scale), (DbU::Unit)(uaDelta.height()/_scale) );
|
||||
_displayArea.inflate ( 0, 0, (DbU::Unit)(uaDelta.width()/getScale()), (DbU::Unit)(uaDelta.height()/getScale()) );
|
||||
_visibleArea.inflate ( 0, 0, (DbU::Unit)(uaDelta.width()/getScale()), (DbU::Unit)(uaDelta.height()/getScale()) );
|
||||
|
||||
QSize bufferSize ( ( ( uaSize.width () / _stripWidth ) + 1 ) * _stripWidth
|
||||
, ( ( uaSize.height() / _stripWidth ) + 1 ) * _stripWidth );
|
||||
|
@ -1864,29 +1965,43 @@ namespace Hurricane {
|
|||
|
||||
shared_ptr<State> state ( new State(cell) );
|
||||
setState ( state );
|
||||
|
||||
fitToContents ( false, false );
|
||||
|
||||
_state->setHistoryEnable ( true );
|
||||
}
|
||||
|
||||
|
||||
void CellWidget::setState ( shared_ptr<State>& state )
|
||||
{
|
||||
//cerr << "CellWidget::setCell() - " << cell << endl;
|
||||
//cerr << "CellWidget::setState() - " << state->getName() << endl;
|
||||
|
||||
if ( state.get() == _state.get() ) return;
|
||||
if ( state == _state ) return;
|
||||
|
||||
cellPreModificate ();
|
||||
_state->getSelection().clear ();
|
||||
_state->getSelection ().clear ();
|
||||
_state->setCellWidget ( NULL );
|
||||
_state->setTopLeft ( getTopLeft() );
|
||||
|
||||
_cellChanged = true;
|
||||
_state = state;
|
||||
|
||||
// cerr << " about to restore " << (void*)_state.get()
|
||||
// << " " << _state->getName()
|
||||
// << ": _state->setTopLeft("
|
||||
// << DbU::getValueString(_state->getTopLeft().getX()) << ","
|
||||
// << DbU::getValueString(_state->getTopLeft().getY()) << ")" << endl;
|
||||
|
||||
_state->setHistoryEnable ( false );
|
||||
_state->setCellWidget ( this );
|
||||
_drawingQuery .setCell ( getCell() );
|
||||
_textDrawingQuery.setCell ( getCell() );
|
||||
|
||||
emit cellChanged ( getCell() );
|
||||
reframe ( true );
|
||||
_state->setHistoryEnable ( true );
|
||||
|
||||
fitToContents ( true );
|
||||
emit cellChanged ( getCell() );
|
||||
emit stateChanged ( _state );
|
||||
|
||||
cellPostModificate ();
|
||||
}
|
||||
|
@ -2017,7 +2132,7 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
void CellWidget::toggleSelect ( Occurrence occurrence, bool fromPopup )
|
||||
void CellWidget::toggleSelection ( Occurrence occurrence )
|
||||
{
|
||||
if ( !occurrence.isValid() )
|
||||
throw Error ( "Can't select occurrence : invalid occurrence" );
|
||||
|
@ -2040,7 +2155,7 @@ namespace Hurricane {
|
|||
_selectionHasChanged = true;
|
||||
if ( _state->showSelection() ) _redrawManager.refresh ();
|
||||
|
||||
if ( fromPopup ) emit occurrenceToggled ( occurrence );
|
||||
emit selectionToggled ( occurrence );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -290,10 +290,10 @@ namespace Hurricane {
|
|||
if ( getCellWidget() ) {
|
||||
connect ( getCellWidget(), SIGNAL(selectionChanged(const SelectorSet&,Cell*))
|
||||
, _selection , SLOT (setSelection (const SelectorSet&,Cell*)) );
|
||||
connect ( _selection , SIGNAL(occurrenceToggled(Occurrence,bool))
|
||||
, getCellWidget(), SLOT (toggleSelect (Occurrence,bool)) );
|
||||
connect ( getCellWidget(), SIGNAL(occurrenceToggled(Occurrence))
|
||||
, _selection , SLOT (toggleSelection (Occurrence)) );
|
||||
connect ( _selection , SIGNAL(selectionToggled(Occurrence))
|
||||
, getCellWidget(), SLOT (toggleSelection (Occurrence)) );
|
||||
connect ( getCellWidget(), SIGNAL(selectionToggled(Occurrence))
|
||||
, _selection , SLOT (toggleSelection (Occurrence)) );
|
||||
connect ( _selection , SIGNAL(cumulativeToggled (bool))
|
||||
, getCellWidget(), SLOT (setCumulativeSelection(bool)) );
|
||||
connect ( _selection , SIGNAL(selectionCleared())
|
||||
|
|
|
@ -0,0 +1,103 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC/LIP6 2008-2009, 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 : "./HierarchyCommand.cpp" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
|
||||
|
||||
# include <QMouseEvent>
|
||||
# include <QKeyEvent>
|
||||
# include <QAction>
|
||||
|
||||
# include "hurricane/Cell.h"
|
||||
|
||||
# include "hurricane/viewer/CellWidget.h"
|
||||
# include "hurricane/viewer/HierarchyCommand.h"
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "HierarchyCommand".
|
||||
|
||||
|
||||
HierarchyCommand::HierarchyCommand ()
|
||||
: Command ()
|
||||
, _history()
|
||||
, _historyIndex(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
HierarchyCommand::~HierarchyCommand ()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool HierarchyCommand::keyReleaseEvent ( CellWidget* widget, QKeyEvent* event )
|
||||
{
|
||||
bool control = (event->modifiers() & Qt::ControlModifier);
|
||||
bool shift = (event->modifiers() & Qt::ShiftModifier );
|
||||
|
||||
if ( !shift && !control ) return false;
|
||||
if ( !widget->getCell() ) return false;
|
||||
|
||||
QPoint position ( widget->mapFromGlobal(QCursor::pos()) );
|
||||
Box pointBox ( widget->screenToDbuBox(QRect(position,QSize(1,1))) );
|
||||
|
||||
switch ( event->key() ) {
|
||||
case Qt::Key_U:
|
||||
if ( ( _historyIndex > 0 ) && (shift || control) ) {
|
||||
widget->setState ( _history[--_historyIndex]._state );
|
||||
}
|
||||
break;
|
||||
case Qt::Key_D:
|
||||
{
|
||||
if ( control ) {
|
||||
if ( _history.empty() )
|
||||
_history.push_back ( HistoryEntry ( NULL, widget->getState() ) );
|
||||
|
||||
Instances instances = widget->getCell()->getInstancesUnder ( pointBox );
|
||||
if ( !instances.isEmpty() ) {
|
||||
_history.erase ( _history.begin()+_historyIndex+1, _history.end() );
|
||||
|
||||
Instance* instance = instances.getFirst ();
|
||||
widget->setCell ( instance->getMasterCell() );
|
||||
_history.push_back ( HistoryEntry ( instance, widget->getState() ) );
|
||||
_historyIndex++;
|
||||
}
|
||||
} else if ( shift ) {
|
||||
if ( _historyIndex+1 < _history.size() ) {
|
||||
widget->setState ( _history[++_historyIndex]._state );
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
|
@ -317,7 +317,7 @@ namespace Hurricane {
|
|||
} else if ( event->key() == Qt::Key_O ) {
|
||||
forkInspector ( _view->currentIndex() );
|
||||
} else {
|
||||
event->ignore();
|
||||
QWidget::keyPressEvent ( event );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -159,7 +159,7 @@ namespace Hurricane {
|
|||
|
||||
void NetlistWidget::keyPressEvent ( QKeyEvent* event )
|
||||
{
|
||||
event->ignore ();
|
||||
QWidget::keyPressEvent ( event );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -48,8 +48,8 @@ namespace Hurricane {
|
|||
{
|
||||
_selectionPopup = new SelectionPopup ();
|
||||
|
||||
connect ( _selectionPopup, SIGNAL(occurrenceSelected(Occurrence,bool))
|
||||
, this , SIGNAL(selectionToggled (Occurrence,bool)) );
|
||||
connect ( _selectionPopup, SIGNAL(selectionToggled(Occurrence))
|
||||
, this , SIGNAL(selectionToggled(Occurrence)) );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ namespace Hurricane {
|
|||
|
||||
void SelectionPopup::keyPressEvent ( QKeyEvent* event )
|
||||
{
|
||||
event->ignore();
|
||||
QWidget::keyPressEvent ( event );
|
||||
}
|
||||
|
||||
|
||||
|
@ -123,7 +123,7 @@ namespace Hurricane {
|
|||
if ( index.isValid() ) {
|
||||
Occurrence occurrence = _model->getOccurrence(index.row());
|
||||
if ( occurrence.getEntity() )
|
||||
emit occurrenceSelected ( occurrence, true );
|
||||
emit selectionToggled ( occurrence );
|
||||
}
|
||||
|
||||
clear ();
|
||||
|
|
|
@ -47,14 +47,15 @@ namespace Hurricane {
|
|||
|
||||
|
||||
SelectionWidget::SelectionWidget ( QWidget* parent )
|
||||
: QWidget(parent)
|
||||
, _baseModel(new SelectionModel(this))
|
||||
, _sortModel(new QSortFilterProxyModel(this))
|
||||
, _view(new QTableView(this))
|
||||
: QWidget (parent)
|
||||
, _baseModel (new SelectionModel(this))
|
||||
, _sortModel (new QSortFilterProxyModel(this))
|
||||
, _view (new QTableView(this))
|
||||
, _filterPatternLineEdit(new QLineEdit(this))
|
||||
, _cumulative(new QCheckBox())
|
||||
, _showSelection(new QCheckBox())
|
||||
, _rowHeight(20)
|
||||
, _cumulative (new QCheckBox())
|
||||
, _showSelection (new QCheckBox())
|
||||
, _rowHeight (20)
|
||||
, _isEmitter (false)
|
||||
{
|
||||
setAttribute ( Qt::WA_DeleteOnClose );
|
||||
setAttribute ( Qt::WA_QuitOnClose, false );
|
||||
|
@ -147,7 +148,7 @@ namespace Hurricane {
|
|||
{
|
||||
if ( event->key() == Qt::Key_I ) { inspect ( _view->currentIndex() ); }
|
||||
else if ( event->key() == Qt::Key_T ) { toggleSelection ( _view->currentIndex() ); }
|
||||
else event->ignore();
|
||||
else QWidget::keyPressEvent ( event );
|
||||
}
|
||||
|
||||
|
||||
|
@ -167,14 +168,19 @@ namespace Hurricane {
|
|||
void SelectionWidget::toggleSelection ( const QModelIndex& index )
|
||||
{
|
||||
Occurrence occurrence = _baseModel->toggleSelection ( index );
|
||||
if ( occurrence.isValid() )
|
||||
emit occurrenceToggled ( occurrence, false );
|
||||
if ( occurrence.isValid() ) {
|
||||
_isEmitter = true;
|
||||
emit selectionToggled ( occurrence );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SelectionWidget::toggleSelection ( Occurrence occurrence )
|
||||
{
|
||||
_baseModel->toggleSelection ( occurrence );
|
||||
if ( !_isEmitter ) {
|
||||
_baseModel->toggleSelection ( occurrence );
|
||||
_isEmitter = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -62,6 +62,8 @@ namespace Hurricane {
|
|||
switch ( event->key() ) {
|
||||
case Qt::Key_Z: widget->setScale ( widget->getScale()*2.0 ); return true;
|
||||
case Qt::Key_M: widget->setScale ( widget->getScale()/2.0 ); return true;
|
||||
case Qt::Key_U: widget->scaleHistoryUp (); return true;
|
||||
case Qt::Key_D: widget->scaleHistoryDown(); return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -45,6 +45,8 @@ class QMenu;
|
|||
#include "hurricane/viewer/MoveCommand.h"
|
||||
#include "hurricane/viewer/ZoomCommand.h"
|
||||
#include "hurricane/viewer/SelectCommand.h"
|
||||
#include "hurricane/viewer/HierarchyCommand.h"
|
||||
#include "hurricane/viewer/CellWidget.h"
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
@ -55,7 +57,6 @@ namespace Hurricane {
|
|||
class HGraphics;
|
||||
class HDisplayFilter;
|
||||
//class MapView;
|
||||
class CellWidget;
|
||||
class MousePositionWidget;
|
||||
class HSelection;
|
||||
class ControllerWidget;
|
||||
|
@ -68,21 +69,24 @@ namespace Hurricane {
|
|||
CellViewer ( QWidget* parent=NULL );
|
||||
virtual ~CellViewer ();
|
||||
QMenu* createDebugMenu ();
|
||||
inline void setApplicationName ( const QString& name );
|
||||
void setCell ( Cell* cell );
|
||||
inline void setEnableRedrawInterrupt ( bool );
|
||||
inline void setApplicationName ( const QString& );
|
||||
void setCell ( Cell* );
|
||||
Cell* getCell ();
|
||||
virtual Cell* getCellFromDb ( const char* name );
|
||||
inline CellWidget* getCellWidget ();
|
||||
void select ( Occurrence& occurence );
|
||||
void unselect ( Occurrence& occurence );
|
||||
void select ( Occurrence& );
|
||||
void unselect ( Occurrence& );
|
||||
void unselectAll ();
|
||||
public slots:
|
||||
void setShowSelection ( bool );
|
||||
void setState ( shared_ptr<CellWidget::State>& );
|
||||
void showController ();
|
||||
void openHistoryCell ();
|
||||
void printDisplay ();
|
||||
signals:
|
||||
void showSelectionToggled ( bool );
|
||||
void stateChanged ( shared_ptr<CellWidget::State>& );
|
||||
void redrawCellWidget ();
|
||||
|
||||
public:
|
||||
|
@ -113,18 +117,24 @@ namespace Hurricane {
|
|||
MoveCommand _moveCommand;
|
||||
ZoomCommand _zoomCommand;
|
||||
SelectCommand _selectCommand;
|
||||
list<Cell*> _cellHistory;
|
||||
HierarchyCommand _hierarchyCommand;
|
||||
list< shared_ptr<CellWidget::State> >
|
||||
_cellHistory;
|
||||
bool _firstShow;
|
||||
|
||||
protected:
|
||||
void createActions ();
|
||||
void createMenus ();
|
||||
void createLayout ();
|
||||
void refreshTitle ();
|
||||
void refreshHistory ();
|
||||
};
|
||||
|
||||
|
||||
// Inline Functions.
|
||||
inline void CellViewer::setEnableRedrawInterrupt ( bool state )
|
||||
{ _cellWidget->setEnableRedrawInterrupt(state); }
|
||||
|
||||
inline CellWidget* CellViewer::getCellWidget () { return _cellWidget; }
|
||||
inline void CellViewer::setApplicationName ( const QString& name ) { _applicationName = name; }
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <math.h>
|
||||
|
||||
#include <vector>
|
||||
#include <functional>
|
||||
#include <tr1/memory>
|
||||
|
||||
#include <QWidget>
|
||||
|
@ -65,6 +66,7 @@ class QAction;
|
|||
namespace Hurricane {
|
||||
|
||||
using std::vector;
|
||||
using std::unary_function;
|
||||
using std::tr1::shared_ptr;
|
||||
|
||||
class Technology;
|
||||
|
@ -109,7 +111,6 @@ namespace Hurricane {
|
|||
// Accessors.
|
||||
// MapView* getMapView () { return _mapView; };
|
||||
void setCell ( Cell* );
|
||||
void setState ( shared_ptr<State>& );
|
||||
inline Cell* getCell () const;
|
||||
inline shared_ptr<State>& getState ();
|
||||
inline PaletteWidget* getPalette ();
|
||||
|
@ -131,11 +132,12 @@ namespace Hurricane {
|
|||
inline int getQueryFilter () const ;
|
||||
inline bool timeout ( const char*, const Timer&, double timeout, bool& timedout ) const;
|
||||
// Painter control & Hurricane objects drawing primitives.
|
||||
inline void setEnableRedrawInterrupt ( bool );
|
||||
inline void addDrawExtensionGo ( const Name&, InitExtensionGo_t*, DrawExtensionGo_t* );
|
||||
inline QPainter& getPainter ( size_t plane=PlaneId::Working );
|
||||
inline int getDarkening () const;
|
||||
inline void copyToPrinter ( QPrinter* printer );
|
||||
inline float getScale () const;
|
||||
inline const float& getScale () const;
|
||||
inline const QPoint& getMousePosition () const;
|
||||
bool isDrawable ( const Name& );
|
||||
bool isDrawableLayer ( const Name& );
|
||||
|
@ -175,6 +177,10 @@ namespace Hurricane {
|
|||
inline DbU::Unit screenToDbuY ( int y ) const;
|
||||
inline Point screenToDbuPoint ( const QPoint& point ) const;
|
||||
inline Box screenToDbuBox ( const QRect& rect ) const;
|
||||
inline Point getTopLeft () const;
|
||||
Box computeVisibleArea ( float scale ) const;
|
||||
Box computeVisibleArea ( float scale, const Point& topLeft ) const;
|
||||
Box computeVisibleArea ( const Box&, float& scale ) const;
|
||||
// Qt QWidget Functions Overloads.
|
||||
void pushCursor ( Qt::CursorShape cursor );
|
||||
void popCursor ();
|
||||
|
@ -192,17 +198,19 @@ namespace Hurricane {
|
|||
void cellChanged ( Cell* );
|
||||
void cellPreModificated ();
|
||||
void cellPostModificated ();
|
||||
void stateChanged ( shared_ptr<CellWidget::State>& );
|
||||
void settingsChanged ();
|
||||
void styleChanged ( void* emitter );
|
||||
void updatePalette ( Cell* );
|
||||
void mousePositionChanged ( const Point& position );
|
||||
void selectionChanged ( const SelectorSet&, Cell* );
|
||||
void occurrenceToggled ( Occurrence );
|
||||
void selectionToggled ( Occurrence );
|
||||
void showSelectionToggled ( bool );
|
||||
void cumulativeSelectionToggled ( bool );
|
||||
void showBoundariesToggled ( bool );
|
||||
public slots:
|
||||
// Qt QWidget Slots Overload & CellWidget Specifics.
|
||||
void setState ( shared_ptr<CellWidget::State>& );
|
||||
inline DrawingPlanes& getDrawingPlanes ();
|
||||
inline QPoint& getOffsetVA ();
|
||||
void select ( const Net* net, bool delayRedraw=false );
|
||||
|
@ -212,7 +220,7 @@ namespace Hurricane {
|
|||
void unselect ( const Net* net, bool delayRedraw=false );
|
||||
void unselect ( Occurrence occurence );
|
||||
void unselectAll ( bool delayRedraw=false );
|
||||
void toggleSelect ( Occurrence occurence, bool fromPopup );
|
||||
void toggleSelection ( Occurrence occurence );
|
||||
void setShowSelection ( bool state );
|
||||
void setCumulativeSelection ( bool state );
|
||||
void _select ( const Net* net, bool delayRedraw=false );
|
||||
|
@ -232,9 +240,12 @@ namespace Hurricane {
|
|||
void goRight ( int dx = 0 );
|
||||
void goUp ( int dy = 0 );
|
||||
void goDown ( int dy = 0 );
|
||||
void fitToContents ( bool delayed=false );
|
||||
void fitToContents ( bool delayed=false, bool historyEnable=true );
|
||||
void setScale ( float );
|
||||
void scaleHistoryUp ();
|
||||
void scaleHistoryDown ();
|
||||
void setShowBoundaries ( bool state );
|
||||
void reframe ( bool delayed=false );
|
||||
void reframe ( const Box& box, bool delayed=false );
|
||||
void displayReframe ( bool delayed=false );
|
||||
void _goLeft ( int dx );
|
||||
|
@ -458,17 +469,50 @@ namespace Hurricane {
|
|||
inline void setShowBoundaries ( bool );
|
||||
inline void setShowSelection ( bool );
|
||||
inline void setCumulativeSelection ( bool );
|
||||
void setScale ( float );
|
||||
inline void setTopLeft ( DbU::Unit, DbU::Unit );
|
||||
inline void setTopLeft ( const Point& );
|
||||
inline void setHistoryEnable ( bool );
|
||||
bool scaleHistoryUp ();
|
||||
bool scaleHistoryDown ();
|
||||
inline Cell* getCell () const;
|
||||
const Name& getName () const;
|
||||
inline SelectorCriterions& getSelection ();
|
||||
inline bool showBoundaries () const;
|
||||
inline bool showSelection () const;
|
||||
inline bool cumulativeSelection () const;
|
||||
inline bool showBoundaries () const;
|
||||
inline bool showSelection () const;
|
||||
inline bool cumulativeSelection () const;
|
||||
inline bool getHistoryEnable () const;
|
||||
inline size_t getHistorySize () const;
|
||||
inline const float& getScale () const;
|
||||
inline const Point& getTopLeft () const;
|
||||
|
||||
private:
|
||||
class ScaleEntry {
|
||||
public:
|
||||
inline ScaleEntry ( float, const Point& );
|
||||
public:
|
||||
float _scale;
|
||||
Point _topLeft;
|
||||
};
|
||||
|
||||
private:
|
||||
Cell* _cell;
|
||||
CellWidget* _cellWidget;
|
||||
SelectorCriterions _selection;
|
||||
bool _showBoundaries;
|
||||
bool _showSelection;
|
||||
bool _cumulativeSelection;
|
||||
vector<ScaleEntry> _scaleHistory;
|
||||
size_t _ihistory;
|
||||
bool _historyEnable;
|
||||
};
|
||||
public:
|
||||
class FindStateName : public unary_function< const shared_ptr<State>&, bool > {
|
||||
public:
|
||||
inline FindStateName ( const Name& );
|
||||
inline bool operator() ( const shared_ptr<State>& );
|
||||
private:
|
||||
const Name _cellName;
|
||||
};
|
||||
|
||||
protected:
|
||||
|
@ -481,7 +525,6 @@ namespace Hurricane {
|
|||
PaletteWidget* _palette;
|
||||
Box _displayArea;
|
||||
Box _visibleArea;
|
||||
float _scale;
|
||||
QPoint _offsetVA;
|
||||
RedrawManager _redrawManager;
|
||||
DrawingPlanes _drawingPlanes;
|
||||
|
@ -496,6 +539,7 @@ namespace Hurricane {
|
|||
bool _selectionHasChanged;
|
||||
int _delaySelectionChanged;
|
||||
bool _cellModificated;
|
||||
bool _enableRedrawInterrupt;
|
||||
SelectorSet _selectors;
|
||||
vector<Command*> _commands;
|
||||
size_t _redrawRectCount;
|
||||
|
@ -531,6 +575,10 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
inline void CellWidget::setEnableRedrawInterrupt ( bool state )
|
||||
{ _enableRedrawInterrupt = state; }
|
||||
|
||||
|
||||
inline void CellWidget::DrawingQuery::addDrawExtensionGo ( const Name& name
|
||||
, InitExtensionGo_t* initExtensionGo
|
||||
, DrawExtensionGo_t* drawExtensionGo
|
||||
|
@ -677,13 +725,23 @@ namespace Hurricane {
|
|||
{ return _criterions.size(); }
|
||||
|
||||
|
||||
inline CellWidget::State::ScaleEntry::ScaleEntry ( float scale, const Point& topLeft )
|
||||
: _scale(scale), _topLeft(topLeft)
|
||||
{ }
|
||||
|
||||
|
||||
inline CellWidget::State::State ( Cell* cell )
|
||||
: _cell (cell)
|
||||
, _selection ()
|
||||
, _showBoundaries (true)
|
||||
, _showSelection (false)
|
||||
, _cumulativeSelection(false)
|
||||
{ }
|
||||
, _scaleHistory ()
|
||||
, _ihistory (0)
|
||||
, _historyEnable (false)
|
||||
{
|
||||
_scaleHistory.push_back ( ScaleEntry(1.0,Point(0,0)) );
|
||||
}
|
||||
|
||||
|
||||
inline void CellWidget::State::setCell ( Cell* cell )
|
||||
|
@ -691,7 +749,10 @@ namespace Hurricane {
|
|||
|
||||
|
||||
inline void CellWidget::State::setCellWidget ( CellWidget* cw )
|
||||
{ _selection.setCellWidget ( cw ); }
|
||||
{
|
||||
_cellWidget = cw;
|
||||
_selection.setCellWidget ( cw );
|
||||
}
|
||||
|
||||
|
||||
inline void CellWidget::State::setShowBoundaries ( bool state )
|
||||
|
@ -706,6 +767,23 @@ namespace Hurricane {
|
|||
{ _cumulativeSelection = state; }
|
||||
|
||||
|
||||
inline void CellWidget::State::setTopLeft ( DbU::Unit x, DbU::Unit y )
|
||||
{
|
||||
_scaleHistory[_ihistory]._topLeft.setX(x);
|
||||
_scaleHistory[_ihistory]._topLeft.setY(y);
|
||||
}
|
||||
|
||||
|
||||
inline void CellWidget::State::setTopLeft ( const Point& topLeft )
|
||||
{
|
||||
_scaleHistory[_ihistory]._topLeft = topLeft;
|
||||
}
|
||||
|
||||
|
||||
inline void CellWidget::State::setHistoryEnable ( bool enable )
|
||||
{ _historyEnable = enable; }
|
||||
|
||||
|
||||
inline Cell* CellWidget::State::getCell () const
|
||||
{ return _cell; }
|
||||
|
||||
|
@ -726,8 +804,37 @@ namespace Hurricane {
|
|||
{ return _cumulativeSelection; }
|
||||
|
||||
|
||||
inline bool CellWidget::State::getHistoryEnable () const
|
||||
{ return _historyEnable; }
|
||||
|
||||
|
||||
inline size_t CellWidget::State::getHistorySize () const
|
||||
{ return _scaleHistory.size(); }
|
||||
|
||||
|
||||
inline const Point& CellWidget::State::getTopLeft () const
|
||||
{ return _scaleHistory[_ihistory]._topLeft; }
|
||||
|
||||
|
||||
inline const float& CellWidget::State::getScale () const
|
||||
{ return _scaleHistory[_ihistory]._scale; }
|
||||
|
||||
|
||||
CellWidget::FindStateName::FindStateName ( const Name& cellName )
|
||||
: unary_function< const shared_ptr<State>&, bool >()
|
||||
, _cellName(cellName)
|
||||
{ }
|
||||
|
||||
|
||||
bool CellWidget::FindStateName::operator () ( const shared_ptr<State>& state )
|
||||
{ return state->getName() == _cellName; }
|
||||
|
||||
|
||||
inline shared_ptr<CellWidget::State>& CellWidget::getState ()
|
||||
{ return _state; }
|
||||
{
|
||||
_state->setTopLeft ( getTopLeft() );
|
||||
return _state;
|
||||
}
|
||||
|
||||
|
||||
inline void CellWidget::addDrawExtensionGo ( const Name& name
|
||||
|
@ -774,23 +881,23 @@ namespace Hurricane {
|
|||
|
||||
|
||||
inline int CellWidget::dbuToDisplayX ( DbU::Unit x ) const
|
||||
{ return (int)rint ( (float)( x - _displayArea.getXMin() ) * _scale ); }
|
||||
{ return (int)rint ( (float)( x - _displayArea.getXMin() ) * getScale() ); }
|
||||
|
||||
|
||||
inline int CellWidget::dbuToDisplayY ( DbU::Unit y ) const
|
||||
{ return (int)rint ( (float)( _displayArea.getYMax() - y ) * _scale ); }
|
||||
{ return (int)rint ( (float)( _displayArea.getYMax() - y ) * getScale() ); }
|
||||
|
||||
|
||||
inline int CellWidget::dbuToDisplayLength ( DbU::Unit length ) const
|
||||
{ return (int)rint ( (float)length * _scale ); }
|
||||
{ return (int)rint ( (float)length * getScale() ); }
|
||||
|
||||
|
||||
inline int CellWidget::dbuToScreenX ( DbU::Unit x ) const
|
||||
{ return (int)rint ( (float)( x - _displayArea.getXMin() ) * _scale ) - _offsetVA.x(); }
|
||||
{ return (int)rint ( (float)( x - _displayArea.getXMin() ) * getScale() ) - _offsetVA.x(); }
|
||||
|
||||
|
||||
inline int CellWidget::dbuToScreenY ( DbU::Unit y ) const
|
||||
{ return (int)rint ( (float)( _displayArea.getYMax() - y ) * _scale ) - _offsetVA.y(); }
|
||||
{ return (int)rint ( (float)( _displayArea.getYMax() - y ) * getScale() ) - _offsetVA.y(); }
|
||||
|
||||
|
||||
inline QPoint CellWidget::dbuToScreenPoint ( const Point& point ) const
|
||||
|
@ -798,15 +905,15 @@ namespace Hurricane {
|
|||
|
||||
|
||||
inline DbU::Unit CellWidget::displayToDbuX ( int x ) const
|
||||
{ return (DbU::Unit)(x/_scale) + _displayArea.getXMin(); }
|
||||
{ return (DbU::Unit)(x/getScale()) + _displayArea.getXMin(); }
|
||||
|
||||
|
||||
inline DbU::Unit CellWidget::displayToDbuY ( int y ) const
|
||||
{ return _displayArea.getYMax() - (DbU::Unit)(y/_scale); }
|
||||
{ return _displayArea.getYMax() - (DbU::Unit)(y/getScale()); }
|
||||
|
||||
|
||||
inline DbU::Unit CellWidget::displayToDbuLength ( int length ) const
|
||||
{ return (int)( (float)length / _scale ); }
|
||||
{ return (int)( (float)length / getScale() ); }
|
||||
|
||||
|
||||
inline Box CellWidget::displayToDbuBox ( const QRect& rect ) const
|
||||
|
@ -841,6 +948,10 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
inline Point CellWidget::getTopLeft () const
|
||||
{ return Point(_visibleArea.getXMin(),_visibleArea.getYMax()); }
|
||||
|
||||
|
||||
inline Cell* CellWidget::getCell () const
|
||||
{ return _state->getCell(); }
|
||||
|
||||
|
@ -869,8 +980,8 @@ namespace Hurricane {
|
|||
{ return _darkening; }
|
||||
|
||||
|
||||
inline float CellWidget::getScale () const
|
||||
{ return _scale; }
|
||||
inline const float& CellWidget::getScale () const
|
||||
{ return _state->getScale(); }
|
||||
|
||||
|
||||
inline const QPoint& CellWidget::getMousePosition () const
|
||||
|
|
|
@ -0,0 +1,86 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC/LIP6 2008-2009, 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 : "./HierarchyCommand.h" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
|
||||
|
||||
#ifndef __HURRICANE_HIERARCHY_COMMAND__
|
||||
#define __HURRICANE_HIERARCHY_COMMAND__
|
||||
|
||||
#include <set>
|
||||
|
||||
#include <QObject>
|
||||
#include <QPoint>
|
||||
|
||||
class QAction;
|
||||
|
||||
#include "hurricane/Occurrence.h"
|
||||
#include "hurricane/viewer/Command.h"
|
||||
#include "hurricane/viewer/CellWidget.h"
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
|
||||
class Cell;
|
||||
|
||||
|
||||
class HierarchyCommand : public Command {
|
||||
public:
|
||||
HierarchyCommand ();
|
||||
virtual ~HierarchyCommand ();
|
||||
virtual bool keyReleaseEvent ( CellWidget*, QKeyEvent* );
|
||||
|
||||
private:
|
||||
class HistoryEntry {
|
||||
public:
|
||||
inline HistoryEntry ( Instance*, shared_ptr<CellWidget::State> );
|
||||
public:
|
||||
Instance* _instance;
|
||||
shared_ptr<CellWidget::State> _state;
|
||||
};
|
||||
|
||||
private:
|
||||
HierarchyCommand ( const HierarchyCommand& );
|
||||
HierarchyCommand& operator= ( const HierarchyCommand& );
|
||||
private:
|
||||
vector<HistoryEntry> _history;
|
||||
size_t _historyIndex;
|
||||
};
|
||||
|
||||
|
||||
// Inline Functions.
|
||||
inline HierarchyCommand::HistoryEntry::HistoryEntry ( Instance* instance
|
||||
, shared_ptr<CellWidget::State> state
|
||||
)
|
||||
: _instance(instance)
|
||||
, _state (state)
|
||||
{ }
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
|
||||
|
||||
#endif
|
|
@ -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-2009, All Rights Reserved
|
||||
//
|
||||
// ===================================================================
|
||||
//
|
||||
|
@ -58,7 +58,7 @@ namespace Hurricane {
|
|||
virtual bool mouseReleaseEvent ( CellWidget*, QMouseEvent* );
|
||||
void bindToAction ( QAction* action );
|
||||
signals:
|
||||
void selectionToggled ( Occurrence occurrence, bool fromPopup );
|
||||
void selectionToggled ( Occurrence occurrence );
|
||||
private:
|
||||
QAction* _selectAction;
|
||||
SelectionPopup* _selectionPopup;
|
||||
|
|
|
@ -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-2009, All Rights Reserved
|
||||
//
|
||||
// ===================================================================
|
||||
//
|
||||
|
@ -51,18 +51,18 @@ namespace Hurricane {
|
|||
|
||||
public:
|
||||
SelectionPopup ( QWidget* parent=NULL );
|
||||
void updateLayout ();
|
||||
void popup ();
|
||||
void updateLayout ();
|
||||
void popup ();
|
||||
signals:
|
||||
void occurrenceSelected ( Occurrence occurrence, bool fromPopup );
|
||||
void selectionToggled ( Occurrence occurrence );
|
||||
public slots:
|
||||
void add ( Occurrence occurrence, bool showChange=false );
|
||||
void clear ();
|
||||
void forceRowHeight ();
|
||||
void add ( Occurrence occurrence, bool showChange=false );
|
||||
void clear ();
|
||||
void forceRowHeight ();
|
||||
protected:
|
||||
virtual void keyPressEvent ( QKeyEvent * event );
|
||||
virtual void mouseMoveEvent ( QMouseEvent* event );
|
||||
virtual void mouseReleaseEvent ( QMouseEvent* event );
|
||||
virtual void keyPressEvent ( QKeyEvent * event );
|
||||
virtual void mouseMoveEvent ( QMouseEvent* event );
|
||||
virtual void mouseReleaseEvent ( QMouseEvent* event );
|
||||
|
||||
private:
|
||||
SelectionPopupModel* _model;
|
||||
|
|
|
@ -61,7 +61,7 @@ namespace Hurricane {
|
|||
bool isCumulative () const;
|
||||
signals:
|
||||
void showSelectionToggled ( bool );
|
||||
void occurrenceToggled ( Occurrence, bool );
|
||||
void selectionToggled ( Occurrence );
|
||||
void cumulativeToggled ( bool );
|
||||
void selectionCleared ();
|
||||
void inspect ( Record* );
|
||||
|
@ -88,6 +88,7 @@ namespace Hurricane {
|
|||
QCheckBox* _cumulative;
|
||||
QCheckBox* _showSelection;
|
||||
int _rowHeight;
|
||||
bool _isEmitter;
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue