summaryrefslogtreecommitdiff
path: root/plugins/Clist_nicer/src/clui.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-07-03 08:43:58 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-07-03 08:43:58 +0000
commit1ac5dafa951f57dfca5cf0dd6e7d2eeeea2f6772 (patch)
tree7f7adfefbd54d284072b98dc18bbd2bb26a165d4 /plugins/Clist_nicer/src/clui.cpp
parent6c1c4268578dcd59fc78f2ec8336bee991213a93 (diff)
- IDR_CONTEXT resource removed from all clists;
- all menu control rewritten using Menu_* functions, thus making group & tray menu customizable in StdClist & Clist_Nicer; - major gdi resource leak fixed git-svn-id: http://svn.miranda-ng.org/main/trunk@14483 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Clist_nicer/src/clui.cpp')
-rw-r--r--plugins/Clist_nicer/src/clui.cpp42
1 files changed, 12 insertions, 30 deletions
diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp
index 80b01a7a48..ec0cf9dc97 100644
--- a/plugins/Clist_nicer/src/clui.cpp
+++ b/plugins/Clist_nicer/src/clui.cpp
@@ -73,7 +73,6 @@ void InitGroupMenus();
void FS_RegisterFonts();
void LoadExtraIconModule();
void RemoveFromTaskBar(HWND hWnd);
-void DestroyTrayMenu(HMENU hMenu);
extern LONG g_cxsmIcon, g_cysmIcon;
@@ -778,6 +777,8 @@ static void GetButtonRect(HWND hwnd, RECT *rc)
LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
+ RECT rc;
+
switch (msg) {
case WM_CREATE:
{
@@ -906,7 +907,7 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
case WM_PAINT:
{
PAINTSTRUCT ps;
- RECT rc, rcFrame, rcClient;
+ RECT rcFrame, rcClient;
HDC hdc;
HRGN rgn = 0;
HDC hdcReal = BeginPaint(hwnd, &ps);
@@ -1022,7 +1023,6 @@ skipbg:
case WM_ENTERSIZEMOVE:
{
- RECT rc;
POINT pt = { 0 };
GetWindowRect(hwnd, &g_PreSizeRect);
@@ -1098,7 +1098,6 @@ skipbg:
if (pcli->hwndContactList != 0) {
SendMessage(hwnd, WM_ENTERSIZEMOVE, 0, 0);
- RECT rc;
GetWindowRect(hwnd, &rc);
WINDOWPOS wp = { 0 };
wp.cx = rc.right - rc.left;
@@ -1113,7 +1112,6 @@ skipbg:
case WM_MOVE:
if (!IsIconic(hwnd)) {
- RECT rc;
GetWindowRect(hwnd, &rc);
if (!Docking_IsDocked(0, 0)) {
@@ -1123,7 +1121,6 @@ skipbg:
}
cluiPos.right = rc.right - rc.left;
if (cfg::dat.realTimeSaving) {
- RECT rc;
GetWindowRect(hwnd, &rc);
// if docked, dont remember pos (except for width)
@@ -1346,9 +1343,8 @@ skipbg:
if (cfg::clcdat) {
pcli->pfnGetRowByIndex(cfg::clcdat, cfg::clcdat->selection, &contact, NULL);
- if (contact && contact->type == CLCIT_CONTACT) {
+ if (contact && contact->type == CLCIT_CONTACT)
hContact = contact->hContact;
- }
}
while (item) {
if (item->uId == (DWORD)LOWORD(wParam)) {
@@ -1438,26 +1434,17 @@ skipbg:
case IDC_TBMENU:
case IDC_TBTOPMENU:
case IDC_STBTOPMENU:
- {
- RECT rc;
- HMENU hMenu = Menu_GetMainMenu();
- GetButtonRect(GetDlgItem(hwnd, LOWORD(wParam)), &rc);
- TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, rc.left, LOWORD(wParam) == IDC_TBMENU ? rc.top : rc.bottom, 0, hwnd, NULL);
- }
+ GetButtonRect(GetDlgItem(hwnd, LOWORD(wParam)), &rc);
+ TrackPopupMenu(Menu_GetMainMenu(), TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, rc.left, LOWORD(wParam) == IDC_TBMENU ? rc.top : rc.bottom, 0, hwnd, NULL);
return 0;
case IDC_TBTOPSTATUS:
case IDC_STBTOPSTATUS:
case IDC_TBGLOBALSTATUS:
- {
- RECT rc;
- HMENU hmenu = (HMENU)Menu_GetStatusMenu();
- GetButtonRect(GetDlgItem(hwnd, LOWORD(wParam)), &rc);
- TrackPopupMenu(hmenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, rc.left, LOWORD(wParam) == IDC_TBGLOBALSTATUS ? rc.top : rc.bottom, 0, hwnd, NULL);
- }
+ GetButtonRect(GetDlgItem(hwnd, LOWORD(wParam)), &rc);
+ TrackPopupMenu(Menu_GetStatusMenu(), TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, rc.left, LOWORD(wParam) == IDC_TBGLOBALSTATUS ? rc.top : rc.bottom, 0, hwnd, NULL);
return 0;
-
case IDC_TBSOUND:
case IDC_STBSOUND:
cfg::dat.soundsOff = !cfg::dat.soundsOff;
@@ -1613,10 +1600,8 @@ buttons_done:
break;
case WM_CONTEXTMENU:
+ GetWindowRect(pcli->hwndContactTree, &rc);
{
- RECT rc;
- GetWindowRect(pcli->hwndContactTree, &rc);
-
// x/y might be -1 if it was generated by a kb click
POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
if (pt.x == -1 && pt.y == -1) {
@@ -1631,7 +1616,7 @@ buttons_done:
if (PtInRect(&rc, pt)) {
HMENU hMenu = Menu_BuildGroupMenu();
TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwnd, NULL);
- DestroyTrayMenu(hMenu);
+ Menu_DestroyNestedMenu(hMenu);
return 0;
}
GetWindowRect(pcli->hwndStatus, &rc);
@@ -1640,7 +1625,7 @@ buttons_done:
if (cfg::getByte("CLUI", "SBarRightClk", 0))
hMenu = Menu_GetMainMenu();
else
- hMenu = (HMENU)Menu_GetStatusMenu();
+ hMenu = Menu_GetStatusMenu();
TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwnd, NULL);
return 0;
}
@@ -1924,12 +1909,9 @@ static INT_PTR CLN_ShowMainMenu(WPARAM, LPARAM)
static INT_PTR CLN_ShowStatusMenu(WPARAM, LPARAM)
{
- HMENU hMenu;
POINT pt;
-
- hMenu = (HMENU)Menu_GetStatusMenu();
GetCursorPos(&pt);
- TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_LEFTBUTTON, pt.x, pt.y, 0, pcli->hwndContactList, NULL);
+ TrackPopupMenu(Menu_GetStatusMenu(), TPM_TOPALIGN | TPM_LEFTALIGN | TPM_LEFTBUTTON, pt.x, pt.y, 0, pcli->hwndContactList, NULL);
return 0;
}