21#include <wx/treebook.h>
65 wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER|wxFULL_REPAINT_ON_RESIZE|wxTAB_TRAVERSAL,
67 m_lastNotebookPage( -1 )
69 m_aboutTitle =
_HKI(
"KiCad Calculator Tools" );
74 SetSizeHints( wxDefaultSize, wxDefaultSize );
76 m_mainSizer =
new wxBoxSizer( wxVERTICAL );
78 m_treebook =
new wxTreebook(
this, wxID_ANY );
80 m_mainSizer->Add( m_treebook, 1, wxEXPAND | wxLEFT | wxTOP, 0 );
82 SetSizer( m_mainSizer );
90 wxIconBundle icon_bundle;
93 icon_bundle.AddIcon( icon );
95 icon_bundle.AddIcon( icon );
97 icon_bundle.AddIcon( icon );
99 icon_bundle.AddIcon( icon );
101 icon_bundle.AddIcon( icon );
103 SetIcons( icon_bundle );
113 m_toolManager->InitTools();
118 GetSizer()->SetSizeHints(
this );
121 SetSize( m_framePos.x, m_framePos.y, m_frameSize.x, m_frameSize.y );
123 if( m_framePos == wxDefaultPosition )
127 for(
size_t pageId = 0; pageId < m_treebook->GetPageCount(); pageId++ )
128 m_treebook->ExpandNode( pageId );
134 Bind( wxEVT_SYS_COLOUR_CHANGED,
137 m_treebook->Connect( wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED, wxTreebookEventHandler(
144 m_treebook->Disconnect( wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED, wxTreebookEventHandler(
154 if( aEvent.GetId() == wxID_EXIT )
157 if( aEvent.GetId() == wxID_CLOSE ||
Kiface().IsSingle() )
164 m_treebook->AddPage(
nullptr,
_(
"General system design" ) );
169 m_treebook->AddPage(
nullptr,
_(
"Power, current and isolation" ) );
193 regPanel->ReadDataFile();
203 wxCHECK( base_frame, );
207 wxMenuBar* oldMenuBar = base_frame->GetMenuBar();
214 fileMenu->
AddClose(
_(
"Calculator Tools" ) );
215 fileMenu->
AddQuit(
_(
"Calculator Tools" ) );
223 prefsMenu->AppendSeparator();
229 menuBar->Append( fileMenu,
_(
"&File" ) );
230 menuBar->Append( prefsMenu,
_(
"&Preferences" ) );
231 base_frame->AddStandardHelpMenu( menuBar );
233 base_frame->SetMenuBar( menuBar );
242 SetTitle(
_(
"Calculator Tools" ) );
264 int page = aEvent.GetSelection();
267 if (
m_treebook->GetPageParent( page ) == wxNOT_FOUND )
284 m_treebook->AddSubPage( aPanel, panelUIName );
295 panel->ThemeChanged();
313 wxASSERT( translinePanel );
314 wxASSERT( attenPanel );
315 wxASSERT( viaSizePanel );
316 wxASSERT( regulPanel );
317 wxASSERT( elecSpacingPanel );
320 wxCommandEvent event2( wxEVT_RADIOBUTTON );
331 wxCommandEvent event2( wxEVT_RADIOBUTTON );
341 viaSizePanel->Layout();
342 regulPanel->Layout();
356 wxASSERT( regPanel );
361 wxString title =
_(
"Write Data Failed" );
365 msg =
_(
"No data filename to save modifications.\n"
366 "Do you want to exit and abandon your changes?" );
368 if( wxMessageBox( msg, title, wxYES_NO | wxICON_QUESTION ) == wxNO )
375 msg.Printf(
_(
"Unable to write file '%s'\n"
376 "Do you want to exit and abandon your changes?"),
379 if( wxMessageBox( msg, title, wxYES_NO | wxICON_ERROR ) == wxNO )
391 if( aCfg ==
nullptr )
401 panel->LoadSettings( cfg );
407 if( aCfg ==
nullptr )
420 panel->SaveSettings( cfg );
constexpr EDA_IU_SCALE unityScale
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
BITMAP_STORE * GetBitmapStore()
static TOOL_ACTION openPreferences
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
void ThemeChanged()
Notifies the store that the icon theme has been changed by the user, so caches must be invalidated.
Handle actions that are shared between different applications.
The base frame for deriving all KiCad main window classes.
virtual APP_SETTINGS_BASE * config() const
Returns the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
void ShowChangedLanguage() override
Redraw the menus and what not in current language.
void AddMenuLanguageList(ACTION_MENU *aMasterMenu, TOOL_INTERACTIVE *aControlTool)
Function AddMenuLanguageList creates a menu list for language choice, and add it as submenu to Master...
virtual void LoadSettings(APP_SETTINGS_BASE *aCfg)
Load common frame parameters from a configuration file.
virtual void SaveSettings(APP_SETTINGS_BASE *aCfg)
Save common frame parameters to a configuration data file.
APP_SETTINGS_BASE * KifaceSettings() const
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
bool m_RegulatorListChanged
const wxString GetDataFilename()
ATTENUATOR * m_CurrAttenuator
std::vector< ATTENUATOR * > m_AttenuatorList
wxRadioBox * GetAttenuatorsSelector()
wxRadioBox * GetTranslineSelector()
TRANSLINE_TYPE_ID GetCurrTransLineType()
Handle actions for the various symbol editor and viewers.
PCB calculator the main frame.
void doReCreateMenuBar() override
void OnPageChanged(wxTreebookEvent &aEvent)
void ShowChangedLanguage() override
Redraw the menus and what not in current language.
std::vector< CALCULATOR_PANEL * > m_panels
void OnUpdateUI(wxUpdateUIEvent &event)
void onThemeChanged(wxSysColourChangedEvent &aEvent)
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
void OnExit(wxCommandEvent &aEvent)
Event handler for the wxID_EXIT and wxID_CLOSE events.
void OnClosePcbCalc(wxCloseEvent &event)
void AddCalculator(CALCULATOR_PANEL *aPanel, const wxString &panelUIName)
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
std::map< std::size_t, CALCULATOR_PANEL * > m_panelTypes
Represent a set of closed polygons.
KICOMMON_API wxFont GetControlFont(wxWindow *aWindow)
void Refresh()
Update the board display after modifying it by a python script (note: it is automatically called by a...
std::vector< FAB_LAYER_COLOR > dummy