void MockBLE::clearParsingSetups(String stringToClear, char charArrayToClear[]){ for (int i=0; i<CHARS_TO_READ; i++){ charArrayToClear[i] = 1; TestEmpty ("clear parsing--array", charArrayToClear[i]); } stringToClear= ""; TestEmpty ("clear parsing--String", stringToClear); }
void EkstraktorMainWindow::onDeleteParams(wxCommandEvent &event) { int i; if ((i = parametersList->GetSelection()) > -1) { parlist->Remove(i); parametersList->Delete(i); parametersList->SetSelection(wxMin( (unsigned int) i, parametersList->GetCount())); TestEmpty(); } }
/** * conduct automated self test for this class * * @param * @return */ int _TestDeque::Test() { /* the old deque should have failed a bunch of these tests */ int results=0; results+=OriginalTest(); results+=OriginalFlaw(); results+=AssignFlaw(); results+=TestRemove(); results+=TestPushFront(); results+=TestEmpty(); return results; }
void EkstraktorMainWindow::onAddParams(szParSelectEvent &event) { const ArrayOfTParam *params = event.GetParams(); int n = params->Count(); for (int i = 0; i < n; i++) { parametersList->Append(wxString(params->Item(i)->GetName())); parlist->Append(params->Item(i)); } if (n == 1) { SetStatusText(wxString(_("Added parameter: ")) + wxString(params->Item(0)->GetName())); } else { SetStatusText(wxString::Format(_("Added parameters: %d"), n)); } TestEmpty(); }
void EkstraktorMainWindow::onReadParamListFromFile(wxCommandEvent &event) { int i, j; szParList *old = new szParList(*parlist); i = parlist->LoadFile(); if (i <= 0) { delete old; return; } if ((i > 0) && (parlist->Unbinded() > 0)) { if (wxMessageBox( _("Loaded list contains parameters from other configuration.\nSelect Ok to remove these parameters from list\nor Cancel to abort loading."), _("Incorrect parameters"), wxOK | wxCANCEL) == wxOK) { parlist->RemoveUnbinded(); SetStatusText(wxString::Format(_("Loaded %d parameters"), parlist->Count())); delete old; } else { delete parlist; parlist = old; SetStatusText(_("Loading of parameters list canceled")); } } for (i = 0, j = 0; i < (int)parlist->Count(); i++) { if (!parlist->GetParam(i)->IsReadable()) { parlist->Remove(i); j++; i--; } } if (j > 0) { wxMessageBox(_("Loaded list contains parameters not existing in base.\nThese parameters will be removed from list."), _("Incorrect parameters"), wxOK); } parlist->FillListBox(parametersList); TestEmpty(); }
EkstraktorMainWindow::EkstraktorMainWindow(EkstraktorWidget *widget, const wxPoint pos, const wxSize size): wxFrame(NULL, -1, EKSTRAKTOR_TITLEBAR, pos, size, // the wxRESIZE_BORDER option turned off wxDEFAULT_FRAME_STYLE - wxRESIZE_BORDER ) { selectedValueType = SzbExtractor::TYPE_AVERAGE; mainWidget = widget; mainWidget->SetProbeType(PT_MIN10); progressDialog = NULL; exSetDefFont(this); wxImage::AddHandler(new wxPNGHandler); CreateMenu(); CreateStatusBar(); exSetDefFont(GetMenuBar()); /* * Extractor main window: * It's gonna look as follows: +-----------------------------------------------sizer1---------------------------+ |+-sizer1_1-------------------------------------------++-sizer1_2---------------+| ||+-sizer1_1_1_1---------------++-sizer1_1_1_2-------+|| *separatorChooser || |||*firstDatabaseText || ||| || |||*startDateText *wxString || *setStartDateBtn ||+ ---------------------- +| |||*lastDatabaseText || ||| *typeOfAvarege || |||*stopDateText || *setStopDateBtn ||| || ||+------------------------------+| ||| || || *parameterListText || ||| || || *parameterListWidget || ||| || || |+-------------------------------++------------------+ +------------------------+| | *chooseParamsBtn *writeToDiskBtn | +--------------------------------------------------------------------------------+ */ selectedPeriod = PT_MIN10; selectedSeparator = COMMA; wxPanel* panel = new wxPanel(this); // Building begin/end date section firstDatabaseText = new wxStaticText(panel, -1, wxString(FIRST_DATE_STR) + wxString(_T("YYYY-MM-DD HH:MM:SS")), wxDefaultPosition, wxDefaultSize); exSetDefFont(firstDatabaseText); lastDatabaseText = new wxStaticText(panel, -1, wxString(LAST_DATE_STR) + wxString(_T("YYYY-MM-DD HH:MM:SS")) , wxDefaultPosition, wxDefaultSize); exSetDefFont(lastDatabaseText); startDateText = new wxStaticText(panel, -1, wxString(START_DATE_STR) + wxString(_T("YYYY-MM-DD HH:MM:SS")), wxDefaultPosition, wxDefaultSize); stopDateText = new wxStaticText(panel, -1, wxString(STOP_DATE_STR) + wxString(_T("YYYY-MM-DD HH:MM:SS")), wxDefaultPosition, wxDefaultSize); setStartDateBtn = new wxButton(panel, ID_ChangeStartDate, _("Change start date"), //wxPoint(15, 2), wxDefaultSize, 0, wxDefaultValidator, _T("")); wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("")); setStartDateBtn->SetToolTip(_("Set beginning of result data period")); setStopDateBtn = new wxButton(panel, ID_ChangeStopDate, _("Change stop date"), //wxPoint(30, 2), wxDefaultSize, 0, wxDefaultValidator, _T("")); wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("")); setStopDateBtn->SetToolTip(_("Set end of result data period")); wxStaticBoxSizer *separator_box_sizer = new wxStaticBoxSizer(wxVERTICAL, panel, _("Decimal Separator:")); wxStaticBox *static_box = separator_box_sizer->GetStaticBox(); static_box->SetToolTip(_("Toggles between dot/comma and comma/semicolon decimal/field separator")); separator_box_sizer->Add(new wxRadioButton(panel, ID_CommaSeparator, _(", (colon)"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP), 0, wxEXPAND | wxRIGHT, 40); separator_box_sizer->Add(new wxRadioButton(panel, ID_DotSeparator, _(". (dot)")), 0, wxEXPAND | wxRIGHT, 40); minimize = new wxCheckBox( panel, ID_Minimize, _("Minimize output")); minimize->SetToolTip(_("Turns off printing of empty result lines")); minimize->SetValue(true); wxStaticBoxSizer *period_box_sizer = new wxStaticBoxSizer(wxVERTICAL, panel, _("Period:")); static_box = period_box_sizer->GetStaticBox(); static_box->SetToolTip(_("Sets type of result data")); if (widget->IsProberConfigured()) { period_box_sizer->Add(new wxRadioButton(panel, ID_Sec10Period, _("10 SECONDS"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP), 0, wxEXPAND | wxRIGHT, 20); period_box_sizer->Add(new wxRadioButton(panel, ID_Min10Period, _("10 MINUTES"), wxDefaultPosition, wxDefaultSize), 0, wxEXPAND | wxRIGHT, 20); } else period_box_sizer->Add(new wxRadioButton(panel, ID_Min10Period, _("10 MINUTES"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP), 0, wxEXPAND | wxRIGHT, 20); period_box_sizer->Add(new wxRadioButton(panel, ID_HourPeriod, _("HOUR")), 0, wxEXPAND | wxRIGHT, 20); period_box_sizer->Add(new wxRadioButton(panel, ID_8HourPeriod, _("8 HOURS")), 0, wxEXPAND | wxRIGHT, 20); period_box_sizer->Add(new wxRadioButton(panel, ID_DayPeriod, _("DAY")), 0, wxEXPAND | wxRIGHT, 20); period_box_sizer->Add(new wxRadioButton(panel, ID_WeekPeriod, _("WEEK")), 0, wxEXPAND | wxRIGHT, 20); period_box_sizer->Add(new wxRadioButton(panel, ID_MonthPeriod, _("MONTH")), 0, wxEXPAND | wxRIGHT, 20); wxStaticBoxSizer *value_type_box_sizer = new wxStaticBoxSizer(wxVERTICAL, panel, _("Values type:")); value_type_box_sizer->Add(new wxRadioButton(panel, ID_Average, _("Average"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP), 0, wxEXPAND | wxRIGHT, 20); value_type_box_sizer->Add(new wxRadioButton(panel, ID_End, _("Counter")), 0, wxEXPAND | wxRIGHT, 20); sizer_top = new wxBoxSizer(wxVERTICAL); sizer1 = new wxBoxSizer(wxHORIZONTAL); sizer2 = new wxBoxSizer(wxHORIZONTAL); sizer1_1 = new wxBoxSizer(wxVERTICAL); sizer1_2 = new wxBoxSizer(wxVERTICAL); sizer1_1_1 = new wxBoxSizer(wxHORIZONTAL); sizer1_1_1_1 = new wxBoxSizer(wxVERTICAL); sizer1_1_1_2 = new wxBoxSizer(wxVERTICAL); sizer1_1_1_1->Add(firstDatabaseText, 0, wxTOP | wxLEFT | wxEXPAND, 5); sizer1_1_1_1->Add(startDateText, 0, wxLEFT | wxEXPAND, 5); sizer1_1_1_1->Add(lastDatabaseText, 0, wxLEFT | wxEXPAND, 5); sizer1_1_1_1->Add(stopDateText, 0, wxLEFT | wxEXPAND, 5); sizer1_1_1_2->Add(setStartDateBtn, 0, wxALL | wxEXPAND, 5); sizer1_1_1_2->Add(setStopDateBtn, 0, wxALL | wxEXPAND, 5); sizer1_1_1->Add(sizer1_1_1_1, 0, 0, 0); sizer1_1_1->Add(sizer1_1_1_2, 0, 0, 0); sizer1_1->Add(sizer1_1_1, 0, wxBOTTOM, 10); sizer1_2->Add(separator_box_sizer, 0, wxALL, 5); sizer1_2->Add(minimize, 0, wxALL, 5); sizer1_2->Add(period_box_sizer, 0, wxALL, 5); sizer1_2->Add(value_type_box_sizer, 0, wxALL, 5); sizer1_1->Add(new wxStaticText(panel, -1, _("Parameters to be extracted:"), wxDefaultPosition, wxDefaultSize), 0, wxALL, 5); parametersList = new wxListBox(panel, -1, wxDefaultPosition, wxSize(400,200), 0, NULL, wxLB_NEEDED_SB|wxLB_SINGLE); sizer1_1->Add(parametersList, 1, wxALL | wxEXPAND, 5); wxButton* add_bt = new wxButton(panel, ID_AddParametersBt, _("Add parameter")); add_bt->SetToolTip(_("Shows dialog to select parameters")); sizer2->Add(add_bt, 1, wxALL | wxEXPAND, 10); del_par_bt = new wxButton(panel, ID_DeleteParametersBt, _("Delete parameter")); del_par_bt->SetToolTip(_("Removes currently selected parameter from list")); sizer2->Add(del_par_bt, 1, wxALL | wxEXPAND, 10); write_bt = new wxButton(panel, ID_WriteResultsBt, _("Write results to file")); write_bt->SetToolTip(_("Opens dialog for selecting result file")); sizer2->Add(write_bt, 1, wxALL | wxEXPAND, 10); sizer1->Add(sizer1_1, 1, wxALL | wxEXPAND, 0); sizer1->Add(sizer1_2, 0, wxALL, 0); sizer_top->Add(sizer1, 1, wxALL | wxEXPAND, 0); sizer_top->Add(sizer2, 0, wxALL | wxEXPAND, 0); panel->SetSizer(sizer_top); sizer_top->SetSizeHints(this); m_help = new szHelpController; #ifndef MINGW32 m_help->AddBook(dynamic_cast<szAppConfig*>(wxTheApp)->GetSzarpDir() + L"/resources/documentation/new/ekstraktor3/html/ekstraktor3.hhp"); #else m_help->AddBook(dynamic_cast<szAppConfig*>(wxTheApp)->GetSzarpDir() + L"\\resources\\documentation\\new\\ekstraktor3\\html\\ekstraktor3.hhp"); #endif szHelpControllerHelpProvider* m_provider = new szHelpControllerHelpProvider; wxHelpProvider::Set(m_provider); m_provider->SetHelpController(m_help); setStartDateBtn->SetHelpText(_T("ekstraktor3-base-date")); setStopDateBtn->SetHelpText(_T("ekstraktor3-base-date")); add_bt->SetHelpText(_T("ekstraktor3-base-select")); del_par_bt->SetHelpText(_T("ekstraktor3-base-select")); write_bt->SetHelpText(_T("ekstraktor3-base-write")); minimize->SetHelpText(_T("ekstraktor3-ext-mini")); ps = new szParSelect(mainWidget->GetIpk(), this, ID_ParSelectDlg, _("Choose parameter"), TRUE, TRUE, TRUE, TRUE,FALSE, readable_filter); ps->SetHelp(_T("ekstraktor3-base-select")); parlist = new szParList(); parlist->RegisterIPK(mainWidget->GetIpk()); wxIcon icon(wxICON(extr64)); if (icon.Ok()) SetIcon(icon); TestEmpty(); dynamic_cast<wxRadioButton*>(FindWindowById(ID_Min10Period))->SetValue(true); Show( TRUE ); }