Move cursor shape flag into GAL settings

The motivation here is to concentrate display options in the GAL display
settings, ready for removal of legacy canvases. Instead of having the
property as a member of the DRAW_FRAME, with the GAL canvas retreiving
it from there, it is now in the GAL_DISPLAY_OPTIONS struct, and both GAL
and legacy get it from there.

The options for setting cursor shape are then moved out of the general
options dialog, and into the GAL display options widget, where they can
be used in all GAL-aware programs.

GAL cursor shape works on GAL, but not legacy, so the option is now
available on OSX (but only affects GAL, and is labelled as such).
This commit is contained in:
John Beard 2017-03-20 04:51:59 +08:00 committed by Maciej Suminski
parent b4a4748672
commit b8edecc10f
20 changed files with 88 additions and 197 deletions

View File

@ -66,8 +66,6 @@ static const wxString traceScrollSettings( wxT( "KicadScrollSettings" ) );
///@{ ///@{
/// \ingroup config /// \ingroup config
/// Nonzero iff fullscreen cursor is to be used (suffix)
static const wxString CursorShapeEntryKeyword( wxT( "CursorShape" ) );
/// Nonzero to show grid (suffix) /// Nonzero to show grid (suffix)
static const wxString ShowGridEntryKeyword( wxT( "ShowGrid" ) ); static const wxString ShowGridEntryKeyword( wxT( "ShowGrid" ) );
/// Grid color ID (suffix) /// Grid color ID (suffix)
@ -154,7 +152,6 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent,
m_showBorderAndTitleBlock = false; // true to display reference sheet. m_showBorderAndTitleBlock = false; // true to display reference sheet.
m_showGridAxis = false; // true to draw the grid axis m_showGridAxis = false; // true to draw the grid axis
m_showOriginAxis = false; // true to draw the grid origin m_showOriginAxis = false; // true to draw the grid origin
m_cursorShape = 0;
m_LastGridSizeId = 0; m_LastGridSizeId = 0;
m_drawGrid = true; // hide/Show grid. default = show m_drawGrid = true; // hide/Show grid. default = show
m_gridColor = COLOR4D( DARKGRAY ); // Default grid color m_gridColor = COLOR4D( DARKGRAY ); // Default grid color
@ -318,7 +315,11 @@ void EDA_DRAW_FRAME::OnToggleCrossHairStyle( wxCommandEvent& aEvent )
{ {
INSTALL_UNBUFFERED_DC( dc, m_canvas ); INSTALL_UNBUFFERED_DC( dc, m_canvas );
m_canvas->CrossHairOff( &dc ); m_canvas->CrossHairOff( &dc );
SetCursorShape( !GetCursorShape() );
auto& galOpts = GetGalDisplayOptions();
galOpts.m_fullscreenCursor = !galOpts.m_fullscreenCursor;
galOpts.NotifyChanged();
m_canvas->CrossHairOn( &dc ); m_canvas->CrossHairOn( &dc );
} }
@ -360,7 +361,7 @@ void EDA_DRAW_FRAME::OnUpdateGrid( wxUpdateUIEvent& aEvent )
void EDA_DRAW_FRAME::OnUpdateCrossHairStyle( wxUpdateUIEvent& aEvent ) void EDA_DRAW_FRAME::OnUpdateCrossHairStyle( wxUpdateUIEvent& aEvent )
{ {
aEvent.Check( m_cursorShape ); aEvent.Check( GetGalDisplayOptions().m_fullscreenCursor );
} }
@ -692,13 +693,6 @@ void EDA_DRAW_FRAME::LoadSettings( wxConfigBase* aCfg )
wxString baseCfgName = ConfigBaseName(); wxString baseCfgName = ConfigBaseName();
// Cursor shape is problematic on OS X, lock to 0
#ifdef __APPLE__
m_cursorShape = 0;
#else
aCfg->Read( baseCfgName + CursorShapeEntryKeyword, &m_cursorShape, ( long )0 );
#endif // __APPLE__
bool btmp; bool btmp;
if( aCfg->Read( baseCfgName + ShowGridEntryKeyword, &btmp ) ) if( aCfg->Read( baseCfgName + ShowGridEntryKeyword, &btmp ) )
SetGridVisibility( btmp ); SetGridVisibility( btmp );
@ -726,7 +720,6 @@ void EDA_DRAW_FRAME::SaveSettings( wxConfigBase* aCfg )
wxString baseCfgName = ConfigBaseName(); wxString baseCfgName = ConfigBaseName();
aCfg->Write( baseCfgName + CursorShapeEntryKeyword, m_cursorShape );
aCfg->Write( baseCfgName + ShowGridEntryKeyword, IsGridVisible() ); aCfg->Write( baseCfgName + ShowGridEntryKeyword, IsGridVisible() );
aCfg->Write( baseCfgName + GridColorEntryKeyword, aCfg->Write( baseCfgName + GridColorEntryKeyword,
GetGridColor().ToColour().GetAsString( wxC2S_CSS_SYNTAX ) ); GetGridColor().ToColour().GetAsString( wxC2S_CSS_SYNTAX ) );
@ -1129,7 +1122,6 @@ void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable )
// Transfer EDA_DRAW_PANEL settings // Transfer EDA_DRAW_PANEL settings
GetGalCanvas()->GetViewControls()->EnableCursorWarping( !m_canvas->GetEnableZoomNoCenter() ); GetGalCanvas()->GetViewControls()->EnableCursorWarping( !m_canvas->GetEnableZoomNoCenter() );
GetGalCanvas()->GetViewControls()->EnableMousewheelPan( m_canvas->GetEnableMousewheelPan() ); GetGalCanvas()->GetViewControls()->EnableMousewheelPan( m_canvas->GetEnableMousewheelPan() );
GetToolManager()->RunAction( "pcbnew.Control.switchCursor" );
} }
else if( m_galCanvasActive ) else if( m_galCanvasActive )
{ {

View File

@ -39,6 +39,7 @@
#include <class_base_screen.h> #include <class_base_screen.h>
#include <draw_frame.h> #include <draw_frame.h>
#include <view/view_controls.h> #include <view/view_controls.h>
#include <gal/gal_display_options.h>
#include <kicad_device_context.h> #include <kicad_device_context.h>
@ -221,7 +222,7 @@ void EDA_DRAW_PANEL::DrawCrossHair( wxDC* aDC, COLOR4D aColor )
GRSetDrawMode( aDC, GR_XOR ); GRSetDrawMode( aDC, GR_XOR );
if( GetParent()->m_cursorShape != 0 ) // Draws full screen crosshair. if( GetParent()->GetGalDisplayOptions().m_fullscreenCursor )
{ {
wxSize clientSize = GetClientSize(); wxSize clientSize = GetClientSize();

View File

@ -112,6 +112,7 @@ bool CAIRO_GAL::updatedGalDisplayOptions( const GAL_DISPLAY_OPTIONS& aOptions )
if( super::updatedGalDisplayOptions( aOptions ) ) if( super::updatedGalDisplayOptions( aOptions ) )
{ {
initCursor();
Refresh(); Refresh();
refresh = true; refresh = true;
} }
@ -850,13 +851,6 @@ void CAIRO_GAL::ClearTarget( RENDER_TARGET aTarget )
} }
void CAIRO_GAL::SetCursorSize( unsigned int aCursorSize )
{
GAL::SetCursorSize( aCursorSize );
initCursor();
}
void CAIRO_GAL::DrawCursor( const VECTOR2D& aCursorPosition ) void CAIRO_GAL::DrawCursor( const VECTOR2D& aCursorPosition )
{ {
cursorPosition = aCursorPosition; cursorPosition = aCursorPosition;
@ -964,6 +958,8 @@ void CAIRO_GAL::initCursor()
if( cursorPixelsSaved ) if( cursorPixelsSaved )
delete cursorPixelsSaved; delete cursorPixelsSaved;
const int cursorSize = fullscreenCursor ? 8000 : 80;
cursorPixels = new wxBitmap( cursorSize, cursorSize ); cursorPixels = new wxBitmap( cursorSize, cursorSize );
cursorPixelsSaved = new wxBitmap( cursorSize, cursorSize ); cursorPixelsSaved = new wxBitmap( cursorSize, cursorSize );
@ -991,6 +987,7 @@ void CAIRO_GAL::blitCursor( wxMemoryDC& clientDC )
auto p = ToScreen( cursorPosition ); auto p = ToScreen( cursorPosition );
const auto cColor = getCursorColor(); const auto cColor = getCursorColor();
const int cursorSize = fullscreenCursor ? 8000 : 80;
wxColour color( cColor.r * cColor.a * 255, cColor.g * cColor.a * 255, wxColour color( cColor.r * cColor.a * 255, cColor.g * cColor.a * 255,
cColor.b * cColor.a * 255, 255 ); cColor.b * cColor.a * 255, 255 );

View File

@ -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 GalFullscreenCursorConfig( "CursorFullscreen" );
static const wxString GalForceDisplayCursorConfig( "ForceDisplayCursor" ); static const wxString GalForceDisplayCursorConfig( "ForceDisplayCursor" );
@ -63,6 +64,7 @@ GAL_DISPLAY_OPTIONS::GAL_DISPLAY_OPTIONS()
m_gridLineWidth( 0.5 ), m_gridLineWidth( 0.5 ),
m_gridMinSpacing( 10.0 ), m_gridMinSpacing( 10.0 ),
m_axesEnabled( false ), m_axesEnabled( false ),
m_fullscreenCursor( false ),
m_forceDisplayCursor( false ) m_forceDisplayCursor( false )
{} {}
@ -88,6 +90,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 + GalFullscreenCursorConfig,
&m_fullscreenCursor, false );
aCfg->Read( aBaseName + GalForceDisplayCursorConfig, aCfg->Read( aBaseName + GalForceDisplayCursorConfig,
&m_forceDisplayCursor, false ); &m_forceDisplayCursor, false );
@ -112,6 +117,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 + GalFullscreenCursorConfig,
m_fullscreenCursor );
aCfg->Write( aBaseName + GalForceDisplayCursorConfig, aCfg->Write( aBaseName + GalForceDisplayCursorConfig,
m_forceDisplayCursor ); m_forceDisplayCursor );
} }

