|
|
| version 1.3, 2003/11/03 18:50:25 | version 1.5, 2003/11/11 16:33:51 |
|---|---|
| Line 1 | Line 1 |
| #include "compiler.h" | #include "compiler.h" |
| #include "resource.h" | #include "resource.h" |
| #include "sysmng.h" | #include "sysmng.h" |
| #include "dialog.h" | |
| #include "pccore.h" | #include "pccore.h" |
| #include "fddfile.h" | #include "dialog.h" |
| #include "diskdrv.h" | #include "diskdrv.h" |
| #if 0 | |
| #include "newdisk.h" | |
| #endif | |
| #include "font.h" | #include "font.h" |
| #include "iocore.h" | #include "iocore.h" |
| #include "np2.h" | #include "np2.h" |
| Line 19 | Line 15 |
| #include "fdefine.h" | #include "fdefine.h" |
| #include "toolwin.h" | #include "toolwin.h" |
| static Handle GetDlgItem(DialogPtr hWnd, short pos) { | |
| Handle ret; | |
| Rect rct; | |
| short s; | |
| GetDialogItem(hWnd, pos, &s, &ret, &rct); | |
| return(ret); | |
| } | |
| void AboutDialogProc(void) { | |
| DialogPtr hDlg; | |
| Str255 verstr; | |
| int done; | |
| short item; | |
| hDlg = GetNewDialog(IDD_ABOUT, NULL, (WindowPtr)-1); | |
| if (!hDlg) { | |
| return; | |
| } | |
| mkstr255(verstr, np2version); | |
| SetDialogItemText(GetDlgItem(hDlg, IDD_VERSION), verstr); | |
| SetDialogDefaultItem(hDlg, IDOK); | |
| done = 0; | |
| while(!done) { | |
| ModalDialog(NULL, &item); | |
| switch(item) { | |
| case IDOK: | |
| done = 1; | |
| break; | |
| } | |
| } | |
| DisposeDialog(hDlg); | |
| } | |
| // ---- | // ---- |
| static const BYTE pathsep[2] = {0x01, ':'}; | static const BYTE pathsep[2] = {0x01, ':'}; |
| Line 111 void fsspec2path(FSSpec *fs, char *dst, | Line 69 void fsspec2path(FSSpec *fs, char *dst, |
| } while(cipbr.dirInfo.ioDrDirID != fsRtDirID); | } while(cipbr.dirInfo.ioDrDirID != fsRtDirID); |
| } | } |
| #if 1 | |
| static NavDialogRef navWin; | static NavDialogRef navWin; |
| static pascal void dummyproc(NavEventCallbackMessage sel, NavCBRecPtr prm, | static pascal void dummyproc(NavEventCallbackMessage sel, NavCBRecPtr prm, |
| NavCallBackUserData ud) { | NavCallBackUserData ud) { |
| switch( sel ) | switch( sel ) |
| Line 175 BOOL dialog_fileselect(char *name, int s | Line 133 BOOL dialog_fileselect(char *name, int s |
| fsel_exit: | fsel_exit: |
| return(ret); | return(ret); |
| } | } |
| #else | |
| BOOL dialog_fileselect(char *name, int size, WindowRef parent) { | |
| StandardFileReply sfr; | BOOL dialog_filewriteselect(OSType type, char *title, FSSpec *fsc, WindowRef parentWindow) |
| { | |
| OSType sign='SMil'; | |
| NavEventUPP eventUPP; | |
| NavReplyRecord reply; | |
| DescType rtype; | |
| OSErr ret; | |
| AEKeyword key; | |
| Size len; | |
| FSRef parent; | |
| UniCharCount ulen; | |
| UniChar* buffer = NULL; | |
| NavDialogCreationOptions copt; | |
| InitCursor(); | |
| NavGetDefaultDialogCreationOptions(&copt); | |
| copt.parentWindow = parentWindow; | |
| copt.saveFileName = CFStringCreateWithCString(NULL, title, CFStringGetSystemEncoding()); | |
| copt.optionFlags += kNavNoTypePopup; | |
| copt.modality = kWindowModalityWindowModal; | |
| eventUPP=NewNavEventUPP( dummyproc ); | |
| NavCreatePutFileDialog(&copt, type, sign, eventUPP, NULL, &navWin); | |
| NavDialogRun(navWin); | |
| RunAppModalLoopForWindow(NavDialogGetWindow(navWin)); | |
| NavDialogGetReply(navWin, &reply); | |
| NavDialogDispose(navWin); | |
| DisposeNavEventUPP(eventUPP); | |
| StandardGetFile(NULL, -1, NULL, &sfr); | if( reply.validRecord) |
| if (sfr.sfGood) { | { |
| fsspec2path(&sfr.sfFile, name, size); | ret=AEGetNthPtr( &(reply.selection),1,typeFSRef,&key,&rtype,(Ptr)&parent,(long)sizeof(FSRef),&len ); |
| return(TRUE); | ulen = (UniCharCount)CFStringGetLength(reply.saveFileName); |
| } | buffer = (UniChar*)NewPtr(ulen); |
| else { | CFStringGetCharacters(reply.saveFileName, CFRangeMake(0, ulen), buffer); |
| return(FALSE); | ret = FSCreateFileUnicode(&parent, ulen, buffer, kFSCatInfoNone, NULL, NULL, fsc); |
| DisposePtr((Ptr)buffer); | |
| NavDisposeReply( &reply ); | |
| if (ret == noErr) { | |
| return true; | |
| } | |
| } | } |
| (void)paret; | return( false ); |
| } | } |
| #endif | |
| // ---- | |
| void dialog_changefdd(BYTE drv) { | void dialog_changefdd(BYTE drv) { |
| Line 243 void dialog_writebmp(void) { | Line 232 void dialog_writebmp(void) { |
| bmp = scrnbmp(); | bmp = scrnbmp(); |
| if (bmp) { | if (bmp) { |
| if (saveFile('BMP ', "np2.bmp", &fss)) { | if (dialog_filewriteselect('BMP ', "np2.bmp", &fss, hWndMain)) { |
| fsspec2path(&fss, path, MAX_PATH); | fsspec2path(&fss, path, MAX_PATH); |
| fh = file_create(path); | fh = file_create(path); |
| if (fh != FILEH_INVALID) { | if (fh != FILEH_INVALID) { |
| Line 266 void dialog_s98(void) { | Line 255 void dialog_s98(void) { |
| if (check) { | if (check) { |
| check = FALSE; | check = FALSE; |
| } | } |
| else if (saveFile('.S98', "S98 log.s98", &fsc)) { | else if (dialog_filewriteselect('.S98', "S98 log.s98", &fsc, hWndMain)) { |
| fsspec2path(&fsc, fname, MAX_PATH); | fsspec2path(&fsc, fname, MAX_PATH); |
| if (S98_open(fname) == SUCCESS) { | if (S98_open(fname) == SUCCESS) { |
| check = TRUE; | check = TRUE; |