Skip to content

Commit

Permalink
fix cloning
Browse files Browse the repository at this point in the history
  • Loading branch information
katahiromz committed May 14, 2019
1 parent 3ab3889 commit 828c070
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 7 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 4 additions & 1 deletion README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.]
Expand Down
5 changes: 4 additions & 1 deletion READMEJP.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.]
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
44 changes: 43 additions & 1 deletion src/RisohEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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'))

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
{
Expand All @@ -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)
{
Expand All @@ -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)
{
Expand All @@ -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
{
Expand All @@ -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);
}
}
}
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/lang/en_US.rc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 828c070

Please sign in to comment.