diff --git a/pcb_calculator/dialogs/pcb_calculator_frame_base.cpp b/pcb_calculator/dialogs/pcb_calculator_frame_base.cpp index 0ea446f340..4e13ce5731 100644 --- a/pcb_calculator/dialogs/pcb_calculator_frame_base.cpp +++ b/pcb_calculator/dialogs/pcb_calculator_frame_base.cpp @@ -15,6 +15,9 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow { this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + m_menubar = new wxMenuBar( 0 ); + this->SetMenuBar( m_menubar ); + wxBoxSizer* bmainFrameSizer; bmainFrameSizer = new wxBoxSizer( wxVERTICAL ); @@ -1753,14 +1756,13 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow bSizerElectricalClearance->Add( bLeftSizerElectricalClearance, 0, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 ); - wxBoxSizer* bElectricalSpacingSizerRight; - bElectricalSpacingSizerRight = new wxBoxSizer( wxVERTICAL ); + m_electricalSpacingSizer = new wxBoxSizer( wxVERTICAL ); m_staticTextElectricalSpacing = new wxStaticText( m_panelElectricalSpacing, wxID_ANY, _("Note: Values are minimal values (from IPC 2221)"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextElectricalSpacing->Wrap( -1 ); m_staticTextElectricalSpacing->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_ITALIC, wxFONTWEIGHT_BOLD, false, wxEmptyString ) ); - bElectricalSpacingSizerRight->Add( m_staticTextElectricalSpacing, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxRIGHT|wxLEFT, 5 ); + m_electricalSpacingSizer->Add( m_staticTextElectricalSpacing, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxRIGHT|wxLEFT, 5 ); m_gridElectricalSpacingValues = new wxGrid( m_panelElectricalSpacing, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); @@ -1820,14 +1822,14 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow // Cell Defaults m_gridElectricalSpacingValues->SetDefaultCellAlignment( wxALIGN_CENTER, wxALIGN_TOP ); - bElectricalSpacingSizerRight->Add( m_gridElectricalSpacingValues, 0, wxALL, 5 ); + m_electricalSpacingSizer->Add( m_gridElectricalSpacingValues, 0, wxALL, 5 ); m_staticText88 = new wxStaticText( m_panelElectricalSpacing, wxID_ANY, _("* B1 - Internal Conductors\n* B2 - External Conductors, uncoated, sea level to 3050 m\n* B3 - External Conductors, uncoated, over 3050 m\n* B4 - External Conductors, with permanent polymer coating (any elevation)\n* A5 - External Conductors, with conformal coating over assembly (any elevation)\n* A6 - External Component lead/termination, uncoated\n* A7 - External Component lead termination, with conformal coating (any elevation)"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText88->Wrap( -1 ); - bElectricalSpacingSizerRight->Add( m_staticText88, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + m_electricalSpacingSizer->Add( m_staticText88, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - bSizerElectricalClearance->Add( bElectricalSpacingSizerRight, 1, wxEXPAND|wxLEFT, 20 ); + bSizerElectricalClearance->Add( m_electricalSpacingSizer, 1, wxEXPAND|wxLEFT, 20 ); m_panelElectricalSpacing->SetSizer( bSizerElectricalClearance ); diff --git a/pcb_calculator/dialogs/pcb_calculator_frame_base.fbp b/pcb_calculator/dialogs/pcb_calculator_frame_base.fbp index f59223d078..68ea5d1f18 100644 --- a/pcb_calculator/dialogs/pcb_calculator_frame_base.fbp +++ b/pcb_calculator/dialogs/pcb_calculator_frame_base.fbp @@ -56,6 +56,29 @@ 1 OnClosePcbCalc OnUpdateUI + + + + 1 + 1 + + + 0 + wxID_ANY + MenuBar + + + m_menubar + protected + + + + ; ; forward_declare + + + + + bmainFrameSizer @@ -20496,9 +20519,9 @@ 1 - bElectricalSpacingSizerRight + m_electricalSpacingSizer wxVERTICAL - none + protected 5 wxALIGN_CENTER_HORIZONTAL|wxTOP|wxRIGHT|wxLEFT diff --git a/pcb_calculator/dialogs/pcb_calculator_frame_base.h b/pcb_calculator/dialogs/pcb_calculator_frame_base.h index 0408550fd2..6ffffc7f9f 100644 --- a/pcb_calculator/dialogs/pcb_calculator_frame_base.h +++ b/pcb_calculator/dialogs/pcb_calculator_frame_base.h @@ -19,11 +19,12 @@ class UNIT_SELECTOR_THICKNESS; #include "widgets/unit_selector.h" #include "kiway_player.h" #include -#include +#include #include #include #include #include +#include #include #include #include @@ -54,6 +55,7 @@ class PCB_CALCULATOR_FRAME_BASE : public KIWAY_PLAYER private: protected: + wxMenuBar* m_menubar; wxNotebook* m_Notebook; wxPanel* m_panelRegulators; wxStaticText* m_staticTextRegType; @@ -365,6 +367,7 @@ class PCB_CALCULATOR_FRAME_BASE : public KIWAY_PLAYER wxStaticText* m_staticText891; wxTextCtrl* m_ElectricalSpacingVoltage; wxButton* m_buttonElectSpacingRefresh; + wxBoxSizer* m_electricalSpacingSizer; wxStaticText* m_staticTextElectricalSpacing; wxGrid* m_gridElectricalSpacingValues; wxStaticText* m_staticText88; diff --git a/pcb_calculator/pcb_calculator_frame.cpp b/pcb_calculator/pcb_calculator_frame.cpp index fbd5790f49..572dfe14e8 100644 --- a/pcb_calculator/pcb_calculator_frame.cpp +++ b/pcb_calculator/pcb_calculator_frame.cpp @@ -36,7 +36,8 @@ const wxString DataFileNameExt( wxT("pcbcalc") ); PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) : PCB_CALCULATOR_FRAME_BASE( aParent ), - m_lastNotebookPage( -1 ) + m_lastNotebookPage( -1 ), + m_macHack( true ) { m_bpButtonCalcAtt->SetBitmap( KiBitmap( small_down_xpm ) ); m_bpButtonAnalyze->SetBitmap( KiBitmap( small_down_xpm ) ); @@ -210,7 +211,28 @@ void PCB_CALCULATOR_FRAME::OnUpdateUI( wxUpdateUIEvent& event ) // Until it's shown on screen the above won't work; but doing it anyway at least keeps // putting new OnUpdateUI events into the queue until it *is* shown on screen. if( m_Notebook->IsShownOnScreen() ) + { + // Work around an OSX bug where the wxGrid children don't get placed correctly until + // the first resize event. +#ifdef __WXMAC__ + if( m_macHack ) + { + wxSize pageSize = m_panelElectricalSpacing->GetSize(); + + pageSize.x -= 100; + m_panelElectricalSpacing->SetSize( pageSize ); + m_panelElectricalSpacing->Layout(); + + pageSize.x += 100; + m_panelElectricalSpacing->SetSize( pageSize ); + m_panelElectricalSpacing->Layout(); + + m_macHack = false; + } +#endif + m_lastNotebookPage = m_Notebook->GetSelection(); + } } } diff --git a/pcb_calculator/pcb_calculator_frame.h b/pcb_calculator/pcb_calculator_frame.h index 31acbf28f4..d41e4a0a0e 100644 --- a/pcb_calculator/pcb_calculator_frame.h +++ b/pcb_calculator/pcb_calculator_frame.h @@ -391,6 +391,7 @@ private: wxBitmap* m_ccTolerancesBitmap; int m_lastNotebookPage; + bool m_macHack; };