diff --git a/hurricane/src/hurricane/Breakpoint.cpp b/hurricane/src/hurricane/Breakpoint.cpp index 401d60ae..3725ad6f 100644 --- a/hurricane/src/hurricane/Breakpoint.cpp +++ b/hurricane/src/hurricane/Breakpoint.cpp @@ -94,7 +94,6 @@ namespace Hurricane { void Breakpoint::setStopCb ( Breakpoint::StopCb_t* cb ) { - cerr << "Breakpoint::setStopCb() - " << (void*)cb << endl; _stopCb = cb; } diff --git a/hurricane/src/hviewer/BreakpointWidget.cpp b/hurricane/src/hviewer/BreakpointWidget.cpp index ed82469a..1c6ecc9b 100644 --- a/hurricane/src/hviewer/BreakpointWidget.cpp +++ b/hurricane/src/hviewer/BreakpointWidget.cpp @@ -61,11 +61,11 @@ namespace Hurricane { vLine->setFrameShadow ( QFrame::Sunken ); QGridLayout* layout = new QGridLayout (); - layout->addWidget ( ok , 0, 0, 2, 1, Qt::AlignVCenter ); - layout->addWidget ( vLine , 0, 1, 2, 1 ); - layout->addWidget ( _message , 0, 2 ); - layout->addWidget ( stopLabel , 1, 2 ); - layout->addWidget ( _stopLevel, 1, 3 ); + layout->addWidget ( _message , 0, 0 ); + layout->addWidget ( stopLabel , 1, 0 ); + layout->addWidget ( _stopLevel, 1, 1 ); + layout->addWidget ( vLine , 0, 2, 2, 1 ); + layout->addWidget ( ok , 0, 3, 2, 1, Qt::AlignVCenter ); setLayout ( layout ); connect ( ok , SIGNAL(clicked()) , this, SLOT(accept()) ); diff --git a/hurricane/src/hviewer/CMakeLists.txt b/hurricane/src/hviewer/CMakeLists.txt index e7531dab..8f45ff4b 100644 --- a/hurricane/src/hviewer/CMakeLists.txt +++ b/hurricane/src/hviewer/CMakeLists.txt @@ -4,12 +4,14 @@ include_directories ( ${HURRICANE_SOURCE_DIR}/src/hurricane ${HURRICANE_SOURCE_DIR}/src/hviewer ) - set ( mocincludes hurricane/viewer/PaletteItem.h + set ( mocincludes hurricane/viewer/HApplication.h + hurricane/viewer/PaletteItem.h hurricane/viewer/PaletteNamedItem.h hurricane/viewer/PaletteLayerItem.h hurricane/viewer/PaletteExtensionGoItem.h hurricane/viewer/PaletteWidget.h hurricane/viewer/GraphicsWidget.h + hurricane/viewer/ExceptionWidget.h hurricane/viewer/BreakpointWidget.h hurricane/viewer/DynamicLabel.h hurricane/viewer/MousePositionWidget.h @@ -27,11 +29,13 @@ hurricane/viewer/DisplayFilterWidget.h hurricane/viewer/ControllerWidget.h ) - set ( exports hurricane/viewer/ScreenUtilities.h + set ( exports hurricane/viewer/HApplication.h + hurricane/viewer/ScreenUtilities.h hurricane/viewer/DisplayStyle.h hurricane/viewer/ColorScale.h hurricane/viewer/Graphics.h hurricane/viewer/GraphicsWidget.h + hurricane/viewer/ExceptionWidget.h hurricane/viewer/BreakpointWidget.h hurricane/viewer/Selector.h hurricane/viewer/Command.h @@ -53,11 +57,13 @@ hurricane/viewer/DisplayFilterWidget.h hurricane/viewer/ControllerWidget.h ) - set ( cpps ScreenUtilities.cpp + set ( cpps HApplication.cpp + ScreenUtilities.cpp DisplayStyle.cpp ColorScale.cpp Graphics.cpp GraphicsWidget.cpp + ExceptionWidget.cpp BreakpointWidget.cpp PaletteItem.cpp PaletteNamedItem.cpp diff --git a/hurricane/src/hviewer/CellViewer.qrc b/hurricane/src/hviewer/CellViewer.qrc index fb7e6985..168c250e 100644 --- a/hurricane/src/hviewer/CellViewer.qrc +++ b/hurricane/src/hviewer/CellViewer.qrc @@ -10,5 +10,7 @@ images/gtk-go-forward-ltr.png images/swiss-knife.png images/gnome-gmush.png + images/gnome-core.png + images/i-core.png diff --git a/hurricane/src/hviewer/CellWidget.cpp b/hurricane/src/hviewer/CellWidget.cpp index 3803b157..04da5ae0 100644 --- a/hurricane/src/hviewer/CellWidget.cpp +++ b/hurricane/src/hviewer/CellWidget.cpp @@ -890,6 +890,13 @@ namespace Hurricane { } + void CellWidget::styleChange ( void* emitter ) + { + refresh (); + emit styleChanged(emitter); + } + + void CellWidget::updatePalette () { emit updatePalette(getCell()); @@ -904,6 +911,7 @@ namespace Hurricane { connect ( _palette, SIGNAL(paletteChanged()) , this , SLOT(refresh()) ); connect ( this , SIGNAL(cellChanged(Cell*)) , _palette, SLOT(updateExtensions(Cell*)) ); connect ( this , SIGNAL(updatePalette(Cell*)), _palette, SLOT(updateExtensions(Cell*)) ); + connect ( this , SIGNAL(styleChanged(void*)) , _palette, SLOT(styleChange(void*)) ); } @@ -913,6 +921,7 @@ namespace Hurricane { disconnect ( _palette, SIGNAL(paletteChanged()) , this , SLOT(refresh()) ); disconnect ( this , SIGNAL(cellChanged(Cell*)) , _palette, SLOT(updateExtensions(Cell*)) ); disconnect ( this , SIGNAL(updatePalette(Cell*)), _palette, SLOT(updateExtensions(Cell*)) ); + disconnect ( this , SIGNAL(styleChanged(void*)) , _palette, SLOT(styleChange(void*)) ); _palette = NULL; } } @@ -1094,7 +1103,7 @@ namespace Hurricane { } } - //_drawingQuery.setFilter ( _queryFilter & ~Query::DoMasterCells ); + //_drawingQuery.setFilter ( _queryFilter & ~Query::DoMasterCells ); forEach ( ExtensionSlice*, islice, _cell->getExtensionSlices() ) { QApplication::processEvents(); if ( /*timeout("redraw [extension]",timer,10.0,timedout) ||*/ (_redrawManager.interrupted()) ) break; diff --git a/hurricane/src/hviewer/ControllerWidget.cpp b/hurricane/src/hviewer/ControllerWidget.cpp index e5954233..f1071925 100644 --- a/hurricane/src/hviewer/ControllerWidget.cpp +++ b/hurricane/src/hviewer/ControllerWidget.cpp @@ -98,7 +98,7 @@ namespace Hurricane { if ( getCellWidget() != cellWidget ) { ControllerTab::setCellWidget ( cellWidget ); if ( getCellWidget() ) { - connect ( _graphics, SIGNAL(styleChanged()), getCellWidget(), SLOT(refresh()) ); + connect ( _graphics, SIGNAL(styleChanged(void*)), getCellWidget(), SLOT(styleChange(void*)) ); } } } diff --git a/hurricane/src/hviewer/GraphicsWidget.cpp b/hurricane/src/hviewer/GraphicsWidget.cpp index 7640bb84..5fd13f3d 100644 --- a/hurricane/src/hviewer/GraphicsWidget.cpp +++ b/hurricane/src/hviewer/GraphicsWidget.cpp @@ -79,15 +79,15 @@ namespace Hurricane { wLayout->addStretch (); setLayout ( wLayout ); - connect ( group, SIGNAL(buttonClicked(int)), this, SLOT(styleChanged(int)) ); + connect ( group, SIGNAL(buttonClicked(int)), this, SLOT(styleChange(int)) ); } - void GraphicsWidget::styleChanged ( int id ) + void GraphicsWidget::styleChange ( int id ) { Graphics::setStyle ( (size_t)id ); //cerr << "GraphicsWidget::setStyle() - " << getString(Graphics::getStyle()->getName()) << endl; - emit styleChanged (); + emit styleChanged ( (void*)this ); } diff --git a/hurricane/src/hviewer/HApplication.cpp b/hurricane/src/hviewer/HApplication.cpp new file mode 100644 index 00000000..a3b90fcb --- /dev/null +++ b/hurricane/src/hviewer/HApplication.cpp @@ -0,0 +1,102 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved +// +// =================================================================== +// +// $Id$ +// +// x-----------------------------------------------------------------x +// | | +// | C O R I O L I S | +// | U n i c o r n - M a i n G U I | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | =============================================================== | +// | C++ Module : "./HApplication.cpp" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + + +#include +#include + +#include "hurricane/Error.h" +#include "hurricane/viewer/ExceptionWidget.h" +#include "hurricane/viewer/HApplication.h" + + +namespace Hurricane { + + + using std::cerr; + using std::endl; + using std::exception; + + +// ------------------------------------------------------------------- +// Class : "HApplication". + + + HApplication::HApplication ( int& argc, char** argv ) + : QApplication ( argc, argv ) + { } + + + HApplication::HApplication ( int& argc, char** argv, bool GUIenabled ) + : QApplication ( argc, argv, GUIenabled ) + { } + + + HApplication::HApplication ( int& argc, char** argv, Type type ) + : QApplication ( argc, argv, type ) + { } + + + HApplication::HApplication ( Display* display, Qt::HANDLE visual, Qt::HANDLE colormap ) + : QApplication ( display, visual, colormap ) + { } + + + HApplication::HApplication ( Display* display, int& argc, char** argv, Qt::HANDLE visual, Qt::HANDLE colormap ) + : QApplication ( display, argc, argv, visual, colormap ) + { } + + + bool HApplication::notify ( QObject* object, QEvent* event ) + { + try { + return QApplication::notify ( object, event ); + } + catch ( Error& e ) { + ExceptionWidget* ew = new ExceptionWidget (); + ew->setMessage ( e.getReason().c_str() ); + if ( ew->exec() == QDialog::Rejected ) + kill ( getpid(), SIGSEGV ); + } + catch ( exception& e ) { + ExceptionWidget* ew = new ExceptionWidget (); + ew->setMessage ( e.what() ); + if ( ew->exec() == QDialog::Rejected ) + kill ( getpid(), SIGSEGV ); + } + catch ( ... ) { + static const char* message = + "  Unmanaged exception, neither a Hurricane::Error
" + "nor a std::exception."; + + ExceptionWidget* ew = new ExceptionWidget (); + ew->setMessage ( message ); + if ( ew->exec() == QDialog::Rejected ) + kill ( getpid(), SIGSEGV ); + } + return true; + } + + +} // End of Hurricane namespace. diff --git a/hurricane/src/hviewer/PaletteItem.cpp b/hurricane/src/hviewer/PaletteItem.cpp index aa467969..e05f8c59 100644 --- a/hurricane/src/hviewer/PaletteItem.cpp +++ b/hurricane/src/hviewer/PaletteItem.cpp @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved // // =================================================================== // @@ -59,6 +59,8 @@ namespace Hurricane { painter.setPen ( Graphics::getPen (_entry->getName()) ); painter.setBrush ( Graphics::getBrush(_entry->getName()) ); painter.drawRect ( 2, 2, 16, 16 ); + + update (); } @@ -88,4 +90,10 @@ namespace Hurricane { { } + void PaletteItem::styleChange () + { + emit styleChanged (); + } + + } // End of Hurricane namespace. diff --git a/hurricane/src/hviewer/PaletteLayerItem.cpp b/hurricane/src/hviewer/PaletteLayerItem.cpp index e791aa9d..18275869 100644 --- a/hurricane/src/hviewer/PaletteLayerItem.cpp +++ b/hurricane/src/hviewer/PaletteLayerItem.cpp @@ -43,7 +43,9 @@ namespace Hurricane { { QHBoxLayout* layout = new QHBoxLayout (); layout->setContentsMargins ( 0, 0, 0, 0 ); - layout->addWidget ( new DrawingStyleSample(this) ); + + DrawingStyleSample* sample = new DrawingStyleSample(this); + layout->addWidget ( sample ); _visible->setChecked ( visible ); _visible->setText ( getString(getName()).c_str() ); @@ -61,8 +63,9 @@ namespace Hurricane { setLayout ( layout ); - connect ( _visible , SIGNAL(clicked()), this, SIGNAL(visibleToggled ()) ); - connect ( _selectable, SIGNAL(clicked()), this, SIGNAL(selectableToggled()) ); + connect ( this , SIGNAL(styleChanged()), sample, SLOT (redraw ()) ); + connect ( _visible , SIGNAL(clicked ()), this , SIGNAL(visibleToggled ()) ); + connect ( _selectable, SIGNAL(clicked ()), this , SIGNAL(selectableToggled()) ); } diff --git a/hurricane/src/hviewer/PaletteWidget.cpp b/hurricane/src/hviewer/PaletteWidget.cpp index 59bbcda9..e2b6d4d3 100644 --- a/hurricane/src/hviewer/PaletteWidget.cpp +++ b/hurricane/src/hviewer/PaletteWidget.cpp @@ -377,4 +377,18 @@ namespace Hurricane { } + void PaletteWidget::styleChange ( void* emitter ) + { + if ( emitter == this ) return; + + PaletteItems::iterator iitem = _layerItems.begin(); + for ( ; iitem != _layerItems.end() ; iitem++ ) + iitem->second->styleChange (); + + iitem = _extensionGoItems.begin(); + for ( ; iitem != _extensionGoItems.end() ; iitem++ ) + iitem->second->styleChange (); + } + + } // End of Hurricane namespace. diff --git a/hurricane/src/hviewer/hurricane/viewer/CellWidget.h b/hurricane/src/hviewer/hurricane/viewer/CellWidget.h index f5d90333..6967d569 100644 --- a/hurricane/src/hviewer/hurricane/viewer/CellWidget.h +++ b/hurricane/src/hviewer/hurricane/viewer/CellWidget.h @@ -187,6 +187,7 @@ namespace Hurricane { void cellPreModificated (); void cellPostModificated (); void settingsChanged (); + void styleChanged ( void* emitter ); void updatePalette ( Cell* ); void mousePositionChanged ( const Point& position ); void selectionChanged ( const SelectorSet&, Cell* ); @@ -211,6 +212,7 @@ namespace Hurricane { void _selectOccurrencesUnder ( Box selectArea ); void _unselectAll ( bool delayRedraw ); void rubberChange (); + void styleChange ( void* emitter ); void updatePalette (); void cellPreModificate (); void cellPostModificate (); diff --git a/hurricane/src/hviewer/hurricane/viewer/GraphicsWidget.h b/hurricane/src/hviewer/hurricane/viewer/GraphicsWidget.h index 65356d37..68b6588f 100644 --- a/hurricane/src/hviewer/hurricane/viewer/GraphicsWidget.h +++ b/hurricane/src/hviewer/hurricane/viewer/GraphicsWidget.h @@ -39,9 +39,9 @@ namespace Hurricane { public: GraphicsWidget ( QWidget* parent=NULL ); signals: - void styleChanged (); + void styleChanged ( void* emitter ); public slots: - void styleChanged ( int id ); + void styleChange ( int id ); }; diff --git a/hurricane/src/hviewer/hurricane/viewer/HApplication.h b/hurricane/src/hviewer/hurricane/viewer/HApplication.h new file mode 100644 index 00000000..dbe0faf3 --- /dev/null +++ b/hurricane/src/hviewer/hurricane/viewer/HApplication.h @@ -0,0 +1,54 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved +// +// =================================================================== +// +// $Id$ +// +// x-----------------------------------------------------------------x +// | | +// | C O R I O L I S | +// | U n i c o r n - M a i n G U I | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | =============================================================== | +// | C++ Header : "./HApplication.h" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + + + + +#ifndef __HURRICANE_HAPPLICATION__ +#define __HURRICANE_HAPPLICATION__ + +#include + + +namespace Hurricane { + + + class HApplication : public QApplication { + Q_OBJECT; + + public: + HApplication ( int& argc, char** argv ); + HApplication ( int& argc, char** argv, bool GUIenabled ); + HApplication ( int& argc, char** argv, Type type ); + HApplication ( Display*, Qt::HANDLE visual=0, Qt::HANDLE colormap=0 ); + HApplication ( Display*, int& argc, char** argv, Qt::HANDLE visual=0, Qt::HANDLE colormap=0 ); + virtual bool notify ( QObject*, QEvent* ); + }; + + +} // End of Hurricane namespace. + + +#endif // __HURRICANE_HAPPLICATION__ + diff --git a/hurricane/src/hviewer/hurricane/viewer/PaletteItem.h b/hurricane/src/hviewer/hurricane/viewer/PaletteItem.h index e57b0920..bfbc28b7 100644 --- a/hurricane/src/hviewer/hurricane/viewer/PaletteItem.h +++ b/hurricane/src/hviewer/hurricane/viewer/PaletteItem.h @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved // // =================================================================== // @@ -55,7 +55,7 @@ namespace Hurricane { protected: QPixmap _sample; PaletteItem* _entry; - protected: + protected slots: void redraw (); void paintEvent ( QPaintEvent* ); }; @@ -74,10 +74,12 @@ namespace Hurricane { virtual bool isItemSelectable () const; virtual void setItemVisible ( bool ) = 0; virtual void setItemSelectable ( bool ); + public slots: + virtual void styleChange (); signals: + void styleChanged (); void visibleToggled (); void selectableToggled (); - protected: PaletteItem (); PaletteItem ( const PaletteItem& ); diff --git a/hurricane/src/hviewer/hurricane/viewer/PaletteWidget.h b/hurricane/src/hviewer/hurricane/viewer/PaletteWidget.h index 0938571c..fc2d12df 100644 --- a/hurricane/src/hviewer/hurricane/viewer/PaletteWidget.h +++ b/hurricane/src/hviewer/hurricane/viewer/PaletteWidget.h @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved // // =================================================================== // @@ -68,6 +68,7 @@ namespace Hurricane { void updateExtensions ( Cell* cell ); void showAll (); void hideAll (); + void styleChange ( void* emitter ); protected: PaletteItems _layerItems; diff --git a/hurricane/src/hviewer/images/gnome-core.png b/hurricane/src/hviewer/images/gnome-core.png new file mode 100644 index 00000000..05ffbd80 Binary files /dev/null and b/hurricane/src/hviewer/images/gnome-core.png differ diff --git a/hurricane/src/hviewer/images/i-core.png b/hurricane/src/hviewer/images/i-core.png new file mode 100644 index 00000000..12289072 Binary files /dev/null and b/hurricane/src/hviewer/images/i-core.png differ