28 #include <QtGui/QVBoxLayout>
29 #include <QtGui/QToolTip>
31 #define NB_SELECTION_BOUTONS 16
42 "S",
"A*",
"F*",
"V*",
"C"
48 ORBIT_0, ORBIT_1, ORBIT_2, ORBIT_3,
49 ORBIT_01 , ORBIT_02 , ORBIT_03,
50 ORBIT_12 , ORBIT_13 , ORBIT_23,
51 ORBIT_123, ORBIT_023, ORBIT_013, ORBIT_012, ORBIT_0123
57 "[0---]",
"[-1--]",
"[--2-]",
"[---3]",
58 "[01--: Face/Volume (ou demi-face)]",
59 "[0-2-: Arête/Volume]",
60 "[0--3: Arête/Face (ou demi-arête)]",
61 "[-12-: Sommet/Volume]",
"[-1-3: Sommet/Face]",
62 "[--23: Sommet/Arête (ou demi-sommet)]",
63 "[-123: Sommet]",
"[0-23: Arête]",
"[01-3: Face]",
65 "[0123: Composante connexe]"
74 QToolBar(*
HTML::decode(
"Sélection") , parent),
75 FControler(parent -> getControler()),
78 setAllowedAreas(Qt::LeftToolBarArea | Qt::RightToolBarArea);
82 QWidget * total =
new QWidget(
this) ;
83 QVBoxLayout * bl =
new QVBoxLayout(total) ;
88 FGroupe =
new QGroupBox(total) ;
89 QVBoxLayout * gpl =
new QVBoxLayout(FGroupe) ;
95 gpl -> addWidget(rb_tab[i]);
97 connect(rb_tab[i], SIGNAL(clicked(
int)),
98 this, SLOT(callBackClic(
int))) ;
101 rb_tab[0] -> setChecked(
true);
105 rb_tab[i] -> setToolTip(*
HTML::decode(mokaTooltips [ i ])) ;
111 QWidget * sel =
new QWidget ;
112 sel -> setToolTip(*
HTML::decode(
"Niveau de sélection")) ;
114 QHBoxLayout * bh =
new QHBoxLayout(sel) ;
118 int nb_selection_lev = FControler -> getNbSelectionLevels();
122 for (
int i = 0;i < nb_selection_lev;i++)
124 FNiveaux [ i ] =
new IdPushButton(i, QString::number(i + 1)) ;
125 bh -> addWidget(FNiveaux [ i ]) ;
127 connect(FNiveaux[i], SIGNAL(clicked(
int)),
128 this, SLOT(callbackSelectionLevel(
int))) ;
131 FNiveaux [ 0 ] -> setEnabled(
false) ;
134 FBlock =
new QPushButton(
"Block");
135 FBlock->setCheckable(
true);
136 connect(FBlock, SIGNAL(toggled(
bool)),
this,
137 SLOT(callbackToggleBlock(
bool)));
140 FSimplif =
new QPushButton(
"Simplif");
141 FSimplif->setCheckable(
true);
142 connect(FSimplif, SIGNAL(toggled(
bool)),
this,
143 SLOT(callbackToggleSimplificationMode(
bool)));
146 bl -> addWidget(FGroupe) ;
147 bl -> addWidget(sel) ;
148 bl -> addWidget(FBlock) ;
149 bl -> addWidget(FSimplif) ;
151 total -> setMaximumWidth(90);
162 void SelectBar::callBackClic(
int ind)
164 FControler->setSelectionOrbit(mokaOrbit [ ind ]) ;
168 static bool freezed = false ;
170 void SelectBar::callbackSelectionLevel(
int id)
173 setSelectionLevel(
id) ;
176 void SelectBar :: setSelectionLevel(
int L ,
bool freeze)
180 FControler -> setSelectionLevel(L) ;
181 FParent -> repaint() ;
186 for (
int i = 0 ; i < FControler -> getNbSelectionLevels() ; i++)
188 if (FControler -> getSelectionLevel() == i)
189 FNiveaux [ i ] -> setEnabled(
false) ;
191 FNiveaux [ i ] -> setEnabled(
true) ;
199 for (
int i = 0 ; i < FControler -> getNbSelectionLevels() ; i++)
201 if (! FNiveaux [ i ] -> isEnabled())
203 setSelectionLevel((i + 1) % FControler->getNbSelectionLevels()) ;
209 void SelectBar::callbackToggleBlock(
bool ABlock )
211 FControler->toggleModelBlocked();
212 if ( !ABlock ) FParent->
repaint();
215 void SelectBar::callbackToggleSimplificationMode(
bool ABlock )
217 FControler->toggleModeSimplification();
218 if ( !ABlock ) FParent->
repaint();