Skip to content

Commit

Permalink
add zoom settings
Browse files Browse the repository at this point in the history
  • Loading branch information
katahiromz committed Apr 2, 2024
1 parent a571e76 commit f694f96
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 1 deletion.
38 changes: 38 additions & 0 deletions GUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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;

Expand Down Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion lang/en_US.rc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
}

//////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -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"
Expand Down
3 changes: 3 additions & 0 deletions lang/ja_JP.rc
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

//////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -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, "問題を開く"
Expand Down
1 change: 1 addition & 0 deletions resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f694f96

Please sign in to comment.