Diff for /np2/macosx/np2.cpp between versions 1.24 and 1.27

version 1.24, 2003/10/28 19:17:29 version 1.27, 2003/11/03 10:19:43
Line 34 Line 34
 #include        "macnewdisk.h"  #include        "macnewdisk.h"
 #include        "fdefine.h"  #include        "fdefine.h"
 #include        "hid.h"  #include        "hid.h"
   #include        "midiopt.h"
   #include        "macalert.h"
   #include        "np2opening.h"
   #include        "toolmac.h"
   
   #include        <QuickTime/QuickTime.h>
 #define USE_RESUME  #define USE_RESUME
 #define NP2OPENING  #define NP2OPENING
   
 #ifdef          NP2OPENING  
 #include        <QuickTime/QuickTime.h>  
 // #define      OPENING_WAIT    1500  // #define      OPENING_WAIT    1500
 #endif  
   
   
   
                 NP2OSCFG        np2oscfg = {0, 2, 0, 0, 0, 0, 1, 0};                  NP2OSCFG        np2oscfg = {0, 2, 0, 0, 0, 0, 1, 0};
Line 52 Line 52
 static  UINT            framecnt = 0;  static  UINT            framecnt = 0;
 static  UINT            waitcnt = 0;  static  UINT            waitcnt = 0;
 static  UINT            framemax = 1;  static  UINT            framemax = 1;
 static  BYTE            scrnmode;          BYTE            scrnmode;
   
   
 #define DRAG_THRESHOLD          5  #define DRAG_THRESHOLD          5
