Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
katahiromz committed Apr 2, 2024
1 parent f985143 commit 1abfb37
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 18 deletions.
31 changes: 31 additions & 0 deletions GUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ BOOL xg_bMainWndMaximized = FALSE;
// 二重マス文字を表示するか?
BOOL xg_bShowDoubleFrameLetters = TRUE;

// 二重マスを表示するか?
BOOL xg_bShowDoubleFrame = TRUE;

// 保存先のパスのリスト。
std::deque<XGStringW> xg_dirs_save_to;

Expand Down Expand Up @@ -843,6 +846,7 @@ void XgResetSettings(void)
xg_bShowNumbering = TRUE;
xg_bShowCaret = TRUE;
xg_bShowDoubleFrameLetters = TRUE;
xg_bShowDoubleFrame = TRUE;

xg_bHiragana = FALSE;
xg_bLowercase = FALSE;
Expand Down Expand Up @@ -1097,6 +1101,9 @@ bool __fastcall XgLoadSettings(void)
if (!app_key.QueryDword(L"ShowDoubleFrameLetters", dwValue)) {
xg_bShowDoubleFrameLetters = !!dwValue;
}
if (!app_key.QueryDword(L"ShowDoubleFrame", dwValue)) {
xg_bShowDoubleFrame = !!dwValue;
}
if (!app_key.QueryDword(L"ViewMode", dwValue)) {
xg_nViewMode = static_cast<XG_VIEW_MODE>(dwValue);
if (xg_nViewMode != XG_VIEW_NORMAL && xg_nViewMode != XG_VIEW_SKELETON) {
Expand Down Expand Up @@ -1244,6 +1251,7 @@ bool __fastcall XgSaveSettings(void)
app_key.SetDword(L"MarkingY", xg_nMarkingY);

app_key.SetDword(L"ShowDoubleFrameLetters", xg_bShowDoubleFrameLetters);
app_key.SetDword(L"ShowDoubleFrame", xg_bShowDoubleFrame);
app_key.SetDword(L"ViewMode", xg_nViewMode);
app_key.SetDword(L"LineWidth", static_cast<int>(xg_nLineWidthInPt * 100));
app_key.SetDword(L"OuterFrame", static_cast<int>(xg_nOuterFrameInPt * 100));
Expand Down Expand Up @@ -4218,6 +4226,12 @@ void __fastcall MainWnd_OnInitMenu(HWND /*hwnd*/, HMENU hMenu)
} else {
::CheckMenuItem(hMenu, ID_VIEW_DOUBLEFRAME_LETTERS, MF_UNCHECKED);
}
// 二重マス表示のメニュー更新。
if (xg_bShowDoubleFrame) {
::CheckMenuItem(hMenu, ID_VIEW_DOUBLEFRAME, MF_CHECKED);
} else {
::CheckMenuItem(hMenu, ID_VIEW_DOUBLEFRAME, MF_UNCHECKED);
}

// ビューモード。
switch (xg_nViewMode) {
Expand Down Expand Up @@ -5761,6 +5775,8 @@ ViewSettingsDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
::CheckDlgButton(hwnd, chx12, BST_CHECKED);
if (xg_bCheckingAnswer)
::CheckDlgButton(hwnd, chx13, BST_CHECKED);
if (xg_bShowDoubleFrame)
::CheckDlgButton(hwnd, chx14, BST_CHECKED);
if (!xg_bSolved) {
::EnableWindow(::GetDlgItem(hwnd, chx4), FALSE);
::EnableWindow(::GetDlgItem(hwnd, chx5), FALSE);
Expand Down Expand Up @@ -5797,6 +5813,7 @@ ViewSettingsDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case chx11:
case chx12:
case chx13:
case chx14:
if (HIWORD(wParam) == BN_CLICKED)
PropSheet_Changed(GetParent(hwnd), hwnd);
break;
Expand Down Expand Up @@ -5834,6 +5851,7 @@ ViewSettingsDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
xg_bLowercase = (::IsDlgButtonChecked(hwnd, chx11) == BST_CHECKED);
xg_bHiragana = (::IsDlgButtonChecked(hwnd, chx12) == BST_CHECKED);
xg_bCheckingAnswer = (::IsDlgButtonChecked(hwnd, chx13) == BST_CHECKED);
xg_bShowDoubleFrame = (::IsDlgButtonChecked(hwnd, chx14) == BST_CHECKED);

// コンボボックスの設定を適用する。
WCHAR szText[128];
Expand Down Expand Up @@ -5886,6 +5904,13 @@ ViewSettingsDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
xg_bShowClues = FALSE;
}

if (xg_bNumCroMode) {
XgMakeItNumCro(hwnd);
} else {
xg_mapNumCro1.clear();
xg_mapNumCro2.clear();
}

// 元に戻す情報を確定。
auto sa2 = std::make_shared<XG_UndoData_SetAll>();
sa2->Get();
Expand Down Expand Up @@ -7200,6 +7225,12 @@ void __fastcall MainWnd_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT /*codeNo
XgNumberingSave(hwnd, FALSE);
break;

case ID_VIEW_DOUBLEFRAME:
// 二重マスを描画するか?
xg_bShowDoubleFrame = !xg_bShowDoubleFrame;
bUpdateImage = TRUE;
break;

default:
if (!XgOnCommandExtra(hwnd, id)) {
::MessageBeep(0xFFFFFFFF);
Expand Down
30 changes: 15 additions & 15 deletions XWordGiver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5098,14 +5098,14 @@ void __fastcall XgDrawOneCell(HDC hdc, INT iRow, INT jCol)
{
// 答え合わせで一致しないセル。
::FillRect(hdc, &rc, hbrUnmatched);
} else if (slot.count(XG_Pos(iRow, jCol)) > 0 && nMarked != -1 && !xg_bNumCroMode) {
// ハイライトかつ二重マスかつ非ナンクロ
} else if (slot.count(XG_Pos(iRow, jCol)) > 0 && nMarked != -1 && !xg_bNumCroMode && xg_bShowDoubleFrame) {
// ハイライトかつ二重マスかつ非ナンクロかつ二重マスが有効
::FillRect(hdc, &rc, hbrHighlightAndDblFrame);
} else if (slot.count(XG_Pos(iRow, jCol)) > 0) {
// ハイライト。
::FillRect(hdc, &rc, hbrHighlight);
} else if (nMarked != -1 && !xg_bNumCroMode) {
// 二重マスかつ非ナンクロ
} else if (nMarked != -1 && !xg_bNumCroMode && xg_bShowDoubleFrame) {
// 二重マスかつ非ナンクロかつ二重マスが有効
::FillRect(hdc, &rc, hbrMarked);
} else {
// その他のマス。
Expand All @@ -5119,7 +5119,7 @@ void __fastcall XgDrawOneCell(HDC hdc, INT iRow, INT jCol)
HGDIOBJ hFontOld = ::SelectObject(hdc, hFontSmall);

// 二重マスを描画する。
if (!xg_bNumCroMode && nMarked != -1) {
if (!xg_bNumCroMode && nMarked != -1 && xg_bShowDoubleFrame) {
XgDrawDoubleFrameCell(hdc, nMarked, rc, nCellSize, hThinPen, iRow, jCol);
}

Expand Down Expand Up @@ -5400,14 +5400,14 @@ void __fastcall XgDrawXWord_NormalView(const XG_Board& xw, HDC hdc, const SIZE *
{
// 答え合わせで一致しないセル。
::FillRect(hdc, &rc, hbrUnmatched);
} else if (slot.count(XG_Pos(i, j)) > 0 && nMarked != -1 && !xg_bNumCroMode) {
// ハイライトかつ二重マスかつ非ナンクロ
} else if (slot.count(XG_Pos(i, j)) > 0 && nMarked != -1 && !xg_bNumCroMode && xg_bShowDoubleFrame) {
// ハイライトかつ二重マスかつ非ナンクロかつ二重マスが有効
::FillRect(hdc, &rc, hbrHighlightAndDblFrame);
} else if (slot.count(XG_Pos(i, j)) > 0) {
// ハイライト。
::FillRect(hdc, &rc, hbrHighlight);
} else if (nMarked != -1 && !xg_bNumCroMode) {
// 二重マスかつ非ナンクロ
} else if (nMarked != -1 && !xg_bNumCroMode && xg_bShowDoubleFrame) {
// 二重マスかつ非ナンクロかつ二重マスが有効
::FillRect(hdc, &rc, hbrMarked);
} else {
// その他のマス。
Expand All @@ -5423,7 +5423,7 @@ void __fastcall XgDrawXWord_NormalView(const XG_Board& xw, HDC hdc, const SIZE *
HGDIOBJ hFontOld = ::SelectObject(hdc, hFontSmall);

// 二重マスを描画する。
if (!xg_bNumCroMode) {
if (!xg_bNumCroMode && xg_bShowDoubleFrame) {
for (int i = 0; i < xg_nRows; i++) {
for (int j = 0; j < xg_nCols; j++) {
// セルの座標をセットする。
Expand Down Expand Up @@ -5689,14 +5689,14 @@ void __fastcall XgDrawXWord_SkeletonView(const XG_Board& xw, HDC hdc, const SIZE
{
// 答え合わせで一致しないセル。
::FillRect(hdc, &rc, hbrUnmatched);
} else if (slot.count(XG_Pos(i, j)) > 0 && nMarked != -1 && !xg_bNumCroMode) {
// ハイライトかつ二重マスかつ非ナンクロ
} else if (slot.count(XG_Pos(i, j)) > 0 && nMarked != -1 && !xg_bNumCroMode && xg_bShowDoubleFrame) {
// ハイライトかつ二重マスかつ非ナンクロかつ二重マスが有効
::FillRect(hdc, &rc, hbrHighlightAndDblFrame);
} else if (slot.count(XG_Pos(i, j)) > 0) {
// ハイライト。
::FillRect(hdc, &rc, hbrHighlight);
} else if (nMarked != -1 && !xg_bNumCroMode) {
// 二重マスかつ非ナンクロ
} else if (nMarked != -1 && !xg_bNumCroMode && xg_bShowDoubleFrame) {
// 二重マスかつ非ナンクロかつ二重マスが有効
::FillRect(hdc, &rc, hbrMarked);
} else {
// その他のマス。
Expand All @@ -5709,7 +5709,7 @@ void __fastcall XgDrawXWord_SkeletonView(const XG_Board& xw, HDC hdc, const SIZE
HGDIOBJ hFontOld = ::SelectObject(hdc, hFontSmall);

// 二重マスを描画する。
if (!xg_bNumCroMode) {
if (!xg_bNumCroMode && xg_bShowDoubleFrame) {
for (int i = 0; i < xg_nRows; i++) {
for (int j = 0; j < xg_nCols; j++) {
// 二重マスか?
Expand Down
2 changes: 2 additions & 0 deletions XWordGiver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1009,6 +1009,8 @@ extern BOOL xg_bShowNumbering;
extern BOOL xg_bShowCaret;
// 二重マス文字。
extern XGStringW xg_strDoubleFrameLetters;
// 二重マスを表示するか?
extern BOOL xg_bShowDoubleFrame;
// 二重マス文字を表示するか?
extern BOOL xg_bShowDoubleFrameLetters;

Expand Down
6 changes: 4 additions & 2 deletions lang/en_US.rc
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ IDB_DELETEPAT BITMAP "res/1033_Bitmap_102.bmp"
MENUITEM "&Answer\tCtrl+M", ID_SHOWHIDESOLUTION
MENUITEM "&Numbering", ID_SHOWHIDENUMBERING
MENUITEM "&Caret", ID_SHOWHIDECARET
MENUITEM "Doubl&e-frame", ID_VIEW_DOUBLEFRAME_LETTERS
MENUITEM "Doubl&e-frame", ID_VIEW_DOUBLEFRAME
MENUITEM "Dou&ble-frame letters", ID_VIEW_DOUBLEFRAME_LETTERS
MENUITEM SEPARATOR
MENUITEM "Skelt&on View", ID_VIEW_SKELETON_VIEW
MENUITEM "NumCro &Mode", ID_NUMCROMODE
Expand Down Expand Up @@ -1521,7 +1522,7 @@ FONT 9, "Tahoma"
}

IDD_VIEWSETTINGS DIALOG 0, 0, 220, 170
CAPTION "表示設定"
CAPTION "View settings"
STYLE DS_CENTER | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION
FONT 9, "Tahoma"
{
Expand All @@ -1538,6 +1539,7 @@ FONT 9, "Tahoma"
AUTOCHECKBOX "lo&wercase", chx11, 115, 65, 95, 15
AUTOCHECKBOX "&Hiragana", chx12, 115, 85, 95, 15
AUTOCHECKBOX "Checking ans&wer", chx13, 115, 105, 95, 15
AUTOCHECKBOX "Double-&frame", chx14, 115, 125, 95, 15
RTEXT "&Zoom:", -1, 15, 150, 35, 10, SS_CENTERIMAGE | NOT WS_GROUP
COMBOBOX cmb1, 60, 150, 95, 300, CBS_HASSTRINGS | CBS_AUTOHSCROLL | CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
}
Expand Down
4 changes: 3 additions & 1 deletion lang/ja_JP.rc
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ IDB_DELETEPAT BITMAP "res/1041_Bitmap_102.bmp"
MENUITEM "答え(&A)\tCtrl+M", ID_SHOWHIDESOLUTION
MENUITEM "番号(&N)", ID_SHOWHIDENUMBERING
MENUITEM "キャレット(&C)", ID_SHOWHIDECARET
MENUITEM "二重マス(&E)", ID_VIEW_DOUBLEFRAME_LETTERS
MENUITEM "二重マス(&E)", ID_VIEW_DOUBLEFRAME
MENUITEM "二重マスの文字(&B)", ID_VIEW_DOUBLEFRAME_LETTERS
MENUITEM SEPARATOR
MENUITEM "スケルトン ビュー(&O)", ID_VIEW_SKELETON_VIEW
MENUITEM "ナンクロモード(&M)", ID_NUMCROMODE
Expand Down Expand Up @@ -1541,6 +1542,7 @@ FONT 9, "MS UI Gothic"
AUTOCHECKBOX "lo&wercase", chx11, 115, 65, 95, 15
AUTOCHECKBOX "ひらがな(&H)", chx12, 115, 85, 95, 15
AUTOCHECKBOX "答え合わせ(&W)", chx13, 115, 105, 95, 15
AUTOCHECKBOX "二重マス(&F)", chx14, 115, 125, 95, 15
RTEXT "ズーム(&Z):", -1, 15, 150, 35, 10, SS_CENTERIMAGE | NOT WS_GROUP
COMBOBOX cmb1, 60, 150, 95, 300, CBS_HASSTRINGS | CBS_AUTOHSCROLL | CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
}
Expand Down
1 change: 1 addition & 0 deletions resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@
#define ID_JUMPNUMBER 604
#define ID_GENERALSETTINGS 605
#define ID_NUMBERINGSAVE 606
#define ID_VIEW_DOUBLEFRAME 607
#define ID_TT_BASE 10000

#define ctl2 1185
Expand Down

0 comments on commit 1abfb37

Please sign in to comment.