From d25e5bf2e92d4d588f40d177fd1aadb2c73fdcae Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 15 Sep 2013 13:47:52 +0000 Subject: - forward declarations removed; - code cleaning; git-svn-id: http://svn.miranda-ng.org/main/trunk@6073 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Popup/src/main.cpp | 2 +- plugins/Popup/src/srmm_menu.cpp | 85 +++++++++++++++++++---------------------- 2 files changed, 41 insertions(+), 46 deletions(-) (limited to 'plugins/Popup/src') diff --git a/plugins/Popup/src/main.cpp b/plugins/Popup/src/main.cpp index 880d92c0c3..58d9c1ba94 100644 --- a/plugins/Popup/src/main.cpp +++ b/plugins/Popup/src/main.cpp @@ -258,7 +258,7 @@ static int ModulesLoaded(WPARAM,LPARAM) (CallService(MS_HPP_GETVERSION, 0, 0) >= PLUGIN_MAKE_VERSION(1,5,0,112)); //check if MText plugin is installed if (MText.Register) { - htuText = MText.Register("Popup Plus/Text", MTEXT_FANCY_DEFAULT); + htuText = MText.Register("Popup Plus/Text", MTEXT_FANCY_DEFAULT); htuTitle = MText.Register("Popup Plus/Title",MTEXT_FANCY_DEFAULT); } else htuTitle = htuText = NULL; diff --git a/plugins/Popup/src/srmm_menu.cpp b/plugins/Popup/src/srmm_menu.cpp index 28e6da3f8a..336b389975 100644 --- a/plugins/Popup/src/srmm_menu.cpp +++ b/plugins/Popup/src/srmm_menu.cpp @@ -31,39 +31,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static HANDLE hDialogsList = NULL; -static int SrmmMenu_ProcessEvent(WPARAM wParam, LPARAM lParam); -static int SrmmMenu_ProcessIconClick(WPARAM wParam, LPARAM lParam); - - -void SrmmMenu_Load() -{ - StatusIconData sid = { sizeof(sid) }; - sid.szModule = MODULNAME; - - sid.dwId = 0; - sid.szTooltip = LPGEN("Popup Mode: Auto"); - sid.hIcon = sid.hIconDisabled = IcoLib_GetIcon(ICO_POPUP_ON,0); - Srmm_AddIcon(&sid); - - sid.dwId = 1; - sid.szTooltip = LPGEN("Popup Mode: Favourite"); - sid.hIcon = sid.hIconDisabled = IcoLib_GetIcon(ICO_FAV,0); - Srmm_AddIcon(&sid); - - sid.dwId = 2; - sid.szTooltip = LPGEN("Popup Mode: Ignore fullscreen"); - sid.hIcon = sid.hIconDisabled = IcoLib_GetIcon(ICO_FULLSCREEN,0); - Srmm_AddIcon(&sid); - - sid.dwId = 3; - sid.szTooltip = LPGEN("Popup Mode: Block contact"); - sid.hIcon = sid.hIconDisabled = IcoLib_GetIcon(ICO_POPUP_OFF,0); - Srmm_AddIcon(&sid); - - HookEvent(ME_MSG_ICONPRESSED, SrmmMenu_ProcessIconClick); - HookEvent(ME_MSG_WINDOWEVENT, SrmmMenu_ProcessEvent); -} - static void SrmmMenu_UpdateIcon(HANDLE hContact) { if (!hContact) @@ -74,7 +41,7 @@ static void SrmmMenu_UpdateIcon(HANDLE hContact) StatusIconData sid = { sizeof(sid) }; sid.szModule = MODULNAME; - for (int i=0; i < 4; ++i) { + for (int i=0; i < 4; i++) { sid.dwId = i; sid.flags = (i == mode) ? 0 : MBF_HIDDEN; Srmm_ModifyIcon(hContact, &sid); @@ -92,8 +59,7 @@ static int SrmmMenu_ProcessEvent(WPARAM, LPARAM lParam) WindowList_Add(hDialogsList, mwevent->hwndWindow, mwevent->hContact); SrmmMenu_UpdateIcon(mwevent->hContact); } - else if (mwevent->uType == MSG_WINDOW_EVT_CLOSING) - { + else if (mwevent->uType == MSG_WINDOW_EVT_CLOSING) { if (hDialogsList) WindowList_Remove(hDialogsList, mwevent->hwndWindow); } @@ -104,27 +70,27 @@ static int SrmmMenu_ProcessEvent(WPARAM, LPARAM lParam) static int SrmmMenu_ProcessIconClick(WPARAM wParam, LPARAM lParam) { StatusIconClickData *sicd = (StatusIconClickData *)lParam; - if (lstrcmpA(sicd->szModule, MODULNAME)) return 0; + if (lstrcmpA(sicd->szModule, MODULNAME)) + return 0; HANDLE hContact = (HANDLE)wParam; - if (!hContact) return 0; + if (!hContact) + return 0; int mode = db_get_b(hContact, MODULNAME, "ShowMode", PU_SHOWMODE_AUTO); if (sicd->flags & MBCF_RIGHTBUTTON) { HMENU hMenu = CreatePopupMenu(); - AppendMenu(hMenu, MF_STRING, 1+PU_SHOWMODE_AUTO, TranslateT("Auto")); - AppendMenu(hMenu, MF_STRING, 1+PU_SHOWMODE_FAVORITE, TranslateT("Favourite")); - AppendMenu(hMenu, MF_STRING, 1+PU_SHOWMODE_FULLSCREEN, TranslateT("Ignore fullscreen")); - AppendMenu(hMenu, MF_STRING, 1+PU_SHOWMODE_BLOCK, TranslateT("Block")); + AppendMenu(hMenu, MF_STRING, 1+PU_SHOWMODE_AUTO, TranslateT("Auto")); + AppendMenu(hMenu, MF_STRING, 1+PU_SHOWMODE_FAVORITE, TranslateT("Favourite")); + AppendMenu(hMenu, MF_STRING, 1+PU_SHOWMODE_FULLSCREEN, TranslateT("Ignore fullscreen")); + AppendMenu(hMenu, MF_STRING, 1+PU_SHOWMODE_BLOCK, TranslateT("Block")); CheckMenuItem(hMenu, 1+mode, MF_BYCOMMAND|MF_CHECKED); mode = TrackPopupMenu(hMenu, TPM_RETURNCMD, sicd->clickLocation.x, sicd->clickLocation.y, 0, WindowList_Find(hDialogsList, hContact), NULL); - - if (mode) - { + if (mode) { db_set_b(hContact, MODULNAME, "ShowMode", mode-1); SrmmMenu_UpdateIcon(hContact); } @@ -136,3 +102,32 @@ static int SrmmMenu_ProcessIconClick(WPARAM wParam, LPARAM lParam) return 0; } + +void SrmmMenu_Load() +{ + StatusIconData sid = { sizeof(sid) }; + sid.szModule = MODULNAME; + + sid.dwId = 0; + sid.szTooltip = LPGEN("Popup Mode: Auto"); + sid.hIcon = sid.hIconDisabled = IcoLib_GetIcon(ICO_POPUP_ON,0); + Srmm_AddIcon(&sid); + + sid.dwId = 1; + sid.szTooltip = LPGEN("Popup Mode: Favourite"); + sid.hIcon = sid.hIconDisabled = IcoLib_GetIcon(ICO_FAV,0); + Srmm_AddIcon(&sid); + + sid.dwId = 2; + sid.szTooltip = LPGEN("Popup Mode: Ignore fullscreen"); + sid.hIcon = sid.hIconDisabled = IcoLib_GetIcon(ICO_FULLSCREEN,0); + Srmm_AddIcon(&sid); + + sid.dwId = 3; + sid.szTooltip = LPGEN("Popup Mode: Block contact"); + sid.hIcon = sid.hIconDisabled = IcoLib_GetIcon(ICO_POPUP_OFF,0); + Srmm_AddIcon(&sid); + + HookEvent(ME_MSG_ICONPRESSED, SrmmMenu_ProcessIconClick); + HookEvent(ME_MSG_WINDOWEVENT, SrmmMenu_ProcessEvent); +} -- cgit v1.2.3