Ejemplo n.º 1
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();
        }
Ejemplo n.º 2
0
// Handle event from scrollbars
void wxWindowQt::QtOnScrollBarEvent( wxScrollEvent& event )
{
    wxEventType windowEventType = 0;

    // Map the scroll bar event to the corresponding scroll window event:

    wxEventType scrollBarEventType = event.GetEventType();
    if ( scrollBarEventType == wxEVT_SCROLL_TOP )
        windowEventType = wxEVT_SCROLLWIN_TOP;
    else if ( scrollBarEventType == wxEVT_SCROLL_BOTTOM )
        windowEventType = wxEVT_SCROLLWIN_BOTTOM;
    else if ( scrollBarEventType == wxEVT_SCROLL_PAGEUP )
        windowEventType = wxEVT_SCROLLWIN_PAGEUP;
    else if ( scrollBarEventType == wxEVT_SCROLL_PAGEDOWN )
        windowEventType = wxEVT_SCROLLWIN_PAGEDOWN;
    else if ( scrollBarEventType == wxEVT_SCROLL_LINEUP )
        windowEventType = wxEVT_SCROLLWIN_LINEUP;
    else if ( scrollBarEventType == wxEVT_SCROLL_LINEDOWN )
        windowEventType = wxEVT_SCROLLWIN_LINEDOWN;
    else if ( scrollBarEventType == wxEVT_SCROLL_THUMBTRACK )
        windowEventType = wxEVT_SCROLLWIN_THUMBTRACK;
    else if ( scrollBarEventType == wxEVT_SCROLL_THUMBRELEASE )
        windowEventType = wxEVT_SCROLLWIN_THUMBRELEASE;

    if ( windowEventType != 0 )
    {
        wxScrollWinEvent e( windowEventType, event.GetPosition(), event.GetOrientation() );
        ProcessWindowEvent( e );
    }
}
Ejemplo n.º 3
0
Archivo: main.cpp Proyecto: krpors/navi
void TrackStatusHandler::onVolChange(wxScrollEvent& event) {
    if (event.GetEventType() == wxEVT_SCROLL_CHANGED) {
        if (m_pipeline != NULL) {
            m_pipeline->setVolume(event.GetPosition());
        }
    }
}
Ejemplo n.º 4
0
void tpanelscrollbar::OnScrollHandler(wxScrollEvent &event) {
	wxEventType type = event.GetEventType();
	bool upok = (type == wxEVT_SCROLL_TOP || type == wxEVT_SCROLL_LINEUP || type == wxEVT_SCROLL_PAGEUP || type == wxEVT_SCROLL_THUMBRELEASE || type == wxEVT_SCROLL_CHANGED);
	bool downok = (type == wxEVT_SCROLL_BOTTOM || type == wxEVT_SCROLL_LINEDOWN || type == wxEVT_SCROLL_PAGEDOWN || type == wxEVT_SCROLL_THUMBRELEASE || type == wxEVT_SCROLL_CHANGED);

	int y;
	if (type == wxEVT_SCROLL_LINEUP || type == wxEVT_SCROLL_LINEDOWN) {
		y = GetThumbPosition();
		if (type == wxEVT_SCROLL_LINEUP) {
			y -= gc.linescrollspeed;
		} else {
			y += gc.linescrollspeed;
		}
		SetThumbPosition(std::max(0, y));
		ScrollItems();
	} else {
		if (type == wxEVT_SCROLLWIN_THUMBRELEASE || type == wxEVT_SCROLL_CHANGED) {
			y = event.GetPosition();
			SetThumbPosition(y);
		} else {
			y = GetThumbPosition();
		}
		ScrollItemsForPosition(y);
		event.Skip();
	}

	OnScrollHandlerCommon(upok, downok, 0, y);
}
Ejemplo n.º 5
0
/*----------------------------------------------------------------------
 *       Class:  AmayaScrollBar
 *      Method:  OnScroll
 * Description:  
  -----------------------------------------------------------------------*/
void AmayaScrollBar::OnScroll( wxScrollEvent& event )
{
  /* this flag is necessary because 2 events occure when up/down button
     is pressed (it's an optimisation)
     this hack works because OnLineDown is called before OnScroll,
     but becareful the events orders could change in future wxWidgets
     releases or can be platform specific
  */
  if (m_IgnoreNextScrollEvent)
    {
      m_IgnoreNextScrollEvent = FALSE;
      event.Skip();
      return;
    }
  
  if (event.GetOrientation() == wxHORIZONTAL)
    {
      TTALOGDEBUG_3( TTA_LOG_DIALOG, _T("AmayaScrollBar::OnScroll [wxHORIZONTAL][frameid=%d][pos=%d][pagesize=%d]"), m_ParentFrameID, event.GetPosition(), GetPageSize() );
      FrameHScrolledCallback( m_ParentFrameID,
                              event.GetPosition(),
                              GetPageSize() );
    }
  else if (event.GetOrientation() == wxVERTICAL)
    {
      TTALOGDEBUG_3( TTA_LOG_DIALOG, _T("AmayaScrollBar::OnScroll [wxVERTICAL][frameid=%d][pos=%d][pagesize=%d]"), m_ParentFrameID, event.GetPosition(), GetPageSize() );
      FrameVScrolledCallback( m_ParentFrameID,
                              event.GetPosition() );
    }
}
Ejemplo n.º 6
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;
            }
        }
