* ./hurricane :

- Change: in CellWidget::DrawingPlane, complete replacement of hard-coded
        numeric indexes by the PlaneId enum values.
    - Change: in SelectionWidget, filter on the Occurrence name instead of the
        path name. Todo: add a radio button to select on witch column we sort.
    - Bug: in SelectionWidget, when the filter is active, remap the index
        of the toggled occurrence through the filter.

  * ./hurricane,
    ./coriolis/src/katabatic,
    ./coriolis/src/kite :
    - Change: documentation building with doxygen is now optional and disabled
        by default. To enable documentation generation run cmake with the
        following argument :
          -D "BUILD_DOC:STRING=ON"
        Or edit the cmake cache variable "BUILD_DOC".
This commit is contained in:
Jean-Paul Chaput 2009-03-03 22:27:03 +00:00
parent b8e5f9073a
commit 634af2196f
9 changed files with 114 additions and 61 deletions

View File

@ -5,6 +5,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.4.0)
SET(CMAKE_MODULE_PATH "${HURRICANE_SOURCE_DIR}/cmake_modules/") SET(CMAKE_MODULE_PATH "${HURRICANE_SOURCE_DIR}/cmake_modules/")
OPTION(BUILD_STATIC "Build static version of libraries & binaries" OFF) OPTION(BUILD_STATIC "Build static version of libraries & binaries" OFF)
OPTION(BUILD_DOC "Build the documentation (doxygen)" OFF)
IF(BUILD_STATIC) IF(BUILD_STATIC)
MESSAGE(STATUS "Building static libraries.") MESSAGE(STATUS "Building static libraries.")
@ -25,14 +26,16 @@ FIND_PACKAGE(Qt4 REQUIRED) # find and setup Qt4 for this project
FIND_PACKAGE(BISON REQUIRED) FIND_PACKAGE(BISON REQUIRED)
FIND_PACKAGE(FLEX REQUIRED) FIND_PACKAGE(FLEX REQUIRED)
FIND_PACKAGE(PythonLibs REQUIRED) FIND_PACKAGE(PythonLibs REQUIRED)
FIND_PACKAGE(Doxygen) IF(BUILD_DOC)
FIND_PACKAGE(Doxygen)
ENDIF(BUILD_DOC)
ADD_SUBDIRECTORY(src) ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(cmake_modules) ADD_SUBDIRECTORY(cmake_modules)
ADD_SUBDIRECTORY(tests) ADD_SUBDIRECTORY(tests)
IF(DOXYGEN_FOUND) IF(BUILD_DOC AND DOXYGEN_FOUND)
ADD_SUBDIRECTORY(doc) ADD_SUBDIRECTORY(doc)
ENDIF(DOXYGEN_FOUND) ENDIF(BUILD_DOC AND DOXYGEN_FOUND)
ENABLE_TESTING() ENABLE_TESTING()
ADD_TEST(HurricaneTest ${PROJECT_BINARY_DIR}/tests/htest) ADD_TEST(HurricaneTest ${PROJECT_BINARY_DIR}/tests/htest)

View File

