00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "options-frame.qt.hh"
00025 #include "window.qt.hh"
00026 #include "HtmlEntities.hh"
00027
00028 #include <Qt3Support/Q3Accel>
00029 #include <QtGui/QVBoxLayout>
00030
00031
00032
00033
00034 OptionsFrame :: OptionsFrame ( Window * parent )
00035 : QDialog ( parent ) ,
00036 FVisible ( false )
00037 {
00038 valid_btn = new QPushButton("OK");
00039 valid_btn->setMaximumSize(75,50);
00040 connect(valid_btn, SIGNAL(clicked()),
00041 this, SLOT(callbackButtonOkPressed()));
00042
00043 main_tab = new QTabWidget(this);
00044
00045 FAffichage = new OptionsAffichage ( parent , main_tab ) ;
00046 main_tab -> addTab ( FAffichage , "&Affichage") ;
00047
00048 FVue = new OptionsVue ( parent , this ) ;
00049 main_tab -> addTab ( FVue , *HTML::decode("&Vue Eclatée") ) ;
00050
00051 FPonderation = new OptionsPonderation ( parent , main_tab) ;
00052 main_tab -> addTab ( FPonderation , *HTML::decode("Pondération "
00053 "des &déformations") ) ;
00054
00055 FExtrusion = new OptionsExtrusion ( parent , main_tab ) ;
00056 main_tab -> addTab ( FExtrusion , "&Extrusions/Epaississement" ) ;
00057
00058 #ifdef MODULE_MESH
00059 FInterpolation = new OptionsInterpolation ( parent , main_tab ) ;
00060 main_tab -> addTab ( FInterpolation , "&Interpolations/Lissages" ) ;
00061 #endif //MODULE_MESH
00062
00063 FDivers = new OptionsDivers ( parent , main_tab ) ;
00064 main_tab -> addTab ( FDivers , "&Divers" ) ;
00065
00066
00067 Q3Accel * Raccourci = new Q3Accel ( this ) ;
00068
00069 Raccourci -> insertItem ( QKeySequence ( Qt::Key_F2 ) , 2 ) ;
00070 Raccourci -> connectItem ( 2 , this , SLOT ( callbackShowAffichage ( ) ) ) ;
00071
00072 Raccourci -> insertItem ( QKeySequence ( Qt::Key_F3 ) , 3 ) ;
00073 Raccourci -> connectItem ( 3 , this , SLOT ( callbackShowVue ( ) ) ) ;
00074
00075 Raccourci -> insertItem ( QKeySequence ( Qt::Key_F4 ) , 4 ) ;
00076 Raccourci -> connectItem ( 4 , this , SLOT ( callbackShowPonderation ( ) ) ) ;
00077
00078 Raccourci -> insertItem ( QKeySequence ( Qt::Key_F5 ) , 5 ) ;
00079 Raccourci -> connectItem ( 5 , this , SLOT ( callbackShowExtrusion ( ) ) ) ;
00080
00081 Raccourci -> insertItem ( QKeySequence ( Qt::Key_F6 ) , 6 ) ;
00082 Raccourci -> connectItem ( 6 , this , SLOT ( callbackShowInterpolation()));
00083
00084 Raccourci -> insertItem ( QKeySequence ( Qt::Key_F7 ) , 7 ) ;
00085 Raccourci->connectItem(7, this, SLOT(callbackShowDivers()));
00086
00087
00088
00089
00090 Raccourci -> insertItem ( QKeySequence ( "Alt+F9" ) , 8 ) ;
00091 Raccourci -> connectItem ( 8 , this , SLOT ( callbackToggleNormal ( ) ) ) ;
00092
00093 Raccourci -> insertItem ( QKeySequence ( Qt::Key_F9 ) , 9 ) ;
00094 Raccourci -> connectItem ( 9 , this , SLOT ( callbackToggleSews ( ) ) ) ;
00095
00096 Raccourci -> insertItem ( QKeySequence ( Qt::Key_F10 ) , 10 ) ;
00097 Raccourci -> connectItem ( 10 , this , SLOT ( callbackToggleVertices ( ) ) ) ;
00098
00099 Raccourci -> insertItem ( QKeySequence ( Qt::Key_F11 ) , 11 ) ;
00100 Raccourci -> connectItem ( 11 , this , SLOT ( callbackToggleFaces ( ) ) ) ;
00101
00102 Raccourci -> insertItem ( QKeySequence ( Qt::Key_F12 ) , 12 ) ;
00103 Raccourci -> connectItem ( 12 , this , SLOT ( callbackToggleGrille ( ) ) ) ;
00104
00105 Raccourci->insertItem ( QKeySequence ( Qt :: Key_Space ) , 13 ) ;
00106 Raccourci->connectItem(13, parent, SLOT (callbackHideAllWindow()));
00107
00108 Raccourci -> insertItem ( QKeySequence ( "Alt+F11" ) , 14 ) ;
00109 Raccourci -> connectItem ( 14 , this , SLOT (callbackTournerButton() )) ;
00110
00111 connect(main_tab,SIGNAL(currentChanged(int)),this,SLOT(updateTab(int)));
00112
00113 QVBoxLayout* layout = new QVBoxLayout();
00114 layout->addWidget(main_tab);
00115 layout->addWidget(valid_btn);
00116 layout->setAlignment(valid_btn, Qt::AlignCenter);
00117
00118 setLayout(layout);
00119 setWindowTitle ( "Options" ) ;
00120 }
00121
00122
00123
00124
00125 OptionsFrame :: ~OptionsFrame ( )
00126 {
00127 }
00128
00129 void OptionsFrame :: update ( ) {
00130 FAffichage -> update ( ) ;
00131 }
00132
00133 void OptionsFrame :: setOption ( int indice )
00134 {
00135 switch (indice) {
00136 case 2 : case 4 :
00137 if ( FVisible && main_tab->currentWidget ( ) == FAffichage ) {
00138 FVisible = false ;
00139 close ( ) ;
00140 break ;
00141 }
00142 FVisible = true ;
00143 FAffichage -> update ( ) ;
00144 main_tab->setCurrentWidget ( FAffichage ) ; break ;
00145
00146 case 3 :
00147 if ( FVisible && main_tab->currentWidget ( ) == FVue ) {
00148 FVisible = false ;
00149 close ( ) ;
00150 break ;
00151 }
00152 FVisible = true ;
00153 FVue -> update ( ) ;
00154 main_tab->setCurrentWidget ( FVue ) ; break ;
00155
00156 case 5 :
00157 if ( FVisible && main_tab->currentWidget ( ) == FPonderation ){
00158 FVisible = false ;
00159 close ( ) ;
00160 break ;
00161 }
00162 FPonderation -> update ( ) ;
00163 FVisible = true ;
00164 main_tab->setCurrentWidget ( FPonderation ) ; break ;
00165
00166 case 6 :
00167 if ( FVisible && main_tab->currentWidget ( ) == FExtrusion ) {
00168 FVisible = false ;
00169 close ( ) ;
00170 break ;
00171 }
00172 FExtrusion -> update ( ) ;
00173 FVisible = true ;
00174 main_tab->setCurrentWidget ( FExtrusion ) ; break ;
00175
00176 case 7 :
00177 if ( FVisible && main_tab->currentWidget ( ) == FInterpolation ) {
00178 FVisible = false ;
00179 close ( ) ;
00180 break ;
00181 }
00182 FInterpolation -> update ( ) ;
00183 FVisible = true ;
00184 main_tab->setCurrentWidget ( FInterpolation ) ; break ;
00185
00186 case 8 :
00187 if ( FVisible && main_tab->currentWidget ( ) == FDivers ) {
00188 FVisible = false ;
00189 close ( ) ;
00190 break ;
00191 }
00192 FDivers -> update ( ) ;
00193 FVisible = true ;
00194 main_tab->setCurrentWidget ( FDivers ) ; break ;
00195
00196 default : {}
00197 }
00198 }
00199
00200 void OptionsFrame :: updateTab(int num_tab)
00201 {
00202 QWidget * current = main_tab->currentWidget();
00203
00204 if (current == FAffichage) FAffichage -> update();
00205 else if (current == FPonderation) FPonderation -> update();
00206 else if (current == FInterpolation) FInterpolation -> update();
00207 else if (current == FExtrusion) FExtrusion -> update();
00208 else if (current == FVue) FVue -> update();
00209 else if (current == FDivers) FDivers -> update();
00210 }
00211
00212 OptionsAffichage * OptionsFrame :: getOptionsAffichage() const
00213 {
00214 return FAffichage;
00215 }
00216
00217 OptionsVue * OptionsFrame :: getOptionsVue() const
00218 {
00219 return FVue;
00220 }
00221
00222
00223
00224 void OptionsFrame :: callbackShowVue ( )
00225 {
00226 setOption ( 3 ) ;
00227 }
00228
00229 void OptionsFrame :: callbackShowCouture ( )
00230 {
00231 setOption ( 4 ) ;
00232 }
00233
00234 void OptionsFrame :: callbackShowPonderation ( )
00235 {
00236 setOption ( 5 ) ;
00237 }
00238
00239 void OptionsFrame :: callbackShowExtrusion ( )
00240 {
00241 setOption ( 6 ) ;
00242 }
00243
00244 void OptionsFrame :: callbackShowInterpolation ( )
00245 {
00246 #ifdef MODULE_MESH
00247 setOption ( 7 ) ;
00248 #endif //MODULE_MESH
00249 }
00250
00251 void OptionsFrame :: callbackShowAffichage ( )
00252 {
00253 setOption ( 2 ) ;
00254 }
00255
00256 void OptionsFrame :: callbackShowDivers ()
00257 {
00258 setOption ( 8 ) ;
00259 }
00260
00261 void OptionsFrame :: applyValues()
00262 {
00263 FAffichage -> applyValues ( ) ;
00264 }
00265
00266
00267 void OptionsFrame :: callbackToggleSews ( )
00268 {
00269 FAffichage -> setFMain ( ) ;
00270 FAffichage -> callbackToggleSews ( ) ;
00271 }
00272
00273
00274 void OptionsFrame :: callbackToggleNormal ( )
00275 {
00276 FAffichage -> setFMain ( ) ;
00277 FAffichage -> callbackToggleNormal ( ) ;
00278 }
00279
00280
00281 void OptionsFrame :: callbackToggleVertices ( )
00282 {
00283 FAffichage -> setFMain ( ) ;
00284 FAffichage -> callbackToggleVertices ( ) ;
00285 }
00286
00287
00288 void OptionsFrame :: callbackToggleFaces ( )
00289 {
00290 FAffichage -> setFMain ( ) ;
00291 FAffichage -> callbackToggleFaces ( ) ;
00292 }
00293
00294 void OptionsFrame :: callbackTournerButton( )
00295 {
00296 if ( FAffichage ->getFacesDisplay ( ) )
00297 {
00298 if (FAffichage->getCoulFacesGlobale()) FAffichage->setFacesCoulAlea();
00299 else if (FAffichage->getFacesCoulAlea())
00300 FAffichage->setVolumesCoulAlea();
00301 else if (FAffichage->getVolumesCoulAlea())
00302 FAffichage->setCoulFacesGlobale();
00303 else { assert(false); }
00304 }
00305 }
00306
00307 void OptionsFrame :: setFVisible ( bool b )
00308 {
00309 FVisible = b ;
00310 }
00311
00312 void OptionsFrame :: callbackToggleGrille ( )
00313 {
00314 FAffichage -> setFMain ( ) ;
00315 FAffichage -> callbackToggleGrid ( ) ;
00316 FAffichage -> setFMain ( ) ;
00317 FAffichage -> callbackToggleAxis ( ) ;
00318 }
00319
00320 void OptionsFrame :: callbackButtonOkPressed ( )
00321 {
00322 FVisible = false ;
00323 done(QDialog::Accepted);
00324 }