Пример #1
0
void EffectPanelUtils::OnVCChanged(wxCommandEvent& event)
{
    ValueCurveButton * vcb = (ValueCurveButton*)event.GetEventObject();
    wxString name = vcb->GetName();
    wxString slidername = name;
    wxString slidername2 = name;
    slidername.Replace("ID_VALUECURVE_", "ID_SLIDER_");
    slidername2.Replace("ID_VALUECURVE_", "IDD_SLIDER_");
    wxString textctrlname = name;
    wxString textctrlname2 = name;
    textctrlname.Replace("ID_VALUECURVE_", "ID_TEXTCTRL_");
    textctrlname2.Replace("ID_VALUECURVE_", "IDD_TEXTCTRL_");
    wxSlider* slider = (wxSlider*)vcb->GetParent()->FindWindowByName(slidername);
    if (slider == NULL || (void*)slider == (void*)vcb)
    {
        slider = (wxSlider*)vcb->GetParent()->FindWindowByName(slidername2);
    }
    wxTextCtrl* textctrl = (wxTextCtrl*)vcb->GetParent()->FindWindowByName(textctrlname);
    if (textctrl == NULL || (void*)textctrl == (void*)vcb)
    {
        textctrl = (wxTextCtrl*)vcb->GetParent()->FindWindowByName(textctrlname2);
    }

    wxASSERT(slider != NULL && (void*)slider != (void*)vcb);
    wxASSERT(textctrl != NULL && (void*)textctrl != (void*)vcb);

    if (vcb->GetValue()->IsActive())
    {
        if (slider != NULL)
        {
            slider->Disable();
        }
        if (textctrl != NULL)
        {
            textctrl->Disable();
        }
    }
    else
    {
        if (slider != NULL)
        {
            slider->Enable();
        }
        if (textctrl != NULL)
        {
            textctrl->Enable();
        }
    }
}
Пример #2
0
void EffectPanelUtils::OnVCButtonClick(wxCommandEvent& event)
{
    ValueCurveButton * vc = (ValueCurveButton*)event.GetEventObject();

    wxString name = vc->GetName();
    name.Replace("IDD_VALUECURVE_", "ID_SLIDER_");
    name.Replace("ID_VALUECURVE_", "ID_SLIDER_");
    wxSlider *slider = (wxSlider*)vc->GetParent()->FindWindowByName(name);
    if (slider == NULL || (void*)slider == (void*)vc)
    {
        name = vc->GetName();
        name.Replace("IDD_VALUECURVE_", "IDD_SLIDER_");
        name.Replace("ID_VALUECURVE_", "IDD_SLIDER_");
        slider = (wxSlider*)vc->GetParent()->FindWindowByName(name);
    }

    name = vc->GetName();
    name.Replace("IDD_VALUECURVE_", "ID_TEXTCTRL_");
    name.Replace("ID_VALUECURVE_", "ID_TEXTCTRL_");
    wxTextCtrl *txt = (wxTextCtrl*)vc->GetParent()->FindWindowByName(name);
    if (txt == NULL || (void*)txt == (void*)vc)
    {
        name = vc->GetName();
        name.Replace("IDD_VALUECURVE_", "IDD_TEXTCTRL_");
        name.Replace("ID_VALUECURVE_", "IDD_TEXTCTRL_");
        txt = (wxTextCtrl*)vc->GetParent()->FindWindowByName(name);
    }

    vc->ToggleActive();
    if (vc->GetValue()->IsActive())
    {
        ValueCurveDialog vcd(vc->GetParent(), vc->GetValue());
        if (vcd.ShowModal() == wxOK)
        {
            if (slider != NULL)
            {
                slider->Disable();
            }
            if (txt != NULL)
            {
                txt->Disable();
            }
        }
        else
        {
            if (slider != NULL)
            {
                slider->Enable();
            }
            if (txt != NULL)
            {
                txt->Enable();
            }
            vc->SetActive(false);
        }
        vc->UpdateState();
    }
    else
    {
        if (slider != NULL)
        {
            slider->Enable();
        }
        if (txt != NULL)
        {
            txt->Enable();
        }
    }
}