summaryrefslogtreecommitdiff
path: root/plugins/Clist_modern
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2016-05-28 07:29:21 +0000
committerGeorge Hazan <george.hazan@gmail.com>2016-05-28 07:29:21 +0000
commitaa22627377b06fd781e1f3667ac48687dda03247 (patch)
tree0affed38123540a6416e7d0c4919466767acc093 /plugins/Clist_modern
parent33fa85c712ad498aebb5c518fb7973fb40fcdf46 (diff)
minor code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@16877 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Clist_modern')
-rw-r--r--plugins/Clist_modern/src/modern_clistevents.cpp316
-rw-r--r--plugins/Clist_modern/src/modern_clistmenus.cpp6
-rw-r--r--plugins/Clist_modern/src/modern_rowheight_funcs.cpp2
-rw-r--r--plugins/Clist_modern/src/modern_tbbutton.cpp114
4 files changed, 205 insertions, 233 deletions
diff --git a/plugins/Clist_modern/src/modern_clistevents.cpp b/plugins/Clist_modern/src/modern_clistevents.cpp
index 52752fdf3b..078f80432d 100644
--- a/plugins/Clist_modern/src/modern_clistevents.cpp
+++ b/plugins/Clist_modern/src/modern_clistevents.cpp
@@ -31,27 +31,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/* Declarations */
static HANDLE hNotifyFrame = NULL;
-static int EventArea_PaintCallbackProc(HWND hWnd, HDC hDC, RECT *rcPaint, HRGN rgn, DWORD dFlags, void * CallBackData);
-static int EventArea_Draw(HWND hwnd, HDC hDC);
-static int EventArea_DrawWorker(HWND hwnd, HDC hDC);
-static void EventArea_HideShowNotifyFrame();
-static LRESULT CALLBACK EventArea_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
-
-int EventArea_Create(HWND hCluiWnd);
-int EventArea_UnloadModule();
-void EventArea_ConfigureEventArea();
/**************************************************/
-HWND g_hwndEventArea = 0;
-
-static CListEvent *event;
-static int eventCount;
-static int disableTrayFlash;
-static int disableIconFlash;
-
-
-struct CListImlIcon {
+struct CListImlIcon
+{
int index;
HICON hIcon;
};
@@ -62,7 +46,8 @@ static UINT flashTimerId;
static int iconsOn;
-struct NotifyMenuItemExData {
+struct NotifyMenuItemExData
+{
MCONTACT hContact;
int iIcon; // icon index in the image list
HICON hIcon; // corresponding icon handle
@@ -79,10 +64,31 @@ static CLISTEVENT* MyGetEvent(int iSelection)
return NULL;
}
+static void EventArea_HideShowNotifyFrame()
+{
+ int dwVisible = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, hNotifyFrame), 0) & F_VISIBLE;
+
+ int desired;
+ if (g_CluiData.dwFlags & CLUI_FRAME_SHOWALWAYS)
+ desired = TRUE;
+ else if (g_CluiData.dwFlags & CLUI_FRAME_AUTOHIDENOTIFY)
+ desired = g_CluiData.bNotifyActive ? TRUE : FALSE;
+ else
+ desired = FALSE;
+
+ if (desired) {
+ if (!dwVisible)
+ CallService(MS_CLIST_FRAMES_SHFRAME, (WPARAM)hNotifyFrame, 0);
+ }
+ else {
+ if (dwVisible)
+ CallService(MS_CLIST_FRAMES_SHFRAME, (WPARAM)hNotifyFrame, 0);
+ }
+}
CListEvent* cli_AddEvent(CLISTEVENT *cle)
{
- CListEvent* p = corecli.pfnAddEvent(cle);
+ CListEvent *p = corecli.pfnAddEvent(cle);
if (p == NULL)
return NULL;
@@ -92,8 +98,7 @@ CListEvent* cli_AddEvent(CLISTEVENT *cle)
mii.fMask = MIIM_DATA | MIIM_BITMAP | MIIM_ID;
if (p->pszService &&
(!strncmp("SRMsg/ReadMessage", p->pszService, _countof("SRMsg/ReadMessage")) ||
- !strncmp("GChat/DblClickEvent", p->pszService, _countof("GChat/DblClickEvent"))))
- {
+ !strncmp("GChat/DblClickEvent", p->pszService, _countof("GChat/DblClickEvent")))) {
// dup check only for msg events
for (int j = 0; j < GetMenuItemCount(g_CluiData.hMenuNotify); j++) {
if (GetMenuItemInfo(g_CluiData.hMenuNotify, j, TRUE, &mii) != 0) {
@@ -208,7 +213,8 @@ struct event_area_t
bkColour(CLCDEFAULT_BKCOLOUR),
useWinColors(CLCDEFAULT_USEWINDOWSCOLOURS),
backgroundBmpUse(CLCDEFAULT_USEBITMAP)
- {}
+ {
+ }
};
static event_area_t event_area;
@@ -216,23 +222,19 @@ static event_area_t event_area;
static BOOL sttDrawEventAreaBackground(HWND hwnd, HDC hdc, RECT *rect)
{
BOOL bFloat = (GetParent(hwnd) != pcli->hwndContactList);
- if (g_CluiData.fDisableSkinEngine || !g_CluiData.fLayered || bFloat)
- {
+ if (g_CluiData.fDisableSkinEngine || !g_CluiData.fLayered || bFloat) {
RECT rc;
+ if (rect)
+ rc = *rect;
+ else
+ GetClientRect(hwnd, &rc);
- if (rect) rc = *rect;
- else GetClientRect(hwnd, &rc);
-
- if (!event_area.hBmpBackground && !event_area.useWinColors)
- {
+ if (!event_area.hBmpBackground && !event_area.useWinColors) {
HBRUSH hbr = CreateSolidBrush(event_area.bkColour);
FillRect(hdc, &rc, hbr);
DeleteObject(hbr);
}
- else
- {
- DrawBackGround(hwnd, hdc, event_area.hBmpBackground, event_area.bkColour, event_area.backgroundBmpUse);
- }
+ else DrawBackGround(hwnd, hdc, event_area.hBmpBackground, event_area.bkColour, event_area.backgroundBmpUse);
}
return TRUE;
}
@@ -241,8 +243,7 @@ COLORREF sttGetColor(char * module, char * color, COLORREF defColor); //clcutils
static int ehhEventAreaBackgroundSettingsChanged(WPARAM, LPARAM)
{
- if (event_area.hBmpBackground)
- {
+ if (event_area.hBmpBackground) {
DeleteObject(event_area.hBmpBackground);
event_area.hBmpBackground = NULL;
}
@@ -279,33 +280,19 @@ void EventArea_ConfigureEventArea()
EventArea_HideShowNotifyFrame();
}
-
-static int EventArea_PaintCallbackProc(HWND hWnd, HDC hDC, RECT *, HRGN, DWORD, void *)
-{
- return EventArea_Draw(hWnd, hDC);
-}
-
-static int EventArea_Draw(HWND hwnd, HDC hDC)
-{
- if (hwnd == (HWND)-1) return 0;
- if (GetParent(hwnd) == pcli->hwndContactList)
- return EventArea_DrawWorker(hwnd, hDC);
-
- cliInvalidateRect(hwnd, NULL, FALSE);
- return 0;
-}
+/////////////////////////////////////////////////////////////////////////////////////////
static int EventArea_DrawWorker(HWND hWnd, HDC hDC)
{
RECT rc;
- HFONT hOldFont;
GetClientRect(hWnd, &rc);
+
if (g_CluiData.fDisableSkinEngine)
sttDrawEventAreaBackground(hWnd, hDC, &rc);
else
SkinDrawGlyph(hDC, &rc, &rc, "Main,ID=EventArea");
- hOldFont = g_clcPainter.ChangeToFont(hDC, NULL, FONTID_EVENTAREA, NULL);
+ HFONT hOldFont = g_clcPainter.ChangeToFont(hDC, NULL, FONTID_EVENTAREA, NULL);
SetBkMode(hDC, TRANSPARENT);
int iCount = GetMenuItemCount(g_CluiData.hMenuNotify);
@@ -324,7 +311,7 @@ static int EventArea_DrawWorker(HWND hWnd, HDC hDC)
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_DATA;
GetMenuItemInfo(g_CluiData.hMenuNotify, iCount - 1, TRUE, &mii);
-
+
NotifyMenuItemExData *nmi = (struct NotifyMenuItemExData *) mii.dwItemData;
TCHAR *szName = pcli->pfnGetContactDisplayName(nmi->hContact, 0);
int iIcon = cli_GetContactIcon(nmi->hContact);
@@ -346,123 +333,60 @@ static int EventArea_DrawWorker(HWND hWnd, HDC hDC)
return 0;
}
-static void EventArea_HideShowNotifyFrame()
-{
- int dwVisible = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, hNotifyFrame), 0) & F_VISIBLE;
- int desired;
-
- if (g_CluiData.dwFlags & CLUI_FRAME_SHOWALWAYS)
- desired = TRUE;
- else if (g_CluiData.dwFlags & CLUI_FRAME_AUTOHIDENOTIFY)
- desired = g_CluiData.bNotifyActive ? TRUE : FALSE;
- else
- desired = FALSE;
-
- if (desired) {
- if (!dwVisible)
- CallService(MS_CLIST_FRAMES_SHFRAME, (WPARAM)hNotifyFrame, 0);
- }
- else {
- if (dwVisible)
- CallService(MS_CLIST_FRAMES_SHFRAME, (WPARAM)hNotifyFrame, 0);
- }
-}
-
-int EventArea_Create(HWND hCluiWnd)
+static int EventArea_Draw(HWND hwnd, HDC hDC)
{
+ if (hwnd == (HWND)-1) return 0;
+ if (GetParent(hwnd) == pcli->hwndContactList)
+ return EventArea_DrawWorker(hwnd, hDC);
- CallService(MS_BACKGROUNDCONFIG_REGISTER, (WPARAM)(LPGEN("Event area background")"/EventArea"), 0);
- HookEvent(ME_BACKGROUNDCONFIG_CHANGED, ehhEventAreaBackgroundSettingsChanged);
- ehhEventAreaBackgroundSettingsChanged(0, 0);
-
- WNDCLASS wndclass = { 0 };
- TCHAR pluginname[] = _T("EventArea");
- int h = GetSystemMetrics(SM_CYSMICON) + 2;
- if (GetClassInfo(g_hInst, pluginname, &wndclass) == 0) {
- wndclass.style = 0;
- wndclass.lpfnWndProc = EventArea_WndProc;
- wndclass.cbClsExtra = 0;
- wndclass.cbWndExtra = 0;
- wndclass.hInstance = g_hInst;
- wndclass.hIcon = NULL;
- wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
- wndclass.hbrBackground = GetSysColorBrush(COLOR_3DFACE);
- wndclass.lpszMenuName = NULL;
- wndclass.lpszClassName = pluginname;
- RegisterClass(&wndclass);
- }
- g_CluiData.hwndEventFrame = CreateWindow(pluginname, pluginname, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN,
- 0, 0, 0, h, hCluiWnd, NULL, g_hInst, NULL);
-
- // register frame
- CLISTFrame Frame = { sizeof(Frame) };
- Frame.hWnd = g_CluiData.hwndEventFrame;
- Frame.align = alBottom;
- Frame.hIcon = Skin_LoadIcon(SKINICON_OTHER_FRAME);
- Frame.Flags = (db_get_b(NULL, "CLUI", "ShowEventArea", SETTING_SHOWEVENTAREAFRAME_DEFAULT) ? F_VISIBLE : 0) | F_LOCKED | F_NOBORDER | F_NO_SUBCONTAINER | F_TCHAR;
- Frame.height = h;
- Frame.tname = _T("EventArea"); //do not translate
- Frame.TBtname = TranslateT("Event area");
- hNotifyFrame = (HANDLE)CallService(MS_CLIST_FRAMES_ADDFRAME, (WPARAM)&Frame, 0);
- CallService(MS_SKINENG_REGISTERPAINTSUB, (WPARAM)Frame.hWnd, (LPARAM)EventArea_PaintCallbackProc); //$$$$$ register sub for frame
- CallService(MS_CLIST_FRAMES_UPDATEFRAME, -1, 0);
- EventArea_HideShowNotifyFrame();
-
- g_CluiData.hMenuNotify = CreatePopupMenu();
- g_CluiData.wNextMenuID = 1;
- EventArea_ConfigureEventArea();
+ cliInvalidateRect(hwnd, NULL, FALSE);
return 0;
}
-int EventArea_UnloadModule()
+static int EventArea_PaintCallbackProc(HWND hWnd, HDC hDC, RECT *, HRGN, DWORD, void *)
{
- // remove frame window
- // remove all events data from menu
- DestroyMenu(g_CluiData.hMenuNotify);
- return 0;
+ return EventArea_Draw(hWnd, hDC);
}
static LRESULT CALLBACK EventArea_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
case WM_MEASUREITEM:
- {
- MEASUREITEMSTRUCT *lpi = (LPMEASUREITEMSTRUCT)lParam;
- MENUITEMINFOA mii = { 0 };
-
- mii.cbSize = sizeof(mii);
- mii.fMask = MIIM_DATA | MIIM_ID;
- if (GetMenuItemInfoA(g_CluiData.hMenuNotify, lpi->itemID, FALSE, &mii) != 0) {
- if (mii.dwItemData == lpi->itemData) {
- lpi->itemWidth = 8 + 16;
- lpi->itemHeight = 0;
- return TRUE;
+ {
+ MEASUREITEMSTRUCT *lpi = (LPMEASUREITEMSTRUCT)lParam;
+ MENUITEMINFOA mii = { 0 };
+ mii.cbSize = sizeof(mii);
+ mii.fMask = MIIM_DATA | MIIM_ID;
+ if (GetMenuItemInfoA(g_CluiData.hMenuNotify, lpi->itemID, FALSE, &mii) != 0) {
+ if (mii.dwItemData == lpi->itemData) {
+ lpi->itemWidth = 8 + 16;
+ lpi->itemHeight = 0;
+ return TRUE;
+ }
}
}
- }
- break;
+ break;
case WM_DRAWITEM:
- {
- LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam;
- if (dis->hwndItem == (HWND)g_CluiData.hMenuNotify) {
- NotifyMenuItemExData *nmi = 0;
-
- MENUITEMINFOA mii = { 0 };
- mii.cbSize = sizeof(mii);
- mii.fMask = MIIM_DATA;
- if (GetMenuItemInfoA(g_CluiData.hMenuNotify, (UINT)dis->itemID, FALSE, &mii) != 0) {
- nmi = (NotifyMenuItemExData *)mii.dwItemData;
- if (nmi) {
- int iIcon = cli_GetContactIcon(nmi->hContact);
- ske_ImageList_DrawEx(g_himlCListClc, nmi->iIcon, dis->hDC, 2, (dis->rcItem.bottom + dis->rcItem.top - GetSystemMetrics(SM_CYSMICON)) / 2, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), CLR_NONE, CLR_NONE, ILD_NORMAL);
- ske_ImageList_DrawEx(g_himlCListClc, iIcon, dis->hDC, 2 + GetSystemMetrics(SM_CXSMICON) + 2, (dis->rcItem.bottom + dis->rcItem.top - GetSystemMetrics(SM_CYSMICON)) / 2, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), CLR_NONE, CLR_NONE, ILD_NORMAL);
- return TRUE;
+ {
+ LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam;
+ if (dis->hwndItem == (HWND)g_CluiData.hMenuNotify) {
+ MENUITEMINFOA mii = { 0 };
+ mii.cbSize = sizeof(mii);
+ mii.fMask = MIIM_DATA;
+ if (GetMenuItemInfoA(g_CluiData.hMenuNotify, (UINT)dis->itemID, FALSE, &mii) != 0) {
+ NotifyMenuItemExData *nmi = (NotifyMenuItemExData *)mii.dwItemData;
+ if (nmi) {
+ int iIcon = cli_GetContactIcon(nmi->hContact);
+ ske_ImageList_DrawEx(g_himlCListClc, nmi->iIcon, dis->hDC, 2, (dis->rcItem.bottom + dis->rcItem.top - GetSystemMetrics(SM_CYSMICON)) / 2, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), CLR_NONE, CLR_NONE, ILD_NORMAL);
+ ske_ImageList_DrawEx(g_himlCListClc, iIcon, dis->hDC, 2 + GetSystemMetrics(SM_CXSMICON) + 2, (dis->rcItem.bottom + dis->rcItem.top - GetSystemMetrics(SM_CYSMICON)) / 2, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), CLR_NONE, CLR_NONE, ILD_NORMAL);
+ return TRUE;
+ }
}
}
}
break;
- }
+
case WM_LBUTTONUP:
if (g_CluiData.bEventAreaEnabled)
SendMessage(hwnd, WM_COMMAND, MAKEWPARAM(IDC_NOTIFYBUTTON, 0), 0);
@@ -470,24 +394,21 @@ static LRESULT CALLBACK EventArea_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LP
case WM_COMMAND:
if (LOWORD(wParam) == IDC_NOTIFYBUTTON) {
- int iSelection;
- struct NotifyMenuItemExData *nmi = 0;
- int iCount = GetMenuItemCount(g_CluiData.hMenuNotify);
- BOOL result;
-
POINT pt;
GetCursorPos(&pt);
MENUITEMINFO mii = { 0 };
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_DATA;
- if (iCount > 1)
+
+ int iSelection;
+ if (GetMenuItemCount(g_CluiData.hMenuNotify) > 1)
iSelection = TrackPopupMenu(g_CluiData.hMenuNotify, TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, NULL);
else
iSelection = GetMenuItemID(g_CluiData.hMenuNotify, 0);
- result = GetMenuItemInfo(g_CluiData.hMenuNotify, (UINT)iSelection, FALSE, &mii);
+ BOOL result = GetMenuItemInfo(g_CluiData.hMenuNotify, (UINT)iSelection, FALSE, &mii);
if (result != 0) {
- nmi = (struct NotifyMenuItemExData *) mii.dwItemData;
+ NotifyMenuItemExData *nmi = (NotifyMenuItemExData*)mii.dwItemData;
if (nmi) {
CLISTEVENT *cle = MyGetEvent(iSelection);
if (cle) {
@@ -517,16 +438,14 @@ static LRESULT CALLBACK EventArea_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LP
if (GetParent(hwnd) == pcli->hwndContactList && g_CluiData.fLayered)
CallService(MS_SKINENG_INVALIDATEFRAMEIMAGE, (WPARAM)hwnd, 0);
else if (GetParent(hwnd) == pcli->hwndContactList && !g_CluiData.fLayered) {
- HDC hdc, hdc2;
- HBITMAP hbmp, hbmpo;
RECT rc = { 0 };
GetClientRect(hwnd, &rc);
rc.right++;
rc.bottom++;
- hdc = GetDC(hwnd);
- hdc2 = CreateCompatibleDC(hdc);
- hbmp = ske_CreateDIB32(rc.right, rc.bottom);
- hbmpo = (HBITMAP)SelectObject(hdc2, hbmp);
+ HDC hdc = GetDC(hwnd);
+ HDC hdc2 = CreateCompatibleDC(hdc);
+ HBITMAP hbmp = ske_CreateDIB32(rc.right, rc.bottom);
+ HBITMAP hbmpo = (HBITMAP)SelectObject(hdc2, hbmp);
ske_BltBackImage(hwnd, hdc2, &rc);
EventArea_DrawWorker(hwnd, hdc2);
BitBlt(hdc, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top,
@@ -539,16 +458,14 @@ static LRESULT CALLBACK EventArea_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LP
ValidateRect(hwnd, NULL);
}
else {
- HDC hdc, hdc2;
- HBITMAP hbmp, hbmpo;
RECT rc;
- PAINTSTRUCT ps;
- HBRUSH br = GetSysColorBrush(COLOR_3DFACE);
GetClientRect(hwnd, &rc);
- hdc = BeginPaint(hwnd, &ps);
- hdc2 = CreateCompatibleDC(hdc);
- hbmp = ske_CreateDIB32(rc.right, rc.bottom);
- hbmpo = (HBITMAP)SelectObject(hdc2, hbmp);
+ HBRUSH br = GetSysColorBrush(COLOR_3DFACE);
+ PAINTSTRUCT ps;
+ HDC hdc = BeginPaint(hwnd, &ps);
+ HDC hdc2 = CreateCompatibleDC(hdc);
+ HBITMAP hbmp = ske_CreateDIB32(rc.right, rc.bottom);
+ HBITMAP hbmpo = (HBITMAP)SelectObject(hdc2, hbmp);
FillRect(hdc2, &ps.rcPaint, br);
EventArea_DrawWorker(hwnd, hdc2);
BitBlt(hdc, ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right - ps.rcPaint.left, ps.rcPaint.bottom - ps.rcPaint.top,
@@ -565,3 +482,56 @@ static LRESULT CALLBACK EventArea_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LP
}
return TRUE;
}
+
+int EventArea_Create(HWND hCluiWnd)
+{
+ CallService(MS_BACKGROUNDCONFIG_REGISTER, (WPARAM)(LPGEN("Event area background")"/EventArea"), 0);
+ HookEvent(ME_BACKGROUNDCONFIG_CHANGED, ehhEventAreaBackgroundSettingsChanged);
+ ehhEventAreaBackgroundSettingsChanged(0, 0);
+
+ WNDCLASS wndclass = { 0 };
+ TCHAR pluginname[] = _T("EventArea");
+ int h = GetSystemMetrics(SM_CYSMICON) + 2;
+ if (GetClassInfo(g_hInst, pluginname, &wndclass) == 0) {
+ wndclass.style = 0;
+ wndclass.lpfnWndProc = EventArea_WndProc;
+ wndclass.cbClsExtra = 0;
+ wndclass.cbWndExtra = 0;
+ wndclass.hInstance = g_hInst;
+ wndclass.hIcon = NULL;
+ wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wndclass.hbrBackground = GetSysColorBrush(COLOR_3DFACE);
+ wndclass.lpszMenuName = NULL;
+ wndclass.lpszClassName = pluginname;
+ RegisterClass(&wndclass);
+ }
+ g_CluiData.hwndEventFrame = CreateWindow(pluginname, pluginname, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN,
+ 0, 0, 0, h, hCluiWnd, NULL, g_hInst, NULL);
+
+ // register frame
+ CLISTFrame Frame = { sizeof(Frame) };
+ Frame.hWnd = g_CluiData.hwndEventFrame;
+ Frame.align = alBottom;
+ Frame.hIcon = Skin_LoadIcon(SKINICON_OTHER_FRAME);
+ Frame.Flags = (db_get_b(NULL, "CLUI", "ShowEventArea", SETTING_SHOWEVENTAREAFRAME_DEFAULT) ? F_VISIBLE : 0) | F_LOCKED | F_NOBORDER | F_NO_SUBCONTAINER | F_TCHAR;
+ Frame.height = h;
+ Frame.tname = _T("EventArea"); //do not translate
+ Frame.TBtname = TranslateT("Event area");
+ hNotifyFrame = (HANDLE)CallService(MS_CLIST_FRAMES_ADDFRAME, (WPARAM)&Frame, 0);
+ CallService(MS_SKINENG_REGISTERPAINTSUB, (WPARAM)Frame.hWnd, (LPARAM)EventArea_PaintCallbackProc); //$$$$$ register sub for frame
+ CallService(MS_CLIST_FRAMES_UPDATEFRAME, -1, 0);
+ EventArea_HideShowNotifyFrame();
+
+ g_CluiData.hMenuNotify = CreatePopupMenu();
+ g_CluiData.wNextMenuID = 1;
+ EventArea_ConfigureEventArea();
+ return 0;
+}
+
+int EventArea_UnloadModule()
+{
+ // remove frame window
+ // remove all events data from menu
+ DestroyMenu(g_CluiData.hMenuNotify);
+ return 0;
+}
diff --git a/plugins/Clist_modern/src/modern_clistmenus.cpp b/plugins/Clist_modern/src/modern_clistmenus.cpp
index 7c0108265e..1eef9fc23e 100644
--- a/plugins/Clist_modern/src/modern_clistmenus.cpp
+++ b/plugins/Clist_modern/src/modern_clistmenus.cpp
@@ -72,10 +72,10 @@ static HGENMENU hFavoriteContactMenuItems[_countof(rates)];
static IconItem iconList[] =
{
- { LPGEN("Contact rate: none"), "Rate1", IDI_FAVORITE_0 },
- { LPGEN("Contact rate: low"), "Rate2", IDI_FAVORITE_1 },
+ { LPGEN("Contact rate: none"), "Rate1", IDI_FAVORITE_0 },
+ { LPGEN("Contact rate: low"), "Rate2", IDI_FAVORITE_1 },
{ LPGEN("Contact rate: medium"), "Rate3", IDI_FAVORITE_2 },
- { LPGEN("Contact rate: high"), "Rate4", IDI_FAVORITE_3 }
+ { LPGEN("Contact rate: high"), "Rate4", IDI_FAVORITE_3 }
};
static int FAV_OnContactMenuBuild(WPARAM hContact, LPARAM)
diff --git a/plugins/Clist_modern/src/modern_rowheight_funcs.cpp b/plugins/Clist_modern/src/modern_rowheight_funcs.cpp
index fbd3362f7e..d57c546a3a 100644
--- a/plugins/Clist_modern/src/modern_rowheight_funcs.cpp
+++ b/plugins/Clist_modern/src/modern_rowheight_funcs.cpp
@@ -547,7 +547,7 @@ int cliGetRowTopY(ClcData *dat, int item)
int cliGetRowBottomY(ClcData *dat, int item)
{
if (!dat->row_variable_height)
- return (item+1) * dat->rowHeight;
+ return (item + 1) * dat->rowHeight;
if (item >= dat->row_heights_size)
return -1;
diff --git a/plugins/Clist_modern/src/modern_tbbutton.cpp b/plugins/Clist_modern/src/modern_tbbutton.cpp
index c36cfdf1a5..34a6339e60 100644
--- a/plugins/Clist_modern/src/modern_tbbutton.cpp
+++ b/plugins/Clist_modern/src/modern_tbbutton.cpp
@@ -190,7 +190,7 @@ static void PaintWorker(TBBUTTONDATA *bct, HDC hdcPaint, POINT *pOffset)
if (bct->hIcon && (rcIcon.right > rcTemp.right || rcIcon.bottom > rcTemp.bottom || rcIcon.left < rcTemp.left || rcIcon.top < rcTemp.top))
bct->hIcon = NULL;
- if (bHasText && (rcText.right>rcTemp.right || rcText.bottom>rcTemp.bottom || rcText.left < rcTemp.left || rcText.top < rcTemp.top))
+ if (bHasText && (rcText.right > rcTemp.right || rcText.bottom > rcTemp.bottom || rcText.left < rcTemp.left || rcText.top < rcTemp.top))
bHasText = FALSE;
if (bct->hIcon) {
@@ -297,30 +297,30 @@ static LRESULT CALLBACK ToolbarButtonProc(HWND hwndDlg, UINT msg, WPARAM wParam
return 0;
case WM_LBUTTONDOWN:
- {
- POINT ptMouse = UNPACK_POINT(lParam);
+ {
+ POINT ptMouse = UNPACK_POINT(lParam);
- RECT rcClient;
- GetClientRect(bct->hwnd, &rcClient);
- if (!PtInRect(&rcClient, ptMouse)) {
- bct->bHotMark = false;
- ReleaseCapture();
- }
- else {
- if (bct->stateId != PBS_DISABLED && bct->stateId != PBS_PRESSED) {
- bct->stateId = PBS_PRESSED;
- bct->bHotMark = true;
- InvalidateParentRect(bct->hwnd, NULL, TRUE);
- if (bct->bSendOnDown) {
- SendMessage(GetParent(hwndDlg), WM_COMMAND, MAKELONG(GetDlgCtrlID(hwndDlg), BN_CLICKED), (LPARAM)hwndDlg);
- bct->stateId = PBS_NORMAL;
+ RECT rcClient;
+ GetClientRect(bct->hwnd, &rcClient);
+ if (!PtInRect(&rcClient, ptMouse)) {
+ bct->bHotMark = false;
+ ReleaseCapture();
+ }
+ else {
+ if (bct->stateId != PBS_DISABLED && bct->stateId != PBS_PRESSED) {
+ bct->stateId = PBS_PRESSED;
+ bct->bHotMark = true;
InvalidateParentRect(bct->hwnd, NULL, TRUE);
+ if (bct->bSendOnDown) {
+ SendMessage(GetParent(hwndDlg), WM_COMMAND, MAKELONG(GetDlgCtrlID(hwndDlg), BN_CLICKED), (LPARAM)hwndDlg);
+ bct->stateId = PBS_NORMAL;
+ InvalidateParentRect(bct->hwnd, NULL, TRUE);
+ }
}
+ SetCapture(bct->hwnd);
}
- SetCapture(bct->hwnd);
}
- }
- return 0;
+ return 0;
case WM_LBUTTONUP:
if (GetCapture() == bct->hwnd) {
@@ -355,48 +355,50 @@ static LRESULT CALLBACK ToolbarButtonProc(HWND hwndDlg, UINT msg, WPARAM wParam
return 0;
case WM_MOUSEMOVE:
- {
- BOOL bPressed = (wParam & MK_LBUTTON) != 0;
- if (bPressed && !bct->bHotMark)
- break;
-
- RECT rc;
- POINT pt;
- GetWindowRect(hwndDlg, &rc);
- GetCursorPos(&pt);
- BOOL inClient = PtInRect(&rc, pt);
- if (inClient) {
- SetCapture(bct->hwnd);
- if (bct->stateId == PBS_NORMAL) {
- bct->stateId = PBS_HOT;
- InvalidateParentRect(bct->hwnd, NULL, TRUE);
+ {
+ BOOL bPressed = (wParam & MK_LBUTTON) != 0;
+ if (bPressed && !bct->bHotMark)
+ break;
+
+ RECT rc;
+ GetWindowRect(hwndDlg, &rc);
+
+ POINT pt;
+ GetCursorPos(&pt);
+
+ BOOL inClient = PtInRect(&rc, pt);
+ if (inClient) {
+ SetCapture(bct->hwnd);
+ if (bct->stateId == PBS_NORMAL) {
+ bct->stateId = PBS_HOT;
+ InvalidateParentRect(bct->hwnd, NULL, TRUE);
+ }
}
- }
- if (!inClient && bct->stateId == PBS_PRESSED) {
- bct->stateId = PBS_HOT;
- InvalidateParentRect(bct->hwnd, NULL, TRUE);
- }
- else if (inClient && bct->stateId == PBS_HOT && bPressed) {
- if (bct->bHotMark) {
- bct->stateId = PBS_PRESSED;
+ if (!inClient && bct->stateId == PBS_PRESSED) {
+ bct->stateId = PBS_HOT;
InvalidateParentRect(bct->hwnd, NULL, TRUE);
}
+ else if (inClient && bct->stateId == PBS_HOT && bPressed) {
+ if (bct->bHotMark) {
+ bct->stateId = PBS_PRESSED;
+ InvalidateParentRect(bct->hwnd, NULL, TRUE);
+ }
+ }
+ else if (!inClient && !bPressed) {
+ bct->bHotMark = false;
+ ReleaseCapture();
+ }
}
- else if (!inClient && !bPressed) {
- bct->bHotMark = false;
- ReleaseCapture();
- }
- }
- return 0;
+ return 0;
case WM_NCHITTEST:
- {
- LRESULT lr = SendMessage(GetParent(hwndDlg), WM_NCHITTEST, wParam, lParam);
- if (lr == HTLEFT || lr == HTRIGHT || lr == HTBOTTOM || lr == HTTOP || lr == HTTOPLEFT || lr == HTTOPRIGHT || lr == HTBOTTOMLEFT || lr == HTBOTTOMRIGHT)
- return HTTRANSPARENT;
- }
- break;
+ {
+ LRESULT lr = SendMessage(GetParent(hwndDlg), WM_NCHITTEST, wParam, lParam);
+ if (lr == HTLEFT || lr == HTRIGHT || lr == HTBOTTOM || lr == HTTOP || lr == HTTOPLEFT || lr == HTTOPRIGHT || lr == HTBOTTOMLEFT || lr == HTBOTTOMRIGHT)
+ return HTTRANSPARENT;
+ }
+ break;
case BM_SETCHECK:
if (!bct->bIsPushBtn) break;
@@ -501,4 +503,4 @@ HRESULT ToolbarButtonLoadModule()
void ToolbarButtonUnloadModule()
{
WindowList_Destroy(hButtonWindowList);
-} \ No newline at end of file
+}