View File

@ -65,9 +65,9 @@ GAL::GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions ) :
// Initialize the cursor shape // Initialize the cursor shape
SetCursorColor( COLOR4D( 1.0, 1.0, 1.0, 1.0 ) ); SetCursorColor( COLOR4D( 1.0, 1.0, 1.0, 1.0 ) );
SetCursorSize( 80 ); fullscreenCursor = false;
SetCursorEnabled( false );
forceDisplayCursor = false; forceDisplayCursor = false;
SetCursorEnabled( false );
strokeFont.LoadNewStrokeFont( newstroke_font, newstroke_font_bufsize ); strokeFont.LoadNewStrokeFont( newstroke_font, newstroke_font_bufsize );
@ -124,6 +124,12 @@ bool GAL::updatedGalDisplayOptions( const GAL_DISPLAY_OPTIONS& aOptions )
refresh = true; refresh = true;
} }
if( options.m_fullscreenCursor != fullscreenCursor )
{
fullscreenCursor = options.m_fullscreenCursor;
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;
} }

View File

@ -1662,6 +1662,8 @@ void OPENGL_GAL::blitCursor()
compositor->SetBuffer( OPENGL_COMPOSITOR::DIRECT_RENDERING ); compositor->SetBuffer( OPENGL_COMPOSITOR::DIRECT_RENDERING );
const int cursorSize = fullscreenCursor ? 8000 : 80;
VECTOR2D cursorBegin = cursorPosition - cursorSize / ( 2 * worldScale ); VECTOR2D cursorBegin = cursorPosition - cursorSize / ( 2 * worldScale );
VECTOR2D cursorEnd = cursorPosition + cursorSize / ( 2 * worldScale ); VECTOR2D cursorEnd = cursorPosition + cursorSize / ( 2 * worldScale );
VECTOR2D cursorCenter = ( cursorBegin + cursorEnd ) / 2; VECTOR2D cursorCenter = ( cursorBegin + cursorEnd ) / 2;

