Skip to content

Commit

Permalink
Fix #80
Browse files Browse the repository at this point in the history
  • Loading branch information
katahiromz committed Apr 18, 2024
1 parent 5bd843d commit 243a38d
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 21 deletions.
36 changes: 19 additions & 17 deletions GUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,9 @@ WCHAR xg_szNumberingFileName1[MAX_PATH];
// 連番ファイル名2。
WCHAR xg_szNumberingFileName2[MAX_PATH];

// 「ジャンプ」ダイアログ。
XG_JumpDialog xg_hwndJumpDlg;

//////////////////////////////////////////////////////////////////////////////
// static variables

Expand Down Expand Up @@ -5873,8 +5876,10 @@ void __fastcall XgGoNextPane(HWND hwnd, BOOL bNext)
xg_hHintsWnd,
xg_cands_wnd,
xg_hwndInputPalette,
xg_hMarkingDlg
xg_hMarkingDlg,
xg_hwndJumpDlg
) : make_array<HWND>(
xg_hwndJumpDlg,
xg_hMarkingDlg,
xg_hwndInputPalette,
xg_cands_wnd,
Expand Down Expand Up @@ -5945,22 +5950,14 @@ void __fastcall XgJumpNumber(HWND hwnd, INT nNumber, BOOL bVert)
// ジャンプダイアログ。
void XgJumpDialog(HWND hwnd)
{
XG_JumpDialog dialog;
if (dialog.DoModal(hwnd) == IDOK) {
switch (dialog.m_nType) {
case 0: // マス位置。
xg_caret_pos.m_j = dialog.m_jCol - 1;
xg_caret_pos.m_i = dialog.m_iRow - 1;
// 表示を更新する。
XgEnsureCaretVisible(hwnd);
XgUpdateStatusBar(hwnd);
// すぐに入力できるようにする。
SetFocus(hwnd);
break;
case 1: // カギ位置。
XgJumpNumber(hwnd, dialog.m_nNumber, dialog.m_bVert);
break;
}
if (xg_hwndJumpDlg)
{
::SetFocus(xg_hwndJumpDlg);
}
else
{
xg_hwndJumpDlg.CreateDx(hwnd);
::ShowWindow(xg_hwndJumpDlg, SW_SHOWNORMAL);
}
}

Expand Down Expand Up @@ -8152,6 +8149,11 @@ int WINAPI WinMain(
continue;
}

if (xg_hwndJumpDlg) {
if (::IsDialogMessageW(xg_hwndJumpDlg, &msg))
continue;
}

if (xg_hMarkingDlg) {
if (::IsDialogMessageW(xg_hMarkingDlg, &msg))
continue;
Expand Down
3 changes: 3 additions & 0 deletions GUI.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,7 @@ extern WCHAR xg_szNumberingFileName1[MAX_PATH];
// 連番ファイル名2。
extern WCHAR xg_szNumberingFileName2[MAX_PATH];

// カギにジャンプする。
void __fastcall XgJumpNumber(HWND hwnd, INT nNumber, BOOL bVert);

//////////////////////////////////////////////////////////////////////////////
2 changes: 2 additions & 0 deletions HISTORY.txt
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@
- 2024-XX-YY ver.5.2.5
- This time, we do exclusive control properly.
- Added a function to display the dictionary update date and time.
- The "Jump" dialog has been made modeless.

# 開発履歴 (Japanese)

Expand Down Expand Up @@ -957,3 +958,4 @@
- 2024年XX月YY日 ver.5.2.5
- 今度こそ排他制御をちゃんとする。
- 辞書の更新日時を表示する機能を追加。
- 「ジャンプ」ダイアログをモードレス化した。
27 changes: 23 additions & 4 deletions XG_JumpDialog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,26 @@ class XG_JumpDialog : public XG_Dialog
case IDOK:
if (OnOK(hwnd))
{
::EndDialog(hwnd, id);
switch (m_nType)
{
case 0: // マス位置。
xg_caret_pos.m_j = m_jCol - 1;
xg_caret_pos.m_i = m_iRow - 1;
// 表示を更新する。
XgEnsureCaretVisible(hwnd);
XgUpdateStatusBar(hwnd);
// すぐに入力できるようにする。
SetFocus(hwnd);
break;
case 1: // カギ位置。
XgJumpNumber(hwnd, m_nNumber, m_bVert);
break;
}
}
break;

case IDCANCEL:
::EndDialog(hwnd, id);
EndDialog(IDCANCEL);
break;

case rad1:
Expand Down Expand Up @@ -205,8 +219,13 @@ class XG_JumpDialog : public XG_Dialog
return 0;
}

INT_PTR DoModal(HWND hwnd)
BOOL CreateDx(HWND hwnd) noexcept
{
return CreateDialogDx(hwnd, IDD_JUMP);
}

BOOL EndDialog(INT result)
{
return DialogBoxDx(hwnd, IDD_JUMP);
return ::DestroyWindow(m_hWnd);
}
};

0 comments on commit 243a38d

Please sign in to comment.