From: mpa Date: Thu, 8 Aug 2013 14:06:50 +0000 (+0000) Subject: 0022171: EDF 2477 GUI: Redesign of the "split" action and addition of a "tile" action X-Git-Tag: BR_hydro_v_0_3_1~89 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6b44d761bb8435bd7ca6ad1891065fc223f27963;p=modules%2Fgui.git 0022171: EDF 2477 GUI: Redesign of the "split" action and addition of a "tile" action --- diff --git a/doc/salome/gui/images/arrange_views_dlg.png b/doc/salome/gui/images/arrange_views_dlg.png new file mode 100644 index 000000000..cd5c2d930 Binary files /dev/null and b/doc/salome/gui/images/arrange_views_dlg.png differ diff --git a/doc/salome/gui/images/create_sub-views_dlg.png b/doc/salome/gui/images/create_sub-views_dlg.png new file mode 100644 index 000000000..b2c57447e Binary files /dev/null and b/doc/salome/gui/images/create_sub-views_dlg.png differ diff --git a/doc/salome/gui/images/windowmenu.png b/doc/salome/gui/images/windowmenu.png index 6e47ee86a..b1991900d 100755 Binary files a/doc/salome/gui/images/windowmenu.png and b/doc/salome/gui/images/windowmenu.png differ diff --git a/doc/salome/gui/input/occ_3d_viewer.doc b/doc/salome/gui/input/occ_3d_viewer.doc index e27d346d3..4eb31fce6 100644 --- a/doc/salome/gui/input/occ_3d_viewer.doc +++ b/doc/salome/gui/input/occ_3d_viewer.doc @@ -208,8 +208,28 @@ on/off. \image html occ_view_minimized.png \image html occ_view_maximized.png -Minimize/Maximize - these buttons allow switching the current +Create sub-views/Maximize - these buttons allow switching the current view area to the minimized / maximized state. + +Create sub-views - user can select the layout and types of child sub-views: + +\image html create_sub-views_dlg.png + +- Sub-views Layout + + - Three radio-buttons to specify numbers of the views to arrange (2, 3 or 4). + + - Buttons (depending on the chosen number of views) with images to specify + view layout. + + - Buttons "Previous" and "Next" for possibility to change split schemas. + +- Sub-views Properties + + - Type of each sub-view: XZ, YZ, XY or XYZ. + +Maximize - the current view area will be converted to maximized state. +
\image html occ_view_sync.png diff --git a/doc/salome/gui/input/salome_desktop.doc b/doc/salome/gui/input/salome_desktop.doc index 5ce734d80..03704ae0b 100644 --- a/doc/salome/gui/input/salome_desktop.doc +++ b/doc/salome/gui/input/salome_desktop.doc @@ -96,6 +96,30 @@ viewer.
  • Close - closes the currently active viewer window.
  • Close all - closes all viewer windows.
  • Group all - arranges all created viewer windows on the same desktop
  • +
  • Arrange Views - choice of split scheme and list of used views. +\image html arrange_views_dlg.png + +- Views Layout + + - Three radio-buttons to specify numbers of the views to arrange (2, 3 or 4). + + - Buttons (depending on the chosen number of views) with images to specify + view layout. + + - Buttons "Previous" and "Next" for possibility to change split schemas. + +- Views List + + - The list of opened view windows - the user have to select corresponding + views to be arranged. + + - Two radio-buttons that specify an action to be applied to the remaining views. + + - "Close the remaining views" - all remaining views will be closed. + + - "Stack the remaining views" - all remaining views will be stacker to the + last tab area. +
  • Split Vertically and Split Horizontally allows to split the representation area into two parts, in horizontal or vertical direction.
  • diff --git a/src/OCCViewer/OCCViewer_ViewFrame.cxx b/src/OCCViewer/OCCViewer_ViewFrame.cxx index d9b3397bd..6e7667829 100644 --- a/src/OCCViewer/OCCViewer_ViewFrame.cxx +++ b/src/OCCViewer/OCCViewer_ViewFrame.cxx @@ -25,13 +25,18 @@ #include "OCCViewer_ViewModel.h" #include +#include +#include + +#include +#include #include #include #include OCCViewer_ViewFrame::OCCViewer_ViewFrame(SUIT_Desktop* theDesktop, OCCViewer_Viewer* theModel) - : OCCViewer_ViewWindow( theDesktop, theModel ), myPopupRequestedView(0) + : OCCViewer_ViewWindow( theDesktop, theModel ), myPopupRequestedView(0), mySplitMode(-1) { QFrame* centralFrame = new QFrame( this ); setCentralWidget( centralFrame ); @@ -45,7 +50,8 @@ OCCViewer_ViewFrame::OCCViewer_ViewFrame(SUIT_Desktop* theDesktop, OCCViewer_Vie myLayout->setMargin( 0 ); myLayout->setSpacing( 1 ); - myLayout->addWidget( view0, 1, 1 ); + myLayout->addWidget( view0, 0, 0 ); + myMaximizedView = view0; connectViewSignals(view0); } @@ -79,70 +85,176 @@ void OCCViewer_ViewFrame::setViewManager( SUIT_ViewManager* theMgr ) } } - //************************************************************************************** void OCCViewer_ViewFrame::onMaximizedView( OCCViewer_ViewWindow* theView, bool isMaximized) { + myMaximizedView = theView; if (isMaximized) { if (myViews.count() <= 1) return; - myLayout->setColumnStretch(0, 0); myLayout->setColumnStretch(1, 0); + myLayout->addWidget( theView, 0, 0 ); int i = 0; OCCViewer_ViewWindow* view = 0; - for ( i = BOTTOM_RIGHT; i <= TOP_RIGHT; i++) { + for ( i = BOTTOM_RIGHT; i <= TOP_RIGHT; i++ ) { view = myViews.at(i); view->setVisible( view == theView ); view->setMaximized( view == theView, false ); } + mySplitMode = -1; + myViewsMode.clear(); } else { - OCCViewer_Viewer* aModel = dynamic_cast(myManager->getViewModel()); - if (!aModel) return; + createSubViews(); - myLayout->setColumnStretch(0, 10); - myLayout->setColumnStretch(1, 10); - - int i = 0; - if (myViews.count() == 1) { - //QColor aColor = myViews.at( MAIN_VIEW )->backgroundColor(); - OCCViewer_ViewWindow* view = 0; - for ( i = BOTTOM_LEFT; i <= TOP_RIGHT; i++) { - view = aModel->createSubWindow(); - view->set2dMode( (Mode2dType) i ); - view->setParent( centralWidget() ); - view->setViewManager(myManager); - updateWindowTitle( view ); - myViews.append( view ); - aModel->initView(view); - view->setMaximized(false, false); - view->setDropDownButtons( dropDownButtons() ); - connectViewSignals(view); - view->setBackground(aModel->background(i)); - } - myLayout->addWidget( myViews.at(BOTTOM_LEFT), 1, 0 ); - myLayout->addWidget( myViews.at(TOP_LEFT), 0, 0 ); - myLayout->addWidget( myViews.at(TOP_RIGHT), 0, 1 ); + QtxSplitDlg CreateSubViewsDlg( this, NULL, CreateSubViews ); + if ( CreateSubViewsDlg.exec() ) { + mySplitMode = CreateSubViewsDlg.getSplitMode(); + myViewsMode = CreateSubViewsDlg.getViewsMode(); + splitSubViews(); } + else { + myMaximizedView->setMaximized(true); + } + } + myLayout->invalidate(); +} + +//************************************************************************************** +void OCCViewer_ViewFrame::createSubViews() +{ + OCCViewer_Viewer* aModel = dynamic_cast(myManager->getViewModel()); + if (!aModel) return; + int i = 0; + if (myViews.count() == 1) { + //QColor aColor = myViews.at( MAIN_VIEW )->backgroundColor(); OCCViewer_ViewWindow* view = 0; - for ( i = BOTTOM_RIGHT; i <= TOP_RIGHT; i++) { - view = myViews.at(i); + for ( i = BOTTOM_LEFT; i <= TOP_RIGHT; i++) { + view = aModel->createSubWindow(); + view->set2dMode( (Mode2dType) i ); + view->setParent( centralWidget() ); + view->setViewManager(myManager); + updateWindowTitle( view ); + myViews.append( view ); + aModel->initView(view); + view->setMaximized(false, false); + view->setDropDownButtons( dropDownButtons() ); + connectViewSignals(view); + view->setBackground(aModel->background(i)); + } + } +} + +void OCCViewer_ViewFrame::splitSubViews() +{ + if( mySplitMode == -1 ) + return; + + int aNbViews; + if ( mySplitMode >= 0 && mySplitMode < 2) + aNbViews = 2; + else if( mySplitMode >= 2 && mySplitMode < 8 ) + aNbViews = 3; + else if( mySplitMode >=8 && mySplitMode < 29 ) + aNbViews = 4; + + if( aNbViews != myViewsMode.count() ) + return; + + int SubViews3Map[6][3][4] = { + { {0,0,1,1}, {0,1,1,1}, {0,2,1,1} }, + { {0,0,1,1}, {1,0,1,1}, {2,0,1,1} }, + { {0,0,1,1}, {1,0,1,1}, {0,1,2,1} }, + { {0,0,2,1}, {0,1,1,1}, {1,1,1,1} }, + { {0,0,1,2}, {1,0,1,1}, {1,1,1,1} }, + { {0,0,1,1}, {0,1,1,1}, {1,0,1,2} } + }; + + int SubViews4Map[21][4][4] = { + { {0,0,1,1}, {0,1,1,1}, {0,2,1,1}, {0,3,1,1} }, + { {0,0,1,1}, {1,0,1,1}, {2,0,1,1}, {3,0,1,1} }, + { {0,0,1,1}, {0,1,1,1}, {1,0,1,1}, {1,1,1,1} }, + { {0,0,1,1}, {1,0,1,1}, {0,1,2,1}, {0,2,2,1} }, + { {0,0,2,1}, {0,1,1,1}, {1,1,1,1}, {0,2,2,1} }, + { {0,0,2,1}, {0,1,2,1}, {0,2,1,1}, {1,2,1,1} }, + { {0,0,1,1}, {0,1,1,1}, {1,0,1,2}, {2,0,1,2} }, + { {0,0,1,2}, {1,0,1,1}, {1,1,1,1}, {2,0,1,2} }, + { {0,0,1,2}, {1,0,1,2}, {2,0,1,1}, {2,1,1,1} }, + { {0,0,1,1}, {1,0,1,1}, {0,1,2,1}, {2,0,1,2} }, + { {0,0,2,1}, {0,1,1,1}, {1,1,1,1}, {2,0,1,2} }, + { {0,0,1,2}, {1,0,1,1}, {2,0,1,1}, {1,1,2,1} }, + { {0,0,1,2}, {1,0,2,1}, {1,1,1,1}, {2,1,1,1} }, + { {0,0,2,1}, {0,1,1,1}, {0,2,1,1}, {1,1,1,2} }, + { {0,0,2,1}, {0,1,1,2}, {1,1,1,1}, {1,2,1,1} }, + { {0,0,1,1}, {0,1,1,1}, {1,0,1,2}, {0,2,2,1} }, + { {0,0,1,2}, {1,0,1,1}, {1,1,1,1}, {0,2,2,1} }, + { {0,0,1,3}, {1,0,1,1}, {1,1,1,1}, {1,2,1,1} }, + { {0,0,1,1}, {0,1,1,1}, {0,2,1,1}, {1,0,1,3} }, + { {0,0,1,1}, {1,0,1,1}, {2,0,1,1}, {0,1,3,1} }, + { {0,0,3,1}, {0,1,1,1}, {1,1,1,1}, {2,1,1,1} }, + }; + + if( aNbViews == 2 ) { + if( mySplitMode == 0 ) { + myLayout->addWidget( myViews.at(myViewsMode[0]), 0,0,2,1 ); + myLayout->addWidget( myViews.at(myViewsMode[1]), 0,1,2,1 ); + } + else if( mySplitMode == 1 ) { + myLayout->addWidget( myViews.at(myViewsMode[0]), 0,0,1,2 ); + myLayout->addWidget( myViews.at(myViewsMode[1]), 1,0,1,2 ); + } + } + else if( aNbViews == 3 ) { + int aSplitMode = mySplitMode - 2; + for( int i = 0; i < 3; i++ ) { + myLayout->addWidget( myViews.at(myViewsMode[i]), + SubViews3Map[aSplitMode][i][0], + SubViews3Map[aSplitMode][i][1], + SubViews3Map[aSplitMode][i][2], + SubViews3Map[aSplitMode][i][3]); + } + } + else if( aNbViews == 4 ) { + int aSplitMode = mySplitMode - 8; + for( int i = 0; i < 4; i++ ) { + myLayout->addWidget( myViews.at(myViewsMode[i]), + SubViews4Map[aSplitMode][i][0], + SubViews4Map[aSplitMode][i][1], + SubViews4Map[aSplitMode][i][2], + SubViews4Map[aSplitMode][i][3]); + } + } + + OCCViewer_ViewWindow* view = 0; + for ( int i = 0; i< myViews.count(); i++ ) { + view = myViews.at(i); + bool isShowed = false; + for( int j = 0; j < myViewsMode.count(); j++ ) { + OCCViewer_ViewWindow* view2 = 0; + view2 = myViews.at( myViewsMode[j] ); + if( view == view2 ) + isShowed = true; + } + if( isShowed ) { view->show(); view->setMaximized( false, false ); ///////////////QApplication::processEvents(); // VSR: hangs up ? - if (view != theView) + if ( view != myMaximizedView ) view->onViewFitAll(); } + else + view->setVisible( false ); } - myLayout->invalidate(); } +//************************************************************************************** OCCViewer_ViewPort3d* OCCViewer_ViewFrame::getViewPort(int theView) { return getView(theView)? getView(theView)->getViewPort() : 0; } +//************************************************************************************** void OCCViewer_ViewFrame::updateEnabledDrawMode() { foreach (OCCViewer_ViewWindow* aView, myViews) { @@ -150,6 +262,7 @@ void OCCViewer_ViewFrame::updateEnabledDrawMode() } } +//************************************************************************************** void OCCViewer_ViewFrame::setCuttingPlane( bool on, const double x , const double y , const double z, const double dx, const double dy, const double dz) { @@ -325,6 +438,15 @@ void OCCViewer_ViewFrame::setDropDownButtons( bool on ) QString OCCViewer_ViewFrame::getVisualParameters() { QStringList params; + QStringList splitParams; + if( mySplitMode != -1 && myViewsMode.count() != 0 ) { + splitParams << QString::number( mySplitMode ); + foreach ( int aViewMode, myViewsMode ) + splitParams << QString::number( aViewMode ); + params.append( splitParams.join("*") ); + } + else + params.append( QString::number( mySplitMode ) ); int maximizedView = 999; for ( int i = BOTTOM_RIGHT; i <= TOP_RIGHT && i < myViews.count(); i++) { if ( getView(i)->isVisible() ) @@ -340,13 +462,24 @@ void OCCViewer_ViewFrame::setVisualParameters( const QString& parameters ) QStringList params = parameters.split( "|" ); if ( params.count() > 1 ) { int maximizedView = params[0].toInt(); - if ( myViews.count() < params.count()-1 ) - onMaximizedView( getView(MAIN_VIEW), false ); // secondary views are not created yet, but should be - for ( int i = 1; i < params.count(); i++ ) { - int idx = i-1; + if ( myViews.count() < params.count()-2 ) + createSubViews(); // secondary views are not created yet, but should be + + for ( int i = 2; i < params.count(); i++ ) { + int idx = i-2; getView( idx )->setVisualParameters( params[i] ); } - onMaximizedView( getView( maximizedView ), maximizedView != -1 ); // set proper sib-window maximized + + QStringList aSplitParams = params[1].split("*"); + if( aSplitParams.count() > 1 ) { + mySplitMode = aSplitParams[0].toInt(); + for( int i = 1; i < aSplitParams.count(); i++ ) + myViewsMode << aSplitParams[i].toInt(); + } + if( mySplitMode != -1 ) + splitSubViews(); + else + onMaximizedView( getView( maximizedView ), true ); // set proper sub-window maximized } else { // handle obsolete versions - no parameters for xy, yz, xz views diff --git a/src/OCCViewer/OCCViewer_ViewFrame.h b/src/OCCViewer/OCCViewer_ViewFrame.h index 8fe5e30cb..99cfdb064 100644 --- a/src/OCCViewer/OCCViewer_ViewFrame.h +++ b/src/OCCViewer/OCCViewer_ViewFrame.h @@ -129,9 +129,14 @@ private slots: private: void connectViewSignals( OCCViewer_ViewWindow* theView ); void updateWindowTitle( OCCViewer_ViewWindow* theView ); + void createSubViews(); + void splitSubViews(); QList myViews; QGridLayout* myLayout; + OCCViewer_ViewWindow* myMaximizedView; + int mySplitMode; + QList myViewsMode; OCCViewer_ViewWindow* myPopupRequestedView; }; diff --git a/src/OCCViewer/resources/OCCViewer_msg_en.ts b/src/OCCViewer/resources/OCCViewer_msg_en.ts index 029eda7dc..e505ec1ab 100644 --- a/src/OCCViewer/resources/OCCViewer_msg_en.ts +++ b/src/OCCViewer/resources/OCCViewer_msg_en.ts @@ -289,7 +289,7 @@ MNU_MINIMIZE_VIEW - Minimize + Create sub-views diff --git a/src/OCCViewer/resources/OCCViewer_msg_fr.ts b/src/OCCViewer/resources/OCCViewer_msg_fr.ts index c54f67989..74b9bfeb3 100755 --- a/src/OCCViewer/resources/OCCViewer_msg_fr.ts +++ b/src/OCCViewer/resources/OCCViewer_msg_fr.ts @@ -289,7 +289,7 @@ MNU_MINIMIZE_VIEW - Minimiser + Créer les sous-vues diff --git a/src/Qtx/CMakeLists.txt b/src/Qtx/CMakeLists.txt index 070d8c9d5..0caedd7b7 100755 --- a/src/Qtx/CMakeLists.txt +++ b/src/Qtx/CMakeLists.txt @@ -72,6 +72,9 @@ SET(GUI_HEADERS ) QT4_WRAP_CPP(GUI_HEADERS_MOC ${GUI_HEADERS}) +SET(RCCS Qtx.qrc) +QT4_ADD_RESOURCES(RCC_SRCS ${RCCS}) + SET(qtx_SOURCES Qtx.cxx QtxAction.cxx @@ -127,7 +130,7 @@ SET(GUITS_SOURCES ) ADD_DEFINITIONS(${QT_DEFINITIONS}) -ADD_LIBRARY(qtx ${qtx_SOURCES} ${GUI_HEADERS_MOC}) +ADD_LIBRARY(qtx ${qtx_SOURCES} ${GUI_HEADERS_MOC} ${RCC_SRCS}) TARGET_LINK_LIBRARIES(qtx ${QT_LIBRARIES} ${OPENGL_LIBRARIES}) INSTALL(TARGETS qtx EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS}) @@ -183,4 +186,4 @@ SET(COMMON_HEADERS_H QtxWebBrowser.h ) INSTALL(FILES ${COMMON_HEADERS_H} DESTINATION ${SALOME_INSTALL_HEADERS}) -QT4_INSTALL_TS_RESOURCES("${GUITS_SOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}") +QT4_INSTALL_TS_RESOURCES("${GUITS_SOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}") \ No newline at end of file diff --git a/src/Qtx/Qtx.qrc b/src/Qtx/Qtx.qrc new file mode 100644 index 000000000..15aa9c467 --- /dev/null +++ b/src/Qtx/Qtx.qrc @@ -0,0 +1,34 @@ + + + images/qtx_split2_1.png + images/qtx_split2_2.png + images/qtx_split3_1.png + images/qtx_split3_2.png + images/qtx_split3_3.png + images/qtx_split3_4.png + images/qtx_split3_5.png + images/qtx_split3_6.png + images/qtx_split4_1.png + images/qtx_split4_2.png + images/qtx_split4_3.png + images/qtx_split4_4.png + images/qtx_split4_5.png + images/qtx_split4_6.png + images/qtx_split4_7.png + images/qtx_split4_8.png + images/qtx_split4_9.png + images/qtx_split4_10.png + images/qtx_split4_11.png + images/qtx_split4_12.png + images/qtx_split4_13.png + images/qtx_split4_14.png + images/qtx_split4_15.png + images/qtx_split4_16.png + images/qtx_split4_17.png + images/qtx_split4_18.png + images/qtx_split4_19.png + images/qtx_split4_20.png + images/qtx_split4_21.png + + + diff --git a/src/Qtx/QtxWorkstack.cxx b/src/Qtx/QtxWorkstack.cxx index bdc987b59..18354c847 100644 --- a/src/Qtx/QtxWorkstack.cxx +++ b/src/Qtx/QtxWorkstack.cxx @@ -2729,10 +2729,12 @@ void QtxWorkstack::onContextMenuRequested( QWidget* w, QPoint p ) if ( lst.count() > 1 ) { - if ( myActionsMap[SplitVertical]->isEnabled() ) - pm->addAction( myActionsMap[SplitVertical] ); - if ( myActionsMap[SplitHorizontal]->isEnabled() ) - pm->addAction( myActionsMap[SplitHorizontal] ); + if ( !myActionsMap[SplitVertical]->isEnabled() ) + myActionsMap[SplitVertical]->setEnabled(true); + pm->addAction( myActionsMap[SplitVertical] ); + if ( !myActionsMap[SplitHorizontal]->isEnabled() ) + myActionsMap[SplitHorizontal]->setEnabled(true); + pm->addAction( myActionsMap[SplitHorizontal] ); pm->addSeparator(); } @@ -3223,6 +3225,7 @@ bool QtxWorkstack::move( QWidget* wid, QWidget* wid_to, const bool before ) idx++; area_src->removeWidget( wid, true ); area_to->insertWidget( wid, idx ); + wid->showMaximized(); return true; } } diff --git a/src/Qtx/QtxWorkstackAction.cxx b/src/Qtx/QtxWorkstackAction.cxx index 4d9b05014..92205bc94 100644 --- a/src/Qtx/QtxWorkstackAction.cxx +++ b/src/Qtx/QtxWorkstackAction.cxx @@ -29,6 +29,82 @@ #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +const char* const prev_xpm[] = { +"16 16 12 1", +" c None", +". c #111111", +"+ c #ACACAC", +"@ c #FC6D6E", +"# c #FB6364", +"$ c #F25B5C", +"% c #EA5859", +"& c #C1494A", +"* c #B64545", +"= c #AB4040", +"- c #A03C3C", +"; c #99393A", +" . ", +" ..+ ", +" .@...... ", +" .@@@@@@@.+ ", +" .########.+ ", +" .$$$$$$$$$.+ ", +" .%%%%%%%%%%.+ ", +" .&&&&&&&&&&&.+ ", +" .**********.+ ", +" +.=========.+ ", +" +.--------.+ ", +" +.;;;;;;;.+ ", +" +.;......+ ", +" +..++++++ ", +" +.+ ", +" ++ "}; + +const char* const next_xpm[] = { +"16 16 12 1", +" c None", +". c #111111", +"+ c #FC6D6E", +"@ c #FB6364", +"# c #F25B5C", +"$ c #EA5859", +"% c #C1494A", +"& c #B64545", +"* c #ACACAC", +"= c #AB4040", +"- c #A03C3C", +"; c #99393A", +" . ", +" .. ", +" ......+. ", +" .+++++++. ", +" .@@@@@@@@. ", +" .#########. ", +" .$$$$$$$$$$. ", +" .%%%%%%%%%%%. ", +" .&&&&&&&&&&.**", +" .=========.** ", +" .--------.** ", +" .;;;;;;;.** ", +" ......;.** ", +" ****..** ", +" .** ", +" ** "}; /*! \class QtxWorkstackAction @@ -61,6 +137,8 @@ QtxWorkstackAction::QtxWorkstackAction( QtxWorkstack* ws, QObject* parent ) connect( this, SIGNAL( triggered( int ) ), this, SLOT( onTriggered( int ) ) ); setMenuActions( Standard ); + + myArrangeViewsAction = new QAction( tr( "Arrange Views" ), this ); } /*! @@ -79,6 +157,14 @@ QtxWorkstack* QtxWorkstackAction::workstack() const return myWorkstack; } +/*! + \brief Get arrange views action. +*/ +QAction* QtxWorkstackAction::getArrangeViewsAction() +{ + return myArrangeViewsAction; +} + /*! \brief Set actions to be visible in the menu. @@ -280,6 +366,8 @@ void QtxWorkstackAction::updateContent() bool count = workstack() ? workstack()->splitWindowList().count() > 1 : 0; action( SplitVertical )->setEnabled( count ); action( SplitHorizontal )->setEnabled( count ); + count = workstack() ? workstack()->windowList().count() > 1 : 0; + myArrangeViewsAction->setEnabled( count ); updateWindows(); } @@ -378,3 +466,606 @@ void QtxWorkstackAction::onTriggered( int id ) else activateItem( id - Windows - 1 ); } + +/*! + \class QtxSplitDlg + \brief Used for arranging views(menu item "Window->Arrange Views") + and for creating sub-views of current view(button "Create sub-views") +*/ + +/*! + \brief Constructor. + \param parent - parent object + \param workstack - Work Stack widget + \param mode - mode of current dialog +*/ +QtxSplitDlg::QtxSplitDlg( QWidget* parent, QtxWorkstack* workstack, QtxSplitDlgMode mode ) +: QDialog( parent ), + myWorkstack( workstack ), + myDlgMode( mode ), + myViewsNB(2), + mySplitMode(0), + myNBSelectedViews(0), + myIsCloseViews( false ) +{ + Q_INIT_RESOURCE(Qtx); + + setModal( true ); + setObjectName( "Qtx_Split" ); + + if( mode == ArrangeViews ) + setWindowTitle( tr( "Arrange views" ) ); + else if( mode == CreateSubViews ) + setWindowTitle( tr( "Create sub-views") ); + + QVBoxLayout* topLayout = new QVBoxLayout( this ); + topLayout->setMargin( 11 ); topLayout->setSpacing( 6 ); + + ///////////////////////////////////////////////////////////////////// + QGroupBox* aGroupViewsLayout = new QGroupBox(); + if( mode == ArrangeViews ) + aGroupViewsLayout->setTitle( tr("Views Layout") ); + else if( mode == CreateSubViews ) + aGroupViewsLayout->setTitle( tr("Sub-views Layout") ); + + QGridLayout* OptionsViewsLayout = new QGridLayout( aGroupViewsLayout ); + + // Radio Buttons for selecting the number of views + QVBoxLayout* RadioButtonsLayout = new QVBoxLayout(); + myButton2Views = new QRadioButton( "2", this ); + myButton3Views = new QRadioButton( "3", this ); + myButton4Views = new QRadioButton( "4", this ); + + myButton2Views->setChecked( true ); + + RadioButtonsLayout->addWidget( myButton2Views ); + RadioButtonsLayout->addWidget( myButton3Views ); + RadioButtonsLayout->addWidget( myButton4Views ); + + // Buttons for possibility of switching the variants of split + myButtonPrevious = new QPushButton( this ); + myButtonPrevious->setIcon( QIcon( prev_xpm ) ); + myButtonPrevious->setAutoDefault(true); + myButtonPrevious->setEnabled( false ); + + myButtonNext = new QPushButton( this ); + myButtonNext->setIcon( QIcon( next_xpm ) ); + myButtonNext->setAutoDefault(true); + myButtonNext->setEnabled( false ); + + // Split options + myStackedSplitLayout = new QStackedLayout(); + + QButtonGroup* SplitOptions = new QButtonGroup( this ); + SplitOptions->setExclusive( true ); + + // Arrange icons for 2 views according to next scheme + // x + // x + QGridLayout* aSplit2Layout = new QGridLayout(); + for( int i=1; i<=2; i++ ) { + QToolButton* aSplitBtn = createSplitButton( 2, i ); + aSplit2Layout->addWidget( aSplitBtn, i-1, 0 ); + SplitOptions->addButton( aSplitBtn, i-1 ); + } + QWidget* aSplit2Widget = new QWidget( this ); + aSplit2Widget->setLayout( aSplit2Layout ); + myStackedSplitLayout->addWidget( aSplit2Widget ); + + // Arrange icons for 3 views according to next scheme + // x x x + // x x x + QGridLayout* aSplit3Layout = new QGridLayout(); + bool anIconPosition = 0; + for( int i=1; i<=6; i++ ) { + QToolButton* aSplitBtn = createSplitButton( 3, i ); + aSplit3Layout->addWidget( aSplitBtn, anIconPosition, int((i-1)/2) ); + SplitOptions->addButton( aSplitBtn, i+1 ); + anIconPosition = !anIconPosition; + } + QWidget* aSplit3Widget = new QWidget( this ); + aSplit3Widget->setLayout( aSplit3Layout ); + myStackedSplitLayout->addWidget( aSplit3Widget ); + + // Arrange icons for 4 views according to next scheme + // x x x x x x x x x + // x x x x x x x x x + // x x x + QGridLayout* aSplit4Layout = new QGridLayout(); + int aPosition = 0; + for( int i=1; i<=21; i++ ) { + QToolButton* aSplitBtn = createSplitButton( 4, i ); + SplitOptions->addButton( aSplitBtn, i+7 ); + if( i <= 9 ) { + aSplit4Layout->addWidget( aSplitBtn, int((i-1)/3), aPosition ); + aPosition = ( aPosition == 2 ) ? 0: aPosition + 1; + } + else if( i > 9 && i <= 17 ) { + aSplit4Layout->addWidget( aSplitBtn, int( (i-10)/4), aPosition ); + aPosition = ( aPosition == 3 ) ? 0: aPosition + 1; + } + else if( i>17 ) { + aSplit4Layout->addWidget( aSplitBtn, int( (i-18)/2 ), aPosition ); + aPosition = ( aPosition == 1 ) ? 0: aPosition + 1; + } + if( i == 9 || i == 17 || i == 21 ) { //finish set icon in current stack widget + QWidget* aSplit4Widget = new QWidget( this ); + aSplit4Widget->setLayout( aSplit4Layout ); + myStackedSplitLayout->addWidget( aSplit4Widget ); + aSplit4Layout = new QGridLayout(); + } + } + + QHBoxLayout* ArrowLayout = new QHBoxLayout(); + ArrowLayout->addSpacing(130); + ArrowLayout->addWidget( myButtonPrevious ); + ArrowLayout->addWidget( myButtonNext ); + ArrowLayout->addSpacing(130); + + OptionsViewsLayout->addLayout( ArrowLayout, 0, 1, 1, 2); + OptionsViewsLayout->addLayout( RadioButtonsLayout, 1, 0 ); + OptionsViewsLayout->addLayout( myStackedSplitLayout, 1, 1, 1, 2 ); + + ///////////////////////////////////////////////////////////////////// + + QGroupBox* GroupProperties = new QGroupBox(); + + if( mode == ArrangeViews ) { + GroupProperties->setTitle( tr("Views List") ); + + QVBoxLayout* ViewsListLayout = new QVBoxLayout( GroupProperties ); + + QWidgetList aWidgetList = myWorkstack->windowList(); + myViewsList = new QListWidget( GroupProperties ); + myViewsList->setSelectionMode(QAbstractItemView::SingleSelection); + connect( myViewsList, SIGNAL( itemClicked(QListWidgetItem*) ), this, SLOT( onSynchronize() ) ); + + for( int i=0; i< aWidgetList.count(); i++ ) { + QWidget* aWidget = aWidgetList.at(i); + QListWidgetItem* anItem = new QListWidgetItem( aWidget->windowTitle(), myViewsList ); + anItem->setCheckState( Qt::Unchecked ); + anItem->setFlags( anItem->flags() & ~Qt::ItemIsSelectable ); + } + + QRadioButton* CloseViews = new QRadioButton( GroupProperties ); + CloseViews->setText( tr( "Close remaining views" ) ); + connect( CloseViews, SIGNAL( pressed() ), this, SLOT( onCloseViews() ) ); + + QRadioButton* StackViews = new QRadioButton( GroupProperties ); + StackViews->setText( tr( "Stack remaining views in the last area" ) ); + StackViews->setChecked( true ); + connect( StackViews, SIGNAL( pressed() ), this, SLOT( onStackViews() ) ); + + ViewsListLayout->addWidget( myViewsList ); + ViewsListLayout->addWidget( CloseViews ); + ViewsListLayout->addWidget( StackViews ); + } + else { + GroupProperties->setTitle( tr( "Sub-views Properties" ) ); + for( int i = 0; i < 4; i++ ) { + QLabel* SubView = new QLabel( tr( "Sub-view" ) + " " + QString::number(i+1), + GroupProperties); + myLabels << SubView; + + QComboBox* ComboBox = new QComboBox( GroupProperties ); + ComboBox->addItem("XYZ"); + ComboBox->addItem("XY"); + ComboBox->addItem("XZ"); + ComboBox->addItem("YZ"); + myComboBox.append( ComboBox ); + myMapComboBoxMode.insert( ComboBox, (ViewMode)i ); + ComboBox->setCurrentIndex(i); + connect( ComboBox, SIGNAL( currentIndexChanged (int) ), this, SLOT( onComboBoxChanged(int) ) ); + } + + QGridLayout* SubViewsPropLayout = new QGridLayout( GroupProperties ); + SubViewsPropLayout->addWidget( myLabels[0], 0, 0 ); + SubViewsPropLayout->addWidget( myComboBox[0], 0, 1 ); + SubViewsPropLayout->addWidget( myLabels[1], 0, 2 ); + SubViewsPropLayout->addWidget( myComboBox[1], 0, 3 ); + SubViewsPropLayout->addWidget( myLabels[2], 1, 0 ); + SubViewsPropLayout->addWidget( myComboBox[2], 1, 1 ); + SubViewsPropLayout->addWidget( myLabels[3], 1, 2 ); + SubViewsPropLayout->addWidget( myComboBox[3], 1, 3 ); + } + + ///////////////////////////////////////////////////////////////////// + + QGroupBox* GroupButtons = new QGroupBox(); + QHBoxLayout* GroupButtonsLayout = new QHBoxLayout(GroupButtons); + + myButtonApply = new QPushButton(tr( "&Apply" ), GroupButtons); + myButtonApply->setAutoDefault(true); + myButtonApply->setDefault(true); + myButtonApply->setEnabled( false ); + QPushButton* buttonClose = new QPushButton(tr( "&Close" ), GroupButtons); + buttonClose->setAutoDefault(true); + + GroupButtonsLayout->addWidget( myButtonApply ); + GroupButtonsLayout->addSpacing(100); + GroupButtonsLayout->addWidget( buttonClose ); + + ///////////////////////////////////////////////////////////////////// + + topLayout->addWidget( aGroupViewsLayout ); + topLayout->insertStretch(1); + topLayout->addWidget( GroupProperties ); + topLayout->addWidget( GroupButtons ); + + + connect( myButton2Views, SIGNAL( pressed() ), this, SLOT( onChangeIcons() ) ); + connect( myButton3Views, SIGNAL( pressed() ), this, SLOT( onChangeIcons() ) ); + connect( myButton4Views, SIGNAL( pressed() ), this, SLOT( onChangeIcons() ) ); + connect( myButtonPrevious, SIGNAL( pressed() ), this, SLOT( onPreviousViews() ) ); + connect( myButtonNext, SIGNAL( pressed() ), this, SLOT( onNextViews() ) ); + connect( SplitOptions, SIGNAL( buttonClicked(int) ), SLOT( onSplitChanged(int))); + connect( buttonClose, SIGNAL( pressed() ), this, SLOT( reject() ) ); + connect( myButtonApply, SIGNAL( pressed() ), this, SLOT( onApply() ) ); + + initialize(); +} + +/*! + \brief Destructor +*/ +QtxSplitDlg::~QtxSplitDlg() +{ +} + +/*! + \brief Return current split mode +*/ +int QtxSplitDlg::getSplitMode() +{ + return mySplitMode; +} + +/*! + \brief Return selected view modes +*/ +QList QtxSplitDlg::getViewsMode() +{ + QList aList; + for ( int i = 0; i < myViewsNB; i++ ) { + int aMode = myMapComboBoxMode[myComboBox[i]]; + aList<setCheckable( true ); + aSplitBtn->setIcon( aSplitIcon ); + aSplitBtn->setIconSize( QSize( aSplitIcon.width(), aSplitIcon.height() ) ); + return aSplitBtn; +} + +/*! + \brief Initialisation of widgets +*/ +void QtxSplitDlg::initialize() +{ + if( myDlgMode == ArrangeViews ) { + int aViewsNumber = myWorkstack->windowList().count(); + if( aViewsNumber == 2 ) { + myButton3Views->setEnabled( false ); + myButton4Views->setEnabled( false ); + } + else if( aViewsNumber == 3 ) + myButton4Views->setEnabled( false ); + } + else if( myDlgMode == CreateSubViews ) { + for( int i = 0; i < 4; i++) { + if( i < myViewsNB ) + myMapModeIsBusy[(ViewMode)i] = true; + else + myMapModeIsBusy[ (ViewMode)i] = false; + } + onSynchronize(); + } +} + +/*! + \brief Verification if all items necessary for dialog were selected +*/ +void QtxSplitDlg::valid() +{ + bool isValid = false; + if( myViewsNB == 2 ) + isValid = ( mySplitMode >= 0 && mySplitMode < 2 )? true:false; + else if( myViewsNB == 3 ) + isValid = ( mySplitMode >= 2 && mySplitMode < 8 )? true:false; + else if( myViewsNB == 4) + isValid = ( mySplitMode >=8 && mySplitMode < 29 )?true:false; + + if( myDlgMode == ArrangeViews ) { + if( myNBSelectedViews != myViewsNB) + isValid = false; + } + myButtonApply->setEnabled( isValid ); +} + +/*! + \brief Called when number of views was changed + and it's necessary to set others split icons +*/ +void QtxSplitDlg::onChangeIcons() +{ + if( myButton2Views->isDown() ) { + myViewsNB = 2; + mySplitMode = 0; + myStackedSplitLayout->setCurrentIndex(0); + myButtonPrevious->setEnabled( false ); + myButtonNext->setEnabled( false ); + } + else if( myButton3Views->isDown() ) { + myViewsNB = 3; + mySplitMode = 2; + myStackedSplitLayout->setCurrentIndex(1); + myButtonPrevious->setEnabled( false ); + myButtonNext->setEnabled( false ); + } + else if( myButton4Views->isDown() ) { + myViewsNB = 4; + mySplitMode = 8; + myStackedSplitLayout->setCurrentIndex(2); + myButtonPrevious->setEnabled( false ); + myButtonNext->setEnabled( true ); + } + onSynchronize(); +} + +/*! + \brief Called when user selects an icon for split +*/ +void QtxSplitDlg::onSplitChanged( int theMode ) +{ + mySplitMode = theMode; + valid(); +} + +/*! + \brief Called when user selects item of Combo Box +*/ +void QtxSplitDlg::onComboBoxChanged( int theItem ) +{ + QMap aModeEnabledMap; + for( int i = 0; i < 4; i++ ) + aModeEnabledMap[(ViewMode)i] = false; + QComboBox* aSender = qobject_cast(sender()); + for ( int i=0;i<4;i++ ) + if( myComboBox[i] == aSender ) + myMapComboBoxMode[myComboBox[i]]=(ViewMode)theItem; + + for( int i = 0; i < 4; i++ ) { + if( myComboBox[i]->isVisible() ) { + ViewMode aViewMode = myMapComboBoxMode[myComboBox[i]]; + aModeEnabledMap[aViewMode] = true; + } + } + for( int i = 0; i < 4; i++ ) { + if( myComboBox[i] != aSender ) { + ViewMode aNewMode; + if( myMapComboBoxMode[myComboBox[i]] == (ViewMode)(theItem) ) { + for( int j = 0; j < 4; j++ ) + if( !aModeEnabledMap[(ViewMode)j] ) + aNewMode = (ViewMode)j; + myComboBox[i]->setCurrentIndex( (int)aNewMode ); + } + } + } +} + +/*! + \brief Called when user taps previous button +*/ +void QtxSplitDlg::onPreviousViews() +{ + int aCurrentIndex = myStackedSplitLayout->currentIndex(); + myStackedSplitLayout->setCurrentIndex( aCurrentIndex - 1 ); + if( myStackedSplitLayout->currentIndex() == 2 ) + myButtonPrevious->setEnabled( false ); + if( myStackedSplitLayout->currentIndex() < 4 ) + myButtonNext->setEnabled( true ); +} + +/*! + \brief Called when user taps next button +*/ +void QtxSplitDlg::onNextViews() +{ + int aCurrentIndex = myStackedSplitLayout->currentIndex(); + myStackedSplitLayout->setCurrentIndex( aCurrentIndex + 1 ); + if( myStackedSplitLayout->currentIndex() == 4 ) + myButtonNext->setEnabled( false ); + if( myStackedSplitLayout->currentIndex() > 2 ) + myButtonPrevious->setEnabled( true ); +} + +/*! + \brief Synchronize data and widgets +*/ +void QtxSplitDlg::onSynchronize( ) +{ + if( myDlgMode == ArrangeViews) { + int aCheckedNumber = 0; + for( int i=0; i < myViewsList->count(); i++ ) { + if( myViewsList->item(i)->checkState() == Qt::Checked ) + aCheckedNumber++; + if( aCheckedNumber == myViewsNB ) + for( int p = i+1; p < myViewsList->count(); p++ ) + myViewsList->item(p)->setCheckState( Qt::Unchecked ); + } + if( aCheckedNumber == myViewsNB ) { + for( int i=0; i < myViewsList->count(); i++ ) + if( myViewsList->item(i)->checkState() == Qt::Unchecked ) + myViewsList->item(i)->setFlags( myViewsList->item(i)->flags() & ~Qt::ItemIsEnabled ); + } + else if( aCheckedNumber < myViewsNB ) { + for( int i=0; i < myViewsList->count(); i++ ) + if( myViewsList->item(i)->checkState() == Qt::Unchecked ) + myViewsList->item(i)->setFlags( myViewsList->item(i)->flags() | Qt::ItemIsEnabled ); + } + myNBSelectedViews = aCheckedNumber; + } + else if( myDlgMode == CreateSubViews ) { + foreach( QComboBox* aBox, myComboBox ) + aBox->setVisible( true ); + foreach( QLabel* aLabel, myLabels ) + aLabel->setVisible( true ); + + for( int i = myViewsNB; i < 4; i++ ) { + myComboBox[i]->setVisible( false ); + myLabels[i]->setVisible( false ); + } + for( int i = 0; i < 4; i++ ) + myComboBox[i]->setCurrentIndex(i); + } + valid(); +} + +/*! + \brief Called when check box "Close remaining views" is active +*/ +void QtxSplitDlg::onCloseViews() +{ + myIsCloseViews = true; +} + +/*! + \brief Called when check box "Stack remaining views + in the last area" is active +*/ +void QtxSplitDlg::onStackViews() +{ + myIsCloseViews = false; +} + +/*! + \brief Apply dialog +*/ +void QtxSplitDlg::onApply() +{ + if( myDlgMode == ArrangeViews ) { + myWorkstack->stack(); + int Split3Map[6][6] = { + // View, Dir, View,Move, Dir + { 1, 1, 2, -1, 1 }, + { 1, 2, 2, -1, 2 }, + { 2, 1, 1, -1, 2 }, + { 1, 1, 2, 1, 2 }, + { 1, 2, 2, 1, 1 }, + { 2, 2, 1, -1, 1 }, + }; + + int Split4Map[21][9] = { + // View, Dir, View,Move, Dir, View,Move, Dir + { 1, 1, 2, -1, 1, 3, -1, 1 }, + { 1, 2, 2, -1, 2, 3, -1, 2 }, + { 1, 1, 2, -1, 2, 3, 1, 2 }, + { 2, 1, 3, -1, 1, 1, -1, 2 }, + { 1, 1, 3, -1, 1, 2, 1, 2 }, + { 1, 1, 2, -1, 1, 3, 2, 2 }, + { 2, 2, 3, -1, 2, 1, -1, 1 }, + { 1, 2, 3, -1, 2, 2, 1, 1 }, + { 1, 2, 2, -1, 2, 3, 2, 1 }, + { 3, 2, 2, -1, 1, 1, -1, 2 }, + { 3, 2, 1, -1, 1, 2, 1, 2 }, + { 1, 2, 3, 1, 1, 2, 1, 2 }, + { 1, 2, 2, 1, 1, 3, 2, 2 }, + { 1, 1, 3, 1, 2, 2, 1, 1 }, + { 1, 1, 2, 1, 2, 3, 2, 1 }, + { 3, 1, 2, -1, 2, 1, -1, 1 }, + { 3, 1, 1, -1, 2, 2, 1, 1 }, + { 1, 2, 2, 1, 1, 3, 1, 1 }, + { 3, 2, 1, -1, 1, 2, -1, 1 }, + { 3, 1, 1, -1, 2, 2, -1, 2 }, + { 1, 1, 2, 1, 2, 3, 1, 2 } + }; + + QWidgetList aWidgetList = myWorkstack->windowList(); + QWidgetList aListChecked; + QWidgetList aListUnchecked; + QtxWorkstack::SplitType aSplitType = QtxWorkstack::SplitMove; + + for( int i = 0; i < myViewsList->count(); i++ ) { + QString aName = myViewsList->item(i)->text(); + for( int j = 0; j< aWidgetList.count(); j++ ) { + QWidget* aWidget = aWidgetList.at(j); + if( aWidget->windowTitle() == aName ) { + if( myViewsList->item(i)->checkState() == Qt::Checked ) + aListChecked.append( aWidget ); + else if( myViewsList->item(i)->checkState() == Qt::Unchecked ) + aListUnchecked.append( aWidget ); + } + } + } + + if( myViewsNB == 2 ) + { + if( aListChecked.size() != 2 ) + return; + if( mySplitMode == 0) + myWorkstack->Split( aListChecked.at(1),Qt::Horizontal, aSplitType ); + else if( mySplitMode == 1 ) + myWorkstack->Split( aListChecked.at(1),Qt::Vertical, aSplitType ); + } + else if( myViewsNB == 3 ) { + if( aListChecked.size() != 3 ) + return; + mySplitMode = mySplitMode - 2; + myWorkstack->Split( aListChecked.at( Split3Map[mySplitMode][0] ), + Qt::Orientation( Split3Map[mySplitMode][1] ), + aSplitType ); + if( Split3Map[mySplitMode][3] >= 0 ) + myWorkstack->move( aListChecked.at( Split3Map[mySplitMode][2] ), + aListChecked.at( Split3Map[mySplitMode][3] ), + false ); + + myWorkstack->Split( aListChecked.at( Split3Map[mySplitMode][2] ), + Qt::Orientation( Split3Map[mySplitMode][4] ), + aSplitType ); + } + else if( myViewsNB == 4 ) { + if( aListChecked.size() != 4 ) + return; + mySplitMode = mySplitMode - 8; + myWorkstack->Split( aListChecked.at( Split4Map[mySplitMode][0] ), + Qt::Orientation( Split4Map[mySplitMode][1] ), + aSplitType ); + if( Split4Map[mySplitMode][3] >= 0 ) + myWorkstack->move( aListChecked.at( Split4Map[mySplitMode][2] ), + aListChecked.at( Split4Map[mySplitMode][3] ), + false ); + + myWorkstack->Split( aListChecked.at( Split4Map[mySplitMode][2] ), + Qt::Orientation( Split4Map[mySplitMode][4] ), + aSplitType ); + if( Split4Map[mySplitMode][6] >= 0 ) + myWorkstack->move( aListChecked.at( Split4Map[mySplitMode][5] ), + aListChecked.at( Split4Map[mySplitMode][6] ), + false ); + + myWorkstack->Split( aListChecked.at( Split4Map[mySplitMode][5] ), + Qt::Orientation( Split4Map[mySplitMode][7] ), + aSplitType ); + } + for( int i = 0; i < aListUnchecked.count(); i++ ) { + if( myIsCloseViews ) + aListUnchecked.at(i)->close(); + else + myWorkstack->move( aListUnchecked.at(i), + aListChecked.at( myViewsNB - 1 ), + false ); + } + } + accept(); +} diff --git a/src/Qtx/QtxWorkstackAction.h b/src/Qtx/QtxWorkstackAction.h index e5ec2d248..0d1c0abbd 100644 --- a/src/Qtx/QtxWorkstackAction.h +++ b/src/Qtx/QtxWorkstackAction.h @@ -27,8 +27,15 @@ #define QTXWORKSTACKACTION_H #include "QtxActionSet.h" +#include class QtxWorkstack; +class QRadioButton; +class QStackedLayout; +class QListWidget; +class QComboBox; +class QLabel; +class QToolButton; #ifdef WIN32 #pragma warning( disable:4251 ) @@ -50,6 +57,7 @@ public: virtual ~QtxWorkstackAction(); QtxWorkstack* workstack() const; + QAction* getArrangeViewsAction(); int menuActions() const; void setMenuActions( const int ); @@ -84,6 +92,60 @@ private: private: QtxWorkstack* myWorkstack; //!< parent workstack bool myWindowsFlag; //!< "show child windows items" flag + QAction* myArrangeViewsAction; +}; + +enum QtxSplitDlgMode{ ArrangeViews, CreateSubViews }; + +class QTX_EXPORT QtxSplitDlg : public QDialog +{ + Q_OBJECT + + enum ViewMode{ XYZ, XY, XZ, YZ }; + +public: + QtxSplitDlg( QWidget* = 0, QtxWorkstack* = NULL, QtxSplitDlgMode = ArrangeViews ); + ~QtxSplitDlg(); + int getSplitMode(); + QList getViewsMode(); + +private : + QToolButton* createSplitButton( int, int ); + void initialize(); + void valid(); + + QStackedLayout* myStackedSplitLayout; + QRadioButton* myButton2Views; + QRadioButton* myButton3Views; + QRadioButton* myButton4Views; + QPushButton* myButtonApply; + QPushButton* myButtonPrevious; + QPushButton* myButtonNext; + QList myLabels; + QList myComboBox; + QListWidget* myViewsList; + + QtxWorkstack* myWorkstack; + QtxSplitDlgMode myDlgMode; + + int myViewsNB; + int mySplitMode; + int myNBSelectedViews; + bool myIsCloseViews; + QMap myMapComboBoxMode; + QMap myMapModeIsBusy; + +private slots: + + void onChangeIcons(); + void onSplitChanged(int); + void onComboBoxChanged(int); + void onPreviousViews(); + void onNextViews(); + void onSynchronize(); + void onCloseViews(); + void onStackViews(); + void onApply(); }; #ifdef WIN32 diff --git a/src/Qtx/images/qtx_split2_1.png b/src/Qtx/images/qtx_split2_1.png new file mode 100644 index 000000000..f36cb7273 Binary files /dev/null and b/src/Qtx/images/qtx_split2_1.png differ diff --git a/src/Qtx/images/qtx_split2_2.png b/src/Qtx/images/qtx_split2_2.png new file mode 100644 index 000000000..35eae7b3b Binary files /dev/null and b/src/Qtx/images/qtx_split2_2.png differ diff --git a/src/Qtx/images/qtx_split3_1.png b/src/Qtx/images/qtx_split3_1.png new file mode 100644 index 000000000..a1a835d0d Binary files /dev/null and b/src/Qtx/images/qtx_split3_1.png differ diff --git a/src/Qtx/images/qtx_split3_2.png b/src/Qtx/images/qtx_split3_2.png new file mode 100644 index 000000000..67fb997c9 Binary files /dev/null and b/src/Qtx/images/qtx_split3_2.png differ diff --git a/src/Qtx/images/qtx_split3_3.png b/src/Qtx/images/qtx_split3_3.png new file mode 100644 index 000000000..cca6c6630 Binary files /dev/null and b/src/Qtx/images/qtx_split3_3.png differ diff --git a/src/Qtx/images/qtx_split3_4.png b/src/Qtx/images/qtx_split3_4.png new file mode 100644 index 000000000..ab739c896 Binary files /dev/null and b/src/Qtx/images/qtx_split3_4.png differ diff --git a/src/Qtx/images/qtx_split3_5.png b/src/Qtx/images/qtx_split3_5.png new file mode 100644 index 000000000..b3637bde0 Binary files /dev/null and b/src/Qtx/images/qtx_split3_5.png differ diff --git a/src/Qtx/images/qtx_split3_6.png b/src/Qtx/images/qtx_split3_6.png new file mode 100644 index 000000000..6f1bbcf58 Binary files /dev/null and b/src/Qtx/images/qtx_split3_6.png differ diff --git a/src/Qtx/images/qtx_split4_1.png b/src/Qtx/images/qtx_split4_1.png new file mode 100644 index 000000000..c8c11725d Binary files /dev/null and b/src/Qtx/images/qtx_split4_1.png differ diff --git a/src/Qtx/images/qtx_split4_10.png b/src/Qtx/images/qtx_split4_10.png new file mode 100644 index 000000000..acd466ac8 Binary files /dev/null and b/src/Qtx/images/qtx_split4_10.png differ diff --git a/src/Qtx/images/qtx_split4_11.png b/src/Qtx/images/qtx_split4_11.png new file mode 100644 index 000000000..6b35be32f Binary files /dev/null and b/src/Qtx/images/qtx_split4_11.png differ diff --git a/src/Qtx/images/qtx_split4_12.png b/src/Qtx/images/qtx_split4_12.png new file mode 100644 index 000000000..2c674d20f Binary files /dev/null and b/src/Qtx/images/qtx_split4_12.png differ diff --git a/src/Qtx/images/qtx_split4_13.png b/src/Qtx/images/qtx_split4_13.png new file mode 100644 index 000000000..c0b8d215f Binary files /dev/null and b/src/Qtx/images/qtx_split4_13.png differ diff --git a/src/Qtx/images/qtx_split4_14.png b/src/Qtx/images/qtx_split4_14.png new file mode 100644 index 000000000..2c66e4e17 Binary files /dev/null and b/src/Qtx/images/qtx_split4_14.png differ diff --git a/src/Qtx/images/qtx_split4_15.png b/src/Qtx/images/qtx_split4_15.png new file mode 100644 index 000000000..e126c6f0a Binary files /dev/null and b/src/Qtx/images/qtx_split4_15.png differ diff --git a/src/Qtx/images/qtx_split4_16.png b/src/Qtx/images/qtx_split4_16.png new file mode 100644 index 000000000..ab9647aec Binary files /dev/null and b/src/Qtx/images/qtx_split4_16.png differ diff --git a/src/Qtx/images/qtx_split4_17.png b/src/Qtx/images/qtx_split4_17.png new file mode 100644 index 000000000..fbe663dd4 Binary files /dev/null and b/src/Qtx/images/qtx_split4_17.png differ diff --git a/src/Qtx/images/qtx_split4_18.png b/src/Qtx/images/qtx_split4_18.png new file mode 100644 index 000000000..225477377 Binary files /dev/null and b/src/Qtx/images/qtx_split4_18.png differ diff --git a/src/Qtx/images/qtx_split4_19.png b/src/Qtx/images/qtx_split4_19.png new file mode 100644 index 000000000..86c7dba4d Binary files /dev/null and b/src/Qtx/images/qtx_split4_19.png differ diff --git a/src/Qtx/images/qtx_split4_2.png b/src/Qtx/images/qtx_split4_2.png new file mode 100644 index 000000000..1cfbf006d Binary files /dev/null and b/src/Qtx/images/qtx_split4_2.png differ diff --git a/src/Qtx/images/qtx_split4_20.png b/src/Qtx/images/qtx_split4_20.png new file mode 100644 index 000000000..634fbd5c5 Binary files /dev/null and b/src/Qtx/images/qtx_split4_20.png differ diff --git a/src/Qtx/images/qtx_split4_21.png b/src/Qtx/images/qtx_split4_21.png new file mode 100644 index 000000000..45f0f47cf Binary files /dev/null and b/src/Qtx/images/qtx_split4_21.png differ diff --git a/src/Qtx/images/qtx_split4_3.png b/src/Qtx/images/qtx_split4_3.png new file mode 100644 index 000000000..308dd4db3 Binary files /dev/null and b/src/Qtx/images/qtx_split4_3.png differ diff --git a/src/Qtx/images/qtx_split4_4.png b/src/Qtx/images/qtx_split4_4.png new file mode 100644 index 000000000..3616d8a8c Binary files /dev/null and b/src/Qtx/images/qtx_split4_4.png differ diff --git a/src/Qtx/images/qtx_split4_5.png b/src/Qtx/images/qtx_split4_5.png new file mode 100644 index 000000000..1faa5e0a5 Binary files /dev/null and b/src/Qtx/images/qtx_split4_5.png differ diff --git a/src/Qtx/images/qtx_split4_6.png b/src/Qtx/images/qtx_split4_6.png new file mode 100644 index 000000000..115f9feeb Binary files /dev/null and b/src/Qtx/images/qtx_split4_6.png differ diff --git a/src/Qtx/images/qtx_split4_7.png b/src/Qtx/images/qtx_split4_7.png new file mode 100644 index 000000000..2ebabd1bf Binary files /dev/null and b/src/Qtx/images/qtx_split4_7.png differ diff --git a/src/Qtx/images/qtx_split4_8.png b/src/Qtx/images/qtx_split4_8.png new file mode 100644 index 000000000..22f600a31 Binary files /dev/null and b/src/Qtx/images/qtx_split4_8.png differ diff --git a/src/Qtx/images/qtx_split4_9.png b/src/Qtx/images/qtx_split4_9.png new file mode 100644 index 000000000..c15f618e5 Binary files /dev/null and b/src/Qtx/images/qtx_split4_9.png differ diff --git a/src/Qtx/resources/Qtx_msg_fr.ts b/src/Qtx/resources/Qtx_msg_fr.ts index c98d41bee..48d7c6d87 100644 --- a/src/Qtx/resources/Qtx_msg_fr.ts +++ b/src/Qtx/resources/Qtx_msg_fr.ts @@ -264,6 +264,10 @@ Split horizontally Diviser horizontalement + + Arrange Views + Disposer les vues + QtxColorButton @@ -333,4 +337,51 @@ Modifier l'arrière plan + + QtxSplitDlg + + Arrange views + Disposer les vues + + + Create sub-views + Créer les sous-vues + + + Views Layout + Mise en page des vues + + + Sub-views Layout + Mise en page des sous-vues + + + Views List + Liste des vues + + + Close remaining views + Fermer les vues restantes + + + Stack remaining views in the last area + Empiler les vues restantes dans la dernière zone + + + Sub-views Properties + Propriétés des sous-vues + + + Sub-view + Sous-vue + + + &Apply + &Appliquer + + + &Close + &Fermer + + diff --git a/src/STD/STD_TabDesktop.cxx b/src/STD/STD_TabDesktop.cxx index 3690d8b1c..dea05fd50 100644 --- a/src/STD/STD_TabDesktop.cxx +++ b/src/STD/STD_TabDesktop.cxx @@ -213,15 +213,29 @@ void STD_TabDesktop::createActions() myWorkstackAction->setStatusTip( QtxWorkstackAction::SplitVertical, tr( "PRP_DESK_WINDOW_VSPLIT" ) ); myWorkstackAction->setAccel( QtxWorkstackAction::SplitVertical, Qt::ALT + Qt::SHIFT + Qt::Key_V ); + QAction* anArrangeViewsAction = myWorkstackAction->getArrangeViewsAction(); + if( anArrangeViewsAction ) + connect( anArrangeViewsAction, SIGNAL( triggered() ), this, SLOT( onArrangeViews() ) ); + QtxActionMenuMgr* mMgr = menuMgr(); if ( !mMgr ) return; int winMenuId = mMgr->insert( tr( "MEN_DESK_WINDOW" ), -1, 100 ); + mMgr->insert( anArrangeViewsAction, winMenuId, -1 ); mMgr->insert( myWorkstackAction, winMenuId, -1 ); mMgr->insert( QtxActionMenuMgr::separator(), winMenuId, -1 ); } +/*! + Emit Arrange Views menu activated. +*/ +void STD_TabDesktop::onArrangeViews() +{ + QtxSplitDlg ArrangeViewsDlg( this, workstack(), ArrangeViews ); + ArrangeViewsDlg.exec(); +} + /*! Convert STD_TabDesktop enumerations to QtxWorkstackAction */ diff --git a/src/STD/STD_TabDesktop.h b/src/STD/STD_TabDesktop.h index 5beff91b3..76707ceb6 100644 --- a/src/STD/STD_TabDesktop.h +++ b/src/STD/STD_TabDesktop.h @@ -57,6 +57,7 @@ public: private slots: void onWindowActivated( QWidget* ); + void onArrangeViews(); protected: void createActions();