Wire m_showPageLimits control up to GAL canvas.

Fixes: lp:1499285
* https://bugs.launchpad.net/kicad/+bug/1499285

(cherry picked from commit 4cb7442)
This commit is contained in:
Jeff Young 2018-07-01 09:24:57 +01:00
parent 6a7e6e7735
commit df863e44e2
12 changed files with 36 additions and 9 deletions

View File

@ -41,6 +41,7 @@ RENDER_SETTINGS::RENDER_SETTINGS()
m_highlightNetcode = -1; m_highlightNetcode = -1;
m_outlineWidth = 1; m_outlineWidth = 1;
m_worksheetLineWidth = 100000; m_worksheetLineWidth = 100000;
m_showPageLimits = false;
} }

View File

@ -126,7 +126,8 @@ void WORKSHEET_VIEWITEM::ViewDraw( int aLayer, VIEW* aView ) const
} }
// Draw gray line that outlines the sheet size // Draw gray line that outlines the sheet size
drawBorder( gal ); if( settings->GetShowPageLimits() )
drawBorder( gal );
} }

View File

@ -88,6 +88,7 @@ void GERBVIEW_RENDER_SETTINGS::LoadDisplayOptions( const GBR_DISPLAY_OPTIONS* aO
m_showCodes = aOptions->m_DisplayDCodes; m_showCodes = aOptions->m_DisplayDCodes;
m_diffMode = aOptions->m_DiffMode; m_diffMode = aOptions->m_DiffMode;
m_hiContrastEnabled = aOptions->m_HighContrastMode; m_hiContrastEnabled = aOptions->m_HighContrastMode;
m_showPageLimits = aOptions->m_DisplayPageLimits;
update(); update();
} }

View File

