Пример #1
0
void TAdjuster::OnSlide(wxScrollEvent& event)
{
    int value = event.GetInt();
    TUniform* uniform = sliders[event.GetId()].first;
    int component = sliders[event.GetId()].second;
    uniform->SetSlider((float) value / MaxSliderValue, component);
    uniform->UpdateSlider();
    event.Skip();
}
Пример #2
0
        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;
            }
        }
Пример #3
0
        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
//Scrolling. Calculate positions
void wxFixWidthImportCtrl::OnScroll(wxScrollEvent &sevent)
{
    m_NowType = sevent.GetEventType();

    //Uncomment next iy you want to avoid some flicker.
    //But dragging-scroll will be not so good
/*
    //When this event arrives here.
    //Event::GetTimestamp() is when it was fired.
    m_timeNow = wxGetLocalTimeMillis();

    //We want to avoid flicker when many EVT_SCROLL_THUMBTRACK are fired
    if ( m_timeNow - m_timeInit < 200
         && m_lastType == m_NowType )
        return;
*/
    //Avoid also consecutive THUMBRELEASE ENDSCROLL, they are so similar ...
    if ( m_lastType == wxEVT_SCROLL_THUMBRELEASE
        && m_NowType == wxEVT_SCROLL_CHANGED )
    {
        SetFocus(); //Avoid blinking bar
        return;
    }

    m_lastType = m_NowType;

    bool refresNow = false;
    size_t pos = (size_t) sevent.GetPosition();

    if ( sevent.GetId() == FW_SCROH && m_curposX != pos )
    {
        m_curposX = pos;
        refresNow = true;
    }
    if ( sevent.GetId() == FW_SCROV && m_curposL != pos )
    {
        m_curposL = pos;
        refresNow = true;
    }

    if ( refresNow )
    {
        m_timeInit = m_timeNow; //Reinit time
        Refresh();
    }
    SetFocus(); //Avoid blinking bar
}
Пример #5
0
void TimelinePanel::OnSliderFinish( wxScrollEvent& event ) {
  switch (event.GetId()) {
    case SPEED_SLIDER:
      inst->song->history.record(speedChange);
      speedChange = 0;
      break;
  }
}
Пример #6
0
void EffectPanel::OnSliderFinish( wxScrollEvent& event ) {
  switch (event.GetId()) {
    case DEPTH_SLIDER:
      effect->inst->song->history.record(depthChange);
      depthChange = 0;
      break;
  }
}
Пример #7
0
void ModelControl::OnSlider(wxScrollEvent &event)
{
	if (!init || !model)
		return;

	int id = event.GetId();
	if (id == ID_MODEL_ALPHA) {
		model->alpha = event.GetInt() / 100.0f;
	} else if (id == ID_MODEL_SCALE) {
		att->scale = event.GetInt() / 100.0f;
		txtsize->SetValue(wxString::Format(wxT("%.2f"), att->scale));
	}
}
Пример #8
0
void EffectPanel::OnSliderUpdate( wxScrollEvent& event ) {
  int val = event.GetSelection();
  switch (event.GetId()) {
    case DEPTH_SLIDER:
      if (depthChange != 0) {
        depthChange->undo();
        delete depthChange;
        depthChange = 0;
      }
      depthChange = new ChangeEffectDepth(effect->inst, effect->timeline, effect->type, val);
      break;
  }
  SharedManagerBase::share();
}
Пример #9
0
void MainFrame::OnScrollChange(wxScrollEvent& event)
{
    if(event.GetId() == ZOOMSLIDER_ID)
    {
        wxSlider* pSlider = m_pStatusBar->GetSlider();
        double curVal = static_cast<double>(pSlider->GetValue()) / 10000;
        for(std::size_t idx = 0; idx < m_pCenterPageManager->GetSize(); idx++)
        {
            PicViewCtrl* pPic = m_pCenterPageManager->GetPicViewCtrl(idx);
            pPic->SetFitMode(false);
            pPic->ChangeScaleRate(curVal);
        }
    }
}
Пример #10
0
void TimelinePanel::OnSliderUpdate( wxScrollEvent &event ) {
  //int val = m_slider->GetValue();
  int val = event.GetSelection();
  switch (event.GetId()) {
    case SPEED_SLIDER:
      printf("SPEED_SLIDER\n");
      if (speedChange != 0) {
        speedChange->undo();
        delete speedChange;
        speedChange = 0;
      }
      speedChange = new ChangeTimelineSpeed(inst, timeline, val);
      break;
  }
  SharedManagerBase::share();
  printf("slider updated, index: %d\n", val);
}
Пример #11
0
void OscillatorPanel::OnSliderMove(wxScrollEvent& event) {
  int val = event.GetSelection();
  HarmonicSet* set = &inst->oscillator.harmonicSet[selectedVoice];
  if (sliderChange == 0) {
    switch (event.GetId()) {
      case BLUR_SLIDER:
        sliderChange = new ChangeOscillatorSlider(inst, &set->blur, val);
        break;
      case STRETCH_SLIDER:
        sliderChange = new ChangeOscillatorSlider(inst, &set->stretch, val);
        break;
    }
  } else {
    sliderChange->update(val);
  }
  SharedManagerBase::share();
}
Пример #12
0
void ExtraPanel::OnChangeEqualizer( wxScrollEvent &event )
{
    aout_instance_t *p_aout= (aout_instance_t *)vlc_object_find(p_intf,
                                 VLC_OBJECT_AOUT, FIND_ANYWHERE);
    char psz_values[102];
    memset( psz_values, 0, 102 );


    /* Smoothing */
    int i_diff = event.GetPosition() - i_values[  event.GetId() - Band0_Event ];
    i_values[ event.GetId() - Band0_Event] = event.GetPosition();

    for( int i = event.GetId() + 1 ; i <= Band9_Event ; i++ )
    {
        int i_new = band_sliders[ i-Band0_Event ]->GetValue() +
           (int)( i_diff * pow( (float)i_smooth / 100 , i- event.GetId() ) ) ;
        if( i_new < 0 ) i_new = 0;
        if( i_new > 400 ) i_new = 400;
        band_sliders[ i-Band0_Event ]->SetValue( i_new );
    }
    for( int i = Band0_Event ; i < event.GetId() ; i++ )
    {
        int i_new =   band_sliders[ i-Band0_Event ]->GetValue() +
           (int)( i_diff * pow( (float)i_smooth / 100 , event.GetId() - i  ) );
        if( i_new < 0 ) i_new = 0;
        if( i_new > 400 ) i_new = 400;
        band_sliders[ i-Band0_Event ]->SetValue( i_new );
    }

    /* Write the new bands values */
    for( int i = 0 ; i < 10 ; i++ )
    {
        char psz_val[5];
        float f_val = (float)( 400 - band_sliders[i]->GetValue() ) / 10- 20 ;
        sprintf( psz_values, "%s %f", psz_values, f_val );
        sprintf( psz_val, "%.1f", f_val );
        band_texts[i]->SetLabel( band_frequencies[i] + wxT("\n") +
                        wxU( psz_val ) + wxT("dB" ) );
    }
    if( p_aout == NULL )
    {
        config_PutPsz( p_intf, "equalizer-bands", psz_values );
    }
    else
    {
        var_SetString( p_aout, "equalizer-bands", psz_values );
        config_PutPsz( p_intf, "equalizer-bands", psz_values );
        b_my_update = VLC_TRUE;
        vlc_object_release( p_aout );
    }
}
Пример #13
0
void ExtraPanel::OnAdjustUpdate( wxScrollEvent &event)
{
    vout_thread_t *p_vout = (vout_thread_t *)vlc_object_find(p_intf,
                                 VLC_OBJECT_VOUT, FIND_ANYWHERE);
    if( p_vout == NULL )
    {
        switch( event.GetId() )
        {
            case Hue_Event:
                config_PutInt( p_intf , "hue" , event.GetPosition() );
                break;

            case Saturation_Event:
                config_PutFloat( p_intf , "saturation" ,
                                (float)event.GetPosition()/100 );
                break;

            case Brightness_Event:
                config_PutFloat( p_intf , "brightness" ,
                                (float)event.GetPosition()/100 );
                break;

            case Contrast_Event:
                config_PutFloat( p_intf , "contrast" ,
                                (float)event.GetPosition()/100 );
                break;

            case Gamma_Event:
                config_PutFloat( p_intf , "gamma" ,
                                (float)event.GetPosition()/10 );
                break;
        }
    }
    else
    {
        vlc_value_t val;
        switch( event.GetId() )
        {
            case Hue_Event:
                val.i_int = event.GetPosition();
                var_Set( p_vout, "hue", val );
                config_PutInt( p_intf , "hue" , event.GetPosition() );
                break;

            case Saturation_Event:
                val.f_float = (float)event.GetPosition() / 100;
                var_Set( p_vout, "saturation", val );
                config_PutFloat( p_intf , "saturation" ,
                                (float)event.GetPosition()/100 );
                break;

            case Brightness_Event:
                val.f_float = (float)event.GetPosition() / 100;
                var_Set( p_vout, "brightness", val );
                config_PutFloat( p_intf , "brightness" ,
                                (float)event.GetPosition()/100 );
                break;

            case Contrast_Event:
                val.f_float = (float)event.GetPosition() / 100;
                var_Set( p_vout, "contrast", val );
                config_PutFloat( p_intf , "contrast" ,
                                (float)event.GetPosition()/100 );
                break;

            case Gamma_Event:
                val.f_float = (float)event.GetPosition() / 10;
                var_Set( p_vout, "gamma", val );
                config_PutFloat( p_intf , "gamma" ,
                                (float)event.GetPosition()/10 );
                break;
        }
        vlc_object_release(p_vout);
    }
}