Diff for /np2/macosx/toolwin.cpp between versions 1.9 and 1.10

version 1.9, 2003/11/11 16:33:50 version 1.10, 2003/11/12 19:06:33
Line 107  static const OSType subcommand[11] ={ '- Line 107  static const OSType subcommand[11] ={ '-
                                         'exit',                                          'exit',
                                     };                                      };
   
   #define BASENUMBER      4
 static const ControlID popup[2] = { {'pop1', 1}, {'pop2', 2} };  static const ControlID popup[2] = { {'pop1', 1}, {'pop2', 2} };
   
 static DragReceiveHandlerUPP    dr;  static DragReceiveHandlerUPP    dr;
 static bool     isPUMA;  static bool     isPUMA;
   
 static void openpopup(HIPoint location);  static void openpopup(HIPoint location);
 static void skinchange(void);  static void skinchange(bool remake);
   
 // ----  // ----
   
 static void checkOSVersion(void) {  static void checkOSVersion(void) {
     long        res;      static      long    res = 0;
     Gestalt(gestaltSystemVersion, &res);      if (!res) {
     if (res<0x1020) {          Gestalt(gestaltSystemVersion, &res);
         isPUMA = true;          if (res<0x1020) {
     }              isPUMA = true;
     else {          }
         isPUMA = false;          else {
               isPUMA = false;
           }
     }      }
 }  }
   
Line 565  OSErr setDropFile(FSSpec spec, int drv)  Line 568  OSErr setDropFile(FSSpec spec, int drv) 
                           
         case FTYPE_TEXT:          case FTYPE_TEXT:
             strcpy(np2tool.skin, fname);              strcpy(np2tool.skin, fname);
             skinchange();              skinchange(true);
             break;              break;
                   
         case FTYPE_THD:          case FTYPE_THD:
Line 672  static void createskinmenu(MenuRef ret)  Line 675  static void createskinmenu(MenuRef ret) 
 const char      *base;  const char      *base;
         char    *p;          char    *p;
         UINT    i;          UINT    i;
         UINT    j;  
         UINT    id[SKINMRU_MAX];  
 const char      *file[SKINMRU_MAX];  
     char        longname[256];      char        longname[256];
   
         AppendMenuItemTextWithCFString(ret, CFCopyLocalizedString(CFSTR("Select Skin..."),"Slect Skin"), kMenuItemAttrIconDisabled, NULL,NULL);          AppendMenuItemTextWithCFString(ret, CFCopyLocalizedString(CFSTR("Select Skin..."),"Slect Skin"), kMenuItemAttrIconDisabled, NULL,NULL);
