diff --git a/EGA b/EGA index daa114a5..c10ea2bb 160000 --- a/EGA +++ b/EGA @@ -1 +1 @@ -Subproject commit daa114a5cfe8421cc4dd66e73333517e5c93a456 +Subproject commit c10ea2bb44d62a55a99fb0d3e776d59ecaec7daa diff --git a/README.md b/README.md index f574b594..ab4c3f87 100644 --- a/README.md +++ b/README.md @@ -290,9 +290,10 @@ You have to copy the 64-bit file into another place before loading. - Updated mcpp.exe and dfmsc.exe. - v.5.5.9 (2021.06.16) - Fixed loading resource.h macros. -- v.5.6.0 (2021.XX.YY) +- v.5.6.0 (2021.06.19) - Don't compress dfmsc.exe (for security). - Supported command line. + - Added RES_load and RES_save functions to EGA language. ## Contact Us diff --git a/README.txt b/README.txt index 663328d3..6630a57f 100644 --- a/README.txt +++ b/README.txt @@ -281,9 +281,10 @@ Question 6. Are the 64-bit files supported? - Updated mcpp.exe and dfmsc.exe. - v.5.5.9 (2021.06.16) - Fixed loading resource.h macros. -- v.5.6.0 (2021.XX.YY) +- v.5.6.0 (2021.06.19) - Don't compress dfmsc.exe (for security). - Supported command line. + - Added RES_load and RES_save functions to EGA language. ///////////////////////////////////////////////////////////////////// Katayama Hirofumi MZ (katahiromz) [A.N.T.] diff --git a/READMEIT.txt b/READMEIT.txt index b8a01734..af78a4ee 100644 --- a/READMEIT.txt +++ b/READMEIT.txt @@ -281,9 +281,10 @@ Domanda 6. I file a 64 bit sono supportati? - Updated mcpp.exe and dfmsc.exe. - v.5.5.9 (16.06.2021) - Fixed loading resource.h macros. -- v.5.6.0 (2021.XX.YY) +- v.5.6.0 (19.06.2021) - Don't compress dfmsc.exe (for security). - Supported command line. + - Added RES_load and RES_save functions to EGA language. ///////////////////////////////////////////////////////////////////// // Katayama Hirofumi MZ (katahiromz) [A.N.T.] diff --git a/READMEJP.txt b/READMEJP.txt index ce63fccf..6e232f2e 100644 --- a/READMEJP.txt +++ b/READMEJP.txt @@ -623,9 +623,10 @@ mcpp.exe と dfmsc.exe を更新。 v.5.5.9 (2021.06.16) resource.hのマクロ読み込みを修正。 - v.5.6.0 (2021.XX.YY) + v.5.6.0 (2021.06.19) dfmsc.exe を圧縮しない(安全のため)。 コマンドラインをサポート。 + RES_loadとRES_save関数をEGA言語に追加。 ///////////////////////////////////////////////////// // 片山博文MZ (katahiromz) [A.N.T.] diff --git a/READMEKO.txt b/READMEKO.txt index d12e6f40..0c33afa9 100644 --- a/READMEKO.txt +++ b/READMEKO.txt @@ -281,9 +281,10 @@ Windows XP/2003/Vista/7/8.1/10 및 ReactOS에서 작동합니다. - Updated mcpp.exe and dfmsc.exe. - v.5.5.9 (2021.06.16) - Fixed loading resource.h macros. -- v.5.6.0 (2021.XX.YY) +- v.5.6.0 (2021.06.19) - Don't compress dfmsc.exe (for security). - Supported command line. + - Added RES_load and RES_save functions to EGA language. ///////////////////////////////////////////////////////////////////// Katayama Hirofumi MZ (katahiromz) [A.N.T.] diff --git a/src/RisohEditor.cpp b/src/RisohEditor.cpp index e1a1b861..e05aa45f 100644 --- a/src/RisohEditor.cpp +++ b/src/RisohEditor.cpp @@ -24,8 +24,6 @@ BOOL g_bNoGuiMode = FALSE; // No-GUI mode LPWSTR g_pszLogFile = NULL; -MStringW g_load_options; -MStringW g_save_options; INT LogMessageBoxW(HWND hwnd, LPCWSTR text, LPCWSTR title, UINT uType) { @@ -2172,6 +2170,8 @@ class MMainWnd : public MWindowBase public: MDropdownArrow m_arrow; // the language drop-down arrow MStringW m_commands; + MStringW m_load_options; + MStringW m_save_options; BOOL ParseCommandLine(HWND hwnd, INT argc, WCHAR **targv); @@ -2351,6 +2351,11 @@ class MMainWnd : public MWindowBase BOOL DoItemSearch(ITEM_SEARCH& search); BOOL DoItemSearchBang(HWND hwnd, MItemSearchDlg *pDialog); + bool DoResLoad(const MStringW& filename, const MStringW& options = L""); + bool DoResSave(const MStringW& filename, const MStringW& options = L""); + + EGA::arg_t DoEgaResLoad(const EGA::args_t& args); + EGA::arg_t DoEgaResSave(const EGA::args_t& args); EGA::arg_t DoEgaResSearch(const EGA::args_t& args); EGA::arg_t DoEgaResDelete(const EGA::args_t& args); EGA::arg_t DoEgaResCloneByName(const EGA::args_t& args); @@ -11474,55 +11479,14 @@ void MMainWnd::OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify) if (command.find(L"load:") == 0) { command = command.substr(5); - - BOOL bAutoLoadNearbyResH = g_settings.bAutoLoadNearbyResH; - g_settings.bAutoLoadNearbyResH = g_load_options.find(L"(no-load-res-h)") != g_load_options.npos; - { - DoLoadFile(hwnd, command.c_str(), 0, TRUE); - } - g_settings.bAutoLoadNearbyResH = bAutoLoadNearbyResH; + DoResLoad(command, m_load_options); continue; } if (command.find(L"save:") == 0) { command = command.substr(5); - BOOL bUseIDC_STATIC = g_settings.bUseIDC_STATIC; - BOOL bAskUpdateResH = g_settings.bAskUpdateResH; - BOOL bCompressByUPX = g_settings.bCompressByUPX; - BOOL bSepFilesByLang = g_settings.bSepFilesByLang; - BOOL bStoreToResFolder = g_settings.bStoreToResFolder; - BOOL bSelectableByMacro = g_settings.bSelectableByMacro; - BOOL bRedundantComments = g_settings.bRedundantComments; - BOOL bWrapManifest = g_settings.bWrapManifest; - BOOL bUseBeginEnd = g_settings.bUseBeginEnd; - BOOL bRCFileUTF16 = g_settings.bRCFileUTF16; - BOOL bBackup = g_settings.bBackup; - g_settings.bUseIDC_STATIC = g_save_options.find(L"(idc-static)") != g_save_options.npos; - g_settings.bAskUpdateResH = FALSE; - g_settings.bCompressByUPX = g_save_options.find(L"(compress)") != g_save_options.npos; - g_settings.bSepFilesByLang = g_save_options.find(L"(sep-lang)") != g_save_options.npos; - g_settings.bStoreToResFolder = g_save_options.find(L"(no-res-folder)") == g_save_options.npos; - g_settings.bSelectableByMacro = g_save_options.find(L"(lang-macro)") != g_save_options.npos; - g_settings.bRedundantComments = g_save_options.find(L"(less-comments)") == g_save_options.npos; - g_settings.bWrapManifest = g_save_options.find(L"(wrap-manifest)") != g_save_options.npos; - g_settings.bUseBeginEnd = g_save_options.find(L"(begin-end)") != g_save_options.npos; - g_settings.bRCFileUTF16 = g_save_options.find(L"(utf-16)") != g_save_options.npos; - g_settings.bBackup = g_save_options.find(L"(backup)") != g_save_options.npos; - { - DoSaveFile(hwnd, command.c_str()); - } - g_settings.bUseIDC_STATIC = bUseIDC_STATIC; - g_settings.bAskUpdateResH = bAskUpdateResH; - g_settings.bCompressByUPX = bCompressByUPX; - g_settings.bSepFilesByLang = bSepFilesByLang; - g_settings.bStoreToResFolder = bStoreToResFolder; - g_settings.bSelectableByMacro = bSelectableByMacro; - g_settings.bRedundantComments = bRedundantComments; - g_settings.bWrapManifest = bWrapManifest; - g_settings.bUseBeginEnd = bUseBeginEnd; - g_settings.bRCFileUTF16 = bRCFileUTF16; - g_settings.bBackup = bBackup; + DoResSave(command, m_save_options); continue; } } @@ -15927,6 +15891,76 @@ MStringW GetRisohTemplate(const MIdOrString& type, WORD wLang) static MMainWnd *s_pMainWnd = NULL; +bool MMainWnd::DoResLoad(const MStringW& filename, const MStringW& options) +{ + bool bOK; + BOOL bNoGuiMode = g_bNoGuiMode; + g_bNoGuiMode = TRUE; + BOOL bAutoLoadNearbyResH = g_settings.bAutoLoadNearbyResH; + g_settings.bAutoLoadNearbyResH = options.find(L"(no-load-res-h)") != options.npos; + { + bOK = !!DoLoadFile(m_hwnd, filename.c_str(), 0, TRUE); + } + g_settings.bAutoLoadNearbyResH = bAutoLoadNearbyResH; + g_bNoGuiMode = bNoGuiMode; + return bOK; +} + +bool MMainWnd::DoResSave(const MStringW& filename, const MStringW& options) +{ + bool bOK; + BOOL bNoGuiMode = g_bNoGuiMode; + g_bNoGuiMode = TRUE; + BOOL bUseIDC_STATIC = g_settings.bUseIDC_STATIC; + BOOL bAskUpdateResH = g_settings.bAskUpdateResH; + BOOL bCompressByUPX = g_settings.bCompressByUPX; + BOOL bSepFilesByLang = g_settings.bSepFilesByLang; + BOOL bStoreToResFolder = g_settings.bStoreToResFolder; + BOOL bSelectableByMacro = g_settings.bSelectableByMacro; + BOOL bRedundantComments = g_settings.bRedundantComments; + BOOL bWrapManifest = g_settings.bWrapManifest; + BOOL bUseBeginEnd = g_settings.bUseBeginEnd; + BOOL bRCFileUTF16 = g_settings.bRCFileUTF16; + BOOL bBackup = g_settings.bBackup; + g_settings.bUseIDC_STATIC = options.find(L"(idc-static)") != options.npos; + g_settings.bAskUpdateResH = FALSE; + g_settings.bCompressByUPX = options.find(L"(compress)") != options.npos; + g_settings.bSepFilesByLang = options.find(L"(sep-lang)") != options.npos; + g_settings.bStoreToResFolder = options.find(L"(no-res-folder)") == options.npos; + g_settings.bSelectableByMacro = options.find(L"(lang-macro)") != options.npos; + g_settings.bRedundantComments = options.find(L"(less-comments)") == options.npos; + g_settings.bWrapManifest = options.find(L"(wrap-manifest)") != options.npos; + g_settings.bUseBeginEnd = options.find(L"(begin-end)") != options.npos; + g_settings.bRCFileUTF16 = options.find(L"(utf-16)") != options.npos; + g_settings.bBackup = options.find(L"(backup)") != options.npos; + { + bOK = !!DoSaveFile(m_hwnd, filename.c_str()); + } + g_settings.bUseIDC_STATIC = bUseIDC_STATIC; + g_settings.bAskUpdateResH = bAskUpdateResH; + g_settings.bCompressByUPX = bCompressByUPX; + g_settings.bSepFilesByLang = bSepFilesByLang; + g_settings.bStoreToResFolder = bStoreToResFolder; + g_settings.bSelectableByMacro = bSelectableByMacro; + g_settings.bRedundantComments = bRedundantComments; + g_settings.bWrapManifest = bWrapManifest; + g_settings.bUseBeginEnd = bUseBeginEnd; + g_settings.bRCFileUTF16 = bRCFileUTF16; + g_settings.bBackup = bBackup; + g_bNoGuiMode = bNoGuiMode; + return bOK; +} + +EGA::arg_t EGA_FN EGA_RES_load(const EGA::args_t& args) +{ + return s_pMainWnd->DoEgaResLoad(args); +} + +EGA::arg_t EGA_FN EGA_RES_save(const EGA::args_t& args) +{ + return s_pMainWnd->DoEgaResSave(args); +} + EGA::arg_t EGA_FN EGA_RES_search(const EGA::args_t& args) { return s_pMainWnd->DoEgaResSearch(args); @@ -16003,6 +16037,56 @@ EGA::arg_t EGA_set_id_or_str(const MIdOrString& id) } } +EGA::arg_t MMainWnd::DoEgaResLoad(const EGA::args_t& args) +{ + using namespace EGA; + arg_t arg0, arg1; + + if (args.size() >= 1) + arg0 = EGA_eval_arg(args[0], true); + if (args.size() >= 2) + arg1 = EGA_eval_arg(args[1], false); + + bool ret; + MAnsiToWide str0(CP_UTF8, EGA_get_str(arg0)); + if (args.size() >= 2) + { + MAnsiToWide str1(CP_UTF8, EGA_get_str(arg1)); + ret = DoResLoad(str0.c_str(), str1.c_str()); + } + else + { + ret = DoResLoad(str0.c_str(), L""); + } + + return make_arg(ret); +} + +EGA::arg_t MMainWnd::DoEgaResSave(const EGA::args_t& args) +{ + using namespace EGA; + arg_t arg0, arg1; + + if (args.size() >= 1) + arg0 = EGA_eval_arg(args[0], true); + if (args.size() >= 2) + arg1 = EGA_eval_arg(args[1], false); + + bool ret; + MAnsiToWide str0(CP_UTF8, EGA_get_str(arg0)); + if (args.size() >= 2) + { + MAnsiToWide str1(CP_UTF8, EGA_get_str(arg1)); + ret = DoResSave(str0.c_str(), str1.c_str()); + } + else + { + ret = DoResSave(str0.c_str(), L""); + } + + return make_arg(ret); +} + EGA::arg_t MMainWnd::DoEgaResSearch(const EGA::args_t& args) { using namespace EGA; @@ -16391,6 +16475,8 @@ void EGA_extension(void) EGA_add_fn("RES_get_binary", 0, 3, EGA_RES_get_binary, "RES_get_binary([type[, name[, lang]]])"); EGA_add_fn("RES_set_binary", 4, 4, EGA_RES_set_binary, "RES_set_binary(type, name, lang, bin)"); EGA_add_fn("RES_const", 1, 1, EGA_RES_const, "RES_const(name)"); + EGA_add_fn("RES_load", 1, 2, EGA_RES_load, "RES_load(filename[, options])"); + EGA_add_fn("RES_save", 1, 2, EGA_RES_save, "RES_save(filename[, options])"); EGA_add_fn("RES_search", 0, 3, EGA_RES_search, "RES_search([type[, name[, lang]]])"); EGA_add_fn("RES_select", 0, 3, EGA_RES_select, "RES_select([type[, name[, lang]]])"); EGA_add_fn("RES_unload_resh", 0, 0, EGA_RES_unload_resh, "EGA_RES_unload_resh()"); @@ -16444,7 +16530,7 @@ BOOL MMainWnd::ParseCommandLine(HWND hwnd, INT argc, WCHAR **targv) lstrcmpiW(arg, L"--load-options") == 0) { arg = targv[++iarg]; - g_load_options = arg; + m_load_options = arg; continue; } @@ -16461,7 +16547,7 @@ BOOL MMainWnd::ParseCommandLine(HWND hwnd, INT argc, WCHAR **targv) lstrcmpiW(arg, L"--save-options") == 0) { arg = targv[++iarg]; - g_save_options = arg; + m_save_options = arg; continue; }