* ./coriolis/src/crlcore/src/ccore/Banner.cpp
./coriolis/src/crlcore/src/ccore/crlcore/Banner.h - Moved "CBanner" to "Banner", cleaned up, relooked, renamed functions, reorganised. * ./coriolis/src/crlcore/src/ccore/ToolEngine.cpp ./coriolis/src/crlcore/src/ccore/crlcore/ToolEngine.h ./coriolis/src/crlcore/src/ccore/crlcore/ToolEngines.h - Renamed CEngine to ToolEngine, cleaned up, relooked. All fonctions as static members. * ./coriolis/src/crlcore/src/ccore/Memory.cpp ./coriolis/src/crlcore/src/ccore/crlcore/Memory.h - Renamed CMemory to Memory (as for Timer), minimal cleanup. * ./coriolis/src/crlcore/src/ccore/crlcore/*.h - Change anti-double inclusion constants from __XX_H__ to __CRL_XX_H__ (that is: include namespace) to avoid potential constant clashes with other pieces of software. * ./coriolis/src/crlcore/src/ccore/Utilities.cpp ./coriolis/src/crlcore/src/ccore/crlcore/Utilities.h - Finish porting of all features from CUtils. Simplificated mstream using member templates. Speedup mstream by using static_cast instead of dynamic_cast. * ./coriolis/src/crlcore/src/ccore/Environment.cpp - Now read CORIOLIS_TOP from UNIX environment instead of hard-coded directory (to my personnal installation...). See new method "loadFromShell()", needs to be extended to all other variables. _____________________________________________________________________________ * ./hurricane/src/hurricane/BasicLayer.{h,cpp} - Suppress all graphics related members from Layer. - Adding realName member for symbolic to real transformation. * ./hurricane/src/hviewer/CellWidget.cpp Bug: Now uses display threshold from Graphics (DisplayStyle) instead of layer. Now layers appears/diseapears while zooming/unzooming. * ./coriolis/src/crlcore : - Separating clearly symbolic technology form real technology. - Various file renaming. _____________________________________________________________________________ * ./hurricane/src : - Complete include re-organisation. include/hurricane/*.h : kernel. include/hurricane/viewer/*.h : hviewer. include/hurricane/inspector/*.h : hinspector. Includes have been moved into subdirectories of .cpp files (as in crlcore). - Now you must include files like this : #include <hurricane/Layer.h> #include <hurricane/viewer/CellViewer.h> #include <hurricane/inspector/HInspector.h> - Suppressed viewer specific include path in FindHURRICANE.cmake. - Re-enabled documentation, with dot disabled as it seems to slow down doxygen. * ./crlcore/src/crlcore : - Adapted to new Hurricane include scheme. Corrected bugs in it's own include files (noticeably "Utilities.h"). _____________________________________________________________________________ * ./hurricane/doc/hurricane : - Added (empty) directories "html" & "latex". Those directories are created by doxygen, but as they are used in the CMakeList.txt, they must be present even before the fisrt run of cmake (otherwise cmake choke on them). - Doxygen sets to only generate html & pdf (through LaTeX) documentation. - All ".dox" files corrected to suit the new function members naming scheme (some work may remains in code examples). _____________________________________________________________________________ * ./hurricane/doc/hurricane/src/hurricane/Layer.{h.cpp} ./hurricane/doc/hurricane/src/hurricane/BasicLayer.{h.cpp} - Changed "Type" to "Material" to fit better the OpenAccess semantic. Introduce Material meanings : pWell, nWell, pImplant, nImplant active, metal, cut, obstacle & other. * ./coriolis/src/crlcore : - Switched to the generic layer model. Updated technology XML configuration files, technology parser & AP parser/driver. - Note that the representation of transistors visually changes as it's now modelled with Implant + Active. _____________________________________________________________________________ * ./hurricane/src/hurricane : - CompositeLayer replaced by 5 kind of symbolic layers : RegularLayer (1 BasicLayer) DiffusionLayer (2 or 3 BasicLayers: active+implant,well) TransistorLayer (3 or 4 BasicLayers: poly+active+implant,well) ContactLayer (4 or 5 BasicLayers: metal+cut+active+implant,well) ViaLayer (3 BasicLayers: metal0+cut0+metal1) - To better follow the OpenAccess semantic, the "obstacle" Material type is renommed to "blockage". - NB: doxygen documentation is not up-to-date and issue warnings. * ./coriolis/src/crlcore : - Migrate from CompositeLayer to the various SymbolicLayers. - Symbolic rules are now closer to the reality so that a Cell displayed with Hurricane should look identical to the Graal one. - Complete rewrite of the AP parser. Much simplificated, do not try to merge/articulates segments. This ensure a true rendering of the Cell. Especially do not create contact to anchor diffusion segments, which leads to very strange randering (DRC error as well). _____________________________________________________________________________ * ./hurricane : - Unit evolution to allow Symbolic (lamda) and Real (grid founder) mixing. All functions related to Unit translations are now grouped under the "DbU" class (another tribute to OpenAccess). "DbU" contains only static attributes (constants) and methods. Unit itself becomes a typedef inside this class, hence the file renaming from Unit.{h,cpp} to DbU.{h.cpp}. Have to replace all instances of "Unit" by "DbU::Unit". - Doc will be updated shortly. _____________________________________________________________________________ * ./coriolis/src/crlcore : - New AP parser : simplificated, no longer try to re-articulates segments. More accurate representation of standart cell innards. - More accurate symbolic extentions rules. - Propagated changes from Hurricane about Unit/DbU. _____________________________________________________________________________ * ./hurricane/src : - Rename "pyext" to "isobar". _____________________________________________________________________________ * ./hurricane/doc/hurricane : - Documentation of DbU, replacing documentation of Unit. * ./hurricane/src/hurricane/hurricane/DBo.h : - Property set is now a mutable member, allowing const DBo to changes their properties. Strange side effect on SlotAdapter in which we need to declare two separate templates, one for const type and another for non-const type. - _getTypeName() defined to prevents noisy error message when a derived class (from DBo) do not want to implement support for the inspector. _____________________________________________________________________________ Derrick Release !! * ./hurricane/src - Simplification of the Inspector internal mechanism. Simple, but with more templates, means a slower compilation. - The DbU::Unit problem : DbU::Unit are only typedef over long type, so we cannot create a specific overload for them. Uses "getValueRecord()" instead of "getRecord()" - For HInspectorWidget add a "getClone()" method. Also add a global object counter (for Record too) to track down memory leaks. - Big rewrite of the HInspectorWidget : now do not leak memory like hell, and only kept allocated the current Record and not the full stack of them (instead, we stack Slots which are ligthweigh objects). - Rename of "real" unit to "grid" unit. - New conversion function "getPhysicalsPerGrid()" and associated mechanism. * ./coriolis/src/crlcore : - Synchronise with the Hurricane modifications. _____________________________________________________________________________ * ./hurricane/src/hurricane/DbU.{h,cpp} : - Add forgotten converter function physicalToGrid(), physical units to founder grid units. * ./hurricane/src/hinspector : - Added history support, and ability to move through the history stack. - Fork support : by typing 'O' (capitalized 'o' letter) you can open a new inspector on the current record. _____________________________________________________________________________ * ./hurricane/src/hinspector :cla - No more extra arguments in HInspectorWidget & RecordModel constructors. Valid values have to be sets through setRootRecord() & setSlot(). - Key for forking sub-inspector is now *minus* 'o'. _____________________________________________________________________________ * ./hurricane/src/hviewer : - Bug: very tricky one. Do not emit "layoutAboutToChange()" signal after destroying the Record used by the RecordModel but before setting a new one and not setting the _record field to NULL. Now setRootRecord() should work more than once. _____________________________________________________________________________ * ./hurricane/src/hviewer : - API : in CellWidget & CellViewer constructors now only takes the parent QWidget. - Renaming coordinates translation functions for more clarity. - Adding a StatusBar showing mouse coordinates. _____________________________________________________________________________ * ./hurricane/src/hviewer : - Grid & Spot support (adjusted display threshold). - Added new copyToScreen() functions for _drawingBuffer to screen refreshment or partial copy (useful for Spot). _____________________________________________________________________________ * ./hurricane/src/hviewer : - New Widget policy : a widget do not generate other widget : applied to CellWidget which no longer supplies Palette & StatusBar. API note: to associate a HPalette to a CellWidget (that is be able to select layer) you have to call "bindToPalette()" on the CellWidget. - Hurricane reusable widget names prefixed by 'H' : HMousePosition and HPalette. _____________________________________________________________________________ * ./hurricane/src/hviewer : - New feature : support for highlighted selection with decent refresh time. To active selection mode, use the 's' key or the "View" menu. - New feature : HNetlist to browse a Cell's Netlist. HNetlist can be used with any NetInformations derived class, allowing the user to enrich the HNetlist displayed fields. For an example, have a look at SimpleNetlistWidget. - Added proper licence header to all file. _____________________________________________________________________________ * ./hurricane/src/hurricane : - New feature : geometrical Query with callback fonctions "a la" OpenAccess. * ./hurricane/src/hviewer : - Uses Query to draw display. - Bug : when drawing segments as lines (width inferior to 1 pixel) uses an alternate Pen which is one pixel wide and SolidLine styled, avoiding strange orange lines... Mechanism implemented in sub-class DrawingPlanes. - Make selection always visible regardless the zoom level. - CellWidget names it's most importants childs QWidget (mostly menus) for later retrieval in customized sub-classes. * ./coriolis/src/crlcore/src/cyclop : - Created a simple derived class from CellViewer. Example of customisation of CellWidget. _____________________________________________________________________________ * ./hurricane/src/hviewer : - Bug : now CellViewer can start with a NULL Cell, note that in this case all displacement/zooming function of CellWidget became uneffective. (display only a black screen) - New widget : HGraphics to select the layout graphic's theme. - New widget : HDisplayFilter to select displayed hierarchical levels. - Distinguish between Close (one viewer) & Exit (all viewers). - Small enhancments of DisplayStyle (Description & darkening). * ./coriolis/src/crlcore/src/ccore : - Xml display parser takes account of DisplayStyle description & darkening. * ./coriolis/src/crlcore/src/cyclop : - Enhanced COpenCellDialog : ability to open in a new Viewer. - Bug : now Cyclop can start on a NULL Cell. - Half Bug : when a Cell is loaded at start, call show() *before* setCell() so all internal widget resizing due to the insertion of the toolbar, menbar palette ... takes places before the Cell fit. Now the loaded cell appears correctly fitted. _____________________________________________________________________________ * ./hurricane/src/hviewer : - New feature : Command support. Move command is now implemenented as a Command and no longer built into the CellWidget. ZoomCommand implemented. - New feature : SelectCommand support along with new HSelection widget to browse the current selection. Selection is automatically kept up to date. - Note : Selection Browser & Netlist Browser pointer in the CellViewer are resets to NULL on widget destruction by closing. We do not want to keep big widget hiden. The are allocateds on demand. - New feature : progessive grid. First display 5x5 then 5x5 + 1x1. _____________________________________________________________________________ * ./hurricane/src/hviewer : - Bug : default argument to setWeight() sould be QFont::Normal and not "-1". Shows in Qt debug mode (catched by an assert). - Bug : SelectCommand now keep the Selection check button in sync. - Change : Palette doesn't show at start. * ./hurricane : - Now choice between static and dynamic linking. Note that thoses options are mutually exclusives. * ./coriolis/src/crlcore : - New choice between static and dynamic linking. - New feature : XmlParser optional warning when file not found (default is to warn). - New feature : now read environment from user's optional configuration file : ~/.environment.alliance.xml - Potential bug : when loading/parsing file, the XmlReader hangs if the opened file is a directory, and QFile allows directory opening :-( _____________________________________________________________________________ * ./hurricane/src/viewer : - New features : advanced selection widget/commands. Communications between CellWidget, HSelectionPopup, HSelection & SelectCommand mostly done through signal/slots (better undersdanding of the possibilities). - Change : debug menu is hidden by default. - Change : in all the QTableView rows are now correctly resized, even when filtering is active (new forceRowHeight() slot). I'm pretty sure there's a better way to handle this, but I haven't found it for now. - Change : small naming normalisation in all those TableView.
This commit is contained in:
parent
7bce78379c
commit
d669774d84
|
@ -68,6 +68,7 @@ namespace Hurricane {
|
|||
: Command()
|
||||
, _startPoint()
|
||||
, _stopPoint()
|
||||
, _drawingEnabled(false)
|
||||
{ }
|
||||
|
||||
|
||||
|
@ -78,7 +79,7 @@ namespace Hurricane {
|
|||
|
||||
bool AreaCommand::mouseMoveEvent ( CellWidget* widget, QMouseEvent* event )
|
||||
{
|
||||
if ( !isActive() ) return false;
|
||||
if ( !_drawingEnabled ) return false;
|
||||
|
||||
setStopPoint ( event->pos() );
|
||||
widget->update ();
|
||||
|
@ -89,7 +90,7 @@ namespace Hurricane {
|
|||
|
||||
void AreaCommand::draw ( CellWidget* widget )
|
||||
{
|
||||
if ( !_active ) return;
|
||||
if ( !_drawingEnabled ) return;
|
||||
|
||||
widget->drawScreenRect ( _startPoint, _stopPoint );
|
||||
drawCorner ( widget, true );
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
hurricane/viewer/CellViewer.h
|
||||
hurricane/viewer/RecordModel.h
|
||||
hurricane/viewer/HInspectorWidget.h
|
||||
hurricane/viewer/HSelectionPopupModel.h
|
||||
hurricane/viewer/HSelectionPopup.h
|
||||
hurricane/viewer/HSelectionModel.h
|
||||
hurricane/viewer/HSelection.h
|
||||
hurricane/viewer/HNetlistModel.h
|
||||
|
@ -41,6 +43,8 @@
|
|||
hurricane/viewer/CellWidgets.h
|
||||
hurricane/viewer/CellViewer.h
|
||||
hurricane/viewer/HInspectorWidget.h
|
||||
hurricane/viewer/HSelectionPopupModel.h
|
||||
hurricane/viewer/HSelectionPopup.h
|
||||
hurricane/viewer/HSelectionModel.h
|
||||
hurricane/viewer/HSelection.h
|
||||
hurricane/viewer/NetInformations.h
|
||||
|
@ -68,6 +72,8 @@
|
|||
CellViewer.cpp
|
||||
RecordModel.cpp
|
||||
HInspectorWidget.cpp
|
||||
HSelectionPopupModel.cpp
|
||||
HSelectionPopup.cpp
|
||||
HSelectionModel.cpp
|
||||
HSelection.cpp
|
||||
NetInformations.cpp
|
||||
|
|
|
@ -450,10 +450,23 @@ namespace Hurricane {
|
|||
{
|
||||
if ( !_selectionBrowser ) {
|
||||
_selectionBrowser = new HSelection ();
|
||||
_selectionBrowser->setSelection ( _cellWidget->getSelectorSet() );
|
||||
connect ( _selectionBrowser, SIGNAL(destroyed()), this, SLOT(selectionBrowserDestroyed()) );
|
||||
connect ( &_selectCommand , SIGNAL(selectionChanged(const set<Selector*>&,Cell*))
|
||||
_selectionBrowser->setSelection ( _cellWidget->getSelectorSet(), _cellWidget->getCell() );
|
||||
|
||||
connect ( _selectionBrowser , SIGNAL(destroyed()), this, SLOT(selectionBrowserDestroyed()) );
|
||||
connect ( _cellWidget , SIGNAL(selectionChanged(const set<Selector*>&,Cell*))
|
||||
, _selectionBrowser, SLOT (setSelection (const set<Selector*>&,Cell*)) );
|
||||
connect ( &_selectCommand , SIGNAL(selectionToggled (Occurrence,bool))
|
||||
, _cellWidget , SLOT (toggleSelect (Occurrence,bool)) );
|
||||
connect ( _selectionBrowser, SIGNAL(occurrenceToggled(Occurrence,bool))
|
||||
, _cellWidget , SLOT (toggleSelect (Occurrence,bool)) );
|
||||
connect ( _cellWidget , SIGNAL(occurrenceToggled(Occurrence))
|
||||
, _selectionBrowser, SLOT (toggleSelection (Occurrence)) );
|
||||
connect ( _selectionBrowser, SIGNAL(cumulativeToggled (bool))
|
||||
, _cellWidget , SLOT (setCumulativeSelection(bool)) );
|
||||
connect ( _selectionBrowser, SIGNAL(selectionCleared())
|
||||
, _cellWidget , SLOT (unselectAll ()) );
|
||||
connect ( _selectionBrowser, SIGNAL(showSelected (bool))
|
||||
, _cellWidget , SLOT (setShowSelection(bool)) );
|
||||
}
|
||||
_selectionBrowser->show ();
|
||||
}
|
||||
|
|
|
@ -351,6 +351,7 @@ namespace Hurricane {
|
|||
, _cell(NULL)
|
||||
, _showBoundaries(true)
|
||||
, _showSelection(false)
|
||||
, _cumulativeSelection(false)
|
||||
, _selectionHasChanged(false)
|
||||
, _commands()
|
||||
, _redrawRectCount(0)
|
||||
|
@ -457,6 +458,13 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
void CellWidget::setCumulativeSelection ( bool state )
|
||||
{
|
||||
cerr << "CellWidget::setCumulativeSelection() - " << state << endl;
|
||||
_cumulativeSelection = state;
|
||||
}
|
||||
|
||||
|
||||
void CellWidget::redraw ( QRect redrawArea )
|
||||
{
|
||||
// cerr << "CellWidget::redraw() - "
|
||||
|
@ -1068,6 +1076,17 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
void CellWidget::selectOccurrencesUnder ( Box selectArea )
|
||||
{
|
||||
if ( !_cumulativeSelection ) unselectAll ( true );
|
||||
|
||||
forEach ( Occurrence, ioccurrence, _cell->getOccurrencesUnder(selectArea) )
|
||||
select ( *ioccurrence );
|
||||
|
||||
emit selectionChanged(_selectors,_cell);
|
||||
}
|
||||
|
||||
|
||||
void CellWidget::unselect ( Occurrence occurrence )
|
||||
{
|
||||
if ( !occurrence.isValid() )
|
||||
|
@ -1101,4 +1120,31 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
void CellWidget::toggleSelect ( Occurrence occurrence, bool fromPopup )
|
||||
{
|
||||
if ( !occurrence.isValid() )
|
||||
throw Error ( "Can't select occurrence : invalid occurrence" );
|
||||
|
||||
if ( occurrence.getOwnerCell() != getCell() )
|
||||
throw Error ( "Can't select occurrence : incompatible occurrence" );
|
||||
|
||||
Property* property = occurrence.getProperty ( Selector::getPropertyName() );
|
||||
Selector* selector = NULL;
|
||||
if ( !property ) {
|
||||
selector = Selector::create ( occurrence );
|
||||
selector->attachTo ( this );
|
||||
} else {
|
||||
selector = dynamic_cast<Selector*>(property);
|
||||
if ( !selector )
|
||||
throw Error ( "Abnormal property named " + getString(Selector::getPropertyName()) );
|
||||
selector->detachFrom ( this );
|
||||
}
|
||||
|
||||
_selectionHasChanged = true;
|
||||
redraw ();
|
||||
|
||||
if ( fromPopup ) emit occurrenceToggled ( occurrence );
|
||||
}
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
|
|
|
@ -180,10 +180,10 @@ namespace Hurricane {
|
|||
|
||||
HInspectorWidget::HInspectorWidget ( QWidget* parent )
|
||||
: QWidget(parent)
|
||||
, _recordModel(NULL)
|
||||
, _baseModel(NULL)
|
||||
, _sortModel(NULL)
|
||||
, _historyComboBox(NULL)
|
||||
, _slotsView(NULL)
|
||||
, _view(NULL)
|
||||
, _rowHeight(20)
|
||||
, _history()
|
||||
{
|
||||
|
@ -192,17 +192,17 @@ namespace Hurricane {
|
|||
|
||||
_rowHeight = QFontMetrics(Graphics::getFixedFont()).height() + 4;
|
||||
|
||||
_slotsView = new QTableView(this);
|
||||
_slotsView->setShowGrid(false);
|
||||
_slotsView->setAlternatingRowColors(true);
|
||||
_slotsView->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
_slotsView->setSortingEnabled(true);
|
||||
_view = new QTableView(this);
|
||||
_view->setShowGrid(false);
|
||||
_view->setAlternatingRowColors(true);
|
||||
_view->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
_view->setSortingEnabled(true);
|
||||
|
||||
QHeaderView* horizontalHeader = _slotsView->horizontalHeader ();
|
||||
QHeaderView* horizontalHeader = _view->horizontalHeader ();
|
||||
horizontalHeader->setStretchLastSection ( true );
|
||||
horizontalHeader->setMinimumSectionSize ( 200 );
|
||||
|
||||
QHeaderView* verticalHeader = _slotsView->verticalHeader ();
|
||||
QHeaderView* verticalHeader = _view->verticalHeader ();
|
||||
verticalHeader->setVisible ( false );
|
||||
|
||||
_historyComboBox = new QComboBox ( this );
|
||||
|
@ -214,7 +214,7 @@ namespace Hurricane {
|
|||
|
||||
QGridLayout* inspectorLayout = new QGridLayout();
|
||||
inspectorLayout->addWidget(_historyComboBox , 0, 0, 1, 2);
|
||||
inspectorLayout->addWidget(_slotsView , 1, 0, 1, 2);
|
||||
inspectorLayout->addWidget(_view , 1, 0, 1, 2);
|
||||
inspectorLayout->addWidget(filterPatternLabel , 2, 0);
|
||||
inspectorLayout->addWidget(_filterPatternLineEdit, 2, 1);
|
||||
|
||||
|
@ -237,24 +237,32 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
void HInspectorWidget::forceRowHeight ()
|
||||
{
|
||||
for ( int rows=_sortModel->rowCount()-1; rows >= 0 ; rows-- )
|
||||
_view->setRowHeight ( rows, _rowHeight );
|
||||
}
|
||||
|
||||
|
||||
void HInspectorWidget::setRootRecord ( Record* record )
|
||||
{
|
||||
_history.setRootRecord ( record );
|
||||
|
||||
if ( !_recordModel ) {
|
||||
_recordModel = new RecordModel ( this );
|
||||
if ( !_baseModel ) {
|
||||
_baseModel = new RecordModel ( this );
|
||||
_sortModel = new QSortFilterProxyModel ( this );
|
||||
_sortModel->setSourceModel ( _recordModel );
|
||||
_sortModel->setSourceModel ( _baseModel );
|
||||
_sortModel->setDynamicSortFilter ( true );
|
||||
_sortModel->setFilterKeyColumn ( 1 );
|
||||
|
||||
_slotsView->setModel ( _sortModel );
|
||||
_slotsView->horizontalHeader()->setStretchLastSection ( true );
|
||||
_slotsView->resizeColumnToContents ( 0 );
|
||||
_view->setModel ( _sortModel );
|
||||
_view->horizontalHeader()->setStretchLastSection ( true );
|
||||
_view->resizeColumnToContents ( 0 );
|
||||
|
||||
// Only after creating the RecordModel can we connect the ComboBox.
|
||||
connect ( _historyComboBox, SIGNAL(currentIndexChanged(int))
|
||||
, this , SLOT(historyChanged(int)) );
|
||||
connect ( _baseModel, SIGNAL(layoutChanged()), this, SLOT(forceRowHeight()) );
|
||||
}
|
||||
|
||||
setSlot ();
|
||||
|
@ -265,13 +273,13 @@ namespace Hurricane {
|
|||
{
|
||||
bool change = true;
|
||||
|
||||
change = _recordModel->setSlot ( _history.getSlot(), _history.getDepth() );
|
||||
if ( change ) {
|
||||
int rows = _sortModel->rowCount ();
|
||||
for ( rows-- ; rows >= 0 ; rows-- )
|
||||
_slotsView->setRowHeight ( rows, _rowHeight );
|
||||
_slotsView->selectRow ( 0 );
|
||||
}
|
||||
change = _baseModel->setSlot ( _history.getSlot(), _history.getDepth() );
|
||||
// if ( change ) {
|
||||
// int rows = _sortModel->rowCount ();
|
||||
// for ( rows-- ; rows >= 0 ; rows-- )
|
||||
// _view->setRowHeight ( rows, _rowHeight );
|
||||
// _view->selectRow ( 0 );
|
||||
// }
|
||||
|
||||
return change;
|
||||
}
|
||||
|
@ -302,9 +310,9 @@ namespace Hurricane {
|
|||
void HInspectorWidget::keyPressEvent ( QKeyEvent *event )
|
||||
{
|
||||
if ( event->key() == Qt::Key_Right ) {
|
||||
QModelIndex index = _slotsView->currentIndex();
|
||||
QModelIndex index = _view->currentIndex();
|
||||
if ( index.isValid() ) {
|
||||
Slot* slot = _recordModel->getRecord()->getSlot(_sortModel->mapToSource(index).row());
|
||||
Slot* slot = _baseModel->getRecord()->getSlot(_sortModel->mapToSource(index).row());
|
||||
|
||||
if ( slot )
|
||||
pushSlot ( slot );
|
||||
|
@ -312,7 +320,7 @@ namespace Hurricane {
|
|||
} else if ( event->key() == Qt::Key_Left ) {
|
||||
back ();
|
||||
} else if ( event->key() == Qt::Key_O ) {
|
||||
forkInspector ( _slotsView->currentIndex() );
|
||||
forkInspector ( _view->currentIndex() );
|
||||
} else {
|
||||
event->ignore();
|
||||
}
|
||||
|
@ -322,6 +330,7 @@ namespace Hurricane {
|
|||
void HInspectorWidget::textFilterChanged ()
|
||||
{
|
||||
_sortModel->setFilterRegExp ( _filterPatternLineEdit->text() );
|
||||
forceRowHeight ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -337,7 +346,7 @@ namespace Hurricane {
|
|||
void HInspectorWidget::forkInspector ( const QModelIndex& index )
|
||||
{
|
||||
if ( index.isValid() ) {
|
||||
Slot* slot = _recordModel->getRecord()->getSlot(_sortModel->mapToSource(index).row());
|
||||
Slot* slot = _baseModel->getRecord()->getSlot(_sortModel->mapToSource(index).row());
|
||||
Record* record = slot->getDataRecord();
|
||||
|
||||
if ( record ) {
|
||||
|
|
|
@ -72,9 +72,9 @@ namespace Hurricane {
|
|||
|
||||
HNetlist::HNetlist ( QWidget* parent )
|
||||
: QWidget(parent)
|
||||
, _netlistModel(NULL)
|
||||
, _baseModel(NULL)
|
||||
, _sortModel(NULL)
|
||||
, _netlistView(NULL)
|
||||
, _view(NULL)
|
||||
, _rowHeight(20)
|
||||
, _cellWidget(NULL)
|
||||
{
|
||||
|
@ -83,26 +83,26 @@ namespace Hurricane {
|
|||
|
||||
_rowHeight = QFontMetrics(Graphics::getFixedFont()).height() + 4;
|
||||
|
||||
_netlistModel = new HNetlistModel ( this );
|
||||
_baseModel = new HNetlistModel ( this );
|
||||
|
||||
_sortModel = new QSortFilterProxyModel ( this );
|
||||
_sortModel->setSourceModel ( _netlistModel );
|
||||
_sortModel->setSourceModel ( _baseModel );
|
||||
_sortModel->setDynamicSortFilter ( true );
|
||||
_sortModel->setFilterKeyColumn ( 0 );
|
||||
|
||||
_netlistView = new QTableView(this);
|
||||
_netlistView->setShowGrid(false);
|
||||
_netlistView->setAlternatingRowColors(true);
|
||||
_netlistView->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
_netlistView->setSortingEnabled(true);
|
||||
_netlistView->setModel ( _sortModel );
|
||||
_netlistView->horizontalHeader()->setStretchLastSection ( true );
|
||||
_view = new QTableView(this);
|
||||
_view->setShowGrid(false);
|
||||
_view->setAlternatingRowColors(true);
|
||||
_view->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
_view->setSortingEnabled(true);
|
||||
_view->setModel ( _sortModel );
|
||||
_view->horizontalHeader()->setStretchLastSection ( true );
|
||||
|
||||
QHeaderView* horizontalHeader = _netlistView->horizontalHeader ();
|
||||
QHeaderView* horizontalHeader = _view->horizontalHeader ();
|
||||
horizontalHeader->setStretchLastSection ( true );
|
||||
horizontalHeader->setMinimumSectionSize ( 200 );
|
||||
|
||||
QHeaderView* verticalHeader = _netlistView->verticalHeader ();
|
||||
QHeaderView* verticalHeader = _view->verticalHeader ();
|
||||
verticalHeader->setVisible ( false );
|
||||
|
||||
_filterPatternLineEdit = new QLineEdit(this);
|
||||
|
@ -110,7 +110,7 @@ namespace Hurricane {
|
|||
filterPatternLabel->setBuddy(_filterPatternLineEdit);
|
||||
|
||||
QGridLayout* inspectorLayout = new QGridLayout();
|
||||
inspectorLayout->addWidget(_netlistView , 1, 0, 1, 2);
|
||||
inspectorLayout->addWidget(_view , 1, 0, 1, 2);
|
||||
inspectorLayout->addWidget(filterPatternLabel , 2, 0);
|
||||
inspectorLayout->addWidget(_filterPatternLineEdit, 2, 1);
|
||||
|
||||
|
@ -119,9 +119,10 @@ namespace Hurricane {
|
|||
connect ( _filterPatternLineEdit, SIGNAL(textChanged(const QString &))
|
||||
, this , SLOT(textFilterChanged())
|
||||
);
|
||||
connect ( _netlistView , SIGNAL(activated(const QModelIndex&))
|
||||
connect ( _view , SIGNAL(activated(const QModelIndex&))
|
||||
, this , SLOT(selectNet(const QModelIndex&))
|
||||
);
|
||||
connect ( _baseModel , SIGNAL(layoutChanged()), this, SLOT(forceRowHeight()) );
|
||||
|
||||
setWindowTitle(tr("Netlist"));
|
||||
resize(500, 300);
|
||||
|
@ -129,9 +130,16 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
void HNetlist::forceRowHeight ()
|
||||
{
|
||||
for ( int rows=_sortModel->rowCount()-1; rows >= 0 ; rows-- )
|
||||
_view->setRowHeight ( rows, _rowHeight );
|
||||
}
|
||||
|
||||
|
||||
void HNetlist::selectNet ( const QModelIndex& index )
|
||||
{
|
||||
const Net* net = _netlistModel->getNet ( _sortModel->mapToSource(index).row() );
|
||||
const Net* net = _baseModel->getNet ( _sortModel->mapToSource(index).row() );
|
||||
|
||||
if ( _cellWidget && net ) {
|
||||
_cellWidget->unselectAll ();
|
||||
|
@ -142,7 +150,7 @@ namespace Hurricane {
|
|||
|
||||
void HNetlist::keyPressEvent ( QKeyEvent* event )
|
||||
{
|
||||
if ( event->key() == Qt::Key_I ) { runInspector(_netlistView->currentIndex()); }
|
||||
if ( event->key() == Qt::Key_I ) { runInspector(_view->currentIndex()); }
|
||||
else {
|
||||
event->ignore();
|
||||
}
|
||||
|
@ -152,13 +160,14 @@ namespace Hurricane {
|
|||
void HNetlist::textFilterChanged ()
|
||||
{
|
||||
_sortModel->setFilterRegExp ( _filterPatternLineEdit->text() );
|
||||
forceRowHeight ();
|
||||
}
|
||||
|
||||
|
||||
void HNetlist::runInspector ( const QModelIndex& index )
|
||||
{
|
||||
if ( index.isValid() ) {
|
||||
const Net* net = _netlistModel->getNet ( _sortModel->mapToSource(index).row() );
|
||||
const Net* net = _baseModel->getNet ( _sortModel->mapToSource(index).row() );
|
||||
|
||||
HInspectorWidget* inspector = new HInspectorWidget ();
|
||||
|
||||
|
|
|
@ -50,11 +50,15 @@
|
|||
|
||||
|
||||
#include <QFontMetrics>
|
||||
#include <QFrame>
|
||||
#include <QLabel>
|
||||
#include <QCheckBox>
|
||||
#include <QPushButton>
|
||||
#include <QLineEdit>
|
||||
#include <QHeaderView>
|
||||
#include <QKeyEvent>
|
||||
#include <QGroupBox>
|
||||
#include <QHBoxLayout>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "hurricane/Commons.h"
|
||||
|
@ -72,9 +76,10 @@ namespace Hurricane {
|
|||
|
||||
HSelection::HSelection ( QWidget* parent )
|
||||
: QWidget(parent)
|
||||
, _selectionModel(NULL)
|
||||
, _baseModel(NULL)
|
||||
, _sortModel(NULL)
|
||||
, _selectionView(NULL)
|
||||
, _view(NULL)
|
||||
, _cumulative(NULL)
|
||||
, _rowHeight(20)
|
||||
{
|
||||
setAttribute ( Qt::WA_DeleteOnClose );
|
||||
|
@ -82,51 +87,90 @@ namespace Hurricane {
|
|||
|
||||
_rowHeight = QFontMetrics(Graphics::getFixedFont()).height() + 4;
|
||||
|
||||
_selectionModel = new HSelectionModel ( this );
|
||||
|
||||
_sortModel = new QSortFilterProxyModel ( this );
|
||||
_sortModel->setSourceModel ( _selectionModel );
|
||||
_sortModel->setDynamicSortFilter ( true );
|
||||
_sortModel->setFilterKeyColumn ( 0 );
|
||||
|
||||
_selectionView = new QTableView(this);
|
||||
_selectionView->setShowGrid(false);
|
||||
_selectionView->setAlternatingRowColors(true);
|
||||
_selectionView->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
_selectionView->setSortingEnabled(true);
|
||||
_selectionView->setModel ( _sortModel );
|
||||
_selectionView->horizontalHeader()->setStretchLastSection ( true );
|
||||
|
||||
QHeaderView* horizontalHeader = _selectionView->horizontalHeader ();
|
||||
horizontalHeader->setStretchLastSection ( true );
|
||||
horizontalHeader->setMinimumSectionSize ( 200 );
|
||||
|
||||
QHeaderView* verticalHeader = _selectionView->verticalHeader ();
|
||||
verticalHeader->setVisible ( false );
|
||||
|
||||
_filterPatternLineEdit = new QLineEdit(this);
|
||||
QLabel* filterPatternLabel = new QLabel(tr("&Filter pattern:"), this);
|
||||
filterPatternLabel->setBuddy(_filterPatternLineEdit);
|
||||
|
||||
QGridLayout* inspectorLayout = new QGridLayout();
|
||||
inspectorLayout->addWidget(_selectionView , 1, 0, 1, 2);
|
||||
inspectorLayout->addWidget(filterPatternLabel , 2, 0);
|
||||
inspectorLayout->addWidget(_filterPatternLineEdit, 2, 1);
|
||||
QHBoxLayout* hLayout1 = new QHBoxLayout ();
|
||||
hLayout1->addWidget ( filterPatternLabel );
|
||||
hLayout1->addWidget ( _filterPatternLineEdit );
|
||||
|
||||
setLayout ( inspectorLayout );
|
||||
QFrame* separator = new QFrame ();
|
||||
separator->setFrameShape ( QFrame::HLine );
|
||||
separator->setFrameShadow ( QFrame::Sunken );
|
||||
|
||||
_cumulative = new QCheckBox ();
|
||||
_cumulative->setText ( tr("Cumulative Selection") );
|
||||
_cumulative->setChecked ( false );
|
||||
|
||||
QPushButton* clear = new QPushButton ();
|
||||
clear->setText ( tr("Clear") );
|
||||
|
||||
QHBoxLayout* hLayout2 = new QHBoxLayout ();
|
||||
hLayout2->addWidget ( _cumulative );
|
||||
hLayout2->addStretch ();
|
||||
hLayout2->addWidget ( clear );
|
||||
|
||||
_baseModel = new HSelectionModel ( this );
|
||||
|
||||
_sortModel = new QSortFilterProxyModel ( this );
|
||||
_sortModel->setSourceModel ( _baseModel );
|
||||
_sortModel->setDynamicSortFilter ( true );
|
||||
_sortModel->setFilterKeyColumn ( 0 );
|
||||
|
||||
_view = new QTableView(this);
|
||||
_view->setShowGrid(false);
|
||||
_view->setAlternatingRowColors(true);
|
||||
_view->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
_view->setSortingEnabled(true);
|
||||
_view->setModel ( _sortModel );
|
||||
_view->horizontalHeader()->setStretchLastSection ( true );
|
||||
|
||||
QHeaderView* horizontalHeader = _view->horizontalHeader ();
|
||||
horizontalHeader->setStretchLastSection ( true );
|
||||
horizontalHeader->setMinimumSectionSize ( 200 );
|
||||
|
||||
QHeaderView* verticalHeader = _view->verticalHeader ();
|
||||
verticalHeader->setVisible ( false );
|
||||
|
||||
QVBoxLayout* vLayout = new QVBoxLayout ();
|
||||
vLayout->addWidget ( _view );
|
||||
vLayout->addLayout ( hLayout1 );
|
||||
vLayout->addWidget ( separator );
|
||||
vLayout->addLayout ( hLayout2 );
|
||||
|
||||
setLayout ( vLayout );
|
||||
|
||||
connect ( _filterPatternLineEdit, SIGNAL(textChanged(const QString &))
|
||||
, this , SLOT(textFilterChanged())
|
||||
);
|
||||
connect ( _baseModel , SIGNAL(layoutChanged()), this, SLOT(forceRowHeight()) );
|
||||
connect ( _cumulative, SIGNAL(toggled(bool)) , this, SIGNAL(cumulativeToggled(bool)) );
|
||||
connect ( clear , SIGNAL(clicked()) , this, SIGNAL(selectionCleared()) );
|
||||
connect ( clear , SIGNAL(clicked()) , _baseModel, SLOT(clear()) );
|
||||
|
||||
setWindowTitle(tr("Selection<None>"));
|
||||
resize(500, 300);
|
||||
setWindowTitle ( tr("Selection<None>") );
|
||||
resize ( 500, 300 );
|
||||
}
|
||||
|
||||
|
||||
void HSelection::hideEvent ( QHideEvent* event )
|
||||
{
|
||||
emit showSelected(false);
|
||||
}
|
||||
|
||||
|
||||
void HSelection::forceRowHeight ()
|
||||
{
|
||||
for ( int rows=_sortModel->rowCount()-1; rows >= 0 ; rows-- )
|
||||
_view->setRowHeight ( rows, _rowHeight );
|
||||
}
|
||||
|
||||
|
||||
void HSelection::keyPressEvent ( QKeyEvent* event )
|
||||
{
|
||||
if ( event->key() == Qt::Key_I ) { runInspector(_selectionView->currentIndex()); }
|
||||
if ( event->key() == Qt::Key_I ) { runInspector ( _view->currentIndex() ); }
|
||||
else if ( event->key() == Qt::Key_T ) { toggleSelection ( _view->currentIndex() ); }
|
||||
else event->ignore();
|
||||
}
|
||||
|
||||
|
@ -134,38 +178,48 @@ namespace Hurricane {
|
|||
void HSelection::textFilterChanged ()
|
||||
{
|
||||
_sortModel->setFilterRegExp ( _filterPatternLineEdit->text() );
|
||||
forceRowHeight ();
|
||||
}
|
||||
|
||||
|
||||
void HSelection::addToSelection ( Selector* selector )
|
||||
bool HSelection::isCumulative () const
|
||||
{
|
||||
_selectionModel->addToSelection ( selector );
|
||||
int rows = _sortModel->rowCount () - 1;
|
||||
_selectionView->setRowHeight ( rows, _rowHeight );
|
||||
return _cumulative->isChecked();
|
||||
}
|
||||
|
||||
|
||||
void HSelection::toggleSelection ( const QModelIndex& index )
|
||||
{
|
||||
Occurrence occurrence = _baseModel->toggleSelection ( index );
|
||||
if ( occurrence.isValid() )
|
||||
emit occurrenceToggled ( occurrence, false );
|
||||
}
|
||||
|
||||
|
||||
void HSelection::toggleSelection ( Occurrence occurrence )
|
||||
{
|
||||
_baseModel->toggleSelection ( occurrence );
|
||||
}
|
||||
|
||||
|
||||
void HSelection::setSelection ( const set<Selector*>& selection, Cell* cell )
|
||||
{
|
||||
_selectionModel->setSelection ( selection );
|
||||
_baseModel->setSelection ( selection );
|
||||
|
||||
string windowTitle = "Selection";
|
||||
if ( cell ) windowTitle += getString(cell);
|
||||
else windowTitle += "<None>";
|
||||
setWindowTitle ( tr(windowTitle.c_str()) );
|
||||
|
||||
int rows = _sortModel->rowCount ();
|
||||
for ( rows-- ; rows >= 0 ; rows-- )
|
||||
_selectionView->setRowHeight ( rows, _rowHeight );
|
||||
_selectionView->selectRow ( 0 );
|
||||
_selectionView->resizeColumnToContents ( 0 );
|
||||
_view->selectRow ( 0 );
|
||||
_view->resizeColumnToContents ( 0 );
|
||||
}
|
||||
|
||||
|
||||
void HSelection::runInspector ( const QModelIndex& index )
|
||||
{
|
||||
if ( index.isValid() ) {
|
||||
Occurrence occurrence = _selectionModel->getOccurrence ( _sortModel->mapToSource(index).row() );
|
||||
Occurrence occurrence = _baseModel->getOccurrence ( _sortModel->mapToSource(index).row() );
|
||||
|
||||
HInspectorWidget* inspector = new HInspectorWidget ();
|
||||
|
||||
|
|
|
@ -50,6 +50,8 @@
|
|||
// x-----------------------------------------------------------------x
|
||||
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <QFont>
|
||||
|
||||
#include "hurricane/Path.h"
|
||||
|
@ -58,6 +60,7 @@
|
|||
#include "hurricane/viewer/Graphics.h"
|
||||
#include "hurricane/viewer/Selector.h"
|
||||
#include "hurricane/viewer/HSelectionModel.h"
|
||||
#include "hurricane/viewer/HSelection.h"
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
@ -73,22 +76,77 @@ namespace Hurricane {
|
|||
{ }
|
||||
|
||||
|
||||
void HSelectionModel::setSelection ( const set<Selector*>& selection )
|
||||
bool HSelectionModel::isCumulative () const
|
||||
{
|
||||
HSelection* widget = qobject_cast<HSelection*>(QObject::parent());
|
||||
if ( widget )
|
||||
return widget->isCumulative();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void HSelectionModel::clear ()
|
||||
{
|
||||
_selection.clear ();
|
||||
emit layoutChanged ();
|
||||
}
|
||||
|
||||
set<Selector*>::const_iterator iselector = selection.begin();
|
||||
for ( ; iselector != selection.end() ; iselector++ )
|
||||
_selection.push_back ( (*iselector)->getOccurrence() );
|
||||
|
||||
void HSelectionModel::setSelection ( const set<Selector*>& selection )
|
||||
{
|
||||
if ( !isCumulative() ) _selection.clear ();
|
||||
|
||||
set<Selector*>::const_iterator iselector = selection.begin();
|
||||
vector<OccurrenceItem>::iterator iitem;
|
||||
for ( ; iselector != selection.end() ; iselector++ ) {
|
||||
if ( isCumulative() ) {
|
||||
iitem = find( _selection.begin(), _selection.end(), (*iselector)->getOccurrence() );
|
||||
if ( iitem != _selection.end() ) {
|
||||
(*iitem)._flags |= OccurrenceItem::Selected;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
_selection.push_back ( OccurrenceItem((*iselector)->getOccurrence()) );
|
||||
}
|
||||
|
||||
emit layoutChanged ();
|
||||
}
|
||||
|
||||
|
||||
void HSelectionModel::addToSelection ( Selector* selector )
|
||||
Occurrence HSelectionModel::toggleSelection ( const QModelIndex& index )
|
||||
{
|
||||
_selection.push_back ( selector->getOccurrence() );
|
||||
if ( index.isValid() && ( index.row() < (int)_selection.size() ) ) {
|
||||
_selection[index.row()].toggle();
|
||||
emit layoutChanged ();
|
||||
|
||||
return _selection[index.row()]._occurrence;
|
||||
}
|
||||
|
||||
return Occurrence ();
|
||||
}
|
||||
|
||||
|
||||
void HSelectionModel::toggleSelection ( Occurrence occurrence )
|
||||
{
|
||||
bool found = false;
|
||||
size_t i = 0;
|
||||
for ( ; i<_selection.size() ; i++ ) {
|
||||
if ( !found && (_selection[i]._occurrence == occurrence) ) {
|
||||
found = true;
|
||||
if ( isCumulative() ) break;
|
||||
}
|
||||
if ( found && ( i < _selection.size()-1 ) )
|
||||
_selection[i] = _selection[i+1];
|
||||
}
|
||||
|
||||
if ( !found )
|
||||
_selection.push_back ( OccurrenceItem(occurrence) );
|
||||
else {
|
||||
if ( isCumulative() ) _selection[i].toggle ();
|
||||
else _selection.pop_back ();
|
||||
}
|
||||
|
||||
emit layoutChanged ();
|
||||
}
|
||||
|
||||
|
@ -107,20 +165,24 @@ namespace Hurricane {
|
|||
}
|
||||
}
|
||||
|
||||
int row = index.row ();
|
||||
if ( row >= (int)_selection.size() ) return QVariant ();
|
||||
|
||||
if ( role == Qt::FontRole ) {
|
||||
switch (index.column()) {
|
||||
case 0: return occurrenceFont;
|
||||
default: return entityFont;
|
||||
case 1:
|
||||
if ( _selection[row]._flags & OccurrenceItem::Selected )
|
||||
return entityFont;
|
||||
default:
|
||||
return occurrenceFont;
|
||||
}
|
||||
}
|
||||
|
||||
if ( role == Qt::DisplayRole ) {
|
||||
int row = index.row ();
|
||||
if ( row < (int)_selection.size() ) {
|
||||
switch ( index.column() ) {
|
||||
case 0: return getString(_selection[row].getPath()).c_str();
|
||||
case 1: return getString(_selection[row].getEntity()).c_str();
|
||||
}
|
||||
switch ( index.column() ) {
|
||||
case 0: return getString(_selection[row]._occurrence.getPath()).c_str();
|
||||
case 1: return getString(_selection[row]._occurrence.getEntity()).c_str();
|
||||
}
|
||||
}
|
||||
return QVariant();
|
||||
|
@ -159,7 +221,7 @@ namespace Hurricane {
|
|||
{
|
||||
if ( row >= (int)_selection.size() ) return Occurrence();
|
||||
|
||||
return _selection[row];
|
||||
return _selection[row]._occurrence;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,186 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Project.
|
||||
// Copyright (C) Laboratoire LIP6 - Departement ASIM
|
||||
// Universite Pierre et Marie Curie
|
||||
//
|
||||
// Main contributors :
|
||||
// Christophe Alexandre <Christophe.Alexandre@lip6.fr>
|
||||
// Sophie Belloeil <Sophie.Belloeil@lip6.fr>
|
||||
// Hugo Clément <Hugo.Clement@lip6.fr>
|
||||
// Jean-Paul Chaput <Jean-Paul.Chaput@lip6.fr>
|
||||
// Damien Dupuis <Damien.Dupuis@lip6.fr>
|
||||
// Christian Masson <Christian.Masson@lip6.fr>
|
||||
// Marek Sroka <Marek.Sroka@lip6.fr>
|
||||
//
|
||||
// The Coriolis Project is free software; you can redistribute it
|
||||
// and/or modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2 of
|
||||
// the License, or (at your option) any later version.
|
||||
//
|
||||
// The Coriolis Project is distributed in the hope that it will be
|
||||
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Coriolis Project; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
// USA
|
||||
//
|
||||
// License-Tag
|
||||
// Authors-Tag
|
||||
// ===================================================================
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// x-----------------------------------------------------------------x
|
||||
// | |
|
||||
// | H U R R I C A N E |
|
||||
// | |
|
||||
// | Author : Jean-Paul CHAPUT |
|
||||
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Module : "./HSelectionPopup.cpp" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
|
||||
|
||||
#include <QFontMetrics>
|
||||
#include <QLabel>
|
||||
#include <QHeaderView>
|
||||
#include <QKeyEvent>
|
||||
#include <QGroupBox>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "hurricane/Commons.h"
|
||||
|
||||
#include "hurricane/viewer/Graphics.h"
|
||||
#include "hurricane/viewer/HSelectionPopupModel.h"
|
||||
#include "hurricane/viewer/HSelectionPopup.h"
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
|
||||
|
||||
HSelectionPopup::HSelectionPopup ( QWidget* parent )
|
||||
: QWidget(parent)
|
||||
, _model(NULL)
|
||||
, _view(NULL)
|
||||
, _rowHeight(20)
|
||||
{
|
||||
setAttribute ( Qt::WA_DeleteOnClose );
|
||||
setAttribute ( Qt::WA_QuitOnClose, false );
|
||||
//setWindowFlags ( Qt::Popup );
|
||||
setWindowFlags ( Qt::FramelessWindowHint );
|
||||
setWindowOpacity ( 0.7 );
|
||||
|
||||
_rowHeight = QFontMetrics(Graphics::getFixedFont()).height() + 4;
|
||||
|
||||
_model = new HSelectionPopupModel ( this );
|
||||
|
||||
_view = new QTableView ( this );
|
||||
_view->setShowGrid ( false );
|
||||
_view->setAlternatingRowColors ( true );
|
||||
_view->setSelectionBehavior ( QAbstractItemView::SelectRows );
|
||||
_view->setModel ( _model );
|
||||
_view->horizontalHeader()->setStretchLastSection ( true );
|
||||
_view->setWordWrap ( false );
|
||||
//_view->setTextElideMode ( Qt::ElideRight );
|
||||
//_view->setFixedSize ( QSize(300,100) );
|
||||
//_view->setIconSize ( QSize(600,40) );
|
||||
//_view->setStyleSheet ( "QTableView { background-color: #555555; }" );
|
||||
|
||||
QHeaderView* horizontalHeader = _view->horizontalHeader ();
|
||||
horizontalHeader->setStretchLastSection ( true );
|
||||
horizontalHeader->setMinimumSectionSize ( 200 );
|
||||
horizontalHeader->setVisible ( false );
|
||||
|
||||
QHeaderView* verticalHeader = _view->verticalHeader ();
|
||||
verticalHeader->setVisible ( false );
|
||||
|
||||
connect ( _model, SIGNAL(layoutChanged()), this, SLOT(forceRowHeight()) );
|
||||
|
||||
resize ( 600, 10 );
|
||||
}
|
||||
|
||||
|
||||
void HSelectionPopup::popup ()
|
||||
{
|
||||
show ();
|
||||
grabMouse ();
|
||||
}
|
||||
|
||||
|
||||
void HSelectionPopup::forceRowHeight ()
|
||||
{
|
||||
for ( int rows=_model->rowCount()-1; rows >= 0 ; rows-- )
|
||||
_view->setRowHeight ( rows, _rowHeight );
|
||||
}
|
||||
|
||||
|
||||
void HSelectionPopup::keyPressEvent ( QKeyEvent* event )
|
||||
{
|
||||
event->ignore();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void HSelectionPopup::mouseMoveEvent ( QMouseEvent* event )
|
||||
{
|
||||
QModelIndex index = _view->indexAt ( event->pos() );
|
||||
if ( index.isValid() )
|
||||
_view->selectionModel()->select ( index, QItemSelectionModel::ClearAndSelect );
|
||||
else
|
||||
_view->selectionModel()->clearSelection ();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void HSelectionPopup::mouseReleaseEvent ( QMouseEvent* event )
|
||||
{
|
||||
releaseMouse ();
|
||||
hide ();
|
||||
|
||||
QModelIndex index = _view->indexAt ( event->pos() );
|
||||
if ( index.isValid() ) {
|
||||
Occurrence occurrence = _model->getOccurrence(index.row());
|
||||
if ( occurrence.getEntity() )
|
||||
emit occurrenceSelected ( occurrence, true );
|
||||
}
|
||||
|
||||
clear ();
|
||||
}
|
||||
|
||||
|
||||
void HSelectionPopup::add ( Occurrence occurrence, bool showChange )
|
||||
{
|
||||
_model->add ( occurrence, showChange );
|
||||
}
|
||||
|
||||
|
||||
void HSelectionPopup::clear ()
|
||||
{
|
||||
_model->clear ();
|
||||
}
|
||||
|
||||
|
||||
void HSelectionPopup::updateLayout ()
|
||||
{
|
||||
_model->updateLayout ();
|
||||
|
||||
// This seems a very bad way to set the size of the popup window
|
||||
// and underlying QTableView (top-down instead of bottom-up).
|
||||
int rows = _model->rowCount();
|
||||
QSize windowSize = QSize ( 600, _rowHeight*rows + 4 );
|
||||
|
||||
resize ( windowSize );
|
||||
_view->resize ( windowSize );
|
||||
}
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
|
@ -0,0 +1,183 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Project.
|
||||
// Copyright (C) Laboratoire LIP6 - Departement ASIM
|
||||
// Universite Pierre et Marie Curie
|
||||
//
|
||||
// Main contributors :
|
||||
// Christophe Alexandre <Christophe.Alexandre@lip6.fr>
|
||||
// Sophie Belloeil <Sophie.Belloeil@lip6.fr>
|
||||
// Hugo Clément <Hugo.Clement@lip6.fr>
|
||||
// Jean-Paul Chaput <Jean-Paul.Chaput@lip6.fr>
|
||||
// Damien Dupuis <Damien.Dupuis@lip6.fr>
|
||||
// Christian Masson <Christian.Masson@lip6.fr>
|
||||
// Marek Sroka <Marek.Sroka@lip6.fr>
|
||||
//
|
||||
// The Coriolis Project is free software; you can redistribute it
|
||||
// and/or modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2 of
|
||||
// the License, or (at your option) any later version.
|
||||
//
|
||||
// The Coriolis Project is distributed in the hope that it will be
|
||||
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Coriolis Project; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
// USA
|
||||
//
|
||||
// License-Tag
|
||||
// Authors-Tag
|
||||
// ===================================================================
|
||||
//
|
||||
// $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 : "./HSelectionPopupModel.cpp" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
|
||||
|
||||
#include <QFont>
|
||||
|
||||
#include "hurricane/Path.h"
|
||||
#include "hurricane/Entity.h"
|
||||
#include "hurricane/Occurrence.h"
|
||||
#include "hurricane/viewer/Graphics.h"
|
||||
#include "hurricane/viewer/Selector.h"
|
||||
#include "hurricane/viewer/HSelectionPopupModel.h"
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
|
||||
HSelectionPopupModel::HSelectionPopupModel ( QObject* parent )
|
||||
: QAbstractTableModel(parent)
|
||||
, _occurrences(NULL)
|
||||
{ }
|
||||
|
||||
|
||||
HSelectionPopupModel::~HSelectionPopupModel ()
|
||||
{
|
||||
clear ();
|
||||
}
|
||||
|
||||
|
||||
void HSelectionPopupModel::add ( Occurrence occurrence, bool showChange )
|
||||
{
|
||||
if ( !_occurrences ) _occurrences = new vector<Occurrence> ();
|
||||
|
||||
_occurrences->push_back ( occurrence );
|
||||
if ( showChange ) emit layoutChanged ();
|
||||
}
|
||||
|
||||
|
||||
void HSelectionPopupModel::clear ()
|
||||
{
|
||||
if ( _occurrences ) {
|
||||
delete _occurrences;
|
||||
_occurrences = NULL;
|
||||
}
|
||||
emit layoutChanged ();
|
||||
}
|
||||
|
||||
|
||||
void HSelectionPopupModel::updateLayout ()
|
||||
{
|
||||
emit layoutChanged ();
|
||||
}
|
||||
|
||||
|
||||
QVariant HSelectionPopupModel::data ( const QModelIndex& index, int role ) const
|
||||
{
|
||||
static QFont occurrenceFont = Graphics::getFixedFont ( QFont::Normal );
|
||||
static QFont entityFont = Graphics::getFixedFont ( QFont::Bold, false );
|
||||
|
||||
if ( !index.isValid() ) return QVariant ();
|
||||
|
||||
if ( role == Qt::SizeHintRole ) {
|
||||
switch (index.column()) {
|
||||
default: return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if ( role == Qt::FontRole ) {
|
||||
switch (index.column()) {
|
||||
default: return entityFont;
|
||||
}
|
||||
}
|
||||
|
||||
if ( role == Qt::DisplayRole ) {
|
||||
int row = index.row ();
|
||||
string name;
|
||||
if ( _occurrences ) {
|
||||
if ( row < (int)_occurrences->size() ) {
|
||||
if ( index.column() == 0 ) {
|
||||
name = getString ( (*_occurrences)[row].getPath() )
|
||||
+ getString ( (*_occurrences)[row].getEntity() );
|
||||
return name.c_str();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ( row < 1 ) {
|
||||
if ( index.column() == 0 ) {
|
||||
return QVariant ( tr("Nothing Selectable") );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
|
||||
QVariant HSelectionPopupModel::headerData ( int section
|
||||
, Qt::Orientation orientation
|
||||
, int role ) const
|
||||
{
|
||||
if ( ( orientation == Qt::Vertical ) || (role != Qt::DisplayRole) )
|
||||
return QVariant();
|
||||
|
||||
if ( section == 0 ) {
|
||||
return "Path+Entity";
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
|
||||
int HSelectionPopupModel::rowCount ( const QModelIndex& parent ) const
|
||||
{
|
||||
if ( !_occurrences ) return 1;
|
||||
return _occurrences->size();
|
||||
}
|
||||
|
||||
|
||||
int HSelectionPopupModel::columnCount ( const QModelIndex& parent ) const
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Occurrence HSelectionPopupModel::getOccurrence ( int row )
|
||||
{
|
||||
if ( !_occurrences || (row >= (int)_occurrences->size()) )
|
||||
return Occurrence();
|
||||
|
||||
return (*_occurrences)[row];
|
||||
}
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
|
@ -58,6 +58,7 @@
|
|||
|
||||
# include "hurricane/viewer/CellWidget.h"
|
||||
# include "hurricane/viewer/SelectCommand.h"
|
||||
# include "hurricane/viewer/HSelectionPopup.h"
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
@ -70,11 +71,19 @@ namespace Hurricane {
|
|||
SelectCommand::SelectCommand ()
|
||||
: AreaCommand()
|
||||
, _selectAction(NULL)
|
||||
{ }
|
||||
, _selectionPopup(NULL)
|
||||
{
|
||||
_selectionPopup = new HSelectionPopup ();
|
||||
|
||||
connect ( _selectionPopup, SIGNAL(occurrenceSelected(Occurrence,bool))
|
||||
, this , SIGNAL(selectionToggled (Occurrence,bool)) );
|
||||
}
|
||||
|
||||
|
||||
SelectCommand::~SelectCommand ()
|
||||
{ }
|
||||
{
|
||||
delete _selectionPopup;
|
||||
}
|
||||
|
||||
|
||||
void SelectCommand::bindToAction ( QAction* action )
|
||||
|
@ -87,9 +96,21 @@ namespace Hurricane {
|
|||
{
|
||||
if ( isActive() ) return true;
|
||||
|
||||
if ( (event->button() == Qt::RightButton) && !event->modifiers() ) {
|
||||
setActive ( true );
|
||||
setStartPoint ( event->pos() );
|
||||
if ( event->button() == Qt::RightButton ) {
|
||||
if ( !event->modifiers() ) {
|
||||
setActive ( true );
|
||||
setStartPoint ( event->pos() );
|
||||
setDrawingEnabled ( true );
|
||||
} else if ( event->modifiers() == Qt::ControlModifier ) {
|
||||
QRect selectArea ( event->pos() - QPoint(2,2), QSize(4,4) );
|
||||
forEach ( Occurrence, ioccurrence
|
||||
, widget->getCell()->getOccurrencesUnder(widget->screenToDbuBox(selectArea)) ) {
|
||||
_selectionPopup->add ( *ioccurrence );
|
||||
}
|
||||
_selectionPopup->updateLayout ();
|
||||
_selectionPopup->move ( event->globalPos() );
|
||||
_selectionPopup->popup ();
|
||||
}
|
||||
}
|
||||
|
||||
return isActive();
|
||||
|
@ -101,6 +122,7 @@ namespace Hurricane {
|
|||
if ( !isActive() ) return false;
|
||||
|
||||
setActive ( false );
|
||||
setDrawingEnabled ( false );
|
||||
|
||||
QRect selectArea;
|
||||
if ( _startPoint == _stopPoint )
|
||||
|
@ -108,11 +130,9 @@ namespace Hurricane {
|
|||
else
|
||||
selectArea = QRect ( _startPoint, _stopPoint );
|
||||
|
||||
widget->unselectAll ();
|
||||
forEach ( Occurrence, ioccurrence
|
||||
, widget->getCell()->getOccurrencesUnder(widget->screenToDbuBox(selectArea)) ) {
|
||||
widget->select ( *ioccurrence );
|
||||
}
|
||||
//widget->unselectAll ();
|
||||
widget->selectOccurrencesUnder ( widget->screenToDbuBox(selectArea) );
|
||||
|
||||
if ( _selectAction ) {
|
||||
if ( !_selectAction->isChecked() )
|
||||
_selectAction->setChecked ( true );
|
||||
|
@ -122,11 +142,10 @@ namespace Hurricane {
|
|||
widget->setShowSelection ( true );
|
||||
widget->redraw ();
|
||||
}
|
||||
|
||||
emit selectionChanged(widget->getSelectorSet(),widget->getCell());
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
|
|
|
@ -88,8 +88,9 @@ namespace Hurricane {
|
|||
if ( isActive() ) return true;
|
||||
|
||||
if ( (event->button() == Qt::LeftButton) && (event->modifiers() & Qt::ControlModifier) ) {
|
||||
setActive ( true );
|
||||
setStartPoint ( event->pos() );
|
||||
setActive ( true );
|
||||
setStartPoint ( event->pos() );
|
||||
setDrawingEnabled ( true );
|
||||
}
|
||||
|
||||
return isActive();
|
||||
|
@ -100,7 +101,8 @@ namespace Hurricane {
|
|||
{
|
||||
if ( !isActive() ) return false;
|
||||
|
||||
setActive ( false );
|
||||
setActive ( false );
|
||||
setDrawingEnabled ( false );
|
||||
|
||||
widget->reframe ( widget->screenToDbuBox(QRect(_startPoint,_stopPoint)) );
|
||||
|
||||
|
|
|
@ -67,13 +67,16 @@ namespace Hurricane {
|
|||
virtual ~AreaCommand ();
|
||||
inline void setStartPoint ( const QPoint& start );
|
||||
inline void setStopPoint ( const QPoint& stop );
|
||||
inline void setDrawingEnabled ( bool state );
|
||||
virtual void draw ( CellWidget* widget );
|
||||
virtual void drawCorner ( CellWidget* widget, bool bottomLeft );
|
||||
virtual bool mouseMoveEvent ( CellWidget* widget, QMouseEvent* event );
|
||||
inline bool isDrawingEnabled () const;
|
||||
protected:
|
||||
QPoint _startPoint;
|
||||
QPoint _stopPoint;
|
||||
QPoint _cornerPoints[3];
|
||||
bool _drawingEnabled;
|
||||
private:
|
||||
AreaCommand ( const AreaCommand& );
|
||||
AreaCommand& operator= ( const AreaCommand& );
|
||||
|
@ -88,6 +91,14 @@ namespace Hurricane {
|
|||
{ _stopPoint = stop; }
|
||||
|
||||
|
||||
inline void AreaCommand::setDrawingEnabled ( bool state )
|
||||
{ _drawingEnabled = state; }
|
||||
|
||||
|
||||
inline bool AreaCommand::isDrawingEnabled () const
|
||||
{ return _drawingEnabled; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -111,90 +111,95 @@ namespace Hurricane {
|
|||
|
||||
public:
|
||||
// Constructor & Destructor.
|
||||
CellWidget ( QWidget* parent=NULL );
|
||||
virtual ~CellWidget ();
|
||||
CellWidget ( QWidget* parent=NULL );
|
||||
virtual ~CellWidget ();
|
||||
// Accessors.
|
||||
// MapView* getMapView () { return _mapView; };
|
||||
void setCell ( Cell* cell );
|
||||
inline Cell* getCell () const;
|
||||
inline HPalette* getPalette ();
|
||||
void bindToPalette ( HPalette* palette );
|
||||
void detachFromPalette ();
|
||||
void bindCommand ( Command* command );
|
||||
void unbindCommand ( Command* command );
|
||||
inline bool showBoundaries () const;
|
||||
inline set<Selector*>& getSelectorSet ();
|
||||
inline bool showSelection () const;
|
||||
void select ( const Net* net, bool delayRedraw=false );
|
||||
void select ( Occurrence occurence );
|
||||
void unselect ( Occurrence occurence );
|
||||
void unselectAll ( bool delayRedraw=true );
|
||||
inline void setStartLevel ( int level );
|
||||
inline void setStopLevel ( int level );
|
||||
inline void setQueryFilter ( int filter );
|
||||
// MapView* getMapView () { return _mapView; };
|
||||
void setCell ( Cell* cell );
|
||||
inline Cell* getCell () const;
|
||||
inline HPalette* getPalette ();
|
||||
void bindToPalette ( HPalette* palette );
|
||||
void detachFromPalette ();
|
||||
void bindCommand ( Command* command );
|
||||
void unbindCommand ( Command* command );
|
||||
inline bool showBoundaries () const;
|
||||
inline set<Selector*>& getSelectorSet ();
|
||||
inline bool showSelection () const;
|
||||
inline void setStartLevel ( int level );
|
||||
inline void setStopLevel ( int level );
|
||||
inline void setQueryFilter ( int filter );
|
||||
// Painter control & Hurricane objects drawing primitives.
|
||||
inline float getScale () const;
|
||||
bool isDrawable ( const Name& entryName );
|
||||
void drawBox ( const Box& );
|
||||
void drawLine ( const Point&, const Point& );
|
||||
void drawGrid ();
|
||||
void drawSpot ();
|
||||
void drawScreenRect ( const QPoint&, const QPoint& );
|
||||
void drawScreenPolyline ( const QPoint*, int, int );
|
||||
inline float getScale () const;
|
||||
bool isDrawable ( const Name& entryName );
|
||||
void drawBox ( const Box& );
|
||||
void drawLine ( const Point&, const Point& );
|
||||
void drawGrid ();
|
||||
void drawSpot ();
|
||||
void drawScreenRect ( const QPoint&, const QPoint& );
|
||||
void drawScreenPolyline ( const QPoint*, int, int );
|
||||
// Geometric conversions.
|
||||
QRect dbuToDisplayRect ( DbU::Unit x1, DbU::Unit y1, DbU::Unit x2, DbU::Unit y2 ) const;
|
||||
QRect dbuToDisplayRect ( const Box& box ) const;
|
||||
QPoint dbuToDisplayPoint ( DbU::Unit x, DbU::Unit y ) const;
|
||||
QPoint dbuToDisplayPoint ( const Point& point ) const;
|
||||
inline int dbuToDisplayX ( DbU::Unit x ) const;
|
||||
inline int dbuToDisplayY ( DbU::Unit y ) const;
|
||||
inline int dbuToDisplayLength ( DbU::Unit length ) const;
|
||||
inline int dbuToScreenX ( DbU::Unit x ) const;
|
||||
inline int dbuToScreenY ( DbU::Unit y ) const;
|
||||
QPoint dbuToScreenPoint ( DbU::Unit x, DbU::Unit y ) const;
|
||||
inline QPoint dbuToScreenPoint ( const Point& point ) const;
|
||||
inline DbU::Unit displayToDbuX ( int x ) const;
|
||||
inline DbU::Unit displayToDbuY ( int y ) const;
|
||||
inline DbU::Unit displayToDbuLength ( int length ) const;
|
||||
inline Box displayToDbuBox ( const QRect& rect ) const;
|
||||
inline DbU::Unit screenToDbuX ( int x ) const;
|
||||
inline DbU::Unit screenToDbuY ( int y ) const;
|
||||
inline Point screenToDbuPoint ( const QPoint& point ) const;
|
||||
inline Box screenToDbuBox ( const QRect& rect ) const;
|
||||
QRect dbuToDisplayRect ( DbU::Unit x1, DbU::Unit y1, DbU::Unit x2, DbU::Unit y2 ) const;
|
||||
QRect dbuToDisplayRect ( const Box& box ) const;
|
||||
QPoint dbuToDisplayPoint ( DbU::Unit x, DbU::Unit y ) const;
|
||||
QPoint dbuToDisplayPoint ( const Point& point ) const;
|
||||
inline int dbuToDisplayX ( DbU::Unit x ) const;
|
||||
inline int dbuToDisplayY ( DbU::Unit y ) const;
|
||||
inline int dbuToDisplayLength ( DbU::Unit length ) const;
|
||||
inline int dbuToScreenX ( DbU::Unit x ) const;
|
||||
inline int dbuToScreenY ( DbU::Unit y ) const;
|
||||
QPoint dbuToScreenPoint ( DbU::Unit x, DbU::Unit y ) const;
|
||||
inline QPoint dbuToScreenPoint ( const Point& point ) const;
|
||||
inline DbU::Unit displayToDbuX ( int x ) const;
|
||||
inline DbU::Unit displayToDbuY ( int y ) const;
|
||||
inline DbU::Unit displayToDbuLength ( int length ) const;
|
||||
inline Box displayToDbuBox ( const QRect& rect ) const;
|
||||
inline DbU::Unit screenToDbuX ( int x ) const;
|
||||
inline DbU::Unit screenToDbuY ( int y ) const;
|
||||
inline Point screenToDbuPoint ( const QPoint& point ) const;
|
||||
inline Box screenToDbuBox ( const QRect& rect ) const;
|
||||
// Qt QWidget Functions Overloads.
|
||||
void pushCursor ( Qt::CursorShape cursor );
|
||||
void popCursor ();
|
||||
QSize minimumSizeHint () const;
|
||||
void paintEvent ( QPaintEvent* );
|
||||
void resizeEvent ( QResizeEvent* );
|
||||
void keyPressEvent ( QKeyEvent* );
|
||||
void mouseMoveEvent ( QMouseEvent* );
|
||||
void mousePressEvent ( QMouseEvent* );
|
||||
void mouseReleaseEvent ( QMouseEvent* );
|
||||
void pushCursor ( Qt::CursorShape cursor );
|
||||
void popCursor ();
|
||||
QSize minimumSizeHint () const;
|
||||
void paintEvent ( QPaintEvent* );
|
||||
void resizeEvent ( QResizeEvent* );
|
||||
void keyPressEvent ( QKeyEvent* );
|
||||
void mouseMoveEvent ( QMouseEvent* );
|
||||
void mousePressEvent ( QMouseEvent* );
|
||||
void mouseReleaseEvent ( QMouseEvent* );
|
||||
signals:
|
||||
void mousePositionChanged ( const Point& position );
|
||||
void mousePositionChanged ( const Point& position );
|
||||
void selectionChanged ( const set<Selector*>&, Cell* );
|
||||
void occurrenceToggled ( Occurrence );
|
||||
public slots:
|
||||
// Qt QWidget Slots Overload & CellWidget Specifics.
|
||||
inline DrawingPlanes& getDrawingPlanes ();
|
||||
inline QPoint& getOffsetVA ();
|
||||
void setShowSelection ( bool state );
|
||||
inline void redraw ();
|
||||
void redraw ( QRect redrawArea );
|
||||
inline void redrawSelection ();
|
||||
void redrawSelection ( QRect redrawArea );
|
||||
void goLeft ( int dx = 0 );
|
||||
void goRight ( int dx = 0 );
|
||||
void goUp ( int dy = 0 );
|
||||
void goDown ( int dy = 0 );
|
||||
void fitToContents ();
|
||||
void setScale ( float scale );
|
||||
void setShowBoundaries ( bool state );
|
||||
void reframe ( const Box& box );
|
||||
void displayReframe ();
|
||||
void shiftLeft ( int dx );
|
||||
void shiftRight ( int dx );
|
||||
void shiftUp ( int dy );
|
||||
void shiftDown ( int dy );
|
||||
inline DrawingPlanes& getDrawingPlanes ();
|
||||
inline QPoint& getOffsetVA ();
|
||||
void select ( const Net* net, bool delayRedraw=false );
|
||||
void select ( Occurrence occurence );
|
||||
void selectOccurrencesUnder ( Box selectArea );
|
||||
void unselect ( Occurrence occurence );
|
||||
void unselectAll ( bool delayRedraw=false );
|
||||
void toggleSelect ( Occurrence occurence, bool fromPopup );
|
||||
void setShowSelection ( bool state );
|
||||
void setCumulativeSelection ( bool state );
|
||||
inline void redraw ();
|
||||
void redraw ( QRect redrawArea );
|
||||
inline void redrawSelection ();
|
||||
void redrawSelection ( QRect redrawArea );
|
||||
void goLeft ( int dx = 0 );
|
||||
void goRight ( int dx = 0 );
|
||||
void goUp ( int dy = 0 );
|
||||
void goDown ( int dy = 0 );
|
||||
void fitToContents ();
|
||||
void setScale ( float scale );
|
||||
void setShowBoundaries ( bool state );
|
||||
void reframe ( const Box& box );
|
||||
void displayReframe ();
|
||||
void shiftLeft ( int dx );
|
||||
void shiftRight ( int dx );
|
||||
void shiftUp ( int dy );
|
||||
void shiftDown ( int dy );
|
||||
|
||||
private:
|
||||
class Spot {
|
||||
|
@ -298,6 +303,7 @@ namespace Hurricane {
|
|||
Cell* _cell;
|
||||
bool _showBoundaries;
|
||||
bool _showSelection;
|
||||
bool _cumulativeSelection;
|
||||
bool _selectionHasChanged;
|
||||
set<Selector*> _selectors;
|
||||
vector<Command*> _commands;
|
||||
|
|
|
@ -108,6 +108,7 @@ namespace Hurricane {
|
|||
~HInspectorWidget ();
|
||||
void setRootRecord ( Record* record );
|
||||
private slots:
|
||||
void forceRowHeight ();
|
||||
void textFilterChanged ();
|
||||
void historyChanged ( int depth );
|
||||
void forkInspector ( const QModelIndex& index );
|
||||
|
@ -120,10 +121,10 @@ namespace Hurricane {
|
|||
bool setSlot ();
|
||||
|
||||
private:
|
||||
RecordModel* _recordModel;
|
||||
RecordModel* _baseModel;
|
||||
QSortFilterProxyModel* _sortModel;
|
||||
QComboBox* _historyComboBox;
|
||||
QTableView* _slotsView;
|
||||
QTableView* _view;
|
||||
QLineEdit* _filterPatternLineEdit;
|
||||
int _rowHeight;
|
||||
History _history;
|
||||
|
|
|
@ -88,6 +88,8 @@ namespace Hurricane {
|
|||
template<typename InformationType>
|
||||
void setCellWidget ( CellWidget* cw );
|
||||
void runInspector ( const QModelIndex& index );
|
||||
public slots:
|
||||
void forceRowHeight ();
|
||||
private slots:
|
||||
void textFilterChanged ();
|
||||
void selectNet ( const QModelIndex& index );
|
||||
|
@ -95,9 +97,9 @@ namespace Hurricane {
|
|||
void keyPressEvent ( QKeyEvent * event );
|
||||
|
||||
private:
|
||||
HNetlistModel* _netlistModel;
|
||||
HNetlistModel* _baseModel;
|
||||
QSortFilterProxyModel* _sortModel;
|
||||
QTableView* _netlistView;
|
||||
QTableView* _view;
|
||||
QLineEdit* _filterPatternLineEdit;
|
||||
int _rowHeight;
|
||||
CellWidget* _cellWidget;
|
||||
|
@ -107,23 +109,23 @@ namespace Hurricane {
|
|||
template<typename InformationType>
|
||||
void HNetlist::setCell ( Cell* cell )
|
||||
{
|
||||
_netlistModel->setCell<InformationType> ( cell );
|
||||
_baseModel->setCell<InformationType> ( cell );
|
||||
|
||||
string windowTitle = "Netlist" + getString(cell);
|
||||
setWindowTitle ( tr(windowTitle.c_str()) );
|
||||
|
||||
int rows = _sortModel->rowCount ();
|
||||
for ( rows-- ; rows >= 0 ; rows-- )
|
||||
_netlistView->setRowHeight ( rows, _rowHeight );
|
||||
_netlistView->selectRow ( 0 );
|
||||
_netlistView->resizeColumnToContents ( 0 );
|
||||
_view->setRowHeight ( rows, _rowHeight );
|
||||
_view->selectRow ( 0 );
|
||||
_view->resizeColumnToContents ( 0 );
|
||||
}
|
||||
|
||||
|
||||
template<typename InformationType>
|
||||
void HNetlist::setCellWidget ( CellWidget* cw )
|
||||
{
|
||||
if ( _netlistModel->getCell() != cw->getCell() )
|
||||
if ( _baseModel->getCell() != cw->getCell() )
|
||||
setCell<InformationType>( cw->getCell() );
|
||||
|
||||
_cellWidget = cw;
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
#include <QSortFilterProxyModel>
|
||||
|
||||
#include "hurricane/Commons.h"
|
||||
#include "hurricane/Occurrence.h"
|
||||
#include "hurricane/viewer/HSelectionModel.h"
|
||||
|
||||
|
||||
|
@ -68,12 +69,14 @@ class QTableView;
|
|||
class QLineEdit;
|
||||
class QComboBox;
|
||||
class QHeaderView;
|
||||
class QCheckBox;
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
|
||||
class Selector;
|
||||
class QCloseEvent;
|
||||
|
||||
|
||||
class HSelection : public QWidget {
|
||||
|
@ -82,19 +85,29 @@ namespace Hurricane {
|
|||
public:
|
||||
HSelection ( QWidget* parent=NULL );
|
||||
void runInspector ( const QModelIndex& index );
|
||||
bool isCumulative () const;
|
||||
signals:
|
||||
void showSelected ( bool );
|
||||
void occurrenceToggled ( Occurrence, bool );
|
||||
void cumulativeToggled ( bool );
|
||||
void selectionCleared ();
|
||||
public slots:
|
||||
void setSelection ( const set<Selector*>& selection, Cell* cell=NULL );
|
||||
void addToSelection ( Selector* selector );
|
||||
void toggleSelection ( Occurrence occurrence );
|
||||
void toggleSelection ( const QModelIndex& index );
|
||||
void forceRowHeight ();
|
||||
private slots:
|
||||
void textFilterChanged ();
|
||||
protected:
|
||||
void keyPressEvent ( QKeyEvent * event );
|
||||
virtual void keyPressEvent ( QKeyEvent * event );
|
||||
virtual void hideEvent ( QHideEvent* event );
|
||||
|
||||
private:
|
||||
HSelectionModel* _selectionModel;
|
||||
HSelectionModel* _baseModel;
|
||||
QSortFilterProxyModel* _sortModel;
|
||||
QTableView* _selectionView;
|
||||
QTableView* _view;
|
||||
QLineEdit* _filterPatternLineEdit;
|
||||
QCheckBox* _cumulative;
|
||||
int _rowHeight;
|
||||
};
|
||||
|
||||
|
|
|
@ -71,22 +71,58 @@ namespace Hurricane {
|
|||
class Selector;
|
||||
|
||||
|
||||
class OccurrenceItem {
|
||||
public:
|
||||
enum Flags { Selected=1 };
|
||||
public:
|
||||
inline OccurrenceItem ( Occurrence occurrence, unsigned int flags=Selected );
|
||||
inline void toggle ();
|
||||
inline bool operator== ( const OccurrenceItem& other ) const;
|
||||
public:
|
||||
unsigned int _flags;
|
||||
Occurrence _occurrence;
|
||||
};
|
||||
|
||||
|
||||
inline OccurrenceItem::OccurrenceItem ( Occurrence occurrence, unsigned int flags )
|
||||
: _flags(flags)
|
||||
, _occurrence(occurrence)
|
||||
{ }
|
||||
|
||||
|
||||
inline void OccurrenceItem::toggle ()
|
||||
{
|
||||
if ( _flags & Selected ) _flags &= ~Selected;
|
||||
else _flags |= Selected;
|
||||
}
|
||||
|
||||
|
||||
inline bool OccurrenceItem::operator== ( const OccurrenceItem& other ) const
|
||||
{
|
||||
return _occurrence == other._occurrence;
|
||||
}
|
||||
|
||||
|
||||
class HSelectionModel : public QAbstractTableModel {
|
||||
Q_OBJECT;
|
||||
|
||||
public:
|
||||
HSelectionModel ( QObject* parent=NULL );
|
||||
~HSelectionModel ();
|
||||
void setSelection ( const set<Selector*>& selection );
|
||||
void addToSelection ( Selector* selector );
|
||||
int rowCount ( const QModelIndex& parent=QModelIndex() ) const;
|
||||
int columnCount ( const QModelIndex& parent=QModelIndex() ) const;
|
||||
QVariant data ( const QModelIndex& index, int role=Qt::DisplayRole ) const;
|
||||
QVariant headerData ( int section, Qt::Orientation orientation, int role=Qt::DisplayRole ) const;
|
||||
const Occurrence getOccurrence ( int row );
|
||||
HSelectionModel ( QObject* parent=NULL );
|
||||
~HSelectionModel ();
|
||||
void setSelection ( const set<Selector*>& selection );
|
||||
void toggleSelection ( Occurrence occurrence );
|
||||
Occurrence toggleSelection ( const QModelIndex& index );
|
||||
int rowCount ( const QModelIndex& parent=QModelIndex() ) const;
|
||||
int columnCount ( const QModelIndex& parent=QModelIndex() ) const;
|
||||
QVariant data ( const QModelIndex& index, int role=Qt::DisplayRole ) const;
|
||||
QVariant headerData ( int section, Qt::Orientation orientation, int role=Qt::DisplayRole ) const;
|
||||
const Occurrence getOccurrence ( int row );
|
||||
bool isCumulative () const;
|
||||
public slots:
|
||||
void clear ();
|
||||
|
||||
private:
|
||||
vector<Occurrence> _selection;
|
||||
vector<OccurrenceItem> _selection;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,104 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Project.
|
||||
// Copyright (C) Laboratoire LIP6 - Departement ASIM
|
||||
// Universite Pierre et Marie Curie
|
||||
//
|
||||
// Main contributors :
|
||||
// Christophe Alexandre <Christophe.Alexandre@lip6.fr>
|
||||
// Sophie Belloeil <Sophie.Belloeil@lip6.fr>
|
||||
// Hugo Clément <Hugo.Clement@lip6.fr>
|
||||
// Jean-Paul Chaput <Jean-Paul.Chaput@lip6.fr>
|
||||
// Damien Dupuis <Damien.Dupuis@lip6.fr>
|
||||
// Christian Masson <Christian.Masson@lip6.fr>
|
||||
// Marek Sroka <Marek.Sroka@lip6.fr>
|
||||
//
|
||||
// The Coriolis Project is free software; you can redistribute it
|
||||
// and/or modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2 of
|
||||
// the License, or (at your option) any later version.
|
||||
//
|
||||
// The Coriolis Project is distributed in the hope that it will be
|
||||
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Coriolis Project; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
// USA
|
||||
//
|
||||
// License-Tag
|
||||
// Authors-Tag
|
||||
// ===================================================================
|
||||
//
|
||||
// $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 : "./HSelectionPopup.h" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
|
||||
|
||||
#ifndef __HURRICANE_SELECTION_POPUP_WIDGET_H__
|
||||
#define __HURRICANE_SELECTION_POPUP_WIDGET_H__
|
||||
|
||||
|
||||
#include <QWidget>
|
||||
#include <QTableView>
|
||||
|
||||
#include "hurricane/Commons.h"
|
||||
#include "hurricane/Occurrence.h"
|
||||
|
||||
|
||||
class QModelIndex;
|
||||
class QTableView;
|
||||
class QComboBox;
|
||||
class QHeaderView;
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
|
||||
class HSelectionPopupModel;
|
||||
|
||||
|
||||
class HSelectionPopup : public QWidget {
|
||||
Q_OBJECT;
|
||||
|
||||
public:
|
||||
HSelectionPopup ( QWidget* parent=NULL );
|
||||
void updateLayout ();
|
||||
void popup ();
|
||||
signals:
|
||||
void occurrenceSelected ( Occurrence occurrence, bool fromPopup );
|
||||
public slots:
|
||||
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 );
|
||||
|
||||
private:
|
||||
HSelectionPopupModel* _model;
|
||||
QTableView* _view;
|
||||
int _rowHeight;
|
||||
};
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
|
||||
|
||||
#endif // __HURRICANE_SELECTION_POPUP_WIDGET_H__
|
|
@ -0,0 +1,97 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Project.
|
||||
// Copyright (C) Laboratoire LIP6 - Departement ASIM
|
||||
// Universite Pierre et Marie Curie
|
||||
//
|
||||
// Main contributors :
|
||||
// Christophe Alexandre <Christophe.Alexandre@lip6.fr>
|
||||
// Sophie Belloeil <Sophie.Belloeil@lip6.fr>
|
||||
// Hugo Clément <Hugo.Clement@lip6.fr>
|
||||
// Jean-Paul Chaput <Jean-Paul.Chaput@lip6.fr>
|
||||
// Damien Dupuis <Damien.Dupuis@lip6.fr>
|
||||
// Christian Masson <Christian.Masson@lip6.fr>
|
||||
// Marek Sroka <Marek.Sroka@lip6.fr>
|
||||
//
|
||||
// The Coriolis Project is free software; you can redistribute it
|
||||
// and/or modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2 of
|
||||
// the License, or (at your option) any later version.
|
||||
//
|
||||
// The Coriolis Project is distributed in the hope that it will be
|
||||
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Coriolis Project; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
// USA
|
||||
//
|
||||
// License-Tag
|
||||
// Authors-Tag
|
||||
// ===================================================================
|
||||
//
|
||||
// $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 : "./HSelectionPopupModel.h" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
|
||||
|
||||
#ifndef __HURRICANE_SELECTION_POPUP_MODEL_H__
|
||||
#define __HURRICANE_SELECTION_POPUP_MODEL_H__
|
||||
|
||||
#include <vector>
|
||||
#include <set>
|
||||
|
||||
#include <QFont>
|
||||
#include <QApplication>
|
||||
#include <QAbstractTableModel>
|
||||
|
||||
#include "hurricane/Commons.h"
|
||||
#include "hurricane/Occurrence.h"
|
||||
#include "hurricane/viewer/Graphics.h"
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
|
||||
class Selector;
|
||||
|
||||
|
||||
class HSelectionPopupModel : public QAbstractTableModel {
|
||||
Q_OBJECT;
|
||||
|
||||
public:
|
||||
HSelectionPopupModel ( QObject* parent=NULL );
|
||||
~HSelectionPopupModel ();
|
||||
void add ( Occurrence occurrence, bool showChange=false );
|
||||
void clear ();
|
||||
void updateLayout ();
|
||||
int rowCount ( const QModelIndex& parent=QModelIndex() ) const;
|
||||
int columnCount ( const QModelIndex& parent=QModelIndex() ) const;
|
||||
QVariant data ( const QModelIndex& index, int role=Qt::DisplayRole ) const;
|
||||
QVariant headerData ( int section, Qt::Orientation orientation, int role=Qt::DisplayRole ) const;
|
||||
Occurrence getOccurrence ( int row );
|
||||
|
||||
private:
|
||||
vector<Occurrence>* _occurrences;
|
||||
};
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
|
||||
|
||||
#endif // __HURRICANE_SELECTION_POPUP_MODEL_H__
|
|
@ -60,6 +60,7 @@
|
|||
|
||||
class QAction;
|
||||
|
||||
#include "hurricane/Occurrence.h"
|
||||
#include "hurricane/viewer/AreaCommand.h"
|
||||
|
||||
|
||||
|
@ -71,6 +72,7 @@ namespace Hurricane {
|
|||
|
||||
class Cell;
|
||||
class Selector;
|
||||
class HSelectionPopup;
|
||||
|
||||
|
||||
class SelectCommand : public QObject, public AreaCommand {
|
||||
|
@ -83,16 +85,17 @@ namespace Hurricane {
|
|||
virtual bool mouseReleaseEvent ( CellWidget*, QMouseEvent* );
|
||||
void bindToAction ( QAction* action );
|
||||
signals:
|
||||
void selectionChanged ( const set<Selector*>&, Cell* );
|
||||
void selectionToggled ( Occurrence occurrence, bool fromPopup );
|
||||
private:
|
||||
QAction* _selectAction;
|
||||
HSelectionPopup* _selectionPopup;
|
||||
private:
|
||||
SelectCommand ( const SelectCommand& );
|
||||
SelectCommand& operator= ( const SelectCommand& );
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
} // End of Hurricane namespace.
|
||||
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue