Truncate based on button size, not 'Voice Keyer' label.
parent
12322d1e05
commit
b70eac9c6a
34
src/main.cpp
34
src/main.cpp
|
@ -567,23 +567,6 @@ setDefaultMode:
|
|||
|
||||
// Show/hide frequency box based on reporting enablement
|
||||
m_freqBox->Show(wxGetApp().appConfiguration.reportingConfiguration.reportingEnabled);
|
||||
|
||||
// Load default voice keyer file as current.
|
||||
if (wxGetApp().appConfiguration.voiceKeyerWaveFile != "")
|
||||
{
|
||||
wxFileName fullVKPath(wxGetApp().appConfiguration.voiceKeyerWaveFilePath, wxGetApp().appConfiguration.voiceKeyerWaveFile);
|
||||
vkFileName_ = fullVKPath.GetFullPath().mb_str();
|
||||
|
||||
m_togBtnVoiceKeyer->SetToolTip(_("Toggle Voice Keyer using file ") + wxGetApp().appConfiguration.voiceKeyerWaveFile + _(". Right-click for additional options."));
|
||||
|
||||
wxString fileNameWithoutExt;
|
||||
wxFileName::SplitPath(wxGetApp().appConfiguration.voiceKeyerWaveFile, nullptr, &fileNameWithoutExt, nullptr);
|
||||
setVoiceKeyerButtonLabel_(fileNameWithoutExt);
|
||||
}
|
||||
else
|
||||
{
|
||||
vkFileName_ = "";
|
||||
}
|
||||
|
||||
// Show/hide callsign combo box based on reporting enablement
|
||||
if (wxGetApp().appConfiguration.reportingConfiguration.reportingEnabled)
|
||||
|
@ -620,6 +603,23 @@ setDefaultMode:
|
|||
m_panel->SetSizerAndFit(currentSizer, false);
|
||||
m_panel->Layout();
|
||||
|
||||
// Load default voice keyer file as current.
|
||||
if (wxGetApp().appConfiguration.voiceKeyerWaveFile != "")
|
||||
{
|
||||
wxFileName fullVKPath(wxGetApp().appConfiguration.voiceKeyerWaveFilePath, wxGetApp().appConfiguration.voiceKeyerWaveFile);
|
||||
vkFileName_ = fullVKPath.GetFullPath().mb_str();
|
||||
|
||||
m_togBtnVoiceKeyer->SetToolTip(_("Toggle Voice Keyer using file ") + wxGetApp().appConfiguration.voiceKeyerWaveFile + _(". Right-click for additional options."));
|
||||
|
||||
wxString fileNameWithoutExt;
|
||||
wxFileName::SplitPath(wxGetApp().appConfiguration.voiceKeyerWaveFile, nullptr, &fileNameWithoutExt, nullptr);
|
||||
setVoiceKeyerButtonLabel_(fileNameWithoutExt);
|
||||
}
|
||||
else
|
||||
{
|
||||
vkFileName_ = "";
|
||||
}
|
||||
|
||||
if (wxGetApp().appConfiguration.experimentalFeatures && wxGetApp().appConfiguration.tabLayout != "")
|
||||
{
|
||||
((TabFreeAuiNotebook*)m_auiNbookCtrl)->LoadPerspective(wxGetApp().appConfiguration.tabLayout);
|
||||
|
|
|
@ -716,46 +716,34 @@ TopFrame::TopFrame(wxWindow* parent, wxWindowID id, const wxString& title, const
|
|||
wxStaticBoxSizer* sbSizer5;
|
||||
wxStaticBox* controlBox = new wxStaticBox(m_panel, wxID_ANY, _("Control"), wxDefaultPosition, wxSize(100,-1));
|
||||
sbSizer5 = new wxStaticBoxSizer(controlBox, wxVERTICAL);
|
||||
wxBoxSizer* bSizer1511;
|
||||
bSizer1511 = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
//-------------------------------
|
||||
// Stop/Stop signal processing (rx and tx)
|
||||
//-------------------------------
|
||||
m_togBtnOnOff = new wxToggleButton(controlBox, wxID_ANY, _("&Start"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
m_togBtnOnOff->SetToolTip(_("Begin/End receiving data."));
|
||||
bSizer1511->Add(m_togBtnOnOff, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 2);
|
||||
sbSizer5->Add(bSizer1511, 0, wxTOP | wxLEFT | wxRIGHT | wxEXPAND, 1);
|
||||
|
||||
wxBoxSizer* bSizer13;
|
||||
bSizer13 = new wxBoxSizer(wxVERTICAL);
|
||||
sbSizer5->Add(m_togBtnOnOff, 0, wxALL | wxEXPAND, 1);
|
||||
|
||||
//------------------------------
|
||||
// Analog Passthrough Toggle
|
||||
//------------------------------
|
||||
m_togBtnAnalog = new wxToggleButton(controlBox, wxID_ANY, _("A&nalog"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
m_togBtnAnalog->SetToolTip(_("Toggle analog/digital operation."));
|
||||
bSizer13->Add(m_togBtnAnalog, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 2);
|
||||
sbSizer5->Add(bSizer13, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 1);
|
||||
sbSizer5->Add(m_togBtnAnalog, 0, wxALL | wxEXPAND, 1);
|
||||
|
||||
//------------------------------
|
||||
// Voice Keyer Toggle
|
||||
//------------------------------
|
||||
m_togBtnVoiceKeyer = new wxToggleButton(controlBox, wxID_ANY, _("Voice &Keyer"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
m_togBtnVoiceKeyer->SetToolTip(_("Toggle Voice Keyer. Right-click for additional options."));
|
||||
wxBoxSizer* bSizer13a = new wxBoxSizer(wxVERTICAL);
|
||||
bSizer13a->Add(m_togBtnVoiceKeyer, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 2);
|
||||
sbSizer5->Add(bSizer13a, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 1);
|
||||
sbSizer5->Add(m_togBtnVoiceKeyer, 0, wxALL | wxEXPAND, 1);
|
||||
|
||||
//------------------------------
|
||||
// PTT button: Toggle Transmit/Receive mode
|
||||
//------------------------------
|
||||
wxBoxSizer* bSizer11;
|
||||
bSizer11 = new wxBoxSizer(wxVERTICAL);
|
||||
m_btnTogPTT = new wxToggleButton(controlBox, wxID_ANY, _("&PTT"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
m_btnTogPTT->SetToolTip(_("Push to Talk - Switch between Receive and Transmit. Right-click for additional options."));
|
||||
bSizer11->Add(m_btnTogPTT, 1, wxALIGN_CENTER|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 2);
|
||||
sbSizer5->Add(bSizer11, 0, wxBOTTOM | wxLEFT | wxRIGHT | wxEXPAND, 1);
|
||||
sbSizer5->Add(m_btnTogPTT, 0, wxALL | wxEXPAND, 1);
|
||||
|
||||
rightSizer->Add(sbSizer5, 2, wxALL|wxEXPAND, 2);
|
||||
|
||||
|
@ -991,10 +979,11 @@ void TopFrame::setVoiceKeyerButtonLabel_(wxString filename)
|
|||
int filenameWidth = 0;
|
||||
int tmp = 0;
|
||||
|
||||
m_togBtnVoiceKeyer->GetTextExtent(vkLabel, &vkLabelWidth, &tmp);
|
||||
wxSize buttonSize = m_togBtnVoiceKeyer->GetSize();
|
||||
vkLabelWidth = buttonSize.GetWidth() * 0.95;
|
||||
m_togBtnVoiceKeyer->GetTextExtent(filename, &filenameWidth, &tmp);
|
||||
|
||||
fprintf(stderr, "vkLabelSize = %d, filenameSize = %d\n", vkLabelWidth, filenameWidth);
|
||||
//fprintf(stderr, "vkLabelSize = %d, filenameSize = %d\n", vkLabelWidth, filenameWidth);
|
||||
|
||||
// Truncate filename as required to ensure button isn't made wider than needed.
|
||||
bool isTruncated = false;
|
||||
|
|
Loading…
Reference in New Issue