示例#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);
    }
}
        void GeneralPreferencePane::OnMouseSliderChanged(wxScrollEvent& event) {
            wxSlider* sender = static_cast<wxSlider*>(event.GetEventObject());
            float value = sender->GetValue() / 100.0f;

            Preferences::PreferenceManager& prefs = Preferences::PreferenceManager::preferences();

            switch (event.GetId()) {
                case CommandIds::GeneralPreferencePane::LookSpeedSliderId: {
                    prefs.setFloat(Preferences::CameraLookSpeed, value);
                    
                    Controller::PreferenceChangeEvent preferenceChangeEvent(Preferences::CameraLookSpeed);
                    static_cast<TrenchBroomApp*>(wxTheApp)->UpdateAllViews(NULL, &preferenceChangeEvent);
                    break;
                }
                case CommandIds::GeneralPreferencePane::PanSpeedSliderId: {
                    prefs.setFloat(Preferences::CameraPanSpeed, value);
                    
                    Controller::PreferenceChangeEvent preferenceChangeEvent(Preferences::CameraPanSpeed);
                    static_cast<TrenchBroomApp*>(wxTheApp)->UpdateAllViews(NULL, &preferenceChangeEvent);
                    break;
                }
                case CommandIds::GeneralPreferencePane::MoveSpeedSliderId: {
                    prefs.setFloat(Preferences::CameraMoveSpeed, value);
                    
                    Controller::PreferenceChangeEvent preferenceChangeEvent(Preferences::CameraMoveSpeed);
                    static_cast<TrenchBroomApp*>(wxTheApp)->UpdateAllViews(NULL, &preferenceChangeEvent);
                    break;
                }
                default:
                    break;
            }
        }
        void GeneralPreferencePane::OnViewSliderChanged(wxScrollEvent& event) {
            wxSlider* sender = static_cast<wxSlider*>(event.GetEventObject());
            int value = sender->GetValue();

            Preferences::PreferenceManager& prefs = Preferences::PreferenceManager::preferences();

            switch (event.GetId()) {
                case CommandIds::GeneralPreferencePane::BrightnessSliderId: {
                    prefs.setFloat(Preferences::RendererBrightness, value / 40.0f);

                    Controller::PreferenceChangeEvent preferenceChangeEvent(Preferences::RendererBrightness);
                    static_cast<TrenchBroomApp*>(wxTheApp)->UpdateAllViews(NULL, &preferenceChangeEvent);
                    break;
                }
                case CommandIds::GeneralPreferencePane::GridAlphaSliderId: {
                    int max = sender->GetMax();
                    float floatValue = static_cast<float>(value) / static_cast<float>(max);
                    prefs.setFloat(Preferences::GridAlpha, floatValue);

                    Controller::PreferenceChangeEvent preferenceChangeEvent(Preferences::GridAlpha);
                    static_cast<TrenchBroomApp*>(wxTheApp)->UpdateAllViews(NULL, &preferenceChangeEvent);
                    break;
                }
                default:
                    break;
            }

            static_cast<TrenchBroomApp*>(wxTheApp)->UpdateAllViews();
        }
