From aa036e33b70541b1613300248af581dc57345ca3 Mon Sep 17 00:00:00 2001 From: enk Date: Wed, 1 Feb 2006 07:51:57 +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/SMESHGUI/SMESHGUI.cxx | 13 +++++++++++++ src/SMESHGUI/SMESH_msg_en.po | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index 8be5d69b2..ecc471d99 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -3000,6 +3000,7 @@ void SMESHGUI::preferencesChanged( const QString& sect, const QString& name ) { if( sect=="SMESH" ){ float sbX1,sbY1,sbW,sbH; + std::string aWarning; SUIT_ResourceMgr* aResourceMgr = SMESH::GetResourceMgr(this); if( name=="selection_object_color" || name=="selection_element_color" || name=="selection_width" || name=="highlight_color" || name=="highlight_width" || @@ -3009,6 +3010,7 @@ void SMESHGUI::preferencesChanged( const QString& sect, const QString& name ) sbX1 = aResourceMgr->doubleValue("SMESH", "scalar_bar_vertical_x", sbX1); sbW = aResourceMgr->doubleValue("SMESH", "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("SMESH", "scalar_bar_vertical_x", sbX1); @@ -3019,6 +3021,7 @@ void SMESHGUI::preferencesChanged( const QString& sect, const QString& name ) sbY1 = aResourceMgr->doubleValue("SMESH", "scalar_bar_vertical_y", sbY1); sbH = aResourceMgr->doubleValue("SMESH", "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("SMESH", "scalar_bar_vertical_y", sbY1); @@ -3029,6 +3032,7 @@ void SMESHGUI::preferencesChanged( const QString& sect, const QString& name ) sbX1 = aResourceMgr->doubleValue("SMESH", "scalar_bar_horizontal_x", sbX1); sbW = aResourceMgr->doubleValue("SMESH", "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("SMESH", "scalar_bar_horizontal_x", sbX1); @@ -3039,12 +3043,21 @@ void SMESHGUI::preferencesChanged( const QString& sect, const QString& name ) sbY1 = aResourceMgr->doubleValue("SMESH", "scalar_bar_horizontal_y", sbY1); sbH = aResourceMgr->doubleValue("SMESH", "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("SMESH", "scalar_bar_horizontal_y", sbY1); aResourceMgr->setValue("SMESH", "scalar_bar_horizontal_height",sbH); } } + + if(aWarning.size() != 0){ + aWarning += "The default values are applied instead."; + SUIT_MessageBox::warn1(SMESHGUI::desktop(), + QObject::tr("SMESH_ERR_SCALARBAR_PARAMS"), + QObject::tr(aWarning.c_str()), + QObject::tr("SMESH_BUT_OK")); + } } } diff --git a/src/SMESHGUI/SMESH_msg_en.po b/src/SMESHGUI/SMESH_msg_en.po index 54287cd1c..b0c73c29e 100644 --- a/src/SMESHGUI/SMESH_msg_en.po +++ b/src/SMESHGUI/SMESH_msg_en.po @@ -630,6 +630,10 @@ msgid "SMESH_UPDATEVIEW" msgstr "Update View" +#Warning incorrect values +msgid "SMESH_ERR_SCALARBAR_PARAMS" +msgstr "Warning! The parameters is incorrect" + # -------------- Connectivity -------------- #Boundary Edges -- 2.39.2