]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
0022171: EDF 2477 GUI: Redesign of the "split" action and addition of a "tile" action
authormpa <mpa@opencascade.com>
Thu, 8 Aug 2013 14:06:50 +0000 (14:06 +0000)
committermpa <mpa@opencascade.com>
Thu, 8 Aug 2013 14:06:50 +0000 (14:06 +0000)
46 files changed:
doc/salome/gui/images/arrange_views_dlg.png [new file with mode: 0644]
doc/salome/gui/images/create_sub-views_dlg.png [new file with mode: 0644]
doc/salome/gui/images/windowmenu.png
doc/salome/gui/input/occ_3d_viewer.doc
doc/salome/gui/input/salome_desktop.doc
src/OCCViewer/OCCViewer_ViewFrame.cxx
src/OCCViewer/OCCViewer_ViewFrame.h
src/OCCViewer/resources/OCCViewer_msg_en.ts
src/OCCViewer/resources/OCCViewer_msg_fr.ts
src/Qtx/CMakeLists.txt
src/Qtx/Qtx.qrc [new file with mode: 0644]
src/Qtx/QtxWorkstack.cxx
src/Qtx/QtxWorkstackAction.cxx
src/Qtx/QtxWorkstackAction.h
src/Qtx/images/qtx_split2_1.png [new file with mode: 0644]
src/Qtx/images/qtx_split2_2.png [new file with mode: 0644]
src/Qtx/images/qtx_split3_1.png [new file with mode: 0644]
src/Qtx/images/qtx_split3_2.png [new file with mode: 0644]
src/Qtx/images/qtx_split3_3.png [new file with mode: 0644]
src/Qtx/images/qtx_split3_4.png [new file with mode: 0644]
src/Qtx/images/qtx_split3_5.png [new file with mode: 0644]
src/Qtx/images/qtx_split3_6.png [new file with mode: 0644]
src/Qtx/images/qtx_split4_1.png [new file with mode: 0644]
src/Qtx/images/qtx_split4_10.png [new file with mode: 0644]
src/Qtx/images/qtx_split4_11.png [new file with mode: 0644]
src/Qtx/images/qtx_split4_12.png [new file with mode: 0644]
src/Qtx/images/qtx_split4_13.png [new file with mode: 0644]
src/Qtx/images/qtx_split4_14.png [new file with mode: 0644]
src/Qtx/images/qtx_split4_15.png [new file with mode: 0644]
src/Qtx/images/qtx_split4_16.png [new file with mode: 0644]
src/Qtx/images/qtx_split4_17.png [new file with mode: 0644]
src/Qtx/images/qtx_split4_18.png [new file with mode: 0644]
src/Qtx/images/qtx_split4_19.png [new file with mode: 0644]
src/Qtx/images/qtx_split4_2.png [new file with mode: 0644]
src/Qtx/images/qtx_split4_20.png [new file with mode: 0644]
src/Qtx/images/qtx_split4_21.png [new file with mode: 0644]
src/Qtx/images/qtx_split4_3.png [new file with mode: 0644]
src/Qtx/images/qtx_split4_4.png [new file with mode: 0644]
src/Qtx/images/qtx_split4_5.png [new file with mode: 0644]
src/Qtx/images/qtx_split4_6.png [new file with mode: 0644]
src/Qtx/images/qtx_split4_7.png [new file with mode: 0644]
src/Qtx/images/qtx_split4_8.png [new file with mode: 0644]
src/Qtx/images/qtx_split4_9.png [new file with mode: 0644]
src/Qtx/resources/Qtx_msg_fr.ts
src/STD/STD_TabDesktop.cxx
src/STD/STD_TabDesktop.h

diff --git a/doc/salome/gui/images/arrange_views_dlg.png b/doc/salome/gui/images/arrange_views_dlg.png
new file mode 100644 (file)
index 0000000..cd5c2d9
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 (file)
index 0000000..b2c5744
Binary files /dev/null and b/doc/salome/gui/images/create_sub-views_dlg.png differ
index 6e47ee86a3927b04f5c146a9556eca3798b88e75..b1991900df1faf561a3451ff13b67f23b19bc86a 100755 (executable)
Binary files a/doc/salome/gui/images/windowmenu.png and b/doc/salome/gui/images/windowmenu.png differ
index e27d346d36225a3f09413236ebb46e0926103f9d..4eb31fce691a33ee7fb554f89995ddd68eda6a90 100644 (file)
@@ -208,8 +208,28 @@ on/off.
 \image html occ_view_minimized.png
 \image html occ_view_maximized.png
 
