* ./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.
This commit is contained in:
parent
865d1bde2a
commit
f6eee66fcb
|
@ -0,0 +1,119 @@
|
|||
|
||||
// -*- 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 : "./AreaCommand.cpp" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
|
||||
|
||||
# include <QMouseEvent>
|
||||
# include <QKeyEvent>
|
||||
|
||||
# include <hurricane/viewer/CellWidget.h>
|
||||
# include <hurricane/viewer/AreaCommand.h>
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "AreaCommand".
|
||||
|
||||
|
||||
AreaCommand::AreaCommand ()
|
||||
: Command()
|
||||
, _startPoint()
|
||||
, _stopPoint()
|
||||
{ }
|
||||
|
||||
|
||||
AreaCommand::~AreaCommand ()
|
||||
{ }
|
||||
|
||||
|
||||
|
||||
bool AreaCommand::mouseMoveEvent ( CellWidget* widget, QMouseEvent* event )
|
||||
{
|
||||
if ( !isActive() ) return false;
|
||||
|
||||
setStopPoint ( event->pos() );
|
||||
widget->update ();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void AreaCommand::draw ( CellWidget* widget )
|
||||
{
|
||||
if ( !_active ) return;
|
||||
|
||||
widget->drawScreenRect ( _startPoint, _stopPoint );
|
||||
drawCorner ( widget, true );
|
||||
drawCorner ( widget, false );
|
||||
}
|
||||
|
||||
|
||||
void AreaCommand::drawCorner ( CellWidget* widget, bool bottomLeft )
|
||||
{
|
||||
QRect zoomRect = QRect(_startPoint,_stopPoint).normalized();
|
||||
QPoint base = (bottomLeft) ? zoomRect.bottomLeft() : zoomRect.topRight();
|
||||
|
||||
if ( bottomLeft ) base.rx() += 2;
|
||||
else base.ry() += 2;
|
||||
|
||||
_cornerPoints[0] = base;
|
||||
_cornerPoints[1] = base;
|
||||
_cornerPoints[2] = base;
|
||||
|
||||
_cornerPoints[0].ry() += (bottomLeft) ? -10 : 10;
|
||||
_cornerPoints[2].rx() += (bottomLeft) ? 10 : -10;
|
||||
|
||||
widget->drawScreenPolyline ( _cornerPoints, 3, 4 );
|
||||
}
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
|
@ -13,11 +13,14 @@
|
|||
hurricane/viewer/DynamicLabel.h
|
||||
hurricane/viewer/HMousePosition.h
|
||||
hurricane/viewer/Selector.h
|
||||
hurricane/viewer/SelectCommand.h
|
||||
hurricane/viewer/CellWidget.h
|
||||
hurricane/viewer/CellWidgets.h
|
||||
hurricane/viewer/CellViewer.h
|
||||
hurricane/viewer/RecordModel.h
|
||||
hurricane/viewer/HInspectorWidget.h
|
||||
hurricane/viewer/HSelectionModel.h
|
||||
hurricane/viewer/HSelection.h
|
||||
hurricane/viewer/HNetlistModel.h
|
||||
hurricane/viewer/HNetlist.h
|
||||
hurricane/viewer/HDisplayFilter.h
|
||||
|
@ -29,10 +32,17 @@
|
|||
hurricane/viewer/Graphics.h
|
||||
hurricane/viewer/HGraphics.h
|
||||
hurricane/viewer/Selector.h
|
||||
hurricane/viewer/Command.h
|
||||
hurricane/viewer/AreaCommand.h
|
||||
hurricane/viewer/MoveCommand.h
|
||||
hurricane/viewer/ZoomCommand.h
|
||||
hurricane/viewer/SelectCommand.h
|
||||
hurricane/viewer/CellWidget.h
|
||||
hurricane/viewer/CellWidgets.h
|
||||
hurricane/viewer/CellViewer.h
|
||||
hurricane/viewer/HInspectorWidget.h
|
||||
hurricane/viewer/HSelectionModel.h
|
||||
hurricane/viewer/HSelection.h
|
||||
hurricane/viewer/NetInformations.h
|
||||
hurricane/viewer/HNetlist.h
|
||||
hurricane/viewer/HDisplayFilter.h
|
||||
|
@ -49,10 +59,17 @@
|
|||
DynamicLabel.cpp
|
||||
HMousePosition.cpp
|
||||
Selector.cpp
|
||||
Command.cpp
|
||||
AreaCommand.cpp
|
||||
MoveCommand.cpp
|
||||
ZoomCommand.cpp
|
||||
SelectCommand.cpp
|
||||
CellWidget.cpp
|
||||
CellViewer.cpp
|
||||
RecordModel.cpp
|
||||
HInspectorWidget.cpp
|
||||
HSelectionModel.cpp
|
||||
HSelection.cpp
|
||||
NetInformations.cpp
|
||||
HNetlistModel.cpp
|
||||
HNetlist.cpp
|
||||
|
|
|
@ -65,6 +65,7 @@
|
|||
#include "hurricane/viewer/CellWidget.h"
|
||||
#include "hurricane/viewer/CellViewer.h"
|
||||
#include "hurricane/viewer/HInspectorWidget.h"
|
||||
#include "hurricane/viewer/HSelection.h"
|
||||
#include "hurricane/viewer/HNetlist.h"
|
||||
#include "hurricane/viewer/HMousePosition.h"
|
||||
#include "hurricane/viewer/HGraphics.h"
|
||||
|
@ -89,6 +90,7 @@ namespace Hurricane {
|
|||
, _displayFilterAction(NULL)
|
||||
, _runInspectorOnDataBase(NULL)
|
||||
, _runInspectorOnCell(NULL)
|
||||
, _browseSelection(NULL)
|
||||
, _browseNetlist(NULL)
|
||||
, _fileMenu(NULL)
|
||||
, _viewMenu(NULL)
|
||||
|
@ -99,7 +101,12 @@ namespace Hurricane {
|
|||
, _graphicsSettings(NULL)
|
||||
, _displayFilter(NULL)
|
||||
, _cellWidget(NULL)
|
||||
, _moveCommand()
|
||||
, _zoomCommand()
|
||||
, _selectCommand()
|
||||
, _cellHistory()
|
||||
, _selectionBrowser(NULL)
|
||||
, _netlistBrowser(NULL)
|
||||
{
|
||||
setObjectName("viewer");
|
||||
|
||||
|
@ -189,13 +196,16 @@ namespace Hurricane {
|
|||
_runInspectorOnCell->setObjectName ( "viewer.tools.inspectCell" );
|
||||
_runInspectorOnCell->setStatusTip ( tr("Run Inspector on the current Cell") );
|
||||
|
||||
_browseSelection= new QAction ( tr("Browse &Selection"), this );
|
||||
_browseSelection->setObjectName ( "viewer.tools.browseSelection" );
|
||||
_browseSelection->setStatusTip ( tr("Browse objects currently selecteds") );
|
||||
|
||||
_browseNetlist= new QAction ( tr("Browse &Netlist"), this );
|
||||
_browseNetlist->setObjectName ( "viewer.tools.browseNetlist" );
|
||||
_browseNetlist->setStatusTip ( tr("Browse netlist from the current Cell") );
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CellViewer::createMenus ()
|
||||
{
|
||||
if ( _fileMenu ) return;
|
||||
|
@ -227,11 +237,11 @@ namespace Hurricane {
|
|||
_toolsMenu->setObjectName ( "viewer.tools" );
|
||||
_toolsMenu->addAction ( _runInspectorOnDataBase );
|
||||
_toolsMenu->addAction ( _runInspectorOnCell );
|
||||
_toolsMenu->addAction ( _browseSelection );
|
||||
_toolsMenu->addAction ( _browseNetlist );
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CellViewer::createLayout ()
|
||||
{
|
||||
if ( _cellWidget ) return;
|
||||
|
@ -243,8 +253,12 @@ namespace Hurricane {
|
|||
//_mapView = _cellWidget->getMapView ();
|
||||
|
||||
_cellWidget->bindToPalette ( _palette );
|
||||
_cellWidget->bindCommand ( &_moveCommand );
|
||||
_cellWidget->bindCommand ( &_zoomCommand );
|
||||
_cellWidget->bindCommand ( &_selectCommand );
|
||||
_displayFilter->setCellWidget ( _cellWidget );
|
||||
|
||||
|
||||
HMousePosition* _mousePosition = new HMousePosition ();
|
||||
statusBar()->addPermanentWidget ( _mousePosition );
|
||||
|
||||
|
@ -280,6 +294,7 @@ namespace Hurricane {
|
|||
connect ( _displayFilterAction , SIGNAL(triggered()) , this , SLOT(showDisplayFilter()) );
|
||||
connect ( _runInspectorOnDataBase, SIGNAL(triggered()) , this , SLOT(runInspectorOnDataBase()));
|
||||
connect ( _runInspectorOnCell , SIGNAL(triggered()) , this , SLOT(runInspectorOnCell()) );
|
||||
connect ( _browseSelection , SIGNAL(triggered()) , this , SLOT(browseSelection()) );
|
||||
connect ( _browseNetlist , SIGNAL(triggered()) , this , SLOT(browseNetlist()) );
|
||||
connect ( _cellWidget , SIGNAL(mousePositionChanged(const Point&))
|
||||
, _mousePosition , SLOT(setPosition(const Point&)) );
|
||||
|
@ -416,9 +431,25 @@ namespace Hurricane {
|
|||
|
||||
void CellViewer::browseNetlist ()
|
||||
{
|
||||
HNetlist* netlistBrowser = new HNetlist ();
|
||||
netlistBrowser->setCellWidget<SimpleNetInformations> ( _cellWidget );
|
||||
netlistBrowser->show ();
|
||||
if ( !_netlistBrowser ) {
|
||||
_netlistBrowser = new HNetlist ();
|
||||
_netlistBrowser->setCellWidget<SimpleNetInformations> ( _cellWidget );
|
||||
connect ( _netlistBrowser, SIGNAL(destroyed()), this, SLOT(netlistBrowserDestroyed()) );
|
||||
}
|
||||
_netlistBrowser->show ();
|
||||
}
|
||||
|
||||
|
||||
void CellViewer::browseSelection ()
|
||||
{
|
||||
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, SLOT (setSelection (const set<Selector*>&,Cell*)) );
|
||||
}
|
||||
_selectionBrowser->show ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -434,4 +465,22 @@ namespace Hurricane {
|
|||
{ if ( _cellWidget ) _cellWidget->unselectAll(); }
|
||||
|
||||
|
||||
void CellViewer::selectionBrowserDestroyed ()
|
||||
{
|
||||
if ( _selectionBrowser ) {
|
||||
_selectionBrowser = NULL;
|
||||
} else
|
||||
cerr << "[ERROR] Double-destruction of the Selection Browser." << endl;
|
||||
}
|
||||
|
||||
|
||||
void CellViewer::netlistBrowserDestroyed ()
|
||||
{
|
||||
if ( _netlistBrowser ) {
|
||||
_netlistBrowser = NULL;
|
||||
} else
|
||||
cerr << "[ERROR] Double-destruction of the Netlist Browser." << endl;
|
||||
}
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
|
|
|
@ -72,6 +72,7 @@
|
|||
# include "hurricane/viewer/HPaletteEntry.h"
|
||||
# include "hurricane/viewer/HPalette.h"
|
||||
// # include "MapView.h"
|
||||
# include "hurricane/viewer/Command.h"
|
||||
# include "hurricane/viewer/CellWidget.h"
|
||||
|
||||
|
||||
|
@ -88,6 +89,7 @@ namespace Hurricane {
|
|||
: _cellWidget(cw)
|
||||
, _spotPoint()
|
||||
, _restore(false)
|
||||
, _showSpot(true)
|
||||
{ }
|
||||
|
||||
|
||||
|
@ -101,13 +103,16 @@ namespace Hurricane {
|
|||
|
||||
|
||||
void CellWidget::Spot::setRestore ( bool state )
|
||||
{
|
||||
_restore = state;
|
||||
}
|
||||
{ _restore = state; }
|
||||
|
||||
|
||||
void CellWidget::Spot::moveTo ( const QPoint& screenPoint )
|
||||
{
|
||||
restore ();
|
||||
if ( !_showSpot ) return;
|
||||
|
||||
_restore = true;
|
||||
|
||||
QPainter& screenPainter = _cellWidget->getDrawingPlanes().painter(2);
|
||||
|
||||
Point mousePoint = _cellWidget->screenToDbuPoint ( screenPoint );
|
||||
|
@ -116,9 +121,6 @@ namespace Hurricane {
|
|||
);
|
||||
QPoint center = _cellWidget->dbuToScreenPoint(spotPoint);
|
||||
|
||||
restore ();
|
||||
_restore = true;
|
||||
|
||||
screenPainter.setPen ( Graphics::getPen("spot") );
|
||||
screenPainter.drawRect ( center.x()-3, center.y()-3, 6, 6 );
|
||||
}
|
||||
|
@ -343,13 +345,13 @@ namespace Hurricane {
|
|||
, _offsetVA(_stripWidth,_stripWidth)
|
||||
, _drawingPlanes(QSize(6*_stripWidth,6*_stripWidth),this)
|
||||
, _drawingQuery(this)
|
||||
, _lastMousePosition(0,0)
|
||||
, _mousePosition(0,0)
|
||||
, _spot(this)
|
||||
, _cell(NULL)
|
||||
, _mouseGo(false)
|
||||
, _showBoundaries(true)
|
||||
, _showSelection(false)
|
||||
, _selectionHasChanged(false)
|
||||
, _commands()
|
||||
, _redrawRectCount(0)
|
||||
{
|
||||
//setBackgroundRole ( QPalette::Dark );
|
||||
|
@ -374,6 +376,9 @@ namespace Hurricane {
|
|||
CellWidget::~CellWidget ()
|
||||
{
|
||||
cerr << "CellWidget::~CellWidget()" << endl;
|
||||
|
||||
for ( size_t i=0 ; i<_commands.size() ; i++ )
|
||||
unbindCommand ( _commands[i] );
|
||||
}
|
||||
|
||||
|
||||
|
@ -396,6 +401,28 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
void CellWidget::bindCommand ( Command* command )
|
||||
{
|
||||
for ( size_t i=0 ; i<_commands.size() ; i++ )
|
||||
if ( _commands[i] == command ) return;
|
||||
|
||||
_commands.push_back ( command );
|
||||
}
|
||||
|
||||
|
||||
void CellWidget::unbindCommand ( Command* command )
|
||||
{
|
||||
size_t i = 0;
|
||||
for ( ; i<_commands.size() ; i++ )
|
||||
if ( _commands[i] == command ) break;
|
||||
|
||||
for ( ; i+1<_commands.size() ; i++ )
|
||||
_commands[i] = _commands[i+1];
|
||||
|
||||
_commands.pop_back ();
|
||||
}
|
||||
|
||||
|
||||
void CellWidget::pushCursor ( Qt::CursorShape cursor )
|
||||
{
|
||||
setCursor ( cursor );
|
||||
|
@ -575,10 +602,31 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
void CellWidget::drawScreenPolyline ( const QPoint* points, int count, int width )
|
||||
{
|
||||
QPen pen = Graphics::getPen("grid");
|
||||
pen.setWidth ( width );
|
||||
|
||||
_drawingPlanes.painter(2).setPen ( pen );
|
||||
_drawingPlanes.painter(2).drawPolyline ( points, count );
|
||||
}
|
||||
|
||||
|
||||
void CellWidget::drawScreenRect ( const QPoint& p1, const QPoint& p2 )
|
||||
{
|
||||
_drawingPlanes.painter(2).setPen ( Graphics::getPen("grid") );
|
||||
_drawingPlanes.painter(2).drawRect ( QRect(p1,p2) );
|
||||
}
|
||||
|
||||
|
||||
void CellWidget::drawGrid ()
|
||||
{
|
||||
_drawingPlanes.painter(2).setPen ( Graphics::getPen("grid") );
|
||||
|
||||
bool lambdaGrid = false;
|
||||
if ( Graphics::getThreshold("grid")/DbU::lambda(1.0) < _scale/5 )
|
||||
lambdaGrid = true;
|
||||
|
||||
DbU::Unit gridStep = DbU::getSnapGridStep();
|
||||
DbU::Unit superGridStep = gridStep*5;
|
||||
DbU::Unit xGrid;
|
||||
|
@ -594,11 +642,16 @@ namespace Hurricane {
|
|||
; xGrid += gridStep
|
||||
) {
|
||||
center = dbuToScreenPoint(xGrid,yGrid);
|
||||
if ( (xGrid % superGridStep) || (yGrid % superGridStep) )
|
||||
_drawingPlanes.painter(2).drawPoint ( center );
|
||||
else {
|
||||
_drawingPlanes.painter(2).drawLine ( center.x()-3, center.y() , center.x()+3, center.y() );
|
||||
_drawingPlanes.painter(2).drawLine ( center.x() , center.y()-3, center.x() , center.y()+3 );
|
||||
if ( (xGrid % superGridStep) || (yGrid % superGridStep) ) {
|
||||
if ( lambdaGrid )
|
||||
_drawingPlanes.painter(2).drawPoint ( center );
|
||||
} else {
|
||||
if ( lambdaGrid ) {
|
||||
_drawingPlanes.painter(2).drawLine ( center.x()-3, center.y() , center.x()+3, center.y() );
|
||||
_drawingPlanes.painter(2).drawLine ( center.x() , center.y()-3, center.x() , center.y()+3 );
|
||||
} else {
|
||||
_drawingPlanes.painter(2).drawPoint ( center );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -831,8 +884,11 @@ namespace Hurricane {
|
|||
_drawingPlanes.painterBegin ( 2 );
|
||||
_drawingPlanes.copyToScreen ();
|
||||
|
||||
for ( size_t i=0 ; i<_commands.size() ; i++ )
|
||||
_commands[i]->draw ( this );
|
||||
|
||||
if ( isDrawable("grid") ) drawGrid ();
|
||||
if ( isDrawable("spot") ) _spot.moveTo ( _lastMousePosition );
|
||||
if ( isDrawable("spot") ) _spot.moveTo ( _mousePosition );
|
||||
|
||||
_drawingPlanes.painterEnd ( 2 );
|
||||
}
|
||||
|
@ -875,36 +931,22 @@ namespace Hurricane {
|
|||
|
||||
void CellWidget::keyPressEvent ( QKeyEvent* event )
|
||||
{
|
||||
switch ( event->key() ) {
|
||||
case Qt::Key_Up: goUp (); break;
|
||||
case Qt::Key_Down: goDown (); break;
|
||||
case Qt::Key_Left: goLeft (); break;
|
||||
case Qt::Key_Right: goRight (); break;
|
||||
case Qt::Key_Z: setScale ( _scale*2.0 ); break;
|
||||
case Qt::Key_M: setScale ( _scale/2.0 ); break;
|
||||
default: QWidget::keyPressEvent ( event );
|
||||
}
|
||||
bool commandActive = false;
|
||||
for ( size_t i=0 ; i<_commands.size() && !commandActive; i++ )
|
||||
commandActive = _commands[i]->keyPressEvent ( this, event );
|
||||
|
||||
if ( !commandActive ) QWidget::keyPressEvent ( event );
|
||||
}
|
||||
|
||||
|
||||
void CellWidget::mouseMoveEvent ( QMouseEvent* event )
|
||||
{
|
||||
if ( _mouseGo ) {
|
||||
int dx = event->x() - _lastMousePosition.x();
|
||||
dx <<= 1;
|
||||
//cerr << "dX (px): " << dx << " _offsetVA.rx() " << _offsetVA.rx() << endl;
|
||||
if ( dx > 0 ) goLeft ( dx );
|
||||
if ( dx < 0 ) goRight ( -dx );
|
||||
bool commandActive = false;
|
||||
for ( size_t i=0 ; i<_commands.size() && !commandActive; i++ )
|
||||
commandActive = _commands[i]->mouseMoveEvent ( this, event );
|
||||
|
||||
int dy = event->y() - _lastMousePosition.y();
|
||||
dy <<= 1;
|
||||
//cerr << "dY (px): " << dy << " _offsetVA.ry() " << _offsetVA.ry() << endl;
|
||||
if ( dy > 0 ) goUp ( dy );
|
||||
if ( dy < 0 ) goDown ( -dy );
|
||||
|
||||
_lastMousePosition = event->pos();
|
||||
} else {
|
||||
_lastMousePosition = event->pos();
|
||||
if ( !commandActive ) {
|
||||
_mousePosition = event->pos();
|
||||
emit mousePositionChanged ( screenToDbuPoint(event->pos()) );
|
||||
|
||||
update ();
|
||||
|
@ -914,20 +956,21 @@ namespace Hurricane {
|
|||
|
||||
void CellWidget::mousePressEvent ( QMouseEvent* event )
|
||||
{
|
||||
if ( ( event->button() == Qt::LeftButton ) && !_mouseGo ) {
|
||||
_mouseGo = true;
|
||||
_lastMousePosition = event->pos();
|
||||
pushCursor ( Qt::ClosedHandCursor );
|
||||
}
|
||||
bool commandActive = false;
|
||||
for ( size_t i=0 ; i<_commands.size() && !commandActive; i++ )
|
||||
commandActive = _commands[i]->mousePressEvent ( this, event );
|
||||
|
||||
_spot.setShowSpot ( !commandActive );
|
||||
}
|
||||
|
||||
|
||||
void CellWidget::mouseReleaseEvent ( QMouseEvent* event )
|
||||
{
|
||||
if ( ( event->button() == Qt::LeftButton ) && _mouseGo ) {
|
||||
_mouseGo = false;
|
||||
popCursor ();
|
||||
}
|
||||
bool commandActive = false;
|
||||
for ( size_t i=0 ; i<_commands.size() && !commandActive; i++ )
|
||||
commandActive = _commands[i]->mouseReleaseEvent ( this, event );
|
||||
|
||||
_spot.setShowSpot ( true );
|
||||
}
|
||||
|
||||
|
||||
|
@ -998,7 +1041,7 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
void CellWidget::select ( Occurrence& occurrence )
|
||||
void CellWidget::select ( Occurrence occurrence )
|
||||
{
|
||||
if ( !occurrence.isValid() )
|
||||
throw Error ( "Can't select occurrence : invalid occurrence" );
|
||||
|
@ -1022,7 +1065,7 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
void CellWidget::unselect ( Occurrence& occurrence )
|
||||
void CellWidget::unselect ( Occurrence occurrence )
|
||||
{
|
||||
if ( !occurrence.isValid() )
|
||||
throw Error ( "Can't unselect occurrence : invalid occurrence" );
|
||||
|
|
|
@ -0,0 +1,101 @@
|
|||
|
||||
// -*- 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 : "./Command.cpp" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
|
||||
|
||||
# include <QMouseEvent>
|
||||
# include <QKeyEvent>
|
||||
|
||||
# include <hurricane/viewer/CellWidget.h>
|
||||
# include <hurricane/viewer/Command.h>
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "Command".
|
||||
|
||||
|
||||
Command::Command ()
|
||||
: _cellWidgets()
|
||||
, _active(false)
|
||||
{ }
|
||||
|
||||
|
||||
Command::~Command ()
|
||||
{
|
||||
set<CellWidget*>::iterator iwidget = _cellWidgets.begin();
|
||||
for ( ; iwidget != _cellWidgets.end() ; iwidget++ )
|
||||
(*iwidget)->unbindCommand ( this );
|
||||
}
|
||||
|
||||
|
||||
bool Command::keyPressEvent ( CellWidget*, QKeyEvent* )
|
||||
{ return false; }
|
||||
|
||||
|
||||
bool Command::mouseMoveEvent ( CellWidget*, QMouseEvent* )
|
||||
{ return false; }
|
||||
|
||||
|
||||
bool Command::mousePressEvent ( CellWidget*, QMouseEvent* )
|
||||
{ return false; }
|
||||
|
||||
|
||||
bool Command::mouseReleaseEvent ( CellWidget*, QMouseEvent* )
|
||||
{ return false; }
|
||||
|
||||
|
||||
void Command::draw ( CellWidget* )
|
||||
{ }
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
|
@ -97,7 +97,6 @@ namespace Hurricane {
|
|||
_netlistView->setSortingEnabled(true);
|
||||
_netlistView->setModel ( _sortModel );
|
||||
_netlistView->horizontalHeader()->setStretchLastSection ( true );
|
||||
_netlistView->resizeColumnToContents ( 0 );
|
||||
|
||||
QHeaderView* horizontalHeader = _netlistView->horizontalHeader ();
|
||||
horizontalHeader->setStretchLastSection ( true );
|
||||
|
|
|
@ -0,0 +1,178 @@
|
|||
|
||||
// -*- 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 : "./HSelection.cpp" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
|
||||
|
||||
#include <QFontMetrics>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QHeaderView>
|
||||
#include <QKeyEvent>
|
||||
#include <QGroupBox>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "hurricane/Commons.h"
|
||||
#include "hurricane/Cell.h"
|
||||
|
||||
#include "hurricane/viewer/Graphics.h"
|
||||
#include "hurricane/viewer/HSelectionModel.h"
|
||||
#include "hurricane/viewer/HSelection.h"
|
||||
#include "hurricane/viewer/HInspectorWidget.h"
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
|
||||
|
||||
HSelection::HSelection ( QWidget* parent )
|
||||
: QWidget(parent)
|
||||
, _selectionModel(NULL)
|
||||
, _sortModel(NULL)
|
||||
, _selectionView(NULL)
|
||||
, _rowHeight(20)
|
||||
{
|
||||
setAttribute ( Qt::WA_DeleteOnClose );
|
||||
setAttribute ( Qt::WA_QuitOnClose, false );
|
||||
|
||||
_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);
|
||||
|
||||
setLayout ( inspectorLayout );
|
||||
|
||||
connect ( _filterPatternLineEdit, SIGNAL(textChanged(const QString &))
|
||||
, this , SLOT(textFilterChanged())
|
||||
);
|
||||
|
||||
setWindowTitle(tr("Selection<None>"));
|
||||
resize(500, 300);
|
||||
}
|
||||
|
||||
|
||||
void HSelection::keyPressEvent ( QKeyEvent* event )
|
||||
{
|
||||
if ( event->key() == Qt::Key_I ) { runInspector(_selectionView->currentIndex()); }
|
||||
else event->ignore();
|
||||
}
|
||||
|
||||
|
||||
void HSelection::textFilterChanged ()
|
||||
{
|
||||
_sortModel->setFilterRegExp ( _filterPatternLineEdit->text() );
|
||||
}
|
||||
|
||||
|
||||
void HSelection::addToSelection ( Selector* selector )
|
||||
{
|
||||
_selectionModel->addToSelection ( selector );
|
||||
int rows = _sortModel->rowCount () - 1;
|
||||
_selectionView->setRowHeight ( rows, _rowHeight );
|
||||
}
|
||||
|
||||
|
||||
void HSelection::setSelection ( const set<Selector*>& selection, Cell* cell )
|
||||
{
|
||||
_selectionModel->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 );
|
||||
}
|
||||
|
||||
|
||||
void HSelection::runInspector ( const QModelIndex& index )
|
||||
{
|
||||
if ( index.isValid() ) {
|
||||
Occurrence occurrence = _selectionModel->getOccurrence ( _sortModel->mapToSource(index).row() );
|
||||
|
||||
HInspectorWidget* inspector = new HInspectorWidget ();
|
||||
|
||||
inspector->setRootRecord ( getRecord(occurrence) );
|
||||
inspector->show ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
|
@ -0,0 +1,166 @@
|
|||
|
||||
// -*- 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 : "./HSelectionModel.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/HSelectionModel.h"
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
|
||||
HSelectionModel::HSelectionModel ( QObject* parent )
|
||||
: QAbstractTableModel(parent)
|
||||
, _selection()
|
||||
{ }
|
||||
|
||||
|
||||
HSelectionModel::~HSelectionModel ()
|
||||
{ }
|
||||
|
||||
|
||||
void HSelectionModel::setSelection ( const set<Selector*>& selection )
|
||||
{
|
||||
_selection.clear ();
|
||||
|
||||
set<Selector*>::const_iterator iselector = selection.begin();
|
||||
for ( ; iselector != selection.end() ; iselector++ )
|
||||
_selection.push_back ( (*iselector)->getOccurrence() );
|
||||
|
||||
emit layoutChanged ();
|
||||
}
|
||||
|
||||
|
||||
void HSelectionModel::addToSelection ( Selector* selector )
|
||||
{
|
||||
_selection.push_back ( selector->getOccurrence() );
|
||||
|
||||
emit layoutChanged ();
|
||||
}
|
||||
|
||||
|
||||
QVariant HSelectionModel::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()) {
|
||||
case 0: return 200;
|
||||
default: return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if ( role == Qt::FontRole ) {
|
||||
switch (index.column()) {
|
||||
case 0: return occurrenceFont;
|
||||
default: return entityFont;
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
|
||||
QVariant HSelectionModel::headerData ( int section
|
||||
, Qt::Orientation orientation
|
||||
, int role ) const
|
||||
{
|
||||
if ( ( orientation == Qt::Vertical ) || (role != Qt::DisplayRole) )
|
||||
return QVariant();
|
||||
|
||||
switch ( section ) {
|
||||
case 0: return "Path";
|
||||
case 1: return "Entity";
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
|
||||
int HSelectionModel::rowCount ( const QModelIndex& parent ) const
|
||||
{
|
||||
return _selection.size();
|
||||
}
|
||||
|
||||
|
||||
int HSelectionModel::columnCount ( const QModelIndex& parent ) const
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
||||
const Occurrence HSelectionModel::getOccurrence ( int row )
|
||||
{
|
||||
if ( row >= (int)_selection.size() ) return Occurrence();
|
||||
|
||||
return _selection[row];
|
||||
}
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
|
@ -0,0 +1,135 @@
|
|||
|
||||
// -*- 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 : "./MoveCommand.cpp" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
|
||||
|
||||
# include <QMouseEvent>
|
||||
# include <QKeyEvent>
|
||||
|
||||
# include <hurricane/viewer/CellWidget.h>
|
||||
# include <hurricane/viewer/MoveCommand.h>
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "MoveCommand".
|
||||
|
||||
|
||||
MoveCommand::MoveCommand ()
|
||||
: Command()
|
||||
, _active(false)
|
||||
, _lastPosition()
|
||||
{ }
|
||||
|
||||
|
||||
MoveCommand::~MoveCommand ()
|
||||
{ }
|
||||
|
||||
|
||||
bool MoveCommand::keyPressEvent ( CellWidget* widget, QKeyEvent* event )
|
||||
{
|
||||
switch ( event->key() ) {
|
||||
case Qt::Key_Up: widget->goUp (); return true;
|
||||
case Qt::Key_Down: widget->goDown (); return true;
|
||||
case Qt::Key_Left: widget->goLeft (); return true;
|
||||
case Qt::Key_Right: widget->goRight (); return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool MoveCommand::mouseMoveEvent ( CellWidget* widget, QMouseEvent* event )
|
||||
{
|
||||
if ( !_active ) return false;
|
||||
|
||||
int dx = event->x() - _lastPosition.x();
|
||||
dx <<= 1;
|
||||
if ( dx > 0 ) widget->goLeft ( dx );
|
||||
if ( dx < 0 ) widget->goRight ( -dx );
|
||||
|
||||
int dy = event->y() - _lastPosition.y();
|
||||
dy <<= 1;
|
||||
if ( dy > 0 ) widget->goUp ( dy );
|
||||
if ( dy < 0 ) widget->goDown ( -dy );
|
||||
|
||||
_lastPosition = event->pos();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool MoveCommand::mousePressEvent ( CellWidget* widget, QMouseEvent* event )
|
||||
{
|
||||
if ( _active ) return true;
|
||||
|
||||
if ( ( event->button() == Qt::LeftButton ) && !event->modifiers() ) {
|
||||
_active = true;
|
||||
_lastPosition = event->pos();
|
||||
widget->pushCursor ( Qt::ClosedHandCursor );
|
||||
}
|
||||
|
||||
return _active;
|
||||
}
|
||||
|
||||
|
||||
bool MoveCommand::mouseReleaseEvent ( CellWidget* widget, QMouseEvent* event )
|
||||
{
|
||||
if ( !_active ) return false;
|
||||
|
||||
_active = false;
|
||||
widget->popCursor ();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
|
@ -0,0 +1,117 @@
|
|||
|
||||
// -*- 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 : "./SelectCommand.cpp" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
|
||||
|
||||
# include <QMouseEvent>
|
||||
# include <QKeyEvent>
|
||||
|
||||
# include "hurricane/Cell.h"
|
||||
|
||||
# include "hurricane/viewer/CellWidget.h"
|
||||
# include "hurricane/viewer/SelectCommand.h"
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "SelectCommand".
|
||||
|
||||
|
||||
SelectCommand::SelectCommand ()
|
||||
: AreaCommand()
|
||||
{ }
|
||||
|
||||
|
||||
SelectCommand::~SelectCommand ()
|
||||
{ }
|
||||
|
||||
|
||||
bool SelectCommand::mousePressEvent ( CellWidget* widget, QMouseEvent* event )
|
||||
{
|
||||
if ( isActive() ) return true;
|
||||
|
||||
if ( (event->button() == Qt::RightButton) && !event->modifiers() ) {
|
||||
setActive ( true );
|
||||
setStartPoint ( event->pos() );
|
||||
}
|
||||
|
||||
return isActive();
|
||||
}
|
||||
|
||||
|
||||
bool SelectCommand::mouseReleaseEvent ( CellWidget* widget, QMouseEvent* event )
|
||||
{
|
||||
if ( !isActive() ) return false;
|
||||
|
||||
setActive ( false );
|
||||
|
||||
QRect selectArea;
|
||||
if ( _startPoint == _stopPoint )
|
||||
selectArea = QRect ( _startPoint - QPoint(2,2), QSize(4,4) );
|
||||
else
|
||||
selectArea = QRect ( _startPoint, _stopPoint );
|
||||
|
||||
widget->unselectAll ();
|
||||
forEach ( Occurrence, ioccurrence
|
||||
, widget->getCell()->getOccurrencesUnder(widget->screenToDbuBox(selectArea)) ) {
|
||||
widget->select ( *ioccurrence );
|
||||
}
|
||||
widget->setShowSelection ( true );
|
||||
widget->redraw ();
|
||||
|
||||
emit selectionChanged(widget->getSelectorSet(),widget->getCell());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
|
@ -0,0 +1,111 @@
|
|||
|
||||
// -*- 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 : "./ZoomCommand.cpp" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
|
||||
|
||||
# include <QMouseEvent>
|
||||
# include <QKeyEvent>
|
||||
|
||||
# include <hurricane/viewer/CellWidget.h>
|
||||
# include <hurricane/viewer/ZoomCommand.h>
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "ZoomCommand".
|
||||
|
||||
|
||||
ZoomCommand::ZoomCommand ()
|
||||
: AreaCommand()
|
||||
{ }
|
||||
|
||||
|
||||
ZoomCommand::~ZoomCommand ()
|
||||
{ }
|
||||
|
||||
|
||||
bool ZoomCommand::keyPressEvent ( CellWidget* widget, QKeyEvent* event )
|
||||
{
|
||||
switch ( event->key() ) {
|
||||
case Qt::Key_Z: widget->setScale ( widget->getScale()*2.0 ); return true;
|
||||
case Qt::Key_M: widget->setScale ( widget->getScale()/2.0 ); return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool ZoomCommand::mousePressEvent ( CellWidget* widget, QMouseEvent* event )
|
||||
{
|
||||
if ( isActive() ) return true;
|
||||
|
||||
if ( (event->button() == Qt::LeftButton) && (event->modifiers() & Qt::ControlModifier) ) {
|
||||
setActive ( true );
|
||||
setStartPoint ( event->pos() );
|
||||
}
|
||||
|
||||
return isActive();
|
||||
}
|
||||
|
||||
|
||||
bool ZoomCommand::mouseReleaseEvent ( CellWidget* widget, QMouseEvent* event )
|
||||
{
|
||||
if ( !isActive() ) return false;
|
||||
|
||||
setActive ( false );
|
||||
|
||||
widget->reframe ( widget->screenToDbuBox(QRect(_startPoint,_stopPoint)) );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
|
@ -0,0 +1,94 @@
|
|||
|
||||
// -*- 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 : "./AreaCommand.h" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
|
||||
|
||||
#ifndef __HURRICANE_AREA_COMMAND_H__
|
||||
#define __HURRICANE_AREA_COMMAND_H__
|
||||
|
||||
#include <QPoint>
|
||||
|
||||
#include "hurricane/viewer/Command.h"
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
|
||||
class AreaCommand : public Command {
|
||||
public:
|
||||
AreaCommand ();
|
||||
virtual ~AreaCommand ();
|
||||
inline void setStartPoint ( const QPoint& start );
|
||||
inline void setStopPoint ( const QPoint& stop );
|
||||
virtual void draw ( CellWidget* widget );
|
||||
virtual void drawCorner ( CellWidget* widget, bool bottomLeft );
|
||||
virtual bool mouseMoveEvent ( CellWidget* widget, QMouseEvent* event );
|
||||
protected:
|
||||
QPoint _startPoint;
|
||||
QPoint _stopPoint;
|
||||
QPoint _cornerPoints[3];
|
||||
private:
|
||||
AreaCommand ( const AreaCommand& );
|
||||
AreaCommand& operator= ( const AreaCommand& );
|
||||
};
|
||||
|
||||
|
||||
inline void AreaCommand::setStartPoint ( const QPoint& start )
|
||||
{ _startPoint = start; _stopPoint = start; }
|
||||
|
||||
|
||||
inline void AreaCommand::setStopPoint ( const QPoint& stop )
|
||||
{ _stopPoint = stop; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
|
@ -69,6 +69,10 @@ class QMenu;
|
|||
#include "hurricane/Name.h"
|
||||
#include "hurricane/Occurrence.h"
|
||||
|
||||
#include "hurricane/viewer/MoveCommand.h"
|
||||
#include "hurricane/viewer/ZoomCommand.h"
|
||||
#include "hurricane/viewer/SelectCommand.h"
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
|
@ -80,29 +84,34 @@ namespace Hurricane {
|
|||
//class MapView;
|
||||
class CellWidget;
|
||||
class HMousePosition;
|
||||
class HNetlist;
|
||||
class HSelection;
|
||||
|
||||
|
||||
class CellViewer : public QMainWindow {
|
||||
Q_OBJECT;
|
||||
|
||||
public:
|
||||
CellViewer ( QWidget* parent=NULL );
|
||||
inline void setApplicationName ( const QString& name );
|
||||
void setCell ( Cell* cell );
|
||||
Cell* getCell ();
|
||||
virtual Cell* getCellFromDb ( const char* name );
|
||||
inline CellWidget* getCellWidget ();
|
||||
void select ( Occurrence& occurence );
|
||||
void unselect ( Occurrence& occurence );
|
||||
void unselectAll ();
|
||||
CellViewer ( QWidget* parent=NULL );
|
||||
inline void setApplicationName ( const QString& name );
|
||||
void setCell ( Cell* cell );
|
||||
Cell* getCell ();
|
||||
virtual Cell* getCellFromDb ( const char* name );
|
||||
inline CellWidget* getCellWidget ();
|
||||
void select ( Occurrence& occurence );
|
||||
void unselect ( Occurrence& occurence );
|
||||
void unselectAll ();
|
||||
public slots:
|
||||
void setShowPalette ( bool show );
|
||||
void showGraphicsSettings ();
|
||||
void showDisplayFilter ();
|
||||
void openHistoryCell ();
|
||||
void runInspectorOnDataBase ();
|
||||
void runInspectorOnCell ();
|
||||
void browseNetlist ();
|
||||
void setShowPalette ( bool show );
|
||||
void showGraphicsSettings ();
|
||||
void showDisplayFilter ();
|
||||
void openHistoryCell ();
|
||||
void runInspectorOnDataBase ();
|
||||
void runInspectorOnCell ();
|
||||
void browseSelection ();
|
||||
void browseNetlist ();
|
||||
void selectionBrowserDestroyed ();
|
||||
void netlistBrowserDestroyed ();
|
||||
|
||||
public:
|
||||
enum { CellHistorySize = 10 };
|
||||
|
@ -122,6 +131,7 @@ namespace Hurricane {
|
|||
QAction* _displayFilterAction;
|
||||
QAction* _runInspectorOnDataBase;
|
||||
QAction* _runInspectorOnCell;
|
||||
QAction* _browseSelection;
|
||||
QAction* _browseNetlist;
|
||||
QMenu* _fileMenu;
|
||||
QMenu* _viewMenu;
|
||||
|
@ -132,14 +142,19 @@ namespace Hurricane {
|
|||
HGraphics* _graphicsSettings;
|
||||
HDisplayFilter* _displayFilter;
|
||||
CellWidget* _cellWidget;
|
||||
MoveCommand _moveCommand;
|
||||
ZoomCommand _zoomCommand;
|
||||
SelectCommand _selectCommand;
|
||||
list<Cell*> _cellHistory;
|
||||
HSelection* _selectionBrowser;
|
||||
HNetlist* _netlistBrowser;
|
||||
|
||||
protected:
|
||||
void createActions ();
|
||||
void createMenus ();
|
||||
void createLayout ();
|
||||
void refreshHistory ();
|
||||
void runInspector ( Record* record );
|
||||
void createActions ();
|
||||
void createMenus ();
|
||||
void createLayout ();
|
||||
void refreshHistory ();
|
||||
void runInspector ( Record* record );
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -99,6 +99,7 @@ namespace Hurricane {
|
|||
class Selector;
|
||||
class HPaletteEntry;
|
||||
class HPalette;
|
||||
class Command;
|
||||
//class MapView;
|
||||
|
||||
|
||||
|
@ -119,21 +120,26 @@ namespace Hurricane {
|
|||
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 select ( Occurrence occurence );
|
||||
void unselect ( Occurrence occurence );
|
||||
void unselectAll ( bool delayRedraw=true );
|
||||
inline void setStartLevel ( int level );
|
||||
inline void setStopLevel ( int level );
|
||||
// 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 );
|
||||
// Geometric conversions.
|
||||
QRect dbuToDisplayRect ( DbU::Unit x1, DbU::Unit y1, DbU::Unit x2, DbU::Unit y2 ) const;
|
||||
QRect dbuToDisplayRect ( const Box& box ) const;
|
||||
|
@ -153,6 +159,7 @@ namespace Hurricane {
|
|||
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 ();
|
||||
|
@ -191,14 +198,16 @@ namespace Hurricane {
|
|||
private:
|
||||
class Spot {
|
||||
public:
|
||||
Spot ( CellWidget* cw );
|
||||
void setRestore ( bool restore );
|
||||
void restore ();
|
||||
void moveTo ( const QPoint& point );
|
||||
Spot ( CellWidget* cw );
|
||||
void setRestore ( bool restore );
|
||||
inline void setShowSpot ( bool show );
|
||||
void restore ();
|
||||
void moveTo ( const QPoint& point );
|
||||
private:
|
||||
CellWidget* _cellWidget;
|
||||
QPoint _spotPoint;
|
||||
bool _restore;
|
||||
CellWidget* _cellWidget;
|
||||
QPoint _spotPoint;
|
||||
bool _restore;
|
||||
bool _showSpot;
|
||||
};
|
||||
|
||||
private:
|
||||
|
@ -282,18 +291,20 @@ namespace Hurricane {
|
|||
QPoint _offsetVA;
|
||||
DrawingPlanes _drawingPlanes;
|
||||
DrawingQuery _drawingQuery;
|
||||
QPoint _lastMousePosition;
|
||||
QPoint _mousePosition;
|
||||
Spot _spot;
|
||||
Cell* _cell;
|
||||
bool _mouseGo;
|
||||
bool _showBoundaries;
|
||||
bool _showSelection;
|
||||
bool _selectionHasChanged;
|
||||
set<Selector*> _selectors;
|
||||
vector<Command*> _commands;
|
||||
size_t _redrawRectCount;
|
||||
};
|
||||
|
||||
|
||||
inline void CellWidget::Spot::setShowSpot ( bool show )
|
||||
{ _showSpot = show; }
|
||||
|
||||
|
||||
inline void CellWidget::DrawingQuery::setQuery ( const Box& area
|
||||
|
@ -467,6 +478,16 @@ namespace Hurricane {
|
|||
{ return Point ( screenToDbuX(point.x()), screenToDbuY(point.y()) ); }
|
||||
|
||||
|
||||
inline Box CellWidget::screenToDbuBox ( const QRect& rect ) const
|
||||
{
|
||||
return Box ( screenToDbuX(rect.x())
|
||||
, screenToDbuY(rect.y())
|
||||
, screenToDbuX(rect.x()+rect.width ())
|
||||
, screenToDbuY(rect.y()+rect.height())
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
inline Cell* CellWidget::getCell () const
|
||||
{ return _cell; }
|
||||
|
||||
|
@ -483,6 +504,10 @@ namespace Hurricane {
|
|||
{ return _showSelection; }
|
||||
|
||||
|
||||
inline float CellWidget::getScale () const
|
||||
{ return _scale; }
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
|
||||
|
||||
|
|
|
@ -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 : "./Command.h" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
|
||||
|
||||
#ifndef __HURRICANE_COMMAND_H__
|
||||
#define __HURRICANE_COMMAND_H__
|
||||
|
||||
|
||||
#include <set>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
class QKeyEvent;
|
||||
class QMouseEvent;
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
|
||||
class CellWidget;
|
||||
|
||||
|
||||
class Command {
|
||||
public:
|
||||
Command ();
|
||||
virtual ~Command ();
|
||||
inline bool isActive ();
|
||||
inline void setActive ( bool state );
|
||||
virtual bool keyPressEvent ( CellWidget*, QKeyEvent* );
|
||||
virtual bool mouseMoveEvent ( CellWidget*, QMouseEvent* );
|
||||
virtual bool mousePressEvent ( CellWidget*, QMouseEvent* );
|
||||
virtual bool mouseReleaseEvent ( CellWidget*, QMouseEvent* );
|
||||
virtual void draw ( CellWidget* );
|
||||
inline set<CellWidget*>& getCellWidgets ();
|
||||
protected:
|
||||
set<CellWidget*> _cellWidgets;
|
||||
bool _active;
|
||||
private:
|
||||
Command ( const Command& );
|
||||
Command& operator= ( const Command& );
|
||||
};
|
||||
|
||||
|
||||
// Inline Functions.
|
||||
inline set<CellWidget*>& Command::getCellWidgets () { return _cellWidgets; }
|
||||
inline bool Command::isActive () { return _active; }
|
||||
inline void Command::setActive ( bool state ) { _active = state; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -116,6 +116,7 @@ namespace Hurricane {
|
|||
for ( rows-- ; rows >= 0 ; rows-- )
|
||||
_netlistView->setRowHeight ( rows, _rowHeight );
|
||||
_netlistView->selectRow ( 0 );
|
||||
_netlistView->resizeColumnToContents ( 0 );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,105 @@
|
|||
|
||||
// -*- 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 : "./HSelection.h" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
|
||||
|
||||
#ifndef __HURRICANE_SELECTION_WIDGET_H__
|
||||
#define __HURRICANE_SELECTION_WIDGET_H__
|
||||
|
||||
|
||||
#include <QWidget>
|
||||
#include <QTableView>
|
||||
#include <QSortFilterProxyModel>
|
||||
|
||||
#include "hurricane/Commons.h"
|
||||
#include "hurricane/viewer/HSelectionModel.h"
|
||||
|
||||
|
||||
class QSortFilterProxyModel;
|
||||
class QModelIndex;
|
||||
class QTableView;
|
||||
class QLineEdit;
|
||||
class QComboBox;
|
||||
class QHeaderView;
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
|
||||
class Selector;
|
||||
|
||||
|
||||
class HSelection : public QWidget {
|
||||
Q_OBJECT;
|
||||
|
||||
public:
|
||||
HSelection ( QWidget* parent=NULL );
|
||||
void runInspector ( const QModelIndex& index );
|
||||
public slots:
|
||||
void setSelection ( const set<Selector*>& selection, Cell* cell=NULL );
|
||||
void addToSelection ( Selector* selector );
|
||||
private slots:
|
||||
void textFilterChanged ();
|
||||
protected:
|
||||
void keyPressEvent ( QKeyEvent * event );
|
||||
|
||||
private:
|
||||
HSelectionModel* _selectionModel;
|
||||
QSortFilterProxyModel* _sortModel;
|
||||
QTableView* _selectionView;
|
||||
QLineEdit* _filterPatternLineEdit;
|
||||
int _rowHeight;
|
||||
};
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
|
||||
|
||||
#endif // __HURRICANE_SELECTION_WIDGET_H__
|
|
@ -0,0 +1,96 @@
|
|||
|
||||
// -*- 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 : "./HSelectionModel.h" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
|
||||
|
||||
#ifndef __HURRICANE_SELECTION_MODEL_H__
|
||||
#define __HURRICANE_SELECTION_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 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 );
|
||||
|
||||
private:
|
||||
vector<Occurrence> _selection;
|
||||
};
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
|
||||
|
||||
#endif // __HURRICANE_SELECTION_MODEL_H__
|
|
@ -0,0 +1,84 @@
|
|||
|
||||
// -*- 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 : "./MoveCommand.h" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
|
||||
|
||||
#ifndef __HURRICANE_MOVE_COMMAND_H__
|
||||
#define __HURRICANE_MOVE_COMMAND_H__
|
||||
|
||||
#include <QPoint>
|
||||
|
||||
#include "hurricane/viewer/Command.h"
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
|
||||
class MoveCommand : public Command {
|
||||
public:
|
||||
MoveCommand ();
|
||||
virtual ~MoveCommand ();
|
||||
virtual bool keyPressEvent ( CellWidget*, QKeyEvent* );
|
||||
virtual bool mouseMoveEvent ( CellWidget*, QMouseEvent* );
|
||||
virtual bool mousePressEvent ( CellWidget*, QMouseEvent* );
|
||||
virtual bool mouseReleaseEvent ( CellWidget*, QMouseEvent* );
|
||||
protected:
|
||||
bool _active;
|
||||
QPoint _lastPosition;
|
||||
private:
|
||||
MoveCommand ( const MoveCommand& );
|
||||
MoveCommand& operator= ( const MoveCommand& );
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
|
@ -0,0 +1,93 @@
|
|||
|
||||
// -*- 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 : "./SelectCommand.h" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
|
||||
|
||||
#ifndef __HURRICANE_SELECT_COMMAND_H__
|
||||
#define __HURRICANE_SELECT_COMMAND_H__
|
||||
|
||||
#include <QObject>
|
||||
#include <QPoint>
|
||||
|
||||
#include <set>
|
||||
|
||||
#include "hurricane/viewer/AreaCommand.h"
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
|
||||
class Cell;
|
||||
class Selector;
|
||||
|
||||
|
||||
class SelectCommand : public QObject, public AreaCommand {
|
||||
Q_OBJECT;
|
||||
|
||||
public:
|
||||
SelectCommand ();
|
||||
virtual ~SelectCommand ();
|
||||
virtual bool mousePressEvent ( CellWidget*, QMouseEvent* );
|
||||
virtual bool mouseReleaseEvent ( CellWidget*, QMouseEvent* );
|
||||
signals:
|
||||
void selectionChanged ( const set<Selector*>&, Cell* );
|
||||
private:
|
||||
SelectCommand ( const SelectCommand& );
|
||||
SelectCommand& operator= ( const SelectCommand& );
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
|
@ -0,0 +1,80 @@
|
|||
|
||||
// -*- 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 : "./ZoomCommand.h" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
|
||||
|
||||
#ifndef __HURRICANE_ZOOM_COMMAND_H__
|
||||
#define __HURRICANE_ZOOM_COMMAND_H__
|
||||
|
||||
#include <QPoint>
|
||||
|
||||
#include "hurricane/viewer/AreaCommand.h"
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
|
||||
class ZoomCommand : public AreaCommand {
|
||||
public:
|
||||
ZoomCommand ();
|
||||
virtual ~ZoomCommand ();
|
||||
virtual bool keyPressEvent ( CellWidget*, QKeyEvent* );
|
||||
virtual bool mousePressEvent ( CellWidget*, QMouseEvent* );
|
||||
virtual bool mouseReleaseEvent ( CellWidget*, QMouseEvent* );
|
||||
private:
|
||||
ZoomCommand ( const ZoomCommand& );
|
||||
ZoomCommand& operator= ( const ZoomCommand& );
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue