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 SetIcons( icon_bundle );
109 m_toolManager->InitTools();
113 GetSizer()->SetSizeHints(
this );
116 SetSize( m_framePos.x, m_framePos.y, m_frameSize.x, m_frameSize.y );
118 if( m_framePos == wxDefaultPosition )
122 for(
size_t pageId = 0; pageId < m_treebook->GetPageCount(); pageId++ )
123 m_treebook->ExpandNode( pageId );
129 Bind( wxEVT_SYS_COLOUR_CHANGED,
132 m_treebook->Connect( wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED, wxTreebookEventHandler(
139 m_treebook->Disconnect( wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED, wxTreebookEventHandler(
149 if( aEvent.GetId() == wxID_EXIT )
152 if( aEvent.GetId() == wxID_CLOSE ||
Kiface().IsSingle() )
159 m_treebook->AddPage(
nullptr,
_(
"General system design" ) );
164 m_treebook->AddPage(
nullptr,
_(
"Power, current and isolation" ) );
188 regPanel->ReadDataFile();
198 wxCHECK( base_frame, );
202 wxMenuBar* oldMenuBar = base_frame->GetMenuBar();
209 fileMenu->
AddClose(
_(
"Calculator Tools" ) );
210 fileMenu->
AddQuit(
_(
"Calculator Tools" ) );
218 prefsMenu->AppendSeparator();
224 menuBar->Append( fileMenu,
_(
"&File" ) );
225 menuBar->Append( prefsMenu,
_(
"&Preferences" ) );
226 base_frame->AddStandardHelpMenu( menuBar );
228 base_frame->SetMenuBar( menuBar );
237 SetTitle(
_(
"Calculator Tools" ) );
259 int page = aEvent.GetSelection();
262 if (
m_treebook->GetPageParent( page ) == wxNOT_FOUND )
279 m_treebook->AddSubPage( aPanel, panelUIName );
290 panel->ThemeChanged();
308 wxASSERT( translinePanel );
309 wxASSERT( attenPanel );
310 wxASSERT( viaSizePanel );
311 wxASSERT( regulPanel );
312 wxASSERT( elecSpacingPanel );
315 wxCommandEvent event2( wxEVT_RADIOBUTTON );
326 wxCommandEvent event2( wxEVT_RADIOBUTTON );
336 viaSizePanel->Layout();
337 regulPanel->Layout();
351 wxASSERT( regPanel );
356 wxString title =
_(
"Write Data Failed" );
360 msg =
_(
"No data filename to save modifications.\n"
361 "Do you want to exit and abandon your changes?" );
363 if( wxMessageBox( msg, title, wxYES_NO | wxICON_QUESTION ) == wxNO )
370 msg.Printf(
_(
"Unable to write file '%s'\n"
371 "Do you want to exit and abandon your changes?"),
374 if( wxMessageBox( msg, title, wxYES_NO | wxICON_ERROR ) == wxNO )
386 if( aCfg ==
nullptr )
396 panel->LoadSettings( cfg );
402 if( aCfg ==
nullptr )
415 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