#include "VisuGUI_SetupPlot2dDlg.h"
#include "Plot2d_SetupCurveDlg.h"
#include "Plot2d_ViewManager.h"
+#include "Plot2d_SetupCurveScaleDlg.h"
#include "QtxPagePrefMgr.h"
#include "OB_Browser.h"
}
}
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnCurveScale()
+{
+ if(IsStudyLocked(GetCStudy(GetAppStudy(this))))
+ return;
+
+ VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects( this );
+ int nbSel = aSelectionInfo.size();
+ QList<VISU::Curve_i*> curList;
+ bool isValuesEquals = true;
+ double value;
+
+ for (int i = 0; i < nbSel; i++ ) {
+ VISU::TSelectionItem aSelectionItem = aSelectionInfo[i];
+ VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
+ if(!aBase)
+ continue;
+
+ if(aBase->GetType() == VISU::TCURVE)
+ // Curve object
+ if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase)) {
+ curList.append(aCurve);
+ if( i>0 && isValuesEquals )
+ isValuesEquals = (value == aCurve->GetScale());
+ value = aCurve->GetScale();
+ }
+ }
+
+ Plot2d_SetupCurveScaleDlg aDlg(GetDesktop( this ));
+ if( isValuesEquals )
+ aDlg.setScale(value);
+
+ if( aDlg.exec() == QDialog::Accepted )
+ for ( int i = 0; i < curList.size(); ++i )
+ curList.at(i)->SetScale( aDlg.getScale() );
+}
//----------------------------------------------------------------------------
void
VisuGUI
tr("MEN_CURVE_PROPS"), "", 0, aParent, false,
this, SLOT(OnCurveProperties()));
+ createAction( VISU_CURVE_SCALE, tr("MEN_CURVE_SCALE"), QIcon(),
+ tr("MEN_CURVE_SCALE"), "", 0, aParent, false,
+ this, SLOT(OnCurveScale()));
+
createAction( VISU_EDIT_CONTAINER, tr("MEN_EDIT_CONTAINER"), QIcon(),
tr("MEN_EDIT_CONTAINER"), "", 0, aParent, false,
this, SLOT(OnEditContainer()));
mgr->insert( action( VISU_ARRANGE_ACTORS ), -1, -1, -1 ); // arrange actors
mgr->insert( action( VISU_CURVE_PROPS ), -1, -1, -1 ); // curve properties
+ mgr->insert( action( VISU_CURVE_SCALE ), -1, -1, -1 ); // curve scale
mgr->insert( action( VISU_MULTIPR_FULL_RES ), -1, -1, -1 );
mgr->insert( action( VISU_MULTIPR_MED_RES ), -1, -1, -1 );
// Curve commands
aRule = "selcount=1 and type='VISU::TCURVE'";
mgr->setRule( action( VISU_CURVE_PROPS ), aRule );
+ mgr->setRule( action( VISU_CURVE_SCALE ), "selcount > 0 and type='VISU::TCURVE'");
// Table Commands
aRule = "selcount=1 and ( type='VISU::TPOINTMAP3D' or type='VISU::TTABLE')";