Exemple #1
0
void BaseEditor::OnMouseWheelEvt(wxMouseEvent& event)
{
	int lines = -event.GetWheelRotation() / event.GetWheelDelta();

	if (event.ShiftDown())
	{
		int nPos = GetScrollPos(wxHORIZONTAL);
		SetScrollPos(wxHORIZONTAL, nPos + lines * event.GetLinesPerAction() * SCROLL_LINE_DISTANCE);
		UpdateScrollPosition(GetScrollPos(wxHORIZONTAL), GetScrollPos(wxVERTICAL));
	}
	else if (event.ControlDown())
	{
		if (lines < 0)
		{
			ZoomIn();
		}
		else
		{
			ZoomOut();
		}
	}
	else
	{
		int nPos = GetScrollPos(wxVERTICAL);
		SetScrollPos(wxVERTICAL, nPos + lines * event.GetLinesPerAction() * SCROLL_LINE_DISTANCE);
		UpdateScrollPosition(GetScrollPos(wxHORIZONTAL), GetScrollPos(wxVERTICAL));
	}
}
Exemple #2
0
void DocHistory::OnMouseWheel(wxMouseEvent& event) {
	if (GetScrollThumb(wxVERTICAL)) { // Only handle scrollwheel if we have a scrollbar
		const wxSize size = GetClientSize();
		int pos = m_scrollPos;
		const int rotation = event.GetWheelRotation();
		const int linescount = (abs(rotation) / event.GetWheelDelta()) * event.GetLinesPerAction();

		if (rotation > 0) { // up
			pos = pos - (pos % m_lineHeight) - (m_lineHeight * linescount);
			if (pos < 0) pos = 0;
		}
		else if (rotation < 0) { // down
			pos = pos - (pos % m_lineHeight) + (m_lineHeight * linescount);
			if (pos > m_treeHeight - size.y) pos = m_treeHeight - size.y;
		}
		else return; // no rotation

		if (pos != m_scrollPos) {
			m_oldScrollPos = m_scrollPos;
			m_scrollPos = pos;
			m_isScrolling = true;

			wxClientDC dc(this);
			DrawLayout(dc);
		}
	}
}
Exemple #3
0
void SpectraDocumentFrame::HandleMouseWheel(const wxMouseEvent& event)
{
	document_view.Zoom(
		GLfloat(event.GetLinesPerAction())*
		GLfloat(event.GetWheelRotation())/
		GLfloat(event.GetWheelDelta())
	);
}
Exemple #4
0
void OSGCanvas::OnMouseWheel(wxMouseEvent &event)
{
    int delta = event.GetWheelRotation() / event.GetWheelDelta() * event.GetLinesPerAction();

    if (_graphics_window.valid()) {
        _graphics_window->getEventQueue()->mouseScroll(
            delta>0 ? 
            osgGA::GUIEventAdapter::SCROLL_UP : 
            osgGA::GUIEventAdapter::SCROLL_DOWN);
    }
}
Exemple #5
0
void CCodeView::OnScrollWheel(wxMouseEvent& event)
{
  const bool scroll_down = (event.GetWheelRotation() < 0);
  const int num_lines = event.GetLinesPerAction();

  if (scroll_down)
  {
    m_curAddress += num_lines * 4;
  }
  else
  {
    m_curAddress -= num_lines * 4;
  }

  Refresh();
  event.Skip();
}
Exemple #6
0
void wxVScrolledWindow::OnMouseWheel(wxMouseEvent& event)
{
    m_sumWheelRotation += event.GetWheelRotation();
    int delta = event.GetWheelDelta();

    // how much to scroll this time
    int units_to_scroll = -(m_sumWheelRotation/delta);
    if ( !units_to_scroll )
        return;

    m_sumWheelRotation += units_to_scroll*delta;

    if ( !event.IsPageScroll() )
        ScrollLines( units_to_scroll*event.GetLinesPerAction() );
    else
        // scroll pages instead of lines
        ScrollPages( units_to_scroll );
}
Exemple #7
0
 void MapGLCanvas::OnMouseWheel(wxMouseEvent& event) {
     m_ignoreNextClick = false;
     float delta = static_cast<float>(event.GetWheelRotation()) / event.GetWheelDelta() * event.GetLinesPerAction();
     if (event.GetWheelAxis() == wxMOUSE_WHEEL_HORIZONTAL)
         m_inputController->scroll(delta, 0.0f);
     else if (event.GetWheelAxis() == wxMOUSE_WHEEL_VERTICAL)
         m_inputController->scroll(0.0f, delta);
 }
void WaterfallCanvas::OnMouseWheelMoved(wxMouseEvent& event) {
    InteractiveCanvas::OnMouseWheelMoved(event);
    float movement = (float)event.GetWheelRotation() / (float)event.GetLinesPerAction();

    mouseZoom = 1.0f - movement/1000.0f;
}
Exemple #9
0
int bmx_wxmouseevent_getlinesperaction(wxMouseEvent & event) {
	return event.GetLinesPerAction();
}