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_outlineWidth = 1;
m_worksheetLineWidth = 100000;
m_showPageLimits = false;
}

View File

@ -126,6 +126,7 @@ void WORKSHEET_VIEWITEM::ViewDraw( int aLayer, VIEW* aView ) const
}
// Draw gray line that outlines the sheet size
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_diffMode = aOptions->m_DiffMode;
m_hiContrastEnabled = aOptions->m_HighContrastMode;
m_showPageLimits = aOptions->m_DisplayPageLimits;
update();
}

View File

@ -178,6 +178,16 @@ public:
return m_worksheetLineWidth;
}
inline bool GetShowPageLimits() const
{
return m_showPageLimits;
}
inline void SetShowPageLimits( bool aDraw )
{
m_showPageLimits = aDraw;
}
/**
* Function GetBackgroundColor
* Returns current background color settings.
@ -259,6 +269,8 @@ protected:
float m_outlineWidth; ///< Line width used when drawing outlines
float m_worksheetLineWidth; ///< Line width used when drawing worksheet
bool m_showPageLimits;
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::PCB_PAINTER* painter = static_cast<KIGFX::PCB_PAINTER*>( view->GetPainter() );
KIGFX::PCB_RENDER_SETTINGS* settings = painter->GetSettings();
settings->LoadDisplayOptions( displ_opts );
settings->LoadDisplayOptions( displ_opts, m_frame->ShowPageLimits() );
view->RecacheAllItems();
view->MarkTargetDirty( KIGFX::TARGET_NONCACHED );

View File

@ -30,7 +30,8 @@
#include <class_board.h>
#include <panel_pcbnew_settings.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_BASE( aWindow ),
@ -91,6 +92,12 @@ bool PANEL_PCBNEW_SETTINGS::TransferDataFromWindow()
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;
}

View File

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

View File

@ -371,8 +371,9 @@ void PCB_DRAW_PANEL_GAL::OnShow()
{
SetTopLayer( frame->GetActiveLayer() );
PCB_DISPLAY_OPTIONS* displ_opts = (PCB_DISPLAY_OPTIONS*) frame->GetDisplayOptions();
static_cast<KIGFX::PCB_RENDER_SETTINGS*>(
m_view->GetPainter()->GetSettings() )->LoadDisplayOptions( displ_opts );
KIGFX::PAINTER* painter = m_view->GetPainter();
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( ShowLayerManagerEntry, &m_show_layer_manager_tools );
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 )
return;
@ -206,6 +207,8 @@ void PCB_RENDER_SETTINGS::LoadDisplayOptions( const PCB_DISPLAY_OPTIONS* aOption
if( aOptions->m_DisplayPadIsol )
m_clearance |= CL_PADS;
m_showPageLimits = aShowPageLimits;
}

View File

@ -99,7 +99,7 @@ public:
* for vias/pads/tracks and so on).
* @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()
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 settings = static_cast<KIGFX::PCB_RENDER_SETTINGS*>( painter->GetSettings() );
settings->LoadDisplayOptions( aOptions );
settings->LoadDisplayOptions( aOptions, settings->GetShowPageLimits() );
}
}