示例#4
0
void Panel_Remaps::EvtSlidersChg( wxScrollEvent& event )
{
	// Get the slider id
	wxSlider *sender = (wxSlider*) event.GetEventObject();
	if( sender == NULL )
		return;

	int val = sender->GetValue();

	switch( sender->GetId())
	{
		case ID_HUE_CTRL :
			paletteCtrl->Set_Hue( val );
			break;
		case ID_SAT_CTRL :
			paletteCtrl->Set_Sat( val );
			break;
		case ID_LUM_CTRL :
			paletteCtrl->Set_Luz( val );
			break;
		case ID_RED_CTRL :
			paletteCtrl->Set_Red( val );
			break;
		case ID_GREEN_CTRL :
			paletteCtrl->Set_Green( val );
			break;
		case ID_BLUE_CTRL :
			paletteCtrl->Set_Blue( val );
			break;
		default:
			return;
	}

	frameView->UpdateFrames();
}
示例#5
0
void PixelAppearanceDlg::UpdateLinkedTextCtrl(wxScrollEvent& event)
{
    wxSlider * slider = (wxSlider*)event.GetEventObject();
    wxString name = slider->GetName();
    if (name.Contains("ID_")) {
        name.Replace("ID_SLIDER_", "IDD_TEXTCTRL_");
    } else {
        name.Replace("IDD_SLIDER_", "ID_TEXTCTRL_");
    }
    wxTextCtrl *txt = (wxTextCtrl*)slider->GetParent()->FindWindowByName(name);
    txt->ChangeValue(wxString::Format("%d",slider->GetValue()));
}
示例#6
0
// -------------------------------------------------------------------------------- //
void guEq10Band::OnUpdateLabel( wxScrollEvent &event )
{
    wxSlider * Band = ( wxSlider * ) event.GetEventObject();
    if( Band )
    {
        long BandIndex;
        Band->GetLabel().ToLong( &BandIndex );

        m_Values[ BandIndex ]->SetLabel( wxString::Format( wxT( "%.1f" ), double( event.GetPosition() ) / 10.0 ) );
        m_Values[ BandIndex ]->GetContainingSizer()->Layout();
    }
}
void kinematicFrame::OnScrollChanged(wxScrollEvent& event)
{
    TJointControlMap::iterator iter =
        mJoints.find(static_cast<wxSlider*>(event.GetEventObject()));

    if (iter == mJoints.end())
        {
            assert(false);
            return;
        }

    JointControl& entry = (*iter).second;
    shared_ptr<Joint> joint(shared_static_cast<Joint>(entry.joint.lock()));
    joint->SetParameter(dParamVel, 0);
}
示例#8
0
void EffectPanelUtils::UpdateLinkedTextCtrlFloat(wxScrollEvent& event)
{
    wxSlider * slider = (wxSlider*)event.GetEventObject();
    wxTextCtrl *txt = (wxTextCtrl*)LINKED_CONTROLS[slider];
    if (txt == nullptr) {
        wxString name = slider->GetName();
        if (name.Contains("ID_")) {
            name.Replace("ID_SLIDER_", "IDD_TEXTCTRL_");
        } else {
            name.Replace("IDD_SLIDER_", "ID_TEXTCTRL_");
        }
        txt = (wxTextCtrl*)slider->GetParent()->FindWindowByName(name);
        LINKED_CONTROLS[slider] = txt;
    }
    txt->ChangeValue(wxString::Format("%0.1f",slider->GetValue()/10.0));
}
示例#9
0
// -------------------------------------------------------------------------------- //
void guEq10Band::OnBandChanged( wxScrollEvent &event )
{
    wxSlider * Band = ( wxSlider * ) event.GetEventObject();
    if( Band )
    {
        long BandIndex;
        Band->GetLabel().ToLong( &BandIndex );
        //guLogMessage( wxT( "Band%u = %i (%i)" ), BandIndex, event.GetPosition(), m_PresetComboBox->GetSelection() );
        m_MediaCtrl->SetEqualizerBand( BandIndex, event.GetPosition() );
        if( m_PresetComboBox->GetSelection() != wxNOT_FOUND )
            m_BandChanged = true;

        OnPresetText( event );

        m_Values[ BandIndex ]->SetLabel( wxString::Format( wxT( "%.1f" ), double( event.GetPosition() ) / 10.0 ) );
        m_Values[ BandIndex ]->GetContainingSizer()->Layout();
    }
}
示例#10
0
void MusicPanel::OnSlider_Music_StartNoteCmdSliderUpdated(wxScrollEvent& event)
{
    int start = Slider_Music_StartNote->GetValue();
    int end = Slider_Music_EndNote->GetValue();
    if (event.GetEventObject() == Slider_Music_StartNote)
    {
        if (end < start)
        {
            end = start;
        }
    }
    else
    {
        if (end < start)
        {
            start = end;
        }
    }

    if (end != Slider_Music_EndNote->GetValue())
    {
        Slider_Music_EndNote->SetValue(end);
    }
    wxString e = wxString::Format("%d", end);
    if (e != TextCtrl_Music_EndNote->GetValue())
    {
        TextCtrl_Music_EndNote->SetValue(e);
    }
    if (start != Slider_Music_StartNote->GetValue())
    {
        Slider_Music_StartNote->SetValue(start);
    }
    wxString s = wxString::Format("%d", start);
    if (s != TextCtrl_Music_StartNote->GetValue())
    {
        TextCtrl_Music_StartNote->SetValue(s);
    }
    ValidateWindow();
}
示例#11
0
void Panels::SpeedHacksPanel::Slider_Click(wxScrollEvent &event) {
	wxSlider* slider = (wxSlider*) event.GetEventObject();
	int value = slider->GetValue();
	int eventType = event.GetEventType();
	if (eventType == wxEVT_SCROLL_PAGEUP || eventType == wxEVT_SCROLL_LINEUP) {
		if (value > slider->GetMin()) {
			slider->SetValue(value-1);
		}
	}
	else if (eventType == wxEVT_SCROLL_TOP) {
		slider->SetValue(slider->GetMin());
	}
	else if (eventType == wxEVT_SCROLL_PAGEDOWN || eventType == wxEVT_SCROLL_LINEDOWN) {
		if (value < slider->GetMax()) {
			slider->SetValue(value+1);
		}
	}
	else if (eventType == wxEVT_SCROLL_BOTTOM) {
		slider->SetValue(slider->GetMax());
	}

	event.Skip();
}
示例#12
0
//---------------------------------------------------------------------------
void wxPagedWindow::OnScroll( wxScrollEvent& event )
{
    wxScrollBar* pSender = (wxScrollBar*)event.GetEventObject();
    // wxMessageBox("wxPagedWindow::OnScroll","-I->");
    if ( pSender == mpTabScroll )
    {

        int maxUnits = GetWholeTabRowLen() / 20;

        mCurentRowOfs = -event.GetPosition()*maxUnits;

        mFirstTitleGap = mTitleRowStart + mCurentRowOfs + mTabTrianGap;

        // let' it automatically disable itself if it's time
        mpTabScroll->Enable( mTitleRowLen < GetWholeTabRowLen() || mCurentRowOfs < 0 );

        // repaint title bars
        wxWindowDC dc(this);
        DrawDecorations( dc );
    }
    else
    {
        if ( !mScrollEventInProgress )
        {
            mScrollEventInProgress = true;

            GetActiveTab()->GetEventHandler()->ProcessEvent( event );
        }
        else
        {
            // event bounced back to us, from here we
            // know that it has traveled the loop - thus it's processed!

            mScrollEventInProgress = false;
        }
    }
}  // wxPagedWindow::OnScroll()