From 716662a4c2bfe9c0ef8cdc7943bcec0c4ec4f2d7 Mon Sep 17 00:00:00 2001 From: nds Date: Tue, 7 Oct 2008 03:35:00 +0000 Subject: [PATCH] Merging GUI_SRC module with the BR_HDF_dev_merged branch, which has been merged with the BR_V5_DEV branch. --- src/LogWindow/LogWindow.cxx | 16 +- src/LogWindow/LogWindow.h | 10 +- src/ObjBrowser/OB_Browser.cxx | 24 +- src/ObjBrowser/OB_Browser.h | 2 + src/Plot2d/Plot2d_SetupViewDlg.cxx | 16 + src/Plot2d/Plot2d_SetupViewDlg.h | 2 + src/Plot2d/Plot2d_ViewManager.cxx | 25 +- src/Plot2d/Plot2d_ViewManager.h | 2 + src/Plot2d/Plot2d_ViewModel.cxx | 31 +- src/Plot2d/Plot2d_ViewModel.h | 9 +- src/Plot2d/Plot2d_ViewWindow.cxx | 160 +++++---- src/Plot2d/Plot2d_ViewWindow.h | 31 +- src/Plot2d/resources/plot2d_legend.png | Bin 308 -> 789 bytes src/Plot2d/resources/plot2d_linear.png | Bin 281 -> 788 bytes src/Plot2d/resources/plot2d_linear_y.png | Bin 289 -> 777 bytes src/Plot2d/resources/plot2d_lines.png | Bin 299 -> 407 bytes src/Plot2d/resources/plot2d_log.png | Bin 288 -> 720 bytes src/Plot2d/resources/plot2d_log_y.png | Bin 280 -> 743 bytes src/Plot2d/resources/plot2d_points.png | Bin 272 -> 342 bytes src/Plot2d/resources/plot2d_settings.png | Bin 313 -> 763 bytes src/Plot2d/resources/plot2d_splines.png | Bin 289 -> 431 bytes src/PyConsole/PyConsole_Editor.cxx | 14 +- src/PyConsole/PyConsole_Interp.cxx | 10 + src/PyInterp/PyInterp.pro | 4 +- src/PyInterp/PyInterp_Dispatcher.cxx | 19 +- src/PyInterp/PyInterp_Dispatcher.h | 5 +- src/Qtx/QtxActionGroup.cxx | 361 ++++++++++++++++++++ src/Qtx/QtxActionGroup.h | 82 +++++ src/Qtx/QtxMenu.cxx | 409 +++++++++++++++++++++++ src/Qtx/QtxMenu.h | 76 +++++ src/Qtx/QtxRubberBand.cxx | 313 +++++++++++++++++ src/Qtx/QtxRubberBand.h | 89 +++++ src/Qtx/QtxTranslator.cxx | 78 +++++ src/Qtx/QtxTranslator.h | 35 ++ 34 files changed, 1687 insertions(+), 136 deletions(-) create mode 100644 src/Qtx/QtxActionGroup.cxx create mode 100644 src/Qtx/QtxActionGroup.h create mode 100644 src/Qtx/QtxMenu.cxx create mode 100644 src/Qtx/QtxMenu.h create mode 100755 src/Qtx/QtxRubberBand.cxx create mode 100755 src/Qtx/QtxRubberBand.h create mode 100644 src/Qtx/QtxTranslator.cxx create mode 100644 src/Qtx/QtxTranslator.h diff --git a/src/LogWindow/LogWindow.cxx b/src/LogWindow/LogWindow.cxx index fb6ef862d..ab0a237d9 100755 --- a/src/LogWindow/LogWindow.cxx +++ b/src/LogWindow/LogWindow.cxx @@ -19,9 +19,9 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File : LogWindow.cxx -// Author : Vadim SANDLER, Open CASCADE S.A. (vadim.sandler@opencascade.com) -// Module : SALOME +// File : LogWindow.cxx +// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) +// #include "LogWindow.h" @@ -87,12 +87,12 @@ static QString plainText( const QString& richText ) \param parent parent widget */ LogWindow::LogWindow( QWidget* parent ) -: QFrame( parent ), +: QWidget( parent ), SUIT_PopupClient() { SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); - QString fntSet = resMgr ? resMgr->stringValue( "Log Window", "font", QString::null ) : QString::null; + QString fntSet = resMgr ? resMgr->stringValue( "Log Window", "font", QString() ) : QString(); setFont( SUIT_Tools::stringToFont( fntSet ) ); @@ -101,7 +101,7 @@ LogWindow::LogWindow( QWidget* parent ) myView->viewport()->installEventFilter( this ); QVBoxLayout* main = new QVBoxLayout( this ); - main->setMargin( 5 ); + main->setMargin( 0 ); main->addWidget( myView ); myBannerSize = 0; @@ -178,7 +178,7 @@ bool LogWindow::eventFilter( QObject* o, QEvent* e ) contextMenuRequest( (QContextMenuEvent*)e ); return true; } - return QFrame::eventFilter( o, e ); + return QWidget::eventFilter( o, e ); } /*! @@ -354,7 +354,7 @@ void LogWindow::onSaveToFile() return; // call application-specific "Save file" dialog box - QString aName = app->getFileName( false, QString::null, QString( "*.log" ), QString::null, 0 ); + QString aName = app->getFileName( false, QString(), QString( "*.log" ), QString(), 0 ); if ( aName.isNull() ) return; diff --git a/src/LogWindow/LogWindow.h b/src/LogWindow/LogWindow.h index b1816f8c8..3461d0a68 100755 --- a/src/LogWindow/LogWindow.h +++ b/src/LogWindow/LogWindow.h @@ -19,9 +19,9 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File : LogWindow.h -// Author : Vadim SANDLER, Open CASCADE S.A. (vadim.sandler@opencascade.com) -// Module : SALOME +// File : LogWindow.h +// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) +// #ifndef LOGWINDOW_H #define LOGWINDOW_H @@ -38,7 +38,7 @@ #include -#include +#include #include #include @@ -49,7 +49,7 @@ class QAction; class QTextEdit; -class LOGWINDOW_EXPORT LogWindow : public QFrame, public SUIT_PopupClient +class LOGWINDOW_EXPORT LogWindow : public QWidget, public SUIT_PopupClient { Q_OBJECT diff --git a/src/ObjBrowser/OB_Browser.cxx b/src/ObjBrowser/OB_Browser.cxx index 57e90af4d..e2d0f0b73 100755 --- a/src/ObjBrowser/OB_Browser.cxx +++ b/src/ObjBrowser/OB_Browser.cxx @@ -37,6 +37,7 @@ #include #include #include +#include #include @@ -456,7 +457,26 @@ void OB_Browser::setOpen( const QModelIndex& index, const bool open ) */ void OB_Browser::adjustWidth() { - myView->resizeColumnToContents( 0 ); + myView->resizeColumnToEncloseContents( 0 ); +} + +/*! + \brief Adjust first column width to its contents. +*/ +void OB_Browser::adjustFirstColumnWidth() +{ + myView->resizeColumnToEncloseContents( 0 ); +} + +/*! + \brief Adjust all columns width to its contents except the first column. +*/ +void OB_Browser::adjustColumnsWidth() +{ + for ( int aCol = 1; aCol < myView->header()->count(); aCol++ ) { + if ( myView->columnWidth( aCol ) > 0 ) + myView->resizeColumnToEncloseContents( aCol ); + } } /*! @@ -980,7 +1000,7 @@ void OB_Browser::createPopupMenu( QMenu* menu ) if ( isSearchToolEnabled() ) { menu->addSeparator(); - menu->addAction( tr( "MEN_FIND" ), searchTool(), SLOT( find() ) ); + menu->addAction( tr( "MEN_FIND" ), searchTool(), SLOT( find() ), QKeySequence(Qt::CTRL + Qt::Key_F) ); menu->addSeparator(); } } diff --git a/src/ObjBrowser/OB_Browser.h b/src/ObjBrowser/OB_Browser.h index 1979c8100..289b5ce6a 100755 --- a/src/ObjBrowser/OB_Browser.h +++ b/src/ObjBrowser/OB_Browser.h @@ -86,6 +86,8 @@ public: virtual void setOpen( const QModelIndex& theObject, const bool theOpen = true ); void adjustWidth(); + void adjustFirstColumnWidth(); + void adjustColumnsWidth(); // san - To be revised or removed // QTreeView::indexAt() should be used diff --git a/src/Plot2d/Plot2d_SetupViewDlg.cxx b/src/Plot2d/Plot2d_SetupViewDlg.cxx index add4a56d0..8b8c5ae7b 100755 --- a/src/Plot2d/Plot2d_SetupViewDlg.cxx +++ b/src/Plot2d/Plot2d_SetupViewDlg.cxx @@ -22,6 +22,8 @@ #include "Plot2d_SetupViewDlg.h" +#include +#include #include #include @@ -305,10 +307,13 @@ Plot2d_SetupViewDlg::Plot2d_SetupViewDlg( QWidget* parent, myOkBtn->setDefault( TRUE ); myCancelBtn = new QPushButton( tr( "BUT_CANCEL" ), this ); myCancelBtn->setAutoDefault( TRUE ); + myHelpBtn = new QPushButton( tr( "BUT_HELP" ), this ); + myHelpBtn->setAutoDefault( TRUE ); QHBoxLayout* btnLayout = new QHBoxLayout; btnLayout->addWidget( myOkBtn ); btnLayout->addStretch(); btnLayout->addWidget( myCancelBtn ); + btnLayout->addWidget( myHelpBtn ); // layout widgets topLayout->addWidget( myTitleCheck, 0, 0 ); @@ -344,6 +349,7 @@ Plot2d_SetupViewDlg::Plot2d_SetupViewDlg( QWidget* parent, connect( myOkBtn, SIGNAL( clicked() ), this, SLOT( accept() ) ); connect( myCancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) ); + connect( myHelpBtn, SIGNAL( clicked() ), this, SLOT( onHelp() ) ); if ( mySecondAxisY ) { connect( myTitleY2Check, SIGNAL( clicked() ), this, SLOT( onY2TitleChecked() ) ); @@ -838,3 +844,13 @@ bool Plot2d_SetupViewDlg::isSetAsDefault() { return myDefCheck->isChecked(); } + +/*! + Slot, called when user clicks "Help" button +*/ +void Plot2d_SetupViewDlg::onHelp() +{ + SUIT_Application* app = SUIT_Session::session()->activeApplication(); + if ( app ) + app->onHelpContextModule( "GUI", "plot2d_viewer_page.html", "settings" ); +} diff --git a/src/Plot2d/Plot2d_SetupViewDlg.h b/src/Plot2d/Plot2d_SetupViewDlg.h index dc75f4daa..923dd5f40 100755 --- a/src/Plot2d/Plot2d_SetupViewDlg.h +++ b/src/Plot2d/Plot2d_SetupViewDlg.h @@ -93,6 +93,7 @@ protected slots: void onXGridMinorChecked(); void onYGridMinorChecked(); void onY2GridMinorChecked(); + void onHelp(); private: QCheckBox* myTitleCheck; @@ -126,6 +127,7 @@ private: QCheckBox* myDefCheck; QPushButton* myOkBtn; QPushButton* myCancelBtn; + QPushButton* myHelpBtn; bool mySecondAxisY; }; diff --git a/src/Plot2d/Plot2d_ViewManager.cxx b/src/Plot2d/Plot2d_ViewManager.cxx index cccfe1865..efd1fa6f8 100755 --- a/src/Plot2d/Plot2d_ViewManager.cxx +++ b/src/Plot2d/Plot2d_ViewManager.cxx @@ -74,17 +74,32 @@ void Plot2d_ViewManager::createView() SLOT: called if action "Clone view" is activated, emits signal cloneView() */ void Plot2d_ViewManager::onCloneView() +{ + if( sender() && sender()->inherits( "Plot2d_ViewWindow" ) ) + { + Plot2d_ViewWindow* srcWnd = ( Plot2d_ViewWindow* )sender(); + cloneView( srcWnd ); + } +} + +/*! + \brief Creates clone of source window + \param srcWnd source window + \return Pointer on the new window + \sa onCloneView() +*/ +Plot2d_ViewWindow* Plot2d_ViewManager::cloneView( Plot2d_ViewWindow* srcWnd ) { SUIT_ViewWindow* vw = createViewWindow(); - Plot2d_ViewWindow *newWnd = 0, *clonedWnd = 0; + Plot2d_ViewWindow* newWnd = 0; if( vw && vw->inherits( "Plot2d_ViewWindow" ) ) newWnd = ( Plot2d_ViewWindow* )vw; - if( sender() && sender()->inherits( "Plot2d_ViewWindow" ) ) - clonedWnd = ( Plot2d_ViewWindow* )sender(); - if( newWnd && clonedWnd ) - emit cloneView( clonedWnd->getViewFrame(), newWnd->getViewFrame() ); + if( newWnd && srcWnd ) + emit cloneView( srcWnd->getViewFrame(), newWnd->getViewFrame() ); + + return newWnd; } /*! diff --git a/src/Plot2d/Plot2d_ViewManager.h b/src/Plot2d/Plot2d_ViewManager.h index 42b23a02c..4eeb0ffd8 100755 --- a/src/Plot2d/Plot2d_ViewManager.h +++ b/src/Plot2d/Plot2d_ViewManager.h @@ -24,6 +24,7 @@ class SUIT_Desktop; class SUIT_PreferenceMgr; +class Plot2d_ViewWindow; class Plot2d_Viewer; class Plot2d_ViewFrame; @@ -36,6 +37,7 @@ public: ~Plot2d_ViewManager(); Plot2d_Viewer* getPlot2dModel() const; + Plot2d_ViewWindow* cloneView( Plot2d_ViewWindow* srcWnd ); static int fillPreferences( SUIT_PreferenceMgr*, const int ); diff --git a/src/Plot2d/Plot2d_ViewModel.cxx b/src/Plot2d/Plot2d_ViewModel.cxx index fae67f5cf..19127bc54 100755 --- a/src/Plot2d/Plot2d_ViewModel.cxx +++ b/src/Plot2d/Plot2d_ViewModel.cxx @@ -175,8 +175,37 @@ void Plot2d_Viewer::onDumpView() /*! SLOT: called when action "Clone view" is activated */ -void Plot2d_Viewer::onCloneView( Plot2d_ViewFrame*, Plot2d_ViewFrame* ) +void Plot2d_Viewer::onCloneView( Plot2d_ViewFrame* clonedVF, Plot2d_ViewFrame* newVF ) { + if( !clonedVF || !newVF ) + return; + + // 1) Copy all properties of view + + newVF->copyPreferences( clonedVF ); + + // 2) Display all curves displayed in cloned view + + curveList aCurves; + clonedVF->getCurves( aCurves ); + curveList::const_iterator anIt = aCurves.begin(), aLast = aCurves.end(); + + for( ; anIt!=aLast; anIt++ ) + if( clonedVF->isVisible( *anIt ) ) + newVF->displayCurve( *anIt, false ); + newVF->Repaint(); + + if ( newVF ) + { + // find view window corresponding to the frame + QWidget* p = newVF->parentWidget(); + while( p && !p->inherits( "SUIT_ViewWindow" ) ) + p = p->parentWidget(); + + // emits signal + if ( p && p->inherits( "SUIT_ViewWindow" ) ) + emit viewCloned( (SUIT_ViewWindow*)p ); + } } /*! diff --git a/src/Plot2d/Plot2d_ViewModel.h b/src/Plot2d/Plot2d_ViewModel.h index db0c471d2..b2c0b0416 100755 --- a/src/Plot2d/Plot2d_ViewModel.h +++ b/src/Plot2d/Plot2d_ViewModel.h @@ -48,11 +48,14 @@ public: void update(); void clearPrs(); void setAutoDel(bool theDel); + +signals: + void viewCloned( SUIT_ViewWindow* ); protected slots: - void onChangeBgColor(); - void onDumpView(); - void onShowToolbar(); + void onChangeBgColor(); + void onDumpView(); + void onShowToolbar(); virtual void onCloneView( Plot2d_ViewFrame*, Plot2d_ViewFrame* ); private: diff --git a/src/Plot2d/Plot2d_ViewWindow.cxx b/src/Plot2d/Plot2d_ViewWindow.cxx index aaaf1046d..f323bb915 100755 --- a/src/Plot2d/Plot2d_ViewWindow.cxx +++ b/src/Plot2d/Plot2d_ViewWindow.cxx @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -78,8 +79,6 @@ void Plot2d_ViewWindow::initLayout() myViewFrame = new Plot2d_ViewFrame( this, "plotView" ); setCentralWidget( myViewFrame ); - myToolBar = addToolBar( tr("LBL_TOOLBAR_LABEL") ); - createActions(); createToolBar(); @@ -126,7 +125,7 @@ Plot2d_ViewFrame* Plot2d_ViewWindow::getViewFrame() */ QToolBar* Plot2d_ViewWindow::getToolBar() { - return myToolBar; + return toolMgr()->toolBar( myToolBar ); } /*! @@ -135,28 +134,29 @@ QToolBar* Plot2d_ViewWindow::getToolBar() */ void Plot2d_ViewWindow::contextMenuPopup( QMenu* thePopup ) { + QtxActionToolMgr* mgr = toolMgr(); // scaling QMenu* scalingPopup = thePopup->addMenu( tr( "SCALING_POPUP" ) ); - scalingPopup->addAction( myActionsMap[ PModeXLinearId ] ); - scalingPopup->addAction( myActionsMap[ PModeXLogarithmicId ] ); + scalingPopup->addAction( mgr->action( PModeXLinearId ) ); + scalingPopup->addAction( mgr->action( PModeXLogarithmicId ) ); scalingPopup->addSeparator(); - scalingPopup->addAction( myActionsMap[ PModeYLinearId ] ); - scalingPopup->addAction( myActionsMap[ PModeYLogarithmicId ] ); + scalingPopup->addAction( mgr->action( PModeYLinearId ) ); + scalingPopup->addAction( mgr->action( PModeYLogarithmicId ) ); // fit data thePopup->addAction( tr( "TOT_PLOT2D_FITDATA" ), myViewFrame, SLOT( onFitData() ) ); // curve type QMenu* curTypePopup = thePopup->addMenu( tr( "CURVE_TYPE_POPUP" ) ); - curTypePopup->addAction( myActionsMap[ CurvPointsId ] ); - curTypePopup->addAction( myActionsMap[ CurvLinesId ] ); - curTypePopup->addAction( myActionsMap[ CurvSplinesId ] ); + curTypePopup->addAction( mgr->action( CurvPointsId ) ); + curTypePopup->addAction( mgr->action( CurvLinesId ) ); + curTypePopup->addAction( mgr->action( CurvSplinesId ) ); // legend - thePopup->addAction( myActionsMap[ LegendId ] ); + thePopup->addAction( mgr->action( LegendId ) ); // settings - thePopup->addAction( myActionsMap[ CurvSettingsId ] ); + thePopup->addAction( mgr->action( CurvSettingsId ) ); } /*! @@ -190,9 +190,7 @@ bool Plot2d_ViewWindow::eventFilter( QObject* watched, QEvent* e ) */ void Plot2d_ViewWindow::createActions() { - if ( !myActionsMap.isEmpty() ) - return; - + QtxActionToolMgr* mgr = toolMgr(); QtxAction* aAction; SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); @@ -203,7 +201,7 @@ void Plot2d_ViewWindow::createActions() 0, this); aAction->setStatusTip( tr( "DSC_DUMP_VIEW" ) ); connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onDumpView() ) ); - myActionsMap[ DumpId ] = aAction; + mgr->registerAction( aAction, DumpId ); // 2. Scaling operations @@ -214,7 +212,7 @@ void Plot2d_ViewWindow::createActions() 0, this); aAction->setStatusTip( tr( "DSC_FITALL" ) ); connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onFitAll() ) ); - myActionsMap[ FitAllId ] = aAction; + mgr->registerAction( aAction, FitAllId ); // 2.2. Fit Rect aAction = new QtxAction( tr( "MNU_FITRECT" ), @@ -223,7 +221,7 @@ void Plot2d_ViewWindow::createActions() 0, this); aAction->setStatusTip( tr( "DSC_FITRECT" ) ); connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onFitRect() ) ); - myActionsMap[ FitRectId ] = aAction; + mgr->registerAction( aAction, FitRectId ); // 2.3. Zoom aAction = new QtxAction( tr( "MNU_ZOOM_VIEW" ), @@ -232,14 +230,14 @@ void Plot2d_ViewWindow::createActions() 0, this); aAction->setStatusTip( tr( "DSC_ZOOM_VIEW" ) ); connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onZoom() ) ); - myActionsMap[ ZoomId ] = aAction; + mgr->registerAction( aAction, ZoomId ); // 2.4. Create multi-action for scaling operations QtxMultiAction* aScaleAction = new QtxMultiAction( this ); - aScaleAction->insertAction( myActionsMap[ FitAllId ] ); - aScaleAction->insertAction( myActionsMap[ FitRectId ] ); - aScaleAction->insertAction( myActionsMap[ ZoomId ] ); - myActionsMap[ ScaleOpId ] = aScaleAction; + aScaleAction->insertAction( mgr->action( FitAllId ) ); + aScaleAction->insertAction( mgr->action( FitRectId ) ); + aScaleAction->insertAction( mgr->action( ZoomId ) ); + mgr->registerAction( aScaleAction, ScaleOpId ); // 3. Moving operations @@ -250,7 +248,7 @@ void Plot2d_ViewWindow::createActions() 0, this); aAction->setStatusTip( tr( "DSC_PAN_VIEW" ) ); connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onPanning() ) ); - myActionsMap[ PanId ] = aAction; + mgr->registerAction( aAction, PanId ); // 3.2. Global Panning aAction = new QtxAction( tr( "MNU_GLOBALPAN_VIEW" ), @@ -259,13 +257,13 @@ void Plot2d_ViewWindow::createActions() 0, this); aAction->setStatusTip( tr( "DSC_GLOBALPAN_VIEW" ) ); connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onGlobalPanning() ) ); - myActionsMap[ GlobalPanId ] = aAction; + mgr->registerAction( aAction, GlobalPanId ); // 3.3. Create multi-action for moving operations QtxMultiAction* aPanAction = new QtxMultiAction( this ); - aPanAction->insertAction( myActionsMap[ PanId ] ); - aPanAction->insertAction( myActionsMap[ GlobalPanId ] ); - myActionsMap[ MoveOpId ] = aPanAction; + aPanAction->insertAction( mgr->action( PanId ) ); + aPanAction->insertAction( mgr->action( GlobalPanId ) ); + mgr->registerAction( aPanAction, MoveOpId ); // 4. Curve type operations @@ -276,7 +274,7 @@ void Plot2d_ViewWindow::createActions() 0, this ); aAction->setStatusTip( tr( "PRP_PLOT2D_CURVES_POINTS" ) ); aAction->setCheckable( true ); - myActionsMap[ CurvPointsId ] = aAction; + mgr->registerAction( aAction, CurvPointsId ); // 4.2. Lines aAction = new QtxAction( tr( "TOT_PLOT2D_CURVES_LINES" ), @@ -285,7 +283,7 @@ void Plot2d_ViewWindow::createActions() 0, this ); aAction->setStatusTip( tr( "PRP_PLOT2D_CURVES_LINES" ) ); aAction->setCheckable( true ); - myActionsMap[ CurvLinesId ] = aAction; + mgr->registerAction( aAction, CurvLinesId ); // 4.3. Splines aAction = new QtxAction( tr( "TOT_PLOT2D_CURVES_SPLINES" ), @@ -294,13 +292,13 @@ void Plot2d_ViewWindow::createActions() 0, this ); aAction->setStatusTip( tr( "PRP_PLOT2D_CURVES_SPLINES" ) ); aAction->setCheckable( true ); - myActionsMap[ CurvSplinesId ] = aAction; + mgr->registerAction( aAction, CurvSplinesId ); // 4.4. Create action group for curve type operations QActionGroup* aCurveGroup = new QActionGroup( this ); - aCurveGroup->addAction( myActionsMap[ CurvPointsId ] ); - aCurveGroup->addAction( myActionsMap[ CurvLinesId ] ); - aCurveGroup->addAction( myActionsMap[ CurvSplinesId ] ); + aCurveGroup->addAction( mgr->action( CurvPointsId ) ); + aCurveGroup->addAction( mgr->action( CurvLinesId ) ); + aCurveGroup->addAction( mgr->action( CurvSplinesId ) ); connect( aCurveGroup, SIGNAL( triggered( QAction* ) ), this, SLOT( onCurves() ) ); // 5. Horizontal scaling mode operations @@ -313,7 +311,7 @@ void Plot2d_ViewWindow::createActions() aAction->setStatusTip( tr( "PRP_PLOT2D_MODE_LINEAR_HOR" ) ); connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onViewHorMode() ) ); aAction->setCheckable( true ); - myActionsMap[ PModeXLinearId ] = aAction; + mgr->registerAction( aAction, PModeXLinearId ); // 5.2. Logarithmic aAction = new QtxAction( tr( "TOT_PLOT2D_MODE_LOGARITHMIC_HOR" ), @@ -323,12 +321,12 @@ void Plot2d_ViewWindow::createActions() aAction->setStatusTip( tr( "PRP_PLOT2D_MODE_LOGARITHMIC_HOR" ) ); connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onViewHorMode() ) ); aAction->setCheckable( true ); - myActionsMap[ PModeXLogarithmicId ] = aAction; + mgr->registerAction( aAction, PModeXLogarithmicId ); // 5.3. Create action group for horizontal scaling mode operations QActionGroup* aHorGroup = new QActionGroup( this ); - aHorGroup->addAction( myActionsMap[ PModeXLinearId ] ); - aHorGroup->addAction( myActionsMap[ PModeXLogarithmicId ] ); + aHorGroup->addAction( mgr->action( PModeXLinearId ) ); + aHorGroup->addAction( mgr->action( PModeXLogarithmicId ) ); // 6. Vertical scaling mode operations @@ -340,7 +338,7 @@ void Plot2d_ViewWindow::createActions() aAction->setStatusTip( tr( "PRP_PLOT2D_MODE_LINEAR_VER" ) ); connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onViewVerMode() ) ); aAction->setCheckable( true ); - myActionsMap[ PModeYLinearId ] = aAction; + mgr->registerAction( aAction, PModeYLinearId ); // 6.2. Logarithmic aAction = new QtxAction( tr( "TOT_PLOT2D_MODE_LOGARITHMIC_VER" ), @@ -350,12 +348,12 @@ void Plot2d_ViewWindow::createActions() aAction->setStatusTip( tr( "PRP_PLOT2D_MODE_LOGARITHMIC_VER" ) ); connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onViewVerMode() ) ); aAction->setCheckable( true ); - myActionsMap[ PModeYLogarithmicId ] = aAction; + mgr->registerAction( aAction, PModeYLogarithmicId ); // 6.3. Create action group for vertical scaling mode operations QActionGroup* aVerGroup = new QActionGroup( this ); - aVerGroup->addAction( myActionsMap[ PModeYLinearId ] ); - aVerGroup->addAction( myActionsMap[ PModeYLogarithmicId ] ); + aVerGroup->addAction( mgr->action( PModeYLinearId ) ); + aVerGroup->addAction( mgr->action( PModeYLogarithmicId ) ); // 7. Legend aAction = new QtxAction( tr( "TOT_PLOT2D_SHOW_LEGEND" ), @@ -365,7 +363,7 @@ void Plot2d_ViewWindow::createActions() aAction->setStatusTip( tr( "PRP_PLOT2D_SHOW_LEGEND" ) ); connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onLegend() ) ); aAction->setCheckable( true ); - myActionsMap[ LegendId ] = aAction; + mgr->registerAction( aAction, LegendId ); // 8. Settings aAction = new QtxAction( tr( "TOT_PLOT2D_SETTINGS" ), @@ -374,7 +372,7 @@ void Plot2d_ViewWindow::createActions() 0, this ); aAction->setStatusTip( tr( "PRP_PLOT2D_SETTINGS" ) ); connect( aAction, SIGNAL( triggered( bool ) ), myViewFrame, SLOT( onSettings() ) ); - myActionsMap[ CurvSettingsId ] = aAction; + mgr->registerAction( aAction, CurvSettingsId ); // 9. Clone aAction = new QtxAction( tr( "MNU_CLONE_VIEW" ), @@ -383,7 +381,7 @@ void Plot2d_ViewWindow::createActions() 0, this); aAction->setStatusTip( tr( "DSC_CLONE_VIEW" ) ); connect( aAction, SIGNAL( triggered( bool ) ), this, SIGNAL( cloneView() ) ); - myActionsMap[ CloneId ] = aAction; + mgr->registerAction( aAction, CloneId ); // 10. Print aAction = new QtxAction( tr( "MNU_PRINT_VIEW" ), @@ -392,7 +390,7 @@ void Plot2d_ViewWindow::createActions() 0, this); aAction->setStatusTip( tr( "DSC_PRINT_VIEW" ) ); connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onPrintView() ) ); - myActionsMap[ PrintId ] = aAction; + mgr->registerAction( aAction, PrintId ); // Set initial values onChangeCurveMode(); @@ -406,24 +404,26 @@ void Plot2d_ViewWindow::createActions() */ void Plot2d_ViewWindow::createToolBar() { - myToolBar->addAction( myActionsMap[ DumpId ] ); - myToolBar->addAction( myActionsMap[ ScaleOpId ] ); - myToolBar->addAction( myActionsMap[ MoveOpId ] ); - myToolBar->addSeparator(); - myToolBar->addAction( myActionsMap[ CurvPointsId ] ); - myToolBar->addAction( myActionsMap[ CurvLinesId ] ); - myToolBar->addAction( myActionsMap[ CurvSplinesId ] ); - myToolBar->addSeparator(); - myToolBar->addAction( myActionsMap[ PModeXLinearId ] ); - myToolBar->addAction( myActionsMap[ PModeXLogarithmicId ] ); - myToolBar->addSeparator(); - myToolBar->addAction( myActionsMap[ PModeYLinearId ] ); - myToolBar->addAction( myActionsMap[ PModeYLogarithmicId ] ); - myToolBar->addSeparator(); - myToolBar->addAction( myActionsMap[ LegendId ] ); - myToolBar->addAction( myActionsMap[ CurvSettingsId ] ); - myToolBar->addAction( myActionsMap[ CloneId ] ); - myToolBar->addAction( myActionsMap[ PrintId ] ); + QtxActionToolMgr* mgr = toolMgr(); + myToolBar = mgr->createToolBar( tr( "LBL_TOOLBAR_LABEL" ) ); + mgr->append( DumpId, myToolBar ); + mgr->append( ScaleOpId, myToolBar ); + mgr->append( MoveOpId, myToolBar ); + mgr->append( toolMgr()->separator(), myToolBar ); + mgr->append( CurvPointsId, myToolBar ); + mgr->append( CurvLinesId, myToolBar ); + mgr->append( CurvSplinesId, myToolBar ); + mgr->append( toolMgr()->separator(), myToolBar ); + mgr->append( PModeXLinearId, myToolBar ); + mgr->append( PModeXLogarithmicId, myToolBar ); + mgr->append( toolMgr()->separator(), myToolBar ); + mgr->append( PModeYLinearId, myToolBar ); + mgr->append( PModeYLogarithmicId, myToolBar ); + mgr->append( toolMgr()->separator(), myToolBar ); + mgr->append( LegendId, myToolBar ); + mgr->append( CurvSettingsId, myToolBar ); + mgr->append( CloneId, myToolBar ); + mgr->append( PrintId, myToolBar ); } /*! @@ -453,11 +453,11 @@ void Plot2d_ViewWindow::onChangeHorMode() bool aVerLinear = myViewFrame->isModeVerLinear(); if ( aHorLinear ) - myActionsMap[ PModeXLinearId ]->setChecked( true ); + toolMgr()->action( PModeXLinearId )->setChecked( true ); else - myActionsMap[ PModeXLogarithmicId ]->setChecked( true ); + toolMgr()->action( PModeXLogarithmicId )->setChecked( true ); - myActionsMap[ GlobalPanId ]->setEnabled( aHorLinear && aVerLinear ); + toolMgr()->action( GlobalPanId )->setEnabled( aHorLinear && aVerLinear ); } /*! @@ -469,11 +469,11 @@ void Plot2d_ViewWindow::onChangeVerMode() bool aVerLinear = myViewFrame->isModeVerLinear(); if ( aVerLinear ) - myActionsMap[ PModeYLinearId ]->setChecked( true ); + toolMgr()->action( PModeYLinearId )->setChecked( true ); else - myActionsMap[ PModeYLogarithmicId ]->setChecked( true ); + toolMgr()->action( PModeYLogarithmicId )->setChecked( true ); - myActionsMap[ GlobalPanId ]->setEnabled( aHorLinear && aVerLinear ); + toolMgr()->action( GlobalPanId )->setEnabled( aHorLinear && aVerLinear ); } /*! @@ -483,13 +483,13 @@ void Plot2d_ViewWindow::onChangeCurveMode() { switch ( myViewFrame->getCurveType() ) { case 0: - myActionsMap[ CurvPointsId ]->setChecked( true ); + toolMgr()->action( CurvPointsId )->setChecked( true ); break; case 1: - myActionsMap[ CurvLinesId ]->setChecked( true ); + toolMgr()->action( CurvLinesId )->setChecked( true ); break; case 2: - myActionsMap[ CurvSplinesId ]->setChecked( true ); + toolMgr()->action( CurvSplinesId )->setChecked( true ); break; default: break; @@ -501,7 +501,7 @@ void Plot2d_ViewWindow::onChangeCurveMode() */ void Plot2d_ViewWindow::onChangeLegendMode() { - myActionsMap[ LegendId ]->setChecked( myViewFrame->isLegendShow() ); + toolMgr()->action( LegendId )->setChecked( myViewFrame->isLegendShow() ); } /*! @@ -549,7 +549,7 @@ void Plot2d_ViewWindow::onGlobalPanning() */ void Plot2d_ViewWindow::onViewHorMode() { - myViewFrame->setHorScaleMode( myActionsMap[ PModeXLinearId ]->isChecked() ? 0 : 1 ); + myViewFrame->setHorScaleMode( toolMgr()->action( PModeXLinearId )->isChecked() ? 0 : 1 ); } /*! @@ -557,7 +557,7 @@ void Plot2d_ViewWindow::onViewHorMode() */ void Plot2d_ViewWindow::onViewVerMode() { - myViewFrame->setVerScaleMode( myActionsMap[ PModeYLinearId ]->isChecked() ? 0 : 1 ); + myViewFrame->setVerScaleMode( toolMgr()->action( PModeYLinearId )->isChecked() ? 0 : 1 ); } /*! @@ -574,11 +574,11 @@ void Plot2d_ViewWindow::onLegend() */ void Plot2d_ViewWindow::onCurves() { - if( myActionsMap[ CurvPointsId ]->isChecked() ) + if( toolMgr()->action( CurvPointsId )->isChecked() ) myViewFrame->setCurveType( 0 ); - else if ( myActionsMap[ CurvLinesId ]->isChecked() ) + else if ( toolMgr()->action( CurvLinesId )->isChecked() ) myViewFrame->setCurveType( 1 ); - else if ( myActionsMap[ CurvSplinesId ]->isChecked() ) + else if ( toolMgr()->action( CurvSplinesId )->isChecked() ) myViewFrame->setCurveType( 2 ); } @@ -778,5 +778,3 @@ void Plot2d_ViewWindow::onPrintView() \fn void Plot2d_ViewWindow::cloneView(); \brief Emitted when the "Clone View" action is activated. */ - - diff --git a/src/Plot2d/Plot2d_ViewWindow.h b/src/Plot2d/Plot2d_ViewWindow.h index e3fc5c8b4..aed5e9cee 100755 --- a/src/Plot2d/Plot2d_ViewWindow.h +++ b/src/Plot2d/Plot2d_ViewWindow.h @@ -44,6 +44,17 @@ class PLOT2D_EXPORT Plot2d_ViewWindow : public SUIT_ViewWindow { Q_OBJECT +public: + enum { DumpId, + ScaleOpId, FitAllId, FitRectId, ZoomId, + MoveOpId, PanId, GlobalPanId, + PModeXLinearId, PModeXLogarithmicId, + PModeYLinearId, PModeYLogarithmicId, + CurvPointsId, CurvLinesId, CurvSplinesId, + LegendId, + CurvSettingsId, + CloneId, PrintId }; + public: Plot2d_ViewWindow( SUIT_Desktop*, Plot2d_Viewer* ); virtual ~Plot2d_ViewWindow(); @@ -78,25 +89,10 @@ public slots: void onViewVerMode(); void onLegend(); void onCurves(); - + void onDumpView(); void onPrintView(); -protected: - enum { DumpId, - ScaleOpId, FitAllId, FitRectId, ZoomId, - MoveOpId, PanId, GlobalPanId, - PModeXLinearId, PModeXLogarithmicId, - PModeYLinearId, PModeYLogarithmicId, - CurvPointsId, CurvLinesId, CurvSplinesId, - LegendId, - CurvSettingsId, - CloneId, - PrintId }; - - typedef QMap ActionsMap; - ActionsMap myActionsMap; - protected: virtual QImage dumpView(); virtual bool dumpViewToFormat( const QImage&, @@ -110,8 +106,7 @@ signals: protected: Plot2d_Viewer* myModel; Plot2d_ViewFrame* myViewFrame; - QToolBar* myToolBar; - QImage myDumpImage; + int myToolBar; }; #ifdef WIN32 diff --git a/src/Plot2d/resources/plot2d_legend.png b/src/Plot2d/resources/plot2d_legend.png index cdcc1e0d858a1fa5dd62c11d6b8df2344f8b873e..0e367cee9bf1917f23aad0692270538b6f78ef80 100755 GIT binary patch delta 772 zcmV+f1N;260+j{?iBL{Qkp&-r32;bRa{vGf6951U69E94oEQKA00d`2O+f$vv5tKE zQIh}w03c&XQcVB=dL;k=fP(-4`Tqa_faw4Lbua(`>RI+y?e7jKeZ#YO-C0*pyS zK~#9!V*LOAKLa%ZKmf6T2m=Fy|Ns8|WBC31H^cYu-xb7y*RKqJ|NaFDd)(B}_#%1rD$jjQ&HpgN#m}DQc>%G6`x%gyxO9o zKn$QT6cZEs|I*z2{|jAz-T#juk|5j<#MVHp55(?JL&ahI#}IXJ{zIst00G1ZGLWC2 z|3ApvfByVIcKrk(-T}m4fS8BKAbbH3K;TIE^y!lUkV*i>51ImyVRxWx2`GL6#n|{f z00G2;MI#K{fhv57q~-;b{)&Uo0}wzA&~(TR@-{0gD=hrFdyWPpa-S5gfG2q3VRL5UjVtbbtV!IPDN_snZY7@3(F7@1iaHYX}E z1}%O1pAqVXbp`P1Q6JT!otG;-KJduyYSD?Zw#B0RY3+; zpvCeRBsMlaIGh200tjp%BO{|e3k%Byq-1jdh%Z15WFR7TC1A-0Ab{Yp3^WYnA{!*z zUm(Te3nUle;)Bfr2q1VYLvsZzhm=G4B*!v905KpHU;iIJ^hHiK+~kxt009IG!~f5o z_%VF_`iJ4ikADoh`rx4Bxq8{-3kwS)0~;GN11l>dgN)pFX2uuK{QpZxZ3NT*{{4qL z3YbtBWaT$A0t67uK#*&`01aT!)&(2Z0*#P6=&=aJFu;SB&%Xc!5X?YOso?>{3!pLl z0&3s|^jJiS00uNUuslEjA-m83YN!g-Wn{S!Aiw}%D=#qbT6z}%0000q<_O%b&X~PS@Rh&PK53ai>iBL{Qkp&-r32;bRa{vGf6951U69E94oEQKA00d`2O+f$vv5tKE zQIh}w03c&XQcVB=dL;k=fP(-4`Tqa_faw4Lbua(`>RI+y?e7jKeZ#YO-C0*gsR zK~#9!V*LOAKLa%ZKmai@P#FLOphJ#L0DwU#i2i^ZJFA1Jpjc=EDbnSC;5E0Hd5Z{$ z=*{lFe$5Q33Ym$BfV)FgVP@+HAh0PjX9R%EW{_7%XL$HvI>Z0}{}?7uxyO*3qX;%Y zK{1En!Tl*<_T(w|8FI4afolFRC@B{)+`iQWwEQQ->^VOedV7170RjkYAV?Bn`)?rs zFO>ZgNgS2^|Nn2OZ+;+u%Xt6<5Y)iG4F4JaBPssNkdYzG@E6Gt7#k#xY#@mJ_3JMn ziw(q80SF+lf&V~~z}UWXy921;7udxhZ^OXN8}$tT{{BP?#lK*mT)A8XHtgHC-!KCi z00Iac%m0CrDyn4+s%n)$g+DN`hGr8AALPwnzkV|4>h&|2nNIfB*s;c>P)xIP5^+?3rAKFJFGb4TQPE&hg4z#1Q6K3FJFGa z6DY`azrY6KF4jN>fL!(eA25Fb*^Eq#a5;bg0vl*&KZ9z;7eD}kjMfL@1Ryq`f_WDJ z0tn>7FF<^UN)EgO5I`Uoas#mh5c5#Mz%Kv+1^}@ugK#y-$;AKw002ovPDHLkV1kbS BKn4H+ literal 281 zcmV+!0p|XRP)Rc&AF+5-asJ9`bIh<#s{<+<1?CEKRI+y?e7jKeZ#YO-C0)Rs70jMJo8i-^PmCZo$Si;WVu4Bg{ri`HAum@I$YO+w z`~xcZ$DpW`1LoboHyO-VQqE_%eXAYF{sq+YlcBfw6G&Pah+hElSAYOwf*JVd&mW*7 z5dICu|Ni|38+P|j4;U*d`AEm;?99 z-8F%>(?)ayLWp)0RcpR!5VJfXkbuN zt7f=yy$+1k)N7%>`N{D8`)`JC-+p6+DL??h4gB%r2gCn=zrlt*pVw=@1}*;0AvE`jtULvlT9J@IVHGgX2twZCewOT=<{C!(%SPisexZzdKq>)<4ahL_0?a^w00RJYI)WOG{+qo30000$vtQ}@Y|s``%z#iB?sWW&-DgXbs+=*j^k+N@AZI)02Fu427qnb-gDMK1GFIn zr-id>99B8{m3IajcSS$Dyww9KB_|@Jl-x?l4X}jVyWtr%ml9(vH{F%Z@zCK+ci1`{ z0^ym%5%g7ubHIPq1+G2}a8cN+(38W`dNIb~ZB7B<-0Um0*n~XN$a&MtB9ggyzEsuq n-oYYQ{{r9>>QznJbl7zd^&y98Uc7U000000NkvXXu0mjfno54V diff --git a/src/Plot2d/resources/plot2d_lines.png b/src/Plot2d/resources/plot2d_lines.png index 6baf57344cacc7fd22a5e42fa8c5eff44313ecef..667189e22d7dfe0a7926c544e2129750a5468a55 100755 GIT binary patch delta 387 zcmV-}0et?e0+#~>iBL{Qkp&-r32;bRa{vGf6951U69E94oEQKA00d`2O+f$vv5tKE zQIh}w03c&XQcVB=dL;k=fP(-4`Tqa_faw4Lbua(`>RI+y?e7jKeZ#YO-C0S-w- zK~#9!V*LOAKLa%ZKmai@P#FLO5Y-I?2q3B(2oOLF#D!r4NRc=Ya}!d32@pU;7})S% zqiX+usG-(`3_55(?JLqKe6Byp^U0t66N1JMja)(oQc@fivbKo|z%F^qv2LjeK^$-svHNMYoT z*IOutf@5D9rWPQ8pa!CLB#m-nk_SW{Gf4pi5X^<*P{G+y1C@!)7s^Qb;z8yB1P~+0 zKt@JJkZTNpSOtjh0PzJN{z`;_82SJL2su)?iOyb_hQjp$1P~*&%R_(wqIziq5I|Hn h5Fmi4ZXiH_0RYvEW6Y?_0RXE0JT4_OJT|IN zm=P$_uiT@)Vv5ae6+`d03x@pxz}amxmn^mKnr9P}*-!iyjEDjeeJ#Rp_=bA`$ziJM xV$#u^;(b!4FZb54|K{s!E#|p0jrXqWb^<002ovPDHLkV1f*>eft0a diff --git a/src/Plot2d/resources/plot2d_log.png b/src/Plot2d/resources/plot2d_log.png index aecca8c13acab4ff9fe724bdd0532f858b60e84e..1a6d7113c9b98294165a9b77b8df4598cfb6392c 100755 GIT binary patch delta 703 zcmV;w0zmzs0?-8niBL{Qkp&-r32;bRa{vGf6951U69E94oEQKA00d`2O+f$vv5tKE zQIh}w03c&XQcVB=dL;k=fP(-4`Tqa_faw4Lbua(`>RI+y?e7jKeZ#YO-C0!K+i zK~#9!V*LOAKLa%ZKmai@P#FLOphJ#L0DwU#i2i^ZJFA1Jpjc=EDbnSC;5E0Hd5Z{$ z=*{lFe$5Q33Ym$BfV)FgVP@+HAh0PjX9R%EW{_7%XL$HvI>Z0}|A2f%P$($oFg&(9!K< zFg2SDjGW(a0|5dEY@n)I70}iOh8x#wfErrBVTuiFX?MX>fxf|i1coDrGZ}X8N@eiy zoC`M)Ab?0phgYu@5mW;ZKvYlI009I~%@A)v67!!wpoIMor>0-OAnJbq{tH%%3;+TM zY~b~4Rp77#fwO0F8NPh^iPb<`yBT2G#B?&l&YdX?j!v_{{1wZi7*3yor~wEd7D!t9 z#c=*yJ}^7|0cN9rUkpEh^gk>HZrhp&jgzF`~t*xsN}#q009JY lAvX|905K004EzERU;whAW!_nNtyV)cn^ALNr{!zm6}N9f-s*K1ca7l!Ic&+rQHFX z0DzhGSCEL%27Ez3iFbL6y|1-uN{J?4m~%b_`n<&lwMw?-TC3)q(ORP;XrH%uT~~O& zEhVLN2s+DK+kMqOvu1*b z(5N%udAK88j8OwH-muv>x@jahvr-D?c?JOWf6=z(em-aBbs|Eg6aeq;cOAYShx7Eh m)*9uU6@a$Z=)S}LTi^rT50BHSofNhJ0000RI+y?e7jKeZ#YO-C0$xc( zK~#9!V*LOAKLZH3xVZc`Ffd>s70jMJo8i-^PmCZo$Si;WVu4Bg{ri`Hp|`geuJGZ5 z=|Bbl7!(wt-WR{wEkifd>%p0OGp<0R%Vj_wV08*W|!8-@VffaXCU0 z(8PaG%YJ}e`St5Bn2ZX45c7Z-009Iy@YkTsjLhz1O%>MrU7wDtEU>Y3&1P~LxBysJ3D#XQCuM~mtrHcgw zlMz4wF%eP#G6)%*I+=r4JwO1lAahjJs^RP#*Q*%F0RRDnVjy}Lk^=w&h>3y903d*< zZXiGap(GoSH(}oW|Nl2o>@P6C{$oJo_kZx@0+RcKBnJZk0R%Vj`}gnQya_V!-@iW$ zKY#uP;=c@5*3(dbH0;=s%<${yADrnBAb{Woe*OBDK|`|@E^+Wc27`m+OonY+6Oml_ zpTWapF2joDQ4GI9F8qV(LVy55G4R~kJaGQ}{{0Wb=g*Kr0Y<|N1c7hgeu3Hlpk*mC z00D)+(1S~MtvZa0K^7ln0WzaAV7ct0B84C9i#D&cmMzZ07*qo IM6N<$f;-kb=Kufz literal 280 zcmV+z0q6dSP)24T;k_?8=a+U^Ie-J8 zx>-@{(9+p2q?EYt8=zQ)y~AEddvY76lz?~lTMqw=3qa1ik_ zY!eb~V_-bu@V13lz#+un49Io~yL4dk5(XxYSE)ji+2*OR3OH;qP|?hM;2p%k$l`6b zM3vXZlS`ptLbB=1*?SCJuCfa_^jz@+YIXUV!VEOUTtJ~=MV^8~10%y(4=>Gm^PkND PdX2%;)z4*}Q$iB}fW%<} literal 272 zcmV+r0q_2aP)4U|+y9YLuzxZ27TOjT%-$E$~~7BX~I%V-x@|x@~x2(ZAX9R%KKv zH@MGoC}F@_4I&aE+H70;nddB~-iLY4vel4?gqeRf*SVE8XRlk&HG8<%u8cjSNlV@f Wo_;8|&b^la0000004R=004l4008;_004mL004C` z008P>0026e000+nl3&F}0007VNkl;Bg+E>5J||v!2xL4s{dcUEc>shs0cEw9Eh!v4Fw1wCQ=Oi{~u(= ze+CniCWia>?{5Ke41ib#h`+$p00a<82LAs28))cnhSR4?88|sPeSkuDfOx^f2kl_{ zKrRIcAfgSlwzmGiYgabVz#j}(uRdV7eXAZMTyyDS9mCtVa0eOy1P~*!5wU$+I?%B1 z3|Fo^U=R`EV0icL8^ezuzZm}h{mr_U{|R<;xEk z1clfboL%#w95F>KHgXq71|1yAM^WP7!VZy@fV8ftchHTglDE$@LF#rJsHqgMp;Qx^$ zWss!w|1U5$e}ZFESeS$1<*QFX%esj&3;VgmpH1VYMC zjhmr(If%b=NB(~#aiR?a2q0M2t3dKn#DV?A48MN=fvJHf37pG@JiR8v!tN2&z{kX7Q-A=1B^z#7)`7YRmYo=&hOGhOyTlj>5J1eZk_qY^ tkfB$A_y-WPLA|*TT1@>W#z24o0|0xN6%UV(FR}mt002ovPDHLkV1n0&L2dv5 literal 313 zcmV-90mlA`P)#4&q426%%9U#yJvcQFmpb-jPz@vDCjNk1TRo9bO7~FmDaAEgfs_?BRl$Z z{J{~B*D*ADZp%(iW>3SJ(I^Wtr zgUl5vb-fG#fb>WJR$lBHZ1^A09Xsld9W@;iQRZq57yw>SO^=j2{5)y<{%mtHr@J^b z^?grYr@S_~r3qMbv>7NOBqG}^)qnuN%#`lwXK1#E<(=B1-Cyh{*-fFAJ}1Tt00000 LNkvXXu0mjfVkmy? diff --git a/src/Plot2d/resources/plot2d_splines.png b/src/Plot2d/resources/plot2d_splines.png index c39d4321c35c26f3792db5fbdcc42d7a272e36a1..71f37f943db548c0c43f026c0d16797c96b2a066 100755 GIT binary patch delta 412 zcmV;N0b~B50RI+y?e7jKeZ#YO-C0VYXA zK~#9!V*LOAKLa%ZKmai@P#FLO5Y-I?2q3B(2oOLF#D!r4NRc=Ya}!d32@pU;7})S% zqiX+usG-(`3Ez1Q3!7;jtJDbpbIz89nv^0tjj# zO4101ra7Y0Cwh_s2q2gX#i4@zKpaoJftdOL0tl9DK+ZLQhQ}Rz=?qH*q38n$Ammu) zCOUgz8Vc735I~I7E)M|$i0Y*cKmbwQK!5E(pSSm7o4rP5dfTZo0?MBWOjZt-%RW<8)Zs3q} nwMS`wb^9v0Oyz4j$R51`lB<3+1VYzX00000NkvXXu0mjfElqrU diff --git a/src/PyConsole/PyConsole_Editor.cxx b/src/PyConsole/PyConsole_Editor.cxx index fea5d6804..af69ea1fb 100644 --- a/src/PyConsole/PyConsole_Editor.cxx +++ b/src/PyConsole/PyConsole_Editor.cxx @@ -138,7 +138,7 @@ public: PyConsole_Editor* theListener, bool sync = false ) : PyInterp_LockRequest( theInterp, theListener, sync ), - myCommand( theCommand ), myState( PyInterp_Event::OK ) + myCommand( theCommand ), myState( PyInterp_Event::ES_OK ) {} protected: @@ -152,9 +152,9 @@ protected: { int ret = getInterp()->run( myCommand.toLatin1() ); if ( ret < 0 ) - myState = PyInterp_Event::ERROR; + myState = PyInterp_Event::ES_ERROR; else if ( ret > 0 ) - myState = PyInterp_Event::INCOMPLETE; + myState = PyInterp_Event::ES_INCOMPLETE; } } @@ -906,8 +906,8 @@ void PyConsole_Editor::customEvent( QEvent* event ) addText( pe->text() ); return; } - case PyInterp_Event::OK: - case PyInterp_Event::ERROR: + case PyInterp_Event::ES_OK: + case PyInterp_Event::ES_ERROR: { // clear command buffer myCommandBuffer.truncate( 0 ); @@ -928,7 +928,7 @@ void PyConsole_Editor::customEvent( QEvent* event ) myEventLoop->exit(); break; } - case PyInterp_Event::INCOMPLETE: + case PyInterp_Event::ES_INCOMPLETE: { // extend command buffer (multi-line command) myCommandBuffer.append( "\n" ); @@ -958,7 +958,7 @@ void PyConsole_Editor::customEvent( QEvent* event ) // unset history browsing mode myCmdInHistory = -1; - if ( (int)event->type() == (int)PyInterp_Event::OK && myQueue.count() > 0 ) + if ( (int)event->type() == (int)PyInterp_Event::ES_OK && myQueue.count() > 0 ) { // process the next sheduled command from the queue (if there is any) QString nextcmd = myQueue[0]; diff --git a/src/PyConsole/PyConsole_Interp.cxx b/src/PyConsole/PyConsole_Interp.cxx index 234e55973..003d59f39 100644 --- a/src/PyConsole/PyConsole_Interp.cxx +++ b/src/PyConsole/PyConsole_Interp.cxx @@ -93,6 +93,16 @@ bool PyConsole_Interp::initState() _tstate = Py_NewInterpreter(); // create an interpreter and save current state PySys_SetArgv(PyInterp_Interp::_argc,PyInterp_Interp::_argv); // initialize sys.argv + if(!builtinmodule) // PAL18041: deepcopy function don't work in Salome + { + //builtinmodule is static member of PyInterp class + //If it is not NULL (initialized to the builtin module of the main interpreter + //all the sub interpreters will have the same builtin + //_interp is a static member and is the main interpreter + //The first time we initialized it to the builtin of main interpreter + builtinmodule=PyDict_GetItemString(_interp->modules, "__builtin__"); + } + //If builtinmodule has been initialized all the sub interpreters // will have the same __builtin__ module if(builtinmodule){ diff --git a/src/PyInterp/PyInterp.pro b/src/PyInterp/PyInterp.pro index bc1afac79..3d651f075 100644 --- a/src/PyInterp/PyInterp.pro +++ b/src/PyInterp/PyInterp.pro @@ -8,8 +8,8 @@ MOC_DIR = ../../moc OBJECTS_DIR = ../../$(CONFIG_ID)/obj/$$TARGET INCLUDEPATH += ../../include $$(PYTHONINC) -unix:LIBS += -L$$(PYTHONLIB) -lpython2.5 -win32:LIBS += -L$$(PYTHONLIB) -lpython25_d +unix:LIBS += -L$$(PYTHONLIB) -lpython2.5 -L../../$(CONFIG_ID)/lib -lEvent +win32:LIBS += -L$$(PYTHONLIB) -lpython25_d win32:LIBS *= -L$(QTLIB) win32:INCLUDEPATH *= $(QTINC) $(QTINC)\QtCore $(QTINC)\QtGui $(QTINC)\QtXml diff --git a/src/PyInterp/PyInterp_Dispatcher.cxx b/src/PyInterp/PyInterp_Dispatcher.cxx index e3adb001d..2fbda19ee 100755 --- a/src/PyInterp/PyInterp_Dispatcher.cxx +++ b/src/PyInterp/PyInterp_Dispatcher.cxx @@ -23,10 +23,23 @@ #include "PyInterp_Dispatcher.h" // !!! WARNING !!! THIS INCLUDE MUST BE THE VERY FIRST !!! #include "PyInterp_Interp.h" #include "PyInterp_Watcher.h" +#include #include #include +class PyInterp_ExecuteEvent: public SALOME_Event +{ +public: + PyInterp_Request* myRequest; + PyInterp_ExecuteEvent( PyInterp_Request* r ) + : myRequest( r ) {} + virtual void Execute() + { + myRequest->execute(); + } +}; + using namespace std; PyInterp_Dispatcher* PyInterp_Dispatcher::myInstance = 0; @@ -49,7 +62,7 @@ void PyInterp_Request::process() void PyInterp_Request::safeExecute() { - execute(); + ProcessVoidEvent( new PyInterp_ExecuteEvent( this ) ); } void PyInterp_Request::Destroy( PyInterp_Request* request ) @@ -62,7 +75,7 @@ void PyInterp_Request::Destroy( PyInterp_Request* request ) QEvent* PyInterp_Request::createEvent() const { - return new PyInterp_Event( PyInterp_Event::NOTIFY, (PyInterp_Request*)this ); + return new PyInterp_Event( PyInterp_Event::ES_NOTIFY, (PyInterp_Request*)this ); } void PyInterp_Request::processEvent( QObject* o ) @@ -94,7 +107,7 @@ void PyInterp_LockRequest::safeExecute() { if ( getInterp() ){ PyLockWrapper aLock = getInterp()->GetLockWrapper(); - execute(); + ProcessVoidEvent( new PyInterp_ExecuteEvent( this ) ); } } diff --git a/src/PyInterp/PyInterp_Dispatcher.h b/src/PyInterp/PyInterp_Dispatcher.h index cf46694e4..5040b1032 100755 --- a/src/PyInterp/PyInterp_Dispatcher.h +++ b/src/PyInterp/PyInterp_Dispatcher.h @@ -35,10 +35,12 @@ class QObject; class PyInterp_Interp; class PyInterp_Watcher; class PyInterp_Dispatcher; +class PyInterp_ExecuteEvent; class PYINTERP_EXPORT PyInterp_Request { friend class PyInterp_Dispatcher; + friend class PyInterp_ExecuteEvent; PyInterp_Request(); PyInterp_Request( const PyInterp_Request& ); @@ -102,7 +104,8 @@ class PYINTERP_EXPORT PyInterp_Event : public QEvent PyInterp_Event( const PyInterp_Event& ); public: - enum { NOTIFY = QEvent::User + 5000, OK, ERROR, INCOMPLETE, LAST }; + //Execution state + enum { ES_NOTIFY = QEvent::User + 5000, ES_OK, ES_ERROR, ES_INCOMPLETE, ES_LAST }; PyInterp_Event( int type, PyInterp_Request* request ) : QEvent( (QEvent::Type)type ), myRequest( request ) {} diff --git a/src/Qtx/QtxActionGroup.cxx b/src/Qtx/QtxActionGroup.cxx new file mode 100644 index 000000000..cc3da3471 --- /dev/null +++ b/src/Qtx/QtxActionGroup.cxx @@ -0,0 +1,361 @@ +// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File: QtxActionGroup.cxx +// Author: Sergey TELKOV + +#include "QtxActionGroup.h" + +#include "QtxComboBox.h" + +#include +#include +#include + +/*! + \class QtxActionGroup + \brief The QtxActionGroup class groups actions together. + + QtxActionGroup class operates with a list of actions in the similar way as it does QActionGroup class. + But in contrast to the Qt 4's class, QtxActrionGroup behaves rather like it was in Qt series 3x. + For example, it automatically shows exclusive combo box widget when action group is added to the toolbar + and if \a usesDropDown and \a exclusive flags are both set to \c true. + + The setExclusive() function is used to ensure that only one action is active at any moment: + it should be used with actions which have their \a checkable state set to \c true. + + Action group actions appear as individual menu options and toolbar buttons. For exclusive action + groups use setUsesDropDown() to display the actions in a subwidget of the toolbar or menu the action group + is added on. + + Actions can be added to the action group using add() function. Add the action group to the menu or + toolbar in the same way as for single action - using addAction() method of QMenu or QToolbar class. +*/ + +/*! + \brief Constructor + + The created action group is exclusive by default. + + \param parent owner object + \sa setExclusive() +*/ +QtxActionGroup::QtxActionGroup( QObject* parent ) +: QtxActionSet( parent ), + myDropDown( false ) +{ + setMenu( new QMenu( 0 ) ); + myActionGroup = new QActionGroup( this ); + + connect( myActionGroup, SIGNAL( triggered( QAction* ) ), this, SLOT( onTriggered( QAction* ) ) ); +} + +/*! + \brief Constructor + \param parent owner object + \param exclusive if \c true only one action in the group will ever be active + \sa setExclusive() +*/ +QtxActionGroup::QtxActionGroup( QObject* parent, const bool exclusive ) +: QtxActionSet( parent ), + myDropDown( false ) +{ + setMenu( new QMenu( 0 ) ); + myActionGroup = new QActionGroup( this ); + myActionGroup->setExclusive( exclusive ); + + connect( myActionGroup, SIGNAL( triggered( QAction* ) ), this, SIGNAL( selected( QAction* ) ) ); +} + +/*! + \brief Destructor. +*/ +QtxActionGroup::~QtxActionGroup() +{ +} + +/*! + \brief Check if the action group is exclusive + \return \c true if the action group is exclusive and \c false otherwise + \sa setExclusive(), setUsesDropDown() +*/ +bool QtxActionGroup::isExclusive() const +{ + return myActionGroup->isExclusive(); +} + +/*! + \brief Set/clear the action group exclusiveness + \param on if \c true the action group will be exclusive + \sa isExclusive(), setUsesDropDown() +*/ +void QtxActionGroup::setExclusive( const bool on ) +{ + if ( myActionGroup->isExclusive() == on ) + return; + + bool e = isEmptyAction(); + + myActionGroup->setExclusive( on ); + + if ( e != isEmptyAction() ) + updateType(); +} + +/*! + \brief Check if action group should appear in a subwidget of parent widget + + Note: for this option to take into effect, the \a exclusive flag should + be also set to \c true + + \return \c true if the action group is shown in subwidget + \sa setUsesDropDown(), setExclusive() +*/ +bool QtxActionGroup::usesDropDown() const +{ + return myDropDown; +} + +/*! + \brief Defines a way how the group's actions should be displayed in parent widget + action group is added to - as a group of actions or in a subwidget (e.g. in the + combo box). + \param on if \c true, action group will be shown in the subwidget + \sa usesDropDown(), setExclusive() +*/ +void QtxActionGroup::setUsesDropDown( const bool on ) +{ + if ( myDropDown == on ) + return; + + bool e = isEmptyAction(); + + myDropDown = on; + + if ( e != isEmptyAction() ) + updateType(); +} + +/*! + \brief Append the specified action into group. + \a action action to be added to the action group +*/ +void QtxActionGroup::add( QAction* a ) +{ + insertAction( a ); +} + +/*! + \brief Called when some subwidget item is activated by the user. + \param id item identifier +*/ +void QtxActionGroup::onActivated( int id ) +{ + const QObject* s = sender(); + + QAction* a = action( id ); + if ( !a ) + return; + + if ( a->isChecked() ) + return; + + a->setChecked( true ); + a->trigger(); + + QList lst = createdWidgets(); + for ( QList::iterator it = lst.begin(); it != lst.end(); ++it ) + { + QtxComboBox* cb = ::qobject_cast( *it ); + if ( cb && cb != s ) + cb->setCurrentId( id ); + } +} + +/*! + \brief Called when some action owned by this action group is activated by the user + \param a action being activated +*/ +void QtxActionGroup::onTriggered( QAction* a ) +{ + int id = actionId( a ); + if ( id != -1 ) { + QList lst = createdWidgets(); + for ( QList::iterator it = lst.begin(); it != lst.end(); ++it ) + { + QtxComboBox* cb = ::qobject_cast( *it ); + if ( cb ) + cb->setCurrentId( id ); + } + } + + emit selected( a ); +} + +/*! + \brief Update action group for the specified widget. + \param w a widget this action group is added to +*/ +void QtxActionGroup::updateAction( QWidget* w ) +{ + if ( !::qobject_cast( w ) && !::qobject_cast( w ) ) { + QtxComboBox* cb = createdWidget( w ); + if ( !cb ) + QtxActionSet::updateAction( w ); + else + { + updateAction( cb ); + + QList lst = actions(); + for ( QList::iterator it = lst.begin(); it != lst.end(); ++it ) + w->removeAction( *it ); + } + } + else + { + if ( !usesDropDown() ) { + QtxActionSet::updateAction( w ); + } + else { + QList lst = actions(); + for ( QList::iterator it = lst.begin(); it != lst.end(); ++it ) + w->removeAction( *it ); + } + } +} + +/*! + \brief Update action group for the specified combo box. + \param cb a combo box this action group is added to +*/ +void QtxActionGroup::updateAction( QtxComboBox* cb ) +{ + if ( !cb ) + return; + + cb->clear(); + cb->setCleared( false ); + + QAction* cur = 0; + QList lst = actions(); + for ( QList::iterator it = lst.begin(); it != lst.end(); ++it ) + { + QAction* a = *it; + cb->addItem( a->icon(), a->text() ); + cb->setId( cb->count() - 1, actionId( a ) ); + if ( a->isChecked() ) + cur = a; + } + + if ( cur ) + cb->setCurrentId( actionId( cur ) ); + else + cb->setCleared( true ); +} + +/*! + \brief Create widget representing action group in the widget + this action group is added to. + \param p widget this action group is being added to + \return new widget representing this action group +*/ +QWidget* QtxActionGroup::createWidget( QWidget* p ) +{ + if ( ::qobject_cast( p ) || ::qobject_cast( p ) ) + return 0; + + QtxComboBox* cb = !isEmptyAction() ? new QtxComboBox( p ) : 0; + if ( cb ) + connect( cb, SIGNAL( activatedId( int ) ), this, SLOT( onActivated( int ) ) ); + return cb; +} + +/*! + \brief Check if the action itself should be invisible + (only child action are shown) + \return \c true if the action itself should be visible +*/ +bool QtxActionGroup::isEmptyAction() const +{ + return !isExclusive() || !usesDropDown(); +} + +/*! + \brief Called when action is added to the action group + \param a action being added to the action group +*/ +void QtxActionGroup::actionAdded( QAction* a ) +{ + myActionGroup->addAction( a ); + if ( menu() ) + menu()->addAction( a ); +} + +/*! + \brief Called when action is removed from the action group + \param a action being removed from the action group +*/ +void QtxActionGroup::actionRemoved( QAction* a ) +{ + myActionGroup->removeAction( a ); + if ( menu() ) + menu()->removeAction( a ); +} + +/*! + \brief Internal update +*/ +void QtxActionGroup::updateType() +{ + QList lst = associatedWidgets(); + for ( QList::iterator it = lst.begin(); it != lst.end(); ++it ) + { + QWidget* w = *it; + QList lst = w->actions(); + + int i = lst.indexOf( this ); + w->removeAction( this ); + + lst = w->actions(); + w->insertAction( i < lst.count() ? lst.at( i ) : 0, this ); + } + setVisible( !isEmptyAction() ); +} + +/*! + \brief Get combo box created by this action group for the specified widget. + \param p widget this action group is added to + \return combo box if it was created for the specified widget or 0 otherwise +*/ +QtxComboBox* QtxActionGroup::createdWidget( QWidget* p ) +{ + QtxComboBox* cb = 0; + QList lst = createdWidgets(); + for ( QList::iterator it = lst.begin(); it != lst.end() && !cb; ++it ) + { + if ( (*it)->parent() == p ) + cb = ::qobject_cast( *it ); + } + return cb; +} + +/*! + \fn void QtxActionGroup::selected( QAction* a ); + \brief Emitted when some child action is toggled by the user. + \param a action being toggled +*/ diff --git a/src/Qtx/QtxActionGroup.h b/src/Qtx/QtxActionGroup.h new file mode 100644 index 000000000..108d40a53 --- /dev/null +++ b/src/Qtx/QtxActionGroup.h @@ -0,0 +1,82 @@ +// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File: QtxActionGroup.h +// Author: Sergey TELKOV + +#ifndef QTXACTIONGROUP_H +#define QTXACTIONGROUP_H + +#include "QtxActionSet.h" + +#ifdef WIN32 +#pragma warning( disable:4251 ) +#endif + +class QtxComboBox; +class QActionGroup; + +class QTX_EXPORT QtxActionGroup : public QtxActionSet +{ + Q_OBJECT + +public: + QtxActionGroup( QObject* = 0 ); + QtxActionGroup( QObject*, const bool ); + virtual ~QtxActionGroup(); + + bool isExclusive() const; + bool usesDropDown() const; + + void add( QAction* ); + +public slots: + void setExclusive( const bool ); + void setUsesDropDown( const bool ); + +signals: + void selected( QAction* ); + +private slots: + void onActivated( int ); + void onTriggered( QAction* ); + +protected: + virtual void updateAction( QWidget* ); + virtual void updateAction( QtxComboBox* ); + + virtual QWidget* createWidget( QWidget* ); + + virtual bool isEmptyAction() const; + virtual void actionAdded( QAction* ); + virtual void actionRemoved( QAction* ); + +private: + void updateType(); + QtxComboBox* createdWidget( QWidget* ); + +private: + bool myDropDown; + QActionGroup* myActionGroup; +}; + +#ifdef WIN32 +#pragma warning( default:4251 ) +#endif + +#endif diff --git a/src/Qtx/QtxMenu.cxx b/src/Qtx/QtxMenu.cxx new file mode 100644 index 000000000..418e5e61c --- /dev/null +++ b/src/Qtx/QtxMenu.cxx @@ -0,0 +1,409 @@ +// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File: QtxMenu.cxx +// Author: Sergey TELKOV +// + +#include "QtxMenu.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/*! + \class QtxMenu::Title + \brief Popup menu title item. + \internal +*/ + +class QtxMenu::Title : public QWidget +{ +public: + Title( QWidget* = 0 ); + virtual ~Title(); + + QIcon icon() const; + void setIcon( const QIcon& ); + + QString text() const; + void setText( const QString& ); + + Qt::Alignment alignment() const; + void setAlignment( const Qt::Alignment ); + + virtual QSize sizeHint() const; + virtual QSize minimumSizeHint() const; + +protected: + virtual void paintEvent( QPaintEvent* ); + +private: + QIcon myIcon; + QString myText; + Qt::Alignment myAlignment; +}; + +/*! + \brief Constructor. + \param parent parent widget + \internal +*/ +QtxMenu::Title::Title( QWidget* parent ) +: QWidget( parent ), + myAlignment( 0 ) +{ +} + +/*! + \brief Destructor. + \internal +*/ +QtxMenu::Title::~Title() +{ +} + +/*! + \brief Get title icon. + \return title item icon + \internal +*/ +QIcon QtxMenu::Title::icon() const +{ + return myIcon; +} + +/*! + \brief Set title icon. + \param ico title item icon + \internal +*/ +void QtxMenu::Title::setIcon( const QIcon& ico ) +{ + myIcon = ico; +} + +/*! + \brief Get title menu text. + \return menu text for the title item + \internal +*/ +QString QtxMenu::Title::text() const +{ + return myText; +} + +/*! + \brief Set title menu text. + \param txt menu text to be used for the title item + \internal +*/ +void QtxMenu::Title::setText( const QString& txt ) +{ + myText = txt; +} + +/*! + \brief Get title alignment flags. + \return title alignment flags + \internal +*/ +Qt::Alignment QtxMenu::Title::alignment() const +{ + return myAlignment; +} + +/*! + \brief Set title alignment flags. + \param a title alignment flags + \internal +*/ +void QtxMenu::Title::setAlignment( const Qt::Alignment a ) +{ + myAlignment = a; +} + +/*! + \brief Get recommended size for the title item widget. + \return title item widget size + \internal +*/ +QSize QtxMenu::Title::sizeHint() const +{ + int m = 5; + QTextDocument doc; + doc.setHtml( text() ); + + QSize sz = icon().isNull() ? QSize( 0, 0 ) : icon().actualSize( QSize( 16, 16 ) ); + sz.setWidth( 2 * m + sz.width() + (int)doc.size().width() ); + sz.setHeight( 2 * m + qMax( sz.height(), (int)doc.size().height() ) ); + return sz; +} + +/*! + \brief Get recommended minimum size for the title item widget. + \return title item widget minimum size + \internal +*/ +QSize QtxMenu::Title::minimumSizeHint() const +{ + return sizeHint(); +} + +/*! + \brief Paint the title item widget. + \param e paint event (not used) + \internal +*/ +void QtxMenu::Title::paintEvent( QPaintEvent* /*e*/ ) +{ + int m = 5; + QIcon ico = icon(); + QString txt = text(); + Qt::Alignment align = alignment(); + + QRect base = rect(); + base.setTop( base.top() + 1 ); + base.setLeft( base.left() + 1 ); + base.setRight( base.right() -1 ); + base.setBottom( base.bottom() - 1 ); + + QTextDocument doc; + doc.setHtml( txt ); + + QSize isz = ico.isNull() ? QSize( 0, 0 ) : ico.actualSize( QSize( 16, 16 ) ); + QSize sz( (int)doc.size().width(), (int)doc.size().height() ); + + QPainter p( this ); + QAbstractTextDocumentLayout::PaintContext ctx; + ctx.palette.setColor( QPalette::Text, palette().color( QPalette::Light ) ); + + QLinearGradient linearGrad( base.topLeft(), base.topRight() ); + linearGrad.setColorAt( 0, palette().color( QPalette::Highlight ) ); + linearGrad.setColorAt( 1, palette().color( QPalette::Window ) ); + + p.fillRect( base, linearGrad ); + + QPoint start = base.topLeft() + QPoint( m, m ); + if ( align & Qt::AlignLeft ) + start.setX( base.left() + m ); + else if ( align & Qt::AlignRight ) + start.setX( base.right() - m - isz.width() - sz.width() ); + else if ( align & Qt::AlignHCenter ) + start.setX( base.left() + ( base.width() - isz.width() - sz.width() ) / 2 ); + + if ( align & Qt::AlignTop ) + start.setY( base.top() + m ); + else if ( align & Qt::AlignBottom ) + start.setY( base.bottom() - m - qMax( isz.height(), - sz.height() ) ); + else if ( align & Qt::AlignVCenter ) + start.setY( base.top() + ( base.height() - qMax( isz.height(), sz.height() ) ) / 2 ); + + if ( !ico.isNull() ) + { + ico.paint( &p, QRect( start, isz ) ); + start.setX( start.x() + isz.width() ); + } + + p.save(); + p.translate( start ); + doc.documentLayout()->draw( &p, ctx ); + p.restore(); +} + +/*! + \class QtxMenu + \brief The class QtxMenu represents the popup menu with the title. + + The title for the popup menu can be set via setTitleText() method. + In addition, title item can contain the icon, which can be set using + setTitleIcon() method. Current title text and icon can be retrieved with + titleText() and titleIcon() methods. + + The title text alignment flags can be changed using setTitleAlignment() + method and retrieved with titleAlignment() method. + + By default, QtxMenu::TitleAuto mode is used. In this mode, the title item + is shown only if it is not empty. To show title always (even empty), pass + QtxMenu::TitleOn to the setTitleMode() method. To hide the title, use + setTitleMode() method with QtxMenu::TitleOff parameter. +*/ + +/*! + \brief Constructor. + \param parent parent widget +*/ +QtxMenu::QtxMenu( QWidget* parent ) +: QMenu( parent ), + myMode( TitleAuto ) +{ + myTitle = new Title( this ); + myAction = new QWidgetAction( this ); + myAction->setDefaultWidget( myTitle ); +} + +/*! + \brief Destructor. +*/ +QtxMenu::~QtxMenu() +{ +} + +/*! + \brief Get title menu text. + \return menu text for the title item +*/ +QString QtxMenu::titleText() const +{ + return myTitle->text(); +} + +/*! + \brief Get title icon. + \return title item icon +*/ +QIcon QtxMenu::titleIcon() const +{ + return myTitle->icon(); +} + +/*! + \brief Get title item display mode. + \return popup menu title display mode (QtxMenu::TitleMode) +*/ +QtxMenu::TitleMode QtxMenu::titleMode() const +{ + return myMode; +} + +/*! + \brief Get title alignment flags. + \return title alignment flags +*/ +Qt::Alignment QtxMenu::titleAlignment() const +{ + return myTitle->alignment(); +} + +/*! + \brief Set title menu text. + \param txt menu text to be used for the title item +*/ +void QtxMenu::setTitleText( const QString& txt ) +{ + if ( titleText() == txt ) + return; + + myTitle->setText( txt ); + + updateTitle(); +} + +/*! + \brief Set title icon. + \param ico title item icon +*/ +void QtxMenu::setTitleIcon( const QIcon& ico ) +{ + myTitle->setIcon( ico ); + + updateTitle(); +} + +/*! + \brief Set title item display mode. + \param m popup menu title display mode (QtxMenu::TitleMode) +*/ +void QtxMenu::setTitleMode( const QtxMenu::TitleMode m ) +{ + if ( myMode == m ) + return; + + myMode = m; + + updateTitle(); +} + +/*! + \brief Set title alignment flags. + \param a title alignment flags +*/ +void QtxMenu::setTitleAlignment( const Qt::Alignment a ) +{ + if ( titleAlignment() == a ) + return; + + myTitle->setAlignment( a ); + + updateTitle(); +} + +/*! + \brief Customize show/hide menu operation. + \param on new popup menu visibility state +*/ +void QtxMenu::setVisible( bool on ) +{ + if ( on ) + insertTitle(); + + QMenu::setVisible( on ); + + if ( !on ) + removeTitle(); +} + +/*! + \brief Insert title item to the popup menu. +*/ +void QtxMenu::insertTitle() +{ + if ( titleMode() == TitleOff || ( titleMode() == TitleAuto && titleText().trimmed().isEmpty() ) ) + return; + + if ( actions().isEmpty() ) + addAction( myAction ); + else + insertAction( actions().first(), myAction ); +} + +/*! + \brief Remove title item from the popup menu. +*/ +void QtxMenu::removeTitle() +{ + if ( actions().contains( myAction ) ) + removeAction( myAction ); +} + +/*! + \brief Update title item. +*/ +void QtxMenu::updateTitle() +{ + if ( !actions().contains( myAction ) ) + return; + + removeTitle(); + insertTitle(); +} diff --git a/src/Qtx/QtxMenu.h b/src/Qtx/QtxMenu.h new file mode 100644 index 000000000..9a50f23c7 --- /dev/null +++ b/src/Qtx/QtxMenu.h @@ -0,0 +1,76 @@ +// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File: QtxMenu.h +// Author: Sergey TELKOV +// + +#ifndef QTXMENU_H +#define QTXMENU_H + +#include "Qtx.h" + +#include + +class QWidgetAction; + +class QTX_EXPORT QtxMenu : public QMenu +{ + Q_OBJECT + + class Title; + +public: + //! Popup menu title mode + typedef enum { + TitleAuto, //!< auto mode + TitleOn, //!< always on (display title) + TitleOff //!< always off (do not display title) + } TitleMode; + +public: + QtxMenu( QWidget* = 0 ); + virtual ~QtxMenu(); + + QIcon titleIcon() const; + QString titleText() const; + + TitleMode titleMode() const; + Qt::Alignment titleAlignment() const; + + virtual void setTitleIcon( const QIcon& ); + virtual void setTitleText( const QString& ); + + virtual void setTitleMode( const TitleMode ); + virtual void setTitleAlignment( const Qt::Alignment ); + +public slots: + virtual void setVisible( bool ); + +private: + void updateTitle(); + void insertTitle(); + void removeTitle(); + +private: + TitleMode myMode; + Title* myTitle; + QWidgetAction* myAction; +}; + +#endif // QTXMENU_H diff --git a/src/Qtx/QtxRubberBand.cxx b/src/Qtx/QtxRubberBand.cxx new file mode 100755 index 000000000..1fb2fad37 --- /dev/null +++ b/src/Qtx/QtxRubberBand.cxx @@ -0,0 +1,313 @@ +// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File: QtxRubberBand.cxx +// Author: Alexander A. BORODIN +// + +#include "QtxRubberBand.h" + +#include +#include +#include +#include +#include +#include +#include + +/*! + \class QtxAbstractRubberBand + \brief Analog of class QRubberBand with possibility of creation non-rectangular contour for selection. + + Currently this class does not support Style functionality in full. +*/ + +/*! + \brief Constructor + \param theParent parent widget + */ + +QtxAbstractRubberBand::QtxAbstractRubberBand( QWidget* theParent) + : QWidget( theParent/*,Qt::ToolTip*/ ), + myPoints(), + myIsClosed( false ) +{ + setAttribute(Qt::WA_TransparentForMouseEvents); +#ifndef WIN32 + setAttribute(Qt::WA_NoSystemBackground); +#endif //WIN32 + setAttribute(Qt::WA_WState_ExplicitShowHide); + setVisible(false); + theParent->installEventFilter(this); + setGeometry( QRect(QPoint(0,0), theParent->size() ) ); +} + +/*! + \brief Destructor + */ +QtxAbstractRubberBand::~QtxAbstractRubberBand() +{ +} + +void QtxAbstractRubberBand::clearGeometry() +{ + myPoints.clear(); +} + +bool QtxAbstractRubberBand::isClosed() +{ + return myIsClosed; +} + +void QtxAbstractRubberBand::paintEvent( QPaintEvent* theEvent ) +{ + if ( !myPoints.empty() ) + { + QPixmap tiledPixmap(16, 16); + + QPainter pixmapPainter(&tiledPixmap); + pixmapPainter.setPen(Qt::NoPen); + pixmapPainter.setBrush(QBrush( Qt::black, Qt::Dense4Pattern )); + pixmapPainter.setBackground(QBrush( Qt::white )); + pixmapPainter.setBackgroundMode(Qt::OpaqueMode); + pixmapPainter.drawRect(0, 0, tiledPixmap.width(), tiledPixmap.height()); + pixmapPainter.end(); + // ### workaround for borked XRENDER + tiledPixmap = QPixmap::fromImage(tiledPixmap.toImage()); + + + + QPainter aPainter( this ); + aPainter.setRenderHint( QPainter::Antialiasing ); + QRect r = myPoints.boundingRect(); + aPainter.setClipRegion( r.normalized().adjusted( -1, -1, 2, 2 ) ); + aPainter.drawTiledPixmap( 0, 0, width(), height(), tiledPixmap); + + aPainter.end(); + + /* + + + +#ifdef WIN32 + QPixmap anImage( size() ); +#else + QImage anImage( size(), QImage::Format_ARGB32_Premultiplied ); +#endif + + anImage.fill( Qt::transparent ); + QPainter aImgPainter( &anImage ); + aImgPainter.setRenderHint( QPainter::Antialiasing ); + aImgPainter.setCompositionMode(QPainter::CompositionMode_Source); + + QPen aPen( Qt::black ); + aPen.setWidth( 2 ); + aImgPainter.setPen( aPen ); + + aImgPainter.drawPolyline( myPoints ); + if ( myIsClosed && myPoints.last() != myPoints.first() ) + aImgPainter.drawLine( myPoints.last(), myPoints.first() ); + + //aImgPainter.setPen(Qt::NoPen); + //aImgPainter.setBrush(QBrush( Qt::white, Qt::Dense4Pattern)); + //aImgPainter.setCompositionMode(QPainter::CompositionMode_SourceAtop); + //aImgPainter.drawRect(0, 0, width(), height()); + aImgPainter.end(); + + QPainter aPainter( this ); + aPainter.drawPolyline( myPoints ); + if ( myIsClosed && myPoints.last() != myPoints.first() ) + aPainter.drawLine( myPoints.last(), myPoints.first() ); + +#ifdef WIN32 + aPainter.drawPixmap( 0, 0, anImage ); +#else + aPainter.drawImage( 0, 0, anImage ); + #endif + aPainter.end();*/ + + } +} + +void QtxAbstractRubberBand::showEvent( QShowEvent* theEvent ) +{ + raise(); + theEvent->ignore(); +} + +void QtxAbstractRubberBand::moveEvent( QMoveEvent* ) +{ +} + +void QtxAbstractRubberBand::resizeEvent( QResizeEvent* ) +{ +} + +bool QtxAbstractRubberBand::eventFilter( QObject* obj, QEvent* e ) +{ + if ( obj && obj == parent() && e->type() == QEvent::Resize ) + { + QWidget* p = (QWidget*)parent(); + setGeometry( QRect(QPoint(0,0), p->size() ) ); + } + return QWidget::eventFilter( obj, e ); +} + +QRegion createRegion( const QPointF& p1, const QPointF& p2 ) +{ + if ( p1 == p2 ) + return QRegion(); + + QLineF n = QLineF( p1, p2 ).normalVector();//.unitVector(); + n.setLength( 1 ); + n.translate( p1 * -1 ); + QPointF nPoint = n.p2(); + + QPolygonF p; + p << p1 + nPoint << p2 + nPoint << p2 - nPoint << p1 - nPoint << p1 + nPoint; + + return QRegion( p.toPolygon() ); +} + +void QtxAbstractRubberBand::updateMask() +{ + QRegion r; + + QVectorIterator it(myPoints); + while( it.hasNext() ) + { + QPoint p = it.next(); + if( !it.hasNext() ) + break; + + QPoint np = it.peekNext(); + + if ( p == np ) continue; + + r += createRegion( p, np ); + } + + if ( isClosed() ) + r += createRegion( myPoints.last(), myPoints.first() ); + + setMask( r ); + +} + + +QtxRectRubberBand::QtxRectRubberBand(QWidget* parent) + :QtxAbstractRubberBand( parent ) +{ + myPoints.resize( 4 ); + myIsClosed = true; +} + +QtxRectRubberBand::~QtxRectRubberBand() +{ +} + +void QtxRectRubberBand::initGeometry( const QRect& theRect ) +{ + myPoints.clear(); + myPoints << theRect.topLeft() << theRect.topRight() << theRect.bottomRight() << theRect.bottomLeft(); + //setMask( QRegion( myPoints ) ); + updateMask(); +} + +void QtxRectRubberBand::setStartPoint( const QPoint& thePoint ) +{ + myPoints[0] = thePoint; + myPoints[1].setY( thePoint.y() ); + myPoints[3].setX( thePoint.x() ); + updateMask(); +} + +void QtxRectRubberBand::setEndPoint( const QPoint& thePoint) +{ + myPoints[2] = thePoint; + myPoints[1].setX( thePoint.x() ); + myPoints[3].setY( thePoint.y() ); + updateMask(); +} + +void QtxRectRubberBand::clearGeometry() +{ + QMutableVectorIterator i(myPoints); + while (i.hasNext()) + { + i.next(); + i.setValue( QPoint( -1, -1 ) ); + } +} + + +QtxPolyRubberBand::QtxPolyRubberBand(QWidget* parent) + :QtxAbstractRubberBand( parent ) +{ +} + +QtxPolyRubberBand::~QtxPolyRubberBand() +{ +} + +void QtxPolyRubberBand::initGeometry( const QPolygon& thePoints ) +{ + myPoints = thePoints; + updateMask(); +} + +void QtxPolyRubberBand::initGeometry( const QPoint& thePoint ) +{ + myPoints.clear(); + myPoints << thePoint; + updateMask(); +} + +void QtxPolyRubberBand::addNode( const QPoint& thePoint ) +{ + myPoints << thePoint; + updateMask(); +} + +void QtxPolyRubberBand::replaceLastNode( const QPoint& thePoint ) +{ + if ( !myPoints.empty() ) + { + myPoints.pop_back(); + myPoints << thePoint; + updateMask(); + } +} + +void QtxPolyRubberBand::removeLastNode() +{ + if ( !myPoints.empty() ) + { + myPoints.pop_back(); + updateMask(); + } +} + +void QtxPolyRubberBand::setClosed( bool theFlag ) +{ + if (myIsClosed != theFlag ) + { + myIsClosed = theFlag; + updateMask(); + } +} diff --git a/src/Qtx/QtxRubberBand.h b/src/Qtx/QtxRubberBand.h new file mode 100755 index 000000000..e16426167 --- /dev/null +++ b/src/Qtx/QtxRubberBand.h @@ -0,0 +1,89 @@ +// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File: QtxRubberBand.h +// Author: Alexander A. BORODIN +// + +#ifndef QTXRUBBERBAND_H +#define QTXRUBBERBAND_H + +#include "Qtx.h" + +#include + +class QTX_EXPORT QtxAbstractRubberBand: public QWidget +{ +protected: + QtxAbstractRubberBand( QWidget* ); + +public: + virtual ~QtxAbstractRubberBand(); + + virtual void clearGeometry(); + + bool isClosed(); + +protected: + virtual void paintEvent( QPaintEvent* ); + virtual void showEvent( QShowEvent* ); + virtual void moveEvent( QMoveEvent* ); + virtual void resizeEvent( QResizeEvent* ); + + virtual bool eventFilter( QObject*, QEvent* ); + + virtual void updateMask(); + +protected: + QPolygon myPoints; + + bool myIsClosed; +}; + +class QTX_EXPORT QtxRectRubberBand: public QtxAbstractRubberBand +{ +public: + + QtxRectRubberBand( QWidget* ); + virtual ~QtxRectRubberBand(); + + void initGeometry( const QRect& ); + void setStartPoint( const QPoint& ); + void setEndPoint( const QPoint& ); + + virtual void clearGeometry(); +}; + +class QTX_EXPORT QtxPolyRubberBand: public QtxAbstractRubberBand +{ +public: + + QtxPolyRubberBand( QWidget* ); + virtual ~QtxPolyRubberBand(); + + void initGeometry( const QPolygon& ); + void initGeometry( const QPoint& ); + + void addNode( const QPoint& ); + void replaceLastNode( const QPoint& ); + void removeLastNode(); + + void setClosed( bool ); +}; + +#endif //QTXRUBBERBAND_H diff --git a/src/Qtx/QtxTranslator.cxx b/src/Qtx/QtxTranslator.cxx new file mode 100644 index 000000000..f3f955be1 --- /dev/null +++ b/src/Qtx/QtxTranslator.cxx @@ -0,0 +1,78 @@ +// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File: QtxTranslator.cxx +// Author: Alexander SOLOVYOV + +#include "QtxTranslator.h" + +/*! + \class QtxTranslator + \brief Extended version of QTranslator + + In addition to the functionality provided by QTranslator class, QtxTranslator + allows translating resources defined in the global context (i.e. common resources). + The QtxTranslator can be used to workaround QTranslator's limitation which + does not allow to process messages with global context. + + For the current moment global context should be specified in translation + (*.ts/*.qm) files as "@default" string. For example: + \verbatim + + + @default + + MY_MESSAGE + My translated message + + + + \endverbatim +*/ + +#define GLOBAL_CONTEXT "@default" + +/*! + \brief Constructor. +*/ +QtxTranslator::QtxTranslator( QObject* parent ) +: QTranslator( parent ) +{ +} + +/*! + \brief Destructor. +*/ +QtxTranslator::~QtxTranslator() +{ +} + +/*! + \brief Returns the translation for the key. + \param context message context + \param sourceText message source name + \param comment message comment (optional) + \return Translated text if found or \a sourceText otherwise +*/ +QString QtxTranslator::translate( const char* context, const char* sourceText, const char* comment ) const +{ + QString res = QTranslator::translate( context, sourceText, comment ); + if( res.isNull() ) + res = QTranslator::translate( GLOBAL_CONTEXT, sourceText, comment ); + return res; +} diff --git a/src/Qtx/QtxTranslator.h b/src/Qtx/QtxTranslator.h new file mode 100644 index 000000000..a2c9ae058 --- /dev/null +++ b/src/Qtx/QtxTranslator.h @@ -0,0 +1,35 @@ +// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File: QtxTranslator.h +// Author: Alexander SOLOVYOV + +#ifndef QTXTRANSLATOR_H +#define QTXTRANSLATOR_H + +#include + +class QtxTranslator : public QTranslator +{ +public: + QtxTranslator( QObject* parent = 0 ); + ~QtxTranslator(); + virtual QString translate( const char*, const char*, const char* = 0 ) const; +}; + +#endif -- 2.39.2