int types(void) { int n = 0; char *type, *desc; printf("Disk image types supported:\n\n"); while (!dsk_type_enum(n, &type)) { dsk_typedesc_enum(n++, &desc); printf(" %-10.10s : %s\n", type, desc); } return 0; }
STDMETHODIMP CLibrary::type_enum(long idx, BSTR *name, BOOL *valid) { dsk_err_t err; char *opt; err = dsk_type_enum(idx, &opt); switch(err) { case DSK_ERR_OK: *valid = true; *name = ret_string(opt); break; case DSK_ERR_NODRVR: *valid = false; break; default: return MapError(err); } return S_OK; }
DriveSelectPage::DriveSelectPage(PageType pt, wxWizard* parent, wxWizardPage* prev, wxWizardPage* next, const wxBitmap&bitmap) : m_pageType(pt), wxWizardPageSimple(parent, prev, next, bitmap) { intptr_t idx; dsk_err_t err; char *drvname = NULL; char *compname = NULL; const char *formname = NULL; const char *formdesc = NULL; m_typebuf = NULL; m_compbuf = NULL; m_doubleStep = false; m_forceHead = -1; m_retries = wxT("1"); switch(m_pageType) { case PT_READ: (void)new wxStaticText(this, -1, wxT("Drive / Disc image to READ:"), wxPoint(5, 5)); break; case PT_WRITE: (void)new wxStaticText(this, -1, wxT("Drive / Disc image to WRITE:"), wxPoint(5, 5)); break; default: (void)new wxStaticText(this, -1, wxT("Select drive / disc image:"), wxPoint(5, 5)); break; } (void)new wxStaticText(this, -1, wxT("Drive / file type:"), wxPoint(5, 55)); (void)new wxStaticText(this, -1, wxT("Compression:"), wxPoint(5, 105)); if (m_pageType == PT_FORMAT) { (void)new wxStaticText(this, -1, wxT("Use format:"), wxPoint(5, 155)); } else if (m_pageType != PT_WRITE) { (void)new wxStaticText(this, -1, wxT("Override format:"), wxPoint(5, 155)); } (void)new wxStaticBox(this, -1, wxT("Floppy drive options"), wxPoint(5, 205), wxSize(330, 50)); m_drivebox = new wxComboBox(this, COMBO_NAME, wxT(""), wxPoint(10, 25), wxSize(200, 20), 2, choices, wxCB_DROPDOWN); m_browse = new wxButton (this, BTN_BROWSE, wxT("Browse"), wxPoint(220, 22), wxSize(70, 30)); m_serial = new wxButton (this, BTN_SERIAL, wxT("Serial"), wxPoint(292, 22), wxSize(70, 30)); m_typebox = new wxComboBox(this, -1, wxT(""), wxPoint(10, 75), wxSize(200, 20), 0, NULL, wxCB_READONLY); m_compbox = new wxComboBox(this, -1, wxT(""), wxPoint(10, 125), wxSize(200, 20), 0, NULL, wxCB_READONLY); m_formbox = new wxComboBox(this, -1, wxT(""), wxPoint(10, 175), wxSize(200, 20), 0, NULL, wxCB_READONLY); m_head = new wxComboBox(this, -1, wxT(""), wxPoint(10, 225), wxSize(100,20), 3, choice2, wxCB_READONLY); m_dstep = new wxCheckBox(this, -1, wxT("Double-step"), wxPoint(120, 225), wxSize(100,20)); m_retrybox = new wxTextCtrl(this, -1, m_retries, wxPoint(225, 223), wxSize(40, 24), 0, wxTextValidator(wxFILTER_NUMERIC, &m_retries)); (void)new wxStaticText(this, -1, wxT("retries"), wxPoint(267,225)); m_head->SetSelection(0); switch (m_pageType) { case PT_FORMAT: m_format = FMT_720K; break; case PT_WRITE: m_format = FMT_UNKNOWN; m_formbox->Show(false); m_formbox->Enable(false); break; case PT_READ: case PT_IDENTIFY: m_formbox->Append(wxT("Auto detect"), (void *)(int)FMT_UNKNOWN); m_formbox->SetSelection(0); m_format = FMT_UNKNOWN; break; } if (m_pageType == PT_READ || m_pageType == PT_IDENTIFY) { m_typebox->Append(wxT("Auto detect"), (void *)NULL); m_typebox->SetSelection(0); m_compbox->Append(wxT("Auto detect"), (void *)NULL); m_compbox->SetSelection(0); m_type = wxT(""); m_compress = wxT(""); } else { m_compbox->Append(wxT("No compression"), (void *)NULL); m_compbox->SetSelection(0); m_compress = wxT(""); } idx = 0; do { dsk_type_enum(idx++, &drvname); if (drvname) { m_typebox->Append(wxString(drvname, wxConvUTF8), drvname); } } while (drvname); idx = 0; do { dsk_comp_enum(idx++, &compname); if (compname) { m_compbox->Append(wxString(compname, wxConvUTF8), compname); } } while (compname); idx = 0; do { err = dg_stdformat(NULL, (dsk_format_t)idx, &formname, &formdesc); if (err == DSK_ERR_OK) { m_formbox->Append(wxString(formdesc, wxConvUTF8), (void *)idx); } ++idx; } while (err == DSK_ERR_OK); if (m_pageType == PT_FORMAT) { m_formbox->SetSelection((int)m_format); } if (m_pageType == PT_FORMAT || m_pageType == PT_WRITE) { int pos = m_typebox->FindString(wxT("dsk")); if (pos != -1) { m_typebox->SetSelection(pos); } m_type = wxT("dsk"); } }