KiCad PCB EDA Suite
ui_common.cpp File Reference
#include <wx/dcclient.h>
#include <wx/checkbox.h>
#include <wx/choice.h>
#include <wx/listbox.h>
#include <wx/dataview.h>
#include <wx/radiobut.h>
#include <wx/slider.h>
#include <wx/spinctrl.h>
#include <wx/srchctrl.h>
#include <wx/stc/stc.h>
#include <wx/scrolbar.h>
#include <wx/grid.h>
#include <widgets/ui_common.h>
#include <algorithm>
#include <dialog_shim.h>
#include <pgm_base.h>
#include <wx/settings.h>
#include <bitmaps/bitmap_types.h>
#include <string_utils.h>

Go to the source code of this file.

Functions

SEVERITY SeverityFromString (const wxString &aSeverity)
 
wxString SeverityToString (const SEVERITY &aSeverity)
 
wxFont getGUIFont (wxWindow *aWindow, int aRelativeSize)
 

Function Documentation

◆ getGUIFont()

wxFont getGUIFont ( wxWindow *  aWindow,
int  aRelativeSize 
)

Definition at line 101 of file ui_common.cpp.

102{
103 wxFont font = aWindow->GetFont();
104
105 font.SetPointSize( font.GetPointSize() + aRelativeSize );
106
107 if( Pgm().GetCommonSettings()->m_Appearance.apply_icon_scale_to_fonts )
108 {
109 double icon_scale_fourths;
110
111 if( Pgm().GetCommonSettings()->m_Appearance.icon_scale <= 0 )
112 icon_scale_fourths = KiIconScale( aWindow );
113 else
114 icon_scale_fourths = Pgm().GetCommonSettings()->m_Appearance.icon_scale;
115
116 font.SetPointSize( KiROUND( icon_scale_fourths * font.GetPointSize() / 4.0 ) );
117 }
118
119#ifdef __WXMAC__
120 // https://trac.wxwidgets.org/ticket/19210
121 if( font.GetFaceName().IsEmpty() )
122 font.SetFaceName( wxS( "San Francisco" ) );
123 // OSX 10.1 .. 10.9: Lucida Grande
124 // OSX 10.10: Helvetica Neue
125 // OSX 10.11 .. : San Francisco
126#endif
127
128 return font;
129}
int KiIconScale(wxWindow *aWindow)
Return the automatic scale factor that would be used for a given window by KiScaledBitmap and KiScale...
Definition: bitmap.cpp:123
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:111
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:85

References KiIconScale(), KiROUND(), and Pgm().

Referenced by KIUI::GetControlFont(), KIUI::GetDockedPaneFont(), KIUI::GetInfoFont(), and KIUI::GetStatusFont().

◆ SeverityFromString()

SEVERITY SeverityFromString ( const wxString &  aSeverity)

Definition at line 48 of file ui_common.cpp.

49{
50 if( aSeverity == wxT( "warning" ) )
52 else if( aSeverity == wxT( "ignore" ) )
54 else
55 return RPT_SEVERITY_ERROR;
56}
@ RPT_SEVERITY_WARNING
@ RPT_SEVERITY_ERROR
@ RPT_SEVERITY_IGNORE

References RPT_SEVERITY_ERROR, RPT_SEVERITY_IGNORE, and RPT_SEVERITY_WARNING.

◆ SeverityToString()

wxString SeverityToString ( const SEVERITY aSeverity)

Definition at line 59 of file ui_common.cpp.

60{
61 if( aSeverity == RPT_SEVERITY_IGNORE )
62 return wxT( "ignore" );
63 else if( aSeverity == RPT_SEVERITY_WARNING )
64 return wxT( "warning" );
65 else
66 return wxT( "error" );
67}

References RPT_SEVERITY_IGNORE, and RPT_SEVERITY_WARNING.

Referenced by BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS(), and ERC_SETTINGS::ERC_SETTINGS().