Adding svn:eol-style=LF property
[occt.git] / samples / qt / Graphic3dDemo / src / ViewDlg.cxx
index 8bd0b61..f8f5648 100755 (executable)
@@ -10,7 +10,7 @@
 #include <qcombobox.h>
 
 #include <V3d_TypeOfVisualization.hxx>
 #include <qcombobox.h>
 
 #include <V3d_TypeOfVisualization.hxx>
-\r
+
 #include "Application.h"
 #include "ViewDlg.h"
 #include "global.h"
 #include "Application.h"
 #include "ViewDlg.h"
 #include "global.h"
@@ -22,7 +22,7 @@
 ViewDlg::ViewDlg( QWidget* parent/*, Handle(V3d_View)& view*/ )
 :QDialog( parent ),
   myAutoApply( true ), /*myView( view ),*/ myApplyAllViews(false)
 ViewDlg::ViewDlg( QWidget* parent/*, Handle(V3d_View)& view*/ )
 :QDialog( parent ),
   myAutoApply( true ), /*myView( view ),*/ myApplyAllViews(false)
-{\r
+{
     setModal( false );
     setWindowTitle( tr( "TITLE_VIEW_DLG" ) );
 
     setModal( false );
     setWindowTitle( tr( "TITLE_VIEW_DLG" ) );
 
@@ -35,15 +35,15 @@ ViewDlg::ViewDlg( QWidget* parent/*, Handle(V3d_View)& view*/ )
     topLayout->addSpacing( 10 );
 
     // view properties
     topLayout->addSpacing( 10 );
 
     // view properties
-    QGridLayout* pLayout = new QGridLayout( mainFrame );\r
+    QGridLayout* pLayout = new QGridLayout( mainFrame );
     pLayout->setMargin( 5 );
     myZBufferBox = new QCheckBox( mainFrame );;
     myZBufferBox->setText( tr( "BTN_ZBUFFER" ) );
     pLayout->setMargin( 5 );
     myZBufferBox = new QCheckBox( mainFrame );;
     myZBufferBox->setText( tr( "BTN_ZBUFFER" ) );
-    verify( connect( myZBufferBox, SIGNAL( toggled( bool ) ), SLOT( onZBuffer( bool ) ) ) );\r
+    verify( connect( myZBufferBox, SIGNAL( toggled( bool ) ), SLOT( onZBuffer( bool ) ) ) );
 
     myAnimBox = new QCheckBox( mainFrame );
     myAnimBox->setText( tr( "BTN_ANIMATION" ) );
 
     myAnimBox = new QCheckBox( mainFrame );
     myAnimBox->setText( tr( "BTN_ANIMATION" ) );
-    verify( connect( myAnimBox, SIGNAL( toggled( bool ) ), SLOT( onAnimation( bool ) ) ) );\r
+    verify( connect( myAnimBox, SIGNAL( toggled( bool ) ), SLOT( onAnimation( bool ) ) ) );
 
     myDegBox = new QCheckBox( mainFrame );
     myDegBox->setText( tr( "BTN_DEGENERATION" ) );
 
     myDegBox = new QCheckBox( mainFrame );
     myDegBox->setText( tr( "BTN_DEGENERATION" ) );
@@ -53,7 +53,7 @@ ViewDlg::ViewDlg( QWidget* parent/*, Handle(V3d_View)& view*/ )
     pLayout->addWidget( myAnimBox, 1, 0 );
     pLayout->addWidget( myDegBox, 2, 0 );
     pLayout->setRowStretch( 3, 10 );
     pLayout->addWidget( myAnimBox, 1, 0 );
     pLayout->addWidget( myDegBox, 2, 0 );
     pLayout->setRowStretch( 3, 10 );
-    pLayout->setColumnStretch( 1, 10 );\r
+    pLayout->setColumnStretch( 1, 10 );
 
     // apply controls
     QCheckBox *autoApply, *applyAllViews;
 
     // apply controls
     QCheckBox *autoApply, *applyAllViews;
@@ -69,39 +69,39 @@ ViewDlg::ViewDlg( QWidget* parent/*, Handle(V3d_View)& view*/ )
     QHBoxLayout* applyLayout = new QHBoxLayout();
     applyLayout->addWidget( autoApply );
     applyLayout->addStretch( 10 );
     QHBoxLayout* applyLayout = new QHBoxLayout();
     applyLayout->addWidget( autoApply );
     applyLayout->addStretch( 10 );
-    applyLayout->addWidget( applyAllViews );\r
+    applyLayout->addWidget( applyAllViews );
     topLayout->addLayout( applyLayout );
     topLayout->addSpacing( 10 );
 
     // control buttons
     topLayout->addLayout( applyLayout );
     topLayout->addSpacing( 10 );
 
     // control buttons
-    QPushButton *bOk, *bCancel/*, *bHelp*/;\r
-       \r
+    QPushButton *bOk, *bCancel/*, *bHelp*/;
+       
     bOk     = new QPushButton( tr( "BTN_OK" ), this );
     bOk     = new QPushButton( tr( "BTN_OK" ), this );
-    verify( connect( bOk, SIGNAL( clicked() ), SLOT( onOk() ) ) );\r
+    verify( connect( bOk, SIGNAL( clicked() ), SLOT( onOk() ) ) );
        bOk->setDefault(true); 
     bCancel = new QPushButton( tr( "BTN_CANCEL" ), this );
        bOk->setDefault(true); 
     bCancel = new QPushButton( tr( "BTN_CANCEL" ), this );
-    verify( connect( bCancel, SIGNAL( clicked() ), SLOT( onCancel() ) ) );\r
-\r
+    verify( connect( bCancel, SIGNAL( clicked() ), SLOT( onCancel() ) ) );
+
 
 
-//    bHelp   = new QPushButton( tr( "BTN_HELP" ), this );\r
-//    verify( connect( bHelp, SIGNAL( clicked() ), SLOT( onHelp() ) ) );\r
+//    bHelp   = new QPushButton( tr( "BTN_HELP" ), this );
+//    verify( connect( bHelp, SIGNAL( clicked() ), SLOT( onHelp() ) ) );
 
     QHBoxLayout* btnLayout = new QHBoxLayout();
 
     QHBoxLayout* btnLayout = new QHBoxLayout();
-    btnLayout->setSpacing( 5 );\r
-    btnLayout->addStretch( 10 );\r
+    btnLayout->setSpacing( 5 );
+    btnLayout->addStretch( 10 );
     btnLayout->addWidget( bOk );
     btnLayout->addWidget( bCancel );
     btnLayout->addStretch( 10 );
     btnLayout->addWidget( bOk );
     btnLayout->addWidget( bCancel );
     btnLayout->addStretch( 10 );
-//    btnLayout->addWidget( bHelp );\r
+//    btnLayout->addWidget( bHelp );
     topLayout->addLayout( btnLayout );
 
     QSize s = topLayout->totalMinimumSize();
     s.setWidth( s.width() + topLayout->margin() + 10 );
     s.setHeight( s.height() + topLayout->margin() + 10 );
     topLayout->addLayout( btnLayout );
 
     QSize s = topLayout->totalMinimumSize();
     s.setWidth( s.width() + topLayout->margin() + 10 );
     s.setHeight( s.height() + topLayout->margin() + 10 );
-    setFixedSize( s );\r
-\r
-       Handle(V3d_View) aView = Application::getApplication()->getActiveMDI()->getView();\r
-       myIsAnim = aView->AnimationMode(myIsDeg);\r
+    setFixedSize( s );
+
+       Handle(V3d_View) aView = Application::getApplication()->getActiveMDI()->getView();
+       myIsAnim = aView->AnimationMode(myIsDeg);
 }
 
 ViewDlg::~ViewDlg()
 }
 
 ViewDlg::~ViewDlg()
