21#include <wx/treebook.h>
68 wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER|wxFULL_REPAINT_ON_RESIZE|wxTAB_TRAVERSAL,
77 SetSizeHints( wxDefaultSize, wxDefaultSize );
93 wxIconBundle icon_bundle;
96 icon_bundle.AddIcon( icon );
98 icon_bundle.AddIcon( icon );
100 icon_bundle.AddIcon( icon );
102 icon_bundle.AddIcon( icon );
104 icon_bundle.AddIcon( icon );
106 SetIcons( icon_bundle );
120 GetSizer()->SetSizeHints(
this );
129 for(
size_t pageId = 0; pageId <
m_treebook->GetPageCount(); pageId++ )
136 Bind( wxEVT_SYS_COLOUR_CHANGED,
139 m_treebook->Connect( wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED, wxTreebookEventHandler(
146 m_treebook->Disconnect( wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED, wxTreebookEventHandler(
166 m_treebook->AddPage(
nullptr,
_(
"General system design" ) );
171 m_treebook->AddPage(
nullptr,
_(
"Footprint design" ) );
175 m_treebook->AddPage(
nullptr,
_(
"Power, current and isolation" ) );
199 regPanel->ReadDataFile();
209 wxCHECK( base_frame, );
213 wxMenuBar* oldMenuBar = base_frame->GetMenuBar();
220 fileMenu->
AddClose(
_(
"Calculator Tools" ) );
221 fileMenu->
AddQuit(
_(
"Calculator Tools" ) );
229 prefsMenu->AppendSeparator();
235 menuBar->Append( fileMenu,
_(
"&File" ) );
236 menuBar->Append( prefsMenu,
_(
"&Preferences" ) );
237 base_frame->AddStandardHelpMenu( menuBar );
239 base_frame->SetMenuBar( menuBar );
248 SetTitle(
_(
"Calculator Tools" ) );
270 int page = aEvent.GetSelection();
273 if (
m_treebook->GetPageParent( page ) == wxNOT_FOUND )
290 m_treebook->AddSubPage( aPanel, panelUIName );
296 for(
size_t i = 0; i <
m_treebook->GetPageCount(); ++i )
300 const int pageIndex =
static_cast<int>( i );
301 const int parentIndex =
m_treebook->GetPageParent( pageIndex );
303 if( parentIndex != wxNOT_FOUND )
320 const std::string& payloadStr = aEvent.
GetPayload();
321 nlohmann::json payload = nlohmann::json::parse( payloadStr,
nullptr,
false );
323 const std::string pageName = payload.value(
"page",
"" );
325 if( pageName.empty() )
328 wxWindow* shownPanel =
nullptr;
330 if( pageName ==
"pth_size" )
334 shownPanel = pthPanel;
353 panel->ThemeChanged();
370 wxASSERT( translinePanel );
371 wxASSERT( attenPanel );
372 wxASSERT( viaSizePanel );
373 wxASSERT( regulPanel );
376 wxCommandEvent event2( wxEVT_RADIOBUTTON );
387 wxCommandEvent event2( wxEVT_RADIOBUTTON );
397 viaSizePanel->Layout();
398 regulPanel->Layout();
412 wxASSERT( regPanel );
417 wxString title =
_(
"Write Data Failed" );
421 msg =
_(
"No data filename to save modifications.\n"
422 "Do you want to exit and abandon your changes?" );
424 if( wxMessageBox( msg, title, wxYES_NO | wxICON_QUESTION ) == wxNO )
431 msg.Printf(
_(
"Unable to write file '%s'\n"
432 "Do you want to exit and abandon your changes?"),
435 if( wxMessageBox( msg, title, wxYES_NO | wxICON_ERROR ) == wxNO )
447 if( aCfg ==
nullptr )
457 panel->LoadSettings( cfg );
463 if( aCfg ==
nullptr )
476 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.
virtual APP_SETTINGS_BASE * config() const
Return 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.
virtual void setupUIConditions()
Setup the UI conditions for the various actions and their controls in this frame.
EDA_BASE_FRAME(wxWindow *aParent, FRAME_T aFrameType, const wxString &aTitle, const wxPoint &aPos, const wxSize &aSize, long aStyle, const wxString &aFrameName, KIWAY *aKiway, const EDA_IU_SCALE &aIuScale)
void AddMenuLanguageList(ACTION_MENU *aMasterMenu, TOOL_INTERACTIVE *aControlTool)
Create a menu list for language choice, and add it as submenu to MasterMenu.
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.
void ReCreateMenuBar()
Recreate the menu bar.
APP_SETTINGS_BASE * KifaceSettings() const
Carry a payload from one KIWAY_PLAYER to another within a PROJECT.
std::string & GetPayload()
Return the payload, which can be any text but it typically self identifying s-expression.
MAIL_T Command()
Returns the MAIL_T associated with this mail.
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
KIWAY_PLAYER(KIWAY *aKiway, wxWindow *aParent, FRAME_T aFrameType, const wxString &aTitle, const wxPoint &aPos, const wxSize &aSize, long aStyle, const wxString &aFrameName, const EDA_IU_SCALE &aIuScale)
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()
PCB calculator the main frame.
void doReCreateMenuBar() override
void OnPageChanged(wxTreebookEvent &aEvent)
void KiwayMailIn(KIWAY_MAIL_EVENT &aEvent) override
Receive #KIWAY_ROUTED_EVENT messages from other players.
PCB_CALCULATOR_FRAME(KIWAY *aKiway, wxWindow *aParent)
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 showCalculatorPage(wxWindow *aPage)
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.
EVT_MENU(ID_COMPARE_PROJECT_BRANCHES, KICAD_MANAGER_FRAME::OnCompareProjectBranches) KICAD_MANAGER_FRAME
KICOMMON_API wxFont GetControlFont(wxWindow *aWindow)
std::vector< FAB_LAYER_COLOR > dummy