diff options
author | George Hazan <george.hazan@gmail.com> | 2013-09-15 13:47:52 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-09-15 13:47:52 +0000 |
commit | d25e5bf2e92d4d588f40d177fd1aadb2c73fdcae (patch) | |
tree | 0ffa88814bf34473eafbfc4bb7354caf2f310c9e /plugins/Popup/src/srmm_menu.cpp | |
parent | d5abdd61330f42bc19500867a801af7a2221a203 (diff) |
- forward declarations removed;
- code cleaning;
git-svn-id: http://svn.miranda-ng.org/main/trunk@6073 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Popup/src/srmm_menu.cpp')
-rw-r--r-- | plugins/Popup/src/srmm_menu.cpp | 85 |
1 files changed, 40 insertions, 45 deletions
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);
+}
|