|
|
| version 1.4, 2003/10/20 10:14:27 | version 1.5, 2003/10/28 16:44:44 |
|---|---|
| Line 5 | Line 5 |
| #include "sysmng.h" | #include "sysmng.h" |
| #include "pccore.h" | #include "pccore.h" |
| #include "fddfile.h" | #include "fddfile.h" |
| #include "diskdrv.h" | |
| static bool getLongFileName(char* dst, const char* path); | |
| UINT sys_updates; | UINT sys_updates; |
| Line 46 BOOL sysmng_workclockrenewal(void) { | Line 48 BOOL sysmng_workclockrenewal(void) { |
| void sysmng_updatecaption(BYTE flag) { | void sysmng_updatecaption(BYTE flag) { |
| char name1[255], name2[255]; | |
| char work[256]; | char work[256]; |
| #ifndef NP2GCC | |
| Str255 str; | Str255 str; |
| #endif | |
| if (flag & 1) { | if (flag & 1) { |
| strtitle[0] = '\0'; | strtitle[0] = '\0'; |
| if (fdd_diskready(0)) { | if (fdd_diskready(0)) { |
| milstr_ncat(strtitle, " FDD1:", sizeof(strtitle)); | milstr_ncat(strtitle, " FDD1:", sizeof(strtitle)); |
| milstr_ncat(strtitle, file_getname((char *)fdd_diskname(0)), | if (getLongFileName(name1, fdd_diskname(0))) { |
| milstr_ncat(strtitle, name1, sizeof(strtitle)); | |
| } | |
| else { | |
| milstr_ncat(strtitle, file_getname((char *)fdd_diskname(0)), | |
| sizeof(strtitle)); | sizeof(strtitle)); |
| } | |
| } | } |
| if (fdd_diskready(1)) { | if (fdd_diskready(1)) { |
| milstr_ncat(strtitle, " FDD2:", sizeof(strtitle)); | milstr_ncat(strtitle, " FDD2:", sizeof(strtitle)); |
| milstr_ncat(strtitle, file_getname((char *)fdd_diskname(1)), | if (getLongFileName(name2, fdd_diskname(1))) { |
| milstr_ncat(strtitle, name2, sizeof(strtitle)); | |
| } | |
| else { | |
| milstr_ncat(strtitle, file_getname((char *)fdd_diskname(1)), | |
| sizeof(strtitle)); | sizeof(strtitle)); |
| } | |
| } | } |
| } | } |
| if (flag & 2) { | if (flag & 2) { |
| Line 86 void sysmng_updatecaption(BYTE flag) { | Line 101 void sysmng_updatecaption(BYTE flag) { |
| milstr_ncat(work, strtitle, sizeof(work)); | milstr_ncat(work, strtitle, sizeof(work)); |
| milstr_ncat(work, strclock, sizeof(work)); | milstr_ncat(work, strclock, sizeof(work)); |
| mkstr255(str, work); | |
| #if defined(NP2GCC) | #if defined(NP2GCC) |
| SetWindowTitleWithCFString(hWndMain, CFStringCreateWithPascalString(NULL, str, CFStringGetSystemEncoding())); | SetWindowTitleWithCFString(hWndMain, CFStringCreateWithCString(NULL, work, kCFStringEncodingUTF8)); |
| #else | #else |
| mkstr255(str, work); | |
| SetWTitle(hWndMain, str); | SetWTitle(hWndMain, str); |
| #endif | #endif |
| } | } |
| static bool getLongFileName(char* dst, const char* path) { | |
| FSSpec fss; | |
| Str255 fname; | |
| FSRef fref; | |
| char buffer[1024]; | |
| char *ret, *val; | |
| if (*path == '\0') { | |
| return(false); | |
| } | |
| mkstr255(fname, path); | |
| if (FSMakeFSSpec(0, 0, fname, &fss) != noErr) { | |
| return(false); | |
| } | |
| if (FSpMakeFSRef(&fss, &fref) != noErr) { | |
| return(false); | |
| } | |
| if (FSRefMakePath(&fref, (UInt8*)buffer, 1024) != noErr) { | |
| return(false); | |
| } | |
| val = buffer; | |
| ret = val; | |
| while(*val != '\0') { | |
| if (*val++ == '/') { | |
| ret = val; | |
| } | |
| } | |
| strcpy(dst, ret); | |
| return(true); | |
| } | |