From 19a718b4d5cc08a7df8898eada87cf6b88a04a95 Mon Sep 17 00:00:00 2001 From: enk Date: Wed, 1 Feb 2006 07:50:58 +0000 Subject: [PATCH] Bug PAL11197: SMESH and VISU: In scalar bar preferences, there is no control that X+width<=1 and Y+height<=1 Warning messages was added. --- src/VISUGUI/VISU_msg_en.po | 2 ++ src/VISUGUI/VisuGUI.cxx | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/VISUGUI/VISU_msg_en.po b/src/VISUGUI/VISU_msg_en.po index 0cd7807b..eb50916f 100644 --- a/src/VISUGUI/VISU_msg_en.po +++ b/src/VISUGUI/VISU_msg_en.po @@ -389,6 +389,8 @@ msgstr "Error has been occured during exporting to file" msgid "VisuGUI::ERR_ACTIVATE_VIEW3D" msgstr "Please activate 3D view before" +msgid "VisuGUI::ERR_SCALARBAR_PARAMS" +msgstr "Warning! The parameters is incorrect" msgid "VisuGUI::FLT_ALL_FILES" msgstr "All Files (*.*)" diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index f59460c8..f5f1a2ed 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -2993,10 +2993,12 @@ void VisuGUI::preferencesChanged( const QString& a, const QString& b) if (b == QString("scalar_bar_orientation")) return; SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); float sbX1,sbY1,sbW,sbH; + std::string aWarning; if(b == QString("scalar_bar_vertical_x") || b == QString("scalar_bar_vertical_width")){ sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_x", sbX1); sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_width", sbW); if(sbX1+sbW > 1.0){ + aWarning = "Origin and Size Vertical: X+Width > 1\n"; sbX1=0.01; sbW=0.05; aResourceMgr->setValue("VISU", "scalar_bar_vertical_x", sbX1); @@ -3007,6 +3009,7 @@ void VisuGUI::preferencesChanged( const QString& a, const QString& b) sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_y", sbY1); sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_height",sbH); if(sbY1+sbH > 1.0){ + aWarning = "Origin and Size Vertical: Y+Height > 1\n"; sbY1=0.01; sbH=0.5; aResourceMgr->setValue("VISU", "scalar_bar_vertical_y", sbY1); @@ -3017,6 +3020,7 @@ void VisuGUI::preferencesChanged( const QString& a, const QString& b) sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_x", sbX1); sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_width", sbW); if(sbX1+sbW > 1.0){ + aWarning = "Origin and Size Horizontal: X+Width > 1\n"; sbX1=0.2; sbW=0.6; aResourceMgr->setValue("VISU", "scalar_bar_horizontal_x", sbX1); @@ -3027,12 +3031,20 @@ void VisuGUI::preferencesChanged( const QString& a, const QString& b) sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_y", sbY1); sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_height",sbH); if(sbY1+sbH > 1.0){ + aWarning = "Origin and Size Horizontal: Y+Height > 1\n"; sbY1=0.01; sbH=0.12; aResourceMgr->setValue("VISU", "scalar_bar_horizontal_y", sbY1); aResourceMgr->setValue("VISU", "scalar_bar_horizontal_height",sbH); } } + if (aWarning.size() != 0){ + aWarning += "The default values are applied instead."; + SUIT_MessageBox::warn1(GetDesktop(this), + tr("ERR_SCALARBAR_PARAMS"), + tr(aWarning.c_str()), + tr("BUT_OK") ); + } } SUIT_ViewManager* -- 2.39.2