// Save check box ===========================================================
QHBox* aSaveBox = new QHBox(this);
+ if (!thePreview) {
+ CBSave = new QCheckBox (tr("SAVE_DEFAULT_CHK"), aSaveBox, "CBSave");
+ }
+ else {
+ CBSave = 0;
+ }
myTextBtn = new QPushButton("Text properties...", aSaveBox);
myBarBtn = new QPushButton("Bar properties...", aSaveBox);
myTextDlg = new VisuGUI_TextPrefDlg(this);
- myTextDlg->setTitleVisible(TRUE);
+ myTextDlg->setTitleVisible(!thePreview);
myBarDlg = new VisuGUI_BarPrefDlg(this);
QGroupBox* CheckGroup = new QGroupBox("", this, "CheckGroup");
myBusy = false;
}
+/**
+ * Stores dialog values to resources
+ */
+void VisuGUI_ScalarBarPane::storeToResources() {
+ int orient = (RBvert->isChecked())? 0 : 1;
+ float sbX1 = XSpin->value();
+ float sbY1 = YSpin->value();
+ float sbW = WidthSpin->value();
+ float sbH = HeightSpin->value();
+ int sbCol = ColorSpin->value();
+ int sbLab = LabelSpin->value();
+
+ if((sbX1 < 0.) || (sbY1 < 0.) || ((sbX1+sbW) > 1.) || ((sbY1+sbH) > 1.)) {
+ if(orient == 0) {
+ sbX1=0.01;
+ sbY1=0.1;
+ sbW=0.17;
+ sbH=0.8;
+ } else {
+ sbX1=0.2;
+ sbY1=0.01;
+ sbW=0.6;
+ sbH=0.12;
+ }
+ }
+
+ bool sbRange = RBIrange->isChecked();
+ float sbVmin = (float)(MinEdit->text().toDouble());
+ float sbVmax = (float)(MaxEdit->text().toDouble());
+
+ if(sbVmin > sbVmax) {
+ sbVmin=0.;
+ sbVmax=0.;
+ }
+
+ SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+
+ 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", "scalar_range_type", 1);
+ aResourceMgr->setValue("VISU", "scalar_range_min" ,sbVmin);
+ aResourceMgr->setValue("VISU", "scalar_range_max" ,sbVmax);
+ }
+ else
+ aResourceMgr->setValue("VISU", "scalar_range_type", 0);
+
+ aResourceMgr->setValue("VISU", "scalar_bar_logarithmic", isLogarithmic());
+
+ ////
+
+ if (myIsStoreTextProp) {
+ // "Title"
+ QColor aTitleColor (255, 255, 255);
+ int aTitleFontFamily = VTK_ARIAL;
+ bool isTitleBold = false;
+ bool isTitleItalic = false;
+ bool isTitleShadow = false;
+
+ myTextDlg->myTitleFont->GetData(aTitleColor, aTitleFontFamily,
+ isTitleBold, isTitleItalic, isTitleShadow);
+
+ QFont aTitleFont;
+
+ aTitleFont.setBold(isTitleBold);
+ aTitleFont.setItalic(isTitleItalic);
+ aTitleFont.setUnderline(isTitleShadow);
+
+ QString titleFontFamily;
+ switch (aTitleFontFamily) {
+ case VTK_ARIAL:
+ titleFontFamily = "Arial";
+ break;
+ case VTK_COURIER:
+ titleFontFamily = "Courier";
+ break;
+ case VTK_TIMES:
+ titleFontFamily = "Times";
+ break;
+ }
+ 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 isLabelBold = false;
+ bool isLabelItalic = false;
+ bool isLabelShadow = false;
+
+ myTextDlg->myLabelFont->GetData(aLabelColor, aLabelFontFamily,
+ isLabelBold, isLabelItalic, isLabelShadow);
+
+
+ QFont aLabelFont;
+
+ aLabelFont.setBold(isLabelBold);
+ aLabelFont.setItalic(isLabelItalic);
+ aLabelFont.setUnderline(isLabelShadow);
+
+ QString labelFontFamily;
+ switch (aLabelFontFamily) {
+ case VTK_ARIAL:
+ labelFontFamily = "Arial";
+ break;
+ case VTK_COURIER:
+ labelFontFamily = "Courier";
+ break;
+ case VTK_TIMES:
+ labelFontFamily = "Times";
+ break;
+ }
+
+ aLabelFont.setFamily(labelFontFamily);
+
+ aResourceMgr->setValue("VISU", "scalar_bar_label_font", aLabelFont);
+
+ aResourceMgr->setValue("VISU", "scalar_bar_label_color", aLabelColor);
+ }
+}
//----------------------------------------------------------------------------
VisuGUI_ScalarBarPane::~VisuGUI_ScalarBarPane()
myScalarMap->SetNbColors(ColorSpin->value());
myScalarMap->SetLabels(LabelSpin->value());
+ if (isToSave()) storeToResources();
+
if (myIsStoreTextProp) {
// "Title"
myScalarMap->SetTitle(myTextDlg->getTitleText().latin1());