Show/Hide modem properties when available
This commit is contained in:
parent
d14dfed063
commit
67edfab862
|
@ -96,6 +96,7 @@ AppFrame::AppFrame() :
|
||||||
|
|
||||||
modemPropertiesUpdated.store(false);
|
modemPropertiesUpdated.store(false);
|
||||||
modemProps = new ModemProperties(demodPanel, wxID_ANY);
|
modemProps = new ModemProperties(demodPanel, wxID_ANY);
|
||||||
|
modemProps->Hide();
|
||||||
demodTray->Add(modemProps, 15, wxEXPAND | wxALL, 0);
|
demodTray->Add(modemProps, 15, wxEXPAND | wxALL, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1052,6 +1053,7 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
|
||||||
if (modemPropertiesUpdated.load()) {
|
if (modemPropertiesUpdated.load()) {
|
||||||
modemProps->initProperties(newModemArgs);
|
modemProps->initProperties(newModemArgs);
|
||||||
modemPropertiesUpdated.store(false);
|
modemPropertiesUpdated.store(false);
|
||||||
|
demodTray->Layout();
|
||||||
}
|
}
|
||||||
// waterfallCanvas->processInputQueue();
|
// waterfallCanvas->processInputQueue();
|
||||||
// waterfallCanvas->Refresh();
|
// waterfallCanvas->Refresh();
|
||||||
|
|
|
@ -5,8 +5,6 @@ ModemProperties::ModemProperties(wxWindow *parent, wxWindowID winid,
|
||||||
const wxPoint& pos, const wxSize& size, long style, const wxString& name) : wxPanel(parent, winid, pos, size, style, name) {
|
const wxPoint& pos, const wxSize& size, long style, const wxString& name) : wxPanel(parent, winid, pos, size, style, name) {
|
||||||
|
|
||||||
m_propertyGrid = new wxPropertyGrid(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxPG_DEFAULT_STYLE);
|
m_propertyGrid = new wxPropertyGrid(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxPG_DEFAULT_STYLE);
|
||||||
|
|
||||||
wxBoxSizer* bSizer;
|
|
||||||
|
|
||||||
bSizer = new wxBoxSizer( wxVERTICAL );
|
bSizer = new wxBoxSizer( wxVERTICAL );
|
||||||
|
|
||||||
|
@ -15,6 +13,11 @@ ModemProperties::ModemProperties(wxWindow *parent, wxWindowID winid,
|
||||||
this->SetSizer(bSizer);
|
this->SetSizer(bSizer);
|
||||||
|
|
||||||
m_propertyGrid->Connect( wxEVT_PG_CHANGED, wxPropertyGridEventHandler( ModemProperties::OnChange ), NULL, this );
|
m_propertyGrid->Connect( wxEVT_PG_CHANGED, wxPropertyGridEventHandler( ModemProperties::OnChange ), NULL, this );
|
||||||
|
this->Connect( wxEVT_SHOW, wxShowEventHandler( ModemProperties::OnShow ), NULL, this );
|
||||||
|
}
|
||||||
|
|
||||||
|
void ModemProperties::OnShow(wxShowEvent &event) {
|
||||||
|
m_propertyGrid->FitColumns();
|
||||||
}
|
}
|
||||||
|
|
||||||
ModemProperties::~ModemProperties() {
|
ModemProperties::~ModemProperties() {
|
||||||
|
@ -23,8 +26,19 @@ ModemProperties::~ModemProperties() {
|
||||||
|
|
||||||
void ModemProperties::initProperties(ModemArgInfoList newArgs) {
|
void ModemProperties::initProperties(ModemArgInfoList newArgs) {
|
||||||
args = newArgs;
|
args = newArgs;
|
||||||
|
|
||||||
m_propertyGrid->Clear();
|
m_propertyGrid->Clear();
|
||||||
|
|
||||||
|
if (newArgs.size() == 0) {
|
||||||
|
Hide();
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
Show();
|
||||||
|
}
|
||||||
|
|
||||||
|
bSizer->Layout();
|
||||||
|
Layout();
|
||||||
|
|
||||||
m_propertyGrid->Append(new wxPropertyCategory("Modem Settings"));
|
m_propertyGrid->Append(new wxPropertyCategory("Modem Settings"));
|
||||||
|
|
||||||
ModemArgInfoList::const_iterator args_i;
|
ModemArgInfoList::const_iterator args_i;
|
||||||
|
@ -33,6 +47,8 @@ void ModemProperties::initProperties(ModemArgInfoList newArgs) {
|
||||||
ModemArgInfo arg = (*args_i);
|
ModemArgInfo arg = (*args_i);
|
||||||
props[arg.key] = addArgInfoProperty(m_propertyGrid, arg);
|
props[arg.key] = addArgInfoProperty(m_propertyGrid, arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_propertyGrid->FitColumns();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPGProperty *ModemProperties::addArgInfoProperty(wxPropertyGrid *pg, ModemArgInfo arg) {
|
wxPGProperty *ModemProperties::addArgInfoProperty(wxPropertyGrid *pg, ModemArgInfo arg) {
|
||||||
|
|
|
@ -25,7 +25,9 @@ private:
|
||||||
wxPGProperty *addArgInfoProperty(wxPropertyGrid *pg, ModemArgInfo arg);
|
wxPGProperty *addArgInfoProperty(wxPropertyGrid *pg, ModemArgInfo arg);
|
||||||
std::string readProperty(std::string);
|
std::string readProperty(std::string);
|
||||||
void OnChange(wxPropertyGridEvent &event);
|
void OnChange(wxPropertyGridEvent &event);
|
||||||
|
void OnShow(wxShowEvent &event);
|
||||||
|
|
||||||
|
wxBoxSizer* bSizer;
|
||||||
wxPropertyGrid* m_propertyGrid;
|
wxPropertyGrid* m_propertyGrid;
|
||||||
ModemArgInfoList args;
|
ModemArgInfoList args;
|
||||||
std::map<std::string, wxPGProperty *> props;
|
std::map<std::string, wxPGProperty *> props;
|
||||||
|
|
Loading…
Reference in New Issue