@ -178,6 +178,16 @@ public:
return m_worksheetLineWidth; return m_worksheetLineWidth;
} }
inline bool GetShowPageLimits() const
{
return m_showPageLimits;
}
inline void SetShowPageLimits( bool aDraw )
{
m_showPageLimits = aDraw;
}
/** /**
* Function GetBackgroundColor * Function GetBackgroundColor
* Returns current background color settings. * Returns current background color settings.
@ -259,6 +269,8 @@ protected:
float m_outlineWidth; ///< Line width used when drawing outlines float m_outlineWidth; ///< Line width used when drawing outlines
float m_worksheetLineWidth; ///< Line width used when drawing worksheet float m_worksheetLineWidth; ///< Line width used when drawing worksheet
bool m_showPageLimits;
COLOR4D m_backgroundColor; ///< The background color COLOR4D m_backgroundColor; ///< The background color
}; };

View File

@ -96,7 +96,7 @@ bool PANEL_PCBNEW_DISPLAY_OPTIONS::TransferDataFromWindow()
KIGFX::VIEW* view = m_frame->GetGalCanvas()->GetView(); KIGFX::VIEW* view = m_frame->GetGalCanvas()->GetView();
KIGFX::PCB_PAINTER* painter = static_cast<KIGFX::PCB_PAINTER*>( view->GetPainter() ); KIGFX::PCB_PAINTER* painter = static_cast<KIGFX::PCB_PAINTER*>( view->GetPainter() );
KIGFX::PCB_RENDER_SETTINGS* settings = painter->GetSettings(); KIGFX::PCB_RENDER_SETTINGS* settings = painter->GetSettings();
settings->LoadDisplayOptions( displ_opts ); settings->LoadDisplayOptions( displ_opts, m_frame->ShowPageLimits() );
view->RecacheAllItems(); view->RecacheAllItems();
view->MarkTargetDirty( KIGFX::TARGET_NONCACHED ); view->MarkTargetDirty( KIGFX::TARGET_NONCACHED );

View File

@ -30,7 +30,8 @@
#include <class_board.h> #include <class_board.h>
#include <panel_pcbnew_settings.h> #include <panel_pcbnew_settings.h>
#include <widgets/stepped_slider.h> #include <widgets/stepped_slider.h>
#include <pcb_view.h>
#include <pcb_painter.h>
PANEL_PCBNEW_SETTINGS::PANEL_PCBNEW_SETTINGS( PCB_EDIT_FRAME* aFrame, wxWindow* aWindow ) : PANEL_PCBNEW_SETTINGS::PANEL_PCBNEW_SETTINGS( PCB_EDIT_FRAME* aFrame, wxWindow* aWindow ) :
PANEL_PCBNEW_SETTINGS_BASE( aWindow ), PANEL_PCBNEW_SETTINGS_BASE( aWindow ),
@ -91,6 +92,12 @@ bool PANEL_PCBNEW_SETTINGS::TransferDataFromWindow()
m_Frame->SetShowPageLimits( m_Show_Page_Limits->GetValue() ); m_Frame->SetShowPageLimits( m_Show_Page_Limits->GetValue() );
// Apply changes to the GAL
KIGFX::VIEW* view = m_Frame->GetGalCanvas()->GetView();
KIGFX::PCB_PAINTER* painter = static_cast<KIGFX::PCB_PAINTER*>( view->GetPainter() );
KIGFX::PCB_RENDER_SETTINGS* settings = painter->GetSettings();
settings->LoadDisplayOptions( displ_opts, m_Frame->ShowPageLimits() );
return true; return true;
} }

View File

@ -1146,7 +1146,7 @@ void PCB_BASE_FRAME::UseGalCanvas( bool aEnable )
auto painter = static_cast<KIGFX::PCB_PAINTER*>( galCanvas->GetView()->GetPainter() ); auto painter = static_cast<KIGFX::PCB_PAINTER*>( galCanvas->GetView()->GetPainter() );
auto settings = painter->GetSettings(); auto settings = painter->GetSettings();
auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions(); auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
settings->LoadDisplayOptions( displ_opts ); settings->LoadDisplayOptions( displ_opts, ShowPageLimits() );
galCanvas->GetView()->RecacheAllItems(); galCanvas->GetView()->RecacheAllItems();
galCanvas->SetEventDispatcher( m_toolDispatcher ); galCanvas->SetEventDispatcher( m_toolDispatcher );

View File

@ -371,8 +371,9 @@ void PCB_DRAW_PANEL_GAL::OnShow()
{ {
SetTopLayer( frame->GetActiveLayer() ); SetTopLayer( frame->GetActiveLayer() );
PCB_DISPLAY_OPTIONS* displ_opts = (PCB_DISPLAY_OPTIONS*) frame->GetDisplayOptions(); PCB_DISPLAY_OPTIONS* displ_opts = (PCB_DISPLAY_OPTIONS*) frame->GetDisplayOptions();
static_cast<KIGFX::PCB_RENDER_SETTINGS*>( KIGFX::PAINTER* painter = m_view->GetPainter();
m_view->GetPainter()->GetSettings() )->LoadDisplayOptions( displ_opts ); auto settings = static_cast<KIGFX::PCB_RENDER_SETTINGS*>( painter->GetSettings() );
settings->LoadDisplayOptions( displ_opts, frame->ShowPageLimits() );
} }
} }

View File

@ -828,6 +828,7 @@ void PCB_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg )
aCfg->Read( ShowMicrowaveEntry, &m_show_microwave_tools ); aCfg->Read( ShowMicrowaveEntry, &m_show_microwave_tools );
aCfg->Read( ShowLayerManagerEntry, &m_show_layer_manager_tools ); aCfg->Read( ShowLayerManagerEntry, &m_show_layer_manager_tools );
aCfg->Read( ShowPageLimitsEntry, &m_showPageLimits ); aCfg->Read( ShowPageLimitsEntry, &m_showPageLimits );
} }

View File

@ -123,7 +123,8 @@ void PCB_RENDER_SETTINGS::ImportLegacyColors( const COLORS_DESIGN_SETTINGS* aSet
} }
void PCB_RENDER_SETTINGS::LoadDisplayOptions( const PCB_DISPLAY_OPTIONS* aOptions ) void PCB_RENDER_SETTINGS::LoadDisplayOptions( const PCB_DISPLAY_OPTIONS* aOptions,
bool aShowPageLimits )
{ {
if( aOptions == NULL ) if( aOptions == NULL )
return; return;
@ -206,6 +207,8 @@ void PCB_RENDER_SETTINGS::LoadDisplayOptions( const PCB_DISPLAY_OPTIONS* aOption
if( aOptions->m_DisplayPadIsol ) if( aOptions->m_DisplayPadIsol )
m_clearance |= CL_PADS; m_clearance |= CL_PADS;
m_showPageLimits = aShowPageLimits;
} }

View File

@ -99,7 +99,7 @@ public:
* for vias/pads/tracks and so on). * for vias/pads/tracks and so on).
* @param aOptions are settings that you want to use for displaying items. * @param aOptions are settings that you want to use for displaying items.
*/ */
void LoadDisplayOptions( const PCB_DISPLAY_OPTIONS* aOptions ); void LoadDisplayOptions( const PCB_DISPLAY_OPTIONS* aOptions, bool aShowPageLimits );
/// @copydoc RENDER_SETTINGS::GetColor() /// @copydoc RENDER_SETTINGS::GetColor()
virtual const COLOR4D& GetColor( const VIEW_ITEM* aItem, int aLayer ) const override; virtual const COLOR4D& GetColor( const VIEW_ITEM* aItem, int aLayer ) const override;

View File

@ -105,6 +105,6 @@ void PCB_VIEW::UpdateDisplayOptions( PCB_DISPLAY_OPTIONS* aOptions )
auto painter = static_cast<KIGFX::PCB_PAINTER*>( GetPainter() ); auto painter = static_cast<KIGFX::PCB_PAINTER*>( GetPainter() );
auto settings = static_cast<KIGFX::PCB_RENDER_SETTINGS*>( painter->GetSettings() ); auto settings = static_cast<KIGFX::PCB_RENDER_SETTINGS*>( painter->GetSettings() );
settings->LoadDisplayOptions( aOptions ); settings->LoadDisplayOptions( aOptions, settings->GetShowPageLimits() );
} }
} }