-<b>Minimize/Maximize</b> - these buttons allow switching the current
+<b>Create sub-views/Maximize</b> - these buttons allow switching the current
 view area to the minimized / maximized state.
+
+<b>Create sub-views</b> - user can select the layout and types of child sub-views:
+
+\image html create_sub-views_dlg.png
+
+- <b>Sub-views Layout</b>
+
+  - 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.
+
+- <b>Sub-views Properties</b>
+
+  - Type of each sub-view: XZ, YZ, XY or XYZ. 
+
+<b>Maximize</b> - the current view area will be converted to maximized state.
+
 <hr>
 
 \image html occ_view_sync.png
index 5ce734d80b16c7b97835f682ee7e62cbca08bcf4..03704ae0b71bcfb718265030dc3ddddaf26a2c95 100644 (file)
@@ -96,6 +96,30 @@ viewer.</li>
 <li><b>Close</b> - closes the currently active viewer window.</li> 
 <li><b>Close all</b> - closes all viewer windows.</li>
 <li><b>Group all</b> - arranges all created viewer windows on the same desktop</li>
+<li><b>Arrange Views</b> - choice of split scheme and list of used views.
+\image html arrange_views_dlg.png
+
+- <b>Views Layout</b>
+
+  - 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.
+
+- <b>Views List</b>
+
+  - 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.
+      
 <li><b>Split Vertically</b> and <b>Split Horizontally</b> allows to split
 the representation area into two parts, in horizontal or vertical
 direction.</li>
index d9b3397bd1e0f664d8a05298cd56441ec370948d..6e7667829bfacc6d56b6298e62d693cf1e13c6f1 100644 (file)
 #include "OCCViewer_ViewModel.h"
 
 #include <SUIT_ViewManager.h>