View File

@ -71,6 +71,9 @@ GAL_OPTIONS_PANEL::GAL_OPTIONS_PANEL( wxWindow* aParent, KIGFX::GAL_DISPLAY_OPTI
wxBoxSizer* sLeftSizer = new wxBoxSizer( wxVERTICAL ); wxBoxSizer* sLeftSizer = new wxBoxSizer( wxVERTICAL );
m_mainSizer->Add( sLeftSizer, 1, wxALL | wxEXPAND, 0 ); m_mainSizer->Add( sLeftSizer, 1, wxALL | wxEXPAND, 0 );
// @todo LEGACY: not required when legacy is gone
const wxString galOnlySuffix = _( " (OpenGL && Cairo)" );
/* /*
* Anti-aliasing subpanel * Anti-aliasing subpanel
*/ */
@ -101,7 +104,7 @@ GAL_OPTIONS_PANEL::GAL_OPTIONS_PANEL( wxWindow* aParent, KIGFX::GAL_DISPLAY_OPTI
{ {
wxStaticBoxSizer* sGridSettings; wxStaticBoxSizer* sGridSettings;
sGridSettings = new wxStaticBoxSizer( new wxStaticBox( this, sGridSettings = new wxStaticBoxSizer( new wxStaticBox( this,
wxID_ANY, _("Grid Display (OpenGL && Cairo)") ), wxVERTICAL ); wxID_ANY, _( "Grid Display" ) + galOnlySuffix ), wxVERTICAL );
wxString m_gridStyleChoices[] = { wxString m_gridStyleChoices[] = {
_( "Dots" ), _( "Dots" ),
@ -110,7 +113,7 @@ GAL_OPTIONS_PANEL::GAL_OPTIONS_PANEL( wxWindow* aParent, KIGFX::GAL_DISPLAY_OPTI
}; };
int m_gridStyleNChoices = sizeof( m_gridStyleChoices ) / sizeof( wxString ); int m_gridStyleNChoices = sizeof( m_gridStyleChoices ) / sizeof( wxString );
m_gridStyle = new wxRadioBox( sGridSettings->GetStaticBox(), m_gridStyle = new wxRadioBox( sGridSettings->GetStaticBox(),
wxID_ANY, _("Grid Style"), wxID_ANY, _( "Grid Style" ),
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
m_gridStyleNChoices, m_gridStyleChoices, 1, wxRA_SPECIFY_COLS ); m_gridStyleNChoices, m_gridStyleChoices, 1, wxRA_SPECIFY_COLS );
sGridSettings->Add( m_gridStyle, 0, wxALL|wxEXPAND, 5 ); sGridSettings->Add( m_gridStyle, 0, wxALL|wxEXPAND, 5 );
@ -177,11 +180,35 @@ GAL_OPTIONS_PANEL::GAL_OPTIONS_PANEL( wxWindow* aParent, KIGFX::GAL_DISPLAY_OPTI
{ {
auto sCursorSettings = new wxStaticBoxSizer( new wxStaticBox( this, auto sCursorSettings = new wxStaticBoxSizer( new wxStaticBox( this,
wxID_ANY, _( "Cursor Display (OpenGL && Cairo)" ) ), wxVERTICAL ); wxID_ANY, _( "Cursor Display" ) ), wxVERTICAL );
sLeftSizer->Add( sCursorSettings, 1, wxALL | wxEXPAND, 5 ); sLeftSizer->Add( sCursorSettings, 1, wxALL | wxEXPAND, 5 );
m_forceCursorDisplay = new wxCheckBox( this, wxID_ANY, _( "Always display cursor" ) ); wxString m_CursorShapeChoices[] = {
_( "Small cross" ),
_( "Full screen cursor" )
};
wxString cursorShapeTitle = _( "Cursor Shape" );
// cursor is not shown in legacy on OSX, so this setting won't
// do anything there
// @todo LEGACY remove this
#ifdef __APPLE__
cursorShapeTitle += galOnlySuffix;
#endif
int m_CursorShapeNChoices = sizeof( m_CursorShapeChoices ) / sizeof( wxString );
m_cursorShape = new wxRadioBox( this, wxID_ANY,
cursorShapeTitle, wxDefaultPosition, wxDefaultSize,
m_CursorShapeNChoices, m_CursorShapeChoices, 1, wxRA_SPECIFY_COLS );
m_cursorShape->SetSelection( 0 );
m_cursorShape->SetToolTip( _( "Main cursor shape selection (small cross or large cursor)" ) );
sCursorSettings->Add( m_cursorShape, 0, wxALL | wxEXPAND, 5 );
m_forceCursorDisplay = new wxCheckBox( this, wxID_ANY, _( "Always display cursor" ) + galOnlySuffix );
sCursorSettings->Add( m_forceCursorDisplay, 0, wxALL | wxEXPAND, 5 ); sCursorSettings->Add( m_forceCursorDisplay, 0, wxALL | wxEXPAND, 5 );
} }
@ -200,6 +227,8 @@ bool GAL_OPTIONS_PANEL::TransferDataToWindow()
m_gridMinSpacingIncrementer->SetValue( m_galOptions.m_gridMinSpacing ); m_gridMinSpacingIncrementer->SetValue( m_galOptions.m_gridMinSpacing );
m_cursorShape->SetSelection( m_galOptions.m_fullscreenCursor );
m_forceCursorDisplay->SetValue( m_galOptions.m_forceDisplayCursor ); m_forceCursorDisplay->SetValue( m_galOptions.m_forceDisplayCursor );
return true; return true;
@ -218,6 +247,8 @@ bool GAL_OPTIONS_PANEL::TransferDataFromWindow()
m_galOptions.m_gridMinSpacing = m_gridMinSpacingIncrementer->GetValue(); m_galOptions.m_gridMinSpacing = m_gridMinSpacingIncrementer->GetValue();
m_galOptions.m_fullscreenCursor = m_cursorShape->GetSelection();
m_galOptions.m_forceDisplayCursor = m_forceCursorDisplay->GetValue(); m_galOptions.m_forceDisplayCursor = m_forceCursorDisplay->GetValue();
m_galOptions.NotifyChanged(); m_galOptions.NotifyChanged();

View File

@ -93,11 +93,18 @@ void DIALOG_DISPLAY_OPTIONS::initOptDialog( )
m_PolarDisplay->SetSelection( m_Parent->m_DisplayOptions.m_DisplayPolarCood ? 1 : 0 ); m_PolarDisplay->SetSelection( m_Parent->m_DisplayOptions.m_DisplayPolarCood ? 1 : 0 );
m_BoxUnits->SetSelection( g_UserUnit ? 1 : 0 ); m_BoxUnits->SetSelection( g_UserUnit ? 1 : 0 );
// @todo: LEGACY: Cursor shape can be set using the GAL options
// widget, when that is added to gerbview. For now, access the
// setting via the frame's GAL options object directly
// Cursor shape cannot be implemented on OS X // Cursor shape cannot be implemented on OS X
#ifdef __APPLE__ #ifdef __APPLE__
m_CursorShape->Hide(); m_CursorShape->Hide();
#else #else
m_CursorShape->SetSelection( m_Parent->GetCursorShape() ? 1 : 0 ); {
auto& galOpts = m_Parent->GetGalDisplayOptions();
m_CursorShape->SetSelection( galOpts.m_fullscreenCursor ? 1 : 0 );
}
#endif // __APPLE__ #endif // __APPLE__
// Show Option Draw Lines. We use DisplayPcbTrackFill as Lines draw option // Show Option Draw Lines. We use DisplayPcbTrackFill as Lines draw option
@ -137,8 +144,12 @@ void DIALOG_DISPLAY_OPTIONS::OnOKBUttonClick( wxCommandEvent& event )
(m_PolarDisplay->GetSelection() == 0) ? false : true; (m_PolarDisplay->GetSelection() == 0) ? false : true;
g_UserUnit = (m_BoxUnits->GetSelection() == 0) ? INCHES : MILLIMETRES; g_UserUnit = (m_BoxUnits->GetSelection() == 0) ? INCHES : MILLIMETRES;
// @todo LEGACY: as above, this should be via the GAL display widget
#ifndef __APPLE__ #ifndef __APPLE__
m_Parent->SetCursorShape( m_CursorShape->GetSelection() ); {
auto& galOpts = m_Parent->GetGalDisplayOptions();
galOpts.m_fullscreenCursor = m_CursorShape->GetSelection();
}
#endif // !__APPLE__ #endif // !__APPLE__
if( m_OptDisplayLines->GetSelection() == 1 ) if( m_OptDisplayLines->GetSelection() == 1 )

View File

@ -98,11 +98,6 @@ protected:
/// Tool ID of previously active draw tool bar button. /// Tool ID of previously active draw tool bar button.
int m_lastDrawToolId; int m_lastDrawToolId;
/// The shape of the KiCad cursor. The default value (0) is the normal cross
/// hair cursor. Set to non-zero value to draw the full screen cursor.
/// @note This is not the system mouse cursor.
int m_cursorShape;
/// True shows the X and Y axis indicators. /// True shows the X and Y axis indicators.
bool m_showAxis; bool m_showAxis;
@ -295,10 +290,6 @@ public:
*/ */
virtual void SetDrawBgColor( COLOR4D aColor) { m_drawBgColor= aColor ; } virtual void SetDrawBgColor( COLOR4D aColor) { m_drawBgColor= aColor ; }
int GetCursorShape() const { return m_cursorShape; }
virtual void SetCursorShape( int aCursorShape ) { m_cursorShape = aCursorShape; }
bool GetShowBorderAndTitleBlock() const { return m_showBorderAndTitleBlock; } bool GetShowBorderAndTitleBlock() const { return m_showBorderAndTitleBlock; }
void SetShowBorderAndTitleBlock( bool aShow ) { m_showBorderAndTitleBlock = aShow; } void SetShowBorderAndTitleBlock( bool aShow ) { m_showBorderAndTitleBlock = aShow; }

View File

@ -244,9 +244,6 @@ public:
// Cursor // Cursor
// ------- // -------
/// @copydoc GAL::SetCursorSize()
virtual void SetCursorSize( unsigned int aCursorSize ) override;
/// @copydoc GAL::DrawCursor() /// @copydoc GAL::DrawCursor()
virtual void DrawCursor( const VECTOR2D& aCursorPosition ) override; virtual void DrawCursor( const VECTOR2D& aCursorPosition ) override;

View File

@ -85,6 +85,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;
///> Fullscreen crosshair or small cross
bool m_fullscreenCursor;
///> Force cursor display ///> Force cursor display
bool m_forceDisplayCursor; bool m_forceDisplayCursor;
}; };

View File

@ -917,26 +917,6 @@ public:
cursorColor = aCursorColor; cursorColor = aCursorColor;
} }
/**
* @brief Returns the cursor size.
*
* @return The current cursor size (in pixels).
*/
inline unsigned int GetCursorSize() const
{
return cursorSize;
}
/**
* @brief Set the cursor size.
*
* @param aCursorSize is the size of the cursor expressed in pixels.
*/
virtual inline void SetCursorSize( unsigned int aCursorSize )
{
cursorSize = aCursorSize;
}
/** /**
* @brief Draw the cursor. * @brief Draw the cursor.
* *
@ -1021,7 +1001,7 @@ protected:
bool isCursorEnabled; ///< Is the cursor enabled? bool isCursorEnabled; ///< Is the cursor enabled?
bool forceDisplayCursor; ///< Always show cursor bool forceDisplayCursor; ///< Always show cursor
COLOR4D cursorColor; ///< Cursor color COLOR4D cursorColor; ///< Cursor color
unsigned int cursorSize; ///< Size of the cursor in pixels bool fullscreenCursor; ///< Shape of the cursor (fullscreen or small cross)
VECTOR2D cursorPosition; ///< Current cursor position (world coordinates) VECTOR2D cursorPosition; ///< Current cursor position (world coordinates)
/// Instance of object that stores information about how to draw texts /// Instance of object that stores information about how to draw texts

View File

@ -65,6 +65,7 @@ private:
wxSpinButton* m_gridMinSpacingSpinBtn; wxSpinButton* m_gridMinSpacingSpinBtn;
wxStaticText* l_gridMinSpacingUnits; wxStaticText* l_gridMinSpacingUnits;
wxRadioBox* m_cursorShape;
wxCheckBox* m_forceCursorDisplay; wxCheckBox* m_forceCursorDisplay;
///> The GAL options to read/write ///> The GAL options to read/write

View File

@ -371,9 +371,6 @@ public:
*/ */
virtual void SetGridColor( COLOR4D aColor ) override; virtual void SetGridColor( COLOR4D aColor ) override;
///> @copydoc EDA_DRAW_FRAME::SetCursorShape()
virtual void SetCursorShape( int aCursorShape ) override;
// Configurations: // Configurations:
void Process_Config( wxCommandEvent& event ); void Process_Config( wxCommandEvent& event );

View File

@ -65,14 +65,6 @@ void DIALOG_GENERALOPTIONS::init()
m_PolarDisplay->SetSelection( displ_opts->m_DisplayPolarCood ? 1 : 0 ); m_PolarDisplay->SetSelection( displ_opts->m_DisplayPolarCood ? 1 : 0 );
m_UnitsSelection->SetSelection( g_UserUnit ? 1 : 0 ); m_UnitsSelection->SetSelection( g_UserUnit ? 1 : 0 );
// Cursor shape cannot be implemented on OS X
#ifdef __APPLE__
m_CursorShape->Hide();
#else
m_CursorShape->SetSelection( GetParent()->GetCursorShape() ? 1 : 0 );
#endif // __APPLE__
wxString rotationAngle; wxString rotationAngle;
rotationAngle = AngleToStringDegrees( (double)GetParent()->GetRotationAngle() ); rotationAngle = AngleToStringDegrees( (double)GetParent()->GetRotationAngle() );
m_RotationAngle->SetValue( rotationAngle ); m_RotationAngle->SetValue( rotationAngle );
@ -114,9 +106,6 @@ void DIALOG_GENERALOPTIONS::OnOkClick( wxCommandEvent& event )
if( ii != g_UserUnit ) if( ii != g_UserUnit )
GetParent()->ReCreateAuxiliaryToolbar(); GetParent()->ReCreateAuxiliaryToolbar();
#ifndef __APPLE__
GetParent()->SetCursorShape( m_CursorShape->GetSelection() );
#endif // !__APPLE__
GetParent()->SetAutoSaveInterval( m_SaveTime->GetValue() * 60 ); GetParent()->SetAutoSaveInterval( m_SaveTime->GetValue() * 60 );
GetParent()->SetRotationAngle( wxRound( 10.0 * wxAtof( m_RotationAngle->GetValue() ) ) ); GetParent()->SetRotationAngle( wxRound( 10.0 * wxAtof( m_RotationAngle->GetValue() ) ) );

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Sep 8 2016) // C++ code generated with wxFormBuilder (version Jan 9 2017)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
@ -38,14 +38,6 @@ DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE::DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE(
bLeftSizer->Add( m_UnitsSelection, 0, wxALL|wxEXPAND, 5 ); bLeftSizer->Add( m_UnitsSelection, 0, wxALL|wxEXPAND, 5 );
wxString m_CursorShapeChoices[] = { _("Small cross"), _("Full screen cursor") };
int m_CursorShapeNChoices = sizeof( m_CursorShapeChoices ) / sizeof( wxString );
m_CursorShape = new wxRadioBox( this, wxID_CURSOR_SHAPE, _("Cursor"), wxDefaultPosition, wxDefaultSize, m_CursorShapeNChoices, m_CursorShapeChoices, 1, wxRA_SPECIFY_COLS );
m_CursorShape->SetSelection( 0 );
m_CursorShape->SetToolTip( _("Main cursor shape selection (small cross or large cursor)") );
bLeftSizer->Add( m_CursorShape, 0, wxALL|wxEXPAND, 5 );
bSizerUpper->Add( bLeftSizer, 2, wxALL|wxEXPAND, 5 ); bSizerUpper->Add( bLeftSizer, 2, wxALL|wxEXPAND, 5 );

View File

@ -291,96 +291,6 @@
<event name="OnUpdateUI"></event> <event name="OnUpdateUI"></event>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxRadioBox" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="choices">&quot;Small cross&quot; &quot;Full screen cursor&quot;</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_CURSOR_SHAPE</property>
<property name="label">Cursor</property>
<property name="majorDimension">1</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_CursorShape</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="selection">0</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxRA_SPECIFY_COLS</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Main cursor shape selection (small cross or large cursor)</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRadioBox"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Sep 8 2016) // C++ code generated with wxFormBuilder (version Jan 9 2017)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
@ -44,7 +44,6 @@ class DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE : public DIALOG_SHIM
{ {
wxID_POLAR_CTRL = 1000, wxID_POLAR_CTRL = 1000,
wxID_UNITS, wxID_UNITS,
wxID_CURSOR_SHAPE,
wxID_DRC_ONOFF, wxID_DRC_ONOFF,
wxID_GENERAL_RATSNEST, wxID_GENERAL_RATSNEST,
wxID_TRACK_AUTODEL, wxID_TRACK_AUTODEL,
@ -56,7 +55,6 @@ class DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE : public DIALOG_SHIM
wxRadioBox* m_PolarDisplay; wxRadioBox* m_PolarDisplay;
wxRadioBox* m_UnitsSelection; wxRadioBox* m_UnitsSelection;
wxRadioBox* m_CursorShape;
wxStaticText* m_staticTextmaxlinks; wxStaticText* m_staticTextmaxlinks;
wxSpinCtrl* m_MaxShowLinks; wxSpinCtrl* m_MaxShowLinks;
wxStaticText* m_staticTextautosave; wxStaticText* m_staticTextautosave;

View File

@ -869,19 +869,6 @@ void PCB_EDIT_FRAME::SetGridColor( COLOR4D aColor )
} }
void PCB_EDIT_FRAME::SetCursorShape( int aCursorShape )
{
const unsigned int BIG_CURSOR = 8000;
const unsigned int SMALL_CURSOR = 80;
EDA_DRAW_FRAME::SetCursorShape( aCursorShape );
KIGFX::GAL* gal = GetGalCanvas()->GetGAL();
if( gal )
gal->SetCursorSize( aCursorShape ? BIG_CURSOR : SMALL_CURSOR );
}
bool PCB_EDIT_FRAME::IsMicroViaAcceptable() bool PCB_EDIT_FRAME::IsMicroViaAcceptable()
{ {
int copperlayercnt = GetBoard()->GetCopperLayerCount( ); int copperlayercnt = GetBoard()->GetCopperLayerCount( );

View File

@ -709,12 +709,10 @@ int PCBNEW_CONTROL::ResetCoords( const TOOL_EVENT& aEvent )
int PCBNEW_CONTROL::SwitchCursor( const TOOL_EVENT& aEvent ) int PCBNEW_CONTROL::SwitchCursor( const TOOL_EVENT& aEvent )
{ {
const unsigned int BIG_CURSOR = 8000; auto& galOpts = m_frame->GetGalDisplayOptions();
const unsigned int SMALL_CURSOR = 80;
PCB_BASE_FRAME* frame = getEditFrame<PCB_BASE_FRAME>(); galOpts.m_fullscreenCursor = !galOpts.m_fullscreenCursor;
KIGFX::GAL* gal = frame->GetGalCanvas()->GetGAL(); galOpts.NotifyChanged();
gal->SetCursorSize( frame->GetCursorShape() ? BIG_CURSOR : SMALL_CURSOR );
return 0; return 0;
} }