Because we (evidently) didn't have enough display hacks....

Also adds back menubar, which appears to be required for cmd-Q on Mac.
This commit is contained in:
Jeff Young 2021-02-14 11:17:12 +00:00
parent cb7add9280
commit 5afc56e285
5 changed files with 61 additions and 10 deletions

View File

@ -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 );

View File

@ -56,6 +56,29 @@
<property name="xrc_skip_sizer">1</property>
<event name="OnClose">OnClosePcbCalc</event>
<event name="OnUpdateUI">OnUpdateUI</event>
<object class="wxMenuBar" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">MenuBar</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_menubar</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bmainFrameSizer</property>
@ -20496,9 +20519,9 @@
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bElectricalSpacingSizerRight</property>
<property name="name">m_electricalSpacingSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<property name="permission">protected</property>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_HORIZONTAL|wxTOP|wxRIGHT|wxLEFT</property>

View File

@ -19,11 +19,12 @@ class UNIT_SELECTOR_THICKNESS;
#include "widgets/unit_selector.h"
#include "kiway_player.h"
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/menu.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/stattext.h>
#include <wx/choice.h>
#include <wx/sizer.h>
#include <wx/bitmap.h>
@ -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;

View File

@ -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,8 +211,29 @@ 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();
}
}
}

View File

@ -391,6 +391,7 @@ private:
wxBitmap* m_ccTolerancesBitmap;
int m_lastNotebookPage;
bool m_macHack;
};