Salome HOME
Fix for Bug PAL8597:
[modules/visu.git] / src / VISUGUI / VisuGUI_ScalarBarDlg.cxx
1 //  VISU VISUGUI : GUI of VISU component
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 //  This library is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU Lesser General Public
8 //  License as published by the Free Software Foundation; either
9 //  version 2.1 of the License.
10 //
11 //  This library is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 //  Lesser General Public License for more details.
15 //
16 //  You should have received a copy of the GNU Lesser General Public
17 //  License along with this library; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
21 //
22 //
23 //
24 //  File   : VisuGUI_ScalarBarDlg.cxx
25 //  Author : Laurent CORNABE & Hubert ROLLAND
26 //  Module : VISU
27 //  $Header$
28
29 #include "VisuGUI_ScalarBarDlg.h"
30
31 #include "VisuGUI.h"
32 #include "VisuGUI_Tools.h"
33 #include "VisuGUI_FontWg.h"
34
35 #include "SVTK_ViewWindow.h"
36
37 #include "VISUConfig.hh"
38 #include "VISU_Convertor.hxx"
39
40 #include "VISU_ScalarMapPL.hxx"
41 #include "VISU_ScalarMap_i.hh"
42 #include "VISU_ScalarMapAct.h"
43
44 #include "SalomeApp_Application.h"
45
46 #include "SUIT_MessageBox.h"
47 #include "SUIT_ResourceMgr.h"
48
49 #include <limits.h>
50 #include <qlayout.h>
51 #include <qvalidator.h>
52 #include <qcolordialog.h>
53
54 #include <vtkTextProperty.h>
55
56 using namespace std;
57
58
59 VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane (QWidget * parent, bool SetPref):
60   QVBox(parent), myPreviewActor(0)
61 {
62   myVerX = 0.01;  myVerY = 0.10;  myVerW = 0.10;  myVerH = 0.80;
63   myHorX = 0.20;  myHorY = 0.01;  myHorW = 0.60;  myHorH = 0.12;
64   Imin = 0.0; Imax = 0.0; /*Fmin = 0.0; Fmax = 0.0;*/ Rmin = 0.0; Rmax = 0.0;
65   myRangeMode = -1;
66
67   setSpacing(6);
68   //setMargin(11);
69
70   // Range ============================================================
71   RangeGroup = new QButtonGroup (tr("SCALAR_RANGE_GRP"), this, "RangeGroup");
72   RangeGroup->setColumnLayout(0, Qt::Vertical );
73   RangeGroup->layout()->setSpacing( 0 );
74   RangeGroup->layout()->setMargin( 0 );
75   QGridLayout* RangeGroupLayout = new QGridLayout( RangeGroup->layout() );
76   RangeGroupLayout->setAlignment( Qt::AlignTop );
77   RangeGroupLayout->setSpacing( 6 );
78   RangeGroupLayout->setMargin( 11 );
79
80   myModeLbl = new QLabel("Scalar Mode", RangeGroup);
81
82   myModeCombo = new QComboBox(RangeGroup);
83   myModeCombo->insertItem("Modulus");
84   myModeCombo->insertItem("Component 1");
85   myModeCombo->insertItem("Component 2");
86   myModeCombo->insertItem("Component 3");
87
88   CBLog = new QCheckBox (tr("LOGARITHMIC_SCALING"), RangeGroup);
89   CBLog->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
90
91   RBFrange = new QRadioButton (tr("FIELD_RANGE_BTN"), RangeGroup, "RBFrange");
92   RBIrange = new QRadioButton (tr("IMPOSED_RANGE_BTN"), RangeGroup, "RBIrange");
93   RBFrange->setChecked( true );
94
95   MinEdit = new QLineEdit( RangeGroup, "MinEdit" );
96   MinEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
97   MinEdit->setMinimumWidth( 70 );
98   MinEdit->setValidator( new QDoubleValidator(this) );
99   MinEdit->setText( "0.0" );
100   QLabel* MinLabel = new QLabel (tr("LBL_MIN"), RangeGroup, "MinLabel");
101   MinLabel->setBuddy(MinEdit);
102
103   MaxEdit = new QLineEdit( RangeGroup, "MaxEdit" );
104   MaxEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
105   MaxEdit->setMinimumWidth( 70 );
106   MaxEdit->setValidator( new QDoubleValidator(this) );
107   MaxEdit->setText( "0.0" );
108   QLabel* MaxLabel = new QLabel (tr("LBL_MAX"), RangeGroup, "MaxLabel");
109   MaxLabel->setBuddy(MaxEdit);
110
111   RangeGroupLayout->addWidget( myModeLbl, 0, 0 );
112   RangeGroupLayout->addMultiCellWidget( myModeCombo, 0, 0, 1, 3);
113   RangeGroupLayout->addMultiCellWidget( CBLog, 1, 1, 0, 3);
114   RangeGroupLayout->addMultiCellWidget( RBFrange, 2, 2, 0, 1);
115   RangeGroupLayout->addMultiCellWidget( RBIrange, 2, 2, 2, 3);
116   RangeGroupLayout->addWidget( MinLabel, 3, 0 );
117   RangeGroupLayout->addWidget( MinEdit,  3, 1 );
118   RangeGroupLayout->addWidget( MaxLabel, 3, 2 );
119   RangeGroupLayout->addWidget( MaxEdit,  3, 3 );
120
121   //TopLayout->addWidget( RangeGroup );
122
123   // Colors and Labels ========================================================
124   QGroupBox* ColLabGroup = new QGroupBox (tr("COLORS_LABELS_GRP"), this, "ColLabGroup");
125   ColLabGroup->setColumnLayout(0, Qt::Vertical );
126   ColLabGroup->layout()->setSpacing( 0 );
127   ColLabGroup->layout()->setMargin( 0 );
128   QGridLayout* ColLabGroupLayout = new QGridLayout( ColLabGroup->layout() );
129   ColLabGroupLayout->setAlignment( Qt::AlignTop );
130   ColLabGroupLayout->setSpacing( 6 );
131   ColLabGroupLayout->setMargin( 11 );
132
133   QLabel* ColorLabel = new QLabel (tr("LBL_NB_COLORS"), ColLabGroup, "ColorLabel");
134   ColorSpin = new QSpinBox( 2, 256, 1, ColLabGroup );
135   ColorSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
136   ColorSpin->setMinimumWidth( 70 );
137   ColorSpin->setValue( 64 );
138
139   QLabel* LabelLabel = new QLabel (tr("LBL_NB_LABELS"), ColLabGroup, "LabelLabel");
140   LabelSpin = new QSpinBox( 2, 65, 1, ColLabGroup );
141   LabelSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
142   LabelSpin->setMinimumWidth( 70 );
143   LabelSpin->setValue( 5 );
144
145   ColLabGroupLayout->addWidget( ColorLabel, 0, 0);
146   ColLabGroupLayout->addWidget( ColorSpin,  0, 1);
147   ColLabGroupLayout->addWidget( LabelLabel, 0, 2);
148   ColLabGroupLayout->addWidget( LabelSpin,  0, 3);
149
150   //TopLayout->addWidget( ColLabGroup );
151
152   // Orientation ==========================================================
153   QButtonGroup* OrientGroup = new QButtonGroup (tr("ORIENTATION_GRP"), this, "OrientGroup");
154   OrientGroup->setColumnLayout(0, Qt::Vertical );
155   OrientGroup->layout()->setSpacing( 0 );
156   OrientGroup->layout()->setMargin( 0 );
157   QGridLayout* OrientGroupLayout = new QGridLayout( OrientGroup->layout() );
158   OrientGroupLayout->setAlignment( Qt::AlignTop );
159   OrientGroupLayout->setSpacing( 6 );
160   OrientGroupLayout->setMargin( 11 );
161
162   RBvert = new QRadioButton (tr("VERTICAL_BTN"), OrientGroup, "RBvert");
163   RBvert->setChecked( true );
164   RBhori = new QRadioButton (tr("HORIZONTAL_BTN"), OrientGroup, "RBhori");
165   OrientGroupLayout->addWidget( RBvert, 0, 0 );
166   OrientGroupLayout->addWidget( RBhori, 0, 1 );
167
168   //  TopLayout->addWidget( OrientGroup );
169
170   // Origin ===============================================================
171   QGroupBox* OriginGroup = new QGroupBox (tr("ORIGIN_GRP"), this, "OriginGroup");
172   OriginGroup->setColumnLayout(0, Qt::Vertical );
173   OriginGroup->layout()->setSpacing( 0 );
174   OriginGroup->layout()->setMargin( 0 );
175   QGridLayout* OriginGroupLayout = new QGridLayout( OriginGroup->layout() );
176   OriginGroupLayout->setAlignment( Qt::AlignTop );
177   OriginGroupLayout->setSpacing( 6 );
178   OriginGroupLayout->setMargin( 11 );
179
180   QLabel* XLabel = new QLabel (tr("LBL_X"), OriginGroup, "XLabel");
181   XSpin = new QtxDblSpinBox( 0.0, 1.0, 0.1, OriginGroup );
182   XSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
183   XSpin->setMinimumWidth( 70 );
184   XSpin->setValue( 0.01 );
185
186   QLabel* YLabel = new QLabel (tr("LBL_Y"), OriginGroup, "YLabel");
187   YSpin = new QtxDblSpinBox( 0.0, 1.0, 0.1, OriginGroup );
188   YSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
189   YSpin->setMinimumWidth( 70 );
190   YSpin->setValue( 0.01 );
191
192   OriginGroupLayout->addWidget( XLabel, 0, 0);
193   OriginGroupLayout->addWidget( XSpin,  0, 1);
194   OriginGroupLayout->addWidget( YLabel, 0, 2);
195   OriginGroupLayout->addWidget( YSpin,  0, 3);
196
197   //TopLayout->addWidget( OriginGroup );
198
199   // Dimensions =========================================================
200   QGroupBox* DimGroup = new QGroupBox (tr("DIMENSIONS_GRP"), this, "DimGroup");
201   DimGroup->setColumnLayout(0, Qt::Vertical );
202   DimGroup->layout()->setSpacing( 0 );
203   DimGroup->layout()->setMargin( 0 );
204   QGridLayout* DimGroupLayout = new QGridLayout( DimGroup->layout() );
205   DimGroupLayout->setAlignment( Qt::AlignTop );
206   DimGroupLayout->setSpacing( 6 );
207   DimGroupLayout->setMargin( 11 );
208
209   QLabel* WidthLabel = new QLabel (tr("LBL_WIDTH"), DimGroup, "WidthLabel");
210   WidthSpin = new QtxDblSpinBox( 0.0, 1.0, 0.1, DimGroup );
211   WidthSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
212   WidthSpin->setMinimumWidth( 70 );
213   WidthSpin->setValue( 0.1 );
214
215   QLabel* HeightLabel = new QLabel (tr("LBL_HEIGHT"), DimGroup, "HeightLabel");
216   HeightSpin = new QtxDblSpinBox( 0.0, 1.0, 0.1, DimGroup );
217   HeightSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
218   HeightSpin->setMinimumWidth( 70 );
219   HeightSpin->setValue( 0.8 );
220
221   DimGroupLayout->addWidget( WidthLabel, 0, 0);
222   DimGroupLayout->addWidget( WidthSpin,  0, 1);
223   DimGroupLayout->addWidget( HeightLabel, 0, 2);
224   DimGroupLayout->addWidget( HeightSpin,  0, 3);
225
226   //TopLayout->addWidget( DimGroup );
227
228   // Save check box ===========================================================
229   QHBox* aSaveBox = new QHBox(this);
230   if (!SetPref) {
231     CBSave = new QCheckBox (tr("SAVE_DEFAULT_CHK"), aSaveBox, "CBSave");
232     //TopLayout->addWidget(CBSave);
233   }
234   else {
235     CBSave = 0;
236   }
237   myTextBtn = new QPushButton("Text properties...", aSaveBox);
238   myTextDlg = new VisuGUI_TextPrefDlg(this);
239   myTextDlg->setTitleVisible(!SetPref);
240
241   QGroupBox* CheckGroup = new QGroupBox("", this, "CheckGroup");
242   CheckGroup->setColumnLayout(0, Qt::Vertical );
243   CheckGroup->layout()->setSpacing( 0 );
244   CheckGroup->layout()->setMargin( 0 );
245   QGridLayout* CheckGroupLayout = new QGridLayout( CheckGroup->layout() );
246   
247   myPreviewCheck = new QCheckBox(tr("LBL_SHOW_PREVIEW"), this);
248   myPreviewCheck->setChecked(false);
249   CheckGroupLayout->addWidget(myPreviewCheck , 0, 0 );
250
251   // signals and slots connections ===========================================
252   connect( RangeGroup,   SIGNAL( clicked( int ) ), this, SLOT( changeRange( int ) ) );
253   connect( OrientGroup,  SIGNAL( clicked( int ) ), this, SLOT( changeDefaults( int ) ) );
254   connect( XSpin,        SIGNAL( valueChanged( double ) ), this, SLOT( XYChanged( double ) ) );
255   connect( YSpin,        SIGNAL( valueChanged( double ) ), this, SLOT( XYChanged( double ) ) );
256   connect( myTextBtn,    SIGNAL( clicked() ), this, SLOT( onTextPref() ) );
257   connect( myPreviewCheck, SIGNAL( toggled( bool )), this, SLOT( onPreviewCheck( bool ) ) );
258   connect( ColorSpin,    SIGNAL( valueChanged( int ) ), this, SLOT( updatePreview() ));
259   connect( LabelSpin,    SIGNAL( valueChanged( int ) ), this, SLOT( updatePreview() ));
260   connect( WidthSpin,    SIGNAL( valueChanged( double ) ), this, SLOT( updatePreview() ));
261   connect( HeightSpin,   SIGNAL( valueChanged( double ) ), this, SLOT( updatePreview() ));
262   connect( MinEdit,      SIGNAL( textChanged( const QString& ) ), this, SLOT( updatePreview() ));
263   connect( MaxEdit,      SIGNAL( textChanged( const QString& ) ), this, SLOT( updatePreview() ));
264   connect( CBLog,        SIGNAL( toggled( bool ) ), this, SLOT( updatePreview() ));
265   changeRange( 0 );
266   changeDefaults( 0 );
267   myIsStoreTextProp = false;
268 }
269
270
271 /**
272  * Initializes dialog box values from resources
273  */
274 void VisuGUI_ScalarBarPane::initFromResources() {
275   int sbCol=64,sbLab=5,orient=0;
276   float sbX1=0.01,sbY1=0.1,sbW=0.1,sbH=0.8;
277   float sbVmin=0., sbVmax=0.;
278   bool sbRange=false;
279   QString aString;
280
281   SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
282
283   int aScalarMode = aResourceMgr->integerValue("VISU", "scalar_bar_mode", 0);
284   myModeCombo->setCurrentItem(aScalarMode);
285
286   orient = aResourceMgr->integerValue("VISU", "scalar_bar_orientation", orient);
287   if(orient != 0){
288     orient=1;
289     sbX1=0.2;
290     sbY1=0.01;
291     sbW=0.6;
292     sbH=0.12;
293   }
294   
295   QString propertyName = QString( "scalar_bar_%1_" ).arg( orient == 0 ? "vertical" : "horizontal" );
296
297   sbX1 = aResourceMgr->doubleValue("VISU", propertyName + "x", sbX1);
298   sbY1 = aResourceMgr->doubleValue("VISU", propertyName + "y", sbY1);
299
300   sbW = aResourceMgr->doubleValue("VISU", propertyName + "width", sbW);
301   sbH = aResourceMgr->doubleValue("VISU", propertyName + "height",sbH);
302   
303   sbCol = aResourceMgr->integerValue("VISU" ,"scalar_bar_num_colors", sbCol);
304   sbLab = aResourceMgr->integerValue("VISU", "scalar_bar_num_labels", sbLab);
305
306   int rangeType = aResourceMgr->integerValue("VISU" , "scalar_range_type", 0);
307   if (rangeType == 1) sbRange = true;
308   sbVmin = aResourceMgr->doubleValue("VISU", "scalar_range_min", sbVmin);
309   sbVmax = aResourceMgr->doubleValue("VISU", "scalar_range_max", sbVmax);
310
311   bool isLog = aResourceMgr->booleanValue("VISU", "scalar_bar_logarithmic", false);
312   setLogarithmic(isLog);
313   
314   if((sbX1 < 0.) || (sbY1 < 0.) ||
315      ((sbX1+sbW) > 1.) || ((sbY1+sbH) > 1.)) {
316     if(orient == 0) {
317       sbX1=0.01;
318       sbY1=0.1;
319       sbW=0.1;
320       sbH=0.8;
321     } else {
322       sbX1=0.2;
323       sbY1=0.01;
324       sbW=0.6;
325       sbH=0.12;
326     }
327   }
328   if(sbCol < 2) sbCol=2;
329   if(sbCol > 64) sbCol=64;
330   if(sbLab < 2) sbLab=2;
331   if(sbLab > 65) sbLab=65;
332
333   if(sbVmin > sbVmax) {
334     sbVmin=0.;
335     sbVmax=0.;
336   }
337
338   setRange( sbVmin, sbVmax, /*0.0, 0.0,*/ sbRange );
339   setPosAndSize( sbX1, sbY1, sbW, sbH, orient == 0);
340   setScalarBarData( sbCol, sbLab );
341
342   // "Title"
343   bool isBold = false, isItalic = false, isShadow = false;
344   int aFontFamily = VTK_ARIAL;
345
346   if ( aResourceMgr->hasValue( "VISU", "scalar_bar_title_font" ) )
347     {
348       QFont f = aResourceMgr->fontValue( "VISU", "scalar_bar_title_font" );
349       
350       if ( f.family() == "Arial" )
351         aFontFamily = VTK_ARIAL;
352       else if ( f.family() == "Courier" )
353         aFontFamily = VTK_COURIER;
354       else if ( f.family() == "Times" )
355         aFontFamily = VTK_TIMES;
356       
357       isBold = f.bold();
358       isItalic = f.italic();
359       isShadow =  f.underline();
360     }
361   
362   QColor aTextColor = aResourceMgr->colorValue( "VISU", "scalar_bar_title_color", QColor( 255, 255, 255 ) );
363   
364   myTextDlg->myTitleFont->SetData(aTextColor, aFontFamily, isBold, isItalic, isShadow);
365
366   // "Labels"
367   isBold = isItalic = isShadow = false;
368   aFontFamily = VTK_ARIAL;
369
370   if ( aResourceMgr->hasValue( "VISU", "scalar_bar_label_font" ) )
371     {
372       QFont f = aResourceMgr->fontValue( "VISU", "scalar_bar_label_font" );
373       
374       if ( f.family() == "Arial" )
375         aFontFamily = VTK_ARIAL;
376       else if ( f.family() == "Courier" )
377         aFontFamily = VTK_COURIER;
378       else if ( f.family() == "Times" )
379         aFontFamily = VTK_TIMES;
380       
381       isBold = f.bold();
382       isItalic = f.italic();
383       isShadow =  f.underline();
384     }
385   
386   aTextColor = aResourceMgr->colorValue( "VISU", "scalar_bar_label_color", QColor( 255, 255, 255 ) );
387   
388   myTextDlg->myLabelFont->SetData(aTextColor, aFontFamily, isBold, isItalic, isShadow);
389 }
390
391 /**
392  * Stores dialog values to resources
393  */
394 void VisuGUI_ScalarBarPane::storeToResources() {
395   int orient = (RBvert->isChecked())? 0 : 1;
396   float sbX1   = XSpin->value();
397   float sbY1   = YSpin->value();
398   float sbW    = WidthSpin->value();
399   float sbH    = HeightSpin->value();
400   int sbCol  = ColorSpin->value();
401   int sbLab  = LabelSpin->value();
402
403   if((sbX1 < 0.) || (sbY1 < 0.) || ((sbX1+sbW) > 1.) || ((sbY1+sbH) > 1.)) {
404     if(orient == 0) {
405       sbX1=0.01;
406       sbY1=0.1;
407       sbW=0.17;
408       sbH=0.8;
409     } else {
410       sbX1=0.2;
411       sbY1=0.01;
412       sbW=0.6;
413       sbH=0.12;
414     }
415   }
416
417   bool sbRange = RBIrange->isChecked();
418   float sbVmin = (float)(MinEdit->text().toDouble());
419   float sbVmax = (float)(MaxEdit->text().toDouble());
420
421   if(sbVmin > sbVmax) {
422     sbVmin=0.;
423     sbVmax=0.;
424   }
425
426   SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
427
428   aResourceMgr->setValue("VISU", "scalar_bar_orientation", orient);
429
430   QString propertyName = QString( "scalar_bar_%1_" ).arg( orient == 0 ? "vertical" : "horizontal" );
431
432   aResourceMgr->setValue("VISU", propertyName + "x", sbX1);
433   aResourceMgr->setValue("VISU", propertyName + "y", sbY1);
434   aResourceMgr->setValue("VISU", propertyName + "width", sbW);
435   aResourceMgr->setValue("VISU", propertyName + "height", sbH);
436
437   aResourceMgr->setValue("VISU", "scalar_bar_num_colors", sbCol);
438   aResourceMgr->setValue("VISU", "scalar_bar_num_labels", sbLab);
439
440   if(sbRange)
441     {
442       aResourceMgr->setValue("VISU", "scalar_range_type", 1);
443       aResourceMgr->setValue("VISU", "scalar_range_min" ,sbVmin);
444       aResourceMgr->setValue("VISU", "scalar_range_max" ,sbVmax);
445     }
446   else
447     aResourceMgr->setValue("VISU", "scalar_range_type", 0);
448   
449   aResourceMgr->setValue("VISU", "scalar_bar_logarithmic", isLogarithmic());
450  
451   ////
452
453   if (myIsStoreTextProp) {
454     // "Title"
455     QColor aTitleColor (255, 255, 255);
456     int aTitleFontFamily = VTK_ARIAL;
457     bool isTitleBold = false;
458     bool isTitleItalic = false;
459     bool isTitleShadow = false;
460
461     myTextDlg->myTitleFont->GetData(aTitleColor, aTitleFontFamily,
462                                     isTitleBold, isTitleItalic, isTitleShadow);
463
464     QFont aTitleFont;
465     
466     aTitleFont.setBold(isTitleBold);
467     aTitleFont.setItalic(isTitleItalic);
468     aTitleFont.setUnderline(isTitleShadow);
469     
470     QString titleFontFamily;
471     switch (aTitleFontFamily) {
472     case VTK_ARIAL:
473       titleFontFamily = "Arial";
474       break;
475     case VTK_COURIER:
476       titleFontFamily = "Courier";
477       break;
478     case VTK_TIMES:
479       titleFontFamily = "Times";
480       break;
481     }
482     aTitleFont.setFamily(titleFontFamily);
483     
484     aResourceMgr->setValue("VISU", "scalar_bar_title_font", aTitleFont);
485     
486     aResourceMgr->setValue("VISU", "scalar_bar_title_color", aTitleColor);
487     
488     // "Label"
489     QColor aLabelColor (255, 255, 255);
490     int aLabelFontFamily = VTK_ARIAL;
491     bool isLabelBold = false;
492     bool isLabelItalic = false;
493     bool isLabelShadow = false;
494
495     myTextDlg->myLabelFont->GetData(aLabelColor, aLabelFontFamily,
496                                     isLabelBold, isLabelItalic, isLabelShadow);
497
498
499     QFont aLabelFont;
500     
501     aLabelFont.setBold(isLabelBold);
502     aLabelFont.setItalic(isLabelItalic);
503     aLabelFont.setUnderline(isLabelShadow);
504
505     QString labelFontFamily;
506     switch (aLabelFontFamily) {
507     case VTK_ARIAL:
508       labelFontFamily = "Arial";
509       break;
510     case VTK_COURIER:
511       labelFontFamily = "Courier";
512       break;
513     case VTK_TIMES:
514       labelFontFamily = "Times";
515       break;
516     }
517
518     aLabelFont.setFamily(labelFontFamily);
519     
520     aResourceMgr->setValue("VISU", "scalar_bar_label_font", aLabelFont);
521
522     aResourceMgr->setValue("VISU", "scalar_bar_label_color", aLabelColor);
523   }
524 }
525
526 /**
527  * Initialise dialog box from presentation object
528  */
529 void VisuGUI_ScalarBarPane::initFromPrsObject(VISU::ScalarMap_i* thePrs) {
530   initFromResources();
531   myScalarMap = thePrs;
532   myModeCombo->setCurrentItem(thePrs->GetScalarMode());
533   setPosAndSize( thePrs->GetPosX(),
534                  thePrs->GetPosY(),
535                  thePrs->GetWidth(),
536                  thePrs->GetHeight(),
537                  thePrs->GetBarOrientation());
538   switch(thePrs->GetScaling()){
539   case VISU::LOGARITHMIC :
540     setLogarithmic(true);
541     break;
542   default:
543     setLogarithmic(false);
544   }
545   float aRange[2];
546   thePrs->GetScalarMapPL()->GetSourceRange(aRange);
547   Rmin = aRange[0]; Rmax = aRange[1];
548   setRange( thePrs->GetMin(), thePrs->GetMax(),
549             /*0.0, 0.0,*/ thePrs->IsRangeFixed() );
550   setScalarBarData( thePrs->GetNbColors(), thePrs->GetLabels() );
551   bool isScalarMode = (thePrs->GetField()->myNbComp > 1);
552   myModeLbl->setEnabled(isScalarMode);
553   myModeCombo->setEnabled(isScalarMode);
554
555   // "Title"
556   myTextDlg->setTitleText(QString(thePrs->GetTitle()));
557
558   float R, G, B;
559   thePrs->GetTitleColor(&R, &G, &B);
560
561   myTextDlg->myTitleFont->SetData(QColor((int)(R*255.), (int)(G*255.), (int)(B*255.)),
562                                   thePrs->GetTitFontType(),
563                                   thePrs->IsBoldTitle(),
564                                   thePrs->IsItalicTitle(),
565                                   thePrs->IsShadowTitle());
566
567   // "Labels"
568   thePrs->GetLabelColor(&R, &G, &B);
569
570   myTextDlg->myLabelFont->SetData(QColor((int)(R*255.), (int)(G*255.), (int)(B*255.)),
571                                   thePrs->GetLblFontType(),
572                                   thePrs->IsBoldLabel(),
573                                   thePrs->IsItalicLabel(),
574                                   thePrs->IsShadowLabel());
575
576   // Draw Preview
577   if (myPreviewCheck->isChecked()) {
578     createScalarBar();
579     updatePreview();
580   }
581
582 }
583 /*! Slot update preview of scalar bar, if preview is checked
584  */
585 void VisuGUI_ScalarBarPane::updatePreview()
586 {
587   if (myPreviewCheck->isChecked()) {
588     if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) {
589       deleteScalarBar();
590       createScalarBar();
591       vf->Repaint();
592     }
593   }
594 }
595
596 /*! Creating preview scalar bar
597  */
598 void VisuGUI_ScalarBarPane::createScalarBar()
599 {
600   if (VISU::GetViewWindow() == NULL) return;
601   if (myPreviewActor != 0) return;
602   if (myScalarMap == NULL) return;
603
604   int sbCol,sbLab;
605   sbCol = getNbColors();
606   sbLab = getNbLabels();
607   if(sbCol < 2) sbCol=2;
608   if(sbCol > 64) sbCol=64;
609   if(sbLab < 2) sbLab=2;
610   if(sbLab > 65) sbLab=65;
611   myPreviewActor = VISU_ScalarMapAct::New();
612   VISU_ScalarBarActor* aScalarBarActor = myPreviewActor->GetScalarBar();
613   myPreviewActor->GetScalarBar()->VisibilityOn();
614   myPreviewActor->PickableOff();
615   
616   myScalarMap->SetScalarMode(myModeCombo->currentItem());
617   myScalarMap->SetPosition(getX(),getY());
618   myScalarMap->SetSize(getWidth(),getHeight());
619   myScalarMap->SetBarOrientation((RBvert->isChecked())? VISU::ScalarMap::VERTICAL : VISU::ScalarMap::HORIZONTAL);
620   if(isLogarithmic())
621     myScalarMap->SetScaling(VISU::LOGARITHMIC);
622   else
623     myScalarMap->SetScaling(VISU::LINEAR);
624   if (RBFrange->isChecked()) {
625     myScalarMap->SetSourceRange();
626   } else {
627     myScalarMap->SetRange(MinEdit->text().toDouble(), MaxEdit->text().toDouble());
628   }
629   myScalarMap->SetNbColors(sbCol);
630   myScalarMap->SetLabels(sbLab); 
631   
632   myScalarMap->GetScalarMapPL()->SetNbColors(sbCol);
633   myScalarMap->GetScalarMapPL()->Update();
634     
635   aScalarBarActor->SetLookupTable(myScalarMap->GetScalarMapPL()->GetBarTable());
636   
637   if (myTextDlg->getTitleText().latin1() != "") 
638     aScalarBarActor->SetTitle(myTextDlg->getTitleText().latin1());
639   else
640     aScalarBarActor->SetTitle(myScalarMap->GetTitle());
641   aScalarBarActor->SetOrientation(getOrientation());
642   aScalarBarActor->GetPositionCoordinate()->SetCoordinateSystemToNormalizedViewport();
643   aScalarBarActor->GetPositionCoordinate()->SetValue(getX(),getY());
644   aScalarBarActor->SetWidth(getWidth());
645   aScalarBarActor->SetHeight(getHeight());
646   aScalarBarActor->SetNumberOfLabels(sbLab);
647   aScalarBarActor->SetMaximumNumberOfColors(sbCol);
648
649   // title text property
650   QColor aTitleColor;
651   int aTitleFontFamily;
652   bool isTitleBold;
653   bool isTitleItalic;
654   bool isTitleShadow;
655   myTextDlg->myTitleFont->GetData(aTitleColor,aTitleFontFamily,
656                                   isTitleBold,isTitleItalic,isTitleShadow);
657   vtkTextProperty* aTitleProp = aScalarBarActor->GetTitleTextProperty();
658   aTitleProp->SetFontFamily(aTitleFontFamily);
659   aTitleProp->SetColor(float(aTitleColor.red())/255.,
660                        float(aTitleColor.green())/255.,
661                        float(aTitleColor.blue())/255.);
662   (isTitleBold)? aTitleProp->BoldOn() : aTitleProp->BoldOff();
663   (isTitleItalic)? aTitleProp->ItalicOn() : aTitleProp->ItalicOff();
664   (isTitleShadow)? aTitleProp->ShadowOn() : aTitleProp->ShadowOff();
665   
666   // label text property
667   QColor aLabelColor;
668   int aLabelFontFamily;
669   bool isLabelBold;
670   bool isLabelItalic;
671   bool isLabelShadow;
672   myTextDlg->myLabelFont->GetData(aLabelColor, aLabelFontFamily,
673                                   isLabelBold, isLabelItalic, isLabelShadow);
674   vtkTextProperty* aLabelProp = aScalarBarActor->GetLabelTextProperty();
675   aLabelProp->SetFontFamily(aLabelFontFamily);
676   aLabelProp->SetColor(float(aLabelColor.red())/255.,
677                        float(aLabelColor.green())/255.,
678                        float(aLabelColor.blue())/255.);
679   (isLabelBold)? aLabelProp->BoldOn() : aLabelProp->BoldOff();
680   (isLabelItalic)? aLabelProp->ItalicOn() : aLabelProp->ItalicOff();
681   (isLabelShadow)? aLabelProp->ShadowOn() : aLabelProp->ShadowOff();
682
683   aScalarBarActor->Modified();
684
685   VISU::GetViewWindow()->AddActor(myPreviewActor);
686 }
687 /*! Deleting preview scalar bar
688  */
689 void VisuGUI_ScalarBarPane::deleteScalarBar()
690 {
691   if (myPreviewActor == 0) return;
692   if (SVTK_ViewWindow* vf = VISU::GetViewWindow()){
693     vf->RemoveActor(myPreviewActor);
694     myPreviewActor->GetScalarBar()->VisibilityOff();
695   }
696   myPreviewActor->Delete();
697   myPreviewActor = 0;
698 }
699 /*! public: Deleting preview scalar bar
700  */
701 void VisuGUI_ScalarBarPane::deletePreview()
702 {
703   deleteScalarBar();
704 }
705 /**
706  * Store values to presentation object
707  */
708 int VisuGUI_ScalarBarPane::storeToPrsObject(VISU::ScalarMap_i* thePrs) {
709   thePrs->SetScalarMode(myModeCombo->currentItem());
710   thePrs->SetPosition(XSpin->value(), YSpin->value());
711   thePrs->SetSize(WidthSpin->value(), HeightSpin->value());
712   thePrs->SetBarOrientation((RBvert->isChecked())? VISU::ScalarMap::VERTICAL : VISU::ScalarMap::HORIZONTAL);
713   if(isLogarithmic())
714     thePrs->SetScaling(VISU::LOGARITHMIC);
715   else
716     thePrs->SetScaling(VISU::LINEAR);
717
718   if (RBFrange->isChecked()) {
719     thePrs->SetSourceRange();
720   } else {
721     thePrs->SetRange(MinEdit->text().toDouble(), MaxEdit->text().toDouble());
722   }
723   thePrs->SetNbColors(ColorSpin->value());
724   thePrs->SetLabels(LabelSpin->value());
725
726   if (isToSave()) storeToResources();
727
728   if (myIsStoreTextProp) {
729     // "Title"
730     thePrs->SetTitle(myTextDlg->getTitleText().latin1());
731
732     QColor aTitColor (255, 255, 255);
733     int aTitleFontFamily = VTK_ARIAL;
734     bool isTitleBold = false;
735     bool isTitleItalic = false;
736     bool isTitleShadow = false;
737
738     myTextDlg->myTitleFont->GetData(aTitColor, aTitleFontFamily,
739                                     isTitleBold, isTitleItalic, isTitleShadow);
740
741     thePrs->SetBoldTitle(isTitleBold);
742     thePrs->SetItalicTitle(isTitleItalic);
743     thePrs->SetShadowTitle(isTitleShadow);
744     thePrs->SetTitFontType(aTitleFontFamily);
745     thePrs->SetTitleColor(aTitColor.red()/255.,
746                           aTitColor.green()/255.,
747                           aTitColor.blue()/255.);
748
749     // "Label"
750     QColor aLblColor (255, 255, 255);
751     int aLabelFontFamily = VTK_ARIAL;
752     bool isLabelBold = false;
753     bool isLabelItalic = false;
754     bool isLabelShadow = false;
755
756     myTextDlg->myLabelFont->GetData(aLblColor, aLabelFontFamily,
757                                     isLabelBold, isLabelItalic, isLabelShadow);
758
759     thePrs->SetBoldLabel(isLabelBold);
760     thePrs->SetItalicLabel(isLabelItalic);
761     thePrs->SetShadowLabel(isLabelShadow);
762     thePrs->SetLblFontType(aLabelFontFamily);
763     thePrs->SetLabelColor(aLblColor.red()/255.,
764                           aLblColor.green()/255.,
765                           aLblColor.blue()/255.);
766   }
767
768   return 1;
769 }
770
771 /*!
772   Called when orientation is changed
773 */
774 void VisuGUI_ScalarBarPane::changeDefaults( int )
775 {
776   if ( RBvert->isChecked() ) {
777     XSpin->setValue( myVerX );
778     YSpin->setValue( myVerY );
779     WidthSpin->setValue( myVerW );
780     HeightSpin->setValue( myVerH );
781   }
782   else {
783     XSpin->setValue( myHorX );
784     YSpin->setValue( myHorY );
785     WidthSpin->setValue( myHorW );
786     HeightSpin->setValue( myHorH );
787   }
788   updatePreview();
789 }
790
791 /*!
792   Called when Range mode is changed
793 */
794 void VisuGUI_ScalarBarPane::changeRange( int )
795 {
796   int mode = -1;
797   if ( RBFrange->isChecked() )
798     mode = 0;
799   if ( RBIrange->isChecked() )
800     mode = 1;
801   if ( myRangeMode == mode )
802     return;
803   //MinSpin->setMaxValue( Fmin );
804   //MaxSpin->setMinValue( Fmax );
805   if ( RBFrange->isChecked() ) {
806     //MinLabel->setEnabled( false );
807     MinEdit->setEnabled( false );
808     //MaxLabel->setEnabled( false );
809     MaxEdit->setEnabled( false );
810     if ( mode != -1 ) {
811       Imin = MinEdit->text().toDouble();
812       Imax = MaxEdit->text().toDouble();
813     }
814     MinEdit->setText( QString::number( Rmin ) );
815     MaxEdit->setText( QString::number( Rmax ) );
816   }
817   else {
818     //MinLabel->setEnabled( true );
819     MinEdit->setEnabled( true );
820     //MaxLabel->setEnabled( true );
821     MaxEdit->setEnabled( true );
822     MinEdit->setText( QString::number( Imin ) );
823     MaxEdit->setText( QString::number( Imax ) );
824   }
825   myRangeMode = mode;
826   updatePreview();
827 }
828
829 /*!
830   Called when X,Y position is changed
831 */
832 void VisuGUI_ScalarBarPane::XYChanged( double )
833 {
834   QtxDblSpinBox* snd = (QtxDblSpinBox*)sender();
835   if ( snd == XSpin ) {
836     WidthSpin->setMaxValue( 1.0 - XSpin->value() );
837   }
838   if ( snd == YSpin ) {
839     HeightSpin->setMaxValue( 1.0 - YSpin->value() );
840   }
841   updatePreview();
842 }
843
844 /*!
845   Sets default values and range mode
846 */
847 void VisuGUI_ScalarBarPane::setRange( double imin, double imax/*, double fmin, double fmax*/, bool sbRange )
848 {
849   Imin = imin; Imax = imax;// Fmin = fmin; Fmax = fmax;
850   if ( RBIrange->isChecked() ) {
851     MinEdit->setText( QString::number( Imin ) );
852     MaxEdit->setText( QString::number( Imax ) );
853   }
854   else {
855     MinEdit->setText( QString::number( Rmin ) );
856     MaxEdit->setText( QString::number( Rmax ) );
857   }
858   myRangeMode = -1;
859   if( sbRange )
860     RBIrange->setChecked( true );
861   else
862     RBFrange->setChecked( true );
863   changeRange( 0 );
864 }
865
866 /*!
867   Sets size and position
868 */
869 void VisuGUI_ScalarBarPane::setPosAndSize( double x, double y, double w, double h, bool vert )
870 {
871   if ( vert ) {
872     myVerX = x;
873     myVerY = y;
874     myVerW = w;
875     myVerH = h;
876     RBvert->setChecked( true );
877   }
878   else {
879     myHorX = x;
880     myHorY = y;
881     myHorW = w;
882     myHorH = h;
883     RBhori->setChecked( true );
884   }
885   changeDefaults( 0 );
886 }
887
888 /*!
889   Sets colors and labels number
890 */
891 void VisuGUI_ScalarBarPane::setScalarBarData( int colors, int labels )
892 {
893   ColorSpin->setValue( colors );
894   LabelSpin->setValue( labels );
895 }
896
897 /*!
898   Gets orientation
899 */
900 int  VisuGUI_ScalarBarPane::getOrientation()
901 {
902   if (RBvert->isChecked() )
903     return  1;
904   else
905     return 0;
906 }
907
908 /*!
909   Called when <OK> button is clicked, validates data and closes dialog
910 */
911 bool VisuGUI_ScalarBarPane::check()
912 {
913   double minVal = MinEdit->text().toDouble();
914   double maxVal = MaxEdit->text().toDouble();
915   if ( RBIrange->isChecked() ) {
916     if (minVal >= maxVal) {
917       SUIT_MessageBox::warn1( this,tr("WRN_VISU"),
918                              tr("MSG_MINMAX_VALUES"),
919                              tr("BUT_OK"));
920       return false;
921     }
922   }
923   // check if logarithmic mode is on and check imposed range to not contain negative values
924   if ( CBLog->isChecked() ) {
925     if ( RBIrange->isChecked() ) {
926       if ( (minVal > 0) && (maxVal > 0) ) {
927         // nothing to do
928       }
929       else {
930         SUIT_MessageBox::warn1( this,
931                                 tr("WRN_VISU"),
932                                 tr("WRN_LOGARITHMIC_RANGE"),
933                                 tr("BUT_OK"));
934         return false;
935       }
936     }
937     else {
938       if ( Rmin > 0 && Rmax > 0 ) {
939         // nothing to do
940       }
941       else {
942         SUIT_MessageBox::warn1( this,
943                                 tr("WRN_VISU"),
944                                 tr("WRN_LOGARITHMIC_FIELD_RANGE"),
945                                 tr("BUT_OK"));
946         RBIrange->setChecked(1);
947         changeRange(1);
948         //MinEdit->setText( QString::number( Rmin ) );
949         //MaxEdit->setText( QString::number( Rmax ) );
950         return false;
951       }
952     }
953   }
954   return true;
955 }
956
957 void VisuGUI_ScalarBarPane::onTextPref()
958 {
959   myIsStoreTextProp = myTextDlg->exec();
960   updatePreview();
961 }
962
963 void VisuGUI_ScalarBarPane::onPreviewCheck (bool thePreview)
964 {
965   if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) {
966     if (thePreview) {
967       createScalarBar();
968     } else {
969       deleteScalarBar();
970     }
971     vf->Repaint();
972   }
973 }
974
975 //#######################################################################################
976
977 /*!
978   Constructor
979 */
980 VisuGUI_ScalarBarDlg::VisuGUI_ScalarBarDlg (SalomeApp_Module* theModule, bool SetPref)
981     : QDialog(VISU::GetDesktop(theModule), 0, true,
982               WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
983 {
984   setName("VisuGUI_ScalarBarDlg");
985   setCaption(SetPref ? tr("DLG_PREF_TITLE") : tr("DLG_PROP_TITLE"));
986   setSizeGripEnabled(TRUE);
987
988   QVBoxLayout* TopLayout = new QVBoxLayout(this);
989   TopLayout->setSpacing(6);
990   TopLayout->setMargin(11);
991
992   myScalarPane = new VisuGUI_ScalarBarPane(this, SetPref);
993   TopLayout->addWidget(myScalarPane);
994
995   // Common buttons ===========================================================
996   QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
997   GroupButtons->setColumnLayout(0, Qt::Vertical );
998   GroupButtons->layout()->setSpacing( 0 );
999   GroupButtons->layout()->setMargin( 0 );
1000   QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
1001   GroupButtonsLayout->setAlignment( Qt::AlignTop );
1002   GroupButtonsLayout->setSpacing( 6 );
1003   GroupButtonsLayout->setMargin( 11 );
1004
1005   QPushButton* buttonOk = new QPushButton( tr( "&OK" ), GroupButtons, "buttonOk" );
1006   buttonOk->setAutoDefault( TRUE );
1007   buttonOk->setDefault( TRUE );
1008   GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
1009   GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
1010
1011   QPushButton* buttonCancel = new QPushButton( tr( "&Cancel" ) , GroupButtons, "buttonCancel" );
1012   buttonCancel->setAutoDefault( TRUE );
1013   GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
1014
1015   TopLayout->addWidget( GroupButtons );
1016
1017   connect( buttonOk,     SIGNAL( clicked() ), this, SLOT( accept() ) );
1018   connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
1019 }
1020
1021 /*!
1022   Called when <OK> button is clicked, validates data and closes dialog
1023 */
1024 void VisuGUI_ScalarBarDlg::accept()
1025 {
1026   myScalarPane->deletePreview();
1027   if (myScalarPane->check()) QDialog::accept();
1028 }
1029
1030 /*!
1031   Called when <Cancel> button is clicked, remove preview and closes dialog
1032 */
1033 void VisuGUI_ScalarBarDlg::reject()
1034 {
1035   myScalarPane->deletePreview();
1036   QDialog::reject();
1037 }
1038
1039
1040 //#######################################################################################
1041 VisuGUI_TextPrefDlg::VisuGUI_TextPrefDlg (QWidget* parent)
1042   : QDialog(parent, 0, true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
1043 {
1044   setName("VisuGUI_TextPrefDlg");
1045   setCaption(tr("TIT_TEXT_PREF"));
1046   setSizeGripEnabled(TRUE);
1047
1048   QVBoxLayout* TopLayout = new QVBoxLayout(this);
1049   TopLayout->setSpacing(6);
1050   TopLayout->setMargin(11);
1051
1052   // "Title" grp
1053   QGroupBox* aTitleGrp = new QGroupBox (2, Qt::Vertical, tr("LBL_TITLE"), this);
1054
1055   //   edit line
1056   myTitleEdt = new QLineEdit (aTitleGrp);
1057
1058   //   font
1059   QHBox* aHBox = new QHBox (aTitleGrp);
1060   aHBox->setSpacing(5);
1061   myTitleFont = new VisuGUI_FontWg (aHBox);
1062
1063   TopLayout->addWidget(aTitleGrp);
1064
1065   // "Labels" grp
1066   QGroupBox* aLabelsGrp = new QGroupBox (1, Qt::Vertical, tr("LBL_LABELS"), this);
1067
1068   //   font
1069   aHBox = new QHBox (aLabelsGrp);
1070   aHBox->setSpacing(5);
1071   myLabelFont = new VisuGUI_FontWg (aHBox);
1072
1073   TopLayout->addWidget(aLabelsGrp);
1074
1075   // Common buttons ===========================================================
1076   QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
1077   GroupButtons->setColumnLayout(0, Qt::Vertical );
1078   GroupButtons->layout()->setSpacing( 0 );
1079   GroupButtons->layout()->setMargin( 0 );
1080   QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
1081   GroupButtonsLayout->setAlignment( Qt::AlignTop );
1082   GroupButtonsLayout->setSpacing( 6 );
1083   GroupButtonsLayout->setMargin( 11 );
1084
1085   QPushButton* buttonOk = new QPushButton( tr( "&OK" ), GroupButtons, "buttonOk" );
1086   buttonOk->setAutoDefault( TRUE );
1087   buttonOk->setDefault( TRUE );
1088   GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
1089   GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
1090
1091   QPushButton* buttonCancel = new QPushButton( tr( "&Cancel" ) , GroupButtons, "buttonCancel" );
1092   buttonCancel->setAutoDefault( TRUE );
1093   GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
1094
1095   TopLayout->addWidget( GroupButtons );
1096
1097   connect(buttonOk,     SIGNAL(clicked()), this, SLOT(accept()));
1098   connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
1099 }