29 #include <QtGui/QPixmap>
30 #include <QtGui/QColorDialog>
31 #include <Qt3Support/Q3Accel>
36 static QString elementLabs [ 27 ] =
66 QToolBar(
"Colors", parent),
71 parent -> addToolBar(Qt::BottomToolBarArea,
this);
72 setAllowedAreas(Qt::BottomToolBarArea | Qt::TopToolBarArea);
75 FModifiables =
new QComboBox(
this) ;
76 #ifdef MODULE_ARCHITECTURE
77 for (
int i = 0 ; i < 26 ; i++)
79 for (
int i = 0 ; i < 19 ; i++)
81 FModifiables -> addItem(elementLabs [ i ]) ;
83 FCouleur =
new QPushButton(
this) ;
84 FCouleur -> setMinimumSize(30 , 20) ;
85 FCouleur -> setMaximumSize(30 , 20) ;
87 FEpaisseur =
new QSpinBox(
this) ;
88 FEpaisseur -> setMinimum(1);
89 FEpaisseur -> setMaximum(10);
90 FEpaisseur -> setAccelerated(
true);
94 FFin =
new QPushButton(QIcon(
":/boutonAnnuler.png"),
"Close" ,
this) ;
97 QObject :: connect(FCouleur , SIGNAL(clicked()) ,
this ,
99 QObject :: connect(FFin , SIGNAL(clicked()) ,
this ,
101 QObject :: connect(FEpaisseur , SIGNAL(valueChanged(
int)) ,
this ,
103 QObject :: connect(FTransparence , SIGNAL(valueChanged(
double)) ,
this ,
105 QObject :: connect(FModifiables , SIGNAL(activated(
int)) ,
this ,
108 Q3Accel * Raccourci =
new Q3Accel(
this) ;
109 Raccourci -> insertItem(QKeySequence(Qt::Key_Space) , 2) ;
110 Raccourci -> connectItem(2 ,
this , SLOT(
close())) ;
113 addWidget(FModifiables);
117 addWidget(FEpaisseur);
119 addWidget(FTransparence);
134 QColor choix = QColorDialog :: getColor() ;
137 if (choix . isValid())
140 choix . getRgb(&r , &g , &b) ;
144 FParent -> repaint() ;
166 void OptionCouleurs :: colorButton()
168 float color[3] = { 0.0, 0.0, 0.0 };
171 switch (FModifiables -> currentIndex())
175 getParameterFace(FLastClikedViewId) -> getCLFace(0) ;
177 getParameterFace(FLastClikedViewId)->getCLFace(1));
179 getParameterFace(FLastClikedViewId)->getCLFace(2));
181 getParameterFace(FLastClikedViewId)->
186 getParameterDrawing(FLastClikedViewId)->
189 getParameterDrawing(FLastClikedViewId)->
192 getParameterDrawing(FLastClikedViewId)->
197 getParameterDart(FLastClikedViewId)->
198 getCLUnsel(FParent->
getControler()->getSelectionLevel(),
201 getParameterDart(FLastClikedViewId)->
202 getCLUnsel(FParent->
getControler()->getSelectionLevel(),
205 getParameterDart(FLastClikedViewId)->
206 getCLUnsel(FParent->
getControler()->getSelectionLevel(),
209 getParameterDart(FLastClikedViewId)->
214 getParameterDart(FLastClikedViewId)->
218 getParameterDart(FLastClikedViewId)->
222 getParameterDart(FLastClikedViewId)->
226 getParameterDart(FLastClikedViewId)->
231 getParameterDart(FLastClikedViewId)->
232 getCLLastSel(FParent->
getControler()->getSelectionLevel(),
235 getParameterDart(FLastClikedViewId)->
236 getCLLastSel(FParent->
getControler()->getSelectionLevel(),
239 getParameterDart(FLastClikedViewId)->
240 getCLLastSel(FParent->
getControler()->getSelectionLevel(),
243 getParameterDart(FLastClikedViewId)->
248 getParameterDart(FLastClikedViewId)->
249 getCL0Remove(FParent->
getControler()->getSelectionLevel(),
252 getParameterDart(FLastClikedViewId)->
253 getCL0Remove(FParent->
getControler()->getSelectionLevel(),
256 getParameterDart(FLastClikedViewId)->
257 getCL0Remove(FParent->
getControler()->getSelectionLevel(),
260 getParameterDart(FLastClikedViewId)->
265 getParameterDart(FLastClikedViewId)->
266 getCL1Remove(FParent->
getControler()->getSelectionLevel(),
269 getParameterDart(FLastClikedViewId)->
270 getCL1Remove(FParent->
getControler()->getSelectionLevel(),
273 getParameterDart(FLastClikedViewId)->
274 getCL1Remove(FParent->
getControler()->getSelectionLevel(),
277 getParameterDart(FLastClikedViewId)->
282 getParameterVertex(FLastClikedViewId)->
285 getParameterVertex(FLastClikedViewId)->
288 getParameterVertex(FLastClikedViewId)->
291 getParameterVertex(FLastClikedViewId)->
296 getParameterSew(FLastClikedViewId)->
299 getParameterSew(FLastClikedViewId)->
302 getParameterSew(FLastClikedViewId)->
305 getParameterSew(FLastClikedViewId)->
310 getParameterSew(FLastClikedViewId)->
313 getParameterSew(FLastClikedViewId)->
316 getParameterSew(FLastClikedViewId)->
319 getParameterSew(FLastClikedViewId)->
324 getParameterSew(FLastClikedViewId)->
327 getParameterSew(FLastClikedViewId)->
330 getParameterSew(FLastClikedViewId)->
333 getParameterSew(FLastClikedViewId)->
338 getParameterSew(FLastClikedViewId)->
341 getParameterSew(FLastClikedViewId)->
344 getParameterSew(FLastClikedViewId)->
347 getParameterSew(FLastClikedViewId)->
352 getParameterGrid(FLastClikedViewId)->getCLGrid(0));
354 getParameterGrid(FLastClikedViewId)->getCLGrid(1));
356 getParameterGrid(FLastClikedViewId)->getCLGrid(2));
358 getParameterGrid(FLastClikedViewId)->
363 getParameterAxis(FLastClikedViewId)->
366 getParameterAxis(FLastClikedViewId)->
369 getParameterAxis(FLastClikedViewId)->
372 getParameterAxis(FLastClikedViewId)->
377 getParameterAxis(FLastClikedViewId)->
380 getParameterAxis(FLastClikedViewId)->
383 getParameterAxis(FLastClikedViewId)->
386 getParameterAxis(FLastClikedViewId)->
391 getParameterAxis(FLastClikedViewId)->
394 getParameterAxis(FLastClikedViewId)->
397 getParameterAxis(FLastClikedViewId)->
400 getParameterAxis(FLastClikedViewId)->
405 getParameterAimedPoint(FLastClikedViewId)->
408 getParameterAimedPoint(FLastClikedViewId)->
411 getParameterAimedPoint(FLastClikedViewId)->
414 getParameterAimedPoint(FLastClikedViewId)->
419 getParameterNormalVector(FLastClikedViewId)->
420 getCLNormalVector(0));
422 getParameterNormalVector(FLastClikedViewId)->
423 getCLNormalVector(1));
425 getParameterNormalVector(FLastClikedViewId)->
426 getCLNormalVector(2));
428 getParameterNormalVector(FLastClikedViewId)->
429 getLWNormalVector());
434 getParameterObjectTransformation(FLastClikedViewId)->
435 getCLObjectTransformation(0));
438 getParameterObjectTransformation(FLastClikedViewId)->
439 getCLObjectTransformation(1));
442 getParameterObjectTransformation(FLastClikedViewId)->
443 getCLObjectTransformation(2));
446 getParameterObjectTransformation(FLastClikedViewId)->
447 getLWObjectTransformation());
452 getParameterPreview(FLastClikedViewId)->
456 getParameterPreview(FLastClikedViewId)->
460 getParameterPreview(FLastClikedViewId)->
464 getParameterPreview(FLastClikedViewId)->
470 getParameterPreview(FLastClikedViewId)->
474 getParameterPreview(FLastClikedViewId)->
478 getParameterPreview(FLastClikedViewId)->
482 getParameterPreview(FLastClikedViewId)->
487 QPixmap * coul =
new QPixmap(30 , 30) ;
488 coul -> fill(QColor((
int)(color[0]* 255) , (
int)(color[1]*255) ,
489 (
int)(color[2]*255))) ;
490 FCouleur -> setIcon(QIcon(*coul));
493 FParent -> repaint() ;
496 void OptionCouleurs :: setColor(
int num ,
float value)
498 TViewId FLastClikedViewId = FParent -> getCurrentViewId() ;
500 switch (FModifiables -> currentIndex())
503 FParent -> getControler()->
504 getParameterFace(FLastClikedViewId)->setCLFace(num, value);
508 setCLBackground(num, value);
512 setCLUnsel(FParent->
getControler()->getSelectionLevel(), num, value);
516 setCLSel(FParent -> getControler()->getSelectionLevel(), num, value);
520 setCLLastSel(FParent -> getControler()->getSelectionLevel(),
525 setCL0Remove(FParent -> getControler()->getSelectionLevel(),
530 setCL1Remove(FParent -> getControler()->getSelectionLevel(),
534 FParent -> getControler()->
535 getParameterVertex(FLastClikedViewId)->setCLVertex(num, value);
538 FParent -> getControler()->
539 getParameterSew(FLastClikedViewId)->setCLSew(0, num, value);
542 FParent -> getControler()->
543 getParameterSew(FLastClikedViewId)->setCLSew(1, num, value);
546 FParent -> getControler()->
547 getParameterSew(FLastClikedViewId)->setCLSew(2, num, value);
550 FParent -> getControler()->
551 getParameterSew(FLastClikedViewId)->setCLSew(3, num, value);
554 FParent -> getControler()->
555 getParameterGrid(FLastClikedViewId)->setCLGrid(num, value);
558 FParent -> getControler()->
559 getParameterAxis(FLastClikedViewId)->setCLAxisX(num, value);
562 FParent -> getControler()->
563 getParameterAxis(FLastClikedViewId)->setCLAxisY(num, value);
566 FParent -> getControler()->
567 getParameterAxis(FLastClikedViewId)->setCLAxisZ(num, value);
570 FParent -> getControler()->
571 getParameterAimedPoint(FLastClikedViewId)->
572 setCLAimedPoint(num, value);
575 FParent -> getControler()->
576 getParameterNormalVector(FLastClikedViewId)->
577 setCLNormalVector(num, value);
580 FParent -> getControler()->
581 getParameterObjectTransformation(FLastClikedViewId)->
582 setCLObjectTransformation(num, value);
586 setCLPreview(num, value);
590 setCLPreviewBad(num, value);
595 void OptionCouleurs :: setR(
int r)
597 setColor(0 , ((
float) r) / 255);
600 void OptionCouleurs :: setG(
int g)
602 setColor(1 , ((
float) g) / 255) ;
605 void OptionCouleurs :: setB(
int b)
607 setColor(2 , ((
float) b) / 255) ;
615 int w = FEpaisseur -> value() ;
617 switch (FModifiables -> currentIndex())
622 FParent -> getControler()->
623 getParameterDart(FLastClikedViewId)->setLWDarts(w);
626 FParent -> getControler()->
627 getParameterVertex(FLastClikedViewId)->setSVertex(w);
630 FParent -> getControler()->
631 getParameterSew(FLastClikedViewId)->setLWSew(0, w);
634 FParent -> getControler()->
635 getParameterSew(FLastClikedViewId)->setLWSew(1, w);
638 FParent -> getControler()->
639 getParameterSew(FLastClikedViewId)->setLWSew(2, w);
642 FParent -> getControler()->
643 getParameterSew(FLastClikedViewId)->setLWSew(3, w);
646 FParent -> getControler()->
647 getParameterGrid(FLastClikedViewId)->setLWGrid(w);
650 FParent -> getControler()->
651 getParameterAxis(FLastClikedViewId)->setLWAxis(w);
654 FParent -> getControler()->
655 getParameterAxis(FLastClikedViewId)->setLWAxis(w);
658 FParent -> getControler()->
659 getParameterAxis(FLastClikedViewId)->setLWAxis(w);
662 FParent -> getControler()->
663 getParameterAimedPoint(FLastClikedViewId)->setLWAimedPoint(w);
666 FParent -> getControler()->
667 getParameterNormalVector(FLastClikedViewId)->
668 setLWNormalVector(w);
671 FParent -> getControler()->
672 getParameterObjectTransformation(FLastClikedViewId)->
673 setLWObjectTransformation(w);
683 FParent -> repaint() ;
691 float a = FTransparence -> valuef() ;
692 TViewId FLastClikedViewId = FParent -> getCurrentViewId() ;
693 switch (FModifiables -> currentIndex())
696 FParent -> getControler() ->
697 getParameterFace(FLastClikedViewId)->setBLFace(a);
702 FParent -> repaint() ;
706 void OptionCouleurs :: griseBoutons()
708 FEpaisseur -> setEnabled(
false) ;
709 FTransparence -> setEnabled(
false) ;
711 switch (FModifiables -> currentIndex())
714 FTransparence -> setEnabled(
true) ;
719 FEpaisseur -> setEnabled(
true) ;
722 FEpaisseur -> setEnabled(
true) ;
725 FEpaisseur -> setEnabled(
true) ;
728 FEpaisseur -> setEnabled(
true) ;
731 FEpaisseur -> setEnabled(
true) ;
735 FEpaisseur -> setEnabled(
true) ;
break;
737 FEpaisseur -> setEnabled(
true) ;
740 FEpaisseur -> setEnabled(
true) ;
743 FEpaisseur -> setEnabled(
true) ;
746 FEpaisseur -> setEnabled(
true) ;
749 FEpaisseur -> setEnabled(
true) ;
752 FEpaisseur -> setEnabled(
true) ;
756 FEpaisseur -> setEnabled(
true) ;
760 FEpaisseur -> setEnabled(
true) ;