+#include <SUIT_Session.h>
+#include <SUIT_ResourceMgr.h>
+
+#include <QtxResourceMgr.h>
+#include <QtxWorkstackAction.h>
 
 #include <QFrame>
 #include <QLayout>
 #include <QApplication>
 
 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<OCCViewer_Viewer*>(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<OCCViewer_Viewer*>(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
index 8fe5e30cb52d48ad92585f28df199967631cab76..99cfdb064ffa051887d678ba71d666f2ada2f365 100644 (file)
@@ -129,9 +129,14 @@ private slots:
 private:
   void connectViewSignals( OCCViewer_ViewWindow* theView );
   void updateWindowTitle( OCCViewer_ViewWindow* theView );
+  void createSubViews();
+  void splitSubViews();
 
   QList<OCCViewer_ViewWindow*> myViews;
   QGridLayout* myLayout;
+  OCCViewer_ViewWindow* myMaximizedView;
+  int mySplitMode;
+  QList<int> myViewsMode;
 
   OCCViewer_ViewWindow* myPopupRequestedView;
 };
index 029eda7dc759c5686877b7047400c9d0ff4be19b..e505ec1ab6bd647767b67c6b36eb0c7a4f94d32a 100644 (file)
     </message>
     <message>
         <source>MNU_MINIMIZE_VIEW</source>
-        <translation>Minimize</translation>
+        <translation>Create sub-views</translation>
     </message>
 </context>
 <context>
index c54f679891909763a1d8aaa89d5d378800365de2..74b9bfeb30cb7fe835985a1c3838f681a50e88d3 100755 (executable)
     </message>
     <message>
         <source>MNU_MINIMIZE_VIEW</source>
-        <translation>Minimiser</translation>
+        <translation>Créer les sous-vues</translation>
     </message>
 </context>
 <context>
index 070d8c9d501dfabc1d273619dd65840ae4cb9bf3..0caedd7b702a4918ebf89f49c5de309ae2503676 100755 (executable)
@@ -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 (file)
index 0000000..15aa9c4
--- /dev/null
@@ -0,0 +1,34 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+  <file>images/qtx_split2_1.png</file>
+  <file>images/qtx_split2_2.png</file>
+  <file>images/qtx_split3_1.png</file>
+  <file>images/qtx_split3_2.png</file>
+  <file>images/qtx_split3_3.png</file>
+  <file>images/qtx_split3_4.png</file>
+  <file>images/qtx_split3_5.png</file>
+  <file>images/qtx_split3_6.png</file>
+  <file>images/qtx_split4_1.png</file>
+  <file>images/qtx_split4_2.png</file>
+  <file>images/qtx_split4_3.png</file>
+  <file>images/qtx_split4_4.png</file>
+  <file>images/qtx_split4_5.png</file>
+  <file>images/qtx_split4_6.png</file>
+  <file>images/qtx_split4_7.png</file>
+  <file>images/qtx_split4_8.png</file>
+  <file>images/qtx_split4_9.png</file>
+  <file>images/qtx_split4_10.png</file>
+  <file>images/qtx_split4_11.png</file>
+  <file>images/qtx_split4_12.png</file>
+  <file>images/qtx_split4_13.png</file>
+  <file>images/qtx_split4_14.png</file>
+  <file>images/qtx_split4_15.png</file>
+  <file>images/qtx_split4_16.png</file>
+  <file>images/qtx_split4_17.png</file>
+  <file>images/qtx_split4_18.png</file>
+  <file>images/qtx_split4_19.png</file>
+  <file>images/qtx_split4_20.png</file>
+  <file>images/qtx_split4_21.png</file>
+</qresource>
+</RCC>
index bdc987b59fcafa92e2c94d782445ac2147ba71dc..18354c8471fac5b2473c85ce4818214fad0cec56 100644 (file)
@@ -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;
       }
     }
index 4d9b0501415419ff5ebed8ce11aa701c4cbea303..92205bc947312e5fdb1453055dd87173fd16d56c 100644 (file)
 
 #include <QMenu>
 #include <QWidgetList>
