Removed some unnecessary stuff and added some comments to WX_VIEW_CONTROLS.

This commit is contained in:
Maciej Suminski 2013-08-23 10:56:52 +02:00
parent 961a8c2eca
commit b03f97b991
2 changed files with 15 additions and 20 deletions

View File

@ -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();
}

View File

@ -37,7 +37,6 @@
#include <view/view_controls.h>
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