Kaydet (Commit) 849f575a authored tarafından Caolán McNamara's avatar Caolán McNamara

weld ScFourierAnalysisDialog

Change-Id: I87e28f62cf03f4a612def322fda5e03d702bec4c
Reviewed-on: https://gerrit.libreoffice.org/70543
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 8d526da3
......@@ -26,11 +26,11 @@
#include <strings.hrc>
ScFourierAnalysisDialog::ScFourierAnalysisDialog(SfxBindings* pSfxBindings,
SfxChildWindow* pChildWindow, vcl::Window* pParent,
ScViewData* pViewData)
: ScStatisticsInputOutputDialog(pSfxBindings, pChildWindow, pParent, pViewData,
"FourierAnalysisDialog",
"modules/scalc/ui/fourieranalysisdialog.ui")
SfxChildWindow* pChildWindow,
weld::Window* pParent, ScViewData* pViewData)
: ScStatisticsInputOutputDialogController(pSfxBindings, pChildWindow, pParent, pViewData,
"modules/scalc/ui/fourieranalysisdialog.ui",
"FourierAnalysisDialog")
, maLabelAddr(ScAddress::INITIALIZE_INVALID)
, maActualInputRange(ScAddress::INITIALIZE_INVALID)
, mnLen(0)
......@@ -40,32 +40,22 @@ ScFourierAnalysisDialog::ScFourierAnalysisDialog(SfxBindings* pSfxBindings,
, mbWithLabels(false)
, mbInverse(false)
, mbPolar(false)
, mxWithLabelsCheckBox(m_xBuilder->weld_check_button("withlabels-check"))
, mxInverseCheckBox(m_xBuilder->weld_check_button("inverse-check"))
, mxPolarCheckBox(m_xBuilder->weld_check_button("polar-check"))
, mxMinMagnitudeField(m_xBuilder->weld_spin_button("minmagnitude-spin"))
, mxErrorMessage(m_xBuilder->weld_label("error-message"))
{
SetText(ScResId(STR_FOURIER_ANALYSIS));
get(mpWithLabelsCheckBox, "withlabels-check");
get(mpInverseCheckBox, "inverse-check");
get(mpPolarCheckBox, "polar-check");
get(mpMinMagnitudeField, "minmagnitude-spin");
get(mpErrorMessage, "error-message");
mpWithLabelsCheckBox->SetToggleHdl(LINK(this, ScFourierAnalysisDialog, CheckBoxHdl));
}
ScFourierAnalysisDialog::~ScFourierAnalysisDialog() { disposeOnce(); }
m_xDialog->set_title(ScResId(STR_FOURIER_ANALYSIS));
bool ScFourierAnalysisDialog::Close()
{
return DoClose(ScFourierAnalysisDialogWrapper::GetChildWindowId());
mxWithLabelsCheckBox->connect_toggled(LINK(this, ScFourierAnalysisDialog, CheckBoxHdl));
}
void ScFourierAnalysisDialog::dispose()
ScFourierAnalysisDialog::~ScFourierAnalysisDialog() {}
void ScFourierAnalysisDialog::Close()
{
mpWithLabelsCheckBox.disposeAndClear();
mpInverseCheckBox.disposeAndClear();
mpPolarCheckBox.disposeAndClear();
mpMinMagnitudeField.disposeAndClear();
mpErrorMessage.disposeAndClear();
ScStatisticsInputOutputDialog::dispose();
DoClose(ScFourierAnalysisDialogWrapper::GetChildWindowId());
}
const char* ScFourierAnalysisDialog::GetUndoNameId() { return STR_FOURIER_ANALYSIS; }
......@@ -120,20 +110,20 @@ bool ScFourierAnalysisDialog::InputRangesValid()
{
if (!mInputRange.IsValid())
{
mpErrorMessage->SetText(ScResId(STR_MESSAGE_INVALID_INPUT_RANGE));
mxErrorMessage->set_label(ScResId(STR_MESSAGE_INVALID_INPUT_RANGE));
return false;
}
if (!mOutputAddress.IsValid())
{
mpErrorMessage->SetText(ScResId(STR_MESSAGE_INVALID_OUTPUT_ADDR));
mxErrorMessage->set_label(ScResId(STR_MESSAGE_INVALID_OUTPUT_ADDR));
return false;
}
mInputRange.PutInOrder();
mbGroupedByColumn = mGroupedBy == BY_COLUMN;
mbWithLabels = mpWithLabelsCheckBox->IsChecked();
mbWithLabels = mxWithLabelsCheckBox->get_active();
mbUse3DAddresses = mInputRange.aStart.Tab() != mOutputAddress.Tab();
......@@ -147,13 +137,13 @@ bool ScFourierAnalysisDialog::InputRangesValid()
{
OUString aMsg = mbGroupedByColumn ? ScResId(STR_MESSAGE_INVALID_NUMCOLS)
: ScResId(STR_MESSAGE_INVALID_NUMROWS);
mpErrorMessage->SetText(aMsg);
mxErrorMessage->set_label(aMsg);
return false;
}
if (mbWithLabels && nLen < 2)
{
mpErrorMessage->SetText(ScResId(STR_MESSAGE_NODATA_IN_RANGE));
mxErrorMessage->set_label(ScResId(STR_MESSAGE_NODATA_IN_RANGE));
return false;
}
......@@ -164,7 +154,7 @@ bool ScFourierAnalysisDialog::InputRangesValid()
if (nLastOutputRow > MAXROW)
{
mpErrorMessage->SetText(ScResId(STR_MESSAGE_OUTPUT_TOO_LONG));
mxErrorMessage->set_label(ScResId(STR_MESSAGE_OUTPUT_TOO_LONG));
return false;
}
......@@ -190,17 +180,17 @@ bool ScFourierAnalysisDialog::InputRangesValid()
}
maActualInputRange = ScRange(aActualStart, mInputRange.aEnd);
mpErrorMessage->SetText("");
mxErrorMessage->set_label("");
return true;
}
void ScFourierAnalysisDialog::getOptions()
{
mbInverse = mpInverseCheckBox->IsChecked();
mbPolar = mpPolarCheckBox->IsChecked();
mbInverse = mxInverseCheckBox->get_active();
mbPolar = mxPolarCheckBox->get_active();
sal_Int32 nDeciBels = static_cast<sal_Int32>(mpMinMagnitudeField->GetValue());
sal_Int32 nDeciBels = static_cast<sal_Int32>(mxMinMagnitudeField->get_value());
if (nDeciBels <= -150)
mfMinMag = 0.0;
else
......@@ -242,6 +232,9 @@ void ScFourierAnalysisDialog::genFormula(OUString& rFormula)
+ OUString::boolean(mbInverse) + ";true;" + OUString::number(mfMinMag) + ")";
}
IMPL_LINK_NOARG(ScFourierAnalysisDialog, CheckBoxHdl, CheckBox&, void) { ValidateDialogInput(); }
IMPL_LINK_NOARG(ScFourierAnalysisDialog, CheckBoxHdl, weld::ToggleButton&, void)
{
ValidateDialogInput();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -13,14 +13,8 @@
#include "StatisticsInputOutputDialog.hxx"
class ScFourierAnalysisDialog : public ScStatisticsInputOutputDialog
class ScFourierAnalysisDialog : public ScStatisticsInputOutputDialogController
{
VclPtr<CheckBox> mpWithLabelsCheckBox;
VclPtr<CheckBox> mpInverseCheckBox;
VclPtr<CheckBox> mpPolarCheckBox;
VclPtr<NumericField> mpMinMagnitudeField;
VclPtr<FixedText> mpErrorMessage;
ScAddress maLabelAddr;
ScRange maActualInputRange;
SCSIZE mnLen;
......@@ -33,16 +27,21 @@ class ScFourierAnalysisDialog : public ScStatisticsInputOutputDialog
bool mbInverse : 1;
bool mbPolar : 1;
std::unique_ptr<weld::CheckButton> mxWithLabelsCheckBox;
std::unique_ptr<weld::CheckButton> mxInverseCheckBox;
std::unique_ptr<weld::CheckButton> mxPolarCheckBox;
std::unique_ptr<weld::SpinButton> mxMinMagnitudeField;
std::unique_ptr<weld::Label> mxErrorMessage;
public:
ScFourierAnalysisDialog(SfxBindings* pB, SfxChildWindow* pCW, vcl::Window* pParent,
ScFourierAnalysisDialog(SfxBindings* pB, SfxChildWindow* pCW, weld::Window* pParent,
ScViewData* pViewData);
virtual ~ScFourierAnalysisDialog() override;
virtual bool Close() override;
virtual void Close() override;
protected:
void dispose() override;
virtual const char* GetUndoNameId() override;
virtual ScRange ApplyOutput(ScDocShell* pDocShell) override;
virtual bool InputRangesValid() override;
......@@ -52,7 +51,7 @@ private:
void getDataLabel(OUString& rLabel);
void genFormula(OUString& rFormula);
DECL_LINK(CheckBoxHdl, CheckBox&, void);
DECL_LINK(CheckBoxHdl, weld::ToggleButton&, void);
};
#endif
......
......@@ -142,7 +142,7 @@ private:
};
class ScFourierAnalysisDialogWrapper :
public ChildWindowWrapper<SID_FOURIER_ANALYSIS_DIALOG>
public ChildControllerWrapper<SID_FOURIER_ANALYSIS_DIALOG>
{
private:
ScFourierAnalysisDialogWrapper() = delete;
......
......@@ -330,12 +330,6 @@ VclPtr<SfxModelessDialog> ScTabViewShell::CreateRefDialog(
}
break;
case SID_FOURIER_ANALYSIS_DIALOG:
{
pResult = VclPtr<ScFourierAnalysisDialog>::Create( pB, pCW, pParent, &GetViewData() );
}
break;
case SID_OPENDLG_OPTSOLVER:
{
ScViewData& rViewData = GetViewData();
......@@ -527,6 +521,11 @@ std::unique_ptr<SfxModelessDialogController> ScTabViewShell::CreateRefDialogCont
xResult.reset(new ScChiSquareTestDialog(pB, pCW, pParent, &GetViewData()));
}
break;
case SID_FOURIER_ANALYSIS_DIALOG:
{
xResult.reset(new ScFourierAnalysisDialog(pB, pCW, pParent, &GetViewData()));
}
break;
}
if (xResult)
......
......@@ -2,7 +2,6 @@
<!-- Generated with glade 3.22.1 -->
<interface domain="sc">
<requires lib="gtk+" version="3.18"/>
<requires lib="LibreOffice" version="1.0"/>
<object class="GtkAdjustment" id="adjustment1">
<property name="lower">-150</property>
<property name="upper">150</property>
......@@ -15,6 +14,8 @@
<property name="border_width">6</property>
<property name="title" translatable="yes" context="fourieranalysisdialog|FourierAnalysisDialog">Fourier Analysis</property>
<property name="resizable">False</property>
<property name="default_width">0</property>
<property name="default_height">0</property>
<property name="type_hint">dialog</property>
<child>
<placeholder/>
......@@ -118,11 +119,12 @@
</packing>
</child>
<child>
<object class="foruilo-RefEdit" id="input-range-edit">
<object class="GtkEntry" id="input-range-edit">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="valign">center</property>
<property name="hexpand">True</property>
<property name="activates_default">True</property>
<property name="width_chars">30</property>
</object>
<packing>
......@@ -131,7 +133,7 @@
</packing>
</child>
<child>
<object class="foruilo-RefButton" id="input-range-button">
<object class="GtkButton" id="input-range-button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
......@@ -156,11 +158,12 @@
</packing>
</child>
<child>
<object class="foruilo-RefEdit" id="output-range-edit">
<object class="GtkEntry" id="output-range-edit">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="valign">center</property>
<property name="hexpand">True</property>
<property name="activates_default">True</property>
<property name="width_chars">30</property>
</object>
<packing>
......@@ -169,7 +172,7 @@
</packing>
</child>
<child>
<object class="foruilo-RefButton" id="output-range-button">
<object class="GtkButton" id="output-range-button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
......@@ -409,6 +412,7 @@
</child>
<action-widgets>
<action-widget response="-5">ok</action-widget>
<action-widget response="-6">cancel</action-widget>
<action-widget response="-11">help</action-widget>
</action-widgets>
</object>
......
......@@ -83,6 +83,8 @@ sc/uiconfig/scalc/ui/externaldata.ui://GtkTreeView[@id='ranges'] no-labelled-by
sc/uiconfig/scalc/ui/externaldata.ui://GtkTreeViewColumn[@id='treeviewcolumn1'] no-labelled-by
sc/uiconfig/scalc/ui/externaldata.ui://GtkLabel[@id='secondsft'] orphan-label
sc/uiconfig/scalc/ui/fourieranalysisdialog.ui://GtkLabel[@id='error-message'] orphan-label
sc/uiconfig/scalc/ui/fourieranalysisdialog.ui://GtkButton[@id='input-range-button'] button-no-label
sc/uiconfig/scalc/ui/fourieranalysisdialog.ui://GtkButton[@id='output-range-button'] button-no-label
sc/uiconfig/scalc/ui/functionpanel.ui://GtkComboBoxText[@id='category'] no-labelled-by
sc/uiconfig/scalc/ui/functionpanel.ui://GtkTreeView[@id='funclist:border'] no-labelled-by
sc/uiconfig/scalc/ui/functionpanel.ui://GtkLabel[@id='funcdesc:border'] orphan-label
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment