summaryrefslogtreecommitdiffstats
path: root/Project/GainForm.cpp
blob: 03a70efba794e22d7a6184c0b0e3069cee26e62c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "GainForm.h"
#include "Gain.h"

GainForm::GainForm(wxWindow* parent, Gain* gain) : GainFormBase(parent)
{
    SetSize(GetBestSize());
    
    m_parent = parent;
    m_gain = gain;

    m_textCtrlValue->SetValue(m_gain->StringFromDouble(m_gain->GetValue()));
}

GainForm::~GainForm() {}
void GainForm::OnOKButtonClick(wxCommandEvent& event)
{
    if(ValidateData()) EndModal(wxID_OK);
}

bool GainForm::ValidateData()
{
    double value;
    if(!m_gain->DoubleFromString(this, m_textCtrlValue->GetValue(), value,
                                 _("Value entered incorrectly in the field \"Gain value\".")))
        return false;

    m_gain->SetValue(value);
    return true;
}