diff --git a/README.md b/README.md index 4cdba41a..a5023469 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,10 @@ It's a special message compiler I made. See mcdx/MESSAGETABLEDX.md for details. * 2019.03.20 ver.5.1.7 - Add PBS_MARQUEE and PBS_SMOOTHREVERSE styles. - Fix the process of compilation error. - * 2019.XX.YY ver.5.1.8 + * 2019.05.14 ver.5.1.8 + - Add check of recompilation upon cloning. + - Fix the selection after cloning. + - Correctly fail upon compilation error of string table and message table. ## Contact Us diff --git a/README.txt b/README.txt index abc2b410..0a3e4009 100644 --- a/README.txt +++ b/README.txt @@ -93,7 +93,10 @@ Question 4. What is mcdx? * 2019.03.20 ver.5.1.7 - Add PBS_MARQUEE and PBS_SMOOTHREVERSE styles. - Fix the process of compilation error. - * 2019.XX.YY ver.5.1.8 + * 2019.05.14 ver.5.1.8 + - Add check of recompilation upon cloning. + - Fix the selection after cloning. + - Correctly fail upon compilation error of string table and message table. ///////////////////////////////////////////////////// // Katayama Hirofumi MZ (katahiromz) [A.N.T.] diff --git a/READMEJP.txt b/READMEJP.txt index d647a4e5..fa005368 100644 --- a/READMEJP.txt +++ b/READMEJP.txt @@ -412,7 +412,10 @@ 2019.03.20 ver.5.1.7 PBS_MARQUEEとPBS_SMOOTHREVERSEスタイルを追加。 コンパイルエラーの処理を修正。 - 2019.XX.YY ver.5.1.8 + 2019.05.14 ver.5.1.8 + 「別の名前で複製」と「別の言語で複製」で再コンパイルのチェックを追加。 + 「別の名前で複製」と「別の言語で複製」で複製後の選択を修正。 + 文字列テーブルとメッセージテーブルのコンパイルエラーでちゃんと失敗。 ///////////////////////////////////////////////////// // 片山博文MZ (katahiromz) [A.N.T.] diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b6ccc09a..56ac9898 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -42,7 +42,7 @@ add_executable(RisohEditor WIN32 RisohEditor.cpp RisohEditor_res.rc res/Manifest_1.manifest) -target_link_libraries(RisohEditor comctl32 msimg32 winmm gdiplus vfw32 oledlg msimg32) +target_link_libraries(RisohEditor comctl32 msimg32 winmm gdiplus vfw32 oledlg msimg32 advapi32) target_compile_definitions(RisohEditor PRIVATE -DUNICODE -D_UNICODE) # resource object extension diff --git a/src/RisohEditor.cpp b/src/RisohEditor.cpp index 7ff73d94..81bffbb8 100644 --- a/src/RisohEditor.cpp +++ b/src/RisohEditor.cpp @@ -77,7 +77,6 @@ BOOL IsFileLockedDx(LPCTSTR pszFileName) return TRUE; } - // "." or ".." #define IS_DOTS(psz) ((psz)[0] == '.' && ((psz)[1] == '\0' || (psz)[1] == '.' && (psz)[2] == '\0')) @@ -3205,6 +3204,10 @@ BOOL MMainWnd::DoItemSearch(ITEM_SEARCH& search) // clone the resource item in new name void MMainWnd::OnCopyAsNewName(HWND hwnd) { + // compile if necessary + if (!CompileIfNecessary(FALSE)) + return; + // get the selected name entry auto entry = g_res.get_entry(); if (!entry || entry->m_et != ET_NAME) @@ -3248,6 +3251,10 @@ void MMainWnd::OnCopyAsNewName(HWND hwnd) // clone the resource item in new language void MMainWnd::OnCopyAsNewLang(HWND hwnd) { + // compile if necessary + if (!CompileIfNecessary(FALSE)) + return; + // get the selected entry auto entry = g_res.get_entry(); if (!entry) @@ -3277,6 +3284,9 @@ void MMainWnd::OnCopyAsNewLang(HWND hwnd) { g_res.copy_group_icon(e, e->m_name, dialog.m_lang); } + + // select the entry + SelectTV(ET_LANG, dialog.m_type, dialog.m_name, dialog.m_lang, FALSE); } else if (entry->m_type == RT_GROUP_CURSOR) { @@ -3289,6 +3299,9 @@ void MMainWnd::OnCopyAsNewLang(HWND hwnd) { g_res.copy_group_cursor(e, e->m_name, dialog.m_lang); } + + // select the entry + SelectTV(ET_LANG, dialog.m_type, dialog.m_name, dialog.m_lang, FALSE); } else if (entry->m_et == ET_STRING) { @@ -3301,6 +3314,9 @@ void MMainWnd::OnCopyAsNewLang(HWND hwnd) { g_res.add_lang_entry(e->m_type, e->m_name, dialog.m_lang, e->m_data); } + + // select the entry + SelectTV(ET_STRING, dialog.m_type, WORD(0), dialog.m_lang, FALSE); } else if (entry->m_et == ET_MESSAGE) { @@ -3313,6 +3329,9 @@ void MMainWnd::OnCopyAsNewLang(HWND hwnd) { g_res.add_lang_entry(e->m_type, e->m_name, dialog.m_lang, e->m_data); } + + // select the entry + SelectTV(ET_MESSAGE, dialog.m_type, WORD(0), dialog.m_lang, FALSE); } else { @@ -3325,6 +3344,9 @@ void MMainWnd::OnCopyAsNewLang(HWND hwnd) { g_res.add_lang_entry(e->m_type, e->m_name, dialog.m_lang, e->m_data); } + + // select the entry + SelectTV(ET_LANG, dialog.m_type, dialog.m_name, dialog.m_lang, FALSE); } } } @@ -5606,6 +5628,12 @@ BOOL MMainWnd::CompileStringTable(MStringA& strOutput, const MIdOrString& name, // clean res up res.delete_all(); } + else + { + bOK = FALSE; + // error message + strOutput = MWideToAnsi(CP_ACP, LoadStringDx(IDS_COMPILEERROR)); + } } else { @@ -5730,6 +5758,12 @@ BOOL MMainWnd::CompileMessageTable(MStringA& strOutput, const MIdOrString& name, // clean res up res.delete_all(); } + else + { + bOK = FALSE; + // error message + strOutput = MWideToAnsi(CP_ACP, LoadStringDx(IDS_COMPILEERROR)); + } } else { @@ -9313,6 +9347,10 @@ void MMainWnd::OnAddBang(HWND hwnd, NMTOOLBAR *pToolBar) void MMainWnd::OnClone(HWND hwnd) { + // compile if necessary + if (!CompileIfNecessary(FALSE)) + return; + auto entry = g_res.get_entry(); if (!entry) return; @@ -10083,6 +10121,10 @@ LRESULT MMainWnd::OnNotify(HWND hwnd, int idFrom, NMHDR *pnmhdr) return TRUE; case VK_F2: { + // compile if necessary + if (!CompileIfNecessary(FALSE)) + return TRUE; + // get the selected type entry auto entry = g_res.get_entry(); if (!entry || entry->m_et == ET_TYPE) diff --git a/src/lang/en_US.rc b/src/lang/en_US.rc index 93f6ed22..e860a6b0 100644 --- a/src/lang/en_US.rc +++ b/src/lang/en_US.rc @@ -165,8 +165,8 @@ IDR_POPUPMENUS MENU MENUITEM SEPARATOR MENUITEM "C&hange Name/Language\tF2", ID_EDITLABEL MENUITEM SEPARATOR - MENUITEM "Clone As New &Name...", ID_COPYASNEWNAME - MENUITEM "Clone As New &Language...", ID_COPYASNEWLANG + MENUITEM "Clone In New &Name...", ID_COPYASNEWNAME + MENUITEM "Clone In New &Language...", ID_COPYASNEWLANG MENUITEM SEPARATOR MENUITEM "Do &Test", ID_TEST MENUITEM SEPARATOR