| version 1.1, 2003/10/16 17:59:03 | version 1.9, 2007/11/11 07:11:27 | 
| Line 1 | Line 1 | 
 | #include        "compiler.h" | #include        "compiler.h" | 
 | #include        "resource.h" |  | 
 | #include        "strres.h" | #include        "strres.h" | 
 |  | #include        "resource.h" | 
 | #include        "np2.h" | #include        "np2.h" | 
 |  | #include        "oemtext.h" | 
 | #include        "dosio.h" | #include        "dosio.h" | 
 | #include        "sysmng.h" | #include        "sysmng.h" | 
 | #include        "pccore.h" |  | 
 | #include        "iocore.h" |  | 
 | #include        "dialog.h" | #include        "dialog.h" | 
 | #include        "dialogs.h" | #include        "dialogs.h" | 
 |  | #include        "pccore.h" | 
 |  | #include        "iocore.h" | 
 |  | #include        "scrnsave.h" | 
 | #include        "font.h" | #include        "font.h" | 
 | #include        "scrnbmp.h" |  | 
 |  |  | 
 |  |  | 
| static const char fontui_title[] = "Select font file"; | static const FSPARAM fpFont = | 
| static const char fontui_filter[] =                                                                             \ | { | 
| "PC-98 BMP font (*.bmp)\0"                                              \ | MAKEINTRESOURCE(IDS_FONTTITLE), | 
| "*.bmp\0"                                                                       \ | MAKEINTRESOURCE(IDS_FONTEXT), | 
| "Virtual98 font\0"                                                              \ | MAKEINTRESOURCE(IDS_FONTFILTER), | 
| "font.rom\0"                                                            \ | 3 | 
| "All supported files\0"                                                 \ | }; | 
| "*.bmp;"                                                                        \ |  | 
| "pc88.fnt;kanji1.rom;kanji2.rom;"                       \ | static const LPTSTR lpszBmpFilter[] = | 
| "font.rom;"                                                                     \ | { | 
| "subsys_c.rom;kanji.rom;"                                       \ | MAKEINTRESOURCE(IDS_BMPFILTER1), | 
| "fnt0808.x1;fnt0816.x1;fnt1616.x1;"                     \ | MAKEINTRESOURCE(IDS_BMPFILTER4), | 
| "cgrom.dat\0"; | MAKEINTRESOURCE(IDS_BMPFILTER8), | 
| static const FILESEL fontui = {fontui_title, str_bmp, fontui_filter, 3}; | MAKEINTRESOURCE(IDS_BMPFILTER24) | 
|  | }; | 
| static const char bmpui_file[] = "NP2_%04d.BMP"; | static const OEMCHAR szBmpFile[] = OEMTEXT("NP2_####.BMP"); | 
| static const char bmpui_title[] = "Save as bitmap file"; |  | 
| static const char bmpui_filter1[] = "1bit-bitmap (*.bmp)\0*.bmp\0"; | void dialog_font(HWND hWnd) | 
| static const char bmpui_filter4[] = "4bit-bitmap (*.bmp)\0*.bmp\0"; | { | 
| static const char bmpui_filter8[] = "8bit-bitmap (*.bmp)\0*.bmp\0"; | OEMCHAR szPath[MAX_PATH]; | 
| static const char *bmpui_filter[3] = { |  | 
| bmpui_filter1, bmpui_filter4, bmpui_filter8}; | file_cpyname(szPath, np2cfg.fontfile, NELEMENTS(szPath)); | 
|  | if ((dlgs_openfile(hWnd, &fpFont, szPath, NELEMENTS(szPath), NULL)) && | 
|  | (font_load(szPath, FALSE))) | 
| void dialog_font(HWND hWnd) { | { | 
|  |  | 
| const char      *p; |  | 
|  |  | 
| p = dlgs_selectfile(hWnd, &fontui, np2cfg.fontfile, NULL, 0, NULL); |  | 
| if ((p != NULL) && (font_load(p, FALSE))) { |  | 
 | gdcs.textdisp |= GDCSCRN_ALLDRAW2; | gdcs.textdisp |= GDCSCRN_ALLDRAW2; | 
| milstr_ncpy(np2cfg.fontfile, p, sizeof(np2cfg.fontfile)); | milstr_ncpy(np2cfg.fontfile, szPath, NELEMENTS(np2cfg.fontfile)); | 
 | sysmng_update(SYS_UPDATECFG); | sysmng_update(SYS_UPDATECFG); | 
 | } | } | 
 | } | } | 
 |  |  | 
 | void dialog_writebmp(HWND hWnd) { | void dialog_writebmp(HWND hWnd) { | 
 |  |  | 
| SCRNBMP bmp; | SCRNSAVE        ss; | 
| FILESEL bmpui; | FSPARAM         fp; | 
| const char      *p; | OEMCHAR         szPath[MAX_PATH]; | 
| FILEH   fh; | const OEMCHAR   *pszExt; | 
|  |  | 
| bmp = scrnbmp(); | ss = scrnsave_get(); | 
| if (bmp) { | if (ss == NULL) | 
| bmpui.title = bmpui_title; | { | 
| bmpui.ext = str_bmp; | return; | 
| bmpui.filter = bmpui_filter[bmp->type]; | } | 
| bmpui.defindex = 1; | fp.lpszTitle = MAKEINTRESOURCE(IDS_BMPTITLE); | 
| p = dlgs_selectwritenum(hWnd, &bmpui, bmpui_file, | fp.lpszDefExt = MAKEINTRESOURCE(IDS_BMPEXT); | 
| bmpfilefolder, sizeof(bmpfilefolder)); | fp.lpszFilter = lpszBmpFilter[ss->type]; | 
| if (p) { | fp.nFilterIndex = 1; | 
| fh = file_create(p); | file_cpyname(szPath, bmpfilefolder, NELEMENTS(szPath)); | 
| if (fh != FILEH_INVALID) { | file_cutname(szPath); | 
| file_write(fh, bmp->ptr, bmp->size); | file_catname(szPath, szBmpFile, NELEMENTS(szPath)); | 
| file_close(fh); | if (dlgs_createfilenum(hWnd, &fp, szPath, NELEMENTS(szPath))) | 
| } | { | 
|  | file_cpyname(bmpfilefolder, szPath, NELEMENTS(bmpfilefolder)); | 
|  | sysmng_update(SYS_UPDATEOSCFG); | 
|  | pszExt = file_getext(szPath); | 
|  | if ((ss->type <= SCRNSAVE_8BIT) && | 
|  | (!file_cmpname(pszExt, OEMTEXT("gif")))) | 
|  | { | 
|  | scrnsave_writegif(ss, szPath, SCRNSAVE_AUTO); | 
|  | } | 
|  | else if (!file_cmpname(pszExt, str_bmp)) | 
|  | { | 
|  | scrnsave_writebmp(ss, szPath, SCRNSAVE_AUTO); | 
 | } | } | 
 | _MFREE(bmp); |  | 
 | } | } | 
 |  | scrnsave_trash(ss); | 
 | } | } | 
 |  |  |