From 66758570c22e4c614b9eca594c55d89c189662e9 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 17 May 2015 11:32:32 +0000 Subject: fix for genmenu options - left tree replaced with a listbox git-svn-id: http://svn.miranda-ng.org/main/trunk@13663 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/clist/genmenuopt.cpp | 38 ++++++++++++++------------------------ src/resource.rc | 4 ++-- 2 files changed, 16 insertions(+), 26 deletions(-) diff --git a/src/modules/clist/genmenuopt.cpp b/src/modules/clist/genmenuopt.cpp index a8a0cb503f..bf5f71aaa9 100644 --- a/src/modules/clist/genmenuopt.cpp +++ b/src/modules/clist/genmenuopt.cpp @@ -248,15 +248,11 @@ class CGenMenuOptionsPage : public CDlgBase bool GetCurrentMenuObjectID(int &result) { - HTREEITEM hti = m_menuObjects.GetSelection(); - if (hti == NULL) + int iItem = m_menuObjects.GetCurSel(); + if (iItem == -1) return false; - TVITEMEX tvi; - tvi.mask = TVIF_HANDLE | TVIF_PARAM; - tvi.hItem = hti; - m_menuObjects.GetItem(&tvi); - result = (int)tvi.lParam; + result = (int)m_menuObjects.GetItemData(iItem); return true; } @@ -292,7 +288,8 @@ class CGenMenuOptionsPage : public CDlgBase return NULL; } - CCtrlTreeView m_menuItems, m_menuObjects; + CCtrlListBox m_menuObjects; + CCtrlTreeView m_menuItems; CCtrlCheck m_radio1, m_radio2, m_disableIcons; CCtrlEdit m_customName, m_service; CCtrlButton m_btnInsert, m_btnReset, m_btnSet, m_btnDefault; @@ -319,7 +316,7 @@ public: m_btnInsert.OnClick = Callback(this, &CGenMenuOptionsPage::btnInsert_Clicked); m_btnDefault.OnClick = Callback(this, &CGenMenuOptionsPage::btnDefault_Clicked); - m_menuObjects.OnSelChanged = Callback(this, &CGenMenuOptionsPage::onMenuObjectChanged); + m_menuObjects.OnSelChange = Callback(this, &CGenMenuOptionsPage::onMenuObjectChanged); m_menuItems.SetFlags(MTREE_CHECKBOX); m_menuItems.OnSelChanged = Callback(this, &CGenMenuOptionsPage::onMenuItemChanged); @@ -335,9 +332,7 @@ public: HIMAGELIST himlCheckBoxes = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 2, 2); ImageList_AddIcon_IconLibLoaded(himlCheckBoxes, SKINICON_OTHER_NOTICK); ImageList_AddIcon_IconLibLoaded(himlCheckBoxes, SKINICON_OTHER_TICK); - m_menuItems.SetImageList(himlCheckBoxes, TVSIL_NORMAL); - m_menuObjects.SetImageList(himlCheckBoxes, TVSIL_NORMAL); if (iInitMenuValue) m_radio2.SetState(true); @@ -346,22 +341,15 @@ public: m_disableIcons.SetState(bIconsDisabled); - //---- init tree ------------------------------------------- - TVINSERTSTRUCT tvis; - tvis.hParent = NULL; - tvis.hInsertAfter = TVI_LAST; - tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE; - + //---- init menu object list -------------------------------------- for (int i = 0; i < g_menus.getCount(); i++) { TIntMenuObject *p = g_menus[i]; - if (p->id == (int)hStatusMenuObject || !p->m_bUseUserDefinedItems) - continue; - - tvis.item.lParam = (LPARAM)p->id; - tvis.item.pszText = TranslateTS(p->ptszDisplayName); - tvis.item.iImage = tvis.item.iSelectedImage = true; - m_menuObjects.InsertItem(&tvis); + if (p->id != (int)hStatusMenuObject && p->m_bUseUserDefinedItems) + m_menuObjects.AddString(TranslateTS(p->ptszDisplayName), p->id); } + + m_menuObjects.SetCurSel(0); + RebuildCurrent(); } virtual void OnApply() @@ -469,7 +457,9 @@ public: void onMenuObjectChanged(void*) { + m_initialized = false; RebuildCurrent(); + m_initialized = true; } void onMenuItemChanged(void*) diff --git a/src/resource.rc b/src/resource.rc index 477a5b0e96..f7279c6178 100644 --- a/src/resource.rc +++ b/src/resource.rc @@ -90,7 +90,7 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_FIXEDSYS | DS_CENTER | CAPTION "Miranda NG profile manager" FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN - CONTROL "",IDC_NAME,"MHeaderbarCtrl",0x0,0,0,220,25 + CONTROL "Manage your Miranda NG profile",IDC_NAME,"MHeaderbarCtrl",0x0,0,0,220,25 CONTROL "Tab1",IDC_TABS,"SysTabControl32",TCS_HOTTRACK | WS_TABSTOP,2,31,215,137 PUSHBUTTON "&Run",IDOK,169,195,48,14 PUSHBUTTON "&Exit",IDCANCEL,112,195,48,14 @@ -486,7 +486,7 @@ EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN GROUPBOX "Menu objects",IDC_STATIC,5,2,140,94 - CONTROL "Tree2",IDC_MENUOBJECTS,"SysTreeView32",TVS_SHOWSELALWAYS | WS_BORDER | WS_HSCROLL | WS_TABSTOP,11,13,128,79 + LISTBOX IDC_MENUOBJECTS,11,13,128,79,WS_VSCROLL | WS_TABSTOP GROUPBOX "Menu items",IDC_STATIC,149,2,161,248 CONTROL "Tree1",IDC_MENUITEMS,"SysTreeView32",TVS_SHOWSELALWAYS | WS_DISABLED | WS_BORDER | WS_HSCROLL | WS_TABSTOP,156,13,148,212 GROUPBOX "Protocol menus",IDC_STATIC,5,100,140,37 -- cgit v1.2.3