Allow GAL cursor to be always displayed
A new items is added to the GAL display options (and the dialog), and a hotkey (Ctrl+Shift+x) is added to toggle it. Fixes: lp:1673633 * https://bugs.launchpad.net/kicad/+bug/1673633
This commit is contained in:
parent
45b10f0f09
commit
78a5185857
|
@ -36,6 +36,7 @@ static const wxString GalGridStyleConfig( "GridStyle" );
|
||||||
static const wxString GalGridLineWidthConfig( "GridLineWidth" );
|
static const wxString GalGridLineWidthConfig( "GridLineWidth" );
|
||||||
static const wxString GalGridMaxDensityConfig( "GridMaxDensity" );
|
static const wxString GalGridMaxDensityConfig( "GridMaxDensity" );
|
||||||
static const wxString GalGridAxesEnabledConfig( "GridAxesEnabled" );
|
static const wxString GalGridAxesEnabledConfig( "GridAxesEnabled" );
|
||||||
|
static const wxString GalForceDisplayCursorConfig( "ForceDisplayCursor" );
|
||||||
|
|
||||||
|
|
||||||
static const UTIL::CFG_MAP<KIGFX::OPENGL_ANTIALIASING_MODE> aaModeConfigVals =
|
static const UTIL::CFG_MAP<KIGFX::OPENGL_ANTIALIASING_MODE> aaModeConfigVals =
|
||||||
|
@ -60,8 +61,9 @@ GAL_DISPLAY_OPTIONS::GAL_DISPLAY_OPTIONS()
|
||||||
: gl_antialiasing_mode( OPENGL_ANTIALIASING_MODE::NONE ),
|
: gl_antialiasing_mode( OPENGL_ANTIALIASING_MODE::NONE ),
|
||||||
m_gridStyle( GRID_STYLE::DOTS ),
|
m_gridStyle( GRID_STYLE::DOTS ),
|
||||||
m_gridLineWidth( 0.5 ),
|
m_gridLineWidth( 0.5 ),
|
||||||
m_gridMinSpacing( 10 ),
|
m_gridMinSpacing( 10.0 ),
|
||||||
m_axesEnabled( false )
|
m_axesEnabled( false ),
|
||||||
|
m_forceDisplayCursor( false )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
@ -86,6 +88,9 @@ void GAL_DISPLAY_OPTIONS::ReadConfig( wxConfigBase* aCfg, wxString aBaseName )
|
||||||
aCfg->Read( aBaseName + GalGridAxesEnabledConfig,
|
aCfg->Read( aBaseName + GalGridAxesEnabledConfig,
|
||||||
&m_axesEnabled, false );
|
&m_axesEnabled, false );
|
||||||
|
|
||||||
|
aCfg->Read( aBaseName + GalForceDisplayCursorConfig,
|
||||||
|
&m_forceDisplayCursor, false );
|
||||||
|
|
||||||
NotifyChanged();
|
NotifyChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,6 +111,9 @@ void GAL_DISPLAY_OPTIONS::WriteConfig( wxConfigBase* aCfg, wxString aBaseName )
|
||||||
|
|
||||||
aCfg->Write( aBaseName + GalGridAxesEnabledConfig,
|
aCfg->Write( aBaseName + GalGridAxesEnabledConfig,
|
||||||
m_axesEnabled );
|
m_axesEnabled );
|
||||||
|
|
||||||
|
aCfg->Write( aBaseName + GalForceDisplayCursorConfig,
|
||||||
|
m_forceDisplayCursor );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -67,6 +67,7 @@ GAL::GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions ) :
|
||||||
SetCursorColor( COLOR4D( 1.0, 1.0, 1.0, 1.0 ) );
|
SetCursorColor( COLOR4D( 1.0, 1.0, 1.0, 1.0 ) );
|
||||||
SetCursorSize( 80 );
|
SetCursorSize( 80 );
|
||||||
SetCursorEnabled( false );
|
SetCursorEnabled( false );
|
||||||
|
forceDisplayCursor = false;
|
||||||
|
|
||||||
strokeFont.LoadNewStrokeFont( newstroke_font, newstroke_font_bufsize );
|
strokeFont.LoadNewStrokeFont( newstroke_font, newstroke_font_bufsize );
|
||||||
|
|
||||||
|
@ -117,6 +118,12 @@ bool GAL::updatedGalDisplayOptions( const GAL_DISPLAY_OPTIONS& aOptions )
|
||||||
refresh = true;
|
refresh = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( options.m_forceDisplayCursor != forceDisplayCursor )
|
||||||
|
{
|
||||||
|
forceDisplayCursor = options.m_forceDisplayCursor;
|
||||||
|
refresh = true;
|
||||||
|
}
|
||||||
|
|
||||||
// tell the derived class if the base class needs an update or not
|
// tell the derived class if the base class needs an update or not
|
||||||
return refresh;
|
return refresh;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,13 @@
|
||||||
|
|
||||||
#include <tool/common_tools.h>
|
#include <tool/common_tools.h>
|
||||||
|
|
||||||
|
|
||||||
|
static TOOL_ACTION ACT_toggleCursor( "common.Control.toggleCursor",
|
||||||
|
AS_GLOBAL, MD_CTRL + MD_SHIFT + 'X',
|
||||||
|
_( "Toggle Always Show Cursor" ),
|
||||||
|
_( "Toogle display of the cursor, even when not in an interactive tool" ) );
|
||||||
|
|
||||||
|
|
||||||
COMMON_TOOLS::COMMON_TOOLS() :
|
COMMON_TOOLS::COMMON_TOOLS() :
|
||||||
TOOL_INTERACTIVE( "common.Control" ), m_frame( NULL )
|
TOOL_INTERACTIVE( "common.Control" ), m_frame( NULL )
|
||||||
{
|
{
|
||||||
|
@ -188,6 +195,17 @@ int COMMON_TOOLS::GridPreset( const TOOL_EVENT& aEvent )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int COMMON_TOOLS::ToggleCursor( const TOOL_EVENT& aEvent )
|
||||||
|
{
|
||||||
|
auto& galOpts = m_frame->GetGalDisplayOptions();
|
||||||
|
|
||||||
|
galOpts.m_forceDisplayCursor = !galOpts.m_forceDisplayCursor;
|
||||||
|
galOpts.NotifyChanged();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void COMMON_TOOLS::SetTransitions()
|
void COMMON_TOOLS::SetTransitions()
|
||||||
{
|
{
|
||||||
Go( &COMMON_TOOLS::ZoomInOut, ACTIONS::zoomIn.MakeEvent() );
|
Go( &COMMON_TOOLS::ZoomInOut, ACTIONS::zoomIn.MakeEvent() );
|
||||||
|
@ -201,6 +219,8 @@ void COMMON_TOOLS::SetTransitions()
|
||||||
Go( &COMMON_TOOLS::GridNext, ACTIONS::gridNext.MakeEvent() );
|
Go( &COMMON_TOOLS::GridNext, ACTIONS::gridNext.MakeEvent() );
|
||||||
Go( &COMMON_TOOLS::GridPrev, ACTIONS::gridPrev.MakeEvent() );
|
Go( &COMMON_TOOLS::GridPrev, ACTIONS::gridPrev.MakeEvent() );
|
||||||
Go( &COMMON_TOOLS::GridPreset, ACTIONS::gridPreset.MakeEvent() );
|
Go( &COMMON_TOOLS::GridPreset, ACTIONS::gridPreset.MakeEvent() );
|
||||||
|
|
||||||
|
Go( &COMMON_TOOLS::ToggleCursor, ACT_toggleCursor.MakeEvent() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,9 @@ void VIEW_CONTROLS::ShowCursor( bool aEnabled )
|
||||||
|
|
||||||
bool VIEW_CONTROLS::IsCursorShown() const
|
bool VIEW_CONTROLS::IsCursorShown() const
|
||||||
{
|
{
|
||||||
assert( m_settings.m_showCursor == m_view->GetGAL()->IsCursorEnabled() );
|
// this only says if the VIEW_CONTROLS say the cursor should be
|
||||||
|
// shown: m_view->GetGAL()->IsCursorEnabled() will say if the GAL is
|
||||||
|
// actually going to do show the cursor or not
|
||||||
return m_settings.m_showCursor;
|
return m_settings.m_showCursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -159,7 +159,7 @@ GAL_OPTIONS_PANEL::GAL_OPTIONS_PANEL( wxWindow* aParent, KIGFX::GAL_DISPLAY_OPTI
|
||||||
|
|
||||||
sGridSettings->Add( sGridSettingsGrid, 1, wxALL|wxEXPAND, 5 );
|
sGridSettings->Add( sGridSettingsGrid, 1, wxALL|wxEXPAND, 5 );
|
||||||
|
|
||||||
sLeftSizer->Add( sGridSettings, 1, wxALL | wxEXPAND, 5 );
|
sLeftSizer->Add( sGridSettings, 0, wxALL | wxEXPAND, 5 );
|
||||||
|
|
||||||
// bind the spin buttons and text boxes
|
// bind the spin buttons and text boxes
|
||||||
m_gridSizeIncrementer = std::make_unique<SPIN_INCREMENTAL_TEXT_CTRL>(
|
m_gridSizeIncrementer = std::make_unique<SPIN_INCREMENTAL_TEXT_CTRL>(
|
||||||
|
@ -176,6 +176,18 @@ GAL_OPTIONS_PANEL::GAL_OPTIONS_PANEL( wxWindow* aParent, KIGFX::GAL_DISPLAY_OPTI
|
||||||
gridMinSpacingStep );
|
gridMinSpacingStep );
|
||||||
m_gridMinSpacingIncrementer->SetPrecision( 0 ); // restrict to ints
|
m_gridMinSpacingIncrementer->SetPrecision( 0 ); // restrict to ints
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
auto sCursorSettings = new wxStaticBoxSizer( new wxStaticBox( this,
|
||||||
|
wxID_ANY, _("Cursor Display (OpenGL && Cairo)") ), wxVERTICAL );
|
||||||
|
|
||||||
|
sLeftSizer->Add( sCursorSettings, 1, wxALL | wxEXPAND, 5 );
|
||||||
|
|
||||||
|
m_forceCursorDisplay = new wxCheckBox( this, wxID_ANY, _( "Always display cursor" ) );
|
||||||
|
|
||||||
|
sCursorSettings->Add( m_forceCursorDisplay, 0, wxALL | wxEXPAND, 5 );
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -191,6 +203,8 @@ bool GAL_OPTIONS_PANEL::TransferDataToWindow()
|
||||||
|
|
||||||
m_gridMinSpacingIncrementer->SetValue( m_galOptions.m_gridMinSpacing );
|
m_gridMinSpacingIncrementer->SetValue( m_galOptions.m_gridMinSpacing );
|
||||||
|
|
||||||
|
m_forceCursorDisplay->SetValue( m_galOptions.m_forceDisplayCursor );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,6 +221,8 @@ bool GAL_OPTIONS_PANEL::TransferDataFromWindow()
|
||||||
|
|
||||||
m_galOptions.m_gridMinSpacing = m_gridMinSpacingIncrementer->GetValue();
|
m_galOptions.m_gridMinSpacing = m_gridMinSpacingIncrementer->GetValue();
|
||||||
|
|
||||||
|
m_galOptions.m_forceDisplayCursor = m_forceCursorDisplay->GetValue();
|
||||||
|
|
||||||
m_galOptions.NotifyChanged();
|
m_galOptions.NotifyChanged();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -84,6 +84,9 @@ namespace KIGFX
|
||||||
|
|
||||||
///> Whether or not to draw the coordinate system axes
|
///> Whether or not to draw the coordinate system axes
|
||||||
bool m_axesEnabled;
|
bool m_axesEnabled;
|
||||||
|
|
||||||
|
///> Force cursor display
|
||||||
|
bool m_forceDisplayCursor;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -904,7 +904,7 @@ public:
|
||||||
*/
|
*/
|
||||||
bool IsCursorEnabled() const
|
bool IsCursorEnabled() const
|
||||||
{
|
{
|
||||||
return isCursorEnabled;
|
return isCursorEnabled || forceDisplayCursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1019,6 +1019,7 @@ protected:
|
||||||
|
|
||||||
// Cursor settings
|
// Cursor settings
|
||||||
bool isCursorEnabled; ///< Is the cursor enabled?
|
bool isCursorEnabled; ///< Is the cursor enabled?
|
||||||
|
bool forceDisplayCursor; ///< Always show cursor
|
||||||
COLOR4D cursorColor; ///< Cursor color
|
COLOR4D cursorColor; ///< Cursor color
|
||||||
unsigned int cursorSize; ///< Size of the cursor in pixels
|
unsigned int cursorSize; ///< Size of the cursor in pixels
|
||||||
VECTOR2D cursorPosition; ///< Current cursor position (world coordinates)
|
VECTOR2D cursorPosition; ///< Current cursor position (world coordinates)
|
||||||
|
|
|
@ -51,6 +51,9 @@ public:
|
||||||
int ZoomFitScreen( const TOOL_EVENT& aEvent );
|
int ZoomFitScreen( const TOOL_EVENT& aEvent );
|
||||||
int ZoomPreset( const TOOL_EVENT& aEvent );
|
int ZoomPreset( const TOOL_EVENT& aEvent );
|
||||||
|
|
||||||
|
// Cursor control
|
||||||
|
int ToggleCursor( const TOOL_EVENT& aEvent );
|
||||||
|
|
||||||
// Grid control
|
// Grid control
|
||||||
int GridNext( const TOOL_EVENT& aEvent );
|
int GridNext( const TOOL_EVENT& aEvent );
|
||||||
int GridPrev( const TOOL_EVENT& aEvent );
|
int GridPrev( const TOOL_EVENT& aEvent );
|
||||||
|
|
|
@ -52,16 +52,21 @@ private:
|
||||||
wxBoxSizer* m_mainSizer;
|
wxBoxSizer* m_mainSizer;
|
||||||
|
|
||||||
wxChoice* m_choiceAntialiasing;
|
wxChoice* m_choiceAntialiasing;
|
||||||
|
|
||||||
wxRadioBox* m_gridStyle;
|
wxRadioBox* m_gridStyle;
|
||||||
|
|
||||||
wxStaticText* l_gridLineWidth;
|
wxStaticText* l_gridLineWidth;
|
||||||
wxTextCtrl* m_gridLineWidth;
|
wxTextCtrl* m_gridLineWidth;
|
||||||
wxSpinButton* m_gridLineWidthSpinBtn;
|
wxSpinButton* m_gridLineWidthSpinBtn;
|
||||||
wxStaticText* l_gridLineWidthUnits;
|
wxStaticText* l_gridLineWidthUnits;
|
||||||
|
|
||||||
wxStaticText* l_gridMinSpacing;
|
wxStaticText* l_gridMinSpacing;
|
||||||
wxTextCtrl* m_gridMinSpacing;
|
wxTextCtrl* m_gridMinSpacing;
|
||||||
wxSpinButton* m_gridMinSpacingSpinBtn;
|
wxSpinButton* m_gridMinSpacingSpinBtn;
|
||||||
wxStaticText* l_gridMinSpacingUnits;
|
wxStaticText* l_gridMinSpacingUnits;
|
||||||
|
|
||||||
|
wxCheckBox* m_forceCursorDisplay;
|
||||||
|
|
||||||
///> The GAL options to read/write
|
///> The GAL options to read/write
|
||||||
KIGFX::GAL_DISPLAY_OPTIONS& m_galOptions;
|
KIGFX::GAL_DISPLAY_OPTIONS& m_galOptions;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue