Beispiel #1
0
void EffectPanelUtils::UpdateLinkedTextCtrlFloatVC(wxScrollEvent& event)
{
    UpdateLinkedTextCtrlFloat(event);
    wxSlider * slider = (wxSlider*)event.GetEventObject();
    wxString name = slider->GetName();
    if (name.Contains("ID_")) {
        name.Replace("ID_SLIDER_", "ID_VALUECURVE_");
    }
    else {
        name.Replace("IDD_SLIDER_", "ID_VALUECURVE_");
    }
    ValueCurveButton* vc = (ValueCurveButton*)slider->GetParent()->FindWindowByName(name);

    if (vc != NULL)
    {
        if (vc->GetValue()->GetType() == "Flat")
        {
            vc->GetValue()->SetUnscaledParameter1(slider->GetValue());
        }
    }
    else
    {
        wxASSERT("Value curve button not found: " + name);
    }
}
Beispiel #2
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();
        }
    }
}
Beispiel #3
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();
        }
    }
}
Beispiel #4
0
// this is recursive
static std::string GetEffectStringFromWindow(wxWindow *ParentWin)
{
    wxString s,ChildName,AttrName;
    int i;
    wxWindowList &ChildList = ParentWin->GetChildren();
    for ( wxWindowList::iterator it = ChildList.begin(); it != ChildList.end(); ++it )
    {
        wxWindow *ChildWin = *it;
        if (!ChildWin->IsEnabled()) {
            continue;
        }
        ChildName=ChildWin->GetName();
        AttrName = "E_" + ChildName.Mid(3);
        if (ChildName.StartsWith("ID_SLIDER"))
        {
            wxSlider* ctrl=(wxSlider*)ChildWin;
            s+=AttrName+ "=" + wxString::Format("%d",ctrl->GetValue()) + ",";
        }
        else if (ChildName.StartsWith("ID_VALUECURVE"))
        {
            ValueCurveButton* ctrl = (ValueCurveButton*)ChildWin;
            //if (ctrl->GetValue()->IsActive())
            {
                s += AttrName + "=" + ctrl->GetValue()->Serialise() + ",";
            }
        }
        else if (ChildName.StartsWith("ID_TEXTCTRL"))
        {
            wxTextCtrl* ctrl=(wxTextCtrl*)ChildWin;
            wxString v = ctrl->GetValue();
            v.Replace("&", "&", true);
            v.Replace(",", ",", true);
            s+=AttrName + "=" + v + ",";
        }
		else if (ChildName.StartsWith("ID_SPINCTRL"))
		{
			wxSpinCtrl* ctrl = (wxSpinCtrl*)ChildWin;
			int i = ctrl->GetValue();
			s += AttrName + "=" + wxString::Format(wxT("%i"), i) + ",";
		}
		else if (ChildName.StartsWith("ID_CHOICE"))
        {
            wxChoice* ctrl=(wxChoice*)ChildWin;
            s+=AttrName + "=" + ctrl->GetStringSelection() + ",";
        }
        else if (ChildName.StartsWith("ID_CHECKBOX"))
        {
            wxCheckBox* ctrl=(wxCheckBox*)ChildWin;
            wxString checkedVal =(ctrl->IsChecked()) ? "1" : "0";
            s+=AttrName + "=" + checkedVal + ",";
        }
        else if (ChildName.StartsWith("ID_FILEPICKER"))
        {
            wxFilePickerCtrl* ctrl=(wxFilePickerCtrl*)ChildWin;
            s+=AttrName + "=" + ctrl->GetFileName().GetFullPath() + ",";
        }
        else if (ChildName.StartsWith("ID_FONTPICKER"))
        {
            wxFontPickerCtrl* ctrl=(wxFontPickerCtrl*)ChildWin;
            wxFont f = ctrl->GetSelectedFont();
            if (f.IsOk()) {
                wxString FontDesc=f.GetNativeFontInfoUserDesc();
                FontDesc.Replace(" unknown-90","");
                s+=AttrName + "=" + FontDesc + ",";
            } else {
                s+=AttrName + "=,";
            }
        }
        else if (ChildName.StartsWith("ID_NOTEBOOK") || ChildName.StartsWith("IDD_NOTEBOOK"))
        {
            wxNotebook* ctrl=(wxNotebook*)ChildWin;
            //for IDD_ stuff, don't record the value of the actual page selected
            if (ChildName.StartsWith("ID_NOTEBOOK")) {
                s+= AttrName + "=" ;
                s+=ctrl->GetPageText(ctrl->GetSelection());
                s+=",";
            }
            for(i=0; i<ctrl->GetPageCount(); i++)
            {
                wxString pageString = GetEffectStringFromWindow(ctrl->GetPage(i));
                if (pageString.size() > 0) {
                    s += pageString;
                    if (!s.EndsWith(",")) {
                        s += ",";
                    }
                }
            }
        }
        else if (ChildName.StartsWith("ID_PANEL_"))
        {
            wxString pageString = GetEffectStringFromWindow(ChildWin);
            if (pageString.size() > 0) {
                s += pageString;
                if (!s.EndsWith(",")) {
                    s += ",";
                }
            }
        }
    }
    s = s.Mid(0,s.size()-1);
    return s.ToStdString();
}