@ -430,8 +430,8 @@ namespace Hurricane {
void CellWidget::DrawingPlanes::shiftLeft ( int dx ) void CellWidget::DrawingPlanes::shiftLeft ( int dx )
{ {
paintersBegin (); paintersBegin ();
_painters[PlaneId::Normal ].drawPixmap ( dx, 0, *_planes[0], 0, 0, width()-dx, height() ); _painters[PlaneId::Normal ].drawPixmap ( dx, 0, *_planes[PlaneId::Normal ], 0, 0, width()-dx, height() );
_painters[PlaneId::Selection].drawPixmap ( dx, 0, *_planes[1], 0, 0, width()-dx, height() ); _painters[PlaneId::Selection].drawPixmap ( dx, 0, *_planes[PlaneId::Selection], 0, 0, width()-dx, height() );
paintersEnd (); paintersEnd ();
} }
@ -439,8 +439,8 @@ namespace Hurricane {
void CellWidget::DrawingPlanes::shiftRight ( int dx ) void CellWidget::DrawingPlanes::shiftRight ( int dx )
{ {
paintersBegin (); paintersBegin ();
_painters[PlaneId::Normal ].drawPixmap ( 0, 0, *_planes[0], dx, 0, width()-dx, height() ); _painters[PlaneId::Normal ].drawPixmap ( 0, 0, *_planes[PlaneId::Normal ], dx, 0, width()-dx, height() );
_painters[PlaneId::Selection].drawPixmap ( 0, 0, *_planes[1], dx, 0, width()-dx, height() ); _painters[PlaneId::Selection].drawPixmap ( 0, 0, *_planes[PlaneId::Selection], dx, 0, width()-dx, height() );
paintersEnd (); paintersEnd ();
} }
@ -448,8 +448,8 @@ namespace Hurricane {
void CellWidget::DrawingPlanes::shiftUp ( int dy ) void CellWidget::DrawingPlanes::shiftUp ( int dy )
{ {
paintersBegin (); paintersBegin ();
_painters[PlaneId::Normal ].drawPixmap ( 0, dy, *_planes[0], 0, 0, width(), height()-dy ); _painters[PlaneId::Normal ].drawPixmap ( 0, dy, *_planes[PlaneId::Normal ], 0, 0, width(), height()-dy );
_painters[PlaneId::Selection].drawPixmap ( 0, dy, *_planes[1], 0, 0, width(), height()-dy ); _painters[PlaneId::Selection].drawPixmap ( 0, dy, *_planes[PlaneId::Selection], 0, 0, width(), height()-dy );
paintersEnd (); paintersEnd ();
} }
@ -457,8 +457,8 @@ namespace Hurricane {
void CellWidget::DrawingPlanes::shiftDown ( int dy ) void CellWidget::DrawingPlanes::shiftDown ( int dy )
{ {
paintersBegin (); paintersBegin ();
_painters[PlaneId::Normal ].drawPixmap ( 0, 0, *_planes[0], 0, dy, width(), height()-dy ); _painters[PlaneId::Normal ].drawPixmap ( 0, 0, *_planes[PlaneId::Normal ], 0, dy, width(), height()-dy );
_painters[PlaneId::Selection].drawPixmap ( 0, 0, *_planes[1], 0, dy, width(), height()-dy ); _painters[PlaneId::Selection].drawPixmap ( 0, 0, *_planes[PlaneId::Selection], 0, dy, width(), height()-dy );
paintersEnd (); paintersEnd ();
} }
@ -470,7 +470,7 @@ namespace Hurricane {
_painters[PlaneId::Selection].setBackground ( Graphics::getBrush("background") ); _painters[PlaneId::Selection].setBackground ( Graphics::getBrush("background") );
_painters[PlaneId::Selection].eraseRect ( sx, sy, w, h ); _painters[PlaneId::Selection].eraseRect ( sx, sy, w, h );
//_painters[PlaneId::Selection].setOpacity ( 0.5 ); //_painters[PlaneId::Selection].setOpacity ( 0.5 );
_painters[PlaneId::Selection].drawPixmap ( sx, sy, *_planes[0], sx, sy, w, h ); _painters[PlaneId::Selection].drawPixmap ( sx, sy, *_planes[PlaneId::Normal], sx, sy, w, h );
painterEnd ( PlaneId::Selection ); painterEnd ( PlaneId::Selection );
} }
@ -571,7 +571,7 @@ namespace Hurricane {
painterBegin ( PlaneId::Image ); painterBegin ( PlaneId::Image );
_painters[PlaneId::Image].setRenderHint(QPainter::Antialiasing, false); _painters[PlaneId::Image].setRenderHint ( QPainter::Antialiasing, false );
_painters[PlaneId::Image].drawPixmap _painters[PlaneId::Image].drawPixmap
( ximage, yimage ( ximage, yimage
, *_planes[PlaneId::Normal] , *_planes[PlaneId::Normal]
@ -1002,6 +1002,8 @@ namespace Hurricane {
{ {
cerr << "CellWidget::~CellWidget()" << endl; cerr << "CellWidget::~CellWidget()" << endl;
unselectAll ();
for ( size_t i=0 ; i<_commands.size() ; i++ ) for ( size_t i=0 ; i<_commands.size() ; i++ )
unbindCommand ( _commands[i] ); unbindCommand ( _commands[i] );
} }

View File

@ -227,6 +227,7 @@ namespace Hurricane {
getCellWidget()->setShowSelection ( true ); getCellWidget()->setShowSelection ( true );
connect ( _netlistBrowser, SIGNAL(netSelected (const Net*)), getCellWidget(), SLOT(select (const Net*)) ); connect ( _netlistBrowser, SIGNAL(netSelected (const Net*)), getCellWidget(), SLOT(select (const Net*)) );
connect ( _netlistBrowser, SIGNAL(netUnselected(const Net*)), getCellWidget(), SLOT(unselect(const Net*)) ); connect ( _netlistBrowser, SIGNAL(netUnselected(const Net*)), getCellWidget(), SLOT(unselect(const Net*)) );
_netlistBrowser->updateSelecteds ();
} else { } else {
getCellWidget()->setShowSelection ( false ); getCellWidget()->setShowSelection ( false );
getCellWidget()->setCumulativeSelection ( _cwCumulativeSelection ); getCellWidget()->setCumulativeSelection ( _cwCumulativeSelection );

View File

@ -241,6 +241,8 @@ namespace Hurricane {
void InspectorWidget::_setRootRecord ( Record* record ) void InspectorWidget::_setRootRecord ( Record* record )
{ {
//if ( _baseModel ) _baseModel->setSlot ( NULL, 0 );
_history.setRootRecord ( record ); _history.setRootRecord ( record );
if ( !record ) _rootOccurrence = Occurrence (); if ( !record ) _rootOccurrence = Occurrence ();

View File

@ -52,14 +52,15 @@ namespace Hurricane {
NetlistWidget::NetlistWidget ( QWidget* parent ) NetlistWidget::NetlistWidget ( QWidget* parent )
: QWidget (parent) : QWidget (parent)
, _cellWidget(NULL) , _cellWidget (NULL)
, _cell (NULL) , _cell (NULL)
, _baseModel (new NetlistModel(this)) , _baseModel (new NetlistModel(this))
, _sortModel (new QSortFilterProxyModel(this)) , _sortModel (new QSortFilterProxyModel(this))
, _view (new QTableView(this)) , _view (new QTableView(this))
, _rowHeight (20) , _rowHeight (20)
, _selecteds () , _selecteds ()
, _forceReselect(false)
{ {
setAttribute ( Qt::WA_DeleteOnClose ); setAttribute ( Qt::WA_DeleteOnClose );
setAttribute ( Qt::WA_QuitOnClose, false ); setAttribute ( Qt::WA_QuitOnClose, false );
@ -130,6 +131,15 @@ namespace Hurricane {
} }
void NetlistWidget::updateSelecteds ()
{
_forceReselect = true;
QItemSelection dummy;
updateSelecteds ( dummy, dummy );
}
void NetlistWidget::updateSelecteds ( const QItemSelection& , const QItemSelection& ) void NetlistWidget::updateSelecteds ( const QItemSelection& , const QItemSelection& )
{ {
if ( _cellWidget ) _cellWidget->openRefreshSession (); if ( _cellWidget ) _cellWidget->openRefreshSession ();
@ -144,6 +154,11 @@ namespace Hurricane {
_selecteds.insert ( net ); _selecteds.insert ( net );
} }
if ( _forceReselect ) {
_selecteds.forceInserteds();
_forceReselect = false;
}
SelectedNetSet::iterator remove; SelectedNetSet::iterator remove;
SelectedNetSet::iterator isel = _selecteds.begin (); SelectedNetSet::iterator isel = _selecteds.begin ();
while ( isel != _selecteds.end() ) { while ( isel != _selecteds.end() ) {
@ -172,7 +187,8 @@ namespace Hurricane {
void NetlistWidget::textFilterChanged () void NetlistWidget::textFilterChanged ()
{ {
_sortModel->setFilterRegExp ( _filterPatternLineEdit->text() ); _sortModel->setFilterRegExp ( _filterPatternLineEdit->text() );
forceRowHeight (); forceRowHeight ();
//updateSelecteds ();
} }

View File

@ -33,6 +33,7 @@
#include <QGroupBox> #include <QGroupBox>
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QAction>
#include "hurricane/Commons.h" #include "hurricane/Commons.h"
#include "hurricane/Cell.h" #include "hurricane/Cell.h"
@ -61,6 +62,7 @@ namespace Hurricane {
{ {
setAttribute ( Qt::WA_DeleteOnClose ); setAttribute ( Qt::WA_DeleteOnClose );
setAttribute ( Qt::WA_QuitOnClose, false ); setAttribute ( Qt::WA_QuitOnClose, false );
setContextMenuPolicy ( Qt::ActionsContextMenu );
_rowHeight = QFontMetrics(Graphics::getFixedFont()).height() + 4; _rowHeight = QFontMetrics(Graphics::getFixedFont()).height() + 4;
@ -93,7 +95,7 @@ namespace Hurricane {
_sortModel->setSourceModel ( _baseModel ); _sortModel->setSourceModel ( _baseModel );
_sortModel->setDynamicSortFilter ( true ); _sortModel->setDynamicSortFilter ( true );
_sortModel->setFilterKeyColumn ( 0 ); _sortModel->setFilterKeyColumn ( 1 );
_view->setShowGrid(false); _view->setShowGrid(false);
_view->setAlternatingRowColors(true); _view->setAlternatingRowColors(true);
@ -131,6 +133,19 @@ namespace Hurricane {
connect ( _view->selectionModel(), SIGNAL(currentChanged(const QModelIndex&,const QModelIndex&)) connect ( _view->selectionModel(), SIGNAL(currentChanged(const QModelIndex&,const QModelIndex&))
, this , SLOT (selectCurrent (const QModelIndex&,const QModelIndex&)) ); , this , SLOT (selectCurrent (const QModelIndex&,const QModelIndex&)) );
QAction* toggleAction = new QAction ( tr("&Toggle Selection"), this );
toggleAction->setShortcut ( QKeySequence(tr("T")) );
toggleAction->setStatusTip ( tr("Toggle the selection state of this Occurrence") );
addAction ( toggleAction );
QAction* inspectAction = new QAction ( tr("&Inspect"), this );
inspectAction->setShortcut ( QKeySequence(tr("I")) );
inspectAction->setStatusTip ( tr("Load this Occurrence in the Inspector") );
addAction ( inspectAction );
connect ( toggleAction , SIGNAL(triggered()), this, SLOT(toggleSelection ()) );
connect ( inspectAction, SIGNAL(triggered()), this, SLOT(inspect()) );
setWindowTitle ( tr("Selection<None>") ); setWindowTitle ( tr("Selection<None>") );
resize ( 500, 300 ); resize ( 500, 300 );
} }
@ -143,19 +158,6 @@ namespace Hurricane {
} }
bool SelectionWidget::eventFilter ( QObject* object, QEvent* event )
{
if ( event->type() == QEvent::KeyPress ) {
QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event);
if ( keyEvent->key() == Qt::Key_I ) { inspect ( _view->currentIndex() ); }
else if ( keyEvent->key() == Qt::Key_T ) { toggleSelection ( _view->currentIndex() ); }
}
return QObject::eventFilter ( object, event );
}
void SelectionWidget::setCellWidget ( CellWidget* cw ) void SelectionWidget::setCellWidget ( CellWidget* cw )
{ {
if ( _cellWidget ) { if ( _cellWidget ) {
@ -234,12 +236,20 @@ namespace Hurricane {
} }
void SelectionWidget::toggleSelection ()
{
toggleSelection ( _view->currentIndex() );
}
void SelectionWidget::toggleSelection ( const QModelIndex& index ) void SelectionWidget::toggleSelection ( const QModelIndex& index )
{ {
Occurrence occurrence = _baseModel->toggleSelection ( index ); if ( index.isValid() ) {
if ( occurrence.isValid() ) { Occurrence occurrence = _baseModel->toggleSelection ( _sortModel->mapToSource(index) );
_updateState = InternalEmit; if ( occurrence.isValid() ) {
_cellWidget->toggleSelection ( occurrence ); _updateState = InternalEmit;
_cellWidget->toggleSelection ( occurrence );
}
} }
} }
@ -285,6 +295,12 @@ namespace Hurricane {
} }
void SelectionWidget::inspect ()
{
inspect ( _view->currentIndex() );
}
void SelectionWidget::inspect ( const QModelIndex& index ) void SelectionWidget::inspect ( const QModelIndex& index )
{ {
if ( index.isValid() ) { if ( index.isValid() ) {

View File

@ -330,8 +330,8 @@ namespace Hurricane {
public: public:
class PlaneId { class PlaneId {
public: public:
enum Ids { Normal = 0 enum Ids { Normal = 0 // _planes[0]
, Selection = 1 , Selection = 1 // _planes[1]
, Widget = 2 , Widget = 2
, Printer = 3 , Printer = 3
, Image = 4 , Image = 4
@ -378,7 +378,7 @@ namespace Hurricane {
QPrinter* _printer; QPrinter* _printer;
QImage* _image; QImage* _image;
QPixmap* _planes[2]; QPixmap* _planes[2];
QPainter _painters[5]; QPainter _painters[PlaneId::Working];
QPen _normalPen; QPen _normalPen;
QPen _linePen; QPen _linePen;
size_t _workingPlane; size_t _workingPlane;
@ -694,15 +694,15 @@ namespace Hurricane {
inline int CellWidget::DrawingPlanes::width () const inline int CellWidget::DrawingPlanes::width () const
{ return _planes[0]->width(); } { return _planes[PlaneId::Normal]->width(); }
inline int CellWidget::DrawingPlanes::height () const inline int CellWidget::DrawingPlanes::height () const
{ return _planes[0]->height(); } { return _planes[PlaneId::Normal]->height(); }
inline QSize CellWidget::DrawingPlanes::size () const inline QSize CellWidget::DrawingPlanes::size () const
{ return _planes[0]->size(); } { return _planes[PlaneId::Normal]->size(); }
inline void CellWidget::DrawingPlanes::select ( size_t i ) inline void CellWidget::DrawingPlanes::select ( size_t i )
@ -710,37 +710,37 @@ namespace Hurricane {
inline QPainter& CellWidget::DrawingPlanes::painter ( size_t i ) inline QPainter& CellWidget::DrawingPlanes::painter ( size_t i )
{ return _painters[(i>3)?_workingPlane:i]; } { return _painters[(i>=PlaneId::Working)?_workingPlane:i]; }
inline void CellWidget::DrawingPlanes::painterBegin ( size_t i ) inline void CellWidget::DrawingPlanes::painterBegin ( size_t i )
{ {
switch ( i ) { switch ( i ) {
case 5: i = _workingPlane; case PlaneId::Working: i = _workingPlane;
case 0: case PlaneId::Normal:
case 1: _painters[i].begin ( _planes[i] ); break; case PlaneId::Selection: _painters[i].begin ( _planes[i] ); break;
case 2: _painters[2].begin ( _cellWidget ); break; case PlaneId::Widget: _painters[2].begin ( _cellWidget ); break;
case 3: _painters[3].begin ( _printer ); break; case PlaneId::Printer: _painters[3].begin ( _printer ); break;
case 4: _painters[4].begin ( _image ); break; case PlaneId::Image: _painters[4].begin ( _image ); break;
} }
} }
inline void CellWidget::DrawingPlanes::paintersBegin () inline void CellWidget::DrawingPlanes::paintersBegin ()
{ {
painterBegin ( 0 ); painterBegin ( PlaneId::Normal );
painterBegin ( 1 ); painterBegin ( PlaneId::Selection );
} }
inline void CellWidget::DrawingPlanes::painterEnd ( size_t i ) inline void CellWidget::DrawingPlanes::painterEnd ( size_t i )
{ _painters[(i>4)?_workingPlane:i].end (); } { _painters[(i>=PlaneId::Working)?_workingPlane:i].end (); }
inline void CellWidget::DrawingPlanes::paintersEnd () inline void CellWidget::DrawingPlanes::paintersEnd ()
{ {
painterEnd ( 0 ); painterEnd ( PlaneId::Normal );
painterEnd ( 1 ); painterEnd ( PlaneId::Selection );
} }

View File

@ -67,6 +67,7 @@ namespace Hurricane {
inline const Net* getNet () const; inline const Net* getNet () const;
inline size_t getAccesses () const; inline size_t getAccesses () const;
inline void incAccesses () const; inline void incAccesses () const;
inline void setInserted () const;
inline void resetAccesses () const; inline void resetAccesses () const;
private: private:
const Net* _net; const Net* _net;
@ -77,6 +78,7 @@ namespace Hurricane {
inline SelectedNet::SelectedNet () : _net(NULL), _accesses(0) { } inline SelectedNet::SelectedNet () : _net(NULL), _accesses(0) { }
inline SelectedNet::SelectedNet ( const Net* net, size_t accesses ) : _net(net), _accesses(accesses) { } inline SelectedNet::SelectedNet ( const Net* net, size_t accesses ) : _net(net), _accesses(accesses) { }
inline const Net* SelectedNet::getNet () const { return _net; } inline const Net* SelectedNet::getNet () const { return _net; }
inline void SelectedNet::setInserted () const { _accesses = 64; }
inline size_t SelectedNet::getAccesses () const { return _accesses; } inline size_t SelectedNet::getAccesses () const { return _accesses; }
inline void SelectedNet::incAccesses () const { ++_accesses; } inline void SelectedNet::incAccesses () const { ++_accesses; }
inline void SelectedNet::resetAccesses () const { _accesses = 0; } inline void SelectedNet::resetAccesses () const { _accesses = 0; }
@ -99,8 +101,9 @@ namespace Hurricane {
class SelectedNetSet : public set<SelectedNet,SelectedNetCompare>{ class SelectedNetSet : public set<SelectedNet,SelectedNetCompare>{
public: public:
void insert ( const Net* ); void insert ( const Net* );
void resetAccesses (); void forceInserteds ();
void resetAccesses ();
}; };
@ -114,6 +117,13 @@ namespace Hurricane {
} }
inline void SelectedNetSet::forceInserteds ()
{
for ( iterator iselected=begin() ; iselected != end() ; ++iselected )
iselected->setInserted ();
}
inline void SelectedNetSet::resetAccesses () inline void SelectedNetSet::resetAccesses ()
{ {
for ( iterator iselected=begin() ; iselected != end() ; ++iselected ) for ( iterator iselected=begin() ; iselected != end() ; ++iselected )
@ -136,6 +146,7 @@ namespace Hurricane {
template<typename InformationType> template<typename InformationType>
void setCell ( Cell* ); void setCell ( Cell* );
void goTo ( int ); void goTo ( int );
void updateSelecteds ();
signals: signals:
void netSelected ( const Net* ); void netSelected ( const Net* );
void netUnselected ( const Net* ); void netUnselected ( const Net* );
@ -156,6 +167,7 @@ namespace Hurricane {
QLineEdit* _filterPatternLineEdit; QLineEdit* _filterPatternLineEdit;
int _rowHeight; int _rowHeight;
SelectedNetSet _selecteds; SelectedNetSet _selecteds;
bool _forceReselect;
}; };

View File

@ -73,14 +73,15 @@ namespace Hurricane {
void setCumulativeSelection ( bool ); void setCumulativeSelection ( bool );
void selectCurrent ( const QModelIndex& current, const QModelIndex& ); void selectCurrent ( const QModelIndex& current, const QModelIndex& );
void setSelection ( const SelectorSet& selection ); void setSelection ( const SelectorSet& selection );
void toggleSelection ();
void toggleSelection ( Occurrence ); void toggleSelection ( Occurrence );
void toggleSelection ( const QModelIndex& ); void toggleSelection ( const QModelIndex& );
void forceRowHeight (); void forceRowHeight ();
void inspect ();
private slots: private slots:
void textFilterChanged (); void textFilterChanged ();
protected: protected:
void blockAllSignals ( bool ); void blockAllSignals ( bool );
virtual bool eventFilter ( QObject*, QEvent* );
private: private:
CellWidget* _cellWidget; CellWidget* _cellWidget;