7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-20 00:21:31 +00:00

Implement Get/Set display options

The pointer passing for display options is deprecated.  This removes the
excess casting as the EDA_FRAME didn't need the base call with no value.
All requests for display options are now returned const and are updated
with a Set() routine after modification.

In Gerbview, this resolves an issue where the display options were not
stored because it was receiving the NULL from EDA_FRAME.
This commit is contained in:
Seth Hillbrand 2019-11-07 06:23:09 -08:00
parent 29ce76b4e4
commit 6625d0721e
54 changed files with 314 additions and 292 deletions

View File

@ -55,12 +55,12 @@ void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::initDialog()
/* mandatory to use escape key as cancel under wxGTK. */
SetFocus();
auto displ_opts = (PCB_DISPLAY_OPTIONS*)m_Parent->GetDisplayOptions();
auto& displ_opts = m_Parent->GetDisplayOptions();
m_EdgesDisplayOption->SetValue( not displ_opts->m_DisplayModEdgeFill );
m_TextDisplayOption->SetValue( not displ_opts->m_DisplayModTextFill );
m_ShowPadSketch->SetValue( not displ_opts->m_DisplayPadFill );
m_ShowPadNum->SetValue( displ_opts->m_DisplayPadNum );
m_EdgesDisplayOption->SetValue( not displ_opts.m_DisplayModEdgeFill );
m_TextDisplayOption->SetValue( not displ_opts.m_DisplayModTextFill );
m_ShowPadSketch->SetValue( not displ_opts.m_DisplayPadFill );
m_ShowPadNum->SetValue( displ_opts.m_DisplayPadNum );
m_autoZoomOption->SetValue( m_Parent->GetAutoZoom() );
}
@ -68,13 +68,14 @@ void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::initDialog()
void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::UpdateObjectSettings( void )
{
auto displ_opts = (PCB_DISPLAY_OPTIONS*)m_Parent->GetDisplayOptions();
PCB_DISPLAY_OPTIONS displ_opts = m_Parent->GetDisplayOptions();
displ_opts->m_DisplayModEdgeFill = not m_EdgesDisplayOption->GetValue();
displ_opts->m_DisplayModTextFill = not m_TextDisplayOption->GetValue();
displ_opts->m_DisplayPadNum = m_ShowPadNum->GetValue();
displ_opts->m_DisplayPadFill = not m_ShowPadSketch->GetValue();
displ_opts.m_DisplayModEdgeFill = not m_EdgesDisplayOption->GetValue();
displ_opts.m_DisplayModTextFill = not m_TextDisplayOption->GetValue();
displ_opts.m_DisplayPadNum = m_ShowPadNum->GetValue();
displ_opts.m_DisplayPadFill = not m_ShowPadSketch->GetValue();
m_Parent->ApplyDisplaySettingsToGAL();
m_Parent->SetDisplayOptions( displ_opts );
m_Parent->SetAutoZoom( m_autoZoomOption->GetValue() );
}

View File

@ -84,11 +84,12 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, wxWindow* aPa
GetScreen()->SetGrid( m_LastGridSizeId + ID_POPUP_GRID_LEVEL_1000 );
// Initialize some display options
auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
displ_opts->m_DisplayPadIsol = false; // Pad clearance has no meaning here
auto displ_opts = GetDisplayOptions();
displ_opts.m_DisplayPadIsol = false; // Pad clearance has no meaning here
// Track and via clearance has no meaning here.
displ_opts->m_ShowTrackClearanceMode = PCB_DISPLAY_OPTIONS::DO_NOT_SHOW_CLEARANCE;
displ_opts.m_ShowTrackClearanceMode = PCB_DISPLAY_OPTIONS::DO_NOT_SHOW_CLEARANCE;
SetDisplayOptions( displ_opts );
// Create GAL canvas
#ifdef __WXMAC__
@ -285,7 +286,7 @@ void DISPLAY_FOOTPRINTS_FRAME::ApplyDisplaySettingsToGAL()
{
auto painter = static_cast<KIGFX::PCB_PAINTER*>( GetCanvas()->GetView()->GetPainter() );
painter->GetSettings()->LoadDisplayOptions( &m_DisplayOptions, false );
painter->GetSettings()->LoadDisplayOptions( GetDisplayOptions(), false );
GetCanvas()->GetView()->UpdateAllItems( KIGFX::ALL );
GetCanvas()->Refresh();

View File

@ -46,11 +46,11 @@ bool PANEL_GERBVIEW_DISPLAY_OPTIONS::TransferDataToWindow( )
m_galOptsPanel->TransferDataToWindow();
// Show Option Draw Lines. We use DisplayPcbTrackFill as Lines draw option
m_OptDisplayLines->SetValue( !m_Parent->m_DisplayOptions.m_DisplayLinesFill );
m_OptDisplayFlashedItems->SetValue( !m_Parent->m_DisplayOptions.m_DisplayFlashedItemsFill );
m_OptDisplayLines->SetValue( !m_Parent->GetDisplayOptions().m_DisplayLinesFill );
m_OptDisplayFlashedItems->SetValue( !m_Parent->GetDisplayOptions().m_DisplayFlashedItemsFill );
// Show Option Draw polygons
m_OptDisplayPolygons->SetValue( !m_Parent->m_DisplayOptions.m_DisplayPolygonsFill );
m_OptDisplayPolygons->SetValue( !m_Parent->GetDisplayOptions().m_DisplayPolygonsFill );
m_OptDisplayDCodes->SetValue( m_Parent->IsElementVisible( LAYER_DCODES ) );
@ -60,30 +60,30 @@ bool PANEL_GERBVIEW_DISPLAY_OPTIONS::TransferDataToWindow( )
bool PANEL_GERBVIEW_DISPLAY_OPTIONS::TransferDataFromWindow()
{
auto displayOptions = (GBR_DISPLAY_OPTIONS*) m_Parent->GetDisplayOptions();
GBR_DISPLAY_OPTIONS displayOptions = m_Parent->GetDisplayOptions();
bool needs_repaint = false, option;
option = !m_OptDisplayLines->GetValue();
if( option != m_Parent->m_DisplayOptions.m_DisplayLinesFill )
if( option != displayOptions.m_DisplayLinesFill )
needs_repaint = true;
m_Parent->m_DisplayOptions.m_DisplayLinesFill = option;
displayOptions.m_DisplayLinesFill = option;
option = !m_OptDisplayFlashedItems->GetValue();
if( option != m_Parent->m_DisplayOptions.m_DisplayFlashedItemsFill )
if( option != m_Parent->GetDisplayOptions().m_DisplayFlashedItemsFill )
needs_repaint = true;
m_Parent->m_DisplayOptions.m_DisplayFlashedItemsFill = option;
displayOptions.m_DisplayFlashedItemsFill = option;
option = !m_OptDisplayPolygons->GetValue();
if( option != m_Parent->m_DisplayOptions.m_DisplayPolygonsFill )
if( option != displayOptions.m_DisplayPolygonsFill )
needs_repaint = true;
m_Parent->m_DisplayOptions.m_DisplayPolygonsFill = option;
displayOptions.m_DisplayPolygonsFill = option;
m_Parent->SetElementVisibility( LAYER_DCODES, m_OptDisplayDCodes->GetValue() );

View File

@ -38,7 +38,7 @@ bool PANEL_GERBVIEW_SETTINGS::TransferDataToWindow( )
{
m_PolarDisplay->SetSelection( m_Parent->GetShowPolarCoords() ? 1 : 0 );
m_BoxUnits->SetSelection( m_Parent->GetUserUnits() ? 1 : 0 );
m_ShowPageLimitsOpt->SetValue( m_Parent->m_DisplayOptions.m_DisplayPageLimits );
m_ShowPageLimitsOpt->SetValue( m_Parent->GetDisplayOptions().m_DisplayPageLimits );
for( unsigned i = 0; i < arrayDim( g_GerberPageSizeList ); ++i )
{
@ -57,11 +57,15 @@ bool PANEL_GERBVIEW_SETTINGS::TransferDataFromWindow()
{
m_Parent->SetShowPolarCoords( m_PolarDisplay->GetSelection() != 0 );
m_Parent->SetUserUnits( m_BoxUnits->GetSelection() == 0 ? INCHES : MILLIMETRES );
m_Parent->m_DisplayOptions.m_DisplayPageLimits = m_ShowPageLimitsOpt->GetValue();
auto opts = m_Parent->GetDisplayOptions();
opts.m_DisplayPageLimits = m_ShowPageLimitsOpt->GetValue();
PAGE_INFO pageInfo( g_GerberPageSizeList[ m_PageSize->GetSelection() ] );
m_Parent->SetPageSettings( pageInfo );
m_Parent->UpdateDisplayOptions( opts );
return true;
}

View File

@ -57,7 +57,7 @@ EDA_DRAW_PANEL_GAL( aParentWindow, aWindowId, aPosition, aSize, aOptions, aGalTy
if( frame )
{
auto displ_opts = (GBR_DISPLAY_OPTIONS*) frame->GetDisplayOptions();
auto& displ_opts = frame->GetDisplayOptions();
static_cast<KIGFX::GERBVIEW_RENDER_SETTINGS*>( m_view->GetPainter()->GetSettings() )
->LoadDisplayOptions( displ_opts );
UseColorScheme( frame->m_colorsSettings );
@ -107,7 +107,7 @@ void GERBVIEW_DRAW_PANEL_GAL::OnShow()
if( frame )
{
SetTopLayer( frame->GetActiveLayer() );
GBR_DISPLAY_OPTIONS* displ_opts = (GBR_DISPLAY_OPTIONS*) frame->GetDisplayOptions();
auto& displ_opts = frame->GetDisplayOptions();
static_cast<KIGFX::GERBVIEW_RENDER_SETTINGS*>(
m_view->GetPainter()->GetSettings() )->LoadDisplayOptions( displ_opts );
}

View File

@ -462,7 +462,7 @@ void GERBVIEW_FRAME::applyDisplaySettingsToGAL()
{
auto painter = static_cast<KIGFX::GERBVIEW_PAINTER*>( GetCanvas()->GetView()->GetPainter() );
KIGFX::GERBVIEW_RENDER_SETTINGS* settings = painter->GetSettings();
settings->LoadDisplayOptions( &m_DisplayOptions );
settings->LoadDisplayOptions( m_DisplayOptions );
settings->ImportLegacyColors( m_colorsSettings );

View File

@ -57,12 +57,26 @@ class REPORTER;
class GERBVIEW_FRAME : public EDA_DRAW_FRAME // PCB_BASE_FRAME
{
GBR_LAYOUT* m_gerberLayout;
wxPoint m_grid_origin;
PAGE_INFO m_paper; // used only to show paper limits to screen
GBR_LAYOUT* m_gerberLayout;
wxPoint m_grid_origin;
PAGE_INFO m_paper; // used only to show paper limits to screen
GBR_DISPLAY_OPTIONS m_DisplayOptions;
public:
GBR_DISPLAY_OPTIONS m_DisplayOptions;
/**
* Function GetDisplayOptions
* returns the display options current in use
*/
const GBR_DISPLAY_OPTIONS& GetDisplayOptions() const
{
return m_DisplayOptions;
}
void SetDisplayOptions( const GBR_DISPLAY_OPTIONS& aOptions )
{
m_DisplayOptions = aOptions;
}
/**
* Function SetLayout

View File

@ -76,20 +76,18 @@ void GERBVIEW_RENDER_SETTINGS::ImportLegacyColors( const COLORS_DESIGN_SETTINGS*
}
void GERBVIEW_RENDER_SETTINGS::LoadDisplayOptions( const GBR_DISPLAY_OPTIONS* aOptions )
void GERBVIEW_RENDER_SETTINGS::LoadDisplayOptions( const GBR_DISPLAY_OPTIONS& aOptions )
{
if( aOptions == NULL )
return;
m_spotFill = aOptions->m_DisplayFlashedItemsFill;
m_lineFill = aOptions->m_DisplayLinesFill;
m_polygonFill = aOptions->m_DisplayPolygonsFill;
m_showNegativeItems = aOptions->m_DisplayNegativeObjects;
m_showCodes = aOptions->m_DisplayDCodes;
m_diffMode = aOptions->m_DiffMode;
m_hiContrastEnabled = aOptions->m_HighContrastMode;
m_showPageLimits = aOptions->m_DisplayPageLimits;
m_backgroundColor = aOptions->m_BgDrawColor;
m_spotFill = aOptions.m_DisplayFlashedItemsFill;
m_lineFill = aOptions.m_DisplayLinesFill;
m_polygonFill = aOptions.m_DisplayPolygonsFill;
m_showNegativeItems = aOptions.m_DisplayNegativeObjects;
m_showCodes = aOptions.m_DisplayDCodes;
m_diffMode = aOptions.m_DiffMode;
m_hiContrastEnabled = aOptions.m_HighContrastMode;
m_showPageLimits = aOptions.m_DisplayPageLimits;
m_backgroundColor = aOptions.m_BgDrawColor;
update();
}

View File

@ -59,7 +59,7 @@ public:
* Loads settings related to display options
* @param aOptions are settings that you want to use for displaying items.
*/
void LoadDisplayOptions( const GBR_DISPLAY_OPTIONS* aOptions );
void LoadDisplayOptions( const GBR_DISPLAY_OPTIONS& aOptions );
/// @copydoc RENDER_SETTINGS::GetColor()
virtual const COLOR4D& GetColor( const VIEW_ITEM* aItem, int aLayer ) const override;

View File

@ -96,7 +96,7 @@ int GERBVIEW_CONTROL::DisplayControl( const TOOL_EVENT& aEvent )
{
bool state;
bool needs_refresh = false;
GBR_DISPLAY_OPTIONS options = m_frame->m_DisplayOptions;
auto options = m_frame->GetDisplayOptions();
if( aEvent.IsAction( &GERBVIEW_ACTIONS::linesDisplayOutlines ) )
{

View File

@ -512,7 +512,7 @@ bool GERBVIEW_SELECTION_TOOL::selectable( const EDA_ITEM* aItem ) const
}
// We do not want to select items that are in the background
if( frame->m_DisplayOptions.m_HighContrastMode && layer != frame->GetActiveLayer() )
if( frame->GetDisplayOptions().m_HighContrastMode && layer != frame->GetActiveLayer() )
return false;
return frame->IsLayerVisible( layer );

View File

@ -486,13 +486,6 @@ public:
virtual EDA_DRAW_PANEL_GAL* GetCanvas() const { return m_canvas; }
void SetCanvas( EDA_DRAW_PANEL_GAL* aPanel ) { m_canvas = aPanel; }
/**
* A way to pass info to draw functions. the base class has no knowledge about
* these options. It is virtual because this function must be overloaded to
* pass usefull info.
*/
virtual void* GetDisplayOptions() { return NULL; }
/**
* Return a reference to the gal rendering options used by GAL for rendering.
*/

View File

@ -67,16 +67,17 @@ class FP_LIB_TABLE;
class PCB_BASE_FRAME : public EDA_DRAW_FRAME
{
public:
PCB_DISPLAY_OPTIONS m_DisplayOptions;
wxPoint m_UserGridSize;
int m_FastGrid1; // 1st fast grid setting (index in EDA_DRAW_FRAME::m_gridSelectBox)
int m_FastGrid2; // 2nd fast grid setting (index in EDA_DRAW_FRAME::m_gridSelectBox)
protected:
BOARD* m_Pcb;
BOARD* m_Pcb;
PCB_GENERAL_SETTINGS m_configSettings;
PCB_DISPLAY_OPTIONS m_DisplayOptions;
PCB_GENERAL_SETTINGS m_configSettings;
void updateZoomSelectBox();
virtual void unitsChangeRefresh() override;
@ -165,10 +166,16 @@ public:
* returns the display options current in use
* Display options are relative to the way tracks, vias, outlines
* and other things are shown (for instance solid or sketch mode)
* Must be overloaded in frames which have display options
* (board editor and footprint editor)
*/
void* GetDisplayOptions() override { return &m_DisplayOptions; }
const PCB_DISPLAY_OPTIONS& GetDisplayOptions() const
{
return m_DisplayOptions;
}
void SetDisplayOptions( const PCB_DISPLAY_OPTIONS& aOptions )
{
m_DisplayOptions = aOptions;
}
const ZONE_SETTINGS& GetZoneSettings() const;
void SetZoneSettings( const ZONE_SETTINGS& aSettings );

View File

@ -150,7 +150,7 @@ MODULE* BOARD_NETLIST_UPDATER::addNewComponent( COMPONENT* aComponent )
m_reporter->Report( msg, REPORTER::RPT_ACTION );
// Set the pads ratsnest settings to the global settings
bool set_ratsnest = ((PCB_DISPLAY_OPTIONS*)m_frame->GetDisplayOptions())->m_ShowGlobalRatsnest;
bool set_ratsnest = m_frame->GetDisplayOptions().m_ShowGlobalRatsnest;
for ( auto pad : footprint->Pads() )
pad->SetLocalRatsnestVisible( set_ratsnest );

View File

@ -362,8 +362,8 @@ void DIMENSION::Print( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& offset )
m_Text.Print( aFrame, DC, offset );
auto gcolor = aFrame->Settings().Colors().GetLayerColor( m_Layer );
auto displ_opts = (PCB_DISPLAY_OPTIONS*)( aFrame->GetDisplayOptions() );
bool filled = displ_opts ? displ_opts->m_DisplayDrawItemsFill : FILLED;
auto displ_opts = aFrame->GetDisplayOptions();
bool filled = displ_opts.m_DisplayDrawItemsFill;
int width = m_Width;
if( filled )

View File

@ -357,7 +357,7 @@ void DRAWSEGMENT::Print( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& aOffse
return;
auto color = aFrame->Settings().Colors().GetLayerColor( GetLayer() );
auto displ_opts = (PCB_DISPLAY_OPTIONS*) aFrame->GetDisplayOptions();
auto displ_opts = aFrame->GetDisplayOptions();
l_trace = m_Width >> 1; // half trace width
@ -369,7 +369,7 @@ void DRAWSEGMENT::Print( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& aOffse
dx = m_End.x + aOffset.x;
dy = m_End.y + aOffset.y;
bool filled = displ_opts ? displ_opts->m_DisplayDrawItemsFill : FILLED;
bool filled = displ_opts.m_DisplayDrawItemsFill;
if( m_Flags & FORCE_SKETCH )
filled = SKETCH;

View File

@ -127,7 +127,7 @@ void EDGE_MODULE::Print( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& offset
return;
auto color = aFrame->Settings().Colors().GetLayerColor( m_Layer );
auto displ_opts = (PCB_DISPLAY_OPTIONS*)( aFrame->GetDisplayOptions() );
auto displ_opts = aFrame->GetDisplayOptions();
ux0 = m_Start.x - offset.x;
uy0 = m_Start.y - offset.y;
@ -135,10 +135,10 @@ void EDGE_MODULE::Print( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& offset
dx = m_End.x - offset.x;
dy = m_End.y - offset.y;
bool filled = displ_opts ? displ_opts->m_DisplayModEdgeFill : FILLED;
bool filled = displ_opts.m_DisplayModEdgeFill;
if( IsCopperLayer( m_Layer ) )
filled = displ_opts ? displ_opts->m_DisplayPcbTrackFill : FILLED;
filled = displ_opts.m_DisplayPcbTrackFill;
switch( m_Shape )
{

View File

@ -87,8 +87,8 @@ void PCB_TARGET::Print( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& offset
return;
auto gcolor = aFrame->Settings().Colors().GetLayerColor( m_Layer );
auto displ_opts = (PCB_DISPLAY_OPTIONS*) aFrame->GetDisplayOptions();
bool filled = displ_opts ? displ_opts->m_DisplayDrawItemsFill : FILLED;
auto displ_opts = aFrame->GetDisplayOptions();
bool filled = displ_opts.m_DisplayDrawItemsFill;
width = m_Width;
radius = m_Size / 3;

View File

@ -73,9 +73,9 @@ void TEXTE_PCB::Print( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& offset )
auto color = aFrame->Settings().Colors().GetLayerColor( m_Layer );
EDA_DRAW_MODE_T fillmode = FILLED;
PCB_DISPLAY_OPTIONS* displ_opts = (PCB_DISPLAY_OPTIONS*)( aFrame->GetDisplayOptions() );
auto& displ_opts = aFrame->GetDisplayOptions();
if( displ_opts && displ_opts->m_DisplayDrawItemsFill == SKETCH )
if( displ_opts.m_DisplayDrawItemsFill == SKETCH )
fillmode = SKETCH;
EDA_TEXT::Print( DC, offset, color, fillmode );

View File

@ -287,12 +287,10 @@ void TEXTE_MODULE::Print( PCB_BASE_FRAME* aFrame, wxDC* aDC, const wxPoint& aOff
color = aFrame->Settings().Colors().GetItemColor( LAYER_MOD_TEXT_INVISIBLE );
}
auto displ_opts = (PCB_DISPLAY_OPTIONS*)( aFrame->GetDisplayOptions() );
// Draw mode compensation for the width
int width = GetThickness();
if( displ_opts && displ_opts->m_DisplayModTextFill == SKETCH )
if( aFrame->GetDisplayOptions().m_DisplayModTextFill == SKETCH )
width = -width;
wxPoint pos = GetTextPos() - aOffset;

View File

@ -45,14 +45,14 @@
* tests to see if the clearance border is drawn on the given track.
* @return bool - true if should draw clearance, else false.
*/
static bool ShowClearance( PCB_DISPLAY_OPTIONS* aDisplOpts, const TRACK* aTrack )
static bool ShowClearance( const PCB_DISPLAY_OPTIONS& aDisplOpts, const TRACK* aTrack )
{
// maybe return true for tracks and vias, not for zone segments
return IsCopperLayer( aTrack->GetLayer() )
&& ( aTrack->Type() == PCB_TRACE_T || aTrack->Type() == PCB_VIA_T )
&& ( ( aDisplOpts->m_ShowTrackClearanceMode == PCB_DISPLAY_OPTIONS::SHOW_CLEARANCE_NEW_AND_EDITED_TRACKS_AND_VIA_AREAS
&& ( ( aDisplOpts.m_ShowTrackClearanceMode == PCB_DISPLAY_OPTIONS::SHOW_CLEARANCE_NEW_AND_EDITED_TRACKS_AND_VIA_AREAS
&& ( aTrack->IsDragging() || aTrack->IsMoving() || aTrack->IsNew() ) )
|| ( aDisplOpts->m_ShowTrackClearanceMode == PCB_DISPLAY_OPTIONS::SHOW_CLEARANCE_ALWAYS )
|| ( aDisplOpts.m_ShowTrackClearanceMode == PCB_DISPLAY_OPTIONS::SHOW_CLEARANCE_ALWAYS )
);
}
@ -467,7 +467,7 @@ void TRACK::Print( PCB_BASE_FRAME* aFrame, wxDC* aDC, const wxPoint& aOffset )
if( !brd->IsLayerVisible( m_Layer ) || !brd->IsElementVisible( LAYER_TRACKS ) )
return;
auto displ_opts = (PCB_DISPLAY_OPTIONS*)( aFrame->GetDisplayOptions() );
auto displ_opts = aFrame->GetDisplayOptions();
color.a = 0.588;
@ -478,7 +478,7 @@ void TRACK::Print( PCB_BASE_FRAME* aFrame, wxDC* aDC, const wxPoint& aOffset )
return;
}
if( !displ_opts->m_DisplayPcbTrackFill || GetState( FORCE_SKETCH ) )
if( !displ_opts.m_DisplayPcbTrackFill || GetState( FORCE_SKETCH ) )
{
GRCSegm( nullptr, aDC, m_Start + aOffset, m_End + aOffset, m_Width, color );
}
@ -530,11 +530,11 @@ void VIA::Print( PCB_BASE_FRAME* aFrame, wxDC* aDC, const wxPoint& aOffset )
int radius;
int fillvia = 0;
PCB_SCREEN* screen = aFrame->GetScreen();
PCB_DISPLAY_OPTIONS* displ_opts = (PCB_DISPLAY_OPTIONS*) aFrame->GetDisplayOptions();
auto& displ_opts = aFrame->GetDisplayOptions();
BOARD* brd = GetBoard();
COLOR4D color = aFrame->Settings().Colors().GetItemColor( LAYER_VIAS + GetViaType() );
if( displ_opts->m_DisplayViaFill == FILLED )
if( displ_opts.m_DisplayViaFill == FILLED )
fillvia = 1;
if( !brd->IsElementVisible( LAYER_VIAS + GetViaType() ) )
@ -667,7 +667,7 @@ void VIA::Print( PCB_BASE_FRAME* aFrame, wxDC* aDC, const wxPoint& aOffset )
if( GetNetCode() == NETINFO_LIST::UNCONNECTED )
return;
if( displ_opts->m_DisplayNetNamesMode == 0 || displ_opts->m_DisplayNetNamesMode == 1 )
if( displ_opts.m_DisplayNetNamesMode == 0 || displ_opts.m_DisplayNetNamesMode == 1 )
return;
NETINFO_ITEM* net = GetNet();

View File

@ -376,9 +376,9 @@ void ZONE_CONTAINER::Print( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& off
auto color = aFrame->Settings().Colors().GetLayerColor( draw_layer );
auto displ_opts = (PCB_DISPLAY_OPTIONS*)( aFrame->GetDisplayOptions() );
auto displ_opts = aFrame->GetDisplayOptions();
if( displ_opts->m_ContrastModeDisplay )
if( displ_opts.m_ContrastModeDisplay )
{
if( !IsOnLayer( curr_layer ) )
color = COLOR4D( DARKDARKGRAY );
@ -424,13 +424,13 @@ void ZONE_CONTAINER::PrintFilledArea( PCB_BASE_FRAME* aFrame, wxDC* DC, const wx
BOARD* brd = GetBoard();
KIGFX::COLOR4D color = aFrame->Settings().Colors().GetLayerColor( GetLayer() );
PCB_DISPLAY_OPTIONS* displ_opts = (PCB_DISPLAY_OPTIONS*) aFrame->GetDisplayOptions();
bool outline_mode = displ_opts->m_DisplayZonesMode == 2;
auto& displ_opts = aFrame->GetDisplayOptions();
bool outline_mode = displ_opts.m_DisplayZonesMode == 2;
if( DC == NULL )
return;
if( displ_opts->m_DisplayZonesMode == 1 ) // Do not show filled areas
if( displ_opts.m_DisplayZonesMode == 1 ) // Do not show filled areas
return;
if( m_FilledPolysList.IsEmpty() ) // Nothing to draw
@ -473,7 +473,7 @@ void ZONE_CONTAINER::PrintFilledArea( PCB_BASE_FRAME* aFrame, wxDC* DC, const wx
for( int is = 0, ie = ilim; is <= ilim; ie = is, is++ )
{
// Draw only basic outlines, not extra segments.
if( !displ_opts->m_DisplayPcbTrackFill || GetState( FORCE_SKETCH ) )
if( !displ_opts.m_DisplayPcbTrackFill || GetState( FORCE_SKETCH ) )
{
GRCSegm( nullptr, DC, CornersBuffer[is], CornersBuffer[ie],
outline_thickness, color );

View File

@ -56,12 +56,12 @@ void DIALOG_FP_BROWSER_DISPLAY_OPTIONS::initDialog()
/* mandatory to use escape key as cancel under wxGTK. */
SetFocus();
auto displ_opts = (PCB_DISPLAY_OPTIONS*)m_frame->GetDisplayOptions();
auto displ_opts = m_frame->GetDisplayOptions();
m_EdgesDisplayOption->SetValue( not displ_opts->m_DisplayModEdgeFill );
m_TextDisplayOption->SetValue( not displ_opts->m_DisplayModTextFill );
m_ShowPadSketch->SetValue( not displ_opts->m_DisplayPadFill );
m_ShowPadNum->SetValue( displ_opts->m_DisplayPadNum );
m_EdgesDisplayOption->SetValue( not displ_opts.m_DisplayModEdgeFill );
m_TextDisplayOption->SetValue( not displ_opts.m_DisplayModTextFill );
m_ShowPadSketch->SetValue( not displ_opts.m_DisplayPadFill );
m_ShowPadNum->SetValue( displ_opts.m_DisplayPadNum );
m_autoZoomOption->SetValue( m_frame->GetAutoZoom() );
}
@ -69,12 +69,12 @@ void DIALOG_FP_BROWSER_DISPLAY_OPTIONS::initDialog()
void DIALOG_FP_BROWSER_DISPLAY_OPTIONS::UpdateObjectSettings()
{
auto displ_opts = (PCB_DISPLAY_OPTIONS*)m_frame->GetDisplayOptions();
auto displ_opts = m_frame->GetDisplayOptions();
displ_opts->m_DisplayModEdgeFill = not m_EdgesDisplayOption->GetValue();
displ_opts->m_DisplayModTextFill = not m_TextDisplayOption->GetValue();
displ_opts->m_DisplayPadNum = m_ShowPadNum->GetValue();
displ_opts->m_DisplayPadFill = not m_ShowPadSketch->GetValue();
displ_opts.m_DisplayModEdgeFill = not m_EdgesDisplayOption->GetValue();
displ_opts.m_DisplayModTextFill = not m_TextDisplayOption->GetValue();
displ_opts.m_DisplayPadNum = m_ShowPadNum->GetValue();
displ_opts.m_DisplayPadFill = not m_ShowPadSketch->GetValue();
m_frame->ApplyDisplaySettingsToGAL();
m_frame->SetAutoZoom( m_autoZoomOption->GetValue() );

View File

@ -56,15 +56,15 @@ PANEL_PCBNEW_DISPLAY_OPTIONS::PANEL_PCBNEW_DISPLAY_OPTIONS( PCB_EDIT_FRAME* aFra
bool PANEL_PCBNEW_DISPLAY_OPTIONS::TransferDataToWindow()
{
const PCB_DISPLAY_OPTIONS* displ_opts = (PCB_DISPLAY_OPTIONS*) m_frame->GetDisplayOptions();
auto& displ_opts = m_frame->GetDisplayOptions();
m_OptDisplayTracksClearance->SetSelection( UTIL::GetConfigForVal(
traceClearanceSelectMap, displ_opts->m_ShowTrackClearanceMode ) );
traceClearanceSelectMap, displ_opts.m_ShowTrackClearanceMode ) );
m_OptDisplayPadClearence->SetValue( displ_opts->m_DisplayPadIsol );
m_OptDisplayPadNumber->SetValue( displ_opts->m_DisplayPadNum );
m_OptDisplayPadClearence->SetValue( displ_opts.m_DisplayPadIsol );
m_OptDisplayPadNumber->SetValue( displ_opts.m_DisplayPadNum );
m_OptDisplayPadNoConn->SetValue( m_frame->IsElementVisible( LAYER_NO_CONNECTS ) );
m_ShowNetNamesOption->SetSelection( displ_opts->m_DisplayNetNamesMode );
m_ShowNetNamesOption->SetSelection( displ_opts.m_DisplayNetNamesMode );
m_galOptsPanel->TransferDataToWindow();
@ -77,17 +77,17 @@ bool PANEL_PCBNEW_DISPLAY_OPTIONS::TransferDataToWindow()
*/
bool PANEL_PCBNEW_DISPLAY_OPTIONS::TransferDataFromWindow()
{
PCB_DISPLAY_OPTIONS* displ_opts = (PCB_DISPLAY_OPTIONS*) m_frame->GetDisplayOptions();
PCB_DISPLAY_OPTIONS displ_opts = m_frame->GetDisplayOptions();
displ_opts->m_ShowTrackClearanceMode = UTIL::GetValFromConfig(
displ_opts.m_ShowTrackClearanceMode = UTIL::GetValFromConfig(
traceClearanceSelectMap, m_OptDisplayTracksClearance->GetSelection() );
displ_opts->m_DisplayPadIsol = m_OptDisplayPadClearence->GetValue();
displ_opts->m_DisplayPadNum = m_OptDisplayPadNumber->GetValue();
displ_opts.m_DisplayPadIsol = m_OptDisplayPadClearence->GetValue();
displ_opts.m_DisplayPadNum = m_OptDisplayPadNumber->GetValue();
m_frame->SetElementVisibility( LAYER_NO_CONNECTS, m_OptDisplayPadNoConn->GetValue() );
displ_opts->m_DisplayNetNamesMode = m_ShowNetNamesOption->GetSelection();
displ_opts.m_DisplayNetNamesMode = m_ShowNetNamesOption->GetSelection();
m_galOptsPanel->TransferDataFromWindow();
@ -96,8 +96,9 @@ bool PANEL_PCBNEW_DISPLAY_OPTIONS::TransferDataFromWindow()
KIGFX::PCB_PAINTER* painter = static_cast<KIGFX::PCB_PAINTER*>( view->GetPainter() );
KIGFX::PCB_RENDER_SETTINGS* settings = painter->GetSettings();
m_frame->SetDisplayOptions( displ_opts );
settings->LoadDisplayOptions( displ_opts, m_frame->ShowPageLimits() );
m_frame->SetElementVisibility( LAYER_RATSNEST, displ_opts->m_ShowGlobalRatsnest );
m_frame->SetElementVisibility( LAYER_RATSNEST, displ_opts.m_ShowGlobalRatsnest );
view->RecacheAllItems();
view->MarkTargetDirty( KIGFX::TARGET_NONCACHED );

View File

@ -41,16 +41,16 @@ PANEL_PCBNEW_SETTINGS::PANEL_PCBNEW_SETTINGS( PCB_EDIT_FRAME* aFrame, PAGED_DIAL
bool PANEL_PCBNEW_SETTINGS::TransferDataToWindow()
{
const PCB_DISPLAY_OPTIONS* displ_opts = (PCB_DISPLAY_OPTIONS*) m_Frame->GetDisplayOptions();
const PCB_DISPLAY_OPTIONS& displ_opts = m_Frame->GetDisplayOptions();
const PCB_GENERAL_SETTINGS& general_opts = m_Frame->Settings();
/* Set display options */
m_PolarDisplay->SetSelection( m_Frame->GetShowPolarCoords() ? 1 : 0 );
m_UnitsSelection->SetSelection( m_Frame->GetUserUnits() == INCHES ? 0 : 1 );
m_OptDisplayCurvedRatsnestLines->SetValue( displ_opts->m_DisplayRatsnestLinesCurved );
m_showGlobalRatsnest->SetValue( displ_opts->m_ShowGlobalRatsnest );
m_showSelectedRatsnest->SetValue( displ_opts->m_ShowModuleRatsnest );
m_OptDisplayCurvedRatsnestLines->SetValue( displ_opts->m_DisplayRatsnestLinesCurved );
m_OptDisplayCurvedRatsnestLines->SetValue( displ_opts.m_DisplayRatsnestLinesCurved );
m_showGlobalRatsnest->SetValue( displ_opts.m_ShowGlobalRatsnest );
m_showSelectedRatsnest->SetValue( displ_opts.m_ShowModuleRatsnest );
m_OptDisplayCurvedRatsnestLines->SetValue( displ_opts.m_DisplayRatsnestLinesCurved );
wxString rotationAngle;
rotationAngle = AngleToStringDegrees( (double)m_Frame->GetRotationAngle() );
@ -86,15 +86,16 @@ bool PANEL_PCBNEW_SETTINGS::TransferDataFromWindow()
m_Frame->SetShowPageLimits( m_Show_Page_Limits->GetValue() );
// Apply changes to the GAL
PCB_DISPLAY_OPTIONS* displ_opts = (PCB_DISPLAY_OPTIONS*) m_Frame->GetDisplayOptions();
PCB_DISPLAY_OPTIONS displ_opts = m_Frame->GetDisplayOptions();
KIGFX::VIEW* view = m_Frame->GetCanvas()->GetView();
KIGFX::PCB_PAINTER* painter = static_cast<KIGFX::PCB_PAINTER*>( view->GetPainter() );
KIGFX::PCB_RENDER_SETTINGS* settings = painter->GetSettings();
displ_opts->m_DisplayRatsnestLinesCurved = m_OptDisplayCurvedRatsnestLines->GetValue();
displ_opts->m_ShowGlobalRatsnest = m_showGlobalRatsnest->GetValue();
displ_opts->m_ShowModuleRatsnest = m_showSelectedRatsnest->GetValue();
displ_opts.m_DisplayRatsnestLinesCurved = m_OptDisplayCurvedRatsnestLines->GetValue();
displ_opts.m_ShowGlobalRatsnest = m_showGlobalRatsnest->GetValue();
displ_opts.m_ShowModuleRatsnest = m_showSelectedRatsnest->GetValue();
m_Frame->SetDisplayOptions( displ_opts );
settings->LoadDisplayOptions( displ_opts, m_Frame->ShowPageLimits() );
view->RecacheAllItems();
view->MarkTargetDirty( KIGFX::TARGET_NONCACHED );

Some files were not shown because too many files have changed in this diff Show More