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();
117 GetSizer()->SetSizeHints(
this );
120 SetSize( m_framePos.x, m_framePos.y, m_frameSize.x, m_frameSize.y );
122 if( m_framePos == wxDefaultPosition )
126 for(
size_t pageId = 0; pageId < m_treebook->GetPageCount(); pageId++ )
127 m_treebook->ExpandNode( pageId );
133 Bind( wxEVT_SYS_COLOUR_CHANGED,
136 m_treebook->Connect( wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED, wxTreebookEventHandler(
143 m_treebook->Disconnect( wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED, wxTreebookEventHandler(
153 if( aEvent.GetId() == wxID_EXIT )
156 if( aEvent.GetId() == wxID_CLOSE ||
Kiface().IsSingle() )
163 m_treebook->AddPage(
nullptr,
_(
"General system design" ) );
168 m_treebook->AddPage(
nullptr,
_(
"Power, current and isolation" ) );
192 regPanel->ReadDataFile();
202 wxCHECK( base_frame, );
206 wxMenuBar* oldMenuBar = base_frame->GetMenuBar();
213 fileMenu->
AddClose(
_(
"Calculator Tools" ) );
214 fileMenu->
AddQuit(
_(
"Calculator Tools" ) );
222 prefsMenu->AppendSeparator();
228 menuBar->Append( fileMenu,
_(
"&File" ) );
229 menuBar->Append( prefsMenu,
_(
"&Preferences" ) );
230 base_frame->AddStandardHelpMenu( menuBar );
232 base_frame->SetMenuBar( menuBar );
241 SetTitle(
_(
"Calculator Tools" ) );
263 int page = aEvent.GetSelection();
266 if (
m_treebook->GetPageParent( page ) == wxNOT_FOUND )
283 m_treebook->AddSubPage( aPanel, panelUIName );
294 panel->ThemeChanged();
312 wxASSERT( translinePanel );
313 wxASSERT( attenPanel );
314 wxASSERT( viaSizePanel );
315 wxASSERT( regulPanel );
316 wxASSERT( elecSpacingPanel );
319 wxCommandEvent event2( wxEVT_RADIOBUTTON );
330 wxCommandEvent event2( wxEVT_RADIOBUTTON );
340 viaSizePanel->Layout();
341 regulPanel->Layout();
355 wxASSERT( regPanel );
360 wxString title =
_(
"Write Data Failed" );
364 msg =
_(
"No data filename to save modifications.\n"
365 "Do you want to exit and abandon your changes?" );
367 if( wxMessageBox( msg, title, wxYES_NO | wxICON_QUESTION ) == wxNO )
374 msg.Printf(
_(
"Unable to write file '%s'\n"
375 "Do you want to exit and abandon your changes?"),
378 if( wxMessageBox( msg, title, wxYES_NO | wxICON_ERROR ) == wxNO )
390 if( aCfg ==
nullptr )
400 panel->LoadSettings( cfg );
406 if( aCfg ==
nullptr )
419 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.
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