KiCad PCB EDA Suite
PANEL_SYM_COLOR_SETTINGS Class Reference

#include <panel_sym_color_settings.h>

Inheritance diagram for PANEL_SYM_COLOR_SETTINGS:
PANEL_SYM_COLOR_SETTINGS_BASE

Public Member Functions

 PANEL_SYM_COLOR_SETTINGS (SYMBOL_EDIT_FRAME *aFrame, wxWindow *aWindow)
 

Protected Member Functions

void OnThemeChanged (wxCommandEvent &event) override
 

Protected Attributes

wxRadioButton * m_eeschemaRB
 
wxRadioButton * m_themeRB
 
wxChoice * m_themes
 

Private Member Functions

bool TransferDataToWindow () override
 
bool TransferDataFromWindow () override
 

Private Attributes

SYMBOL_EDIT_FRAMEm_frame
 

Detailed Description

Definition at line 32 of file panel_sym_color_settings.h.

Constructor & Destructor Documentation

◆ PANEL_SYM_COLOR_SETTINGS()

PANEL_SYM_COLOR_SETTINGS::PANEL_SYM_COLOR_SETTINGS ( SYMBOL_EDIT_FRAME aFrame,
wxWindow *  aWindow 
)

Definition at line 32 of file panel_sym_color_settings.cpp.

34  : PANEL_SYM_COLOR_SETTINGS_BASE( aWindow ), m_frame( aFrame )
35 {
36 }
PANEL_SYM_COLOR_SETTINGS_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxTAB_TRAVERSAL, const wxString &name=wxEmptyString)

Member Function Documentation

◆ OnThemeChanged()

void PANEL_SYM_COLOR_SETTINGS::OnThemeChanged ( wxCommandEvent &  event)
overrideprotectedvirtual

Reimplemented from PANEL_SYM_COLOR_SETTINGS_BASE.

Definition at line 101 of file panel_sym_color_settings.cpp.

102 {
103  m_themeRB->SetValue( true );
104 }

References PANEL_SYM_COLOR_SETTINGS_BASE::m_themeRB.

◆ TransferDataFromWindow()

bool PANEL_SYM_COLOR_SETTINGS::TransferDataFromWindow ( )
overrideprivate

Definition at line 75 of file panel_sym_color_settings.cpp.

76 {
78  int sel = m_themes->GetSelection();
79  COLOR_SETTINGS* colors = static_cast<COLOR_SETTINGS*>( m_themes->GetClientData( sel ) );
80 
82  cfg->m_UseEeschemaColorSettings = m_eeschemaRB->GetValue();
83 
84  if( cfg->m_UseEeschemaColorSettings )
85  {
87  colors = mgr->GetColorSettings( eecfg->m_ColorTheme );
88  }
89  else
90  {
91  cfg->m_ColorTheme = colors->GetFilename();
92  }
93 
95  settings->LoadColors( colors );
96 
97  return true;
98 }
KIGFX::SCH_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
SETTINGS_MANAGER * GetSettingsManager() const
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
wxString GetFilename() const
Definition: json_settings.h:72
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition: view.h:208
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
T * GetAppSettings(bool aLoadNow=true)
Returns a handle to the a given settings by type If the settings have already been loaded,...
COLOR_SETTINGS * GetColorSettings(const wxString &aName="user")
Retrieves a color settings object that applications can read colors from.
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.
Color settings are a bit different than most of the settings objects in that there can be more than o...
virtual void LoadColors(const COLOR_SETTINGS *aSettings)
wxString m_ColorTheme
Active color theme name.
Definition: app_settings.h:184

References SETTINGS_MANAGER::GetAppSettings(), SCH_BASE_FRAME::GetCanvas(), SETTINGS_MANAGER::GetColorSettings(), JSON_SETTINGS::GetFilename(), KIGFX::VIEW::GetPainter(), KIGFX::PAINTER::GetSettings(), EDA_BASE_FRAME::GetSettingsManager(), SCH_DRAW_PANEL::GetView(), KIGFX::RENDER_SETTINGS::LoadColors(), APP_SETTINGS_BASE::m_ColorTheme, PANEL_SYM_COLOR_SETTINGS_BASE::m_eeschemaRB, m_frame, PANEL_SYM_COLOR_SETTINGS_BASE::m_themes, and SYMBOL_EDITOR_SETTINGS::m_UseEeschemaColorSettings.

◆ TransferDataToWindow()

bool PANEL_SYM_COLOR_SETTINGS::TransferDataToWindow ( )
overrideprivate

Definition at line 39 of file panel_sym_color_settings.cpp.

40 {
42 
44  m_eeschemaRB->SetValue( true );
45  else
46  m_themeRB->SetValue( true );
47 
49 
50  int width = 0;
51  int height = 0;
52  int minwidth = width;
53 
54  m_themes->Clear();
55 
57  {
58  int pos = m_themes->Append( settings->GetName(), static_cast<void*>( settings ) );
59 
60  if( settings == current )
61  m_themes->SetSelection( pos );
62 
63  m_themes->GetTextExtent( settings->GetName(), &width, &height );
64  minwidth = std::max( minwidth, width );
65  }
66 
67  m_themes->SetMinSize( wxSize( minwidth + 50, -1 ) );
68 
69  Fit();
70 
71  return true;
72 }
SETTINGS_MANAGER * GetSettingsManager() const
std::vector< COLOR_SETTINGS * > GetColorSettingsList()
SYMBOL_EDITOR_SETTINGS * GetSettings() const
COLOR_SETTINGS * GetColorSettings(const wxString &aName="user")
Retrieves a color settings object that applications can read colors from.
Color settings are a bit different than most of the settings objects in that there can be more than o...
wxString m_ColorTheme
Active color theme name.
Definition: app_settings.h:184

References SETTINGS_MANAGER::GetColorSettings(), SETTINGS_MANAGER::GetColorSettingsList(), SYMBOL_EDIT_FRAME::GetSettings(), EDA_BASE_FRAME::GetSettingsManager(), APP_SETTINGS_BASE::m_ColorTheme, PANEL_SYM_COLOR_SETTINGS_BASE::m_eeschemaRB, m_frame, PANEL_SYM_COLOR_SETTINGS_BASE::m_themeRB, PANEL_SYM_COLOR_SETTINGS_BASE::m_themes, and SYMBOL_EDITOR_SETTINGS::m_UseEeschemaColorSettings.

Member Data Documentation

◆ m_eeschemaRB

wxRadioButton* PANEL_SYM_COLOR_SETTINGS_BASE::m_eeschemaRB
protectedinherited

Definition at line 40 of file panel_sym_color_settings_base.h.

Referenced by TransferDataFromWindow(), and TransferDataToWindow().

◆ m_frame

SYMBOL_EDIT_FRAME* PANEL_SYM_COLOR_SETTINGS::m_frame
private

Definition at line 45 of file panel_sym_color_settings.h.

Referenced by TransferDataFromWindow(), and TransferDataToWindow().

◆ m_themeRB

wxRadioButton* PANEL_SYM_COLOR_SETTINGS_BASE::m_themeRB
protectedinherited

Definition at line 41 of file panel_sym_color_settings_base.h.

Referenced by OnThemeChanged(), and TransferDataToWindow().

◆ m_themes

wxChoice* PANEL_SYM_COLOR_SETTINGS_BASE::m_themes
protectedinherited

Definition at line 42 of file panel_sym_color_settings_base.h.

Referenced by TransferDataFromWindow(), and TransferDataToWindow().


The documentation for this class was generated from the following files: