From 028cfd8ccf136c08b224d6dbf6b30f28d9430c4c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 28 Jan 2023 20:47:56 +0300 Subject: one more fix for menu editor --- src/mir_app/src/menu_options.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/mir_app/src/menu_options.cpp b/src/mir_app/src/menu_options.cpp index 99c027ef82..01a8c7594f 100644 --- a/src/mir_app/src/menu_options.cpp +++ b/src/mir_app/src/menu_options.cpp @@ -100,20 +100,21 @@ class CGenMenuOptionsPage : public CDlgBase while (tvi.hItem != nullptr) { m_menuItems.GetItem(&tvi); + + bool bChecked = (tvi.state >> 12) == 2; auto *iod = (MenuItemOptData*)tvi.lParam; if (TMO_IntMenuItem *pimi = iod->pimi) { if (pimi->mi.uid != miid_last) { char menuItemName[256]; bin2hex(&pimi->mi.uid, sizeof(pimi->mi.uid), menuItemName); - int visible = (tvi.state >> 12) == 2; wchar_t *ptszCustomName; if (iod->name != nullptr && iod->defname != nullptr && mir_wstrcmp(iod->name, iod->defname) != 0) ptszCustomName = iod->name; else ptszCustomName = L""; - CMStringW tszValue(FORMAT, L"%d;%d;%S;%s", visible, runtimepos, pszParent, ptszCustomName); + CMStringW tszValue(FORMAT, L"%d;%d;%S;%s", bChecked, runtimepos, pszParent, ptszCustomName); db_set_ws(0, szModule, menuItemName, tszValue); if (pimi->mi.flags & CMIF_CUSTOM) @@ -127,7 +128,7 @@ class CGenMenuOptionsPage : public CDlgBase runtimepos += 100; } - if (iod->name && !mir_wstrcmp(iod->name, STR_SEPARATOR) && tvi.iImage) + if (iod->name && !mir_wstrcmp(iod->name, STR_SEPARATOR) && bChecked) runtimepos += SEPARATORPOSITIONINTERVAL; tvi.hItem = m_menuItems.GetNextSibling(tvi.hItem); @@ -389,6 +390,7 @@ public: PD->pos = ((MenuItemOptData *)tvi.lParam)->pos - 1; TVINSERTSTRUCT tvis = {}; + tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_STATE; tvis.item.lParam = (LPARAM)PD; tvis.item.pszText = PD->name; tvis.hInsertAfter = hti; -- cgit v1.2.3