Line 93  pascal OSErr OpenAppleEventHandler(const Line 93  pascal OSErr OpenAppleEventHandler(const
         AEKeyword       key;          AEKeyword       key;
         AEDescList      dlist;          AEDescList      dlist;
                   
         if( ! AEGetParamDesc( event,keyDirectObject,typeAEList,&dlist ) )       {          if(!AEGetParamDesc(event,keyDirectObject,typeAEList,&dlist))    {
                 AECountItems( &dlist,&ct );                  AECountItems( &dlist,&ct );
                 for( i=1;i<=ct;i++ )    {                  for( i=1;i<=ct;i++ )    {
             pp=&fsc;              pp=&fsc;
                         if( ! AEGetNthPtr( &dlist,i,typeFSS,&key,&rtype,(Ptr)pp,(long)sizeof(FSSpec),&len ) )   {                          if (!AEGetNthPtr( &dlist,i,typeFSS,&key,&rtype,(Ptr)pp,(long)sizeof(FSSpec),&len))      {
                 char            fname[MAX_PATH];                  setDropFile(fsc, i-1);
                 int                     ftype;  
                 fsspec2path(&fsc, fname, MAX_PATH);  
                 ftype = file_getftype(fname);  
                 if ((ftype != FTYPE_D88) && (ftype != FTYPE_BETA)) {  
                     diskdrv_sethdd(0, fname);  
                 }  
                 else {  
                     diskdrv_setfdd(i-1, fname, 0);  
                 }  
                         }                          }
                 }                  }
                 AEDisposeDesc( &dlist );                  AEDisposeDesc( &dlist );
Line 201  static void HandleMenuChoice(long wParam Line 192  static void HandleMenuChoice(long wParam
                         break;                          break;
   
                 case IDM_RESET:                  case IDM_RESET:
                         pccore_cfgupdate();              if (ResetWarningDialogProc()) {
                         pccore_reset();                  pccore_cfgupdate();
                   pccore_reset();
               }
                         break;                          break;
                           
                 case IDM_CONFIGURE:                  case IDM_CONFIGURE:
Line 231  static void HandleMenuChoice(long wParam Line 224  static void HandleMenuChoice(long wParam
   
                 case IDM_FDD1EJECT:                  case IDM_FDD1EJECT:
                         diskdrv_setfdd(0, NULL, 0);                          diskdrv_setfdd(0, NULL, 0);
               toolwin_setfdd(0, NULL);
                         break;                          break;
   
                 case IDM_FDD2OPEN:                  case IDM_FDD2OPEN:
Line 239  static void HandleMenuChoice(long wParam Line 233  static void HandleMenuChoice(long wParam
   
                 case IDM_FDD2EJECT:                  case IDM_FDD2EJECT:
                         diskdrv_setfdd(1, NULL, 0);                          diskdrv_setfdd(1, NULL, 0);
               toolwin_setfdd(1, NULL);
                         break;                          break;
   
                 case IDM_SASI1OPEN:                  case IDM_SASI1OPEN:
Line 326  static void HandleMenuChoice(long wParam Line 321  static void HandleMenuChoice(long wParam
             mouse_running(MOUSE_XOR);              mouse_running(MOUSE_XOR);
             menu_setmouse(np2oscfg.MOUSE_SW ^ 1);              menu_setmouse(np2oscfg.MOUSE_SW ^ 1);
             sysmng_update(SYS_UPDATECFG);              sysmng_update(SYS_UPDATECFG);
             toggleMenubar();  
                         break;                          break;
                           
           case IDM_MIDIOPT:
               initMidiOpt();
               break;
               
                 case IDM_MIDIPANIC:                  case IDM_MIDIPANIC:
                         rs232c_midipanic();                          rs232c_midipanic();
                         mpu98ii_midipanic();                          mpu98ii_midipanic();
Line 514  static void HandleMenuChoice(long wParam Line 512  static void HandleMenuChoice(long wParam
                         update |= SYS_UPDATECFG;                          update |= SYS_UPDATECFG;
                         break;                          break;
   
           case IDM_MSRAPID:
               menu_setmsrapid(np2cfg.MOUSERAPID ^ 1);
               update |= SYS_UPDATECFG;
               break;
   
                 case IDM_I286SAVE:                  case IDM_I286SAVE:
                         debugsub_status();                          debugsub_status();
                         break;                          break;
Line 549  static void processwait(UINT waitcnt) { Line 552  static void processwait(UINT waitcnt) {
         if (timing_getcount() >= waitcnt) {          if (timing_getcount() >= waitcnt) {
                 framecnt = 0;                  framecnt = 0;
                 timing_setcount(0);                  timing_setcount(0);
                   toolwin_draw((BYTE)waitcnt);
                 if (np2oscfg.DISPCLK & 3) {                  if (np2oscfg.DISPCLK & 3) {
                         if (sysmng_workclockrenewal()) {                          if (sysmng_workclockrenewal()) {
                                 sysmng_updatecaption(3);                                  sysmng_updatecaption(3);
Line 584  static void flagload(const char *ext) { Line 588  static void flagload(const char *ext) {
   
         char    path[MAX_PATH];          char    path[MAX_PATH];
         char    buf[1024];          char    buf[1024];
         int             ret;          int             ret, r;
   
       ret = IDOK;
         getstatfilename(path, ext, sizeof(path));          getstatfilename(path, ext, sizeof(path));
         ret = statsave_check(path, buf, sizeof(buf));          r = statsave_check(path, buf, sizeof(buf));
         if (ret == NP2FLAG_SUCCESS) {          if (r & (~NP2FLAG_DISKCHG)) {
                   ResumeErrorDialogProc();
                   ret = IDCANCEL;
           }
           else if (r & NP2FLAG_DISKCHG) {
                   ret = ResumeWarningDialogProc(buf);
           }
           if (ret == IDOK) {
                 statsave_load(path);                  statsave_load(path);
                   toolwin_setfdd(0, fdd_diskname(0));
                   toolwin_setfdd(1, fdd_diskname(1));
         }          }
           return;
 }  }
   
 #ifdef          NP2OPENING  
 static void openingNP2(void) {  
     Rect                srt, bounds;  
     GrafPtr             port;  
     CFURLRef    openingURL;  
     char                buffer[1024];  
     FSRef               fsr;  
     FSSpec              fsc;  
     PicHandle   pict;  
     GraphicsImportComponent     gi;  
       
     GetPort(&port);  
     SetPortWindowPort(hWndMain);  
     const RGBColor col = {0, 0, 0};  
     SetRect(&bounds, 0, 0, 640, 400);  
     RGBBackColor(&col);  
     EraseRect(&bounds);  
       
     openingURL=CFBundleCopyResourceURL(CFBundleGetMainBundle(), CFSTR("nekop2"), CFSTR("bmp"), NULL);  
     if (openingURL) {  
         if (CFURLGetFSRef(openingURL, &fsr)) {  
             FSPathMakeRef((const UInt8*)buffer, &fsr, NULL);  
             FSGetCatalogInfo(&fsr, kFSCatInfoNone, NULL, NULL, &fsc, NULL);  
             if (!GetGraphicsImporterForFile(&fsc, &gi)) {  
                 if (!GraphicsImportGetNaturalBounds(gi, &srt)) {  
                     OffsetRect( &srt, -srt.left, -srt.top);  
                     GraphicsImportSetBoundsRect(gi, &srt);  
                     GraphicsImportGetAsPicture(gi, &pict);  
                     OffsetRect(&srt, (640-srt.right)/2, (400-srt.bottom)/2);  
                     DrawPicture(pict,&srt);  
                     QDFlushPortBuffer(GetWindowPort(hWndMain), NULL);  
                     KillPicture(pict);  
                 }  
                 CloseComponent(gi);  
             }  
         }  
         CFRelease(openingURL);  
     }  
     SetPort(port);  
 }  
 #endif  
   
   
 int main(int argc, char *argv[]) {  int main(int argc, char *argv[]) {
   
     EventRef            theEvent;      EventRef            theEvent;
Line 654  int main(int argc, char *argv[]) { Line 626  int main(int argc, char *argv[]) {
         initload();          initload();
   
         TRACEINIT();          TRACEINIT();
       
       toolwin_readini();
     if (!(setupMainWindow())) {      if (!(setupMainWindow())) {
         return(0);          return(0);
     }      }
Line 792  int main(int argc, char *argv[]) { Line 765  int main(int argc, char *argv[]) {
         toggleFullscreen();          toggleFullscreen();
     }      }
           
       toolwin_writeini();
         pccore_cfgupdate();          pccore_cfgupdate();
   
 #if defined(USE_RESUME)  #if defined(USE_RESUME)
Line 822  int main(int argc, char *argv[]) { Line 796  int main(int argc, char *argv[]) {
         dosio_term();          dosio_term();
   
         DisposeWindow(hWndMain);          DisposeWindow(hWndMain);
       toolwin_close();
   
         (void)argc;          (void)argc;
         (void)argv;          (void)argv;
Line 933  static pascal OSStatus np2windowevent(Ev Line 908  static pascal OSStatus np2windowevent(Ev
                         np2running = FALSE;                          np2running = FALSE;
                         result = noErr;                          result = noErr;
                         break;                          break;
                     case kEventWindowShowing:  
                         scrndraw_redraw();  
                        break;  
                     case kEventWindowActivated:                      case kEventWindowActivated:
                         DisableAllMenuItems(GetMenuHandle(IDM_EDIT));                          DisableAllMenuItems(GetMenuHandle(IDM_EDIT));
                         break;                          break;
                       case kEventWindowToolbarSwitchMode:
                           toolwin_open();
                           break;
                       case kEventWindowDragStarted:
                           soundmng_stop();
                           break;
                       case kEventWindowDragCompleted:
                           soundmng_play();
                           break;
                 }                  }
                 break;                  break;
             case kEventClassKeyboard:              case kEventClassKeyboard:
Line 1003  static const EventTypeSpec appEventList[ Line 984  static const EventTypeSpec appEventList[
   
 static const EventTypeSpec windEventList[] = {  static const EventTypeSpec windEventList[] = {
                                 {kEventClassWindow,             kEventWindowClose},                                  {kEventClassWindow,             kEventWindowClose},
                                 {kEventClassWindow,             kEventWindowShowing},  
                                 {kEventClassWindow,             kEventWindowActivated},                                  {kEventClassWindow,             kEventWindowActivated},
                                   {kEventClassWindow,             kEventWindowToolbarSwitchMode},
                                   {kEventClassWindow,             kEventWindowDragStarted},
                                   {kEventClassWindow,             kEventWindowDragCompleted},
                                 {kEventClassKeyboard,   kEventRawKeyDown},                                  {kEventClassKeyboard,   kEventRawKeyDown},
                                 {kEventClassKeyboard,   kEventRawKeyUp},                                  {kEventClassKeyboard,   kEventRawKeyUp},
                                 {kEventClassKeyboard,   kEventRawKeyRepeat},                                  {kEventClassKeyboard,   kEventRawKeyRepeat},
Line 1024  static void setUpCarbonEvent(void) { Line 1007  static void setUpCarbonEvent(void) {
     InstallStandardEventHandler(GetWindowEventTarget(hWndMain));      InstallStandardEventHandler(GetWindowEventTarget(hWndMain));
 }  }
   
 bool setupMainWindow(void) {  static bool setupMainWindow(void) {
 #if defined(NP2GCC) && 0  #if defined(NP2GCC)
       OSStatus    err;
       IBNibRef    nibRef;
   
       err = CreateNibReference(CFSTR("np2"), &nibRef);
       if (err ==noErr ) {
           CreateWindowFromNib(nibRef, CFSTR("MainWindow"), &hWndMain);
           DisposeNibReference ( nibRef);
       }
       else {
            return(false);
       }
       
 #else  #else
     Rect wRect;      Rect wRect;
           
Line 1080  static void toggleFullscreen(void) { Line 1075  static void toggleFullscreen(void) {
     soundmng_play();      soundmng_play();
 }  }
   
 void toggleMenubar(void) {  void recieveCommand(long param) {
     if (scrnmode & SCRNMODE_FULLSCREEN) {      HandleMenuChoice(param);
         if (!np2oscfg.MOUSE_SW) {  
             ShowMenuBar();  
         }  
         else {  
             HideMenuBar();  
         }  
     }  
 }  }
   

Removed from v.1.24  
changed lines
  Added in v.1.27


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