diff --git a/hurricane/src/hurricane/hurricane/Commons.h b/hurricane/src/hurricane/hurricane/Commons.h index 258545c6..9f0489ff 100644 --- a/hurricane/src/hurricane/hurricane/Commons.h +++ b/hurricane/src/hurricane/hurricane/Commons.h @@ -993,6 +993,15 @@ inline Hurricane::Record* getRecord ( const std::multiset* s ) GETRECORD_REFERENCE_SUPPORT(Data) +# define INSPECTOR_PV_SUPPORT(Data) \ + GETSTRING_POINTER_SUPPORT(Data) \ + GETSTRING_VALUE_SUPPORT(Data) \ + IOSTREAM_POINTER_SUPPORT(Data) \ + IOSTREAM_VALUE_SUPPORT(Data) \ + GETRECORD_POINTER_SUPPORT(Data) \ + GETRECORD_VALUE_SUPPORT(Data) + + #include "hurricane/Tabulation.h" diff --git a/hurricane/src/hurricane/hurricane/Occurrence.h b/hurricane/src/hurricane/hurricane/Occurrence.h index baae81c9..b022016a 100644 --- a/hurricane/src/hurricane/hurricane/Occurrence.h +++ b/hurricane/src/hurricane/hurricane/Occurrence.h @@ -124,7 +124,7 @@ class JsonOccurrence : public JsonObject { } // End of Hurricane namespace. -INSPECTOR_PR_SUPPORT(Hurricane::Occurrence); +INSPECTOR_PV_SUPPORT(Hurricane::Occurrence); #endif // HURRICANE_OCCURENCE diff --git a/hurricane/src/viewer/CellWidget.cpp b/hurricane/src/viewer/CellWidget.cpp index 6f24daeb..390dc20d 100644 --- a/hurricane/src/viewer/CellWidget.cpp +++ b/hurricane/src/viewer/CellWidget.cpp @@ -1281,6 +1281,7 @@ namespace Hurricane { void CellWidget::setShowSelection ( bool state ) { + //cerr << "CellWidget::setShowSelection(): " << state << " vs. " << _state->showSelection() << endl; if ( state != _state->showSelection() ) { _state->setShowSelection ( state ); _selectionHasChanged = false; @@ -2796,7 +2797,6 @@ namespace Hurricane { if ( occurrence.getOwnerCell() != getCell() ) throw Error( "CellWidget::toggleSelection(): Occurrence do not belong to the loaded cell." ); - cerr << "CellWidget::toggleSelection() " << occurrence << endl; Property* property = occurrence.getProperty( Selector::getPropertyName() ); Selector* selector = NULL; if (not property) { diff --git a/hurricane/src/viewer/Command.cpp b/hurricane/src/viewer/Command.cpp index f1e06c10..c88b75c0 100644 --- a/hurricane/src/viewer/Command.cpp +++ b/hurricane/src/viewer/Command.cpp @@ -51,6 +51,7 @@ namespace Hurricane { } + void Command::setCellWidget ( CellWidget* widget ) { _cellWidget=widget; } void Command::wheelEvent ( QWheelEvent* ) { } void Command::keyPressEvent ( QKeyEvent* ) { } void Command::keyReleaseEvent ( QKeyEvent* ) { } diff --git a/hurricane/src/viewer/ControllerWidget.cpp b/hurricane/src/viewer/ControllerWidget.cpp index acdfb9e6..60656aed 100644 --- a/hurricane/src/viewer/ControllerWidget.cpp +++ b/hurricane/src/viewer/ControllerWidget.cpp @@ -14,26 +14,26 @@ // +-----------------------------------------------------------------+ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include namespace Hurricane { diff --git a/hurricane/src/viewer/InspectorWidget.cpp b/hurricane/src/viewer/InspectorWidget.cpp index 36a1a818..e2dabf1d 100644 --- a/hurricane/src/viewer/InspectorWidget.cpp +++ b/hurricane/src/viewer/InspectorWidget.cpp @@ -1,14 +1,14 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2018, All Rights Reserved +// Copyright (c) Sorbonne Université 2008-2021, All Rights Reserved // // +-----------------------------------------------------------------+ // | 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 | +// | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Module : "./InspectorWidget.cpp" | // +-----------------------------------------------------------------+ @@ -24,7 +24,6 @@ #include #include #include - #include "hurricane/viewer/Graphics.h" #include "hurricane/viewer/RecordModel.h" #include "hurricane/viewer/InspectorWidget.h" diff --git a/hurricane/src/viewer/SelectCommand.cpp b/hurricane/src/viewer/SelectCommand.cpp index c1fd1c5c..ccfa77d5 100644 --- a/hurricane/src/viewer/SelectCommand.cpp +++ b/hurricane/src/viewer/SelectCommand.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2018, All Rights Reserved +// Copyright (c) Sorbonne Université 2008-2021, All Rights Reserved // // +-----------------------------------------------------------------+ // | H U R R I C A N E | @@ -14,20 +14,20 @@ // +-----------------------------------------------------------------+ -#include -#include -#include -#include -#include "hurricane/Path.h" -#include "hurricane/Entity.h" -#include "hurricane/Net.h" -#include "hurricane/Component.h" -#include "hurricane/Occurrence.h" -#include "hurricane/HyperNet.h" -#include "hurricane/Cell.h" -#include "hurricane/viewer/CellWidget.h" -#include "hurricane/viewer/SelectCommand.h" -#include "hurricane/viewer/SelectionPopup.h" +#include +#include +#include +#include +#include "hurricane/Path.h" +#include "hurricane/Entity.h" +#include "hurricane/Net.h" +#include "hurricane/Component.h" +#include "hurricane/Occurrence.h" +#include "hurricane/HyperNet.h" +#include "hurricane/Cell.h" +#include "hurricane/viewer/CellWidget.h" +#include "hurricane/viewer/SelectCommand.h" +#include "hurricane/viewer/SelectionPopup.h" namespace Hurricane { @@ -217,34 +217,34 @@ namespace Hurricane { void SelectCommand::mousePressEvent ( QMouseEvent* event ) { - if ( isActive() ) return; + if (isActive()) return; - if ( event->button() == Qt::RightButton ) { - if ( !event->modifiers() ) { - event->accept (); - setActive ( true ); - setStartPoint ( event->pos() ); - setDrawingEnabled ( true ); - } else if ( event->modifiers() == Qt::ControlModifier ) { - event->accept (); + if (event->button() == Qt::RightButton) { + if (not event->modifiers() ) { + event->accept(); + setActive ( true ); + setStartPoint ( event->pos() ); + setDrawingEnabled( true ); + } else if (event->modifiers() == Qt::ControlModifier) { + event->accept(); QRect selectArea ( event->pos() - QPoint(2,2), QSize(4,4) ); Occurrences selection; switch ( _selectMode ) { case AllMode: // 0 - selection = _cellWidget->getOccurrencesUnder(selectArea); + selection = _cellWidget->getOccurrencesUnder( selectArea ); break; case NetMode: // 1 - selection = Occurrences_GetNets(_cellWidget->getOccurrencesUnder(selectArea),false); + selection = Occurrences_GetNets( _cellWidget->getOccurrencesUnder(selectArea), false ); break; case NoAnonNetMode: // 2 - selection = Occurrences_GetNets(_cellWidget->getOccurrencesUnder(selectArea),true); + selection = Occurrences_GetNets( _cellWidget->getOccurrencesUnder(selectArea), true ); break; } - _selectionPopup->loadOccurrences ( selection ); - _selectionPopup->updateLayout (); - _selectionPopup->move ( event->globalPos() ); - _selectionPopup->popup (); + _selectionPopup->loadOccurrences( selection ); + _selectionPopup->updateLayout(); + _selectionPopup->move( event->globalPos() ); + _selectionPopup->popup(); } } } @@ -257,25 +257,37 @@ namespace Hurricane { event->accept (); - setActive ( false ); - setDrawingEnabled ( false ); + setActive( false ); + setDrawingEnabled( false ); QRect selectArea; if ( _startPoint == _stopPoint ) - selectArea = QRect ( _startPoint - QPoint(2,2), QSize(4,4) ); + selectArea = QRect( _startPoint - QPoint(2,2), QSize(4,4) ); else - selectArea = QRect ( _startPoint, _stopPoint ); + selectArea = QRect( _startPoint, _stopPoint ); //_cellWidget->unselectAll (); - _cellWidget->selectOccurrencesUnder ( _cellWidget->screenToDbuBox(selectArea) ); - bool somethingSelected = not _cellWidget->getSelectorSet().empty(); - - if ( _cellWidget->showSelection() != somethingSelected ) - _cellWidget->setShowSelection ( somethingSelected ); - else - _cellWidget->refresh (); + _cellWidget->selectOccurrencesUnder( _cellWidget->screenToDbuBox(selectArea) ); + setShowSelection( not _cellWidget->getSelectorSet().empty() ); } + void SelectCommand::setCellWidget ( CellWidget* cellWidget ) + { + Super::setCellWidget( cellWidget ); + _selectionPopup->setCellWidget( cellWidget ); + } + + + void SelectCommand::setShowSelection ( bool state ) + { + //cerr << "SelectCommand::setShowSelection(): " + // << state << " vs. " << _cellWidget->showSelection() << endl; + if (_cellWidget->showSelection() != state) + _cellWidget->setShowSelection( state ); + else + _cellWidget->refresh(); + } + } // End of Hurricane namespace. diff --git a/hurricane/src/viewer/SelectionPopup.cpp b/hurricane/src/viewer/SelectionPopup.cpp index 19e49511..11f72968 100644 --- a/hurricane/src/viewer/SelectionPopup.cpp +++ b/hurricane/src/viewer/SelectionPopup.cpp @@ -1,13 +1,14 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2018, All Rights Reserved +// Copyright (c) Sorbonne Université 2008-2021, All Rights Reserved // // +-----------------------------------------------------------------+ // | 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 | +// | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Module : "./SelectionPopup.cpp" | // +-----------------------------------------------------------------+ @@ -21,6 +22,7 @@ #include #include "hurricane/Commons.h" #include "hurricane/viewer/Graphics.h" +#include "hurricane/viewer/CellWidget.h" #include "hurricane/viewer/SelectionPopupModel.h" #include "hurricane/viewer/SelectionPopup.h" @@ -34,6 +36,7 @@ namespace Hurricane { SelectionPopup::SelectionPopup ( QWidget* parent ) : QWidget(parent) + , _cellWidget(NULL) , _model(NULL) , _view(NULL) , _rowHeight(20) @@ -75,10 +78,10 @@ namespace Hurricane { } - void SelectionPopup::popup () + bool SelectionPopup::popup () { - show (); - grabMouse (); + show(); + grabMouse(); } @@ -96,7 +99,6 @@ namespace Hurricane { } - void SelectionPopup::mouseMoveEvent ( QMouseEvent* event ) { QModelIndex index = _view->indexAt ( event->pos() ); @@ -107,20 +109,21 @@ namespace Hurricane { } - void SelectionPopup::mouseReleaseEvent ( QMouseEvent* event ) { - releaseMouse (); - hide (); + releaseMouse(); + hide(); - QModelIndex index = _view->indexAt ( event->pos() ); - if ( index.isValid() ) { + QModelIndex index = _view->indexAt( event->pos() ); + if (index.isValid()) { Occurrence occurrence = _model->getOccurrence(index.row()); - if ( occurrence.getEntity() ) - emit selectionToggled ( occurrence ); + if (occurrence.getEntity()) { + if (_cellWidget) _cellWidget->setShowSelection( true ); + emit selectionToggled( occurrence ); + } } - clear (); + clear(); } diff --git a/hurricane/src/viewer/SelectionWidget.cpp b/hurricane/src/viewer/SelectionWidget.cpp index 360edf4f..19be21f0 100644 --- a/hurricane/src/viewer/SelectionWidget.cpp +++ b/hurricane/src/viewer/SelectionWidget.cpp @@ -160,7 +160,7 @@ namespace Hurricane { connect( _cellWidget, SIGNAL(selectionChanged(const SelectorSet&)) , this , SLOT (setSelection (const SelectorSet&)) ); - connect( _cellWidget, SIGNAL(selectionToggled(Selector*)), this , SLOT(toggleSelection(Selector*)) ); + connect( _cellWidget, SIGNAL(selectionToggled(Selector*)), this, SLOT(toggleSelection(Selector*)) ); _updateState = ExternalEmit; changeSelectionMode (); @@ -169,22 +169,20 @@ namespace Hurricane { void SelectionWidget::changeSelectionMode () { - if ( !_cellWidget ) return; + if (not _cellWidget) return; - if ( _updateState == InternalEmit ) { + if (_updateState == InternalEmit) { _updateState = InternalReceive; emit selectionModeChanged (); } else { - if ( _updateState == ExternalEmit ) { - blockAllSignals ( true ); - - _showSelection->setChecked ( _cellWidget->getState()->showSelection () ); - _cumulative ->setChecked ( _cellWidget->getState()->cumulativeSelection() ); - - blockAllSignals ( false ); + if (_updateState == ExternalEmit) { + blockAllSignals( true ); + _showSelection->setChecked( _cellWidget->getState()->showSelection () ); + _cumulative ->setChecked( _cellWidget->getState()->cumulativeSelection() ); + blockAllSignals( false ); } - _updateState = ExternalEmit; } + _updateState = ExternalEmit; } diff --git a/hurricane/src/viewer/hurricane/viewer/Command.h b/hurricane/src/viewer/hurricane/viewer/Command.h index ce6f4748..f8ac4e4c 100644 --- a/hurricane/src/viewer/hurricane/viewer/Command.h +++ b/hurricane/src/viewer/hurricane/viewer/Command.h @@ -43,7 +43,7 @@ namespace Hurricane { virtual Type getType () const; inline bool isActive () const; void setActive ( bool state ); - inline void setCellWidget ( CellWidget* ); + virtual void setCellWidget ( CellWidget* ); virtual void wheelEvent ( QWheelEvent* ); virtual void keyPressEvent ( QKeyEvent* ); virtual void keyReleaseEvent ( QKeyEvent* ); @@ -63,7 +63,6 @@ namespace Hurricane { // Inline Functions. bool Command::isActive () const { return _active; } - void Command::setCellWidget ( CellWidget* widget ) { _cellWidget=widget; } } diff --git a/hurricane/src/viewer/hurricane/viewer/SelectCommand.h b/hurricane/src/viewer/hurricane/viewer/SelectCommand.h index d358c351..ba20c40f 100644 --- a/hurricane/src/viewer/hurricane/viewer/SelectCommand.h +++ b/hurricane/src/viewer/hurricane/viewer/SelectCommand.h @@ -2,39 +2,26 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2018, All Rights Reserved -// -// =================================================================== -// -// $Id$ +// Copyright (c) Sorbonne Université 2008-2021, All Rights Reserved // // 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 | +// | E-mail : Jean-Paul.Chaput@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 - -#include -#include - +#pragma once +#include +#include +#include class QAction; - -#include "hurricane/Occurrence.h" -#include "hurricane/viewer/AreaCommand.h" +#include "hurricane/Occurrence.h" +#include "hurricane/viewer/AreaCommand.h" using namespace std; @@ -50,7 +37,8 @@ namespace Hurricane { class SelectCommand : public QObject, public AreaCommand { Q_OBJECT; - + public: + typedef AreaCommand Super; public: enum SelectMode { AllMode=0, NetMode=1, NoAnonNetMode=2 }; public: @@ -64,6 +52,8 @@ namespace Hurricane { virtual void mousePressEvent ( QMouseEvent* ); virtual void mouseReleaseEvent ( QMouseEvent* ); void bindToAction ( QAction* ); + virtual void setCellWidget ( CellWidget* ); + void setShowSelection ( bool state ); signals: void selectionToggled ( Occurrence ); private: @@ -81,6 +71,3 @@ namespace Hurricane { } // End of Hurricane namespace. - - -#endif diff --git a/hurricane/src/viewer/hurricane/viewer/SelectionModel.h b/hurricane/src/viewer/hurricane/viewer/SelectionModel.h index fdf1a80c..b9edc038 100644 --- a/hurricane/src/viewer/hurricane/viewer/SelectionModel.h +++ b/hurricane/src/viewer/hurricane/viewer/SelectionModel.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2018, All Rights Reserved +// Copyright (c) Sornonne Université 2008-2021, All Rights Reserved // // +-----------------------------------------------------------------+ // | H U R R I C A N E | @@ -14,9 +14,7 @@ // +-----------------------------------------------------------------+ -#ifndef HURRICANE_SELECTION_MODEL_H -#define HURRICANE_SELECTION_MODEL_H - +#pragma once #include #include #include @@ -34,10 +32,10 @@ namespace Hurricane { class SelectionModel : public QAbstractTableModel { Q_OBJECT; - public: SelectionModel ( QObject* parent=NULL ); ~SelectionModel (); + inline CellWidget* getCellWidget () const; void setCellWidget ( CellWidget* ); Selector* getSelector ( const QModelIndex& index ); void setSelection ( const SelectorSet& selection ); @@ -53,13 +51,13 @@ namespace Hurricane { public slots: void unlink ( Selector* ); void clear (); - private: CellWidget* _cellWidget; vector _selection; }; + + inline CellWidget* SelectionModel::getCellWidget () const { return _cellWidget; } + } // Hurricane namespace. - -#endif // HURRICANE_SELECTION_MODEL_H diff --git a/hurricane/src/viewer/hurricane/viewer/SelectionPopup.h b/hurricane/src/viewer/hurricane/viewer/SelectionPopup.h index 9feeb70c..50e4aef2 100644 --- a/hurricane/src/viewer/hurricane/viewer/SelectionPopup.h +++ b/hurricane/src/viewer/hurricane/viewer/SelectionPopup.h @@ -1,22 +1,20 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2018, All Rights Reserved +// Copyright (c) Sorbonne Université 2008-2021, All Rights Reserved // // +-----------------------------------------------------------------+ // | 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 | +// | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Header : "./hurricane/viewer/SelectionPopup.h" | // +-----------------------------------------------------------------+ -#ifndef HURRICANE_SELECTION_POPUP_WIDGET_H -#define HURRICANE_SELECTION_POPUP_WIDGET_H - +#pragma once #include #include #include "hurricane/Commons.h" @@ -38,15 +36,16 @@ namespace Hurricane { class SelectionPopupModel; + class CellWidget; class SelectionPopup : public QWidget { Q_OBJECT; - public: SelectionPopup ( QWidget* parent=NULL ); + inline void setCellWidget ( CellWidget* ); void updateLayout (); - void popup (); + bool popup (); void clearFilter (); void setFilter ( OccurrenceFilter ); signals: @@ -59,8 +58,8 @@ namespace Hurricane { virtual void keyPressEvent ( QKeyEvent * ); virtual void mouseMoveEvent ( QMouseEvent* ); virtual void mouseReleaseEvent ( QMouseEvent* ); - private: + CellWidget* _cellWidget; SelectionPopupModel* _model; QTableView* _view; int _rowHeight; @@ -68,6 +67,7 @@ namespace Hurricane { }; -} // Hurricane namespace. + inline void SelectionPopup::setCellWidget ( CellWidget* cellWidget ) { _cellWidget=cellWidget; } -#endif // HURRICANE_SELECTION_POPUP_WIDGET_H + +} // Hurricane namespace. diff --git a/hurricane/src/viewer/hurricane/viewer/SelectionWidget.h b/hurricane/src/viewer/hurricane/viewer/SelectionWidget.h index 916b78a5..bb7ca3ad 100644 --- a/hurricane/src/viewer/hurricane/viewer/SelectionWidget.h +++ b/hurricane/src/viewer/hurricane/viewer/SelectionWidget.h @@ -1,29 +1,27 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2019, All Rights Reserved +// Copyright (c) Sorbonne Université 2008-2021, All Rights Reserved // // +-----------------------------------------------------------------+ // | 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@lip6.fr | +// | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Header : "./hurricane/viewer/SelectionWidget.h" | // +-----------------------------------------------------------------+ -#ifndef HURRICANE_SELECTION_WIDGET_H -#define HURRICANE_SELECTION_WIDGET_H - -#include -#include -#include -#include "hurricane/Commons.h" -#include "hurricane/Occurrence.h" -#include "hurricane/viewer/SelectionModel.h" -#include "hurricane/viewer/CellWidget.h" +#pragma once +#include +#include +#include +#include "hurricane/Commons.h" +#include "hurricane/Occurrence.h" +#include "hurricane/viewer/SelectionModel.h" +#include "hurricane/viewer/CellWidget.h" class QCloseEvent; class QSortFilterProxyModel; @@ -42,7 +40,6 @@ namespace Hurricane { class SelectionWidget : public QWidget { Q_OBJECT; - public: SelectionWidget ( QWidget* parent=NULL ); void inspect ( const QModelIndex& index ); @@ -84,5 +81,3 @@ namespace Hurricane { } // Hurricane namespace. - -#endif // HURRICANE_SELECTION_WIDGET_H