coriolis/hurricane/src/viewer/HierarchyCommand.cpp

106 lines
3.2 KiB
C++
Raw Normal View History

// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | H U R R I C A N E |
// | V L S I B a c k e n d D a t a - B a s e |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Module : "./HierarchyCommand.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
# include <QMouseEvent>
# include <QKeyEvent>
# include <QAction>
# include "hurricane/Cell.h"
# include "hurricane/viewer/CellWidget.h"
# include "hurricane/viewer/HierarchyCommand.h"
namespace Hurricane {
// -------------------------------------------------------------------
// Class : "HierarchyCommand".
string HierarchyCommand::_name = "HierarchyCommand";
HierarchyCommand::HierarchyCommand ()
: Command ()
, _history ()
, _historyIndex(0)
{ }
HierarchyCommand::~HierarchyCommand ()
{ }
const string& HierarchyCommand::getName () const
{ return _name; }
void HierarchyCommand::keyReleaseEvent ( QKeyEvent* event )
{
bool control = (event->modifiers() & Qt::ControlModifier);
bool shift = (event->modifiers() & Qt::ShiftModifier );
if ( !shift && !control ) return;
if ( !_cellWidget->getCell() ) return;
QPoint position ( _cellWidget->mapFromGlobal(QCursor::pos()) );
Box pointBox ( _cellWidget->screenToDbuBox(QRect(position,QSize(1,1))) );
switch ( event->key() ) {
* ./hurricane/src/hviewer : - Bug: correction of the bad keyPress event handling in InspectorWidget (had to press twice the key for the action to be transmitted). Uses an eventFilter() at InspectorWidget instead of a keyPressEvent() overload. The keyPress event is first received by the QTableView then transmitted to the upper level. The eventFilter allows the InspectorWidget to catch the event *before* it gets to QTableView (but let pass thoses it don't want). - Bug: idem for SeletionWidget. - Change: do not draw the rectangular area of AreaCommand until it is bigger than a given threshold (programmable). Affect ZoomCommand and SelectCommand. ZoomCommand no longer issue a warning when the zoom is to small. - New feature: fit to net in the NetlistWidget. Uses simple contextual menu, another way to avoid overloading keyPressEvent(). - Change: in Query, the filter has now it's own subtype: Query::Mask. - Change: enhancement for the "start" model of signal propagation, used to re-implement the DisplayFilterWidget. - Change: more clear policy for signal emission: a signal must be emitted by any "setter" method (setStartLevel(), setStopLevel(), ...). Has to be enforced for all setter (work in progress). - Change: re-implemenation of the delayed refresh mechanism. No more flags propaged througout the functions calls but a session mechanism instead. See CellWidget::openRefreshSession() & CellWidget::closeRefreshSession(). Nothing is actually drawn until the last session is closed. Session mechanism can be invoked by signals/slots, see NetlistWidget. - Change: less dangerous key mapping: 'z' : zoom in. 'm' : zoom out. 'CTRL+z' : previous zoom level. 'CTRL+m' : next zoom level. 'CTRL+Up' : back in hierarchy. 'CTRL+Down' : go down in hierarchy. 'SHIFT+Up' : back in hierarchy stack. 'SHIFT+Down' : go down in hierarchy stack.
2009-02-02 08:45:48 -06:00
case Qt::Key_Up:
if ( ( _historyIndex > 0 ) && (shift || control) ) {
_cellWidget->setState ( _history[--_historyIndex]._state );
}
break;
* ./hurricane/src/hviewer : - Bug: correction of the bad keyPress event handling in InspectorWidget (had to press twice the key for the action to be transmitted). Uses an eventFilter() at InspectorWidget instead of a keyPressEvent() overload. The keyPress event is first received by the QTableView then transmitted to the upper level. The eventFilter allows the InspectorWidget to catch the event *before* it gets to QTableView (but let pass thoses it don't want). - Bug: idem for SeletionWidget. - Change: do not draw the rectangular area of AreaCommand until it is bigger than a given threshold (programmable). Affect ZoomCommand and SelectCommand. ZoomCommand no longer issue a warning when the zoom is to small. - New feature: fit to net in the NetlistWidget. Uses simple contextual menu, another way to avoid overloading keyPressEvent(). - Change: in Query, the filter has now it's own subtype: Query::Mask. - Change: enhancement for the "start" model of signal propagation, used to re-implement the DisplayFilterWidget. - Change: more clear policy for signal emission: a signal must be emitted by any "setter" method (setStartLevel(), setStopLevel(), ...). Has to be enforced for all setter (work in progress). - Change: re-implemenation of the delayed refresh mechanism. No more flags propaged througout the functions calls but a session mechanism instead. See CellWidget::openRefreshSession() & CellWidget::closeRefreshSession(). Nothing is actually drawn until the last session is closed. Session mechanism can be invoked by signals/slots, see NetlistWidget. - Change: less dangerous key mapping: 'z' : zoom in. 'm' : zoom out. 'CTRL+z' : previous zoom level. 'CTRL+m' : next zoom level. 'CTRL+Up' : back in hierarchy. 'CTRL+Down' : go down in hierarchy. 'SHIFT+Up' : back in hierarchy stack. 'SHIFT+Down' : go down in hierarchy stack.
2009-02-02 08:45:48 -06:00
case Qt::Key_Down:
{
if ( control ) {
if ( _history.empty() )
_history.push_back ( HistoryEntry ( NULL, _cellWidget->getState() ) );
Instances instances = _cellWidget->getCell()->getInstancesUnder ( pointBox );
if ( !instances.isEmpty() ) {
_history.erase ( _history.begin()+_historyIndex+1, _history.end() );
Instance* instance = instances.getFirst ();
_cellWidget->setCell ( instance->getMasterCell() );
_history.push_back ( HistoryEntry ( instance, _cellWidget->getState() ) );
_historyIndex++;
}
} else if ( shift ) {
if ( _historyIndex+1 < _history.size() ) {
_cellWidget->setState ( _history[++_historyIndex]._state );
}
}
}
break;
}
}
} // End of Hurricane namespace.