Line 683  const char *file[SKINMRU_MAX]; Line 683  const char *file[SKINMRU_MAX];
         base = np2tool.skin;          base = np2tool.skin;
         AppendMenuItemTextWithCFString(ret, CFCopyLocalizedString(CFSTR("<Base Skin>"),"Base Skin"), kMenuItemAttrIconDisabled, NULL,NULL);          AppendMenuItemTextWithCFString(ret, CFCopyLocalizedString(CFSTR("<Base Skin>"),"Base Skin"), kMenuItemAttrIconDisabled, NULL,NULL);
         if (base[0] == '\0') {          if (base[0] == '\0') {
         DisableMenuItem(ret, 3);          CheckMenuItem(ret, BASENUMBER-1, true);
     }      }
         for (cnt=0; cnt<SKINMRU_MAX; cnt++) {          for (cnt=0; cnt<SKINMRU_MAX; cnt++) {
                 p = np2tool.skinmru[cnt];                  p = np2tool.skinmru[cnt];
                 if (p[0] == '\0') {                  if (p[0] == '\0') {
                         break;                          break;
                 }                  }
                 getLongFileName(longname, p);          UInt32  attr = kMenuItemAttrIconDisabled;
         p = longname;          if (file_attr(p) != FILEATTR_ARCHIVE) {
                 for (i=0; i<cnt; i++) {              attr |= kMenuItemAttrDisabled;
                         if (file_cmpname(p, file[id[i]]) < 0) {          }
                                 break;          ZeroMemory(longname, sizeof(longname));
                         }                  if (!getLongFileName(longname, p)) {
                 }              strcpy(longname, file_getname(p));
                 for (j=cnt; j>i; j--) {          }
                         id[j] = id[j-1];          AppendMenuItemTextWithCFString(ret, CFStringCreateWithCString(NULL, longname, kCFStringEncodingUTF8), attr, NULL, NULL);
                 }  
                 id[i] = cnt;  
                 file[cnt] = p;  
         }          }
         for (i=0; i<cnt; i++) {          for (i=0; i<cnt; i++) {
                 j = id[i];          if (!file_cmpname(base, np2tool.skinmru[i])) {
         if (file[j][0] != '\0') {              CheckMenuItem(ret, i+BASENUMBER, true);
             UInt32      attr = kMenuItemAttrIconDisabled;              break;
             if (!file_cmpname(base, np2tool.skinmru[j])) {  
                 attr |= kMenuItemAttrDisabled;  
             }  
             else if (file_attr(np2tool.skinmru[j]) == -1) {  
                 attr |= kMenuItemAttrDisabled;  
             }  
             AppendMenuItemTextWithCFString(ret, CFStringCreateWithCString(NULL, file[j], kCFStringEncodingUTF8), attr, NULL, NULL);  
         }          }
         }          }
         return;          return;
 }  }
   
 static void skinchange(void) {  static void skinchange(bool remake) {
   
 const char              *p;  const char              *p;
         UINT            i;          UINT            i;
   
     toolwin_close();      toolwin_close();
         p = np2tool.skin;          p = np2tool.skin;
         if (p[0]) {          if (p[0] && remake) {
                 for (i=0; i<(SKINMRU_MAX - 1); i++) {                  for (i=0; i<(SKINMRU_MAX - 1); i++) {
                         if (!file_cmpname(p, np2tool.skinmru[i])) {                          if (!file_cmpname(p, np2tool.skinmru[i])) {
                                 break;                                  break;
Line 757  static void openpopup(HIPoint location)  Line 747  static void openpopup(HIPoint location) 
         createskinmenu(hMenu);          createskinmenu(hMenu);
         AppendMenu(hMenu, "\p-");          AppendMenu(hMenu, "\p-");
     AppendMenuItemTextWithCFString(hMenu, CFCopyLocalizedString(CFSTR("Close"),"ToolWin Close"), kMenuItemAttrIconDisabled, NULL, NULL);      AppendMenuItemTextWithCFString(hMenu, CFCopyLocalizedString(CFSTR("Close"),"ToolWin Close"), kMenuItemAttrIconDisabled, NULL, NULL);
   
     DeleteMenu(222);      DeleteMenu(222);
     selectclose = CountMenuItems(hMenu);      selectclose = CountMenuItems(hMenu);
     sel = LoWord(PopUpMenuSelect(hMenu, (short)location.y, (short)location.x, 0));      sel = LoWord(PopUpMenuSelect(hMenu, (short)location.y, (short)location.x, 0));
Line 771  static void openpopup(HIPoint location)  Line 760  static void openpopup(HIPoint location) 
                 if(dialog_fileselect(fname, sizeof(fname), hWndMain)) {                  if(dialog_fileselect(fname, sizeof(fname), hWndMain)) {
                     if (file_getftype(fname)==FTYPE_TEXT) {                      if (file_getftype(fname)==FTYPE_TEXT) {
                         strcpy(np2tool.skin, fname);                          strcpy(np2tool.skin, fname);
                         skinchange();                          skinchange(true);
                     }                      }
                 }                  }
                 break;                  break;
             case 3:              case 3:
                 np2tool.skin[0] = '\0';                  if (np2tool.skin[0]) {
                 skinchange();                      np2tool.skin[0] = '\0';
                       skinchange(false);
                   }
                 break;                  break;
             case 4:              case 4:
             case 5:              case 5:
             case 6:              case 6:
             case 7:              case 7:
                 file_cpyname(np2tool.skin, np2tool.skinmru[sel - 4], sizeof(np2tool.skin));                  if (file_cmpname(np2tool.skin, np2tool.skinmru[sel - BASENUMBER])) {
                 skinchange();                      file_cpyname(np2tool.skin, np2tool.skinmru[sel - BASENUMBER], sizeof(np2tool.skin));
                       skinchange(false);
                   }
                 break;                  break;
             default:              default:
                 break;                  break;
Line 848  void toolwin_open(void) { Line 841  void toolwin_open(void) {
         ShowWindow(hWnd);          ShowWindow(hWnd);
     }      }
     else {      else {
           Rect    mainbounds;
           int             width;
         SetDrawerParent(hWnd, hWndMain);          SetDrawerParent(hWnd, hWndMain);
         SetDrawerOffsets(hWnd, (640-(bounds.right-bounds.left))/2-11, (640-(bounds.right-bounds.left))/2-11);          GetWindowBounds(hWndMain, kWindowContentRgn, &mainbounds);
           width = (mainbounds.right-mainbounds.left)-(bounds.right-bounds.left);
           if (width/2-11<0) {
               toolwin_close();
               return;
           }
           SetDrawerOffsets(hWnd, width/2-11, width/2-11);
         SetDrawerPreferredEdge(hWnd, kWindowEdgeTop);          SetDrawerPreferredEdge(hWnd, kWindowEdgeTop);
         OpenDrawer(hWnd, kWindowEdgeDefault, 1);          OpenDrawer(hWnd, kWindowEdgeDefault, 1);
     }      }

Removed from v.1.9  
changed lines
  Added in v.1.10


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