From b03f97b99183d4378c02b8e85865881282d86df2 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Fri, 23 Aug 2013 10:56:52 +0200 Subject: [PATCH] Removed some unnecessary stuff and added some comments to WX_VIEW_CONTROLS. --- common/view/wx_view_controls.cpp | 10 +--------- include/view/wx_view_controls.h | 25 ++++++++++++++----------- 2 files changed, 15 insertions(+), 20 deletions(-) diff --git a/common/view/wx_view_controls.cpp b/common/view/wx_view_controls.cpp index 7b0dfb1d4d..ad37050336 100644 --- a/common/view/wx_view_controls.cpp +++ b/common/view/wx_view_controls.cpp @@ -33,8 +33,8 @@ using namespace KiGfx; WX_VIEW_CONTROLS::WX_VIEW_CONTROLS( VIEW* aView, wxWindow* aParentPanel ) : VIEW_CONTROLS( aView ), m_state( IDLE ), - m_autoPanEnabled( false ), m_grabMouse( false ), + m_autoPanEnabled( false ), m_autoPanMargin( 0.1 ), m_autoPanSpeed( 0.15 ), m_parentPanel( aParentPanel ) @@ -83,8 +83,6 @@ void WX_VIEW_CONTROLS::onMotion( wxMouseEvent& aEvent ) if( m_autoPanEnabled ) handleAutoPanning( aEvent ); } - -// DeletePendingEvents(); } @@ -186,9 +184,6 @@ void WX_VIEW_CONTROLS::onTimer( wxTimerEvent& aEvent ) dir = dir.Resize( borderSize ); dir = m_view->ToWorld( dir, false ); - -// wxLogDebug( "AutoPanningTimer: dir %.4f %.4f sped %.4f", dir.x, dir.y, m_autoPanSpeed ); - m_view->SetCenter( m_view->GetCenter() + dir * m_autoPanSpeed ); wxPaintEvent redrawEvent; @@ -196,9 +191,6 @@ void WX_VIEW_CONTROLS::onTimer( wxTimerEvent& aEvent ) } break; } - - DeletePendingEvents(); - m_panTimer.DeletePendingEvents(); } diff --git a/include/view/wx_view_controls.h b/include/view/wx_view_controls.h index ca2d9b679d..bbd55f3856 100644 --- a/include/view/wx_view_controls.h +++ b/include/view/wx_view_controls.h @@ -37,7 +37,6 @@ #include class EDA_DRAW_PANEL_GAL; -class TOOL_DISPATCHER; namespace KiGfx { @@ -48,7 +47,6 @@ namespace KiGfx class WX_VIEW_CONTROLS : public VIEW_CONTROLS, public wxEvtHandler { public: - WX_VIEW_CONTROLS( VIEW* aView, wxWindow* aParentPanel ); ~WX_VIEW_CONTROLS() {}; @@ -85,33 +83,38 @@ private: AUTO_PANNING, }; + /// Computes new viewport settings while in autopanning mode void handleAutoPanning( wxMouseEvent& aEvent ); /// Current state of VIEW_CONTROLS State m_state; - /// Options for WX_VIEW_CONTROLS - bool m_autoPanEnabled; - bool m_needRedraw; + /// Flag for grabbing the mouse cursor bool m_grabMouse; + /// Flag for turning on autopanning + bool m_autoPanEnabled; - /// Distance from cursor to VIEW edge when panning is active. + /// Distance from cursor to VIEW edge when panning is active float m_autoPanMargin; - /// How fast is panning when in auto mode. + /// How fast is panning when in auto mode float m_autoPanSpeed; - /// TODO - float m_autoPanAcceleration; /// Panel that is affected by VIEW_CONTROLS wxWindow* m_parentPanel; - /// Stores information about point where event started. + /// Stores information about point where dragging has started VECTOR2D m_dragStartPoint; + + /// Stores information about the center of viewport when dragging has started VECTOR2D m_lookStartPoint; + + /// Current direction of panning (only autopanning mode) VECTOR2D m_panDirection; - /// Used for determining time intervals between events. + /// Used for determining time intervals between scroll & zoom events wxLongLong m_timeStamp; + + /// Timer repsonsible for handling autopanning wxTimer m_panTimer; }; } // namespace KiGfx