KiCad PCB EDA Suite
PANEL_PL_EDITOR_COLOR_SETTINGS Class Reference

#include <panel_pl_editor_color_settings.h>

Inheritance diagram for PANEL_PL_EDITOR_COLOR_SETTINGS:
PANEL_PL_EDITOR_COLOR_SETTINGS_BASE RESETTABLE_PANEL

Public Member Functions

 PANEL_PL_EDITOR_COLOR_SETTINGS (wxWindow *aParent)
 
bool TransferDataToWindow () override
 
bool TransferDataFromWindow () override
 
void ResetPanel () override
 Reset the contents of this panel. More...
 
virtual wxString GetResetTooltip () const
 Get the tooltip the reset button should display when showing this panel. More...
 
wxString GetHelpTextAtPoint (const wxPoint &aPt, wxHelpEvent::Origin aOrigin) const override
 Overridden to supply the reset button tooltip when queried with { -INT_MAX, INT_MAX }. More...
 

Protected Attributes

wxStaticText * m_txtTheme
 
wxChoice * m_themes
 

Detailed Description

Definition at line 26 of file panel_pl_editor_color_settings.h.

Constructor & Destructor Documentation

◆ PANEL_PL_EDITOR_COLOR_SETTINGS()

PANEL_PL_EDITOR_COLOR_SETTINGS::PANEL_PL_EDITOR_COLOR_SETTINGS ( wxWindow *  aParent)

Definition at line 26 of file panel_pl_editor_color_settings.cpp.

26 :
28{
29}
PANEL_PL_EDITOR_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

◆ GetHelpTextAtPoint()

wxString RESETTABLE_PANEL::GetHelpTextAtPoint ( const wxPoint &  aPt,
wxHelpEvent::Origin  aOrigin 
) const
inlineoverrideinherited

Overridden to supply the reset button tooltip when queried with { -INT_MAX, INT_MAX }.

Definition at line 72 of file resettable_panel.h.

73 {
74 if( aPt == wxPoint( -INT_MAX, INT_MAX ) )
75 return GetResetTooltip();
76 else
77 return wxPanel::GetHelpTextAtPoint( aPt, aOrigin );
78 }
virtual wxString GetResetTooltip() const
Get the tooltip the reset button should display when showing this panel.

References RESETTABLE_PANEL::GetResetTooltip().

◆ GetResetTooltip()

virtual wxString RESETTABLE_PANEL::GetResetTooltip ( ) const
inlinevirtualinherited

Get the tooltip the reset button should display when showing this panel.

Returns
the tooltip

Reimplemented in PANEL_COLOR_SETTINGS, and PANEL_HOTKEYS_EDITOR.

Definition at line 64 of file resettable_panel.h.

65 {
66 return _( "Reset all settings on this page to their default" );
67 }
#define _(s)

References _.

Referenced by RESETTABLE_PANEL::GetHelpTextAtPoint().

◆ ResetPanel()

void PANEL_PL_EDITOR_COLOR_SETTINGS::ResetPanel ( )
overridevirtual

Reset the contents of this panel.

Implements RESETTABLE_PANEL.

Definition at line 76 of file panel_pl_editor_color_settings.cpp.

77{
78 m_themes->SetStringSelection( _( "KiCad Default" ) );
79}

References _, and PANEL_PL_EDITOR_COLOR_SETTINGS_BASE::m_themes.

◆ TransferDataFromWindow()

bool PANEL_PL_EDITOR_COLOR_SETTINGS::TransferDataFromWindow ( )
override

Definition at line 63 of file panel_pl_editor_color_settings.cpp.

64{
65 SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
67 int sel = m_themes->GetSelection();
68 COLOR_SETTINGS* colors = static_cast<COLOR_SETTINGS*>( m_themes->GetClientData( sel ) );
69
70 cfg->m_ColorTheme = colors->GetFilename();
71
72 return true;
73}
wxString m_ColorTheme
Active color theme name.
Definition: app_settings.h:184
Color settings are a bit different than most of the settings objects in that there can be more than o...
wxString GetFilename() const
Definition: json_settings.h:72
T * GetAppSettings(bool aLoadNow=true)
Returns a handle to the a given settings by type If the settings have already been loaded,...
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:111

References SETTINGS_MANAGER::GetAppSettings(), JSON_SETTINGS::GetFilename(), APP_SETTINGS_BASE::m_ColorTheme, PANEL_PL_EDITOR_COLOR_SETTINGS_BASE::m_themes, and Pgm().

◆ TransferDataToWindow()

bool PANEL_PL_EDITOR_COLOR_SETTINGS::TransferDataToWindow ( )
override

Definition at line 32 of file panel_pl_editor_color_settings.cpp.

33{
34 PL_EDITOR_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<PL_EDITOR_SETTINGS>();
35
36 COLOR_SETTINGS* current = Pgm().GetSettingsManager().GetColorSettings( cfg->m_ColorTheme );
37
38 int width = 0;
39 int height = 0;
40 int minwidth = width;
41
42 m_themes->Clear();
43
44 for( COLOR_SETTINGS* settings : Pgm().GetSettingsManager().GetColorSettingsList() )
45 {
46 int pos = m_themes->Append( settings->GetName(), static_cast<void*>( settings ) );
47
48 if( settings == current )
49 m_themes->SetSelection( pos );
50
51 m_themes->GetTextExtent( settings->GetName(), &width, &height );
52 minwidth = std::max( minwidth, width );
53 }
54
55 m_themes->SetMinSize( wxSize( minwidth + 50, -1 ) );
56
57 Fit();
58
59 return true;
60}
SETTINGS_MANAGER * GetSettingsManager()

References GetSettingsManager(), APP_SETTINGS_BASE::m_ColorTheme, PANEL_PL_EDITOR_COLOR_SETTINGS_BASE::m_themes, and Pgm().

Member Data Documentation

◆ m_themes

wxChoice* PANEL_PL_EDITOR_COLOR_SETTINGS_BASE::m_themes
protectedinherited

◆ m_txtTheme

wxStaticText* PANEL_PL_EDITOR_COLOR_SETTINGS_BASE::m_txtTheme
protectedinherited

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