From 3fa621ffde27485da36638442224b37ade3ee8f3 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 28 Jun 2015 10:02:17 +0000 Subject: menu fix git-svn-id: http://svn.miranda-ng.org/main/trunk@14423 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/NotesAndReminders/src/main.cpp | 39 ++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 18 deletions(-) (limited to 'plugins') diff --git a/plugins/NotesAndReminders/src/main.cpp b/plugins/NotesAndReminders/src/main.cpp index 7a0489fc49..14d765bd0b 100644 --- a/plugins/NotesAndReminders/src/main.cpp +++ b/plugins/NotesAndReminders/src/main.cpp @@ -174,6 +174,18 @@ static void InitServices() CreateServiceFunction(MODULENAME"/OpenTriggeredReminder",OpenTriggeredReminder); } +///////////////////////////////////////////////////////////////////////////////////////// + +static void addMenuItem(CLISTMENUITEM &mi) +{ + if (g_AddContListMI) { + HGENMENU save = mi.hParentMenu; mi.hParentMenu = NULL; + Menu_AddContactMenuItem(&mi); + mi.hParentMenu = save; + } + Menu_AddMainMenuItem(&mi); +} + int OnModulesLoaded(WPARAM wparam, LPARAM lparam) { // register fonts and hotkeys @@ -184,64 +196,56 @@ int OnModulesLoaded(WPARAM wparam, LPARAM lparam) // register menus CLISTMENUITEM mi = { 0 }; - mi.hParentMenu = Menu_CreateRoot(MO_MAIN, LPGENT("Notes && Reminders"), 1600000000); + mi.hParentMenu = Menu_CreateRoot(MO_MAIN, (TCHAR*)LPGENW("Notes && Reminders"), 1600000000); mi.flags = CMIF_TCHAR; mi.position = 1600000000; mi.icolibItem = iconList[2].hIcolib; mi.name.t = LPGENT("New &Note"); mi.pszService = MODULENAME"/MenuCommandAddNew"; - if (g_AddContListMI) Menu_AddContactMenuItem(&mi); - Menu_AddMainMenuItem(&mi); + addMenuItem(mi); mi.position = 1600000001; mi.icolibItem = iconList[0].hIcolib; mi.name.t = LPGENT("New &Reminder"); mi.pszService = MODULENAME"/MenuCommandNewReminder"; - if (g_AddContListMI) Menu_AddContactMenuItem(&mi); - Menu_AddMainMenuItem(&mi); + addMenuItem(mi); mi.position = 1600100000; mi.icolibItem = iconList[3].hIcolib; mi.name.t = LPGENT("&Show / Hide Notes"); mi.pszService = MODULENAME"/MenuCommandShowHide"; - if (g_AddContListMI) Menu_AddContactMenuItem(&mi); - Menu_AddMainMenuItem(&mi); + addMenuItem(mi); mi.position = 1600100001; mi.icolibItem = iconList[13].hIcolib; mi.name.t = LPGENT("Vie&w Notes"); mi.pszService = MODULENAME"/MenuCommandViewNotes"; - if (g_AddContListMI) Menu_AddContactMenuItem(&mi); - Menu_AddMainMenuItem(&mi); + addMenuItem(mi); mi.position = 1600100002; mi.icolibItem = iconList[1].hIcolib; mi.name.t = LPGENT("&Delete All Notes"); mi.pszService = MODULENAME"/MenuCommandDeleteAll"; - if (g_AddContListMI) Menu_AddContactMenuItem(&mi); - Menu_AddMainMenuItem(&mi); + addMenuItem(mi); mi.position = 1600100003; mi.icolibItem = iconList[11].hIcolib; mi.name.t = LPGENT("&Bring All to Front"); mi.pszService = MODULENAME"/MenuCommandBringAllFront"; - if (g_AddContListMI) Menu_AddContactMenuItem(&mi); - Menu_AddMainMenuItem(&mi); + addMenuItem(mi); mi.position = 1600200000; mi.icolibItem = iconList[6].hIcolib; mi.name.t = LPGENT("&View Reminders"); mi.pszService = MODULENAME"/MenuCommandViewReminders"; - if (g_AddContListMI) Menu_AddContactMenuItem(&mi); - Menu_AddMainMenuItem(&mi); + addMenuItem(mi); mi.position = 1600200001; mi.icolibItem = iconList[5].hIcolib; mi.name.t = LPGENT("D&elete All Reminders"); mi.pszService = MODULENAME"/MenuCommandDeleteReminders"; - if (g_AddContListMI) Menu_AddContactMenuItem(&mi); - Menu_AddMainMenuItem(&mi); + addMenuItem(mi); // register misc hkOptInit = HookEvent(ME_OPT_INITIALISE, OnOptInitialise); @@ -253,7 +257,6 @@ int OnModulesLoaded(WPARAM wparam, LPARAM lparam) CreateMsgWindow(); LoadNotes(TRUE); LoadReminders(); - return 0; } -- cgit v1.2.3