Skip to content

Commit

Permalink
Merge pull request #613 from drowe67/ms-box-sizing
Browse files Browse the repository at this point in the history
Force all left hand side boxes the same width.
  • Loading branch information
tmiw authored Dec 5, 2023
2 parents c7e6eaa + 0ab1578 commit e7847a1
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 44 deletions.
1 change: 1 addition & 0 deletions USER_MANUAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -917,6 +917,7 @@ LDPC | Low Density Parity Check Codes - a family of powerful FEC codes
1. Bugfixes:
* Use SetSize/GetSize instead of SetClientSize/GetClientSize to work around startup sizing issue. (PR #611)
* Check for RIGCAPS_NOT_CONST in Hamlib 4.6. (PR #615)
* Make main screen gauges horizontal to work around sizing/layout issues. (PR #613)

## V1.9.5 November 2023

Expand Down
23 changes: 19 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,13 +390,28 @@ void MainFrame::loadConfiguration_()
g_SquelchLevel /= 2.0;

Move(x, y);
Fit();
wxSize size = GetBestSize();
wxSize size = GetMinSize();

if (w < size.GetWidth()) w = size.GetWidth();
if (h < size.GetHeight()) h = size.GetHeight();
SetSize(w, h);
SetSizeHints(size);

// XXX - with really short windows, wxWidgets sometimes doesn't size
// the components properly until the user resizes the window (even if only
// by a pixel or two). As a really hacky workaround, we emulate this behavior
// when restoring window sizing. These resize events also happen after configuration
// is restored but I'm not sure this is necessary.
CallAfter([=]()
{
SetSize(w, h);
});
CallAfter([=]()
{
SetSize(w + 1, h + 1);
});
CallAfter([=]()
{
SetSize(w, h);
});

g_txLevel = wxGetApp().appConfiguration.transmitLevel;
char fmt[15];
Expand Down
81 changes: 41 additions & 40 deletions src/topFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,10 +325,10 @@ TopFrame::TopFrame(wxWindow* parent, wxWindowID id, const wxString& title, const
#endif // wxUSE_ACCESSIBILITY

this->SetSizeHints(wxDefaultSize, wxDefaultSize);
//this->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
//this->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));

//=====================================================
// Menubar Setup
//=====================================================
m_menubarMain = new wxMenuBar(wxMB_DOCKABLE);
file = new wxMenu();

Expand Down Expand Up @@ -416,13 +416,13 @@ TopFrame::TopFrame(wxWindow* parent, wxWindowID id, const wxString& title, const
wxSizer* leftSizer = new wxWrapSizer(wxVERTICAL);

wxStaticBoxSizer* snrSizer;
wxStaticBox* snrBox = new wxStaticBox(m_panel, wxID_ANY, _("SNR"), wxDefaultPosition, wxSize(150,-1));
wxStaticBox* snrBox = new wxStaticBox(m_panel, wxID_ANY, _("SNR"), wxDefaultPosition, wxSize(100,-1));
snrSizer = new wxStaticBoxSizer(snrBox, wxVERTICAL);

//------------------------------
// S/N ratio Gauge (vert. bargraph)
//------------------------------
m_gaugeSNR = new wxGauge(snrBox, wxID_ANY, 25, wxDefaultPosition, wxSize(15,135), wxGA_SMOOTH|wxGA_VERTICAL);
m_gaugeSNR = new wxGauge(snrBox, wxID_ANY, 25, wxDefaultPosition, wxSize(135,15), wxGA_SMOOTH);
m_gaugeSNR->SetToolTip(_("Displays signal to noise ratio in dB."));
snrSizer->Add(m_gaugeSNR, 1, wxALIGN_CENTER_HORIZONTAL|wxALL, 10);

Expand All @@ -442,11 +442,28 @@ TopFrame::TopFrame(wxWindow* parent, wxWindowID id, const wxString& title, const

leftSizer->Add(snrSizer, 2, wxEXPAND|wxALL, 2);

//------------------------------
// Signal Level(vert. bargraph)
//------------------------------
wxStaticBoxSizer* levelSizer;
wxStaticBox* levelBox = new wxStaticBox(m_panel, wxID_ANY, _("Level"), wxDefaultPosition, wxSize(100,-1));
levelSizer = new wxStaticBoxSizer(levelBox, wxVERTICAL);

m_textLevel = new wxStaticText(levelBox, wxID_ANY, wxT(""), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE);
m_textLevel->SetForegroundColour(wxColour(255,0,0));
levelSizer->Add(m_textLevel, 0, wxALIGN_CENTER_HORIZONTAL, 1);

m_gaugeLevel = new wxGauge(levelBox, wxID_ANY, 100, wxDefaultPosition, wxSize(135,15), wxGA_SMOOTH);
m_gaugeLevel->SetToolTip(_("Peak of From Radio in Rx, or peak of From Mic in Tx mode. If Red you should reduce your levels"));
levelSizer->Add(m_gaugeLevel, 1, wxALIGN_CENTER_HORIZONTAL|wxALL, 10);

leftSizer->Add(levelSizer, 2, wxALL|wxEXPAND, 2);

//------------------------------
// Sync Indicator box
//------------------------------
wxStaticBoxSizer* sbSizer3_33;
wxStaticBox* syncBox = new wxStaticBox(m_panel, wxID_ANY, _("Sync"));
wxStaticBox* syncBox = new wxStaticBox(m_panel, wxID_ANY, _("Sync"), wxDefaultPosition, wxSize(100,-1));
sbSizer3_33 = new wxStaticBoxSizer(syncBox, wxVERTICAL);

m_textSync = new wxStaticText(syncBox, wxID_ANY, wxT("Modem"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE);
Expand All @@ -465,7 +482,7 @@ TopFrame::TopFrame(wxWindow* parent, wxWindowID id, const wxString& title, const
//------------------------------
// Audio Recording/Playback
//------------------------------
wxStaticBox* audioBox = new wxStaticBox(m_panel, wxID_ANY, _("Audio"));
wxStaticBox* audioBox = new wxStaticBox(m_panel, wxID_ANY, _("Audio"), wxDefaultPosition, wxSize(100,-1));
wxStaticBoxSizer* sbSizerAudioRecordPlay = new wxStaticBoxSizer(audioBox, wxVERTICAL);

m_audioRecord = new wxToggleButton(audioBox, wxID_ANY, _("Record"), wxDefaultPosition, wxDefaultSize, 0);
Expand All @@ -479,7 +496,7 @@ TopFrame::TopFrame(wxWindow* parent, wxWindowID id, const wxString& title, const
//------------------------------

wxStaticBoxSizer* sbSizer_ber;
wxStaticBox* statsBox = new wxStaticBox(m_panel, wxID_ANY, _("Stats"));
wxStaticBox* statsBox = new wxStaticBox(m_panel, wxID_ANY, _("Stats"), wxDefaultPosition, wxSize(100,-1));
sbSizer_ber = new wxStaticBoxSizer(statsBox, wxVERTICAL);

m_BtnBerReset = new wxButton(statsBox, wxID_ANY, _("&Reset"), wxDefaultPosition, wxDefaultSize, 0);
Expand All @@ -503,35 +520,19 @@ TopFrame::TopFrame(wxWindow* parent, wxWindowID id, const wxString& title, const
m_textCodec2Var = new wxStaticText(statsBox, wxID_ANY, wxT("Var: 0"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
sbSizer_ber->Add(m_textCodec2Var, 0, wxALL | wxALIGN_LEFT, 1);

leftSizer->Add(sbSizer_ber,0, wxALL|wxEXPAND, 2);
leftSizer->Add(sbSizer_ber,0, wxALL|wxEXPAND|wxFIXED_MINSIZE, 2);

//------------------------------
// Signal Level(vert. bargraph)
//------------------------------
wxStaticBoxSizer* levelSizer;
wxStaticBox* levelBox = new wxStaticBox(m_panel, wxID_ANY, _("Level"));
levelSizer = new wxStaticBoxSizer(levelBox, wxVERTICAL);

m_textLevel = new wxStaticText(levelBox, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(60,-1), wxALIGN_CENTRE);
m_textLevel->SetForegroundColour(wxColour(255,0,0));
levelSizer->Add(m_textLevel, 0, wxALIGN_LEFT, 1);

m_gaugeLevel = new wxGauge(levelBox, wxID_ANY, 100, wxDefaultPosition, wxSize(15,135), wxGA_SMOOTH|wxGA_VERTICAL);
m_gaugeLevel->SetToolTip(_("Peak of From Radio in Rx, or peak of From Mic in Tx mode. If Red you should reduce your levels"));
levelSizer->Add(m_gaugeLevel, 1, wxALIGN_CENTER_HORIZONTAL|wxALL, 10);

leftSizer->Add(levelSizer, 2, wxALL|wxEXPAND, 2);

//------------------------------
// Help button: goes to Help page on website
//------------------------------
wxStaticBox* helpBox = new wxStaticBox(m_panel, wxID_ANY, _("Assistance"));
wxStaticBox* helpBox = new wxStaticBox(m_panel, wxID_ANY, _("Assistance"), wxDefaultPosition, wxSize(100,-1));
wxStaticBoxSizer* helpSizer = new wxStaticBoxSizer(helpBox, wxVERTICAL);

m_btnHelp = new wxButton(helpBox, wxID_ANY, _("Get Help"), wxDefaultPosition, wxDefaultSize, 0);
m_btnHelp->SetToolTip(_("Get help with FreeDV."));
helpSizer->Add(m_btnHelp, 0, wxALIGN_CENTER|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
leftOuterSizer->Add(leftSizer, 2, wxALL | wxEXPAND, 1);
leftSizer->SetMinSize(wxSize(-1, 375));
leftOuterSizer->Add(leftSizer, 2, wxALL | wxEXPAND | wxFIXED_MINSIZE, 1);
leftOuterSizer->Add(helpSizer, 0, wxFIXED_MINSIZE | wxALL | wxEXPAND, 1);

bSizer1->Add(leftOuterSizer, 0, wxALL|wxEXPAND, 5);
Expand Down Expand Up @@ -603,12 +604,12 @@ TopFrame::TopFrame(wxWindow* parent, wxWindowID id, const wxString& title, const
// Squelch Slider Control
//=====================================================
wxStaticBoxSizer* sbSizer3;
wxStaticBox* squelchBox = new wxStaticBox(m_panel, wxID_ANY, _("S&quelch"), wxDefaultPosition, wxSize(150,-1));
wxStaticBox* squelchBox = new wxStaticBox(m_panel, wxID_ANY, _("S&quelch"), wxDefaultPosition, wxSize(100,-1));
sbSizer3 = new wxStaticBoxSizer(squelchBox, wxVERTICAL);

m_sliderSQ = new wxSlider(squelchBox, wxID_ANY, 0, 0, 40, wxDefaultPosition, wxDefaultSize, wxSL_AUTOTICKS|wxSL_INVERSE|wxSL_VERTICAL);
m_sliderSQ = new wxSlider(squelchBox, wxID_ANY, 0, 0, 40, wxDefaultPosition, wxDefaultSize, wxSL_AUTOTICKS);
m_sliderSQ->SetToolTip(_("Set Squelch level in dB."));
m_sliderSQ->SetMinSize(wxSize(-1,150));
m_sliderSQ->SetMinSize(wxSize(135,-1));

// Add accessibility class so that the values are read back correctly.
#if wxUSE_ACCESSIBILITY
Expand Down Expand Up @@ -636,12 +637,12 @@ TopFrame::TopFrame(wxWindow* parent, wxWindowID id, const wxString& title, const
rightSizer->Add(sbSizer3, 2, wxALL | wxEXPAND, 2);

// Transmit Level slider
wxBoxSizer* txLevelSizer = new wxStaticBoxSizer(new wxStaticBox(m_panel, wxID_ANY, _("TX &Attenuation"), wxDefaultPosition, wxSize(150,-1)), wxVERTICAL);
wxBoxSizer* txLevelSizer = new wxStaticBoxSizer(new wxStaticBox(m_panel, wxID_ANY, _("TX &Attenuation"), wxDefaultPosition, wxSize(100,-1)), wxVERTICAL);

// Sliders are integer values, so we're multiplying min/max by 10 here to allow 1 decimal precision.
m_sliderTxLevel = new wxSlider(m_panel, wxID_ANY, g_txLevel, -300, 0, wxDefaultPosition, wxDefaultSize, wxSL_AUTOTICKS|wxSL_INVERSE|wxSL_VERTICAL);
m_sliderTxLevel = new wxSlider(m_panel, wxID_ANY, g_txLevel, -300, 0, wxDefaultPosition, wxDefaultSize, wxSL_AUTOTICKS);
m_sliderTxLevel->SetToolTip(_("Sets TX attenuation (0-30dB))."));
m_sliderTxLevel->SetMinSize(wxSize(-1,150));
m_sliderTxLevel->SetMinSize(wxSize(150,-1));
txLevelSizer->Add(m_sliderTxLevel, 1, wxALIGN_CENTER_HORIZONTAL, 0);

#if wxUSE_ACCESSIBILITY
Expand All @@ -663,7 +664,7 @@ TopFrame::TopFrame(wxWindow* parent, wxWindowID id, const wxString& title, const
//------------------------------
// Mode box
//------------------------------
modeBox = new wxStaticBox(m_panel, wxID_ANY, _("&Mode"), wxDefaultPosition, wxSize(150,-1));
modeBox = new wxStaticBox(m_panel, wxID_ANY, _("&Mode"), wxDefaultPosition, wxSize(100,-1));
sbSizer_mode = new wxStaticBoxSizer(modeBox, wxVERTICAL);

m_rb700d = new wxRadioButton( modeBox, wxID_ANY, wxT("700D"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
Expand Down Expand Up @@ -699,7 +700,7 @@ TopFrame::TopFrame(wxWindow* parent, wxWindowID id, const wxString& title, const
m_hiddenMode1->SetValue(true);
m_hiddenMode2->SetValue(true);

sbSizer_mode->SetMinSize(wxSize(175,225));
sbSizer_mode->SetMinSize(wxSize(75,225));
otherModeWin->SetSizer(otherModeSizer);
otherModeSizer->SetSizeHints(otherModeWin);

Expand All @@ -709,7 +710,7 @@ TopFrame::TopFrame(wxWindow* parent, wxWindowID id, const wxString& title, const
// Control Toggles box
//=====================================================
wxStaticBoxSizer* sbSizer5;
wxStaticBox* controlBox = new wxStaticBox(m_panel, wxID_ANY, _("Control"), wxDefaultPosition, wxSize(150,-1));
wxStaticBox* controlBox = new wxStaticBox(m_panel, wxID_ANY, _("Control"), wxDefaultPosition, wxSize(100,-1));
sbSizer5 = new wxStaticBoxSizer(controlBox, wxVERTICAL);
wxBoxSizer* bSizer1511;
bSizer1511 = new wxBoxSizer(wxVERTICAL);
Expand Down Expand Up @@ -755,18 +756,18 @@ TopFrame::TopFrame(wxWindow* parent, wxWindowID id, const wxString& title, const
rightSizer->Add(sbSizer5, 2, wxALL|wxEXPAND, 2);

// Frequency text field (PSK Reporter)
m_freqBox = new wxStaticBox(m_panel, wxID_ANY, _("Report Frequency"));
m_freqBox = new wxStaticBox(m_panel, wxID_ANY, _("Report Freq. (MHz)"), wxDefaultPosition, wxSize(100,-1));
wxBoxSizer* reportFrequencySizer = new wxStaticBoxSizer(m_freqBox, wxHORIZONTAL);

wxStaticText* reportFrequencyUnits = new wxStaticText(m_freqBox, wxID_ANY, wxT(" MHz"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
//wxStaticText* reportFrequencyUnits = new wxStaticText(m_freqBox, wxID_ANY, wxT(" MHz"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
wxBoxSizer* txtReportFreqSizer = new wxBoxSizer(wxVERTICAL);

m_cboReportFrequency = new wxComboBox(m_freqBox, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_DROPDOWN | wxTE_PROCESS_ENTER);
m_cboReportFrequency->SetMinSize(wxSize(150,-1));
txtReportFreqSizer->Add(m_cboReportFrequency, 1, wxALL, 5);

reportFrequencySizer->Add(txtReportFreqSizer, 1, wxEXPAND, 1);
reportFrequencySizer->Add(reportFrequencyUnits, 0, wxALIGN_CENTER_VERTICAL, 1);
//reportFrequencySizer->Add(reportFrequencyUnits, 0, wxALIGN_CENTER_VERTICAL, 1);

rightSizer->Add(reportFrequencySizer, 0, wxALL, 2);

Expand All @@ -776,7 +777,7 @@ TopFrame::TopFrame(wxWindow* parent, wxWindowID id, const wxString& title, const
this->Layout();

m_statusBar1 = this->CreateStatusBar(1, wxSTB_DEFAULT_STYLE, wxID_ANY);

//=====================================================
// End of layout
//=====================================================
Expand Down

0 comments on commit e7847a1

Please sign in to comment.