#include "VisuGUI_Tools.h"
#include "VisuGUI_FontWg.h"
+#include "SVTK_ViewWindow.h"
+
#include "VISUConfig.hh"
#include "VISU_Convertor.hxx"
#include "VISU_ScalarMapPL.hxx"
#include "VISU_ScalarMap_i.hh"
+#include "VISU_ScalarMapAct.h"
#include "SalomeApp_Application.h"
#include <qvalidator.h>
#include <qcolordialog.h>
+#include <vtkTextProperty.h>
+
using namespace std;
VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane (QWidget * parent, bool SetPref):
- QVBox(parent)
+ QVBox(parent), myPreviewActor(0)
{
myVerX = 0.01; myVerY = 0.10; myVerW = 0.10; myVerH = 0.80;
myHorX = 0.20; myHorY = 0.01; myHorW = 0.60; myHorH = 0.12;
myTextDlg = new VisuGUI_TextPrefDlg(this);
myTextDlg->setTitleVisible(!SetPref);
+ QGroupBox* CheckGroup = new QGroupBox("", this, "CheckGroup");
+ CheckGroup->setColumnLayout(0, Qt::Vertical );
+ CheckGroup->layout()->setSpacing( 0 );
+ CheckGroup->layout()->setMargin( 0 );
+ QGridLayout* CheckGroupLayout = new QGridLayout( CheckGroup->layout() );
+
+ myPreviewCheck = new QCheckBox(tr("LBL_SHOW_PREVIEW"), this);
+ myPreviewCheck->setChecked(false);
+ CheckGroupLayout->addWidget(myPreviewCheck , 0, 0 );
+
// signals and slots connections ===========================================
connect( RangeGroup, SIGNAL( clicked( int ) ), this, SLOT( changeRange( int ) ) );
connect( OrientGroup, SIGNAL( clicked( int ) ), this, SLOT( changeDefaults( int ) ) );
connect( XSpin, SIGNAL( valueChanged( double ) ), this, SLOT( XYChanged( double ) ) );
connect( YSpin, SIGNAL( valueChanged( double ) ), this, SLOT( XYChanged( double ) ) );
connect( myTextBtn, SIGNAL( clicked() ), this, SLOT( onTextPref() ) );
-
+ connect( myPreviewCheck, SIGNAL( toggled( bool )), this, SLOT( onPreviewCheck( bool ) ) );
+ connect( ColorSpin, SIGNAL( valueChanged( int ) ), this, SLOT( updatePreview() ));
+ connect( LabelSpin, SIGNAL( valueChanged( int ) ), this, SLOT( updatePreview() ));
+ connect( WidthSpin, SIGNAL( valueChanged( double ) ), this, SLOT( updatePreview() ));
+ connect( HeightSpin, SIGNAL( valueChanged( double ) ), this, SLOT( updatePreview() ));
+ connect( CBLog, SIGNAL( toggled( bool ) ), this, SLOT( updatePreview() ));
changeRange( 0 );
changeDefaults( 0 );
myIsStoreTextProp = false;
* Initializes dialog box values from resources
*/
void VisuGUI_ScalarBarPane::initFromResources() {
- int sbCol=64,sbLab=5,orient=1;
+ int sbCol=64,sbLab=5,orient=0;
float sbX1=0.01,sbY1=0.1,sbW=0.1,sbH=0.8;
float sbVmin=0., sbVmax=0.;
bool sbRange=false;
SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
- orient = aResourceMgr->integerValue("Visu:SBOrientation",orient);
- if(orient != 1){
- orient=0;
+ int aScalarMode = aResourceMgr->integerValue("VISU", "scalar_bar_mode", 0);
+ myModeCombo->setCurrentItem(aScalarMode);
+
+ orient = aResourceMgr->integerValue("VISU", "scalar_bar_orientation", orient);
+ if(orient != 0){
+ orient=1;
sbX1=0.2;
sbY1=0.01;
sbW=0.6;
sbH=0.12;
}
-
- sbX1 = aResourceMgr->doubleValue("Visu:SBXorigin",sbX1);
- sbY1 = aResourceMgr->doubleValue("Visu:SBYorigin",sbY1);
-
- sbW = aResourceMgr->doubleValue("Visu:SBWidth",sbW);
- sbH = aResourceMgr->doubleValue("Visu:SBHeight",sbH);
-
- sbCol = aResourceMgr->integerValue("Visu:SBNumberOfColors",sbCol);
- sbLab = aResourceMgr->integerValue("Visu:SBNumberOfLabels",sbLab);
- sbRange = aResourceMgr->booleanValue("Visu:SBImposeRange",sbRange);
- sbVmin = aResourceMgr->doubleValue("Visu:SBMinimumValue",sbVmin);
- sbVmax = aResourceMgr->doubleValue("Visu:SBMaximumValue",sbVmax);
-
- QString aScaling = aResourceMgr->stringValue("Visu:SBMaximumValue","LINEAR");
- if(aScaling.compare("LOGARITHMIC") == 0)
- setLogarithmic(true);
- else
- setLogarithmic(false);
-
+
+ QString propertyName = QString( "scalar_bar_%1_" ).arg( orient == 0 ? "vertical" : "horizontal" );
+
+ sbX1 = aResourceMgr->doubleValue("VISU", propertyName + "x", sbX1);
+ sbY1 = aResourceMgr->doubleValue("VISU", propertyName + "y", sbY1);
+
+ sbW = aResourceMgr->doubleValue("VISU", propertyName + "width", sbW);
+ sbH = aResourceMgr->doubleValue("VISU", propertyName + "height",sbH);
+
+ sbCol = aResourceMgr->integerValue("VISU" ,"scalar_bar_num_colors", sbCol);
+ sbLab = aResourceMgr->integerValue("VISU", "scalar_bar_num_labels", sbLab);
+
+ int rangeType = aResourceMgr->integerValue("VISU" , "scalar_range_type", 0);
+ if (rangeType == 1) sbRange = true;
+ sbVmin = aResourceMgr->doubleValue("VISU", "scalar_range_min", sbVmin);
+ sbVmax = aResourceMgr->doubleValue("VISU", "scalar_range_max", sbVmax);
+
+ bool isLog = aResourceMgr->booleanValue("VISU", "scalar_bar_logarithmic", false);
+ setLogarithmic(isLog);
+
if((sbX1 < 0.) || (sbY1 < 0.) ||
((sbX1+sbW) > 1.) || ((sbY1+sbH) > 1.)) {
- if(orient == 1) {
+ if(orient == 0) {
sbX1=0.01;
sbY1=0.1;
sbW=0.1;
}
setRange( sbVmin, sbVmax, /*0.0, 0.0,*/ sbRange );
- setPosAndSize( sbX1, sbY1, sbW, sbH, orient == 1);
+ setPosAndSize( sbX1, sbY1, sbW, sbH, orient == 0);
setScalarBarData( sbCol, sbLab );
// "Title"
- aString = aResourceMgr->stringValue("Visu:IsBoldTitle","true");
- bool isBold = (aString.compare("true") == 0);
- aString = aResourceMgr->stringValue("Visu:IsItalicTitle","true");
- bool isItalic = (aString.compare("true") == 0);
- aString = aResourceMgr->stringValue("Visu:IsShadowTitle","true");
- bool isShadow = (aString.compare("true") == 0);
-
- int aFontType = aResourceMgr->integerValue("Visu:TitFontType",0);
+ bool isBold = false, isItalic = false, isShadow = false;
int aFontFamily = VTK_ARIAL;
- switch (aFontType) {
- case 0:
- aFontFamily = VTK_ARIAL; break;
- case 1:
- aFontFamily = VTK_COURIER; break;
- case 2:
- aFontFamily = VTK_TIMES; break;
- }
-
- float R = aResourceMgr->doubleValue("Visu:TitleColorR",1.0);
- if (R > 1) R = 1;
- if (R < 0) R = 0;
- float G = aResourceMgr->doubleValue("Visu:TitleColorG",1.0);
- if (G > 1) G = 1;
- if (G < 0) G = 0;
-
- float B = aResourceMgr->doubleValue("Visu:TitleColorB",1.0);
- if (B > 1) B = 1;
- if (B < 0) B = 0;
-
- myTextDlg->myTitleFont->SetData(QColor((int)(R*255.), (int)(G*255.), (int)(B*255.)),
- aFontFamily,
- isBold, isItalic, isShadow);
+ if ( aResourceMgr->hasValue( "VISU", "scalar_bar_title_font" ) )
+ {
+ QFont f = aResourceMgr->fontValue( "VISU", "scalar_bar_title_font" );
+
+ if ( f.family() == "Arial" )
+ aFontFamily = VTK_ARIAL;
+ else if ( f.family() == "Courier" )
+ aFontFamily = VTK_COURIER;
+ else if ( f.family() == "Times" )
+ aFontFamily = VTK_TIMES;
+
+ isBold = f.bold();
+ isItalic = f.italic();
+ isShadow = f.underline();
+ }
+
+ QColor aTextColor = aResourceMgr->colorValue( "VISU", "scalar_bar_title_color", QColor( 255, 255, 255 ) );
+
+ myTextDlg->myTitleFont->SetData(aTextColor, aFontFamily, isBold, isItalic, isShadow);
// "Labels"
- aString = aResourceMgr->stringValue("Visu:IsBoldLabel","true");
- isBold = (aString.compare("true") == 0);
- aString = aResourceMgr->stringValue("Visu:IsItalicLabel","true");
- isItalic = (aString.compare("true") == 0);
- aString = aResourceMgr->stringValue("Visu:IsShadowLabel","true");
- isShadow = (aString.compare("true") == 0);
-
- aFontType = aResourceMgr->integerValue("Visu:LblFontType",0);
+ isBold = isItalic = isShadow = false;
aFontFamily = VTK_ARIAL;
- switch (aFontType) {
- case 0:
- aFontFamily = VTK_ARIAL; break;
- case 1:
- aFontFamily = VTK_COURIER; break;
- case 2:
- aFontFamily = VTK_TIMES; break;
- }
- R = aResourceMgr->doubleValue("Visu:LabelColorR",1.0);
- if (R > 1) R = 1;
- if (R < 0) R = 0;
-
- G = aResourceMgr->doubleValue("Visu:LabelColorG",1.0);
- if (G > 1) G = 1;
- if (G < 0) G = 0;
-
- B = aResourceMgr->doubleValue("Visu:LabelColorB",1.0);
- if (B > 1) B = 1;
- if (B < 0) B = 0;
-
- myTextDlg->myLabelFont->SetData(QColor((int)(R*255.), (int)(G*255.), (int)(B*255.)),
- aFontFamily,
- isBold, isItalic, isShadow);
+ if ( aResourceMgr->hasValue( "VISU", "scalar_bar_label_font" ) )
+ {
+ QFont f = aResourceMgr->fontValue( "VISU", "scalar_bar_label_font" );
+
+ if ( f.family() == "Arial" )
+ aFontFamily = VTK_ARIAL;
+ else if ( f.family() == "Courier" )
+ aFontFamily = VTK_COURIER;
+ else if ( f.family() == "Times" )
+ aFontFamily = VTK_TIMES;
+
+ isBold = f.bold();
+ isItalic = f.italic();
+ isShadow = f.underline();
+ }
+
+ aTextColor = aResourceMgr->colorValue( "VISU", "scalar_bar_label_color", QColor( 255, 255, 255 ) );
+
+ myTextDlg->myLabelFont->SetData(aTextColor, aFontFamily, isBold, isItalic, isShadow);
}
/**
* Stores dialog values to resources
*/
void VisuGUI_ScalarBarPane::storeToResources() {
- int orient = (RBvert->isChecked())? 1 : 0;
+ int orient = (RBvert->isChecked())? 0 : 1;
float sbX1 = XSpin->value();
float sbY1 = YSpin->value();
float sbW = WidthSpin->value();
int sbLab = LabelSpin->value();
if((sbX1 < 0.) || (sbY1 < 0.) || ((sbX1+sbW) > 1.) || ((sbY1+sbH) > 1.)) {
- if(orient == 1) {
+ if(orient == 0) {
sbX1=0.01;
sbY1=0.1;
sbW=0.17;
SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
- aResourceMgr->setValue("Visu:SBOrientation",orient);
- aResourceMgr->setValue("Visu:SBXorigin",sbX1);
- aResourceMgr->setValue("Visu:SBYorigin",sbY1);
- aResourceMgr->setValue("Visu:SBWidth",sbW);
- aResourceMgr->setValue("Visu:SBHeight",sbH);
- aResourceMgr->setValue("Visu:SBNumberOfColors",sbCol);
- aResourceMgr->setValue("Visu:SBNumberOfLabels",sbLab);
+ aResourceMgr->setValue("VISU", "scalar_bar_orientation", orient);
+
+ QString propertyName = QString( "scalar_bar_%1_" ).arg( orient == 0 ? "vertical" : "horizontal" );
+
+ aResourceMgr->setValue("VISU", propertyName + "x", sbX1);
+ aResourceMgr->setValue("VISU", propertyName + "y", sbY1);
+ aResourceMgr->setValue("VISU", propertyName + "width", sbW);
+ aResourceMgr->setValue("VISU", propertyName + "height", sbH);
+
+ aResourceMgr->setValue("VISU", "scalar_bar_num_colors", sbCol);
+ aResourceMgr->setValue("VISU", "scalar_bar_num_labels", sbLab);
+
if(sbRange)
- aResourceMgr->setValue("Visu:SBImposeRange", "true");
- else
- aResourceMgr->setValue("Visu:SBImposeRange", "false");
- aResourceMgr->setValue("Visu:SBMinimumValue",sbVmin);
- aResourceMgr->setValue("Visu:SBMaximumValue",sbVmax);
- if(isLogarithmic())
- aResourceMgr->setValue("Visu:SBScaling", "LOGARITHMIC");
+ {
+ aResourceMgr->setValue("VISU", "scalar_range_type", 1);
+ aResourceMgr->setValue("VISU", "scalar_range_min" ,sbVmin);
+ aResourceMgr->setValue("VISU", "scalar_range_max" ,sbVmax);
+ }
else
- aResourceMgr->setValue("Visu:SBScaling", "LINEAR");
-
+ aResourceMgr->setValue("VISU", "scalar_range_type", 0);
+
+ aResourceMgr->setValue("VISU", "scalar_bar_logarithmic", isLogarithmic());
+
////
if (myIsStoreTextProp) {
myTextDlg->myTitleFont->GetData(aTitleColor, aTitleFontFamily,
isTitleBold, isTitleItalic, isTitleShadow);
- if (isTitleBold)
- aResourceMgr->setValue("Visu:IsBoldTitle","true");
- else
- aResourceMgr->setValue("Visu:IsBoldTitle","false");
-
- if (isTitleItalic)
- aResourceMgr->setValue("Visu:IsItalicTitle","true");
- else
- aResourceMgr->setValue("Visu:IsItalicTitle","false");
-
- if (isTitleShadow)
- aResourceMgr->setValue("Visu:IsShadowTitle","true");
- else
- aResourceMgr->setValue("Visu:IsShadowTitle","false");
-
+ QFont aTitleFont;
+
+ aTitleFont.setBold(isTitleBold);
+ aTitleFont.setItalic(isTitleItalic);
+ aTitleFont.setUnderline(isTitleShadow);
+
+ QString titleFontFamily;
switch (aTitleFontFamily) {
case VTK_ARIAL:
- aResourceMgr->setValue("Visu:TitFontType",0);
+ titleFontFamily = "Arial";
break;
case VTK_COURIER:
- aResourceMgr->setValue("Visu:TitFontType",1);
+ titleFontFamily = "Courier";
break;
case VTK_TIMES:
- aResourceMgr->setValue("Visu:TitFontType",2);
+ titleFontFamily = "Times";
break;
}
- aResourceMgr->setValue("Visu:TitleColorR", aTitleColor.red()/255.);
- aResourceMgr->setValue("Visu:TitleColorG", aTitleColor.green()/255.);
- aResourceMgr->setValue("Visu:TitleColorB", aTitleColor.blue()/255.);
-
+ aTitleFont.setFamily(titleFontFamily);
+
+ aResourceMgr->setValue("VISU", "scalar_bar_title_font", aTitleFont);
+
+ aResourceMgr->setValue("VISU", "scalar_bar_title_color", aTitleColor);
+
// "Label"
QColor aLabelColor (255, 255, 255);
int aLabelFontFamily = VTK_ARIAL;
bool isLabelItalic = false;
bool isLabelShadow = false;
- myTextDlg->myTitleFont->GetData(aLabelColor, aLabelFontFamily,
+ myTextDlg->myLabelFont->GetData(aLabelColor, aLabelFontFamily,
isLabelBold, isLabelItalic, isLabelShadow);
- if (isLabelBold)
- aResourceMgr->setValue("Visu:IsBoldLabel","true");
- else
- aResourceMgr->setValue("Visu:IsBoldLabel","false");
-
- if (isLabelItalic)
- aResourceMgr->setValue("Visu:IsItalicLabel","true");
- else
- aResourceMgr->setValue("Visu:IsItalicLabel","false");
- if (isLabelShadow)
- aResourceMgr->setValue("Visu:IsShadowLabel","true");
- else
- aResourceMgr->setValue("Visu:IsShadowLabel","false");
+ QFont aLabelFont;
+
+ aLabelFont.setBold(isLabelBold);
+ aLabelFont.setItalic(isLabelItalic);
+ aLabelFont.setUnderline(isLabelShadow);
+ QString labelFontFamily;
switch (aLabelFontFamily) {
case VTK_ARIAL:
- aResourceMgr->setValue("Visu:LblFontType",0);
+ labelFontFamily = "Arial";
break;
case VTK_COURIER:
- aResourceMgr->setValue("Visu:LblFontType",1);
+ labelFontFamily = "Courier";
break;
case VTK_TIMES:
- aResourceMgr->setValue("Visu:LblFontType",2);
+ labelFontFamily = "Times";
break;
}
- aResourceMgr->setValue("Visu:LabelColorR", aLabelColor.red()/255.);
- aResourceMgr->setValue("Visu:LabelColorG", aLabelColor.green()/255.);
- aResourceMgr->setValue("Visu:LabelColorB", aLabelColor.blue()/255.);
+
+ aLabelFont.setFamily(labelFontFamily);
+
+ aResourceMgr->setValue("VISU", "scalar_bar_label_font", aLabelFont);
+
+ aResourceMgr->setValue("VISU", "scalar_bar_label_color", aLabelColor);
}
}
*/
void VisuGUI_ScalarBarPane::initFromPrsObject(VISU::ScalarMap_i* thePrs) {
initFromResources();
+ myScalarMap = thePrs;
myModeCombo->setCurrentItem(thePrs->GetScalarMode());
setPosAndSize( thePrs->GetPosX(),
thePrs->GetPosY(),
thePrs->IsBoldLabel(),
thePrs->IsItalicLabel(),
thePrs->IsShadowLabel());
+
+ // Draw Preview
+ if (myPreviewCheck->isChecked()) {
+ createScalarBar();
+ updatePreview();
+ }
+
+}
+/*! Slot update preview of scalar bar, if preview is checked
+ */
+void VisuGUI_ScalarBarPane::updatePreview()
+{
+ if (myPreviewCheck->isChecked()) {
+ if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) {
+ deleteScalarBar();
+ createScalarBar();
+ vf->Repaint();
+ }
+ }
}
+/*! Creating preview scalar bar
+ */
+void VisuGUI_ScalarBarPane::createScalarBar()
+{
+ if (VISU::GetViewWindow() == NULL) return;
+ if (myPreviewActor != 0) return;
+ if (myScalarMap == NULL) return;
+
+ if(!check()) return;
+
+ int sbCol,sbLab;
+ sbCol = getNbColors();
+ sbLab = getNbLabels();
+ if(sbCol < 2) sbCol=2;
+ if(sbCol > 64) sbCol=64;
+ if(sbLab < 2) sbLab=2;
+ if(sbLab > 65) sbLab=65;
+ myPreviewActor = VISU_ScalarMapAct::New();
+ VISU_ScalarBarActor* aScalarBarActor = myPreviewActor->GetScalarBar();
+ myPreviewActor->GetScalarBar()->VisibilityOn();
+ myPreviewActor->PickableOff();
+
+ myScalarMap->SetScalarMode(myModeCombo->currentItem());
+ myScalarMap->SetPosition(getX(),getY());
+ myScalarMap->SetSize(getWidth(),getHeight());
+ myScalarMap->SetBarOrientation((RBvert->isChecked())? VISU::ScalarMap::VERTICAL : VISU::ScalarMap::HORIZONTAL);
+ if(isLogarithmic())
+ myScalarMap->SetScaling(VISU::LOGARITHMIC);
+ else
+ myScalarMap->SetScaling(VISU::LINEAR);
+ if (RBFrange->isChecked()) {
+ myScalarMap->SetSourceRange();
+ } else {
+ myScalarMap->SetRange(MinEdit->text().toDouble(), MaxEdit->text().toDouble());
+ }
+ myScalarMap->SetNbColors(sbCol);
+ myScalarMap->SetLabels(sbLab);
+
+ myScalarMap->GetScalarMapPL()->SetNbColors(sbCol);
+ myScalarMap->GetScalarMapPL()->Update();
+
+ aScalarBarActor->SetLookupTable(myScalarMap->GetScalarMapPL()->GetBarTable());
+
+ if (myTextDlg->getTitleText().latin1() != "")
+ aScalarBarActor->SetTitle(myTextDlg->getTitleText().latin1());
+ else
+ aScalarBarActor->SetTitle(myScalarMap->GetTitle());
+ aScalarBarActor->SetOrientation(getOrientation());
+ aScalarBarActor->GetPositionCoordinate()->SetCoordinateSystemToNormalizedViewport();
+ aScalarBarActor->GetPositionCoordinate()->SetValue(getX(),getY());
+ aScalarBarActor->SetWidth(getWidth());
+ aScalarBarActor->SetHeight(getHeight());
+ aScalarBarActor->SetNumberOfLabels(sbLab);
+ aScalarBarActor->SetMaximumNumberOfColors(sbCol);
+
+ // title text property
+ QColor aTitleColor;
+ int aTitleFontFamily;
+ bool isTitleBold;
+ bool isTitleItalic;
+ bool isTitleShadow;
+ myTextDlg->myTitleFont->GetData(aTitleColor,aTitleFontFamily,
+ isTitleBold,isTitleItalic,isTitleShadow);
+ vtkTextProperty* aTitleProp = aScalarBarActor->GetTitleTextProperty();
+ aTitleProp->SetFontFamily(aTitleFontFamily);
+ aTitleProp->SetColor(float(aTitleColor.red())/255.,
+ float(aTitleColor.green())/255.,
+ float(aTitleColor.blue())/255.);
+ (isTitleBold)? aTitleProp->BoldOn() : aTitleProp->BoldOff();
+ (isTitleItalic)? aTitleProp->ItalicOn() : aTitleProp->ItalicOff();
+ (isTitleShadow)? aTitleProp->ShadowOn() : aTitleProp->ShadowOff();
+
+ // label text property
+ QColor aLabelColor;
+ int aLabelFontFamily;
+ bool isLabelBold;
+ bool isLabelItalic;
+ bool isLabelShadow;
+ myTextDlg->myLabelFont->GetData(aLabelColor, aLabelFontFamily,
+ isLabelBold, isLabelItalic, isLabelShadow);
+ vtkTextProperty* aLabelProp = aScalarBarActor->GetLabelTextProperty();
+ aLabelProp->SetFontFamily(aLabelFontFamily);
+ aLabelProp->SetColor(float(aLabelColor.red())/255.,
+ float(aLabelColor.green())/255.,
+ float(aLabelColor.blue())/255.);
+ (isLabelBold)? aLabelProp->BoldOn() : aLabelProp->BoldOff();
+ (isLabelItalic)? aLabelProp->ItalicOn() : aLabelProp->ItalicOff();
+ (isLabelShadow)? aLabelProp->ShadowOn() : aLabelProp->ShadowOff();
+
+ aScalarBarActor->Modified();
+
+ VISU::GetViewWindow()->AddActor(myPreviewActor);
+}
+/*! Deleting preview scalar bar
+ */
+void VisuGUI_ScalarBarPane::deleteScalarBar()
+{
+ if (myPreviewActor == 0) return;
+ if (SVTK_ViewWindow* vf = VISU::GetViewWindow()){
+ vf->RemoveActor(myPreviewActor);
+ myPreviewActor->GetScalarBar()->VisibilityOff();
+ }
+ myPreviewActor->Delete();
+ myPreviewActor = 0;
+}
+/*! public: Deleting preview scalar bar
+ */
+void VisuGUI_ScalarBarPane::deletePreview()
+{
+ deleteScalarBar();
+}
/**
* Store values to presentation object
*/
WidthSpin->setValue( myHorW );
HeightSpin->setValue( myHorH );
}
+ updatePreview();
}
/*!
MaxEdit->setText( QString::number( Imax ) );
}
myRangeMode = mode;
+ updatePreview();
}
/*!
if ( snd == YSpin ) {
HeightSpin->setMaxValue( 1.0 - YSpin->value() );
}
+ updatePreview();
}
/*!
void VisuGUI_ScalarBarPane::onTextPref()
{
myIsStoreTextProp = myTextDlg->exec();
+ updatePreview();
}
+void VisuGUI_ScalarBarPane::onPreviewCheck (bool thePreview)
+{
+ if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) {
+ if (thePreview) {
+ createScalarBar();
+ } else {
+ deleteScalarBar();
+ }
+ vf->Repaint();
+ }
+}
//#######################################################################################
*/
void VisuGUI_ScalarBarDlg::accept()
{
+ myScalarPane->deletePreview();
if (myScalarPane->check()) QDialog::accept();
}
+/*!
+ Called when <Cancel> button is clicked, remove preview and closes dialog
+*/
+void VisuGUI_ScalarBarDlg::reject()
+{
+ myScalarPane->deletePreview();
+ QDialog::reject();
+}
+
//#######################################################################################
VisuGUI_TextPrefDlg::VisuGUI_TextPrefDlg (QWidget* parent)