CURSOR does not take mpWindow* in constructor
This commit is contained in:
parent
0b0885f6cd
commit
cd25e62052
|
@ -31,6 +31,9 @@
|
||||||
|
|
||||||
void CURSOR::Plot( wxDC& aDC, mpWindow& aWindow )
|
void CURSOR::Plot( wxDC& aDC, mpWindow& aWindow )
|
||||||
{
|
{
|
||||||
|
if( !m_window )
|
||||||
|
m_window = &aWindow;
|
||||||
|
|
||||||
if( !m_visible )
|
if( !m_visible )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -80,7 +83,7 @@ void CURSOR::Plot( wxDC& aDC, mpWindow& aWindow )
|
||||||
const int horLen = aWindow.GetScrX();
|
const int horLen = aWindow.GetScrX();
|
||||||
const int verLen = aWindow.GetScrY();
|
const int verLen = aWindow.GetScrY();
|
||||||
|
|
||||||
const wxPoint cursorPos( m_window->x2p( m_coords.x ), m_window->y2p( m_coords.y ) );
|
const wxPoint cursorPos( aWindow.x2p( m_coords.x ), aWindow.y2p( m_coords.y ) );
|
||||||
|
|
||||||
aDC.SetPen( wxPen( *wxBLACK, 1, m_continuous ? wxSOLID : wxLONG_DASH ) );
|
aDC.SetPen( wxPen( *wxBLACK, 1, m_continuous ? wxSOLID : wxLONG_DASH ) );
|
||||||
|
|
||||||
|
|
|
@ -61,9 +61,9 @@ private:
|
||||||
class CURSOR : public mpInfoLayer
|
class CURSOR : public mpInfoLayer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CURSOR( const TRACE* aTrace, mpWindow* aWindow )
|
CURSOR( const TRACE* aTrace )
|
||||||
: mpInfoLayer( wxRect( 0, 0, DRAG_MARGIN, DRAG_MARGIN ), wxTRANSPARENT_BRUSH ),
|
: mpInfoLayer( wxRect( 0, 0, DRAG_MARGIN, DRAG_MARGIN ), wxTRANSPARENT_BRUSH ),
|
||||||
m_trace( aTrace ), m_moved( false ), m_coords( 0.0, 0.0 ), m_window( aWindow )
|
m_trace( aTrace ), m_moved( false ), m_coords( 0.0, 0.0 ), m_window( nullptr )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,6 +71,9 @@ public:
|
||||||
|
|
||||||
bool Inside( wxPoint& aPoint )
|
bool Inside( wxPoint& aPoint )
|
||||||
{
|
{
|
||||||
|
if( !m_window )
|
||||||
|
return false;
|
||||||
|
|
||||||
return ( std::abs( aPoint.x - m_window->x2p( m_coords.x ) ) <= DRAG_MARGIN )
|
return ( std::abs( aPoint.x - m_window->x2p( m_coords.x ) ) <= DRAG_MARGIN )
|
||||||
&& ( std::abs( aPoint.y - m_window->y2p( m_coords.y ) ) <= DRAG_MARGIN );
|
&& ( std::abs( aPoint.y - m_window->y2p( m_coords.y ) ) <= DRAG_MARGIN );
|
||||||
}
|
}
|
||||||
|
@ -83,6 +86,9 @@ public:
|
||||||
|
|
||||||
void UpdateReference()
|
void UpdateReference()
|
||||||
{
|
{
|
||||||
|
if( !m_window )
|
||||||
|
return;
|
||||||
|
|
||||||
m_reference.x = m_window->x2p( m_coords.x );
|
m_reference.x = m_window->x2p( m_coords.x );
|
||||||
m_reference.y = m_window->y2p( m_coords.y );
|
m_reference.y = m_window->y2p( m_coords.y );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue