Skip to content

Commit

Permalink
improve box edit
Browse files Browse the repository at this point in the history
  • Loading branch information
katahiromz committed Aug 16, 2022
1 parent cdf09fa commit e578d10
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 16 deletions.
20 changes: 14 additions & 6 deletions GUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5150,6 +5150,8 @@ BOOL XgAddBox(HWND hwnd, UINT id)
ptr->SetText(dialog1.m_strText);
ptr->SetTextColor(dialog1.GetTextColor());
ptr->SetBgColor(dialog1.GetBgColor());
ptr->m_strFontName = dialog1.m_strFontName;
ptr->m_nFontSizeInPoints = dialog1.m_nFontSizeInPoints;
if (ptr->CreateDx(xg_canvasWnd)) {
xg_boxes.emplace_back(ptr);
// ファイルが変更された。
Expand Down Expand Up @@ -6643,19 +6645,25 @@ void __fastcall MainWnd_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT /*codeNo
XgAddBox(hwnd, id);
break;
case ID_DELETEBOX:
for (auto it = xg_boxes.begin(); it != xg_boxes.end(); ++it) {
if ((*it)->m_hWnd == hwndCtl) {
DestroyWindow(hwndCtl);
{
HWND hwndTarget = XG_BoxWindow::s_hwndSelected;
for (auto it = xg_boxes.begin(); it != xg_boxes.end(); ++it) {
if ((*it)->m_hWnd != hwndTarget)
continue;
DestroyWindow(hwndTarget);
xg_boxes.erase(it);
XG_FILE_MODIFIED(TRUE);
break;
}
}
break;
case ID_BOXPROP:
for (auto it = xg_boxes.begin(); it != xg_boxes.end(); ++it) {
if ((*it)->m_hWnd == hwndCtl) {
if ((*it)->Prop(hwndCtl)) {
{
HWND hwndTarget = XG_BoxWindow::s_hwndSelected;
for (auto it = xg_boxes.begin(); it != xg_boxes.end(); ++it) {
if ((*it)->m_hWnd != hwndTarget)
continue;
if ((*it)->Prop(hwndTarget)) {
XG_FILE_MODIFIED(TRUE);
}
break;
Expand Down
4 changes: 2 additions & 2 deletions HISTORY.txt
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@
- Added file "THEME.txt" to define the theme preset values.
- Clearly displayed the selection status in the Theme dialog.
- Fixed a bug about handling items on the Theme dialog.
- 2022-XX-YY ver.4.9.9
- 2022-08-16 ver.4.9.9
- Improved the "Policy" menu.
- Improved the "Policy Preset" dialog.
- Saved the latest maximized status of the main window.
Expand Down Expand Up @@ -671,7 +671,7 @@
- テーマのプリセット値を定義するファイルTHEME.txtを追加。
- テーマダイアログで選択状態をはっきり表示。
- テーマダイアログの項目の扱いに関する不具合を修正。
- 2022月XX月YY日 ver.4.9.9
- 2022月08月16日 ver.4.9.9
- 「ルール」メニューを改良。
- 「ルール プリセット」ダイアログを改良。
- メインウィンドウの前回の最大化状態を保存。
Expand Down
6 changes: 4 additions & 2 deletions XG_BoxWindow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class XG_BoxWindow : public XG_Window
INT m_i1, m_j1, m_i2, m_j2;
std::wstring m_strText;
RECT m_rcOld;
static inline HWND s_hwndSelected = NULL;

XG_BoxWindow(const std::wstring& type, INT i1 = 0, INT j1 = 0, INT i2 = 1, INT j2 = 1)
: m_type(type)
Expand Down Expand Up @@ -385,6 +386,7 @@ class XG_BoxWindow : public XG_Window
TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD,
pt.x, pt.y, 0, hwnd, NULL);
DestroyMenu(hMenu);
s_hwndSelected = hwnd;
if (id)
PostMessage(m_hwndParent, WM_COMMAND, id, (LPARAM)hwnd);
}
Expand All @@ -398,7 +400,8 @@ class XG_BoxWindow : public XG_Window
{
if (fDoubleClick)
{
PostMessageW(m_hwndParent, WM_COMMAND, ID_BOXPROP, (LPARAM)hwnd);
s_hwndSelected = hwnd;
PostMessageW(m_hwndParent, WM_COMMAND, ID_BOXPROP, 0);
return;
}

Expand Down Expand Up @@ -650,7 +653,6 @@ class XG_PictureBoxWindow : public XG_BoxWindow
dialog.m_strFile = m_strText;
if (dialog.DoModal(m_hwndParent) == IDOK) {
SetText(dialog.m_strFile);

// ファイルが変更された。
xg_bFileModified = TRUE;
// 再描画。
Expand Down
5 changes: 2 additions & 3 deletions lang/en_US.rc
Original file line number Diff line number Diff line change
Expand Up @@ -512,13 +512,12 @@ LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
MENUITEM SEPARATOR
MENUITEM "Delete clues and &unlock board", ID_ERASESOLUTIONANDUNLOCKEDIT
MENUITEM "&Clear all the letters", ID_CLEARNONBLOCKS
POPUP "Add Bo&x", MENUBREAK
POPUP "Add Bo&x"
{
MENUITEM "Add &Text Box...", ID_ADDTEXTBOX
MENUITEM "Add &Picture Box...", ID_ADDPICTUREBOX
}
MENUITEM SEPARATOR
MENUITEM "Copy the DOWN word", ID_COPYWORDVERT
MENUITEM "Copy the DOWN word", ID_COPYWORDVERT, MENUBREAK
MENUITEM "Copy the ACROSS word", ID_COPYWORDHORZ
MENUITEM SEPARATOR
MENUITEM "Show candidates (DOWN)\tShift+Ctrl+↓", ID_OPENCANDSWNDVERT
Expand Down
5 changes: 2 additions & 3 deletions lang/ja_JP.rc
Original file line number Diff line number Diff line change
Expand Up @@ -515,13 +515,12 @@ LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT
MENUITEM SEPARATOR
MENUITEM "ヒントを削除して盤面のロックを解除(&U)", ID_ERASESOLUTIONANDUNLOCKEDIT
MENUITEM "文字をすべてクリア(&C)", ID_CLEARNONBLOCKS
POPUP "ボックスを追加(&X)", MENUBREAK
POPUP "ボックスを追加(&X)"
{
MENUITEM "テキストボックスを追加(&X)...", ID_ADDTEXTBOX
MENUITEM "画像ボックスを追加(&X)...", ID_ADDPICTUREBOX
}
MENUITEM SEPARATOR
MENUITEM "タテの単語をコピー(&V)", ID_COPYWORDVERT
MENUITEM "タテの単語をコピー(&V)", ID_COPYWORDVERT, MENUBREAK
MENUITEM "ヨコの単語をコピー(&H)", ID_COPYWORDHORZ
MENUITEM SEPARATOR
MENUITEM "候補を表示(&C) (タテ)\tShift+Ctrl+↓", ID_OPENCANDSWNDVERT
Expand Down

0 comments on commit e578d10

Please sign in to comment.