From f694f96c9e6ca9812a20ff07d9085e33a34c1739 Mon Sep 17 00:00:00 2001 From: Katayama Hirofumi MZ Date: Tue, 2 Apr 2024 11:38:36 +0900 Subject: [PATCH] add zoom settings --- GUI.cpp | 38 ++++++++++++++++++++++++++++++++++++++ lang/en_US.rc | 5 ++++- lang/ja_JP.rc | 3 +++ resource.h | 1 + 4 files changed, 46 insertions(+), 1 deletion(-) diff --git a/GUI.cpp b/GUI.cpp index 79242f9..29a2c0d 100644 --- a/GUI.cpp +++ b/GUI.cpp @@ -5729,6 +5729,8 @@ FileSettingsDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) INT_PTR CALLBACK ViewSettingsDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { + static XGStringW s_strFit; + switch (uMsg) { case WM_INITDIALOG: @@ -5761,6 +5763,19 @@ ViewSettingsDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ::EnableWindow(::GetDlgItem(hwnd, chx4), FALSE); ::EnableWindow(::GetDlgItem(hwnd, chx5), FALSE); } + // ズームを初期化。 + s_strFit = XgLoadStringDx1(IDS_FITWHOLE); + ::SendDlgItemMessageW(hwnd, cmb1, CB_ADDSTRING, 0, (LPARAM)s_strFit.c_str()); + ::SendDlgItemMessageW(hwnd, cmb1, CB_ADDSTRING, 0, (LPARAM)L"10 %"); + ::SendDlgItemMessageW(hwnd, cmb1, CB_ADDSTRING, 0, (LPARAM)L"30 %"); + ::SendDlgItemMessageW(hwnd, cmb1, CB_ADDSTRING, 0, (LPARAM)L"50 %"); + ::SendDlgItemMessageW(hwnd, cmb1, CB_ADDSTRING, 0, (LPARAM)L"65 %"); + ::SendDlgItemMessageW(hwnd, cmb1, CB_ADDSTRING, 0, (LPARAM)L"80 %"); + ::SendDlgItemMessageW(hwnd, cmb1, CB_ADDSTRING, 0, (LPARAM)L"90 %"); + ::SendDlgItemMessageW(hwnd, cmb1, CB_ADDSTRING, 0, (LPARAM)L"100 %"); + ::SendDlgItemMessageW(hwnd, cmb1, CB_ADDSTRING, 0, (LPARAM)L"200 %"); + ::SendDlgItemMessageW(hwnd, cmb1, CB_ADDSTRING, 0, (LPARAM)L"300 %"); + ::SetDlgItemTextW(hwnd, cmb1, (to_XGStringW(xg_nZoomRate) + L" %").c_str()); return TRUE; case WM_COMMAND: @@ -5781,6 +5796,13 @@ ViewSettingsDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) if (HIWORD(wParam) == BN_CLICKED) PropSheet_Changed(GetParent(hwnd), hwnd); break; + case cmb1: + if (HIWORD(wParam) == CBN_EDITCHANGE || + HIWORD(wParam) == CBN_SELCHANGE || + HIWORD(wParam) == CBN_SELENDOK) + { + PropSheet_Changed(GetParent(hwnd), hwnd); + } } break; @@ -5808,6 +5830,22 @@ ViewSettingsDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) xg_bLowercase = (::IsDlgButtonChecked(hwnd, chx11) == BST_CHECKED); xg_bHiragana = (::IsDlgButtonChecked(hwnd, chx12) == BST_CHECKED); + // コンボボックスの設定を適用する。 + WCHAR szText[128]; + GetDlgItemTextW(hwnd, cmb1, szText, _countof(szText)); + if (s_strFit == szText) { + SendMessage(xg_hMainWnd, WM_COMMAND, ID_FITZOOM, 0); + } else { + INT nRate = _wtoi(szText); + if (nRate == 0) + nRate = 100; + if (nRate < 10) + nRate = 10; + if (nRate > 300) + nRate = 300; + XgSetZoomRate(xg_hMainWnd, nRate); + } + if (xg_bShowToolBar) ::ShowWindow(xg_hToolBar, SW_SHOWNOACTIVATE); else diff --git a/lang/en_US.rc b/lang/en_US.rc index 279187f..b4812a0 100644 --- a/lang/en_US.rc +++ b/lang/en_US.rc @@ -1520,7 +1520,7 @@ FONT 9, "Tahoma" PUSHBUTTON "Open &Folder", psh2, 110, 115, 95, 15 } -IDD_VIEWSETTINGS DIALOG 0, 0, 220, 152 +IDD_VIEWSETTINGS DIALOG 0, 0, 220, 171 CAPTION "表示設定" STYLE DS_CENTER | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION FONT 9, "Tahoma" @@ -1537,6 +1537,8 @@ FONT 9, "Tahoma" AUTOCHECKBOX "NumCro &mode", chx10, 115, 45, 95, 15 AUTOCHECKBOX "lo&wercase", chx11, 115, 65, 95, 15 AUTOCHECKBOX "&Hiragana", chx12, 115, 85, 95, 15 + RTEXT "&Zoom:", -1, 15, 150, 35, 10, SS_CENTERIMAGE + COMBOBOX cmb1, 60, 150, 95, 300, CBS_HASSTRINGS | CBS_AUTOHSCROLL | CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP } ////////////////////////////////////////////////////////////////////////////// @@ -1781,6 +1783,7 @@ STRINGTABLE IDS_OUTOFRANGE, "Out of range." IDS_GENERALSETTINGS, "General settings" IDS_MADEPROBLEM2, "I've generated a crossword and saved as '%s'.\n\nCalculation time: %u.%u[sec]" + IDS_FITWHOLE, "Fit the whole" IDS_TT_NEW, "New crossword" IDS_TT_GENERATE, "Generate crossword" IDS_TT_OPEN, "Open crossword" diff --git a/lang/ja_JP.rc b/lang/ja_JP.rc index 83f33c9..658961a 100644 --- a/lang/ja_JP.rc +++ b/lang/ja_JP.rc @@ -1540,6 +1540,8 @@ FONT 9, "MS UI Gothic" AUTOCHECKBOX "ナンクロモード(&M)", chx10, 115, 45, 95, 15 AUTOCHECKBOX "lo&wercase", chx11, 115, 65, 95, 15 AUTOCHECKBOX "ひらがな(&H)", chx12, 115, 85, 95, 15 + RTEXT "ズーム(&Z):", -1, 15, 150, 35, 10, SS_CENTERIMAGE + COMBOBOX cmb1, 60, 150, 95, 300, CBS_HASSTRINGS | CBS_AUTOHSCROLL | CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP } ////////////////////////////////////////////////////////////////////////////// @@ -1784,6 +1786,7 @@ STRINGTABLE IDS_OUTOFRANGE, "範囲外です。" IDS_GENERALSETTINGS, "全般設定" IDS_MADEPROBLEM2, "問題の生成とファイル「%s」への保存に成功しました。\n\n計算時間: %u.%u[秒]" + IDS_FITWHOLE, "全体に合わせる" IDS_TT_NEW, "新規作成" IDS_TT_GENERATE, "問題を自動生成する" IDS_TT_OPEN, "問題を開く" diff --git a/resource.h b/resource.h index 7a79e8e..b003413 100644 --- a/resource.h +++ b/resource.h @@ -249,6 +249,7 @@ #define IDS_OUTOFRANGE 328 #define IDS_GENERALSETTINGS 329 #define IDS_MADEPROBLEM2 330 +#define IDS_FITWHOLE 331 #define IDS_TT_NEW 10100 #define IDS_TT_GENERATE 10101 #define IDS_TT_OPEN 10102