Use color theme backgrounds in page previews.
Also includes a *lot* of const fixing to make it happen. Fixes https://gitlab.com/kicad/code/kicad/issues/6811
This commit is contained in:
parent
f722ba690f
commit
6b420b191a
|
@ -641,23 +641,27 @@ void DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample()
|
|||
}
|
||||
|
||||
// Draw layout preview.
|
||||
wxString emptyString;
|
||||
GRResetPenAndBrush( &memDC );
|
||||
KIGFX::WS_RENDER_SETTINGS renderSettings;
|
||||
COLOR_SETTINGS* colorSettings = m_parent->GetColorSettings();
|
||||
COLOR4D bgColor = m_parent->GetDrawBgColor();
|
||||
wxString emptyString;
|
||||
|
||||
WS_DATA_MODEL::SetAltInstance( m_pagelayout );
|
||||
KIGFX::WS_RENDER_SETTINGS renderSettings;
|
||||
renderSettings.SetDefaultPenWidth( 1 );
|
||||
renderSettings.SetLayerColor( LAYER_WORKSHEET, COLOR4D( RED ) );
|
||||
renderSettings.SetPrintDC( &memDC );
|
||||
{
|
||||
GRResetPenAndBrush( &memDC );
|
||||
renderSettings.SetDefaultPenWidth( 1 );
|
||||
renderSettings.LoadColors( colorSettings );
|
||||
renderSettings.SetPrintDC( &memDC );
|
||||
|
||||
GRFilledRect( NULL, &memDC, 0, 0, m_layout_size.x, m_layout_size.y, WHITE, WHITE );
|
||||
GRFilledRect( NULL, &memDC, 0, 0, m_layout_size.x, m_layout_size.y, bgColor, bgColor );
|
||||
|
||||
PrintPageLayout( &renderSettings, pageDUMMY, emptyString, emptyString, m_tb,
|
||||
m_screen->GetPageCount(), m_screen->GetPageNumber(), 1, &Prj(),
|
||||
wxEmptyString, m_screen->GetVirtualPageNumber() == 1 );
|
||||
PrintPageLayout( &renderSettings, pageDUMMY, emptyString, emptyString, m_tb,
|
||||
m_screen->GetPageCount(), m_screen->GetPageNumber(), 1, &Prj(),
|
||||
wxEmptyString, m_screen->GetVirtualPageNumber() == 1 );
|
||||
|
||||
memDC.SelectObject( wxNullBitmap );
|
||||
m_PageLayoutExampleBitmap->SetBitmap( *m_pageBitmap );
|
||||
memDC.SelectObject( wxNullBitmap );
|
||||
m_PageLayoutExampleBitmap->SetBitmap( *m_pageBitmap );
|
||||
}
|
||||
WS_DATA_MODEL::SetAltInstance( NULL );
|
||||
|
||||
// Refresh the dialog.
|
||||
|
|
|
@ -943,10 +943,14 @@ void EDA_DRAW_FRAME::RecreateToolbars()
|
|||
}
|
||||
|
||||
|
||||
COLOR_SETTINGS* EDA_DRAW_FRAME::GetColorSettings()
|
||||
COLOR_SETTINGS* EDA_DRAW_FRAME::GetColorSettings() const
|
||||
{
|
||||
if( !m_colorSettings )
|
||||
m_colorSettings = Pgm().GetSettingsManager().GetColorSettings();
|
||||
{
|
||||
COLOR_SETTINGS* colorSettings = Pgm().GetSettingsManager().GetColorSettings();
|
||||
|
||||
const_cast<EDA_DRAW_FRAME*>( this )->m_colorSettings = colorSettings;
|
||||
}
|
||||
|
||||
return m_colorSettings;
|
||||
}
|
||||
|
|
|
@ -505,7 +505,7 @@ void DISPLAY_FOOTPRINTS_FRAME::UpdateMsgPanel()
|
|||
}
|
||||
|
||||
|
||||
COLOR_SETTINGS* DISPLAY_FOOTPRINTS_FRAME::GetColorSettings()
|
||||
COLOR_SETTINGS* DISPLAY_FOOTPRINTS_FRAME::GetColorSettings() const
|
||||
{
|
||||
auto* settings = Pgm().GetSettingsManager().GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>();
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ public:
|
|||
///> @copydoc EDA_DRAW_FRAME::UpdateMsgPanel()
|
||||
void UpdateMsgPanel() override;
|
||||
|
||||
COLOR_SETTINGS* GetColorSettings() override;
|
||||
COLOR_SETTINGS* GetColorSettings() const override;
|
||||
|
||||
/**
|
||||
* Function GetGridColor() , virtual
|
||||
|
|
|
@ -417,13 +417,23 @@ void SCH_BASE_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVars
|
|||
}
|
||||
|
||||
|
||||
COLOR_SETTINGS* SCH_BASE_FRAME::GetColorSettings()
|
||||
COLOR_SETTINGS* SCH_BASE_FRAME::GetColorSettings() const
|
||||
{
|
||||
if( !m_colorSettings )
|
||||
{
|
||||
EESCHEMA_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EESCHEMA_SETTINGS>();
|
||||
m_colorSettings = Pgm().GetSettingsManager().GetColorSettings( cfg->m_ColorTheme );
|
||||
SETTINGS_MANAGER& settingsManager = Pgm().GetSettingsManager();
|
||||
EESCHEMA_SETTINGS* cfg = settingsManager.GetAppSettings<EESCHEMA_SETTINGS>();
|
||||
COLOR_SETTINGS* colorSettings = settingsManager.GetColorSettings( cfg->m_ColorTheme );
|
||||
|
||||
const_cast<SCH_BASE_FRAME*>( this )->m_colorSettings = colorSettings;
|
||||
}
|
||||
|
||||
return m_colorSettings;
|
||||
}
|
||||
|
||||
|
||||
COLOR4D SCH_BASE_FRAME::GetDrawBgColor() const
|
||||
{
|
||||
return GetColorSettings()->GetColor( LAYER_SCHEMATIC_BACKGROUND );
|
||||
}
|
||||
|
||||
|
|
|
@ -123,6 +123,8 @@ public:
|
|||
return *m_defaults;
|
||||
}
|
||||
|
||||
COLOR4D GetDrawBgColor() const override;
|
||||
|
||||
/**
|
||||
* Allow some frames to show/hide hidden pins. The default impl shows all pins.
|
||||
*/
|
||||
|
@ -255,7 +257,7 @@ public:
|
|||
*/
|
||||
COLOR4D GetLayerColor( SCH_LAYER_ID aLayer );
|
||||
|
||||
COLOR_SETTINGS* GetColorSettings() override;
|
||||
COLOR_SETTINGS* GetColorSettings() const override;
|
||||
|
||||
protected:
|
||||
/**
|
||||
|
|
|
@ -273,7 +273,7 @@ void SYMBOL_EDIT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
|
|||
}
|
||||
|
||||
|
||||
COLOR_SETTINGS* SYMBOL_EDIT_FRAME::GetColorSettings()
|
||||
COLOR_SETTINGS* SYMBOL_EDIT_FRAME::GetColorSettings() const
|
||||
{
|
||||
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
||||
|
||||
|
|
|
@ -233,12 +233,12 @@ public:
|
|||
void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
|
||||
void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
|
||||
|
||||
SYMBOL_EDITOR_SETTINGS* GetSettings()
|
||||
SYMBOL_EDITOR_SETTINGS* GetSettings() const
|
||||
{
|
||||
return m_settings;
|
||||
}
|
||||
|
||||
COLOR_SETTINGS* GetColorSettings() override;
|
||||
COLOR_SETTINGS* GetColorSettings() const override;
|
||||
|
||||
/**
|
||||
* Trigger the wxCloseEvent, which is handled by the function given to EVT_CLOSE() macro:
|
||||
|
|
|
@ -151,7 +151,7 @@ public:
|
|||
virtual void SetDrawBgColor( COLOR4D aColor) { m_drawBgColor= aColor ; }
|
||||
|
||||
/// Returns a pointer to the active color theme settings
|
||||
virtual COLOR_SETTINGS* GetColorSettings();
|
||||
virtual COLOR_SETTINGS* GetColorSettings() const;
|
||||
|
||||
bool ShowPageLimits() const { return m_showPageLimits; }
|
||||
void SetShowPageLimits( bool aShow ) { m_showPageLimits = aShow; }
|
||||
|
|
|
@ -160,7 +160,7 @@ public:
|
|||
*
|
||||
* @return a pointer to the active COLOR_SETTINGS.
|
||||
*/
|
||||
virtual COLOR_SETTINGS* GetColorSettings() override
|
||||
virtual COLOR_SETTINGS* GetColorSettings() const override
|
||||
{
|
||||
wxFAIL_MSG( "Color settings requested for a PCB_BASE_FRAME that does not override!" );
|
||||
return nullptr;
|
||||
|
@ -365,9 +365,9 @@ public:
|
|||
void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
|
||||
void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
|
||||
|
||||
PCBNEW_SETTINGS* GetPcbNewSettings();
|
||||
PCBNEW_SETTINGS* GetPcbNewSettings() const;
|
||||
|
||||
FOOTPRINT_EDITOR_SETTINGS* GetFootprintEditorSettings();
|
||||
FOOTPRINT_EDITOR_SETTINGS* GetFootprintEditorSettings() const;
|
||||
|
||||
virtual MAGNETIC_SETTINGS* GetMagneticItemsSettings();
|
||||
|
||||
|
|
|
@ -548,7 +548,7 @@ void FOOTPRINT_EDIT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
|
|||
}
|
||||
|
||||
|
||||
COLOR_SETTINGS* FOOTPRINT_EDIT_FRAME::GetColorSettings()
|
||||
COLOR_SETTINGS* FOOTPRINT_EDIT_FRAME::GetColorSettings() const
|
||||
{
|
||||
wxString currentTheme = GetFootprintEditorSettings()->m_ColorTheme;
|
||||
return Pgm().GetSettingsManager().GetColorSettings( currentTheme );
|
||||
|
|
|
@ -86,7 +86,7 @@ public:
|
|||
void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
|
||||
void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
|
||||
|
||||
COLOR_SETTINGS* GetColorSettings() override;
|
||||
COLOR_SETTINGS* GetColorSettings() const override;
|
||||
|
||||
const BOX2I GetDocumentExtents( bool aIncludeAllVisible = true ) const override;
|
||||
|
||||
|
|
|
@ -793,7 +793,7 @@ WINDOW_SETTINGS* FOOTPRINT_VIEWER_FRAME::GetWindowSettings( APP_SETTINGS_BASE* a
|
|||
}
|
||||
|
||||
|
||||
COLOR_SETTINGS* FOOTPRINT_VIEWER_FRAME::GetColorSettings()
|
||||
COLOR_SETTINGS* FOOTPRINT_VIEWER_FRAME::GetColorSettings() const
|
||||
{
|
||||
auto* settings = Pgm().GetSettingsManager().GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>();
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ public:
|
|||
*/
|
||||
bool ShowModal( wxString* aFootprint, wxWindow* aParent ) override;
|
||||
|
||||
COLOR_SETTINGS* GetColorSettings() override;
|
||||
COLOR_SETTINGS* GetColorSettings() const override;
|
||||
|
||||
private:
|
||||
wxTextCtrl* m_libFilter;
|
||||
|
|
|
@ -282,10 +282,11 @@ void FOOTPRINT_WIZARD_FRAME::OnSize( wxSizeEvent& SizeEv )
|
|||
}
|
||||
|
||||
|
||||
COLOR_SETTINGS* FOOTPRINT_WIZARD_FRAME::GetColorSettings()
|
||||
COLOR_SETTINGS* FOOTPRINT_WIZARD_FRAME::GetColorSettings() const
|
||||
{
|
||||
return Pgm().GetSettingsManager().GetColorSettings(
|
||||
GetFootprintEditorSettings()->m_ColorTheme );
|
||||
wxString currentTheme = GetFootprintEditorSettings()->m_ColorTheme;
|
||||
|
||||
return Pgm().GetSettingsManager().GetColorSettings( currentTheme );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ public:
|
|||
*/
|
||||
void PythonPluginsReload();
|
||||
|
||||
COLOR_SETTINGS* GetColorSettings() override;
|
||||
COLOR_SETTINGS* GetColorSettings() const override;
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -205,7 +205,7 @@ void PCB_BASE_EDIT_FRAME::SetObjectVisible( GAL_LAYER_ID aLayer, bool aVisible )
|
|||
}
|
||||
|
||||
|
||||
COLOR_SETTINGS* PCB_BASE_EDIT_FRAME::GetColorSettings()
|
||||
COLOR_SETTINGS* PCB_BASE_EDIT_FRAME::GetColorSettings() const
|
||||
{
|
||||
return Pgm().GetSettingsManager().GetColorSettings( GetPcbNewSettings()->m_ColorTheme );
|
||||
}
|
||||
|
|
|
@ -191,7 +191,7 @@ public:
|
|||
///> @copydoc PCB_BASE_FRAME::SetBoard()
|
||||
virtual void SetBoard( BOARD* aBoard ) override;
|
||||
|
||||
COLOR_SETTINGS* GetColorSettings() override;
|
||||
COLOR_SETTINGS* GetColorSettings() const override;
|
||||
|
||||
/* full undo redo management : */
|
||||
|
||||
|
|
|
@ -676,13 +676,13 @@ void PCB_BASE_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
|
|||
}
|
||||
|
||||
|
||||
PCBNEW_SETTINGS* PCB_BASE_FRAME::GetPcbNewSettings()
|
||||
PCBNEW_SETTINGS* PCB_BASE_FRAME::GetPcbNewSettings() const
|
||||
{
|
||||
return Pgm().GetSettingsManager().GetAppSettings<PCBNEW_SETTINGS>();
|
||||
}
|
||||
|
||||
|
||||
FOOTPRINT_EDITOR_SETTINGS* PCB_BASE_FRAME::GetFootprintEditorSettings()
|
||||
FOOTPRINT_EDITOR_SETTINGS* PCB_BASE_FRAME::GetFootprintEditorSettings() const
|
||||
{
|
||||
return Pgm().GetSettingsManager().GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue