2009-04-15 11:09:18 -05:00
|
|
|
// -*- C++ -*-
|
|
|
|
//
|
|
|
|
// This file is part of the Coriolis Software.
|
2018-01-06 10:55:44 -06:00
|
|
|
// Copyright (c) UPMC/LIP6 2008-2018, All Rights Reserved
|
2009-04-15 11:09:18 -05:00
|
|
|
//
|
Update to Qt 5, requires cmake 2.8.9. New placer: Etesian.
Update to Qt 5:
* Change: Now requires at least cmake 2.8.9.
* Change: CMakeLists.txt needs small changes. Qt modules must be found
one by one (Core, Gui, Widgets). Must add "set(CMAKE_AUTOMOC ON)"
in the top file and replace "qt4" prefix in macros by "qt5".
Added simpler macro "setup_qt()" in FindBootstrap.cmake.
* Change: No longer need to include <QGtkStyle> is is choosen by default
according to the current desktop environment.
* Change: In <hurricane>, In HApplication, launch ExceptionWidget when
a std::exception is catched instead of silently discarting it.
New placer Tool: Etesian
* New: <etesian> analytical placer. Encapsulate Coloquinte from
Gabriel Gouvine.
* New: in <documentation>, add stub demonstration ToolEngine <smurf>.
Needs to be commented.
Miscellaneous:
* New: in <boostrap> and <unicorn>, added support for Etesian, the new
analytic placer. The tool itself will be added in the next commit.
* Bug: in <CellWidget>, when shifting the display buffer, we no longer
can copy the buffer on itself (we should never have). Now go through
a temporary one (PlaneId::AutoCopy) which is added to the
DrawingPlanes. Affect "goLeft()" and "goUp()".
* Bug: In <CellWidget>, remove the WA_PaintOnScreen flag/attribute.
When it's on, no PaintEvent is transmitted to the CellWidget
when it's the central widget of the <CellViewer> (QMainWindow).
It's something I still don't understand from the doc of Qt.
* Change: In <AreaCommand>, use the PlaneId enumeration instead of a
anonymous numerical index.
* Change: In <HApplication>, no longer catch and silently discard
standartd exceptions but launch the ExceptionWidget...
Suppress the now deprecated constructor with "Type" argument.
* Change: In <SelectionModel>, the "reset()" method is deprecated in
Qt5, instead enclose the "clear()" by a "beginResetModel()" and
"endResetModel()" pair.
* New: In <crlcore>, add support for ISPD05 benchmarks (in Bookshelf
format). Forked from ISPD04 and not finished yet.
* Change: In <Mauka>, distinguish the Action string identifier from
<Etesian>
* New: In <unicorn>, add entry for ISPD05 loader. Add entry for
<Etesian> analytic placer.
2014-03-22 05:50:36 -05:00
|
|
|
// +-----------------------------------------------------------------+
|
2009-04-15 11:09:18 -05:00
|
|
|
// | 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 : "./RulerCommand.cpp" |
|
Update to Qt 5, requires cmake 2.8.9. New placer: Etesian.
Update to Qt 5:
* Change: Now requires at least cmake 2.8.9.
* Change: CMakeLists.txt needs small changes. Qt modules must be found
one by one (Core, Gui, Widgets). Must add "set(CMAKE_AUTOMOC ON)"
in the top file and replace "qt4" prefix in macros by "qt5".
Added simpler macro "setup_qt()" in FindBootstrap.cmake.
* Change: No longer need to include <QGtkStyle> is is choosen by default
according to the current desktop environment.
* Change: In <hurricane>, In HApplication, launch ExceptionWidget when
a std::exception is catched instead of silently discarting it.
New placer Tool: Etesian
* New: <etesian> analytical placer. Encapsulate Coloquinte from
Gabriel Gouvine.
* New: in <documentation>, add stub demonstration ToolEngine <smurf>.
Needs to be commented.
Miscellaneous:
* New: in <boostrap> and <unicorn>, added support for Etesian, the new
analytic placer. The tool itself will be added in the next commit.
* Bug: in <CellWidget>, when shifting the display buffer, we no longer
can copy the buffer on itself (we should never have). Now go through
a temporary one (PlaneId::AutoCopy) which is added to the
DrawingPlanes. Affect "goLeft()" and "goUp()".
* Bug: In <CellWidget>, remove the WA_PaintOnScreen flag/attribute.
When it's on, no PaintEvent is transmitted to the CellWidget
when it's the central widget of the <CellViewer> (QMainWindow).
It's something I still don't understand from the doc of Qt.
* Change: In <AreaCommand>, use the PlaneId enumeration instead of a
anonymous numerical index.
* Change: In <HApplication>, no longer catch and silently discard
standartd exceptions but launch the ExceptionWidget...
Suppress the now deprecated constructor with "Type" argument.
* Change: In <SelectionModel>, the "reset()" method is deprecated in
Qt5, instead enclose the "clear()" by a "beginResetModel()" and
"endResetModel()" pair.
* New: In <crlcore>, add support for ISPD05 benchmarks (in Bookshelf
format). Forked from ISPD04 and not finished yet.
* Change: In <Mauka>, distinguish the Action string identifier from
<Etesian>
* New: In <unicorn>, add entry for ISPD05 loader. Add entry for
<Etesian> analytic placer.
2014-03-22 05:50:36 -05:00
|
|
|
// +-----------------------------------------------------------------+
|
2009-04-15 11:09:18 -05:00
|
|
|
|
|
|
|
|
|
|
|
# include <QMouseEvent>
|
|
|
|
# include <QKeyEvent>
|
|
|
|
|
|
|
|
# include <hurricane/viewer/CellWidget.h>
|
|
|
|
# include <hurricane/viewer/RulerCommand.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace Hurricane {
|
|
|
|
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
// Class : "RulerCommand".
|
|
|
|
|
|
|
|
|
2009-10-19 12:17:21 -05:00
|
|
|
string RulerCommand::_name = "RulerCommand";
|
|
|
|
|
|
|
|
|
2009-04-15 11:09:18 -05:00
|
|
|
RulerCommand::RulerCommand ()
|
2009-12-03 05:19:54 -06:00
|
|
|
: Command ()
|
|
|
|
, _ruler ()
|
|
|
|
, _drawing(false)
|
2009-04-15 11:09:18 -05:00
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
|
|
RulerCommand::~RulerCommand ()
|
|
|
|
{ }
|
|
|
|
|
|
|
|
|
2009-10-19 12:17:21 -05:00
|
|
|
const string& RulerCommand::getName () const
|
|
|
|
{ return _name; }
|
2009-04-15 11:09:18 -05:00
|
|
|
|
|
|
|
|
2009-10-19 12:17:21 -05:00
|
|
|
void RulerCommand::mouseMoveEvent ( QMouseEvent* event )
|
|
|
|
{
|
2009-12-03 05:19:54 -06:00
|
|
|
if ( not isActive() or not _drawing ) return;
|
2009-10-19 12:17:21 -05:00
|
|
|
|
2009-10-21 04:18:12 -05:00
|
|
|
_ruler->setExtremity ( _cellWidget->_onCursorGrid(_cellWidget->screenToDbuPoint(event->pos())) );
|
2009-10-19 12:17:21 -05:00
|
|
|
_cellWidget->update ();
|
2009-04-15 11:09:18 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-10-19 12:17:21 -05:00
|
|
|
void RulerCommand::mousePressEvent ( QMouseEvent* event )
|
2009-04-15 11:09:18 -05:00
|
|
|
{
|
2009-12-03 05:19:54 -06:00
|
|
|
if ( not isActive() ) return;
|
|
|
|
|
|
|
|
if ( event->button() == Qt::LeftButton ) {
|
|
|
|
if ( not _drawing ) {
|
|
|
|
_drawing = true;
|
|
|
|
_ruler.reset ( new Ruler
|
|
|
|
(_cellWidget->_onCursorGrid(_cellWidget->screenToDbuPoint(_cellWidget->getMousePosition())) ) );
|
|
|
|
} else {
|
|
|
|
setActive ( false );
|
|
|
|
_drawing = false;
|
2009-10-19 12:17:21 -05:00
|
|
|
_cellWidget->addRuler ( _ruler );
|
2009-12-03 05:19:54 -06:00
|
|
|
_ruler.reset ();
|
|
|
|
}
|
2009-10-19 12:17:21 -05:00
|
|
|
}
|
2009-04-15 11:09:18 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-10-19 12:17:21 -05:00
|
|
|
void RulerCommand::keyPressEvent ( QKeyEvent* event )
|
2009-04-15 11:09:18 -05:00
|
|
|
{
|
2009-12-03 05:19:54 -06:00
|
|
|
if ( isActive() and (event->key() == Qt::Key_Escape) ) {
|
2009-10-19 12:17:21 -05:00
|
|
|
setActive ( false );
|
2009-12-03 05:19:54 -06:00
|
|
|
_drawing = false;
|
2009-10-19 12:17:21 -05:00
|
|
|
_ruler.reset ();
|
2009-12-03 05:19:54 -06:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( event->key() != Qt::Key_K ) return;
|
|
|
|
|
|
|
|
if ( event->modifiers() & Qt::ShiftModifier ) {
|
|
|
|
_cellWidget->clearRulers ();
|
|
|
|
return;
|
2009-04-15 11:09:18 -05:00
|
|
|
}
|
2009-12-03 05:19:54 -06:00
|
|
|
|
|
|
|
setActive ( true );
|
2009-04-15 11:09:18 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-10-19 12:17:21 -05:00
|
|
|
void RulerCommand::draw ()
|
2009-04-15 11:09:18 -05:00
|
|
|
{
|
2009-12-03 05:19:54 -06:00
|
|
|
if ( not _drawing ) return;
|
2009-10-19 12:17:21 -05:00
|
|
|
_cellWidget->drawRuler ( _ruler );
|
2009-04-15 11:09:18 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} // End of Hurricane namespace.
|