@@ -109,20 +109,20 @@ ViewDlg::~ViewDlg()
 }
 
 void ViewDlg::showEvent ( QShowEvent* e )
 }
 
 void ViewDlg::showEvent ( QShowEvent* e )
-{\r
-       Update();\r
-       QWidget::showEvent( e );\r
+{
+       Update();
+       QWidget::showEvent( e );
 }   
 
 void ViewDlg::onOk()
 {
 }   
 
 void ViewDlg::onOk()
 {
-    hide();\r
-       bool Auto = myAutoApply;\r
-\r
-       myAutoApply = true;\r
-       onZBuffer(myZBufferBox->isChecked());\r
-       onAnimation(myAnimBox->isChecked());\r
-       onDegeneration(myDegBox->isChecked());\r
+    hide();
+       bool Auto = myAutoApply;
+
+       myAutoApply = true;
+       onZBuffer(myZBufferBox->isChecked());
+       onAnimation(myAnimBox->isChecked());
+       onDegeneration(myDegBox->isChecked());
        myAutoApply = Auto;
 }
  
        myAutoApply = Auto;
 }
  
@@ -130,83 +130,83 @@ void ViewDlg::onCancel()
 {
     hide();
 }
 {
     hide();
 }
-\r
+
 void ViewDlg::onHelp()
 {
 }
 
 void ViewDlg::onZBuffer( bool on )
 void ViewDlg::onHelp()
 {
 }
 
 void ViewDlg::onZBuffer( bool on )
