kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #28797
[PATCH] Allow always-on GAL cursor
Hi,
Here's a patch set to allow always-on cursors in GAL, which some
people like for checking alignment and so on. Fixes lp:1673633.
The next patch dims cursors when forced on to make it clear when the
cursor doesn't actually represent an interactive tool.
The next patch is a tidy up of display options dialog to make more
space for GAL options and a bit of code style.
The last patch moves the cursor shape toggle into the GAL settings.
Legacy mode can access it though the GAL options struct on the frame.
This removes another small piece of complexity from the the frame
class interfaces and centralises more display options. Also, it should
now be possible to change cursor shape on OSX and in Modedit via the
dialog.
Cheers,
John
From 26520b5a80952d591f6e151004d7bb713a4f15bf Mon Sep 17 00:00:00 2001
From: John Beard <john.j.beard@xxxxxxxxx>
Date: Mon, 20 Mar 2017 04:51:59 +0800
Subject: [PATCH 4/4] 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).
---
common/draw_frame.cpp | 20 ++---
common/draw_panel.cpp | 3 +-
common/gal/cairo/cairo_gal.cpp | 11 +--
common/gal/gal_display_options.cpp | 8 ++
common/gal/graphics_abstraction_layer.cpp | 10 ++-
common/gal/opengl/opengl_gal.cpp | 2 +
common/widgets/gal_options_panel.cpp | 39 +++++++++-
.../gerbview_dialog_display_options_frame.cpp | 15 +++-
include/draw_frame.h | 9 ---
include/gal/cairo/cairo_gal.h | 3 -
include/gal/gal_display_options.h | 3 +
include/gal/graphics_abstraction_layer.h | 22 +-----
include/widgets/gal_options_panel.h | 1 +
include/wxPcbStruct.h | 3 -
pcbnew/dialogs/dialog_general_options.cpp | 11 ---
.../dialog_general_options_BoardEditor_base.cpp | 10 +--
.../dialog_general_options_BoardEditor_base.fbp | 90 ----------------------
.../dialog_general_options_BoardEditor_base.h | 4 +-
pcbnew/pcbframe.cpp | 13 ----
pcbnew/tools/pcbnew_control.cpp | 8 +-
20 files changed, 88 insertions(+), 197 deletions(-)
diff --git a/common/draw_frame.cpp b/common/draw_frame.cpp
index fb0b6ce8d..99d683993 100644
--- a/common/draw_frame.cpp
+++ b/common/draw_frame.cpp
@@ -66,8 +66,6 @@ static const wxString traceScrollSettings( wxT( "KicadScrollSettings" ) );
///@{
/// \ingroup config
-/// Nonzero iff fullscreen cursor is to be used (suffix)
-static const wxString CursorShapeEntryKeyword( wxT( "CursorShape" ) );
/// Nonzero to show grid (suffix)
static const wxString ShowGridEntryKeyword( wxT( "ShowGrid" ) );
/// 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_showGridAxis = false; // true to draw the grid axis
m_showOriginAxis = false; // true to draw the grid origin
- m_cursorShape = 0;
m_LastGridSizeId = 0;
m_drawGrid = true; // hide/Show grid. default = show
m_gridColor = COLOR4D( DARKGRAY ); // Default grid color
@@ -318,7 +315,11 @@ void EDA_DRAW_FRAME::OnToggleCrossHairStyle( wxCommandEvent& aEvent )
{
INSTALL_UNBUFFERED_DC( dc, m_canvas );
m_canvas->CrossHairOff( &dc );
- SetCursorShape( !GetCursorShape() );
+
+ auto& galOpts = GetGalDisplayOptions();
+ galOpts.m_fullscreenCursor = !galOpts.m_fullscreenCursor;
+ galOpts.NotifyChanged();
+
m_canvas->CrossHairOn( &dc );
}
@@ -360,7 +361,7 @@ void EDA_DRAW_FRAME::OnUpdateGrid( 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();
- // 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;
if( aCfg->Read( baseCfgName + ShowGridEntryKeyword, &btmp ) )
SetGridVisibility( btmp );
@@ -726,7 +720,6 @@ void EDA_DRAW_FRAME::SaveSettings( wxConfigBase* aCfg )
wxString baseCfgName = ConfigBaseName();
- aCfg->Write( baseCfgName + CursorShapeEntryKeyword, m_cursorShape );
aCfg->Write( baseCfgName + ShowGridEntryKeyword, IsGridVisible() );
aCfg->Write( baseCfgName + GridColorEntryKeyword,
GetGridColor().ToColour().GetAsString( wxC2S_CSS_SYNTAX ) );
@@ -1129,7 +1122,6 @@ void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable )
// Transfer EDA_DRAW_PANEL settings
GetGalCanvas()->GetViewControls()->EnableCursorWarping( !m_canvas->GetEnableZoomNoCenter() );
GetGalCanvas()->GetViewControls()->EnableMousewheelPan( m_canvas->GetEnableMousewheelPan() );
- GetToolManager()->RunAction( "pcbnew.Control.switchCursor" );
}
else if( m_galCanvasActive )
{
diff --git a/common/draw_panel.cpp b/common/draw_panel.cpp
index 5b9bca320..d5445e2bd 100644
--- a/common/draw_panel.cpp
+++ b/common/draw_panel.cpp
@@ -39,6 +39,7 @@
#include <class_base_screen.h>
#include <draw_frame.h>
#include <view/view_controls.h>
+#include <gal/gal_display_options.h>
#include <kicad_device_context.h>
@@ -221,7 +222,7 @@ void EDA_DRAW_PANEL::DrawCrossHair( wxDC* aDC, COLOR4D aColor )
GRSetDrawMode( aDC, GR_XOR );
- if( GetParent()->m_cursorShape != 0 ) // Draws full screen crosshair.
+ if( GetParent()->GetGalDisplayOptions().m_fullscreenCursor )
{
wxSize clientSize = GetClientSize();
diff --git a/common/gal/cairo/cairo_gal.cpp b/common/gal/cairo/cairo_gal.cpp
index 948cdcbbc..62078ae79 100644
--- a/common/gal/cairo/cairo_gal.cpp
+++ b/common/gal/cairo/cairo_gal.cpp
@@ -112,6 +112,7 @@ bool CAIRO_GAL::updatedGalDisplayOptions( const GAL_DISPLAY_OPTIONS& aOptions )
if( super::updatedGalDisplayOptions( aOptions ) )
{
+ initCursor();
Refresh();
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 )
{
cursorPosition = aCursorPosition;
@@ -964,6 +958,8 @@ void CAIRO_GAL::initCursor()
if( cursorPixelsSaved )
delete cursorPixelsSaved;
+ const int cursorSize = fullscreenCursor ? 8000 : 80;
+
cursorPixels = new wxBitmap( cursorSize, cursorSize );
cursorPixelsSaved = new wxBitmap( cursorSize, cursorSize );
@@ -991,6 +987,7 @@ void CAIRO_GAL::blitCursor( wxMemoryDC& clientDC )
auto p = ToScreen( cursorPosition );
const auto cColor = getCursorColor();
+ const int cursorSize = fullscreenCursor ? 8000 : 80;
wxColour color( cColor.r * cColor.a * 255, cColor.g * cColor.a * 255,
cColor.b * cColor.a * 255, 255 );
diff --git a/common/gal/gal_display_options.cpp b/common/gal/gal_display_options.cpp
index f09cd19d1..92d46dedf 100644
--- a/common/gal/gal_display_options.cpp
+++ b/common/gal/gal_display_options.cpp
@@ -36,6 +36,7 @@ static const wxString GalGridStyleConfig( "GridStyle" );
static const wxString GalGridLineWidthConfig( "GridLineWidth" );
static const wxString GalGridMaxDensityConfig( "GridMaxDensity" );
static const wxString GalGridAxesEnabledConfig( "GridAxesEnabled" );
+static const wxString GalFullscreenCursorConfig( "CursorFullscreen" );
static const wxString GalForceDisplayCursorConfig( "ForceDisplayCursor" );
@@ -63,6 +64,7 @@ GAL_DISPLAY_OPTIONS::GAL_DISPLAY_OPTIONS()
m_gridLineWidth( 0.5 ),
m_gridMinSpacing( 10.0 ),
m_axesEnabled( false ),
+ m_fullscreenCursor( false ),
m_forceDisplayCursor( false )
{}
@@ -88,6 +90,9 @@ void GAL_DISPLAY_OPTIONS::ReadConfig( wxConfigBase* aCfg, wxString aBaseName )
aCfg->Read( aBaseName + GalGridAxesEnabledConfig,
&m_axesEnabled, false );
+ aCfg->Read( aBaseName + GalFullscreenCursorConfig,
+ &m_fullscreenCursor, false );
+
aCfg->Read( aBaseName + GalForceDisplayCursorConfig,
&m_forceDisplayCursor, false );
@@ -112,6 +117,9 @@ void GAL_DISPLAY_OPTIONS::WriteConfig( wxConfigBase* aCfg, wxString aBaseName )
aCfg->Write( aBaseName + GalGridAxesEnabledConfig,
m_axesEnabled );
+ aCfg->Write( aBaseName + GalFullscreenCursorConfig,
+ m_fullscreenCursor );
+
aCfg->Write( aBaseName + GalForceDisplayCursorConfig,
m_forceDisplayCursor );
}
diff --git a/common/gal/graphics_abstraction_layer.cpp b/common/gal/graphics_abstraction_layer.cpp
index f88d4701f..9db9c04a3 100644
--- a/common/gal/graphics_abstraction_layer.cpp
+++ b/common/gal/graphics_abstraction_layer.cpp
@@ -65,9 +65,9 @@ GAL::GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions ) :
// Initialize the cursor shape
SetCursorColor( COLOR4D( 1.0, 1.0, 1.0, 1.0 ) );
- SetCursorSize( 80 );
- SetCursorEnabled( false );
+ fullscreenCursor = false;
forceDisplayCursor = false;
+ SetCursorEnabled( false );
strokeFont.LoadNewStrokeFont( newstroke_font, newstroke_font_bufsize );
@@ -124,6 +124,12 @@ bool GAL::updatedGalDisplayOptions( const GAL_DISPLAY_OPTIONS& aOptions )
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
return refresh;
}
diff --git a/common/gal/opengl/opengl_gal.cpp b/common/gal/opengl/opengl_gal.cpp
index 6753df676..b59daf694 100644
--- a/common/gal/opengl/opengl_gal.cpp
+++ b/common/gal/opengl/opengl_gal.cpp
@@ -1670,6 +1670,8 @@ void OPENGL_GAL::blitCursor()
compositor->SetBuffer( OPENGL_COMPOSITOR::DIRECT_RENDERING );
+ const int cursorSize = fullscreenCursor ? 8000 : 80;
+
VECTOR2D cursorBegin = cursorPosition - cursorSize / ( 2 * worldScale );
VECTOR2D cursorEnd = cursorPosition + cursorSize / ( 2 * worldScale );
VECTOR2D cursorCenter = ( cursorBegin + cursorEnd ) / 2;
diff --git a/common/widgets/gal_options_panel.cpp b/common/widgets/gal_options_panel.cpp
index 8f9e8f4c7..833591b9a 100644
--- a/common/widgets/gal_options_panel.cpp
+++ b/common/widgets/gal_options_panel.cpp
@@ -71,6 +71,9 @@ GAL_OPTIONS_PANEL::GAL_OPTIONS_PANEL( wxWindow* aParent, KIGFX::GAL_DISPLAY_OPTI
wxBoxSizer* sLeftSizer = new wxBoxSizer( wxVERTICAL );
m_mainSizer->Add( sLeftSizer, 1, wxALL | wxEXPAND, 0 );
+ // @todo LEGACY: not required when legacy is gone
+ const wxString galOnlySuffix = _( " (OpenGL && Cairo)" );
+
/*
* Anti-aliasing subpanel
*/
@@ -101,7 +104,7 @@ GAL_OPTIONS_PANEL::GAL_OPTIONS_PANEL( wxWindow* aParent, KIGFX::GAL_DISPLAY_OPTI
{
wxStaticBoxSizer* sGridSettings;
sGridSettings = new wxStaticBoxSizer( new wxStaticBox( this,
- wxID_ANY, _("Grid Display (OpenGL && Cairo)") ), wxVERTICAL );
+ wxID_ANY, _( "Grid Display" ) + galOnlySuffix ), wxVERTICAL );
wxString m_gridStyleChoices[] = {
_( "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 );
m_gridStyle = new wxRadioBox( sGridSettings->GetStaticBox(),
- wxID_ANY, _("Grid Style"),
+ wxID_ANY, _( "Grid Style" ),
wxDefaultPosition, wxDefaultSize,
m_gridStyleNChoices, m_gridStyleChoices, 1, wxRA_SPECIFY_COLS );
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,
- wxID_ANY, _( "Cursor Display (OpenGL && Cairo)" ) ), wxVERTICAL );
+ wxID_ANY, _( "Cursor Display" ) ), wxVERTICAL );
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 );
}
@@ -200,6 +227,8 @@ bool GAL_OPTIONS_PANEL::TransferDataToWindow()
m_gridMinSpacingIncrementer->SetValue( m_galOptions.m_gridMinSpacing );
+ m_cursorShape->SetSelection( m_galOptions.m_fullscreenCursor );
+
m_forceCursorDisplay->SetValue( m_galOptions.m_forceDisplayCursor );
return true;
@@ -218,6 +247,8 @@ bool GAL_OPTIONS_PANEL::TransferDataFromWindow()
m_galOptions.m_gridMinSpacing = m_gridMinSpacingIncrementer->GetValue();
+ m_galOptions.m_fullscreenCursor = m_cursorShape->GetSelection();
+
m_galOptions.m_forceDisplayCursor = m_forceCursorDisplay->GetValue();
m_galOptions.NotifyChanged();
diff --git a/gerbview/dialogs/gerbview_dialog_display_options_frame.cpp b/gerbview/dialogs/gerbview_dialog_display_options_frame.cpp
index 41ace4a1f..18eb81599 100644
--- a/gerbview/dialogs/gerbview_dialog_display_options_frame.cpp
+++ b/gerbview/dialogs/gerbview_dialog_display_options_frame.cpp
@@ -93,11 +93,18 @@ void DIALOG_DISPLAY_OPTIONS::initOptDialog( )
m_PolarDisplay->SetSelection( m_Parent->m_DisplayOptions.m_DisplayPolarCood ? 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
#ifdef __APPLE__
m_CursorShape->Hide();
#else
- m_CursorShape->SetSelection( m_Parent->GetCursorShape() ? 1 : 0 );
+ {
+ auto& galOpts = m_Parent->GetGalDisplayOptions();
+ m_CursorShape->SetSelection( galOpts.m_fullscreenCursor ? 1 : 0 );
+ }
#endif // __APPLE__
// 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;
g_UserUnit = (m_BoxUnits->GetSelection() == 0) ? INCHES : MILLIMETRES;
+ // @todo LEGACY: as above, this should be via the GAL display widget
#ifndef __APPLE__
- m_Parent->SetCursorShape( m_CursorShape->GetSelection() );
+ {
+ auto& galOpts = m_Parent->GetGalDisplayOptions();
+ galOpts.m_fullscreenCursor = m_CursorShape->GetSelection();
+ }
#endif // !__APPLE__
if( m_OptDisplayLines->GetSelection() == 1 )
diff --git a/include/draw_frame.h b/include/draw_frame.h
index 51eae8351..90d517eb0 100644
--- a/include/draw_frame.h
+++ b/include/draw_frame.h
@@ -98,11 +98,6 @@ protected:
/// Tool ID of previously active draw tool bar button.
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.
bool m_showAxis;
@@ -295,10 +290,6 @@ public:
*/
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; }
void SetShowBorderAndTitleBlock( bool aShow ) { m_showBorderAndTitleBlock = aShow; }
diff --git a/include/gal/cairo/cairo_gal.h b/include/gal/cairo/cairo_gal.h
index 63740ad5d..121c22397 100644
--- a/include/gal/cairo/cairo_gal.h
+++ b/include/gal/cairo/cairo_gal.h
@@ -244,9 +244,6 @@ public:
// Cursor
// -------
- /// @copydoc GAL::SetCursorSize()
- virtual void SetCursorSize( unsigned int aCursorSize ) override;
-
/// @copydoc GAL::DrawCursor()
virtual void DrawCursor( const VECTOR2D& aCursorPosition ) override;
diff --git a/include/gal/gal_display_options.h b/include/gal/gal_display_options.h
index d9e684b73..a281eb489 100644
--- a/include/gal/gal_display_options.h
+++ b/include/gal/gal_display_options.h
@@ -85,6 +85,9 @@ namespace KIGFX
///> Whether or not to draw the coordinate system axes
bool m_axesEnabled;
+ ///> Fullscreen crosshair or small cross
+ bool m_fullscreenCursor;
+
///> Force cursor display
bool m_forceDisplayCursor;
};
diff --git a/include/gal/graphics_abstraction_layer.h b/include/gal/graphics_abstraction_layer.h
index 24c84dda5..9dced85aa 100644
--- a/include/gal/graphics_abstraction_layer.h
+++ b/include/gal/graphics_abstraction_layer.h
@@ -918,26 +918,6 @@ public:
}
/**
- * @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.
*
* @param aCursorPosition is the cursor position in screen coordinates.
@@ -1021,7 +1001,7 @@ protected:
bool isCursorEnabled; ///< Is the cursor enabled?
bool forceDisplayCursor; ///< Always show cursor
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)
/// Instance of object that stores information about how to draw texts
diff --git a/include/widgets/gal_options_panel.h b/include/widgets/gal_options_panel.h
index 8bbfbc51c..d94c5753c 100644
--- a/include/widgets/gal_options_panel.h
+++ b/include/widgets/gal_options_panel.h
@@ -65,6 +65,7 @@ private:
wxSpinButton* m_gridMinSpacingSpinBtn;
wxStaticText* l_gridMinSpacingUnits;
+ wxRadioBox* m_cursorShape;
wxCheckBox* m_forceCursorDisplay;
///> The GAL options to read/write
diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h
index b6c0766cc..5919f969c 100644
--- a/include/wxPcbStruct.h
+++ b/include/wxPcbStruct.h
@@ -371,9 +371,6 @@ public:
*/
virtual void SetGridColor( COLOR4D aColor ) override;
- ///> @copydoc EDA_DRAW_FRAME::SetCursorShape()
- virtual void SetCursorShape( int aCursorShape ) override;
-
// Configurations:
void Process_Config( wxCommandEvent& event );
diff --git a/pcbnew/dialogs/dialog_general_options.cpp b/pcbnew/dialogs/dialog_general_options.cpp
index 8f2b0fb88..6e204ee24 100644
--- a/pcbnew/dialogs/dialog_general_options.cpp
+++ b/pcbnew/dialogs/dialog_general_options.cpp
@@ -65,14 +65,6 @@ void DIALOG_GENERALOPTIONS::init()
m_PolarDisplay->SetSelection( displ_opts->m_DisplayPolarCood ? 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;
rotationAngle = AngleToStringDegrees( (double)GetParent()->GetRotationAngle() );
m_RotationAngle->SetValue( rotationAngle );
@@ -114,9 +106,6 @@ void DIALOG_GENERALOPTIONS::OnOkClick( wxCommandEvent& event )
if( ii != g_UserUnit )
GetParent()->ReCreateAuxiliaryToolbar();
-#ifndef __APPLE__
- GetParent()->SetCursorShape( m_CursorShape->GetSelection() );
-#endif // !__APPLE__
GetParent()->SetAutoSaveInterval( m_SaveTime->GetValue() * 60 );
GetParent()->SetRotationAngle( wxRound( 10.0 * wxAtof( m_RotationAngle->GetValue() ) ) );
diff --git a/pcbnew/dialogs/dialog_general_options_BoardEditor_base.cpp b/pcbnew/dialogs/dialog_general_options_BoardEditor_base.cpp
index c205332fa..6edbf2c1a 100644
--- a/pcbnew/dialogs/dialog_general_options_BoardEditor_base.cpp
+++ b/pcbnew/dialogs/dialog_general_options_BoardEditor_base.cpp
@@ -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/
//
// 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 );
- 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 );
diff --git a/pcbnew/dialogs/dialog_general_options_BoardEditor_base.fbp b/pcbnew/dialogs/dialog_general_options_BoardEditor_base.fbp
index c76acda56..8a444b9ce 100644
--- a/pcbnew/dialogs/dialog_general_options_BoardEditor_base.fbp
+++ b/pcbnew/dialogs/dialog_general_options_BoardEditor_base.fbp
@@ -291,96 +291,6 @@
<event name="OnUpdateUI"></event>
</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">"Small cross" "Full screen cursor"</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 class="sizeritem" expanded="1">
diff --git a/pcbnew/dialogs/dialog_general_options_BoardEditor_base.h b/pcbnew/dialogs/dialog_general_options_BoardEditor_base.h
index 3ca62be9d..85ac74375 100644
--- a/pcbnew/dialogs/dialog_general_options_BoardEditor_base.h
+++ b/pcbnew/dialogs/dialog_general_options_BoardEditor_base.h
@@ -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/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@@ -44,7 +44,6 @@ class DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE : public DIALOG_SHIM
{
wxID_POLAR_CTRL = 1000,
wxID_UNITS,
- wxID_CURSOR_SHAPE,
wxID_DRC_ONOFF,
wxID_GENERAL_RATSNEST,
wxID_TRACK_AUTODEL,
@@ -56,7 +55,6 @@ class DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE : public DIALOG_SHIM
wxRadioBox* m_PolarDisplay;
wxRadioBox* m_UnitsSelection;
- wxRadioBox* m_CursorShape;
wxStaticText* m_staticTextmaxlinks;
wxSpinCtrl* m_MaxShowLinks;
wxStaticText* m_staticTextautosave;
diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp
index 4927fdc16..77a5b62c4 100644
--- a/pcbnew/pcbframe.cpp
+++ b/pcbnew/pcbframe.cpp
@@ -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()
{
int copperlayercnt = GetBoard()->GetCopperLayerCount( );
diff --git a/pcbnew/tools/pcbnew_control.cpp b/pcbnew/tools/pcbnew_control.cpp
index c7cb553e6..d143d9640 100644
--- a/pcbnew/tools/pcbnew_control.cpp
+++ b/pcbnew/tools/pcbnew_control.cpp
@@ -709,12 +709,10 @@ int PCBNEW_CONTROL::ResetCoords( const TOOL_EVENT& aEvent )
int PCBNEW_CONTROL::SwitchCursor( const TOOL_EVENT& aEvent )
{
- const unsigned int BIG_CURSOR = 8000;
- const unsigned int SMALL_CURSOR = 80;
+ auto& galOpts = m_frame->GetGalDisplayOptions();
- PCB_BASE_FRAME* frame = getEditFrame<PCB_BASE_FRAME>();
- KIGFX::GAL* gal = frame->GetGalCanvas()->GetGAL();
- gal->SetCursorSize( frame->GetCursorShape() ? BIG_CURSOR : SMALL_CURSOR );
+ galOpts.m_fullscreenCursor = !galOpts.m_fullscreenCursor;
+ galOpts.NotifyChanged();
return 0;
}
--
2.12.0
From 15780fdf539a9f9249f79f864282f7357bb6ff04 Mon Sep 17 00:00:00 2001
From: John Beard <john.j.beard@xxxxxxxxx>
Date: Sun, 19 Mar 2017 09:39:38 +0800
Subject: [PATCH 3/4] Move sketch mode area in pcbnew display options
This gives a bit more space to the GAL options in the left panel
Also tidy up some code style and unnecessary default arguments in the
GAL display planel widget.
---
common/widgets/gal_options_panel.cpp | 35 ++-
pcbnew/dialogs/dialog_display_options_base.cpp | 24 +-
pcbnew/dialogs/dialog_display_options_base.fbp | 384 ++++++++++++-------------
pcbnew/dialogs/dialog_display_options_base.h | 12 +-
4 files changed, 226 insertions(+), 229 deletions(-)
diff --git a/common/widgets/gal_options_panel.cpp b/common/widgets/gal_options_panel.cpp
index 20f8bd96e..8f9e8f4c7 100644
--- a/common/widgets/gal_options_panel.cpp
+++ b/common/widgets/gal_options_panel.cpp
@@ -77,14 +77,14 @@ GAL_OPTIONS_PANEL::GAL_OPTIONS_PANEL( wxWindow* aParent, KIGFX::GAL_DISPLAY_OPTI
{
wxStaticBoxSizer* sOpenGLRenderingSizer;
sOpenGLRenderingSizer = new wxStaticBoxSizer( new wxStaticBox( this,
- wxID_ANY, _("OpenGL Rendering:") ), wxVERTICAL );
+ wxID_ANY, _( "OpenGL Rendering:" ) ), wxVERTICAL );
wxString m_choiceAntialiasingChoices[] = {
- _("No Antialiasing"),
- _("Subpixel Antialiasing (High Quality)"),
- _("Subpixel Antialiasing (Ultra Quality)"),
- _("Supersampling (2x)"),
- _("Supersampling (4x)")
+ _( "No Antialiasing" ),
+ _( "Subpixel Antialiasing (High Quality)" ),
+ _( "Subpixel Antialiasing (Ultra Quality)" ),
+ _( "Supersampling (2x)" ),
+ _( "Supersampling (4x)" )
};
int m_choiceAntialiasingNChoices = sizeof( m_choiceAntialiasingChoices ) / sizeof( wxString );
m_choiceAntialiasing = new wxChoice( sOpenGLRenderingSizer->GetStaticBox(),
@@ -104,9 +104,9 @@ GAL_OPTIONS_PANEL::GAL_OPTIONS_PANEL( wxWindow* aParent, KIGFX::GAL_DISPLAY_OPTI
wxID_ANY, _("Grid Display (OpenGL && Cairo)") ), wxVERTICAL );
wxString m_gridStyleChoices[] = {
- _("Dots"),
- _("Lines"),
- _("Small crosses")
+ _( "Dots" ),
+ _( "Lines" ),
+ _( "Small crosses" )
};
int m_gridStyleNChoices = sizeof( m_gridStyleChoices ) / sizeof( wxString );
m_gridStyle = new wxRadioBox( sGridSettings->GetStaticBox(),
@@ -122,12 +122,11 @@ GAL_OPTIONS_PANEL::GAL_OPTIONS_PANEL( wxWindow* aParent, KIGFX::GAL_DISPLAY_OPTI
sGridSettingsGrid->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
l_gridLineWidth = new wxStaticText( sGridSettings->GetStaticBox(),
- wxID_ANY, _("Grid thickness:"), wxDefaultPosition, wxDefaultSize, 0 );
+ wxID_ANY, _( "Grid thickness:" ) );
l_gridLineWidth->Wrap( -1 );
sGridSettingsGrid->Add( l_gridLineWidth, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
- m_gridLineWidth = new wxTextCtrl( sGridSettings->GetStaticBox(),
- wxID_ANY, _("0.5"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_gridLineWidth = new wxTextCtrl( sGridSettings->GetStaticBox(), wxID_ANY );
sGridSettingsGrid->Add( m_gridLineWidth, 0, wxEXPAND, 5 );
m_gridLineWidthSpinBtn = new wxSpinButton( sGridSettings->GetStaticBox(),
@@ -135,17 +134,16 @@ GAL_OPTIONS_PANEL::GAL_OPTIONS_PANEL( wxWindow* aParent, KIGFX::GAL_DISPLAY_OPTI
sGridSettingsGrid->Add( m_gridLineWidthSpinBtn, 0, wxEXPAND | wxALL, 0 );
l_gridLineWidthUnits = new wxStaticText( sGridSettings->GetStaticBox(),
- wxID_ANY, _("px"), wxDefaultPosition, wxDefaultSize, 0 );
+ wxID_ANY, _( "px" ) );
l_gridLineWidthUnits->Wrap( -1 );
sGridSettingsGrid->Add( l_gridLineWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
l_gridMinSpacing = new wxStaticText( sGridSettings->GetStaticBox(),
- wxID_ANY, _("Min grid spacing:"), wxDefaultPosition, wxDefaultSize, 0 );
+ wxID_ANY, _( "Min grid spacing:" ) );
l_gridMinSpacing->Wrap( -1 );
sGridSettingsGrid->Add( l_gridMinSpacing, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
- m_gridMinSpacing = new wxTextCtrl( sGridSettings->GetStaticBox(),
- wxID_ANY, _("10"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_gridMinSpacing = new wxTextCtrl( sGridSettings->GetStaticBox(), wxID_ANY);
sGridSettingsGrid->Add( m_gridMinSpacing, 0, wxEXPAND, 5 );
m_gridMinSpacingSpinBtn = new wxSpinButton( sGridSettings->GetStaticBox(),
@@ -153,7 +151,7 @@ GAL_OPTIONS_PANEL::GAL_OPTIONS_PANEL( wxWindow* aParent, KIGFX::GAL_DISPLAY_OPTI
sGridSettingsGrid->Add( m_gridMinSpacingSpinBtn, 0, wxEXPAND | wxALL, 0 );
l_gridMinSpacingUnits = new wxStaticText( sGridSettings->GetStaticBox(),
- wxID_ANY, _("px"), wxDefaultPosition, wxDefaultSize, 0 );
+ wxID_ANY, _( "px" ) );
l_gridMinSpacingUnits->Wrap( -1 );
sGridSettingsGrid->Add( l_gridMinSpacingUnits, 0, wxALL, 5 );
@@ -179,7 +177,7 @@ GAL_OPTIONS_PANEL::GAL_OPTIONS_PANEL( wxWindow* aParent, KIGFX::GAL_DISPLAY_OPTI
{
auto sCursorSettings = new wxStaticBoxSizer( new wxStaticBox( this,
- wxID_ANY, _("Cursor Display (OpenGL && Cairo)") ), wxVERTICAL );
+ wxID_ANY, _( "Cursor Display (OpenGL && Cairo)" ) ), wxVERTICAL );
sLeftSizer->Add( sCursorSettings, 1, wxALL | wxEXPAND, 5 );
@@ -187,7 +185,6 @@ GAL_OPTIONS_PANEL::GAL_OPTIONS_PANEL( wxWindow* aParent, KIGFX::GAL_DISPLAY_OPTI
sCursorSettings->Add( m_forceCursorDisplay, 0, wxALL | wxEXPAND, 5 );
}
-
}
diff --git a/pcbnew/dialogs/dialog_display_options_base.cpp b/pcbnew/dialogs/dialog_display_options_base.cpp
index 3dfea2003..ddf6e45d2 100644
--- a/pcbnew/dialogs/dialog_display_options_base.cpp
+++ b/pcbnew/dialogs/dialog_display_options_base.cpp
@@ -21,18 +21,6 @@ DIALOG_DISPLAY_OPTIONS_BASE::DIALOG_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWi
sLeftSizer = new wxBoxSizer( wxVERTICAL );
- wxStaticBoxSizer* sSketchModeSizer;
- sSketchModeSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Tracks and Vias:") ), wxVERTICAL );
-
- m_OptDisplayTracks = new wxCheckBox( sSketchModeSizer->GetStaticBox(), wxID_ANY, _("Show tracks in sketch mode"), wxDefaultPosition, wxDefaultSize, 0 );
- sSketchModeSizer->Add( m_OptDisplayTracks, 0, wxALL, 5 );
-
- m_OptDisplayVias = new wxCheckBox( sSketchModeSizer->GetStaticBox(), wxID_ANY, _("Show vias in sketch mode"), wxDefaultPosition, wxDefaultSize, 0 );
- sSketchModeSizer->Add( m_OptDisplayVias, 0, wxALL, 5 );
-
-
- sLeftSizer->Add( sSketchModeSizer, 0, wxALL|wxEXPAND, 5 );
-
bupperSizer->Add( sLeftSizer, 1, wxEXPAND, 5 );
@@ -61,6 +49,18 @@ DIALOG_DISPLAY_OPTIONS_BASE::DIALOG_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWi
wxBoxSizer* sRightSizer;
sRightSizer = new wxBoxSizer( wxVERTICAL );
+ wxStaticBoxSizer* sSketchModeSizer;
+ sSketchModeSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Tracks and Vias:") ), wxVERTICAL );
+
+ m_OptDisplayTracks = new wxCheckBox( sSketchModeSizer->GetStaticBox(), wxID_ANY, _("Show tracks in sketch mode"), wxDefaultPosition, wxDefaultSize, 0 );
+ sSketchModeSizer->Add( m_OptDisplayTracks, 0, wxALL, 5 );
+
+ m_OptDisplayVias = new wxCheckBox( sSketchModeSizer->GetStaticBox(), wxID_ANY, _("Show vias in sketch mode"), wxDefaultPosition, wxDefaultSize, 0 );
+ sSketchModeSizer->Add( m_OptDisplayVias, 0, wxALL, 5 );
+
+
+ sRightSizer->Add( sSketchModeSizer, 0, wxALL|wxEXPAND, 5 );
+
wxStaticBoxSizer* sfootprintSizer;
sfootprintSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Footprints:") ), wxVERTICAL );
diff --git a/pcbnew/dialogs/dialog_display_options_base.fbp b/pcbnew/dialogs/dialog_display_options_base.fbp
index 4e5dcf304..90ace2180 100644
--- a/pcbnew/dialogs/dialog_display_options_base.fbp
+++ b/pcbnew/dialogs/dialog_display_options_base.fbp
@@ -111,197 +111,6 @@
<property name="name">sLeftSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">protected</property>
- <object class="sizeritem" expanded="0">
- <property name="border">5</property>
- <property name="flag">wxALL|wxEXPAND</property>
- <property name="proportion">0</property>
- <object class="wxStaticBoxSizer" expanded="0">
- <property name="id">wxID_ANY</property>
- <property name="label">Tracks and Vias:</property>
- <property name="minimum_size"></property>
- <property name="name">sSketchModeSizer</property>
- <property name="orient">wxVERTICAL</property>
- <property name="parent">1</property>
- <property name="permission">none</property>
- <event name="OnUpdateUI"></event>
- <object class="sizeritem" expanded="0">
- <property name="border">5</property>
- <property name="flag">wxALL</property>
- <property name="proportion">0</property>
- <object class="wxCheckBox" 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="checked">0</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_ANY</property>
- <property name="label">Show tracks in sketch mode</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_OptDisplayTracks</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="show">1</property>
- <property name="size"></property>
- <property name="style"></property>
- <property name="subclass"></property>
- <property name="toolbar_pane">0</property>
- <property name="tooltip"></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="OnCheckBox"></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="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 class="sizeritem" expanded="0">
- <property name="border">5</property>
- <property name="flag">wxALL</property>
- <property name="proportion">0</property>
- <object class="wxCheckBox" 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="checked">0</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_ANY</property>
- <property name="label">Show vias in sketch mode</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_OptDisplayVias</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="show">1</property>
- <property name="size"></property>
- <property name="style"></property>
- <property name="subclass"></property>
- <property name="toolbar_pane">0</property>
- <property name="tooltip"></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="OnCheckBox"></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="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="0">
@@ -503,13 +312,204 @@
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
- <object class="wxBoxSizer" expanded="0">
+ <object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">sRightSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
+ <property name="flag">wxALL|wxEXPAND</property>
+ <property name="proportion">0</property>
+ <object class="wxStaticBoxSizer" expanded="0">
+ <property name="id">wxID_ANY</property>
+ <property name="label">Tracks and Vias:</property>
+ <property name="minimum_size"></property>
+ <property name="name">sSketchModeSizer</property>
+ <property name="orient">wxVERTICAL</property>
+ <property name="parent">1</property>
+ <property name="permission">none</property>
+ <event name="OnUpdateUI"></event>
+ <object class="sizeritem" expanded="0">
+ <property name="border">5</property>
+ <property name="flag">wxALL</property>
+ <property name="proportion">0</property>
+ <object class="wxCheckBox" 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="checked">0</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_ANY</property>
+ <property name="label">Show tracks in sketch mode</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_OptDisplayTracks</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="show">1</property>
+ <property name="size"></property>
+ <property name="style"></property>
+ <property name="subclass"></property>
+ <property name="toolbar_pane">0</property>
+ <property name="tooltip"></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="OnCheckBox"></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="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 class="sizeritem" expanded="0">
+ <property name="border">5</property>
+ <property name="flag">wxALL</property>
+ <property name="proportion">0</property>
+ <object class="wxCheckBox" 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="checked">0</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_ANY</property>
+ <property name="label">Show vias in sketch mode</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_OptDisplayVias</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="show">1</property>
+ <property name="size"></property>
+ <property name="style"></property>
+ <property name="subclass"></property>
+ <property name="toolbar_pane">0</property>
+ <property name="tooltip"></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="OnCheckBox"></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="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 class="sizeritem" expanded="0">
+ <property name="border">5</property>
<property name="flag">wxEXPAND|wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticBoxSizer" expanded="0">
diff --git a/pcbnew/dialogs/dialog_display_options_base.h b/pcbnew/dialogs/dialog_display_options_base.h
index 7bc54919f..641246e7f 100644
--- a/pcbnew/dialogs/dialog_display_options_base.h
+++ b/pcbnew/dialogs/dialog_display_options_base.h
@@ -14,15 +14,15 @@
class DIALOG_SHIM;
#include "dialog_shim.h"
-#include <wx/string.h>
-#include <wx/checkbox.h>
+#include <wx/sizer.h>
#include <wx/gdicmn.h>
+#include <wx/string.h>
+#include <wx/radiobox.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
-#include <wx/sizer.h>
#include <wx/statbox.h>
-#include <wx/radiobox.h>
+#include <wx/checkbox.h>
#include <wx/button.h>
#include <wx/dialog.h>
@@ -42,10 +42,10 @@ class DIALOG_DISPLAY_OPTIONS_BASE : public DIALOG_SHIM
};
wxBoxSizer* sLeftSizer;
- wxCheckBox* m_OptDisplayTracks;
- wxCheckBox* m_OptDisplayVias;
wxRadioBox* m_ShowNetNamesOption;
wxRadioBox* m_OptDisplayTracksClearance;
+ wxCheckBox* m_OptDisplayTracks;
+ wxCheckBox* m_OptDisplayVias;
wxCheckBox* m_OptDisplayModOutlines;
wxCheckBox* m_OptDisplayModTexts
;
--
2.12.0
From 09ac231470f3454a52efdc0e3728f423dafffef7 Mon Sep 17 00:00:00 2001
From: John Beard <john.j.beard@xxxxxxxxx>
Date: Sun, 19 Mar 2017 06:00:21 +0800
Subject: [PATCH 2/4] 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.
---
common/gal/cairo/cairo_gal.cpp | 15 ++++++++++-----
common/gal/graphics_abstraction_layer.cpp | 15 +++++++++++++++
common/gal/opengl/opengl_gal.cpp | 8 ++++++--
include/gal/graphics_abstraction_layer.h | 5 +++++
4 files changed, 36 insertions(+), 7 deletions(-)
diff --git a/common/gal/cairo/cairo_gal.cpp b/common/gal/cairo/cairo_gal.cpp
index 9480cf5fc..948cdcbbc 100644
--- a/common/gal/cairo/cairo_gal.cpp
+++ b/common/gal/cairo/cairo_gal.cpp
@@ -969,9 +969,11 @@ void CAIRO_GAL::initCursor()
wxMemoryDC cursorShape( *cursorPixels );
+ const auto cColor = getCursorColor();
+
cursorShape.SetBackground( *wxTRANSPARENT_BRUSH );
- wxColour color( cursorColor.r * cursorColor.a * 255, cursorColor.g * cursorColor.a * 255,
- cursorColor.b * cursorColor.a * 255, 255 );
+ wxColour color( cColor.r * cColor.a * 255, cColor.g * cColor.a * 255,
+ cColor.b * cColor.a * 255, 255 );
wxPen pen = wxPen( color );
cursorShape.SetPen( pen );
cursorShape.Clear();
@@ -983,15 +985,18 @@ void CAIRO_GAL::initCursor()
void CAIRO_GAL::blitCursor( wxMemoryDC& clientDC )
{
- if( !isCursorEnabled )
+ if( !IsCursorEnabled() )
return;
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, p.y - cursorSize / 2, p.x, p.y + cursorSize / 2 );
-
}
diff --git a/common/gal/graphics_abstraction_layer.cpp b/common/gal/graphics_abstraction_layer.cpp
index 640ca45aa..f88d4701f 100644
--- a/common/gal/graphics_abstraction_layer.cpp
+++ b/common/gal/graphics_abstraction_layer.cpp
@@ -385,3 +385,18 @@ VECTOR2D GAL::GetGridPoint( const VECTOR2D& aPoint ) const
const int GAL::MIN_DEPTH = -1024;
const int GAL::MAX_DEPTH = 1023;
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;
+}
diff --git a/common/gal/opengl/opengl_gal.cpp b/common/gal/opengl/opengl_gal.cpp
index f48794f4e..6753df676 100644
--- a/common/gal/opengl/opengl_gal.cpp
+++ b/common/gal/opengl/opengl_gal.cpp
@@ -1665,7 +1665,7 @@ void OPENGL_GAL::skipMouseEvent( wxMouseEvent& aEvent )
void OPENGL_GAL::blitCursor()
{
- if( !isCursorEnabled )
+ if( !IsCursorEnabled() )
return;
compositor->SetBuffer( OPENGL_COMPOSITOR::DIRECT_RENDERING );
@@ -1674,9 +1674,13 @@ void OPENGL_GAL::blitCursor()
VECTOR2D cursorEnd = cursorPosition + cursorSize / ( 2 * worldScale );
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 );
glLineWidth( 1.0 );
- glColor4d( cursorColor.r, cursorColor.g, cursorColor.b, cursorColor.a );
+ glColor4d( color.r, color.g, color.b, color.a );
glBegin( GL_LINES );
glVertex2d( cursorCenter.x, cursorBegin.y );
diff --git a/include/gal/graphics_abstraction_layer.h b/include/gal/graphics_abstraction_layer.h
index 341bb149f..24c84dda5 100644
--- a/include/gal/graphics_abstraction_layer.h
+++ b/include/gal/graphics_abstraction_layer.h
@@ -1055,6 +1055,11 @@ protected:
/// Depth level on which the grid is drawn
static const int GRID_DEPTH;
+ /**
+ * Gets the actual cursor color to draw
+ */
+ COLOR4D getCursorColor() const;
+
// ---------------
// Settings observer interface
// ---------------
--
2.12.0
From 8e0785b3d30808bdbf986f31cc5bcd60f33999db Mon Sep 17 00:00:00 2001
From: John Beard <john.j.beard@xxxxxxxxx>
Date: Sun, 19 Mar 2017 04:03:24 +0800
Subject: [PATCH 1/4] 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
---
common/gal/gal_display_options.cpp | 12 ++++++++++--
common/gal/graphics_abstraction_layer.cpp | 7 +++++++
common/tool/common_tools.cpp | 20 ++++++++++++++++++++
common/view/view_controls.cpp | 4 +++-
common/widgets/gal_options_panel.cpp | 18 +++++++++++++++++-
include/gal/gal_display_options.h | 3 +++
include/gal/graphics_abstraction_layer.h | 3 ++-
include/tool/common_tools.h | 3 +++
include/widgets/gal_options_panel.h | 5 +++++
9 files changed, 70 insertions(+), 5 deletions(-)
diff --git a/common/gal/gal_display_options.cpp b/common/gal/gal_display_options.cpp
index 803adf3d8..f09cd19d1 100644
--- a/common/gal/gal_display_options.cpp
+++ b/common/gal/gal_display_options.cpp
@@ -36,6 +36,7 @@ static const wxString GalGridStyleConfig( "GridStyle" );
static const wxString GalGridLineWidthConfig( "GridLineWidth" );
static const wxString GalGridMaxDensityConfig( "GridMaxDensity" );
static const wxString GalGridAxesEnabledConfig( "GridAxesEnabled" );
+static const wxString GalForceDisplayCursorConfig( "ForceDisplayCursor" );
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 ),
m_gridStyle( GRID_STYLE::DOTS ),
m_gridLineWidth( 0.5 ),
- m_gridMinSpacing( 10 ),
- m_axesEnabled( false )
+ m_gridMinSpacing( 10.0 ),
+ m_axesEnabled( false ),
+ m_forceDisplayCursor( false )
{}
@@ -86,6 +88,9 @@ void GAL_DISPLAY_OPTIONS::ReadConfig( wxConfigBase* aCfg, wxString aBaseName )
aCfg->Read( aBaseName + GalGridAxesEnabledConfig,
&m_axesEnabled, false );
+ aCfg->Read( aBaseName + GalForceDisplayCursorConfig,
+ &m_forceDisplayCursor, false );
+
NotifyChanged();
}
@@ -106,6 +111,9 @@ void GAL_DISPLAY_OPTIONS::WriteConfig( wxConfigBase* aCfg, wxString aBaseName )
aCfg->Write( aBaseName + GalGridAxesEnabledConfig,
m_axesEnabled );
+
+ aCfg->Write( aBaseName + GalForceDisplayCursorConfig,
+ m_forceDisplayCursor );
}
diff --git a/common/gal/graphics_abstraction_layer.cpp b/common/gal/graphics_abstraction_layer.cpp
index 13d79fd09..640ca45aa 100644
--- a/common/gal/graphics_abstraction_layer.cpp
+++ b/common/gal/graphics_abstraction_layer.cpp
@@ -67,6 +67,7 @@ GAL::GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions ) :
SetCursorColor( COLOR4D( 1.0, 1.0, 1.0, 1.0 ) );
SetCursorSize( 80 );
SetCursorEnabled( false );
+ forceDisplayCursor = false;
strokeFont.LoadNewStrokeFont( newstroke_font, newstroke_font_bufsize );
@@ -117,6 +118,12 @@ bool GAL::updatedGalDisplayOptions( const GAL_DISPLAY_OPTIONS& aOptions )
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
return refresh;
}
diff --git a/common/tool/common_tools.cpp b/common/tool/common_tools.cpp
index 1a6c3793c..60d941689 100644
--- a/common/tool/common_tools.cpp
+++ b/common/tool/common_tools.cpp
@@ -32,6 +32,13 @@
#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() :
TOOL_INTERACTIVE( "common.Control" ), m_frame( NULL )
{
@@ -194,6 +201,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()
{
Go( &COMMON_TOOLS::ZoomInOut, ACTIONS::zoomIn.MakeEvent() );
@@ -207,6 +225,8 @@ void COMMON_TOOLS::SetTransitions()
Go( &COMMON_TOOLS::GridNext, ACTIONS::gridNext.MakeEvent() );
Go( &COMMON_TOOLS::GridPrev, ACTIONS::gridPrev.MakeEvent() );
Go( &COMMON_TOOLS::GridPreset, ACTIONS::gridPreset.MakeEvent() );
+
+ Go( &COMMON_TOOLS::ToggleCursor, ACT_toggleCursor.MakeEvent() );
}
diff --git a/common/view/view_controls.cpp b/common/view/view_controls.cpp
index 4c2e10ac1..3330653a3 100644
--- a/common/view/view_controls.cpp
+++ b/common/view/view_controls.cpp
@@ -39,7 +39,9 @@ void VIEW_CONTROLS::ShowCursor( bool aEnabled )
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;
}
diff --git a/common/widgets/gal_options_panel.cpp b/common/widgets/gal_options_panel.cpp
index e18746d07..20f8bd96e 100644
--- a/common/widgets/gal_options_panel.cpp
+++ b/common/widgets/gal_options_panel.cpp
@@ -159,7 +159,7 @@ GAL_OPTIONS_PANEL::GAL_OPTIONS_PANEL( wxWindow* aParent, KIGFX::GAL_DISPLAY_OPTI
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
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 );
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_forceCursorDisplay->SetValue( m_galOptions.m_forceDisplayCursor );
+
return true;
}
@@ -207,6 +221,8 @@ bool GAL_OPTIONS_PANEL::TransferDataFromWindow()
m_galOptions.m_gridMinSpacing = m_gridMinSpacingIncrementer->GetValue();
+ m_galOptions.m_forceDisplayCursor = m_forceCursorDisplay->GetValue();
+
m_galOptions.NotifyChanged();
return true;
diff --git a/include/gal/gal_display_options.h b/include/gal/gal_display_options.h
index 733cb2b91..d9e684b73 100644
--- a/include/gal/gal_display_options.h
+++ b/include/gal/gal_display_options.h
@@ -84,6 +84,9 @@ namespace KIGFX
///> Whether or not to draw the coordinate system axes
bool m_axesEnabled;
+
+ ///> Force cursor display
+ bool m_forceDisplayCursor;
};
}
diff --git a/include/gal/graphics_abstraction_layer.h b/include/gal/graphics_abstraction_layer.h
index c9b9fac9b..341bb149f 100644
--- a/include/gal/graphics_abstraction_layer.h
+++ b/include/gal/graphics_abstraction_layer.h
@@ -904,7 +904,7 @@ public:
*/
bool IsCursorEnabled() const
{
- return isCursorEnabled;
+ return isCursorEnabled || forceDisplayCursor;
}
/**
@@ -1019,6 +1019,7 @@ protected:
// Cursor settings
bool isCursorEnabled; ///< Is the cursor enabled?
+ bool forceDisplayCursor; ///< Always show cursor
COLOR4D cursorColor; ///< Cursor color
unsigned int cursorSize; ///< Size of the cursor in pixels
VECTOR2D cursorPosition; ///< Current cursor position (world coordinates)
diff --git a/include/tool/common_tools.h b/include/tool/common_tools.h
index 9f604026f..d3dd3836b 100644
--- a/include/tool/common_tools.h
+++ b/include/tool/common_tools.h
@@ -51,6 +51,9 @@ public:
int ZoomFitScreen( const TOOL_EVENT& aEvent );
int ZoomPreset( const TOOL_EVENT& aEvent );
+ // Cursor control
+ int ToggleCursor( const TOOL_EVENT& aEvent );
+
// Grid control
int GridNext( const TOOL_EVENT& aEvent );
int GridPrev( const TOOL_EVENT& aEvent );
diff --git a/include/widgets/gal_options_panel.h b/include/widgets/gal_options_panel.h
index 94d905f46..8bbfbc51c 100644
--- a/include/widgets/gal_options_panel.h
+++ b/include/widgets/gal_options_panel.h
@@ -52,16 +52,21 @@ private:
wxBoxSizer* m_mainSizer;
wxChoice* m_choiceAntialiasing;
+
wxRadioBox* m_gridStyle;
+
wxStaticText* l_gridLineWidth;
wxTextCtrl* m_gridLineWidth;
wxSpinButton* m_gridLineWidthSpinBtn;
wxStaticText* l_gridLineWidthUnits;
+
wxStaticText* l_gridMinSpacing;
wxTextCtrl* m_gridMinSpacing;
wxSpinButton* m_gridMinSpacingSpinBtn;
wxStaticText* l_gridMinSpacingUnits;
+ wxCheckBox* m_forceCursorDisplay;
+
///> The GAL options to read/write
KIGFX::GAL_DISPLAY_OPTIONS& m_galOptions;
--
2.12.0
Follow ups