Dim GAL cursor when forced but no interactive tool
This makes it clearer when a tool is active, otherwise interactive tool effects like auto-pan can come as a surprise when the cursor is forced to display all the time.
This commit is contained in:
parent
78a5185857
commit
01c733bdb5
|
@ -969,9 +969,11 @@ void CAIRO_GAL::initCursor()
|
||||||
|
|
||||||
wxMemoryDC cursorShape( *cursorPixels );
|
wxMemoryDC cursorShape( *cursorPixels );
|
||||||
|
|
||||||
|
const auto cColor = getCursorColor();
|
||||||
|
|
||||||
cursorShape.SetBackground( *wxTRANSPARENT_BRUSH );
|
cursorShape.SetBackground( *wxTRANSPARENT_BRUSH );
|
||||||
wxColour color( cursorColor.r * cursorColor.a * 255, cursorColor.g * cursorColor.a * 255,
|
wxColour color( cColor.r * cColor.a * 255, cColor.g * cColor.a * 255,
|
||||||
cursorColor.b * cursorColor.a * 255, 255 );
|
cColor.b * cColor.a * 255, 255 );
|
||||||
wxPen pen = wxPen( color );
|
wxPen pen = wxPen( color );
|
||||||
cursorShape.SetPen( pen );
|
cursorShape.SetPen( pen );
|
||||||
cursorShape.Clear();
|
cursorShape.Clear();
|
||||||
|
@ -983,15 +985,18 @@ void CAIRO_GAL::initCursor()
|
||||||
|
|
||||||
void CAIRO_GAL::blitCursor( wxMemoryDC& clientDC )
|
void CAIRO_GAL::blitCursor( wxMemoryDC& clientDC )
|
||||||
{
|
{
|
||||||
if( !isCursorEnabled )
|
if( !IsCursorEnabled() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto p = ToScreen( cursorPosition );
|
auto p = ToScreen( cursorPosition );
|
||||||
|
|
||||||
clientDC.SetPen( *wxWHITE_PEN );
|
const auto cColor = getCursorColor();
|
||||||
|
|
||||||
|
wxColour color( cColor.r * cColor.a * 255, cColor.g * cColor.a * 255,
|
||||||
|
cColor.b * cColor.a * 255, 255 );
|
||||||
|
clientDC.SetPen( wxPen( color ) );
|
||||||
clientDC.DrawLine( p.x - cursorSize / 2, p.y, p.x + cursorSize / 2, p.y );
|
clientDC.DrawLine( p.x - cursorSize / 2, p.y, p.x + cursorSize / 2, p.y );
|
||||||
clientDC.DrawLine( p.x, p.y - cursorSize / 2, p.x, p.y + cursorSize / 2 );
|
clientDC.DrawLine( p.x, p.y - cursorSize / 2, p.x, p.y + cursorSize / 2 );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -377,3 +377,18 @@ VECTOR2D GAL::GetGridPoint( const VECTOR2D& aPoint ) const
|
||||||
const int GAL::MIN_DEPTH = -1024;
|
const int GAL::MIN_DEPTH = -1024;
|
||||||
const int GAL::MAX_DEPTH = 1023;
|
const int GAL::MAX_DEPTH = 1023;
|
||||||
const int GAL::GRID_DEPTH = MAX_DEPTH - 1;
|
const int GAL::GRID_DEPTH = MAX_DEPTH - 1;
|
||||||
|
|
||||||
|
|
||||||
|
COLOR4D GAL::getCursorColor() const
|
||||||
|
{
|
||||||
|
auto color = cursorColor;
|
||||||
|
|
||||||
|
// dim the cursor if it's only on because it was forced
|
||||||
|
// (this helps to provide a hint for active tools)
|
||||||
|
if( !isCursorEnabled )
|
||||||
|
{
|
||||||
|
color.a = color.a * 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
|
@ -1657,7 +1657,7 @@ void OPENGL_GAL::skipMouseEvent( wxMouseEvent& aEvent )
|
||||||
|
|
||||||
void OPENGL_GAL::blitCursor()
|
void OPENGL_GAL::blitCursor()
|
||||||
{
|
{
|
||||||
if( !isCursorEnabled )
|
if( !IsCursorEnabled() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
compositor->SetBuffer( OPENGL_COMPOSITOR::DIRECT_RENDERING );
|
compositor->SetBuffer( OPENGL_COMPOSITOR::DIRECT_RENDERING );
|
||||||
|
@ -1666,9 +1666,13 @@ void OPENGL_GAL::blitCursor()
|
||||||
VECTOR2D cursorEnd = cursorPosition + cursorSize / ( 2 * worldScale );
|
VECTOR2D cursorEnd = cursorPosition + cursorSize / ( 2 * worldScale );
|
||||||
VECTOR2D cursorCenter = ( cursorBegin + cursorEnd ) / 2;
|
VECTOR2D cursorCenter = ( cursorBegin + cursorEnd ) / 2;
|
||||||
|
|
||||||
|
const COLOR4D cColor = getCursorColor();
|
||||||
|
const COLOR4D color( cColor.r * cColor.a, cColor.g * cColor.a,
|
||||||
|
cColor.b * cColor.a, 1.0 );
|
||||||
|
|
||||||
glDisable( GL_TEXTURE_2D );
|
glDisable( GL_TEXTURE_2D );
|
||||||
glLineWidth( 1.0 );
|
glLineWidth( 1.0 );
|
||||||
glColor4d( cursorColor.r, cursorColor.g, cursorColor.b, cursorColor.a );
|
glColor4d( color.r, color.g, color.b, color.a );
|
||||||
|
|
||||||
glBegin( GL_LINES );
|
glBegin( GL_LINES );
|
||||||
glVertex2d( cursorCenter.x, cursorBegin.y );
|
glVertex2d( cursorCenter.x, cursorBegin.y );
|
||||||
|
|
|
@ -1055,6 +1055,11 @@ protected:
|
||||||
/// Depth level on which the grid is drawn
|
/// Depth level on which the grid is drawn
|
||||||
static const int GRID_DEPTH;
|
static const int GRID_DEPTH;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the actual cursor color to draw
|
||||||
|
*/
|
||||||
|
COLOR4D getCursorColor() const;
|
||||||
|
|
||||||
// ---------------
|
// ---------------
|
||||||
// Settings observer interface
|
// Settings observer interface
|
||||||
// ---------------
|
// ---------------
|
||||||
|
|
Loading…
Reference in New Issue