-{\r
-       QWidgetList aWidgetList;\r
-       Handle(V3d_View) aView;\r
-       QWidget* aWidget;\r
-\r
-       if (!myApplyAllViews)\r
-               aWidgetList.append(Application::getApplication()->getActiveMDI());\r
-       else\r
-               aWidgetList = Application::getWorkspace()->windowList();\r
-\r
-       if ( myAutoApply ){\r
-               foreach(aWidget, aWidgetList){\r
-      if ( !aWidget ) continue;\r
-                       MDIWindow* aMDIWindow = (MDIWindow*)aWidget;\r
-                       aView = aMDIWindow->getView();\r
+{
+       QWidgetList aWidgetList;
+       Handle(V3d_View) aView;
+       QWidget* aWidget;
+
+       if (!myApplyAllViews)
+               aWidgetList.append(Application::getApplication()->getActiveMDI());
+       else
+               aWidgetList = Application::getWorkspace()->windowList();
+
+       if ( myAutoApply ){
+               foreach(aWidget, aWidgetList){
+      if ( !aWidget ) continue;
+                       MDIWindow* aMDIWindow = (MDIWindow*)aWidget;
+                       aView = aMDIWindow->getView();
                        if ( on )
                                aView->SetVisualization( V3d_ZBUFFER );
                        else
                        if ( on )
                                aView->SetVisualization( V3d_ZBUFFER );
                        else
-                               aView->SetVisualization( V3d_WIREFRAME );\r
-               }\r
+                               aView->SetVisualization( V3d_WIREFRAME );
+               }
        }
 }
 
 void ViewDlg::onAnimation( bool on )
        }
 }
 
 void ViewDlg::onAnimation( bool on )
-{\r
-       QWidgetList aWidgetList;\r
-       Handle(V3d_View) aView;\r
-\r
-       myIsAnim = on;\r
-    myDegBox->setEnabled( myIsAnim );\r
-       if (!myIsAnim) myDegBox->setChecked(false);\r
-\r
-       if (!myApplyAllViews)\r
-               aWidgetList.append(Application::getApplication()->getActiveMDI());\r
-       else\r
-               aWidgetList = Application::getWorkspace()->windowList();\r
-       \r
-       if ( myAutoApply ){\r
-               QWidget* aWidget;\r
-               foreach(aWidget, aWidgetList){\r
-      if ( !aWidget ) continue;\r
-                       MDIWindow* aMDIWindow = (MDIWindow*)aWidget;\r
+{
+       QWidgetList aWidgetList;
+       Handle(V3d_View) aView;
+
+       myIsAnim = on;
+    myDegBox->setEnabled( myIsAnim );
+       if (!myIsAnim) myDegBox->setChecked(false);
+
+       if (!myApplyAllViews)
+               aWidgetList.append(Application::getApplication()->getActiveMDI());
+       else
+               aWidgetList = Application::getWorkspace()->windowList();
+       
+       if ( myAutoApply ){
+               QWidget* aWidget;
+               foreach(aWidget, aWidgetList){
+      if ( !aWidget ) continue;
+                       MDIWindow* aMDIWindow = (MDIWindow*)aWidget;
                        aView = aMDIWindow->getView();
                        aView = aMDIWindow->getView();
-                       aView->SetAnimationMode( myIsAnim, myIsDeg );\r
-                       aView->Redraw();\r
-                       aView->SetImmediateUpdate(true);\r
-                       aView->Update();\r
+                       aView->SetAnimationMode( myIsAnim, myIsDeg );
+                       aView->Redraw();
+                       aView->SetImmediateUpdate(true);
+                       aView->Update();
                }
                }
-       }       \r
+       }       
 }
 
 void ViewDlg::onDegeneration( bool on )
 }
 
 void ViewDlg::onDegeneration( bool on )
-{\r
-       QWidgetList aWidgetList;\r
-       Handle(V3d_View) aView;\r
-       QWidget* aWidget;\r
-\r
-       if (!myApplyAllViews)\r
-               aWidgetList.append(Application::getApplication()->getActiveMDI());\r
-       else\r
-               aWidgetList = Application::getWorkspace()->windowList();\r
-\r
+{
+       QWidgetList aWidgetList;
+       Handle(V3d_View) aView;
+       QWidget* aWidget;
+
+       if (!myApplyAllViews)
+               aWidgetList.append(Application::getApplication()->getActiveMDI());
+       else
+               aWidgetList = Application::getWorkspace()->windowList();
+
 
     myIsDeg = on;
 
     myIsDeg = on;
-    if ( myAutoApply ){\r
-               foreach(aWidget, aWidgetList){\r
-      if ( !aWidget ) continue;\r
-                       MDIWindow* aMDIWindow = (MDIWindow*)aWidget;\r
-                       aView = aMDIWindow->getView();\r
-           aView->SetAnimationMode( myIsAnim, myIsDeg );\r
-               }\r
+    if ( myAutoApply ){
+               foreach(aWidget, aWidgetList){
+      if ( !aWidget ) continue;
+                       MDIWindow* aMDIWindow = (MDIWindow*)aWidget;
+                       aView = aMDIWindow->getView();
+           aView->SetAnimationMode( myIsAnim, myIsDeg );
+               }
        }
 }
 
        }
 }
 
@@ -216,33 +216,33 @@ void ViewDlg::onAutoApply( bool on )
 }
 
 void ViewDlg::onApplyAllViews( bool on )
 }
 
 void ViewDlg::onApplyAllViews( bool on )
-{\r
+{
        myApplyAllViews = on;
 }
        myApplyAllViews = on;
 }
-\r
-void ViewDlg::Update()\r
-{\r
-       MDIWindow* anActiveMDIWindow = Application::getApplication()->getActiveMDI();\r
-       if (anActiveMDIWindow){\r
-               Handle(V3d_View) aView = anActiveMDIWindow->getView();\r
-               if(!aView.IsNull()){\r
-               \r
-               myIsAnim = aView->AnimationMode( myIsDeg );\r
-               myAnimBox->blockSignals( true );\r
-               myDegBox->blockSignals( true );\r
-               myAnimBox->setChecked( myIsAnim );\r
-               myDegBox->setChecked( myIsDeg );\r
-               myDegBox->setEnabled( myIsAnim );\r
-               myAnimBox->blockSignals( false );\r
-               myDegBox->blockSignals( false );\r
-\r
-               myZBufferBox->blockSignals(true);\r
-               V3d_TypeOfVisualization aVisuType = aView->Visualization();\r
-               if(aVisuType == V3d_WIREFRAME)\r
-                       myZBufferBox -> setChecked(false);\r
-               else\r
-                       myZBufferBox -> setChecked(true);\r
-               myZBufferBox->blockSignals(false);\r
-               }\r
-       }\r
-}\r
+
+void ViewDlg::Update()
+{
+       MDIWindow* anActiveMDIWindow = Application::getApplication()->getActiveMDI();
+       if (anActiveMDIWindow){
+               Handle(V3d_View) aView = anActiveMDIWindow->getView();
+               if(!aView.IsNull()){
+               
+               myIsAnim = aView->AnimationMode( myIsDeg );
+               myAnimBox->blockSignals( true );
+               myDegBox->blockSignals( true );
+               myAnimBox->setChecked( myIsAnim );
+               myDegBox->setChecked( myIsDeg );
+               myDegBox->setEnabled( myIsAnim );
+               myAnimBox->blockSignals( false );
+               myDegBox->blockSignals( false );
+
+               myZBufferBox->blockSignals(true);
+               V3d_TypeOfVisualization aVisuType = aView->Visualization();
+               if(aVisuType == V3d_WIREFRAME)
+                       myZBufferBox -> setChecked(false);
+               else
+                       myZBufferBox -> setChecked(true);
+               myZBufferBox->blockSignals(false);
+               }
+       }
+}