2008-08-29 04:32:52 -05:00
|
|
|
// -*- C++ -*-
|
|
|
|
//
|
2008-11-26 03:35:07 -06:00
|
|
|
// This file is part of the Coriolis Software.
|
2018-01-06 10:55:44 -06:00
|
|
|
// Copyright (c) UPMC 2008-2018, All Rights Reserved
|
2008-08-29 04:32:52 -05:00
|
|
|
//
|
2012-12-31 05:52:42 -06:00
|
|
|
// +-----------------------------------------------------------------+
|
2008-08-29 04:32:52 -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 |
|
|
|
|
// | =============================================================== |
|
2008-11-26 03:35:07 -06:00
|
|
|
// | C++ Module : "./GraphicsWidget.cpp" |
|
2012-12-31 05:52:42 -06:00
|
|
|
// +-----------------------------------------------------------------+
|
2008-08-29 04:32:52 -05:00
|
|
|
|
|
|
|
|
2015-06-06 11:41:28 -05:00
|
|
|
#include <QLabel>
|
|
|
|
#include <QRadioButton>
|
|
|
|
#include <QButtonGroup>
|
|
|
|
#include <QGroupBox>
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
#include <QGridLayout>
|
|
|
|
#include "hurricane/viewer/Graphics.h"
|
|
|
|
#include "hurricane/viewer/DisplayStyle.h"
|
|
|
|
#include "hurricane/viewer/GraphicsWidget.h"
|
2008-08-29 04:32:52 -05:00
|
|
|
|
|
|
|
|
|
|
|
namespace Hurricane {
|
|
|
|
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
2008-11-26 03:35:07 -06:00
|
|
|
// Class : "GraphicsWidget".
|
2008-08-29 04:32:52 -05:00
|
|
|
|
|
|
|
|
2008-11-26 03:35:07 -06:00
|
|
|
GraphicsWidget::GraphicsWidget ( QWidget* parent )
|
2009-02-03 09:05:05 -06:00
|
|
|
: QWidget (parent)
|
|
|
|
, _cellWidget (NULL)
|
Implementation of DataBase native save/restore in JSON (step 3).
* Test: post-receive hook on server should send mail [1].
* New: In VLSISAPD, in Parameter, callback have now a tag, which the
pointer to the caller. This allow for the callback removal when
the caller is destroyed.
* New: In VLSISAPD, in WidgetDescription, when associated to a parameter,
the destructor must remove the associated callback function on
the Parameter.
* New: In Hurricane, added JSON support for Configuration, separated
from vlsisapd, as the support is not available at this point.
JSON support for Configuration, Parameter & LayoutDescription.
* Change: In Hurricane, in JsonStack, the stack of JsonObjects has been
displaced here from HurricaneHandler. This way, all
JsonObject::toData() can access the JsonOjects in the context
of the parser.
* New: In Hurricane, in DBo::toJson() added support for Entity by
reference (ids).
* New: In Hurricane, added JSON support for all Layer sub-class types.
* New: In Hurricane, in Technology, export the Layers, but must be
sorted by increasing mask value.
* New: In Hurricane, in Entity, added support for Entity by reference (ids).
* New: In Hurricane, in DataBase, added technology full support.
* New: In Hurricane, In JsonNet, move the ring rebuild management from
JsonStack to JsonNet.
* New: In Hurricane, added JSON support for NetAlias, NetExternalcomponents
(not cleanly implemented as a Relation).
* New: In Hurricane, new method Cell::fromJson() to load a cell from
a JSON file.
* New: In Hurricane, In Graphics, make it an observable, for when JSON
fully reload the graphic state, it must be able to notify other
objects (namely the Controller).
* New: In Hurricane, in ControllerWidget, observe the Graphics to regenerate
the palette as needed. New method ControllerTab::graphicsUpdated().
* New: In Hurricane, in RawDrawingStyle added a destructor to release the
Qt pen/brush. Added JSON support for HSVr, DrawingStyle, DrawingGroup,
& DisplayStyle.
* New: In Hurricane, in GraphicsWidget, rewrite correctly the readGraphics()
to erase the previous widgets and re-create the new ones.
* New: In Hurricane, in PaletteWidget, correct re-creation of the layout/widgets
in case of Graphics change.
* New: In CRL Core, in System, register the parameters callbacks with
the address of the object, for later deletion.
* New: In CRL Core, in AllianceFramework, make it observable, to notify
library changes. For the AllianceFramework creation, now allow to
completly bypass the Python initialization system, when we expect
to restore it from a full blob. Added methods to sets the default
RoutingGauge & CellGauge.
* New: In CRL Core, added JSON suppport for CellGauge, RoutingLayerGauge
& RoutingGauge.
* New: In CRL Core, in LibraryManager, oberver AllianceFramework, to update
the list of libraries in case of change (for JSON full reload).
2016-02-20 14:24:44 -06:00
|
|
|
, _stylesGrid (new QGridLayout())
|
|
|
|
, _stylesGroup(new QButtonGroup())
|
2009-02-03 09:05:05 -06:00
|
|
|
, _updateState(ExternalEmit)
|
2008-08-29 04:32:52 -05:00
|
|
|
{
|
|
|
|
setAttribute ( Qt::WA_QuitOnClose, false );
|
|
|
|
setWindowTitle ( tr("Display Styles") );
|
|
|
|
setFont ( Graphics::getNormalFont(true) );
|
|
|
|
|
|
|
|
QGroupBox* groupBox = new QGroupBox ( tr("Display Styles") );
|
2008-11-26 03:35:07 -06:00
|
|
|
QVBoxLayout* wLayout = new QVBoxLayout ();
|
2008-08-29 04:32:52 -05:00
|
|
|
|
Implementation of DataBase native save/restore in JSON (step 3).
* Test: post-receive hook on server should send mail [1].
* New: In VLSISAPD, in Parameter, callback have now a tag, which the
pointer to the caller. This allow for the callback removal when
the caller is destroyed.
* New: In VLSISAPD, in WidgetDescription, when associated to a parameter,
the destructor must remove the associated callback function on
the Parameter.
* New: In Hurricane, added JSON support for Configuration, separated
from vlsisapd, as the support is not available at this point.
JSON support for Configuration, Parameter & LayoutDescription.
* Change: In Hurricane, in JsonStack, the stack of JsonObjects has been
displaced here from HurricaneHandler. This way, all
JsonObject::toData() can access the JsonOjects in the context
of the parser.
* New: In Hurricane, in DBo::toJson() added support for Entity by
reference (ids).
* New: In Hurricane, added JSON support for all Layer sub-class types.
* New: In Hurricane, in Technology, export the Layers, but must be
sorted by increasing mask value.
* New: In Hurricane, in Entity, added support for Entity by reference (ids).
* New: In Hurricane, in DataBase, added technology full support.
* New: In Hurricane, In JsonNet, move the ring rebuild management from
JsonStack to JsonNet.
* New: In Hurricane, added JSON support for NetAlias, NetExternalcomponents
(not cleanly implemented as a Relation).
* New: In Hurricane, new method Cell::fromJson() to load a cell from
a JSON file.
* New: In Hurricane, In Graphics, make it an observable, for when JSON
fully reload the graphic state, it must be able to notify other
objects (namely the Controller).
* New: In Hurricane, in ControllerWidget, observe the Graphics to regenerate
the palette as needed. New method ControllerTab::graphicsUpdated().
* New: In Hurricane, in RawDrawingStyle added a destructor to release the
Qt pen/brush. Added JSON support for HSVr, DrawingStyle, DrawingGroup,
& DisplayStyle.
* New: In Hurricane, in GraphicsWidget, rewrite correctly the readGraphics()
to erase the previous widgets and re-create the new ones.
* New: In Hurricane, in PaletteWidget, correct re-creation of the layout/widgets
in case of Graphics change.
* New: In CRL Core, in System, register the parameters callbacks with
the address of the object, for later deletion.
* New: In CRL Core, in AllianceFramework, make it observable, to notify
library changes. For the AllianceFramework creation, now allow to
completly bypass the Python initialization system, when we expect
to restore it from a full blob. Added methods to sets the default
RoutingGauge & CellGauge.
* New: In CRL Core, added JSON suppport for CellGauge, RoutingLayerGauge
& RoutingGauge.
* New: In CRL Core, in LibraryManager, oberver AllianceFramework, to update
the list of libraries in case of change (for JSON full reload).
2016-02-20 14:24:44 -06:00
|
|
|
if (Graphics::isHighDpi()) _stylesGrid->setContentsMargins( 30, 30, 30, 30 );
|
|
|
|
|
|
|
|
groupBox->setLayout ( _stylesGrid );
|
|
|
|
wLayout->addWidget ( groupBox );
|
|
|
|
wLayout->addStretch ();
|
|
|
|
setLayout ( wLayout );
|
|
|
|
|
|
|
|
connect ( _stylesGroup, SIGNAL(buttonClicked(int)), this, SLOT(setStyle(int)) );
|
|
|
|
|
|
|
|
readGraphics ();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GraphicsWidget::readGraphics ()
|
|
|
|
{
|
|
|
|
const vector<DisplayStyle*>& styles = Graphics::getStyles ();
|
|
|
|
DisplayStyle* activeStyle = Graphics::getStyle ();
|
2008-08-29 04:32:52 -05:00
|
|
|
|
|
|
|
size_t hideFallback = (styles.size() > 1) ? 1 : 0;
|
|
|
|
for ( size_t istyle=hideFallback ; istyle < styles.size() ; istyle++ ) {
|
|
|
|
QRadioButton* button = new QRadioButton ();
|
|
|
|
button->setText ( getString(styles[istyle]->getName()).c_str() );
|
|
|
|
if ( activeStyle == styles[istyle] )
|
|
|
|
button->setChecked ( true );
|
|
|
|
QLabel* label = new QLabel ();
|
|
|
|
label->setText ( styles[istyle]->getDescription().c_str() );
|
|
|
|
label->setFont ( Graphics::getNormalFont() );
|
|
|
|
|
Implementation of DataBase native save/restore in JSON (step 3).
* Test: post-receive hook on server should send mail [1].
* New: In VLSISAPD, in Parameter, callback have now a tag, which the
pointer to the caller. This allow for the callback removal when
the caller is destroyed.
* New: In VLSISAPD, in WidgetDescription, when associated to a parameter,
the destructor must remove the associated callback function on
the Parameter.
* New: In Hurricane, added JSON support for Configuration, separated
from vlsisapd, as the support is not available at this point.
JSON support for Configuration, Parameter & LayoutDescription.
* Change: In Hurricane, in JsonStack, the stack of JsonObjects has been
displaced here from HurricaneHandler. This way, all
JsonObject::toData() can access the JsonOjects in the context
of the parser.
* New: In Hurricane, in DBo::toJson() added support for Entity by
reference (ids).
* New: In Hurricane, added JSON support for all Layer sub-class types.
* New: In Hurricane, in Technology, export the Layers, but must be
sorted by increasing mask value.
* New: In Hurricane, in Entity, added support for Entity by reference (ids).
* New: In Hurricane, in DataBase, added technology full support.
* New: In Hurricane, In JsonNet, move the ring rebuild management from
JsonStack to JsonNet.
* New: In Hurricane, added JSON support for NetAlias, NetExternalcomponents
(not cleanly implemented as a Relation).
* New: In Hurricane, new method Cell::fromJson() to load a cell from
a JSON file.
* New: In Hurricane, In Graphics, make it an observable, for when JSON
fully reload the graphic state, it must be able to notify other
objects (namely the Controller).
* New: In Hurricane, in ControllerWidget, observe the Graphics to regenerate
the palette as needed. New method ControllerTab::graphicsUpdated().
* New: In Hurricane, in RawDrawingStyle added a destructor to release the
Qt pen/brush. Added JSON support for HSVr, DrawingStyle, DrawingGroup,
& DisplayStyle.
* New: In Hurricane, in GraphicsWidget, rewrite correctly the readGraphics()
to erase the previous widgets and re-create the new ones.
* New: In Hurricane, in PaletteWidget, correct re-creation of the layout/widgets
in case of Graphics change.
* New: In CRL Core, in System, register the parameters callbacks with
the address of the object, for later deletion.
* New: In CRL Core, in AllianceFramework, make it observable, to notify
library changes. For the AllianceFramework creation, now allow to
completly bypass the Python initialization system, when we expect
to restore it from a full blob. Added methods to sets the default
RoutingGauge & CellGauge.
* New: In CRL Core, added JSON suppport for CellGauge, RoutingLayerGauge
& RoutingGauge.
* New: In CRL Core, in LibraryManager, oberver AllianceFramework, to update
the list of libraries in case of change (for JSON full reload).
2016-02-20 14:24:44 -06:00
|
|
|
_stylesGrid ->addWidget ( button, istyle-hideFallback, 0 );
|
|
|
|
_stylesGrid ->addWidget ( label , istyle-hideFallback, 1 );
|
|
|
|
_stylesGroup->addButton ( button, istyle );
|
2008-08-29 04:32:52 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-02-03 09:05:05 -06:00
|
|
|
void GraphicsWidget::setCellWidget ( CellWidget* cw )
|
2008-08-29 04:32:52 -05:00
|
|
|
{
|
2009-02-03 09:05:05 -06:00
|
|
|
if ( _cellWidget ) {
|
|
|
|
disconnect ( _cellWidget, 0, this , 0 );
|
|
|
|
disconnect ( this , 0, _cellWidget, 0 );
|
|
|
|
}
|
|
|
|
|
|
|
|
_cellWidget = cw;
|
|
|
|
if ( !_cellWidget ) return;
|
|
|
|
|
|
|
|
connect ( _cellWidget, SIGNAL(styleChanged()), this, SLOT(changeStyle()) );
|
|
|
|
|
|
|
|
_updateState = ExternalEmit;
|
|
|
|
changeStyle ();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GraphicsWidget::changeStyle ()
|
|
|
|
{
|
|
|
|
if ( _updateState != InternalEmit ) {
|
|
|
|
// Should read style here and sets the widget accordingly.
|
|
|
|
}
|
|
|
|
_updateState = ExternalEmit;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GraphicsWidget::setStyle ( int id )
|
|
|
|
{
|
|
|
|
if ( _cellWidget ) {
|
|
|
|
_updateState = InternalEmit;
|
|
|
|
_cellWidget->setStyle ( (size_t)id );
|
|
|
|
}
|
2008-08-29 04:32:52 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
Implementation of DataBase native save/restore in JSON (step 3).
* Test: post-receive hook on server should send mail [1].
* New: In VLSISAPD, in Parameter, callback have now a tag, which the
pointer to the caller. This allow for the callback removal when
the caller is destroyed.
* New: In VLSISAPD, in WidgetDescription, when associated to a parameter,
the destructor must remove the associated callback function on
the Parameter.
* New: In Hurricane, added JSON support for Configuration, separated
from vlsisapd, as the support is not available at this point.
JSON support for Configuration, Parameter & LayoutDescription.
* Change: In Hurricane, in JsonStack, the stack of JsonObjects has been
displaced here from HurricaneHandler. This way, all
JsonObject::toData() can access the JsonOjects in the context
of the parser.
* New: In Hurricane, in DBo::toJson() added support for Entity by
reference (ids).
* New: In Hurricane, added JSON support for all Layer sub-class types.
* New: In Hurricane, in Technology, export the Layers, but must be
sorted by increasing mask value.
* New: In Hurricane, in Entity, added support for Entity by reference (ids).
* New: In Hurricane, in DataBase, added technology full support.
* New: In Hurricane, In JsonNet, move the ring rebuild management from
JsonStack to JsonNet.
* New: In Hurricane, added JSON support for NetAlias, NetExternalcomponents
(not cleanly implemented as a Relation).
* New: In Hurricane, new method Cell::fromJson() to load a cell from
a JSON file.
* New: In Hurricane, In Graphics, make it an observable, for when JSON
fully reload the graphic state, it must be able to notify other
objects (namely the Controller).
* New: In Hurricane, in ControllerWidget, observe the Graphics to regenerate
the palette as needed. New method ControllerTab::graphicsUpdated().
* New: In Hurricane, in RawDrawingStyle added a destructor to release the
Qt pen/brush. Added JSON support for HSVr, DrawingStyle, DrawingGroup,
& DisplayStyle.
* New: In Hurricane, in GraphicsWidget, rewrite correctly the readGraphics()
to erase the previous widgets and re-create the new ones.
* New: In Hurricane, in PaletteWidget, correct re-creation of the layout/widgets
in case of Graphics change.
* New: In CRL Core, in System, register the parameters callbacks with
the address of the object, for later deletion.
* New: In CRL Core, in AllianceFramework, make it observable, to notify
library changes. For the AllianceFramework creation, now allow to
completly bypass the Python initialization system, when we expect
to restore it from a full blob. Added methods to sets the default
RoutingGauge & CellGauge.
* New: In CRL Core, added JSON suppport for CellGauge, RoutingLayerGauge
& RoutingGauge.
* New: In CRL Core, in LibraryManager, oberver AllianceFramework, to update
the list of libraries in case of change (for JSON full reload).
2016-02-20 14:24:44 -06:00
|
|
|
void GraphicsWidget::resetGraphics ()
|
|
|
|
{
|
|
|
|
QLayoutItem* child = NULL;
|
|
|
|
while ( (child = _stylesGrid->takeAt(0)) != 0 ) {
|
|
|
|
_stylesGrid->removeWidget( child->widget() );
|
|
|
|
delete child->widget();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GraphicsWidget::rereadGraphics ()
|
|
|
|
{
|
|
|
|
resetGraphics();
|
|
|
|
readGraphics();
|
|
|
|
//setStyle( 0 );
|
|
|
|
}
|
|
|
|
|
2008-08-29 04:32:52 -05:00
|
|
|
|
Implementation of DataBase native save/restore in JSON (step 3).
* Test: post-receive hook on server should send mail [1].
* New: In VLSISAPD, in Parameter, callback have now a tag, which the
pointer to the caller. This allow for the callback removal when
the caller is destroyed.
* New: In VLSISAPD, in WidgetDescription, when associated to a parameter,
the destructor must remove the associated callback function on
the Parameter.
* New: In Hurricane, added JSON support for Configuration, separated
from vlsisapd, as the support is not available at this point.
JSON support for Configuration, Parameter & LayoutDescription.
* Change: In Hurricane, in JsonStack, the stack of JsonObjects has been
displaced here from HurricaneHandler. This way, all
JsonObject::toData() can access the JsonOjects in the context
of the parser.
* New: In Hurricane, in DBo::toJson() added support for Entity by
reference (ids).
* New: In Hurricane, added JSON support for all Layer sub-class types.
* New: In Hurricane, in Technology, export the Layers, but must be
sorted by increasing mask value.
* New: In Hurricane, in Entity, added support for Entity by reference (ids).
* New: In Hurricane, in DataBase, added technology full support.
* New: In Hurricane, In JsonNet, move the ring rebuild management from
JsonStack to JsonNet.
* New: In Hurricane, added JSON support for NetAlias, NetExternalcomponents
(not cleanly implemented as a Relation).
* New: In Hurricane, new method Cell::fromJson() to load a cell from
a JSON file.
* New: In Hurricane, In Graphics, make it an observable, for when JSON
fully reload the graphic state, it must be able to notify other
objects (namely the Controller).
* New: In Hurricane, in ControllerWidget, observe the Graphics to regenerate
the palette as needed. New method ControllerTab::graphicsUpdated().
* New: In Hurricane, in RawDrawingStyle added a destructor to release the
Qt pen/brush. Added JSON support for HSVr, DrawingStyle, DrawingGroup,
& DisplayStyle.
* New: In Hurricane, in GraphicsWidget, rewrite correctly the readGraphics()
to erase the previous widgets and re-create the new ones.
* New: In Hurricane, in PaletteWidget, correct re-creation of the layout/widgets
in case of Graphics change.
* New: In CRL Core, in System, register the parameters callbacks with
the address of the object, for later deletion.
* New: In CRL Core, in AllianceFramework, make it observable, to notify
library changes. For the AllianceFramework creation, now allow to
completly bypass the Python initialization system, when we expect
to restore it from a full blob. Added methods to sets the default
RoutingGauge & CellGauge.
* New: In CRL Core, added JSON suppport for CellGauge, RoutingLayerGauge
& RoutingGauge.
* New: In CRL Core, in LibraryManager, oberver AllianceFramework, to update
the list of libraries in case of change (for JSON full reload).
2016-02-20 14:24:44 -06:00
|
|
|
} // Hurricane namespace.
|