Diff for /np2/macos9/dialog/d_disk.cpp between versions 1.1 and 1.2

version 1.1, 2003/10/23 10:57:49 version 1.2, 2003/10/23 12:58:44
Line 1 Line 1
 #include        "compiler.h"  #include        "compiler.h"
 // #include     "strres.h"  #include        "strres.h"
 #include        "resource.h"  #include        "resource.h"
 // #include     "sysmng.h"  #include        "dosio.h"
 #include        "dialog.h"  #include        "dialog.h"
 #include        "dialogs.h"  #include        "dialogs.h"
 #include        "pccore.h"  #include        "pccore.h"
Line 35  void dialog_changehdd(BYTE drv) { Line 35  void dialog_changehdd(BYTE drv) {
   
 // ---- newdisk  // ---- newdisk
   
 #if 0  static const char str_newdisk[] = "newdisk.d88";
   
 static const char str_newdisk[] = "newdisk";  typedef struct {
 static const UINT32 hddsizetbl[5] = {20, 41, 65, 80, 128};          BYTE    fdtype;
           char    label[16+1];
 static  BYTE    makefdtype = DISKTYPE_2HD << 4;  } NEWDISK;
 static  char    disklabel[16+1];  
 static  UINT    hddsize;  static int NewHddDlgProc(UINT *hddsize) {
   
 static LRESULT CALLBACK NewHddDlgProc(HWND hWnd, UINT msg,          DialogPtr       hDlg;
                                                                                                         WPARAM wp, LPARAM lp) {          Str255          sizestr;
           int                     done;
         UINT    val;          short           item;
         char    work[32];          char            work[16];
   
         switch (msg) {          hDlg = GetNewDialog(IDD_NEWHDDDISK, NULL, (WindowPtr)-1);
                 case WM_INITDIALOG:          if (!hDlg) {
                         SETLISTUINT32(hWnd, IDC_HDDSIZE, hddsizetbl);                  return(0);
                         SetFocus(GetDlgItem(hWnd, IDC_HDDSIZE));          }
                         return(FALSE);  
           mkstr255(sizestr, "41");
                 case WM_COMMAND:          SetDialogItemText(GetDlgItem(hDlg, IDC_HDDSIZE), sizestr);
                         switch (LOWORD(wp)) {          SelectDialogItemText(hDlg, IDC_HDDSIZE, 0x0000, 0x7fff);
                                 case IDOK:          SetDialogDefaultItem(hDlg, IDOK);
                                         GetWindowText(GetDlgItem(hWnd, IDC_HDDSIZE),          SetDialogCancelItem(hDlg, IDCANCEL);
                                                                                                         work, sizeof(work));  
                                         val = (UINT)milstr_solveINT(work);          done = 0;
                                         if (val < 0) {          while(!done) {
                                                 val = 0;                  ModalDialog(NULL, &item);
                                         }                  switch(item) {
                                         else if (val > 512) {                          case IDOK:
                                                 val = 512;                                  GetDialogItemText(GetDlgItem(hDlg, IDC_HDDSIZE), sizestr);
                                         }                                  mkcstr(work, sizeof(work), sizestr);
                                         hddsize = val;                                  *hddsize = milstr_solveINT(work);
                                         EndDialog(hWnd, IDOK);                                  done = IDOK;
                                         break;                                  break;
   
                                 case IDCANCEL:                          case IDCANCEL:
                                         EndDialog(hWnd, IDCANCEL);                                  done = IDCANCEL;
                                         break;                                  break;
                   }
                                 default:  
                                         return(FALSE);  
                         }  
                         break;  
   
                 case WM_CLOSE:  
                         PostMessage(hWnd, WM_COMMAND, IDCANCEL, 0);  
                         break;  
   
                 default:  
                         return(FALSE);  
         }          }
         return(TRUE);          DisposeDialog(hDlg);
           return(done);
 }  }
   
 static LRESULT CALLBACK NewdiskDlgProc(HWND hWnd, UINT msg,  static int NewdiskDlgProc(NEWDISK *newdisk) {
                                                                                                         WPARAM wp, LPARAM lp) {  
   
         WORD    res;          DialogPtr               hDlg;
           int                             media;
         switch (msg) {          int                             done;
                 case WM_INITDIALOG:          short                   item;
                         switch(makefdtype) {          Str255                  disklabel;
                                 case (DISKTYPE_2DD << 4):          ControlHandle   btn[2];
                                         res = IDC_MAKE2DD;  
                                         break;          hDlg = GetNewDialog(IDD_NEWFDDDISK, NULL, (WindowPtr)-1);
           if (!hDlg) {
                                 case (DISKTYPE_2HD << 4):                  return(0);
                                         res = IDC_MAKE2HD;          }
                                         break;  
           SelectDialogItemText(hDlg, IDC_DISKLABEL, 0x0000, 0x7fff);
                                 default:          btn[0] = (ControlHandle)GetDlgItem(hDlg, IDC_MAKE2DD);
                                         res = IDC_MAKE144;          btn[1] = (ControlHandle)GetDlgItem(hDlg, IDC_MAKE2HD);
                                         break;          SetControlValue(btn[0], 0);
                         }          SetControlValue(btn[1], 1);
                         SetDlgItemCheck(hWnd, res, 1);          media = 1;
                         SetFocus(GetDlgItem(hWnd, IDC_DISKLABEL));          SetDialogDefaultItem(hDlg, IDOK);
                         return(FALSE);          SetDialogCancelItem(hDlg, IDCANCEL);
   
                 case WM_COMMAND:          done = 0;
                         switch (LOWORD(wp)) {          while(!done) {
                                 case IDOK:                  ModalDialog(NULL, &item);
                                         GetWindowText(GetDlgItem(hWnd, IDC_DISKLABEL),                  switch(item) {
                                                                                         disklabel, sizeof(disklabel));                          case IDOK:
                                         if (milstr_kanji1st(disklabel, sizeof(disklabel) - 1)) {                                  if (media == 0) {
                                                 disklabel[sizeof(disklabel) - 1] = '\0';                                          newdisk->fdtype = (DISKTYPE_2DD << 4);
                                         }                                  }
                                         if (GetDlgItemCheck(hWnd, IDC_MAKE2DD)) {                                  else if (media == 1) {
                                                 makefdtype = (DISKTYPE_2DD << 4);                                          newdisk->fdtype = (DISKTYPE_2HD << 4);
                                         }                                  }
                                         else if (GetDlgItemCheck(hWnd, IDC_MAKE2HD)) {                                  else {
                                                 makefdtype = (DISKTYPE_2HD << 4);                                          newdisk->fdtype = (DISKTYPE_2HD << 4) + 1;
                                         }                                  }
                                         else {                                  GetDialogItemText(GetDlgItem(hDlg, IDC_DISKLABEL), disklabel);
                                                 makefdtype = (DISKTYPE_2HD << 4) + 1;                                  mkcstr(newdisk->label, sizeof(newdisk->label), disklabel);
                                         }                                  done = IDOK;
                                         EndDialog(hWnd, IDOK);                                  break;
                                         break;  
                           case IDCANCEL:
                                 case IDCANCEL:                                  done = IDCANCEL;
                                         EndDialog(hWnd, IDCANCEL);                                  break;
                                         break;  
                           case IDC_DISKLABEL:
                                 default:                                  break;
                                         return(FALSE);  
                         }                          case IDC_MAKE2DD:
                         break;                                  SetControlValue(btn[0], 1);
                                   SetControlValue(btn[1], 0);
                 case WM_CLOSE:                                  media = 0;
                         PostMessage(hWnd, WM_COMMAND, IDCANCEL, 0);                                  break;
                         break;  
                           case IDC_MAKE2HD:
                 default:                                  SetControlValue(btn[0], 0);
                         return(FALSE);                                  SetControlValue(btn[1], 1);
                                   media = 1;
                                   break;
                   }
         }          }
         return(TRUE);          DisposeDialog(hDlg);
           return(done);
 }  }
   
 void dialog_newdisk(HWND hWnd) {  void dialog_newdisk(void) {
   
         char            path[MAX_PATH];          char    path[MAX_PATH];
 const char              *p;          UINT    hddsize;
         HINSTANCE       hinst;          NEWDISK disk;
   
         file_cpyname(path, fddfolder, sizeof(path));  
         file_cutname(path);  
         file_catname(path, str_newdisk, sizeof(path));  
   
         p = dlgs_selectwritefile(hWnd, &newdiskui, path, NULL, 0);          if (!dlgs_selectwritefile(path, sizeof(path), str_newdisk)) {
         if (p == NULL) {  
                 return;                  return;
         }          }
         hinst = (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE);          if (!file_cmpname(file_getext(path), str_thd)) {
         if (!file_cmpname(file_getext((char *)p), str_thd)) {  
                 hddsize = 0;                  hddsize = 0;
                 if (DialogBox(hinst, MAKEINTRESOURCE(IDD_NEWHDDDISK),                  if (NewHddDlgProc(&hddsize) == IDOK) {
                                                                         hWnd, (DLGPROC)NewHddDlgProc) == IDOK) {                          newdisk_hdd(path, hddsize);
                         newdisk_hdd(p, hddsize);        // (hddsize < 5) || (hddsize > 256)  
                 }                  }
         }          }
         else {          else {
                 if (DialogBox(hinst,                  if (NewdiskDlgProc(&disk) == IDOK) {
                                 MAKEINTRESOURCE(np2cfg.usefd144?IDD_NEWDISK2:IDD_NEWDISK),                          newdisk_fdd(path, disk.fdtype, disk.label);
                                                                         hWnd, (DLGPROC)NewdiskDlgProc) == IDOK) {  
                         newdisk_fdd(p, makefdtype, disklabel);  
                 }                  }
         }          }
 }  }
 #endif  
   

Removed from v.1.1  
changed lines
  Added in v.1.2


RetroPC.NET-CVS <cvs@retropc.net>