|
|
| version 1.1.1.1, 2003/10/16 17:59:03 | version 1.6, 2004/06/22 04:33:49 |
|---|---|
| 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 "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 char fontui_title[] = "Select font file"; |
| Line 29 static const FILESEL fontui = {fontui_ti | Line 29 static const FILESEL fontui = {fontui_ti |
| static const char bmpui_file[] = "NP2_%04d.BMP"; | static const char bmpui_file[] = "NP2_%04d.BMP"; |
| static const char bmpui_title[] = "Save as bitmap file"; | static const char bmpui_title[] = "Save as bitmap file"; |
| static const char bmpui_filter1[] = "1bit-bitmap (*.bmp)\0*.bmp\0"; | static const char bmpui_filter1[] = "1bit-bitmap (*.bmp)\0*.bmp\0" \ |
| static const char bmpui_filter4[] = "4bit-bitmap (*.bmp)\0*.bmp\0"; | "Graphics Interchange Format (*.gif)\0*.gif\0"; |
| static const char bmpui_filter8[] = "8bit-bitmap (*.bmp)\0*.bmp\0"; | static const char bmpui_filter4[] = "4bit-bitmap (*.bmp)\0*.bmp\0" \ |
| static const char *bmpui_filter[3] = { | "Graphics Interchange Format (*.gif)\0*.gif\0"; |
| bmpui_filter1, bmpui_filter4, bmpui_filter8}; | static const char bmpui_filter8[] = "8bit-bitmap (*.bmp)\0*.bmp\0" \ |
| "Graphics Interchange Format (*.gif)\0*.gif\0"; | |
| static const char bmpui_filter24[] = "24bit-bitmap (*.bmp)\0*.bmp\0"; | |
| static const char *bmpui_filter[4] = { | |
| bmpui_filter1, bmpui_filter4, bmpui_filter8, bmpui_filter24}; | |
| void dialog_font(HWND hWnd) { | void dialog_font(HWND hWnd) { |
| const char *p; | char path[MAX_PATH]; |
| p = dlgs_selectfile(hWnd, &fontui, np2cfg.fontfile, NULL, 0, NULL); | file_cpyname(path, np2cfg.fontfile, sizeof(path)); |
| if ((p != NULL) && (font_load(p, FALSE))) { | if ((dlgs_selectfile(hWnd, &fontui, path, sizeof(path), NULL)) && |
| (font_load(path, FALSE))) { | |
| gdcs.textdisp |= GDCSCRN_ALLDRAW2; | gdcs.textdisp |= GDCSCRN_ALLDRAW2; |
| milstr_ncpy(np2cfg.fontfile, p, sizeof(np2cfg.fontfile)); | milstr_ncpy(np2cfg.fontfile, path, sizeof(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; | FILESEL bmpui; |
| const char *p; | char path[MAX_PATH]; |
| FILEH fh; | const char *ext; |
| bmp = scrnbmp(); | ss = scrnsave_get(); |
| if (bmp) { | if (ss == NULL) { |
| bmpui.title = bmpui_title; | return; |
| bmpui.ext = str_bmp; | } |
| bmpui.filter = bmpui_filter[bmp->type]; | bmpui.title = bmpui_title; |
| bmpui.defindex = 1; | bmpui.ext = str_bmp; |
| p = dlgs_selectwritenum(hWnd, &bmpui, bmpui_file, | bmpui.filter = bmpui_filter[ss->type]; |
| bmpfilefolder, sizeof(bmpfilefolder)); | bmpui.defindex = 1; |
| if (p) { | file_cpyname(path, bmpfilefolder, sizeof(path)); |
| fh = file_create(p); | file_cutname(path); |
| if (fh != FILEH_INVALID) { | file_catname(path, bmpui_file, sizeof(path)); |
| file_write(fh, bmp->ptr, bmp->size); | if (dlgs_selectwritenum(hWnd, &bmpui, path, sizeof(path))) { |
| file_close(fh); | file_cpyname(bmpfilefolder, path, sizeof(bmpfilefolder)); |
| } | sysmng_update(SYS_UPDATEOSCFG); |
| ext = file_getext(path); | |
| if ((ss->type <= SCRNSAVE_8BIT) && | |
| (!file_cmpname(ext, "gif"))) { | |
| scrnsave_writegif(ss, path, SCRNSAVE_AUTO); | |
| } | |
| else if (!file_cmpname(ext, str_bmp)) { | |
| scrnsave_writebmp(ss, path, SCRNSAVE_AUTO); | |
| } | } |
| _MFREE(bmp); | |
| } | } |
| scrnsave_trash(ss); | |
| } | } |