Diff for /np2/macosx/np2.cpp between versions 1.11 and 1.12

version 1.11, 2003/10/22 19:57:39 version 1.12, 2003/10/23 06:26:16
Line 26 Line 26
 #include        "diskdrv.h"  #include        "diskdrv.h"
 #include        "fddfile.h"  #include        "fddfile.h"
 #include        "statsave.h"  #include        "statsave.h"
   
 #if defined(NP2GCC)  
 #include        "mousemng.h"  #include        "mousemng.h"
 #endif  
 #include        "configure.h"  #include        "configure.h"
   
   
 #define USE_RESUME  #define USE_RESUME
   
   
 #if defined(NP2GCC)  
                 NP2OSCFG        np2oscfg = {0, 2, 0, 0, 0, 0};                  NP2OSCFG        np2oscfg = {0, 2, 0, 0, 0, 0};
 #else  
                 NP2OSCFG        np2oscfg = {0, 2, 0, 0, 0};  
 #endif  
   
                 WindowPtr       hWndMain;                  WindowPtr       hWndMain;
                 BOOL            np2running;                  BOOL            np2running;
Line 453  static void HandleMenuChoice(long wParam Line 447  static void HandleMenuChoice(long wParam
         HiliteMenu(0);          HiliteMenu(0);
 }  }
   
   #if 0
 static void HandleUpdateEvent(EventRecord *pevent) {  static void HandleUpdateEvent(EventRecord *pevent) {
   
         WindowPtr       hWnd;          WindowPtr       hWnd;
Line 462  static void HandleUpdateEvent(EventRecor Line 457  static void HandleUpdateEvent(EventRecor
         scrndraw_redraw();          scrndraw_redraw();
         EndUpdate(hWnd);          EndUpdate(hWnd);
 }  }
   #endif
   
 static void HandleMouseDown(EventRecord *pevent) {  static void HandleMouseDown(EventRecord *pevent) {
   
Line 773  int main(int argc, char *argv[]) { Line 769  int main(int argc, char *argv[]) {
   
         scrnmng_destroy();          scrnmng_destroy();
   
         if (sys_updates & (SYS_UPDATECFG | SYS_UPDATEOSCFG)) {          if (sys_updates & (SYS_UPDATECFG | SYS_UPDATEOSCFG)) {
                 initsave();                  initsave();
         }          }
         TRACETERM();          TRACETERM();
Line 788  int main(int argc, char *argv[]) { Line 784  int main(int argc, char *argv[]) {
 }  }
   
 //以下、ごっそりIIxからマージ  //以下、ごっそりIIxからマージ
 static pascal OSStatus MyAppEventHandler (EventHandlerCallRef myHandlerChain, EventRef event, void* userData)  static pascal OSStatus np2appevent (EventHandlerCallRef myHandlerChain, EventRef event, void* userData)
 {  {
     UInt32          whatHappened;      UInt32          whatHappened;
     OSStatus        result = eventNotHandledErr;      OSStatus        result = eventNotHandledErr;
Line 804  static pascal OSStatus MyAppEventHandler Line 800  static pascal OSStatus MyAppEventHandler
     if (IsDialogEvent(&eve)) return result;      if (IsDialogEvent(&eve)) return result;
   
     UInt32 modif;      UInt32 modif;
     EventMouseButton    buttonKind;  
     GetEventParameter (event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modif);      GetEventParameter (event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modif);
   
   #if defined(NP2GCC)
       EventMouseButton buttonKind;
     GetEventParameter (event, kEventParamMouseButton, typeMouseButton, NULL, sizeof(EventMouseButton), NULL, &buttonKind);      GetEventParameter (event, kEventParamMouseButton, typeMouseButton, NULL, sizeof(EventMouseButton), NULL, &buttonKind);
     BYTE ret;  
           BYTE ret;
   #endif
                   
     switch (eventClass)      switch (eventClass)
         {          {
Line 816  static pascal OSStatus MyAppEventHandler Line 816  static pascal OSStatus MyAppEventHandler
                         AEProcessAppleEvent(&eve);                          AEProcessAppleEvent(&eve);
                     }                      }
                     break;                      break;
   
                 case kEventClassMouse:                   case kEventClassMouse: 
   #if defined(NP2GCC)
                     switch (whatHappened)                      switch (whatHappened)
                         {                          {
                         case kEventMouseMoved:                          case kEventMouseMoved:
Line 858  static pascal OSStatus MyAppEventHandler Line 860  static pascal OSStatus MyAppEventHandler
                                     break;                                          break;    
                                 }                                                      }                    
                         }                          }
   #else
                                                   if (whatHappened == kEventMouseDown) {
                                                           HandleMouseDown(&eve);
                                                   }
   #endif
                         break;                          break;
             default:              default:
                     break;                       break; 
         }          }
   
           (void)myHandlerChain;
           (void)userData;
     return result;       return result; 
 }  }
   
 static pascal OSStatus MyWindowEventHandler(EventHandlerCallRef myHandler,  EventRef event, void* userData)  static pascal OSStatus np2windowevent(EventHandlerCallRef myHandler,  EventRef event, void* userData)
 {  {
     WindowRef   window;      WindowRef   window;
     UInt32              whatHappened;      UInt32              whatHappened;
Line 934  static pascal OSStatus MyWindowEventHand Line 944  static pascal OSStatus MyWindowEventHand
                 break;                                  break;                
         }          }
   
           (void)myHandler;
           (void)userData;
     return result;      return result;
 }  }
   
 static void setUpCarbonEvent(void)  static const EventTypeSpec appEventList[] = {
 {                                  {kEventClassAppleEvent, kEventAppleEvent},
     InstallStandardEventHandler(GetWindowEventTarget(hWndMain));                                  {kEventClassMouse,              kEventMouseDown},
         EventTypeSpec   appEventList[] ={       { kEventClassAppleEvent, kEventAppleEvent },  #if defined(NP2GCC)
                                         { kEventClassMouse, kEventMouseDown},                                  {kEventClassMouse,              kEventMouseMoved},
                                         { kEventClassMouse, kEventMouseMoved},                                  {kEventClassMouse,              kEventMouseUp},
                                         { kEventClassMouse, kEventMouseUp}  #endif
                                     };                          };
     EventTypeSpec   windEventList[] ={  { kEventClassWindow, kEventWindowClose},  
                                                         { kEventClassKeyboard, kEventRawKeyDown},  
                                         { kEventClassKeyboard, kEventRawKeyUp},  
                                         { kEventClassKeyboard, kEventRawKeyRepeat},  
                                                         { kEventClassKeyboard, kEventRawKeyModifiersChanged}  
                                      };  
         InstallApplicationEventHandler(NewEventHandlerUPP(MyAppEventHandler), 4, appEventList, 0, NULL);   
         InstallWindowEventHandler(hWndMain, NewEventHandlerUPP(MyWindowEventHandler), 5, windEventList, 0, NULL);  
   
   static const EventTypeSpec windEventList[] = {
                                   {kEventClassWindow,             kEventWindowClose},
                                   {kEventClassKeyboard,   kEventRawKeyDown},
                                   {kEventClassKeyboard,   kEventRawKeyUp},
                                   {kEventClassKeyboard,   kEventRawKeyRepeat},
                                   {kEventClassKeyboard,   kEventRawKeyModifiersChanged},
                           };
   
   
   static void setUpCarbonEvent(void) {
   
           InstallStandardEventHandler(GetWindowEventTarget(hWndMain));
           InstallApplicationEventHandler(NewEventHandlerUPP(np2appevent),
                                                                   sizeof(appEventList)/sizeof(EventTypeSpec),
                                                                   appEventList, 0, NULL);
           InstallWindowEventHandler(hWndMain, NewEventHandlerUPP(np2windowevent),
                                                                   sizeof(windEventList)/sizeof(EventTypeSpec),
                                                                   windEventList, 0, NULL);
 }  }
   

Removed from v.1.11  
changed lines
  Added in v.1.12


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