示例#1
0
void MyStatusBar::DoToggle()
{
#if wxUSE_CHECKBOX
    if ( m_checkbox->GetValue() )
    {
#if wxUSE_TIMER
        m_timer.Start(1000);
#endif

        m_statbmp->SetIcon(wxIcon(green_xpm));

        UpdateClock();
    }
    else // don't show clock
    {
#if wxUSE_TIMER
        m_timer.Stop();
#endif

        m_statbmp->SetIcon(wxIcon(red_xpm));

        SetStatusText(wxEmptyString, Field_Clock);
    }
#endif // wxUSE_CHECKBOX
}
示例#2
0
void MyFrame::OnRun(wxCommandEvent &event) {
    ostringstream stream;

    text->Clear();

    unique_ptr<eph::nominate_abstract> nsl;

    switch (methods->GetCurrentSelection()) {
        case 0:
            nsl = make_unique<eph::nominate_pal>(stream, lines);
            break;
        case 1:
            nsl = make_unique<eph::nominate_sdv_lpe>(stream, lines);
            break;
        case 2:
            nsl = make_unique<eph::nominate_sdv_lpe>(stream, lines, eph::ENABLE_SL::YES);
            break;
    }

    auto result = nsl->nominate(finalists->GetCurrentSelection()+1, noms_per_ballot->GetCurrentSelection()+1);

    if (verbose->GetValue()) {
        text->AppendText(stream.str());
    }
    text->AppendText(result);
}
示例#3
0
文件: exportd.cpp 项目: simedcn/fityk
void DataExportDlg::on_widget_change()
{
    wxString s = (only_a_cb->GetValue() ? wxT("if a: ") : wxT("all: "));
    for (size_t i = 0; i < list->GetCount(); ++i) {
        if (list->IsChecked(i)) {
            if (!s.EndsWith(wxT(": ")) && !cv[i].empty())
                    s += wxT(", ");
            s += cv[i];
        }
    }
    text->ChangeValue(s);
    FindWindow(wxID_OK)->Enable(true);
}
示例#4
0
	bool reset_user_profile() const { return cbox_reset != nullptr ? cbox_reset->GetValue() : false; }
示例#5
0
void App::OnFolderChanged(wxFileCtrlEvent& event)
{
    if (!dir_cb->GetValue())
        dirpicker->SetPath(event.GetDirectory());
}
示例#6
0
void App::OnConvert(wxCommandEvent&)
{
    bool with_header = header->GetValue();
    int block_nr = browser->block_ch->GetSelection();
    int idx_x = browser->x_column->GetValue();
    int idx_y = browser->y_column->GetValue();
    bool has_err = browser->std_dev_cb->GetValue();
    int idx_err = browser->s_column->GetValue();
    bool dec_comma = browser->comma_cb->GetValue();

    wxArrayString paths;
    browser->filectrl->GetPaths(paths);
    string options;
    if (dec_comma)
        options = "decimal-comma";

    for (size_t i = 0; i < paths.GetCount(); ++i) {
        wxFileName old_filename(paths[i]);
        wxString fn = old_filename.GetName() + "." + ext_tc->GetValue();
        wxString new_filename = dirpicker->GetPath() + wxFILE_SEP_PATH + fn;
        if (!overwrite->GetValue() && wxFileExists(new_filename)) {
            int answer = wxMessageBox("File " + fn + " exists.\n"
                                      "Overwrite?",
                                      "Overwrite?",
                                      wxYES|wxNO|wxCANCEL|wxICON_QUESTION);
            if (answer == wxCANCEL)
                break;
            if (answer != wxYES)
                continue;

        }
        FILE *f = fopen(new_filename.mb_str(), "w");
        try {
            wxBusyCursor wait;
            xylib::DataSet const *ds = xylib::load_file(wx2s(paths[i]),
                                            browser->get_filetype(), options);
            xylib::Block const *block = ds->get_block(block_nr);
            xylib::Column const& xcol = block->get_column(idx_x);
            xylib::Column const& ycol = block->get_column(idx_y);
            xylib::Column const* ecol = (has_err ? &block->get_column(idx_err)
                                                 : NULL);
            const int np = block->get_point_count();

            if (with_header) {
                fprintf(f, "# converted by xyConvert %s from file:\n# %s\n",
                        xylib_get_version(),
                        wx2s(new_filename).c_str());
                if (ds->get_block_count() > 1)
                    fprintf(f, "# (block %d) %s\n", block_nr,
                                                    block->get_name().c_str());
                if (block->get_column_count() > 2) {
                    string xname = (xcol.get_name().empty() ? string("x")
                                                            : xcol.get_name());
                    string yname = (ycol.get_name().empty() ? string("y")
                                                            : ycol.get_name());
                    fprintf(f, "#%s\t%s", xname.c_str(), yname.c_str());
                    if (has_err) {
                        string ename = (ecol->get_name().empty() ? string("err")
                                                            : ecol->get_name());
                        fprintf(f, "\t%s", ename.c_str());
                    }
                    fprintf(f, "\n");
                }
            }

            for (int j = 0; j < np; ++j) {
                fprintf(f, "%.9g\t%.9g", xcol.get_value(j), ycol.get_value(j));
                if (has_err)
                    fprintf(f, "\t%.9g", ecol->get_value(j));
                fprintf(f, "\n");
            }
        } catch (runtime_error const& e) {
            wxMessageBox(e.what(), "Error", wxCANCEL|wxICON_ERROR);
        }
        fclose(f);
    }
}