+#include <QGroupBox>
+#include <QVBoxLayout>
+#include <QHBoxLayout>
+#include <QRadioButton>
+#include <QPushButton>
+#include <QListWidget>
+#include <QStackedLayout>
+#include <QToolButton>
+#include <QIcon>
+#include <QPixmap>
+#include <QButtonGroup>
+#include <QCheckBox>
+#include <QLabel>
+#include <QComboBox>
+
+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<int> QtxSplitDlg::getViewsMode()
+{
+  QList<int> aList;
+  for ( int i = 0; i < myViewsNB; i++ ) {
+    int aMode = myMapComboBoxMode[myComboBox[i]];
+    aList<<aMode;
+  }
+  return aList;
+}
+
+/*!
+  \brief Create new QToolButton using icon of split mode
+*/
+QToolButton* QtxSplitDlg::createSplitButton( int theViewsNB, int theSplitMode )
+{
+  QString anImageName = QString( ":/images/qtx_split%1_%2.png" )
+                                 .arg(theViewsNB).arg(theSplitMode).toLatin1().constData();
+  QPixmap aSplitIcon( anImageName );
+  QToolButton* aSplitBtn = new QToolButton( this );
+  aSplitBtn->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<ViewMode,bool > aModeEnabledMap;
+  for( int i = 0; i < 4; i++ )
+    aModeEnabledMap[(ViewMode)i] = false;
+  QComboBox* aSender = qobject_cast<QComboBox*>(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();
+}
index e5ec2d248e469c9d73ee0b831f000c0acf967355..0d1c0abbd158ee6a7213add34de5cd2f5112f306 100644 (file)
 #define QTXWORKSTACKACTION_H
 
 #include "QtxActionSet.h"
+#include <QDialog>
 
 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<int> 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<QLabel*> myLabels;
+  QList<QComboBox*> myComboBox;
+  QListWidget* myViewsList;
+
+  QtxWorkstack* myWorkstack;
+  QtxSplitDlgMode myDlgMode;
+
+  int myViewsNB;
+  int mySplitMode;
+  int myNBSelectedViews;
+  bool myIsCloseViews;
+  QMap<QComboBox*, ViewMode> myMapComboBoxMode;
+  QMap<ViewMode, bool> 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 (file)
index 0000000..f36cb72
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 (file)
index 0000000..35eae7b
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 (file)
index 0000000..a1a835d
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 (file)
index 0000000..67fb997
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 (file)
index 0000000..cca6c66
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 (file)
index 0000000..ab739c8
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 (file)
index 0000000..b3637bd
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 (file)
index 0000000..6f1bbcf
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 (file)
index 0000000..c8c1172
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 (file)
index 0000000..acd466a
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 (file)
index 0000000..6b35be3
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 (file)
index 0000000..2c674d2
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 (file)
index 0000000..c0b8d21
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 (file)
index 0000000..2c66e4e
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 (file)
index 0000000..e126c6f
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 (file)
index 0000000..ab9647a
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 (file)
index 0000000..fbe663d
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 (file)
index 0000000..2254773
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 (file)
index 0000000..86c7dba
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 (file)
index 0000000..1cfbf00
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 (file)
index 0000000..634fbd5
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 (file)
index 0000000..45f0f47
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 (file)
index 0000000..308dd4d
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 (file)
index 0000000..3616d8a
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 (file)
index 0000000..1faa5e0
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 (file)
index 0000000..115f9fe
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 (file)
index 0000000..2ebabd1
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 (file)
index 0000000..22f600a
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 (file)
index 0000000..c15f618
Binary files /dev/null and b/src/Qtx/images/qtx_split4_9.png differ
index c98d41beee3941f06e230054d9ed56f9dc078913..48d7c6d8794bfd2ea639d77c7f82dbe5c9143b5e 100644 (file)
         <source>Split horizontally</source>
         <translation>Diviser horizontalement</translation>
     </message>
+    <message>
+        <source>Arrange Views</source>
+        <translation>Disposer les vues</translation>
+    </message>
 </context>
 <context>
     <name>QtxColorButton</name>
         <translation>Modifier l&apos;arrière plan</translation>
     </message>
 </context>
+<context>
+    <name>QtxSplitDlg</name>
+    <message>
+        <source>Arrange views</source>
+        <translation>Disposer les vues</translation>
+    </message>
+    <message>
+        <source>Create sub-views</source>
+        <translation>Créer les sous-vues</translation>
+    </message>
+    <message>
+        <source>Views Layout</source>
+        <translation>Mise en page des vues</translation>
+    </message>
+    <message>
+        <source>Sub-views Layout</source>
+        <translation>Mise en page des sous-vues</translation>
+    </message>
+    <message>
+        <source>Views List</source>
+        <translation>Liste des vues</translation>
+    </message>
+    <message>
+        <source>Close remaining views</source>
+        <translation>Fermer les vues restantes</translation>
+    </message>
+    <message>
+        <source>Stack remaining views in the last area</source>
+        <translation>Empiler les vues restantes dans la dernière zone</translation>
+    </message>
+    <message>
+        <source>Sub-views Properties</source>
+        <translation>Propriétés des sous-vues</translation>
+    </message>
+    <message>
+        <source>Sub-view</source>
+        <translation>Sous-vue</translation>
+    </message>
+    <message>
+        <source>&amp;Apply</source>
+        <translation>&amp;Appliquer</translation>
+    </message>
+    <message>
+        <source>&amp;Close</source>
+        <translation>&amp;Fermer</translation>
+    </message>
+</context>
 </TS>
index 3690d8b1c03d00e48149df669ec388d751692450..dea05fd50322ef1cb39672dfc8532c49bd28f6c3 100644 (file)
@@ -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
 */
index 5beff91b3180ba2244a9685b46abf4c7cdd1d707..76707ceb6dfe26e1753ec028caba61b8e9c056e7 100644 (file)
@@ -57,6 +57,7 @@ public:
 
 private slots:
   void                     onWindowActivated( QWidget* );
+  void                     onArrangeViews();
 
 protected:
   void                     createActions();