Skip to content

Commit

Permalink
Add a configuration option for global distribution plotting
Browse files Browse the repository at this point in the history
Refs #10639
  • Loading branch information
martyngigg committed Nov 27, 2014
1 parent 6b915a3 commit 27a167f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
3 changes: 3 additions & 0 deletions Code/Mantid/MantidPlot/src/ApplicationWindow.cpp
Expand Up @@ -840,6 +840,7 @@ void ApplicationWindow::initGlobalConstants()
d_show_axes_labels = QVector<bool> (QwtPlot::axisCnt, true);
d_show_axes_labels[1] = false;
d_show_axes_labels[3] = false;
autoDistribution1D = true;
canvasFrameWidth = 0;
defaultPlotMargin = 0;
drawBackbones = true;
Expand Down Expand Up @@ -5294,6 +5295,7 @@ void ApplicationWindow::readSettings()

settings.beginGroup("/General");
titleOn = settings.value("/Title", true).toBool();
autoDistribution1D = settings.value("/AutoDistribution1D", true).toBool();
canvasFrameWidth = settings.value("/CanvasFrameWidth", 0).toInt();
defaultPlotMargin = settings.value("/Margin", 0).toInt();
drawBackbones = settings.value("/AxesBackbones", true).toBool();
Expand Down Expand Up @@ -5672,6 +5674,7 @@ void ApplicationWindow::saveSettings()
settings.beginGroup("/2DPlots");
settings.beginGroup("/General");
settings.setValue("/Title", titleOn);
settings.setValue("/AutoDistribution1D", autoDistribution1D);
settings.setValue("/CanvasFrameWidth", canvasFrameWidth);
settings.setValue("/Margin", defaultPlotMargin);
settings.setValue("/AxesBackbones", drawBackbones);
Expand Down
1 change: 1 addition & 0 deletions Code/Mantid/MantidPlot/src/ApplicationWindow.h
Expand Up @@ -1329,6 +1329,7 @@ public slots:
bool d_synchronize_graph_scales;

int majTicksStyle, minTicksStyle, legendFrameStyle, autoSaveTime, canvasFrameWidth;
bool autoDistribution1D;
QColor legendBackground, legendTextColor, defaultArrowColor;
int defaultArrowHeadLength, defaultArrowHeadAngle;
double defaultArrowLineWidth, defaultCurveLineWidth;
Expand Down
16 changes: 11 additions & 5 deletions Code/Mantid/MantidPlot/src/ConfigDialog.cpp
Expand Up @@ -1346,10 +1346,14 @@ void ConfigDialog::initOptionsPage()
boxFrame->setChecked(app->canvasFrameWidth > 0);
optionsLayout->addWidget( boxFrame, 2, 0 );

boxDistribution = new QCheckBox();
boxDistribution->setChecked(app->autoDistribution1D);
optionsLayout->addWidget( boxDistribution, 3, 0);

labelFrameWidth = new QLabel();
optionsLayout->addWidget( labelFrameWidth, 3, 0 );
optionsLayout->addWidget( labelFrameWidth, 4, 0 );
boxFrameWidth= new QSpinBox();
optionsLayout->addWidget( boxFrameWidth, 3, 1 );
optionsLayout->addWidget( boxFrameWidth, 4, 1 );
boxFrameWidth->setRange(1, 100);
boxFrameWidth->setValue(app->canvasFrameWidth);
if (!app->canvasFrameWidth)
Expand All @@ -1359,12 +1363,12 @@ void ConfigDialog::initOptionsPage()
}

lblMargin = new QLabel();
optionsLayout->addWidget( lblMargin, 4, 0 );
optionsLayout->addWidget( lblMargin, 5, 0 );
boxMargin= new QSpinBox();
boxMargin->setRange(0, 1000);
boxMargin->setSingleStep(5);
boxMargin->setValue(app->defaultPlotMargin);
optionsLayout->addWidget( boxMargin, 4, 1 );
optionsLayout->addWidget( boxMargin, 5, 1 );

optionsLayout->setRowStretch( 7, 1 );

Expand Down Expand Up @@ -1763,6 +1767,8 @@ void ConfigDialog::languageChange()
labelFrameWidth->setText(tr("Frame width" ));

boxFrame->setText(tr("Canvas Fra&me"));
boxDistribution->setText(tr("Normalize 1D to bin width"));
boxDistribution->setToolTip(tr("If checked, plot all spectra graphs normalised to the bin widths"));
boxTitle->setText(tr("Show &Title"));
boxScaleFonts->setText(tr("Scale &Fonts"));
boxAutoscaling->setText(tr("Auto&scaling"));
Expand Down Expand Up @@ -2015,7 +2021,7 @@ void ConfigDialog::apply()
// 2D plots page: options tab
app->d_in_place_editing = !boxLabelsEditing->isChecked();
app->titleOn=boxTitle->isChecked();

app->autoDistribution1D = boxDistribution->isChecked();
if (boxFrame->isChecked())
app->canvasFrameWidth = boxFrameWidth->value();
else
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/MantidPlot/src/ConfigDialog.h
Expand Up @@ -207,7 +207,7 @@ class ConfigDialog : public QDialog

QPushButton* buttonAxesFont, *buttonNumbersFont, *buttonLegendFont, *buttonTitleFont, *fontsBtn;
QCheckBox *boxSearchUpdates, *boxOrthogonal, *logBox, *plotLabelBox, *scaleErrorsBox;
QCheckBox *boxTitle, *boxFrame, *boxPlots3D, *boxPlots2D, *boxTables, *boxNotes, *boxFolders,*boxInstrWindow;
QCheckBox *boxTitle, *boxFrame, *boxDistribution, *boxPlots3D, *boxPlots2D, *boxTables, *boxNotes, *boxFolders,*boxInstrWindow;
QCheckBox *boxSave, *boxBackbones, *boxShowLegend, *boxSmoothMesh;
QCheckBox *boxAutoscaling, *boxShowProjection, *boxMatrices, *boxScaleFonts, *boxResize, *boxAspectRatio;
QComboBox *boxMajTicks, *boxMinTicks, *boxStyle, *boxCurveStyle, *boxSeparator, *boxLanguage, *boxDecimalSeparator;
Expand Down

0 comments on commit 27a167f

Please sign in to comment.