Removed some unnecessary stuff and added some comments to WX_VIEW_CONTROLS.
This commit is contained in:
parent
961a8c2eca
commit
b03f97b991
|
@ -33,8 +33,8 @@ using namespace KiGfx;
|
||||||
WX_VIEW_CONTROLS::WX_VIEW_CONTROLS( VIEW* aView, wxWindow* aParentPanel ) :
|
WX_VIEW_CONTROLS::WX_VIEW_CONTROLS( VIEW* aView, wxWindow* aParentPanel ) :
|
||||||
VIEW_CONTROLS( aView ),
|
VIEW_CONTROLS( aView ),
|
||||||
m_state( IDLE ),
|
m_state( IDLE ),
|
||||||
m_autoPanEnabled( false ),
|
|
||||||
m_grabMouse( false ),
|
m_grabMouse( false ),
|
||||||
|
m_autoPanEnabled( false ),
|
||||||
m_autoPanMargin( 0.1 ),
|
m_autoPanMargin( 0.1 ),
|
||||||
m_autoPanSpeed( 0.15 ),
|
m_autoPanSpeed( 0.15 ),
|
||||||
m_parentPanel( aParentPanel )
|
m_parentPanel( aParentPanel )
|
||||||
|
@ -83,8 +83,6 @@ void WX_VIEW_CONTROLS::onMotion( wxMouseEvent& aEvent )
|
||||||
if( m_autoPanEnabled )
|
if( m_autoPanEnabled )
|
||||||
handleAutoPanning( aEvent );
|
handleAutoPanning( aEvent );
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeletePendingEvents();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -186,9 +184,6 @@ void WX_VIEW_CONTROLS::onTimer( wxTimerEvent& aEvent )
|
||||||
dir = dir.Resize( borderSize );
|
dir = dir.Resize( borderSize );
|
||||||
|
|
||||||
dir = m_view->ToWorld( dir, false );
|
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 );
|
m_view->SetCenter( m_view->GetCenter() + dir * m_autoPanSpeed );
|
||||||
|
|
||||||
wxPaintEvent redrawEvent;
|
wxPaintEvent redrawEvent;
|
||||||
|
@ -196,9 +191,6 @@ void WX_VIEW_CONTROLS::onTimer( wxTimerEvent& aEvent )
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
DeletePendingEvents();
|
|
||||||
m_panTimer.DeletePendingEvents();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,6 @@
|
||||||
#include <view/view_controls.h>
|
#include <view/view_controls.h>
|
||||||
|
|
||||||
class EDA_DRAW_PANEL_GAL;
|
class EDA_DRAW_PANEL_GAL;
|
||||||
class TOOL_DISPATCHER;
|
|
||||||
|
|
||||||
namespace KiGfx
|
namespace KiGfx
|
||||||
{
|
{
|
||||||
|
@ -48,7 +47,6 @@ namespace KiGfx
|
||||||
class WX_VIEW_CONTROLS : public VIEW_CONTROLS, public wxEvtHandler
|
class WX_VIEW_CONTROLS : public VIEW_CONTROLS, public wxEvtHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
WX_VIEW_CONTROLS( VIEW* aView, wxWindow* aParentPanel );
|
WX_VIEW_CONTROLS( VIEW* aView, wxWindow* aParentPanel );
|
||||||
~WX_VIEW_CONTROLS() {};
|
~WX_VIEW_CONTROLS() {};
|
||||||
|
|
||||||
|
@ -85,33 +83,38 @@ private:
|
||||||
AUTO_PANNING,
|
AUTO_PANNING,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// Computes new viewport settings while in autopanning mode
|
||||||
void handleAutoPanning( wxMouseEvent& aEvent );
|
void handleAutoPanning( wxMouseEvent& aEvent );
|
||||||
|
|
||||||
/// Current state of VIEW_CONTROLS
|
/// Current state of VIEW_CONTROLS
|
||||||
State m_state;
|
State m_state;
|
||||||
|
|
||||||
/// Options for WX_VIEW_CONTROLS
|
/// Flag for grabbing the mouse cursor
|
||||||
bool m_autoPanEnabled;
|
|
||||||
bool m_needRedraw;
|
|
||||||
bool m_grabMouse;
|
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;
|
float m_autoPanMargin;
|
||||||
/// How fast is panning when in auto mode.
|
/// How fast is panning when in auto mode
|
||||||
float m_autoPanSpeed;
|
float m_autoPanSpeed;
|
||||||
/// TODO
|
|
||||||
float m_autoPanAcceleration;
|
|
||||||
|
|
||||||
/// Panel that is affected by VIEW_CONTROLS
|
/// Panel that is affected by VIEW_CONTROLS
|
||||||
wxWindow* m_parentPanel;
|
wxWindow* m_parentPanel;
|
||||||
|
|
||||||
/// Stores information about point where event started.
|
/// Stores information about point where dragging has started
|
||||||
VECTOR2D m_dragStartPoint;
|
VECTOR2D m_dragStartPoint;
|
||||||
|
|
||||||
|
/// Stores information about the center of viewport when dragging has started
|
||||||
VECTOR2D m_lookStartPoint;
|
VECTOR2D m_lookStartPoint;
|
||||||
|
|
||||||
|
/// Current direction of panning (only autopanning mode)
|
||||||
VECTOR2D m_panDirection;
|
VECTOR2D m_panDirection;
|
||||||
|
|
||||||
/// Used for determining time intervals between events.
|
/// Used for determining time intervals between scroll & zoom events
|
||||||
wxLongLong m_timeStamp;
|
wxLongLong m_timeStamp;
|
||||||
|
|
||||||
|
/// Timer repsonsible for handling autopanning
|
||||||
wxTimer m_panTimer;
|
wxTimer m_panTimer;
|
||||||
};
|
};
|
||||||
} // namespace KiGfx
|
} // namespace KiGfx
|
||||||
|
|
Loading…
Reference in New Issue