Ejemplo n.º 7
0
void tpanelscrollbar::OnScrollTrack(wxScrollEvent &event) {
	#if TPANEL_SCROLLING_COPIOUS_LOGGING
		LogMsgFormat(LOGT::TPANELTRACE, "TSCL: tpanelscrollbar::OnScrollTrack %s, %d", cstr(GetThisName()), event.GetPosition());
	#endif
	int y = event.GetPosition();
	ScrollItemsForPosition(y);
	SetThumbPosition(y);
	event.Skip();
}
Ejemplo n.º 8
0
void NumericSlider::OnScrollChange(wxScrollEvent &event)
{   
    wxCommandEvent evt(wxEVT_COMMAND_SPINCTRL_UPDATED);
    evt.SetId(this->GetId());    
    evt.SetEventObject(this);
    mSpinner->SetValue(event.GetInt() + mSpinner->GetMin());
    evt.SetInt(event.GetInt() + mSpinner->GetMin());
    wxPostEvent(this, evt);
}
Ejemplo n.º 9
0
void bmImage::OnScrollChanged(wxScrollEvent& event) {
	bmImageFrame* p = ((bmImageFrame*)GetParent());
	if (event.GetOrientation() == wxHORIZONTAL) {
		p->setScroll(cv::Vec2f(event.GetPosition(), p->getScroll()[1]));
	}
	else if (event.GetOrientation() == wxVERTICAL) {
		p->setScroll(cv::Vec2f(p->getScroll()[1], event.GetPosition()));
	}
}
Ejemplo n.º 10
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();
}
Ejemplo n.º 11
0
void AttachableScrollBar::OnScroll(wxScrollEvent & event)
{
   if( mpViewInfo == NULL )
   {
      event.Skip();
      return;
   }
   SetViewInfoFromScrollBar();
   event.Skip(); // This is so that the parent control can refresh whatever it needs to...
}
Ejemplo n.º 12
0
void BrushThicknessPanel::OnScroll(wxScrollEvent& event) {
	static const int lookup_table[10] = {1,2,3,5,8,13,23,35,50,80};
	use_button->SetValue(true);

	ASSERT(event.GetPosition() >= 1);
	ASSERT(event.GetPosition() <= 10);

	//printf("SELECT[%d] = %d\n", event.GetPosition()-1, lookup_table[event.GetPosition()-1]);
	gui.ActivatePalette(GetParentPalette());
	gui.SetBrushThickness(true, lookup_table[event.GetPosition()-1], 100);
}
Ejemplo n.º 13
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();
    }
}
Ejemplo n.º 14
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));
	}
}
Ejemplo n.º 15
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();
}
Ejemplo n.º 16
0
// Explicitly call default scroll behaviour
void wxMDIClientWindow::OnScroll(wxScrollEvent& event)
{
    // Note: for client windows, the scroll position is not set in
    // WM_HSCROLL, WM_VSCROLL, so we can't easily determine what
    // scroll position we're at.
    // This makes it hard to paint patterns or bitmaps in the background,
    // and have the client area scrollable as well.

    if ( event.GetOrientation() == wxHORIZONTAL )
        m_scrollX = event.GetPosition(); // Always returns zero!
    else
        m_scrollY = event.GetPosition(); // Always returns zero!

    event.Skip();
}
Ejemplo n.º 17
0
void ExtraPanel::OnNormvolSlider( wxScrollEvent &event )
{
    aout_instance_t *p_aout= (aout_instance_t *)vlc_object_find(p_intf,
                                 VLC_OBJECT_AOUT, FIND_ANYWHERE);
    if( p_aout != NULL )
    {
        var_SetFloat( p_aout, "norm-max-level", (float)event.GetPosition()/10 );
        vlc_object_release( p_aout );
    }
    else
    {
        config_PutFloat( p_intf, "norm-max-level",
                        (float)event.GetPosition()/10 );
    }
}
Ejemplo n.º 18
0
Archivo: main.cpp Proyecto: krpors/navi
void TrackStatusHandler::onPosChange(wxScrollEvent& event) {
    // only allow scrolling if not a stream.
    if (m_pipelineType == PIPELINE_STREAM) {
        return;
    }

    // else, allow position seeking.
    m_scrolling = true;
    if (event.GetEventType() == wxEVT_SCROLL_CHANGED) {
        if (m_pipeline != NULL) {
            m_pipeline->seekSeconds(event.GetPosition());
            m_scrolling = false;
        }
    }
}
Ejemplo n.º 19
0
//2d influence
void BrushToolDlg::OnBrush2dinflChange(wxScrollEvent &event)
{
	int ival = event.GetPosition();
	double val = double(ival)/100.0;
	wxString str = wxString::Format("%.2f", val);
	m_brush_2dinfl_text->SetValue(str);
}
Ejemplo n.º 20
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);
    }
}
Ejemplo n.º 21
0
void MiscControlPage::OnSpeedChange(wxScrollEvent& event)
{
	auto speedText = wxString::Format(wxT("%d"), event.GetInt());
	m_speedIndicator->SetValue(speedText);
	m_controller.WriteCommand(wxT("set speed ") + speedText);
	m_controller.WriteCommand(wxT("set throttle on"));
}
Ejemplo n.º 22
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();
}
Ejemplo n.º 23
0
/////////////
// On scroll
void BaseGrid::OnScroll(wxScrollEvent &event) {
	int newPos = event.GetPosition();
	if (yPos != newPos) {
		yPos = newPos;
		Refresh(false);
	}
}
Ejemplo n.º 24
0
//selection adjustment
//scalar translate
void BrushToolDlg::OnBrushSclTranslateChange(wxScrollEvent &event)
{
	int ival = event.GetPosition();
	double val = double(ival)/10.0;
	wxString str = wxString::Format("%.1f", val);
	m_brush_scl_translate_text->SetValue(str);
}
Ejemplo n.º 25
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
}
Ejemplo n.º 26
0
void SeriesTool::m_slider_line_weightOnScroll(wxScrollEvent & event)
{
    if (m_series == nullptr)
        return;

    m_series->GetRenderer()->GetLine()->SetThickness(event.GetPosition());
    m_series->Validate();
}
Ejemplo n.º 27
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);
}
Ejemplo n.º 28
0
void TimelinePanel::OnSliderFinish( wxScrollEvent& event ) {
  switch (event.GetId()) {
    case SPEED_SLIDER:
      inst->song->history.record(speedChange);
      speedChange = 0;
      break;
  }
}
Ejemplo n.º 29
0
void
AnimationFrame::OnSlider_anim_gotosheet(wxScrollEvent& event)
{
	if (mAnimationView)
	{
		mAnimationView->GotoSheet(event.GetPosition()-1);
	}
}
Ejemplo n.º 30
0
void wxHexView::OnVScroll(wxScrollEvent &evt)
{
    unsigned int pos = evt.GetPosition();

	if (pos == m_curLine)
		return;
	GotoLine(pos);
}