* ./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
|
@ -19,6 +19,7 @@ ELSE(BUILD_STATIC)
|
||||||
ENDIF(BUILD_STATIC)
|
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(Qt4 REQUIRED) # find and setup Qt4 for this project
|
||||||
FIND_PACKAGE(BISON REQUIRED)
|
FIND_PACKAGE(BISON REQUIRED)
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
hurricane/viewer/MoveCommand.h
|
hurricane/viewer/MoveCommand.h
|
||||||
hurricane/viewer/ZoomCommand.h
|
hurricane/viewer/ZoomCommand.h
|
||||||
hurricane/viewer/SelectCommand.h
|
hurricane/viewer/SelectCommand.h
|
||||||
|
hurricane/viewer/HierarchyCommand.h
|
||||||
hurricane/viewer/SelectorCriterion.h
|
hurricane/viewer/SelectorCriterion.h
|
||||||
hurricane/viewer/CellWidget.h
|
hurricane/viewer/CellWidget.h
|
||||||
hurricane/viewer/CellWidgets.h
|
hurricane/viewer/CellWidgets.h
|
||||||
|
@ -78,6 +79,7 @@
|
||||||
MoveCommand.cpp
|
MoveCommand.cpp
|
||||||
ZoomCommand.cpp
|
ZoomCommand.cpp
|
||||||
SelectCommand.cpp
|
SelectCommand.cpp
|
||||||
|
HierarchyCommand.cpp
|
||||||
SelectorCriterion.cpp
|
SelectorCriterion.cpp
|
||||||
CellWidget.cpp
|
CellWidget.cpp
|
||||||
CellViewer.cpp
|
CellViewer.cpp
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
// x-----------------------------------------------------------------x
|
// x-----------------------------------------------------------------x
|
||||||
|
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QMenuBar>
|
#include <QMenuBar>
|
||||||
|
@ -37,7 +39,6 @@
|
||||||
|
|
||||||
//#include "MapView.h"
|
//#include "MapView.h"
|
||||||
#include "hurricane/viewer/Graphics.h"
|
#include "hurricane/viewer/Graphics.h"
|
||||||
#include "hurricane/viewer/CellWidget.h"
|
|
||||||
#include "hurricane/viewer/CellViewer.h"
|
#include "hurricane/viewer/CellViewer.h"
|
||||||
#include "hurricane/viewer/MousePositionWidget.h"
|
#include "hurricane/viewer/MousePositionWidget.h"
|
||||||
#include "hurricane/viewer/ControllerWidget.h"
|
#include "hurricane/viewer/ControllerWidget.h"
|
||||||
|
@ -71,6 +72,7 @@ namespace Hurricane {
|
||||||
, _moveCommand()
|
, _moveCommand()
|
||||||
, _zoomCommand()
|
, _zoomCommand()
|
||||||
, _selectCommand()
|
, _selectCommand()
|
||||||
|
, _hierarchyCommand()
|
||||||
, _cellHistory()
|
, _cellHistory()
|
||||||
, _firstShow(false)
|
, _firstShow(false)
|
||||||
{
|
{
|
||||||
|
@ -222,6 +224,7 @@ namespace Hurricane {
|
||||||
_cellWidget->bindCommand ( &_moveCommand );
|
_cellWidget->bindCommand ( &_moveCommand );
|
||||||
_cellWidget->bindCommand ( &_zoomCommand );
|
_cellWidget->bindCommand ( &_zoomCommand );
|
||||||
_cellWidget->bindCommand ( &_selectCommand );
|
_cellWidget->bindCommand ( &_selectCommand );
|
||||||
|
_cellWidget->bindCommand ( &_hierarchyCommand );
|
||||||
_controller->setCellWidget ( _cellWidget );
|
_controller->setCellWidget ( _cellWidget );
|
||||||
|
|
||||||
_selectCommand.bindToAction ( _showSelectionAction );
|
_selectCommand.bindToAction ( _showSelectionAction );
|
||||||
|
@ -252,37 +255,55 @@ namespace Hurricane {
|
||||||
connect ( _showSelectionAction , SIGNAL(toggled(bool)) , this , SLOT(setShowSelection(bool)) );
|
connect ( _showSelectionAction , SIGNAL(toggled(bool)) , this , SLOT(setShowSelection(bool)) );
|
||||||
connect ( _rubberChangeAction , SIGNAL(triggered()) , _cellWidget, SLOT(rubberChange()) );
|
connect ( _rubberChangeAction , SIGNAL(triggered()) , _cellWidget, SLOT(rubberChange()) );
|
||||||
connect ( _controllerAction , SIGNAL(triggered()) , this , SLOT(showController()) );
|
connect ( _controllerAction , SIGNAL(triggered()) , this , SLOT(showController()) );
|
||||||
|
|
||||||
connect ( _cellWidget , SIGNAL(mousePositionChanged(const Point&))
|
connect ( _cellWidget , SIGNAL(mousePositionChanged(const Point&))
|
||||||
, _mousePosition , SLOT(setPosition(const Point&)) );
|
, _mousePosition , SLOT(setPosition(const Point&)) );
|
||||||
|
|
||||||
connect ( this , SIGNAL(showSelectionToggled(bool))
|
connect ( this , SIGNAL(showSelectionToggled(bool))
|
||||||
, _cellWidget , SLOT (setShowSelection (bool)) );
|
, _cellWidget , SLOT (setShowSelection (bool)) );
|
||||||
connect ( _cellWidget , SIGNAL(showSelectionToggled(bool))
|
connect ( _cellWidget , SIGNAL(showSelectionToggled(bool))
|
||||||
, this , SLOT (setShowSelection (bool)) );
|
, this , SLOT (setShowSelection (bool)) );
|
||||||
connect ( &_selectCommand , SIGNAL(selectionToggled (Occurrence,bool))
|
connect ( &_selectCommand , SIGNAL(selectionToggled (Occurrence))
|
||||||
, _cellWidget , SLOT (toggleSelect (Occurrence,bool)) );
|
, _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 ();
|
_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 ()
|
void CellViewer::refreshHistory ()
|
||||||
{
|
{
|
||||||
if ( !getCell() ) return;
|
if ( !getCell() ) return;
|
||||||
|
|
||||||
Cell* activeCell = getCell();
|
shared_ptr<CellWidget::State> activeState = _cellWidget->getState();
|
||||||
_cellHistory.remove ( activeCell );
|
_cellHistory.remove ( activeState );
|
||||||
|
|
||||||
if ( _cellHistory.size() > CellHistorySize-1 )
|
if ( _cellHistory.size() > CellHistorySize-1 )
|
||||||
_cellHistory.pop_front ();
|
_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++ ) {
|
for ( size_t i=0 ; i<CellHistorySize ; i++ ) {
|
||||||
if ( iname != _cellHistory.end() ) {
|
if ( istate != _cellHistory.end() ) {
|
||||||
QString entry = tr("&%1: %2").arg(i+1).arg( getString((*iname)->getName()).c_str() );
|
QString entry = tr("&%1: %2").arg(i+1).arg( getString((*istate)->getName()).c_str() );
|
||||||
_cellHistoryAction[i]->setText ( entry );
|
_cellHistoryAction[i]->setText ( entry );
|
||||||
_cellHistoryAction[i]->setVisible ( true );
|
_cellHistoryAction[i]->setVisible ( true );
|
||||||
iname++;
|
istate++;
|
||||||
} else {
|
} else {
|
||||||
_cellHistoryAction[i]->setVisible ( false );
|
_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 )
|
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 );
|
_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() );
|
QAction* historyAction = qobject_cast<QAction*> ( sender() );
|
||||||
if ( historyAction ) {
|
if ( historyAction ) {
|
||||||
list<Cell*>::iterator icell = _cellHistory.begin();
|
list< shared_ptr<CellWidget::State> >::iterator istate = _cellHistory.begin();
|
||||||
size_t index = historyAction->data().toUInt();
|
size_t index = historyAction->data().toUInt();
|
||||||
|
|
||||||
for ( ; index>0 ; index--, icell++ );
|
for ( ; index>0 ; index--, istate++ );
|
||||||
|
|
||||||
cerr << "History: " << *icell << endl;
|
//cerr << "History: " << (*istate)->getName() << endl;
|
||||||
setCell ( *icell );
|
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".
|
// Class : "Hurricane::CellWidget".
|
||||||
|
|
||||||
|
@ -861,7 +907,6 @@ namespace Hurricane {
|
||||||
, _palette (NULL)
|
, _palette (NULL)
|
||||||
, _displayArea (0,0,_initialSide+2*_stripWidth,_initialSide+2*_stripWidth)
|
, _displayArea (0,0,_initialSide+2*_stripWidth,_initialSide+2*_stripWidth)
|
||||||
, _visibleArea (_stripWidth,_stripWidth,_initialSide,_initialSide)
|
, _visibleArea (_stripWidth,_stripWidth,_initialSide,_initialSide)
|
||||||
, _scale (1.0)
|
|
||||||
, _offsetVA (_stripWidth,_stripWidth)
|
, _offsetVA (_stripWidth,_stripWidth)
|
||||||
, _redrawManager (this)
|
, _redrawManager (this)
|
||||||
, _drawingPlanes (QSize(_initialSide+2*_stripWidth,_initialSide+2*_stripWidth),this)
|
, _drawingPlanes (QSize(_initialSide+2*_stripWidth,_initialSide+2*_stripWidth),this)
|
||||||
|
@ -875,6 +920,7 @@ namespace Hurricane {
|
||||||
, _cellChanged (true)
|
, _cellChanged (true)
|
||||||
, _selectionHasChanged (false)
|
, _selectionHasChanged (false)
|
||||||
, _delaySelectionChanged(0)
|
, _delaySelectionChanged(0)
|
||||||
|
, _enableRedrawInterrupt(false)
|
||||||
, _cellModificated (true)
|
, _cellModificated (true)
|
||||||
, _selectors ()
|
, _selectors ()
|
||||||
, _commands ()
|
, _commands ()
|
||||||
|
@ -1029,7 +1075,7 @@ namespace Hurricane {
|
||||||
{
|
{
|
||||||
if ( _state->showBoundaries() != state ) {
|
if ( _state->showBoundaries() != state ) {
|
||||||
_state->setShowBoundaries ( state );
|
_state->setShowBoundaries ( state );
|
||||||
refresh ();
|
_redrawManager.refresh ();
|
||||||
|
|
||||||
emit showBoundariesToggled ( state );
|
emit showBoundariesToggled ( state );
|
||||||
}
|
}
|
||||||
|
@ -1064,7 +1110,6 @@ namespace Hurricane {
|
||||||
_drawingPlanes.painter().setBackground ( Graphics::getBrush("background") );
|
_drawingPlanes.painter().setBackground ( Graphics::getBrush("background") );
|
||||||
_drawingPlanes.painter().setClipRect ( redrawArea );
|
_drawingPlanes.painter().setClipRect ( redrawArea );
|
||||||
_drawingPlanes.painter().eraseRect ( redrawArea );
|
_drawingPlanes.painter().eraseRect ( redrawArea );
|
||||||
//repaint ();
|
|
||||||
|
|
||||||
setDarkening ( (_state->showSelection()) ? Graphics::getDarkening() : 100 );
|
setDarkening ( (_state->showSelection()) ? Graphics::getDarkening() : 100 );
|
||||||
|
|
||||||
|
@ -1087,10 +1132,8 @@ namespace Hurricane {
|
||||||
_drawingQuery.setBasicLayer ( *iLayer );
|
_drawingQuery.setBasicLayer ( *iLayer );
|
||||||
_drawingQuery.setFilter ( _queryFilter & ~(Query::DoMasterCells|Query::DoRubbers) );
|
_drawingQuery.setFilter ( _queryFilter & ~(Query::DoMasterCells|Query::DoRubbers) );
|
||||||
_drawingQuery.doQuery ();
|
_drawingQuery.doQuery ();
|
||||||
//_drawingPlanes.copyToSelect ( redrawArea );
|
|
||||||
//repaint ();
|
|
||||||
}
|
}
|
||||||
QApplication::processEvents();
|
if ( _enableRedrawInterrupt ) QApplication::processEvents();
|
||||||
if ( _redrawManager.interrupted() ) {
|
if ( _redrawManager.interrupted() ) {
|
||||||
//cerr << "CellWidget::redraw() - interrupt after " << (*iLayer)->getName() << endl;
|
//cerr << "CellWidget::redraw() - interrupt after " << (*iLayer)->getName() << endl;
|
||||||
break;
|
break;
|
||||||
|
@ -1106,8 +1149,6 @@ namespace Hurricane {
|
||||||
_drawingQuery.setBasicLayer ( NULL );
|
_drawingQuery.setBasicLayer ( NULL );
|
||||||
_drawingQuery.setFilter ( _queryFilter & ~(Query::DoComponents|Query::DoRubbers) );
|
_drawingQuery.setFilter ( _queryFilter & ~(Query::DoComponents|Query::DoRubbers) );
|
||||||
_drawingQuery.doQuery ();
|
_drawingQuery.doQuery ();
|
||||||
//_drawingPlanes.copyToSelect ( redrawArea );
|
|
||||||
//repaint ();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1119,12 +1160,10 @@ namespace Hurricane {
|
||||||
_drawingQuery.setBasicLayer ( NULL );
|
_drawingQuery.setBasicLayer ( NULL );
|
||||||
_drawingQuery.setFilter ( _queryFilter & ~(Query::DoComponents|Query::DoMasterCells) );
|
_drawingQuery.setFilter ( _queryFilter & ~(Query::DoComponents|Query::DoMasterCells) );
|
||||||
_drawingQuery.doQuery ();
|
_drawingQuery.doQuery ();
|
||||||
//_drawingPlanes.copyToSelect ( redrawArea );
|
|
||||||
//repaint ();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QApplication::processEvents();
|
if ( _enableRedrawInterrupt ) QApplication::processEvents();
|
||||||
if ( /*!timeout("redraw [text.instances]",timer,10.0,timedout) &&*/ (!_redrawManager.interrupted()) ) {
|
if ( /*!timeout("redraw [text.instances]",timer,10.0,timedout) &&*/ (!_redrawManager.interrupted()) ) {
|
||||||
if ( isDrawable("text.instance") ) {
|
if ( isDrawable("text.instance") ) {
|
||||||
_drawingPlanes.setPen ( Graphics::getPen ("text.instance",getDarkening()) );
|
_drawingPlanes.setPen ( Graphics::getPen ("text.instance",getDarkening()) );
|
||||||
|
@ -1133,14 +1172,12 @@ namespace Hurricane {
|
||||||
_textDrawingQuery.setArea ( redrawBox );
|
_textDrawingQuery.setArea ( redrawBox );
|
||||||
_textDrawingQuery.setTransformation ( Transformation() );
|
_textDrawingQuery.setTransformation ( Transformation() );
|
||||||
_textDrawingQuery.doQuery ();
|
_textDrawingQuery.doQuery ();
|
||||||
//_drawingPlanes.copyToSelect ( redrawArea );
|
|
||||||
//repaint ();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//_drawingQuery.setFilter ( _queryFilter & ~Query::DoMasterCells );
|
//_drawingQuery.setFilter ( _queryFilter & ~Query::DoMasterCells );
|
||||||
forEach ( ExtensionSlice*, islice, getCell()->getExtensionSlices() ) {
|
forEach ( ExtensionSlice*, islice, getCell()->getExtensionSlices() ) {
|
||||||
QApplication::processEvents();
|
if ( _enableRedrawInterrupt ) QApplication::processEvents();
|
||||||
if ( /*timeout("redraw [extension]",timer,10.0,timedout) ||*/ (_redrawManager.interrupted()) ) break;
|
if ( /*timeout("redraw [extension]",timer,10.0,timedout) ||*/ (_redrawManager.interrupted()) ) break;
|
||||||
|
|
||||||
if ( isDrawableExtension((*islice)->getName()) ) {
|
if ( isDrawableExtension((*islice)->getName()) ) {
|
||||||
|
@ -1148,8 +1185,6 @@ namespace Hurricane {
|
||||||
_drawingQuery.setDrawExtensionGo ( (*islice)->getName() );
|
_drawingQuery.setDrawExtensionGo ( (*islice)->getName() );
|
||||||
_drawingQuery.setFilter ( Query::DoExtensionGos );
|
_drawingQuery.setFilter ( Query::DoExtensionGos );
|
||||||
_drawingQuery.doQuery ();
|
_drawingQuery.doQuery ();
|
||||||
//_drawingPlanes.copyToSelect ( redrawArea );
|
|
||||||
//repaint ();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
repaint ();
|
repaint ();
|
||||||
|
@ -1282,7 +1317,7 @@ namespace Hurricane {
|
||||||
PaletteItem* item = (_palette) ? _palette->find(name) : NULL;
|
PaletteItem* item = (_palette) ? _palette->find(name) : NULL;
|
||||||
|
|
||||||
return (!item || item->isItemVisible())
|
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) );
|
Box redrawBox = displayToDbuBox ( redrawArea ).inflate ( DbU::lambda(1.0) );
|
||||||
|
|
||||||
bool lambdaGrid = false;
|
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;
|
lambdaGrid = true;
|
||||||
|
|
||||||
DbU::Unit gridStep = DbU::getSnapGridStep();
|
DbU::Unit gridStep = DbU::getSnapGridStep();
|
||||||
|
@ -1487,10 +1522,10 @@ namespace Hurricane {
|
||||||
_offsetVA.rx() = _stripWidth;
|
_offsetVA.rx() = _stripWidth;
|
||||||
_offsetVA.ry() = _stripWidth;
|
_offsetVA.ry() = _stripWidth;
|
||||||
|
|
||||||
DbU::Unit xmin = (DbU::Unit)( _visibleArea.getXMin() - ((float)_offsetVA.x()/_scale) );
|
DbU::Unit xmin = (DbU::Unit)( _visibleArea.getXMin() - ((float)_offsetVA.x()/getScale()) );
|
||||||
DbU::Unit xmax = (DbU::Unit)( xmin + ((float)_drawingPlanes.width()/_scale) ) ;
|
DbU::Unit xmax = (DbU::Unit)( xmin + ((float)_drawingPlanes.width()/getScale()) ) ;
|
||||||
DbU::Unit ymax = (DbU::Unit)( _visibleArea.getYMax() + ((float)_offsetVA.y()/_scale) );
|
DbU::Unit ymax = (DbU::Unit)( _visibleArea.getYMax() + ((float)_offsetVA.y()/getScale()) );
|
||||||
DbU::Unit ymin = (DbU::Unit)( ymax - ((float)_drawingPlanes.height()/_scale) ) ;
|
DbU::Unit ymin = (DbU::Unit)( ymax - ((float)_drawingPlanes.height()/getScale()) ) ;
|
||||||
|
|
||||||
_displayArea = Box ( xmin, ymin, xmax, ymax );
|
_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();
|
Point center = _visibleArea.getCenter();
|
||||||
|
|
||||||
_visibleArea.makeEmpty ();
|
return Box ( (DbU::Unit)( center.getX() - width () / (scale*2) )
|
||||||
_visibleArea.merge ( (DbU::Unit)( center.getX() - width () / (_scale*2) )
|
, (DbU::Unit)( center.getY() - height() / (scale*2) )
|
||||||
, (DbU::Unit)( center.getY() - height() / (_scale*2) )
|
, (DbU::Unit)( center.getX() + width () / (scale*2) )
|
||||||
, (DbU::Unit)( center.getX() + width () / (_scale*2) )
|
, (DbU::Unit)( center.getY() + height() / (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 << "_visibleArea: " << _visibleArea << " (offset: " << _offsetVA.x() << ")" << endl;
|
||||||
//cerr << " " << center << 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 )
|
void CellWidget::reframe ( const Box& box, bool delayed )
|
||||||
{
|
{
|
||||||
//cerr << "CellWidget::reframe() - " << box << endl;
|
//cerr << "CellWidget::reframe() - " << box << endl;
|
||||||
//cerr << " widget size := " << _drawingPlanes.width() << "x" << _drawingPlanes.height() << endl;
|
//cerr << " widget size := " << _drawingPlanes.width() << "x" << _drawingPlanes.height() << endl;
|
||||||
|
|
||||||
//cerr << " CellWidget::reframe() - widget size := " << width() << "x" << 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 scale;
|
||||||
float scaleY = height / (float)box.getHeight();
|
|
||||||
_scale = min ( scaleX, scaleY );
|
|
||||||
|
|
||||||
Point center = box.getCenter();
|
_state->setTopLeft ( getTopLeft() );
|
||||||
|
_visibleArea = computeVisibleArea ( box, scale );
|
||||||
width /= 2;
|
_state->setScale ( scale );
|
||||||
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 )
|
|
||||||
);
|
|
||||||
displayReframe ( delayed );
|
displayReframe ( delayed );
|
||||||
|
|
||||||
//cerr << " _displayArea: " << _displayArea << " (offset: " << _offsetVA.x() << ")" << endl;
|
//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)
|
Box boundingBox = Box ( DbU::lambda(0)
|
||||||
, DbU::lambda(0)
|
, DbU::lambda(0)
|
||||||
, DbU::lambda(10)
|
, DbU::lambda(10)
|
||||||
|
@ -1557,12 +1655,14 @@ namespace Hurricane {
|
||||||
|
|
||||||
if ( getCell() ) boundingBox = getCell()->getBoundingBox();
|
if ( getCell() ) boundingBox = getCell()->getBoundingBox();
|
||||||
reframe ( boundingBox, delayed );
|
reframe ( boundingBox, delayed );
|
||||||
|
|
||||||
|
_state->setHistoryEnable ( backupHistoryEnable );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CellWidget::_goLeft ( int dx )
|
void CellWidget::_goLeft ( int dx )
|
||||||
{
|
{
|
||||||
_visibleArea.translate ( - (DbU::Unit)( dx / _scale ) , 0 );
|
_visibleArea.translate ( - (DbU::Unit)( dx / getScale() ) , 0 );
|
||||||
|
|
||||||
if ( _offsetVA.rx() - dx >= 0 ) {
|
if ( _offsetVA.rx() - dx >= 0 ) {
|
||||||
_offsetVA.rx() -= dx;
|
_offsetVA.rx() -= dx;
|
||||||
|
@ -1572,7 +1672,7 @@ namespace Hurricane {
|
||||||
|
|
||||||
int shift = ( 1 + ( dx - _offsetVA.rx() ) / _stripWidth ) * _stripWidth;
|
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;
|
_offsetVA.rx() -= dx - shift;
|
||||||
|
|
||||||
if ( shift >= _drawingPlanes.width() )
|
if ( shift >= _drawingPlanes.width() )
|
||||||
|
@ -1590,7 +1690,7 @@ namespace Hurricane {
|
||||||
{
|
{
|
||||||
//cerr << "CellWidget::goRight() - dx: " << dx << " (offset: " << _offsetVA.rx() << ")" << endl;
|
//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 ) {
|
if ( _offsetVA.rx() + dx < 2*_stripWidth ) {
|
||||||
_offsetVA.rx() += dx;
|
_offsetVA.rx() += dx;
|
||||||
|
@ -1600,7 +1700,7 @@ namespace Hurricane {
|
||||||
|
|
||||||
int shift = ( ( _offsetVA.rx() + dx ) / _stripWidth ) * _stripWidth;
|
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;
|
_offsetVA.rx() += dx - shift;
|
||||||
|
|
||||||
if ( shift >= _drawingPlanes.width() )
|
if ( shift >= _drawingPlanes.width() )
|
||||||
|
@ -1619,7 +1719,7 @@ namespace Hurricane {
|
||||||
{
|
{
|
||||||
//cerr << "CellWidget::shiftUp() - " << dy << " (offset: " << _offsetVA.ry() << ")" << endl;
|
//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 ) {
|
if ( _offsetVA.ry() - dy >= 0 ) {
|
||||||
_offsetVA.ry() -= dy;
|
_offsetVA.ry() -= dy;
|
||||||
|
@ -1629,7 +1729,7 @@ namespace Hurricane {
|
||||||
|
|
||||||
int shift = ( 1 + ( dy - _offsetVA.ry() ) / _stripWidth ) * _stripWidth;
|
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;
|
_offsetVA.ry() -= dy - shift;
|
||||||
|
|
||||||
if ( shift >= _drawingPlanes.height() )
|
if ( shift >= _drawingPlanes.height() )
|
||||||
|
@ -1647,7 +1747,7 @@ namespace Hurricane {
|
||||||
{
|
{
|
||||||
//cerr << "CellWidget::shiftDown() - " << dy << " (offset: " << _offsetVA.ry() << ")" << endl;
|
//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 ) {
|
if ( _offsetVA.ry() + dy < 2*_stripWidth ) {
|
||||||
_offsetVA.ry() += dy;
|
_offsetVA.ry() += dy;
|
||||||
|
@ -1657,7 +1757,7 @@ namespace Hurricane {
|
||||||
|
|
||||||
int shift = ( ( _offsetVA.ry() + dy ) / _stripWidth ) * _stripWidth;
|
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;
|
_offsetVA.ry() += dy - shift;
|
||||||
|
|
||||||
if ( shift >= _drawingPlanes.height() )
|
if ( shift >= _drawingPlanes.height() )
|
||||||
|
@ -1681,7 +1781,8 @@ namespace Hurricane {
|
||||||
void CellWidget::showEvent ( QShowEvent* )
|
void CellWidget::showEvent ( QShowEvent* )
|
||||||
{
|
{
|
||||||
//cerr << "CellWidget::showEvent() - size: " << geometry().width() << "x" << geometry().height() << endl;
|
//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();
|
uaDelta.rheight() = uaSize.height() - _drawingPlanes.height();
|
||||||
|
|
||||||
if ( uaDelta.width() || uaDelta.height() ) {
|
if ( uaDelta.width() || uaDelta.height() ) {
|
||||||
_displayArea.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()/_scale), (DbU::Unit)(uaDelta.height()/_scale) );
|
_visibleArea.inflate ( 0, 0, (DbU::Unit)(uaDelta.width()/getScale()), (DbU::Unit)(uaDelta.height()/getScale()) );
|
||||||
|
|
||||||
QSize bufferSize ( ( ( uaSize.width () / _stripWidth ) + 1 ) * _stripWidth
|
QSize bufferSize ( ( ( uaSize.width () / _stripWidth ) + 1 ) * _stripWidth
|
||||||
, ( ( uaSize.height() / _stripWidth ) + 1 ) * _stripWidth );
|
, ( ( uaSize.height() / _stripWidth ) + 1 ) * _stripWidth );
|
||||||
|
@ -1864,29 +1965,43 @@ namespace Hurricane {
|
||||||
|
|
||||||
shared_ptr<State> state ( new State(cell) );
|
shared_ptr<State> state ( new State(cell) );
|
||||||
setState ( state );
|
setState ( state );
|
||||||
|
|
||||||
|
fitToContents ( false, false );
|
||||||
|
|
||||||
|
_state->setHistoryEnable ( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CellWidget::setState ( shared_ptr<State>& state )
|
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 ();
|
cellPreModificate ();
|
||||||
_state->getSelection ().clear ();
|
_state->getSelection ().clear ();
|
||||||
_state->setCellWidget ( NULL );
|
_state->setCellWidget ( NULL );
|
||||||
|
_state->setTopLeft ( getTopLeft() );
|
||||||
|
|
||||||
_cellChanged = true;
|
_cellChanged = true;
|
||||||
_state = state;
|
_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 );
|
_state->setCellWidget ( this );
|
||||||
_drawingQuery .setCell ( getCell() );
|
_drawingQuery .setCell ( getCell() );
|
||||||
_textDrawingQuery.setCell ( getCell() );
|
_textDrawingQuery.setCell ( getCell() );
|
||||||
|
|
||||||
emit cellChanged ( getCell() );
|
reframe ( true );
|
||||||
|
_state->setHistoryEnable ( true );
|
||||||
|
|
||||||
fitToContents ( true );
|
emit cellChanged ( getCell() );
|
||||||
|
emit stateChanged ( _state );
|
||||||
|
|
||||||
cellPostModificate ();
|
cellPostModificate ();
|
||||||
}
|
}
|
||||||
|
@ -2017,7 +2132,7 @@ namespace Hurricane {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CellWidget::toggleSelect ( Occurrence occurrence, bool fromPopup )
|
void CellWidget::toggleSelection ( Occurrence occurrence )
|
||||||
{
|
{
|
||||||
if ( !occurrence.isValid() )
|
if ( !occurrence.isValid() )
|
||||||
throw Error ( "Can't select occurrence : invalid occurrence" );
|
throw Error ( "Can't select occurrence : invalid occurrence" );
|
||||||
|
@ -2040,7 +2155,7 @@ namespace Hurricane {
|
||||||
_selectionHasChanged = true;
|
_selectionHasChanged = true;
|
||||||
if ( _state->showSelection() ) _redrawManager.refresh ();
|
if ( _state->showSelection() ) _redrawManager.refresh ();
|
||||||
|
|
||||||
if ( fromPopup ) emit occurrenceToggled ( occurrence );
|
emit selectionToggled ( occurrence );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -290,9 +290,9 @@ namespace Hurricane {
|
||||||
if ( getCellWidget() ) {
|
if ( getCellWidget() ) {
|
||||||
connect ( getCellWidget(), SIGNAL(selectionChanged(const SelectorSet&,Cell*))
|
connect ( getCellWidget(), SIGNAL(selectionChanged(const SelectorSet&,Cell*))
|
||||||
, _selection , SLOT (setSelection (const SelectorSet&,Cell*)) );
|
, _selection , SLOT (setSelection (const SelectorSet&,Cell*)) );
|
||||||
connect ( _selection , SIGNAL(occurrenceToggled(Occurrence,bool))
|
connect ( _selection , SIGNAL(selectionToggled(Occurrence))
|
||||||
, getCellWidget(), SLOT (toggleSelect (Occurrence,bool)) );
|
, getCellWidget(), SLOT (toggleSelection (Occurrence)) );
|
||||||
connect ( getCellWidget(), SIGNAL(occurrenceToggled(Occurrence))
|
connect ( getCellWidget(), SIGNAL(selectionToggled(Occurrence))
|
||||||
, _selection , SLOT (toggleSelection (Occurrence)) );
|
, _selection , SLOT (toggleSelection (Occurrence)) );
|
||||||
connect ( _selection , SIGNAL(cumulativeToggled (bool))
|
connect ( _selection , SIGNAL(cumulativeToggled (bool))
|
||||||
, getCellWidget(), SLOT (setCumulativeSelection(bool)) );
|
, getCellWidget(), SLOT (setCumulativeSelection(bool)) );
|
||||||
|
|
|
@ -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 ) {
|
} else if ( event->key() == Qt::Key_O ) {
|
||||||
forkInspector ( _view->currentIndex() );
|
forkInspector ( _view->currentIndex() );
|
||||||
} else {
|
} else {
|
||||||
event->ignore();
|
QWidget::keyPressEvent ( event );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -159,7 +159,7 @@ namespace Hurricane {
|
||||||
|
|
||||||
void NetlistWidget::keyPressEvent ( QKeyEvent* event )
|
void NetlistWidget::keyPressEvent ( QKeyEvent* event )
|
||||||
{
|
{
|
||||||
event->ignore ();
|
QWidget::keyPressEvent ( event );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -48,8 +48,8 @@ namespace Hurricane {
|
||||||
{
|
{
|
||||||
_selectionPopup = new SelectionPopup ();
|
_selectionPopup = new SelectionPopup ();
|
||||||
|
|
||||||
connect ( _selectionPopup, SIGNAL(occurrenceSelected(Occurrence,bool))
|
connect ( _selectionPopup, SIGNAL(selectionToggled(Occurrence))
|
||||||
, this , SIGNAL(selectionToggled (Occurrence,bool)) );
|
, this , SIGNAL(selectionToggled(Occurrence)) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@ namespace Hurricane {
|
||||||
|
|
||||||
void SelectionPopup::keyPressEvent ( QKeyEvent* event )
|
void SelectionPopup::keyPressEvent ( QKeyEvent* event )
|
||||||
{
|
{
|
||||||
event->ignore();
|
QWidget::keyPressEvent ( event );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ namespace Hurricane {
|
||||||
if ( index.isValid() ) {
|
if ( index.isValid() ) {
|
||||||
Occurrence occurrence = _model->getOccurrence(index.row());
|
Occurrence occurrence = _model->getOccurrence(index.row());
|
||||||
if ( occurrence.getEntity() )
|
if ( occurrence.getEntity() )
|
||||||
emit occurrenceSelected ( occurrence, true );
|
emit selectionToggled ( occurrence );
|
||||||
}
|
}
|
||||||
|
|
||||||
clear ();
|
clear ();
|
||||||
|
|
|
@ -55,6 +55,7 @@ namespace Hurricane {
|
||||||
, _cumulative (new QCheckBox())
|
, _cumulative (new QCheckBox())
|
||||||
, _showSelection (new QCheckBox())
|
, _showSelection (new QCheckBox())
|
||||||
, _rowHeight (20)
|
, _rowHeight (20)
|
||||||
|
, _isEmitter (false)
|
||||||
{
|
{
|
||||||
setAttribute ( Qt::WA_DeleteOnClose );
|
setAttribute ( Qt::WA_DeleteOnClose );
|
||||||
setAttribute ( Qt::WA_QuitOnClose, false );
|
setAttribute ( Qt::WA_QuitOnClose, false );
|
||||||
|
@ -147,7 +148,7 @@ namespace Hurricane {
|
||||||
{
|
{
|
||||||
if ( event->key() == Qt::Key_I ) { inspect ( _view->currentIndex() ); }
|
if ( event->key() == Qt::Key_I ) { inspect ( _view->currentIndex() ); }
|
||||||
else if ( event->key() == Qt::Key_T ) { toggleSelection ( _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 )
|
void SelectionWidget::toggleSelection ( const QModelIndex& index )
|
||||||
{
|
{
|
||||||
Occurrence occurrence = _baseModel->toggleSelection ( index );
|
Occurrence occurrence = _baseModel->toggleSelection ( index );
|
||||||
if ( occurrence.isValid() )
|
if ( occurrence.isValid() ) {
|
||||||
emit occurrenceToggled ( occurrence, false );
|
_isEmitter = true;
|
||||||
|
emit selectionToggled ( occurrence );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SelectionWidget::toggleSelection ( Occurrence occurrence )
|
void SelectionWidget::toggleSelection ( Occurrence occurrence )
|
||||||
{
|
{
|
||||||
|
if ( !_isEmitter ) {
|
||||||
_baseModel->toggleSelection ( occurrence );
|
_baseModel->toggleSelection ( occurrence );
|
||||||
|
_isEmitter = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -62,6 +62,8 @@ namespace Hurricane {
|
||||||
switch ( event->key() ) {
|
switch ( event->key() ) {
|
||||||
case Qt::Key_Z: widget->setScale ( widget->getScale()*2.0 ); return true;
|
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_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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,8 @@ class QMenu;
|
||||||
#include "hurricane/viewer/MoveCommand.h"
|
#include "hurricane/viewer/MoveCommand.h"
|
||||||
#include "hurricane/viewer/ZoomCommand.h"
|
#include "hurricane/viewer/ZoomCommand.h"
|
||||||
#include "hurricane/viewer/SelectCommand.h"
|
#include "hurricane/viewer/SelectCommand.h"
|
||||||
|
#include "hurricane/viewer/HierarchyCommand.h"
|
||||||
|
#include "hurricane/viewer/CellWidget.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Hurricane {
|
namespace Hurricane {
|
||||||
|
@ -55,7 +57,6 @@ namespace Hurricane {
|
||||||
class HGraphics;
|
class HGraphics;
|
||||||
class HDisplayFilter;
|
class HDisplayFilter;
|
||||||
//class MapView;
|
//class MapView;
|
||||||
class CellWidget;
|
|
||||||
class MousePositionWidget;
|
class MousePositionWidget;
|
||||||
class HSelection;
|
class HSelection;
|
||||||
class ControllerWidget;
|
class ControllerWidget;
|
||||||
|
@ -68,21 +69,24 @@ namespace Hurricane {
|
||||||
CellViewer ( QWidget* parent=NULL );
|
CellViewer ( QWidget* parent=NULL );
|
||||||
virtual ~CellViewer ();
|
virtual ~CellViewer ();
|
||||||
QMenu* createDebugMenu ();
|
QMenu* createDebugMenu ();
|
||||||
inline void setApplicationName ( const QString& name );
|
inline void setEnableRedrawInterrupt ( bool );
|
||||||
void setCell ( Cell* cell );
|
inline void setApplicationName ( const QString& );
|
||||||
|
void setCell ( Cell* );
|
||||||
Cell* getCell ();
|
Cell* getCell ();
|
||||||
virtual Cell* getCellFromDb ( const char* name );
|
virtual Cell* getCellFromDb ( const char* name );
|
||||||
inline CellWidget* getCellWidget ();
|
inline CellWidget* getCellWidget ();
|
||||||
void select ( Occurrence& occurence );
|
void select ( Occurrence& );
|
||||||
void unselect ( Occurrence& occurence );
|
void unselect ( Occurrence& );
|
||||||
void unselectAll ();
|
void unselectAll ();
|
||||||
public slots:
|
public slots:
|
||||||
void setShowSelection ( bool );
|
void setShowSelection ( bool );
|
||||||
|
void setState ( shared_ptr<CellWidget::State>& );
|
||||||
void showController ();
|
void showController ();
|
||||||
void openHistoryCell ();
|
void openHistoryCell ();
|
||||||
void printDisplay ();
|
void printDisplay ();
|
||||||
signals:
|
signals:
|
||||||
void showSelectionToggled ( bool );
|
void showSelectionToggled ( bool );
|
||||||
|
void stateChanged ( shared_ptr<CellWidget::State>& );
|
||||||
void redrawCellWidget ();
|
void redrawCellWidget ();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -113,18 +117,24 @@ namespace Hurricane {
|
||||||
MoveCommand _moveCommand;
|
MoveCommand _moveCommand;
|
||||||
ZoomCommand _zoomCommand;
|
ZoomCommand _zoomCommand;
|
||||||
SelectCommand _selectCommand;
|
SelectCommand _selectCommand;
|
||||||
list<Cell*> _cellHistory;
|
HierarchyCommand _hierarchyCommand;
|
||||||
|
list< shared_ptr<CellWidget::State> >
|
||||||
|
_cellHistory;
|
||||||
bool _firstShow;
|
bool _firstShow;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void createActions ();
|
void createActions ();
|
||||||
void createMenus ();
|
void createMenus ();
|
||||||
void createLayout ();
|
void createLayout ();
|
||||||
|
void refreshTitle ();
|
||||||
void refreshHistory ();
|
void refreshHistory ();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// Inline Functions.
|
// Inline Functions.
|
||||||
|
inline void CellViewer::setEnableRedrawInterrupt ( bool state )
|
||||||
|
{ _cellWidget->setEnableRedrawInterrupt(state); }
|
||||||
|
|
||||||
inline CellWidget* CellViewer::getCellWidget () { return _cellWidget; }
|
inline CellWidget* CellViewer::getCellWidget () { return _cellWidget; }
|
||||||
inline void CellViewer::setApplicationName ( const QString& name ) { _applicationName = name; }
|
inline void CellViewer::setApplicationName ( const QString& name ) { _applicationName = name; }
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <functional>
|
||||||
#include <tr1/memory>
|
#include <tr1/memory>
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
@ -65,6 +66,7 @@ class QAction;
|
||||||
namespace Hurricane {
|
namespace Hurricane {
|
||||||
|
|
||||||
using std::vector;
|
using std::vector;
|
||||||
|
using std::unary_function;
|
||||||
using std::tr1::shared_ptr;
|
using std::tr1::shared_ptr;
|
||||||
|
|
||||||
class Technology;
|
class Technology;
|
||||||
|
@ -109,7 +111,6 @@ namespace Hurricane {
|
||||||
// Accessors.
|
// Accessors.
|
||||||
// MapView* getMapView () { return _mapView; };
|
// MapView* getMapView () { return _mapView; };
|
||||||
void setCell ( Cell* );
|
void setCell ( Cell* );
|
||||||
void setState ( shared_ptr<State>& );
|
|
||||||
inline Cell* getCell () const;
|
inline Cell* getCell () const;
|
||||||
inline shared_ptr<State>& getState ();
|
inline shared_ptr<State>& getState ();
|
||||||
inline PaletteWidget* getPalette ();
|
inline PaletteWidget* getPalette ();
|
||||||
|
@ -131,11 +132,12 @@ namespace Hurricane {
|
||||||
inline int getQueryFilter () const ;
|
inline int getQueryFilter () const ;
|
||||||
inline bool timeout ( const char*, const Timer&, double timeout, bool& timedout ) const;
|
inline bool timeout ( const char*, const Timer&, double timeout, bool& timedout ) const;
|
||||||
// Painter control & Hurricane objects drawing primitives.
|
// Painter control & Hurricane objects drawing primitives.
|
||||||
|
inline void setEnableRedrawInterrupt ( bool );
|
||||||
inline void addDrawExtensionGo ( const Name&, InitExtensionGo_t*, DrawExtensionGo_t* );
|
inline void addDrawExtensionGo ( const Name&, InitExtensionGo_t*, DrawExtensionGo_t* );
|
||||||
inline QPainter& getPainter ( size_t plane=PlaneId::Working );
|
inline QPainter& getPainter ( size_t plane=PlaneId::Working );
|
||||||
inline int getDarkening () const;
|
inline int getDarkening () const;
|
||||||
inline void copyToPrinter ( QPrinter* printer );
|
inline void copyToPrinter ( QPrinter* printer );
|
||||||
inline float getScale () const;
|
inline const float& getScale () const;
|
||||||
inline const QPoint& getMousePosition () const;
|
inline const QPoint& getMousePosition () const;
|
||||||
bool isDrawable ( const Name& );
|
bool isDrawable ( const Name& );
|
||||||
bool isDrawableLayer ( const Name& );
|
bool isDrawableLayer ( const Name& );
|
||||||
|
@ -175,6 +177,10 @@ namespace Hurricane {
|
||||||
inline DbU::Unit screenToDbuY ( int y ) const;
|
inline DbU::Unit screenToDbuY ( int y ) const;
|
||||||
inline Point screenToDbuPoint ( const QPoint& point ) const;
|
inline Point screenToDbuPoint ( const QPoint& point ) const;
|
||||||
inline Box screenToDbuBox ( const QRect& rect ) 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.
|
// Qt QWidget Functions Overloads.
|
||||||
void pushCursor ( Qt::CursorShape cursor );
|
void pushCursor ( Qt::CursorShape cursor );
|
||||||
void popCursor ();
|
void popCursor ();
|
||||||
|
@ -192,17 +198,19 @@ namespace Hurricane {
|
||||||
void cellChanged ( Cell* );
|
void cellChanged ( Cell* );
|
||||||
void cellPreModificated ();
|
void cellPreModificated ();
|
||||||
void cellPostModificated ();
|
void cellPostModificated ();
|
||||||
|
void stateChanged ( shared_ptr<CellWidget::State>& );
|
||||||
void settingsChanged ();
|
void settingsChanged ();
|
||||||
void styleChanged ( void* emitter );
|
void styleChanged ( void* emitter );
|
||||||
void updatePalette ( Cell* );
|
void updatePalette ( Cell* );
|
||||||
void mousePositionChanged ( const Point& position );
|
void mousePositionChanged ( const Point& position );
|
||||||
void selectionChanged ( const SelectorSet&, Cell* );
|
void selectionChanged ( const SelectorSet&, Cell* );
|
||||||
void occurrenceToggled ( Occurrence );
|
void selectionToggled ( Occurrence );
|
||||||
void showSelectionToggled ( bool );
|
void showSelectionToggled ( bool );
|
||||||
void cumulativeSelectionToggled ( bool );
|
void cumulativeSelectionToggled ( bool );
|
||||||
void showBoundariesToggled ( bool );
|
void showBoundariesToggled ( bool );
|
||||||
public slots:
|
public slots:
|
||||||
// Qt QWidget Slots Overload & CellWidget Specifics.
|
// Qt QWidget Slots Overload & CellWidget Specifics.
|
||||||
|
void setState ( shared_ptr<CellWidget::State>& );
|
||||||
inline DrawingPlanes& getDrawingPlanes ();
|
inline DrawingPlanes& getDrawingPlanes ();
|
||||||
inline QPoint& getOffsetVA ();
|
inline QPoint& getOffsetVA ();
|
||||||
void select ( const Net* net, bool delayRedraw=false );
|
void select ( const Net* net, bool delayRedraw=false );
|
||||||
|
@ -212,7 +220,7 @@ namespace Hurricane {
|
||||||
void unselect ( const Net* net, bool delayRedraw=false );
|
void unselect ( const Net* net, bool delayRedraw=false );
|
||||||
void unselect ( Occurrence occurence );
|
void unselect ( Occurrence occurence );
|
||||||
void unselectAll ( bool delayRedraw=false );
|
void unselectAll ( bool delayRedraw=false );
|
||||||
void toggleSelect ( Occurrence occurence, bool fromPopup );
|
void toggleSelection ( Occurrence occurence );
|
||||||
void setShowSelection ( bool state );
|
void setShowSelection ( bool state );
|
||||||
void setCumulativeSelection ( bool state );
|
void setCumulativeSelection ( bool state );
|
||||||
void _select ( const Net* net, bool delayRedraw=false );
|
void _select ( const Net* net, bool delayRedraw=false );
|
||||||
|
@ -232,9 +240,12 @@ namespace Hurricane {
|
||||||
void goRight ( int dx = 0 );
|
void goRight ( int dx = 0 );
|
||||||
void goUp ( int dy = 0 );
|
void goUp ( int dy = 0 );
|
||||||
void goDown ( 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 setScale ( float );
|
||||||
|
void scaleHistoryUp ();
|
||||||
|
void scaleHistoryDown ();
|
||||||
void setShowBoundaries ( bool state );
|
void setShowBoundaries ( bool state );
|
||||||
|
void reframe ( bool delayed=false );
|
||||||
void reframe ( const Box& box, bool delayed=false );
|
void reframe ( const Box& box, bool delayed=false );
|
||||||
void displayReframe ( bool delayed=false );
|
void displayReframe ( bool delayed=false );
|
||||||
void _goLeft ( int dx );
|
void _goLeft ( int dx );
|
||||||
|
@ -458,17 +469,50 @@ namespace Hurricane {
|
||||||
inline void setShowBoundaries ( bool );
|
inline void setShowBoundaries ( bool );
|
||||||
inline void setShowSelection ( bool );
|
inline void setShowSelection ( bool );
|
||||||
inline void setCumulativeSelection ( 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;
|
inline Cell* getCell () const;
|
||||||
|
const Name& getName () const;
|
||||||
inline SelectorCriterions& getSelection ();
|
inline SelectorCriterions& getSelection ();
|
||||||
inline bool showBoundaries () const;
|
inline bool showBoundaries () const;
|
||||||
inline bool showSelection () const;
|
inline bool showSelection () const;
|
||||||
inline bool cumulativeSelection () 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:
|
private:
|
||||||
Cell* _cell;
|
Cell* _cell;
|
||||||
|
CellWidget* _cellWidget;
|
||||||
SelectorCriterions _selection;
|
SelectorCriterions _selection;
|
||||||
bool _showBoundaries;
|
bool _showBoundaries;
|
||||||
bool _showSelection;
|
bool _showSelection;
|
||||||
bool _cumulativeSelection;
|
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:
|
protected:
|
||||||
|
@ -481,7 +525,6 @@ namespace Hurricane {
|
||||||
PaletteWidget* _palette;
|
PaletteWidget* _palette;
|
||||||
Box _displayArea;
|
Box _displayArea;
|
||||||
Box _visibleArea;
|
Box _visibleArea;
|
||||||
float _scale;
|
|
||||||
QPoint _offsetVA;
|
QPoint _offsetVA;
|
||||||
RedrawManager _redrawManager;
|
RedrawManager _redrawManager;
|
||||||
DrawingPlanes _drawingPlanes;
|
DrawingPlanes _drawingPlanes;
|
||||||
|
@ -496,6 +539,7 @@ namespace Hurricane {
|
||||||
bool _selectionHasChanged;
|
bool _selectionHasChanged;
|
||||||
int _delaySelectionChanged;
|
int _delaySelectionChanged;
|
||||||
bool _cellModificated;
|
bool _cellModificated;
|
||||||
|
bool _enableRedrawInterrupt;
|
||||||
SelectorSet _selectors;
|
SelectorSet _selectors;
|
||||||
vector<Command*> _commands;
|
vector<Command*> _commands;
|
||||||
size_t _redrawRectCount;
|
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
|
inline void CellWidget::DrawingQuery::addDrawExtensionGo ( const Name& name
|
||||||
, InitExtensionGo_t* initExtensionGo
|
, InitExtensionGo_t* initExtensionGo
|
||||||
, DrawExtensionGo_t* drawExtensionGo
|
, DrawExtensionGo_t* drawExtensionGo
|
||||||
|
@ -677,13 +725,23 @@ namespace Hurricane {
|
||||||
{ return _criterions.size(); }
|
{ return _criterions.size(); }
|
||||||
|
|
||||||
|
|
||||||
|
inline CellWidget::State::ScaleEntry::ScaleEntry ( float scale, const Point& topLeft )
|
||||||
|
: _scale(scale), _topLeft(topLeft)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
|
||||||
inline CellWidget::State::State ( Cell* cell )
|
inline CellWidget::State::State ( Cell* cell )
|
||||||
: _cell (cell)
|
: _cell (cell)
|
||||||
, _selection ()
|
, _selection ()
|
||||||
, _showBoundaries (true)
|
, _showBoundaries (true)
|
||||||
, _showSelection (false)
|
, _showSelection (false)
|
||||||
, _cumulativeSelection(false)
|
, _cumulativeSelection(false)
|
||||||
{ }
|
, _scaleHistory ()
|
||||||
|
, _ihistory (0)
|
||||||
|
, _historyEnable (false)
|
||||||
|
{
|
||||||
|
_scaleHistory.push_back ( ScaleEntry(1.0,Point(0,0)) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline void CellWidget::State::setCell ( Cell* cell )
|
inline void CellWidget::State::setCell ( Cell* cell )
|
||||||
|
@ -691,7 +749,10 @@ namespace Hurricane {
|
||||||
|
|
||||||
|
|
||||||
inline void CellWidget::State::setCellWidget ( CellWidget* cw )
|
inline void CellWidget::State::setCellWidget ( CellWidget* cw )
|
||||||
{ _selection.setCellWidget ( cw ); }
|
{
|
||||||
|
_cellWidget = cw;
|
||||||
|
_selection.setCellWidget ( cw );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline void CellWidget::State::setShowBoundaries ( bool state )
|
inline void CellWidget::State::setShowBoundaries ( bool state )
|
||||||
|
@ -706,6 +767,23 @@ namespace Hurricane {
|
||||||
{ _cumulativeSelection = state; }
|
{ _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
|
inline Cell* CellWidget::State::getCell () const
|
||||||
{ return _cell; }
|
{ return _cell; }
|
||||||
|
|
||||||
|
@ -726,8 +804,37 @@ namespace Hurricane {
|
||||||
{ return _cumulativeSelection; }
|
{ 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 ()
|
inline shared_ptr<CellWidget::State>& CellWidget::getState ()
|
||||||
{ return _state; }
|
{
|
||||||
|
_state->setTopLeft ( getTopLeft() );
|
||||||
|
return _state;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline void CellWidget::addDrawExtensionGo ( const Name& name
|
inline void CellWidget::addDrawExtensionGo ( const Name& name
|
||||||
|
@ -774,23 +881,23 @@ namespace Hurricane {
|
||||||
|
|
||||||
|
|
||||||
inline int CellWidget::dbuToDisplayX ( DbU::Unit x ) const
|
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
|
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
|
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
|
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
|
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
|
inline QPoint CellWidget::dbuToScreenPoint ( const Point& point ) const
|
||||||
|
@ -798,15 +905,15 @@ namespace Hurricane {
|
||||||
|
|
||||||
|
|
||||||
inline DbU::Unit CellWidget::displayToDbuX ( int x ) const
|
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
|
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
|
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
|
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
|
inline Cell* CellWidget::getCell () const
|
||||||
{ return _state->getCell(); }
|
{ return _state->getCell(); }
|
||||||
|
|
||||||
|
@ -869,8 +980,8 @@ namespace Hurricane {
|
||||||
{ return _darkening; }
|
{ return _darkening; }
|
||||||
|
|
||||||
|
|
||||||
inline float CellWidget::getScale () const
|
inline const float& CellWidget::getScale () const
|
||||||
{ return _scale; }
|
{ return _state->getScale(); }
|
||||||
|
|
||||||
|
|
||||||
inline const QPoint& CellWidget::getMousePosition () const
|
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++ -*-
|
// -*- C++ -*-
|
||||||
//
|
//
|
||||||
// This file is part of the Coriolis Software.
|
// 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* );
|
virtual bool mouseReleaseEvent ( CellWidget*, QMouseEvent* );
|
||||||
void bindToAction ( QAction* action );
|
void bindToAction ( QAction* action );
|
||||||
signals:
|
signals:
|
||||||
void selectionToggled ( Occurrence occurrence, bool fromPopup );
|
void selectionToggled ( Occurrence occurrence );
|
||||||
private:
|
private:
|
||||||
QAction* _selectAction;
|
QAction* _selectAction;
|
||||||
SelectionPopup* _selectionPopup;
|
SelectionPopup* _selectionPopup;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
//
|
//
|
||||||
// This file is part of the Coriolis Software.
|
// 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
|
||||||
//
|
//
|
||||||
// ===================================================================
|
// ===================================================================
|
||||||
//
|
//
|
||||||
|
@ -54,7 +54,7 @@ namespace Hurricane {
|
||||||
void updateLayout ();
|
void updateLayout ();
|
||||||
void popup ();
|
void popup ();
|
||||||
signals:
|
signals:
|
||||||
void occurrenceSelected ( Occurrence occurrence, bool fromPopup );
|
void selectionToggled ( Occurrence occurrence );
|
||||||
public slots:
|
public slots:
|
||||||
void add ( Occurrence occurrence, bool showChange=false );
|
void add ( Occurrence occurrence, bool showChange=false );
|
||||||
void clear ();
|
void clear ();
|
||||||
|
|
|
@ -61,7 +61,7 @@ namespace Hurricane {
|
||||||
bool isCumulative () const;
|
bool isCumulative () const;
|
||||||
signals:
|
signals:
|
||||||
void showSelectionToggled ( bool );
|
void showSelectionToggled ( bool );
|
||||||
void occurrenceToggled ( Occurrence, bool );
|
void selectionToggled ( Occurrence );
|
||||||
void cumulativeToggled ( bool );
|
void cumulativeToggled ( bool );
|
||||||
void selectionCleared ();
|
void selectionCleared ();
|
||||||
void inspect ( Record* );
|
void inspect ( Record* );
|
||||||
|
@ -88,6 +88,7 @@ namespace Hurricane {
|
||||||
QCheckBox* _cumulative;
|
QCheckBox* _cumulative;
|
||||||
QCheckBox* _showSelection;
|
QCheckBox* _showSelection;
|
||||||
int _rowHeight;
|
int _rowHeight;
|
||||||
|
bool _isEmitter;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue