Diff for /np2/macosx/dialog/macnewdisk.cpp between versions 1.4 and 1.5

version 1.4, 2003/11/13 20:00:15 version 1.5, 2004/01/23 17:37:39
Line 8 Line 8
 #include        "macnewdisk.h"  #include        "macnewdisk.h"
   
 static  WindowRef       diskWin;  static  WindowRef       diskWin;
 static  SInt32  targetDisk, media, hdsize;  static  SInt32  targetDisk, media, hdsize, hddtype;
 static  char    disklabel[256];  static  char    disklabel[256];
 enum {kTabMasterSig = 'ScrT',kTabMasterID = 1000,kTabPaneSig= 'ScTb'};  enum {kTabMasterSig = 'ScrT',kTabMasterID = 1000,kTabPaneSig= 'ScTb'};
 #define kMaxNumTabs 2  #define kMaxNumTabs 4
 static UInt16           lastPaneSelected = 1;  static UInt16           lastPaneSelected = 1;
 #define getControlValue(a,b)            GetControl32BitValue(getControlRefByID(a,b,diskWin))  #define getControlValue(a,b)            GetControl32BitValue(getControlRefByID(a,b,diskWin))
   
Line 30  static pascal OSStatus cfWinproc(EventHa Line 30  static pascal OSStatus cfWinproc(EventHa
         GetEventParameter(event, kEventParamDirectObject, typeHICommand, NULL, sizeof(HICommand), NULL, &cmd);          GetEventParameter(event, kEventParamDirectObject, typeHICommand, NULL, sizeof(HICommand), NULL, &cmd);
         switch (cmd.commandID)          switch (cmd.commandID)
         {          {
             case 'hdsz':              case 'hds2':
                 data = getControlValue(cmd.commandID,1)-1;                  data = getControlValue('hdsz', 3)-1;
                 sprintf(outstr, "%d", defaultsize[data]);                  sprintf(outstr, "%d", defaultsize[data]);
                 SetControlData(getControlRefByID(cmd.commandID,0,diskWin),kControlNoPart,kControlStaticTextTextTag,strlen(outstr),outstr);                  SetControlData(getControlRefByID('hdsz',2,diskWin),kControlNoPart,kControlStaticTextTextTag,strlen(outstr),outstr);
                 Draw1Control(getControlRefByID(cmd.commandID,0,diskWin));                  Draw1Control(getControlRefByID('hdsz',2,diskWin));
                   break;
                                  
               case 'hds4':
                   data = getControlValue('hdsz', 5)-1;
                   sprintf(outstr, "%d", defaultsize[data]);
                   SetControlData(getControlRefByID('hdsz',4,diskWin),kControlNoPart,kControlStaticTextTextTag,strlen(outstr),outstr);
                   Draw1Control(getControlRefByID('hdsz',4,diskWin));
                 break;                  break;
   
             case kHICommandOK:              case kHICommandOK:
                 targetDisk = getControlValue(kTabMasterSig, kTabMasterID);                  targetDisk = getControlValue(kTabMasterSig, kTabMasterID);
                 getFieldText(getControlRefByID('fdlb', 0, diskWin), disklabel);                  getFieldText(getControlRefByID('fdlb', 0, diskWin), disklabel);
                 media = getControlValue('fdty', 0);                  media = getControlValue('fdty', 0);
                 data = getFieldValue(getControlRefByID('hdsz', 0, diskWin));                                  if (targetDisk==2 || targetDisk==4) {
                 if (data < 0) {                                          data = getFieldValue(getControlRefByID('hdsz', targetDisk, diskWin));
                     data = 0;                                          if (data < 0) {
                 }                                                  data = 0;
                 else if (data > 512) {                                          }
                     data = 512;                                          else if (data > 512) {
                 }                                                  data = 512;
                 hdsize = data;                                          }
                                           hdsize = data;
                                   }
                                   else if (targetDisk==3) {
                                           hdsize = getControlValue('hdsz', 20)-1;
                                   }
                 QuitAppModalLoopForWindow(diskWin);                  QuitAppModalLoopForWindow(diskWin);
                 err=noErr;                  err=noErr;
                 break;                  break;
Line 79  static pascal OSStatus PrefsTabEventHand Line 91  static pascal OSStatus PrefsTabEventHand
         if (ret == 1) {          if (ret == 1) {
             focus = getControlRefByID('fdlb', 0, theWindow);              focus = getControlRefByID('fdlb', 0, theWindow);
         }          }
         else {          else if (ret == 2 || ret == 4) {
             focus = getControlRefByID('hdsz', 0, theWindow);              focus = getControlRefByID('hdsz', ret, theWindow);
         }          }
         SetKeyboardFocus(theWindow, focus, kControlFocusNextPart);          SetKeyboardFocus(theWindow, focus, kControlFocusNextPart);
         lastPaneSelected = ret;          lastPaneSelected = ret;
Line 134  void newdisk(void) {  Line 146  void newdisk(void) { 
     else if (targetDisk == 2) {      else if (targetDisk == 2) {
         if (dialog_filewriteselect('.THD', "Newdisk.thd", &fss, diskWin)) {          if (dialog_filewriteselect('.THD', "Newdisk.thd", &fss, diskWin)) {
             fsspec2path(&fss, fname, sizeof(fname));              fsspec2path(&fss, fname, sizeof(fname));
             newdisk_hdd(fname, hdsize);              newdisk_thd(fname, hdsize);
           }
       }
       else if (targetDisk == 3) {
           if (dialog_filewriteselect('.HDI', "Newdisk.hdi", &fss, diskWin)) {
               fsspec2path(&fss, fname, sizeof(fname));
               newdisk_hdi(fname, hddtype);
           }
       }
       else if (targetDisk == 4) {
           if (dialog_filewriteselect('.HDD', "Newdisk.hdd", &fss, diskWin)) {
               fsspec2path(&fss, fname, sizeof(fname));
               newdisk_vhd(fname, hdsize);
         }          }
     }      }
     HideWindow(diskWin);      HideWindow(diskWin);

Removed from v.1.4  
changed lines
  Added in v.1.5


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