- exclude devices without a prefix in the advanced log options dialog

This commit is contained in:
Volker Ruppert 2006-10-21 15:36:07 +00:00
parent 8312d149eb
commit 04d0b0a892

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// $Id: wxdialog.cc,v 1.100 2006-05-30 17:41:43 vruppert Exp $ // $Id: wxdialog.cc,v 1.101 2006-10-21 15:36:07 vruppert Exp $
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// Define BX_PLUGGABLE in files that can be compiled into plugins. For // Define BX_PLUGGABLE in files that can be compiled into plugins. For
@ -130,7 +130,7 @@ void LogMsgAskDialog::Init()
} }
// Event handler for dialog buttons. Just translate the wx ids into // Event handler for dialog buttons. Just translate the wx ids into
// enum values and return them with EndModel() to make the dialog // enum values and return them with EndModal() to make the dialog
// go away. // go away.
void LogMsgAskDialog::OnEvent(wxCommandEvent& event) void LogMsgAskDialog::OnEvent(wxCommandEvent& event)
{ {
@ -469,13 +469,17 @@ AdvancedLogOptionsDialog::AdvancedLogOptionsDialog(
int devmax = SIM->get_n_log_modules(); int devmax = SIM->get_n_log_modules();
action = new wxChoice** [devmax]; // array of pointers action = new wxChoice** [devmax]; // array of pointers
for (int dev=0; dev<devmax; dev++) { for (int dev=0; dev<devmax; dev++) {
action[dev] = new wxChoice* [ADVLOG_OPTS_N_TYPES]; if (strcmp(SIM->get_prefix(dev), "[ ]")) {
// name of device in first column action[dev] = new wxChoice* [ADVLOG_OPTS_N_TYPES];
gridSizer->Add(new wxStaticText(scrollPanel, -1, wxString(SIM->get_prefix(dev), wxConvUTF8))); // name of device in first column
// wxChoice in every other column gridSizer->Add(new wxStaticText(scrollPanel, -1, wxString(SIM->get_prefix(dev), wxConvUTF8)));
for (type=0; type < typemax; type++) { // wxChoice in every other column
action[dev][type] = makeLogOptionChoiceBox(scrollPanel, -1, type); for (type=0; type < typemax; type++) {
gridSizer->Add(action[dev][type], 1, wxALL|wxGROW|wxADJUST_MINSIZE, 2); action[dev][type] = makeLogOptionChoiceBox(scrollPanel, -1, type);
gridSizer->Add(action[dev][type], 1, wxALL|wxGROW|wxADJUST_MINSIZE, 2);
}
} else {
action[dev] = NULL;
} }
} }
headerSizer->Fit(this); headerSizer->Fit(this);
@ -565,6 +569,7 @@ void AdvancedLogOptionsDialog::CopyGuiToParam() {
} }
void AdvancedLogOptionsDialog::SetAction(int dev, int evtype, int act) { void AdvancedLogOptionsDialog::SetAction(int dev, int evtype, int act) {
if (action[dev] == NULL) return;
// find the choice whose client data matches "act". // find the choice whose client data matches "act".
int *ptr; int *ptr;
// wxLogDebug(wxT("SetAction dev=%d type=%d act=%d"), dev, evtype, act); // wxLogDebug(wxT("SetAction dev=%d type=%d act=%d"), dev, evtype, act);
@ -584,6 +589,7 @@ void AdvancedLogOptionsDialog::SetAction(int dev, int evtype, int act) {
} }
int AdvancedLogOptionsDialog::GetAction(int dev, int evtype) { int AdvancedLogOptionsDialog::GetAction(int dev, int evtype) {
if (action[dev] == NULL) return LOG_OPTS_NO_CHANGE;
int sel = action[dev][evtype]->GetSelection(); int sel = action[dev][evtype]->GetSelection();
int *ptrToChoice = (int*)action[dev][evtype]->GetClientData(sel); int *ptrToChoice = (int*)action[dev][evtype]->GetClientData(sel);
wxASSERT(ptrToChoice != NULL); wxASSERT(ptrToChoice != NULL);