From 3c835ffde2e9d9aad789f222413f99e878efa157 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 9 Nov 2012 22:56:52 +0000 Subject: nicer+ own extra icons spacing settings removed git-svn-id: http://svn.miranda-ng.org/main/trunk@2266 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_nicer/res/resource.rc | 3 - plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp | 643 ++++++++++------------ plugins/Clist_nicer/src/Include/clc.h | 1 - plugins/Clist_nicer/src/Include/resource.h | 2 - plugins/Clist_nicer/src/clcpaint.cpp | 23 +- plugins/Clist_nicer/src/clcutils.cpp | 8 +- plugins/Clist_nicer/src/clui.cpp | 1 - plugins/Clist_nicer/src/cluiopts.cpp | 20 +- plugins/Clist_nicer/src/extBackg.cpp | 5 - 9 files changed, 319 insertions(+), 387 deletions(-) (limited to 'plugins') diff --git a/plugins/Clist_nicer/res/resource.rc b/plugins/Clist_nicer/res/resource.rc index ab9a470993..4eb41e7da9 100644 --- a/plugins/Clist_nicer/res/resource.rc +++ b/plugins/Clist_nicer/res/resource.rc @@ -302,9 +302,6 @@ BEGIN CONTROL "Pin to desktop",IDC_ONDESKTOP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,96,128,10 CONTROL "Show drop shadow (restart required)",IDC_DROPSHADOW, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,108,138,10 - LTEXT "Extra icon size",IDC_STATIC,11,123,81,11 - EDITTEXT IDC_EXICONSCALE,95,121,31,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER - CONTROL "",IDC_EXICONSCALESPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_HOTTRACK,115,121,12,14 CONTROL "Hide contact list after it has been idle for",IDC_AUTOHIDE, "Button",BS_AUTOCHECKBOX | BS_TOP | BS_MULTILINE | WS_TABSTOP,139,11,160,10 EDITTEXT IDC_HIDETIME,150,21,38,12,ES_RIGHT | ES_NUMBER diff --git a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp index f65341ad9a..cf91ea9106 100644 --- a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp +++ b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp @@ -2614,197 +2614,161 @@ LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA memset(&rect, 0, sizeof(rect)); switch (msg) { - case WM_CREATE: - return FALSE; - case WM_MEASUREITEM: - return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam); - case WM_DRAWITEM: - return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam); - - case WM_ENABLE: - if (hwnd != 0) InvalidateRect(hwnd, NULL, FALSE); - return 0; - case WM_SIZE: - return 0; - /* - case WM_PRINT: - case WM_PRINTCLIENT: - InvalidateRect(hwnd,NULL,FALSE); - { - RECT rect; - HDC dc; - GetClientRect(hwnd,&rect); - //DrawTitleBar(wParam,rect,Frameid); - SendMessage(hwnd,WM_PAINT,0,0); - SendMessage(hwnd,WM_NCPAINT,1,0); - dc=GetDC(hwnd); - SendMessage(hwnd,WM_ERASEBKGND,dc,0); - ReleaseDC(hwnd,dc); - SendMessage(hwnd,WM_PAINT,0,0); - // UpdateWindow(hwnd); - return(0); - } - */ - /* - case WM_NCPAINT: - { - - // if (wParam==1) break; - { POINT ptTopLeft={0,0}; - HRGN hClientRgn; - ClientToScreen(hwnd,&ptTopLeft); - hClientRgn=CreateRectRgn(0,0,1,1); - CombineRgn(hClientRgn,(HRGN)wParam,NULL,RGN_COPY); - OffsetRgn(hClientRgn,-ptTopLeft.x,-ptTopLeft.y); - InvalidateRgn(hwnd,hClientRgn,FALSE); - DeleteObject(hClientRgn); - UpdateWindow(hwnd); - } - //return(0); - }; - */ - - - case WM_COMMAND: - if (ServiceExists(MO_CREATENEWMENUOBJECT)) { - if (ProcessCommandProxy(MAKEWPARAM(LOWORD(wParam), 0), (LPARAM)Frameid)) - break; - } else { - if (CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTEXTFRAMEMENU), (LPARAM)Frameid)) - break; - } - - if (HIWORD(wParam) == 0) {//mouse events for self created menu - int framepos = id2pos(Frameid); - if (framepos == -1) - break; - - switch (LOWORD(wParam)) { - case frame_menu_lock: - Frames[framepos].Locked = !Frames[framepos].Locked; - break; - case frame_menu_visible: - Frames[framepos].visible = !Frames[framepos].visible; - break; - case frame_menu_showtitlebar: - Frames[framepos].TitleBar.ShowTitleBar = !Frames[framepos].TitleBar.ShowTitleBar; - break; - case frame_menu_floating: - CLUIFrameSetFloat(Frameid, 0); - break; - } - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); - } - - break; - case WM_RBUTTONDOWN: { - HMENU hmenu; - POINT pt; - GetCursorPos(&pt); + case WM_CREATE: + return FALSE; + case WM_MEASUREITEM: + return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam); + case WM_DRAWITEM: + return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam); + + case WM_ENABLE: + if (hwnd != 0) InvalidateRect(hwnd, NULL, FALSE); + return 0; + case WM_SIZE: + return 0; - if (ServiceExists(MS_CLIST_MENUBUILDFRAMECONTEXT)) { - hmenu = (HMENU)CallService(MS_CLIST_MENUBUILDFRAMECONTEXT, Frameid, 0); - } else { - int framepos = id2pos(Frameid); + case WM_COMMAND: + if (ServiceExists(MO_CREATENEWMENUOBJECT)) { + if (ProcessCommandProxy(MAKEWPARAM(LOWORD(wParam), 0), (LPARAM)Frameid)) + break; + } + else { + if (CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTEXTFRAMEMENU), (LPARAM)Frameid)) + break; + } - lockfrm(); - if (framepos == -1) { - ulockfrm(); - break; - } - hmenu = CreatePopupMenu(); - AppendMenu(hmenu, MF_STRING | MF_DISABLED | MF_GRAYED, 15, Frames[framepos].name); - AppendMenu(hmenu, MF_SEPARATOR, 16, _T("")); - - if (Frames[framepos].Locked) - AppendMenu(hmenu, MF_STRING | MF_CHECKED, frame_menu_lock, TranslateT("Lock Frame")); - else - AppendMenu(hmenu, MF_STRING, frame_menu_lock, TranslateT("Lock Frame")); - - if (Frames[framepos].visible) - AppendMenu(hmenu, MF_STRING | MF_CHECKED, frame_menu_visible, TranslateT("Visible")); - else - AppendMenu(hmenu, MF_STRING, frame_menu_visible, TranslateT("Visible")); - - if (Frames[framepos].TitleBar.ShowTitleBar) - AppendMenu(hmenu, MF_STRING | MF_CHECKED, frame_menu_showtitlebar, TranslateT("Show TitleBar")); - else - AppendMenu(hmenu, MF_STRING, frame_menu_showtitlebar, TranslateT("Show TitleBar")); - - if (Frames[framepos].Skinned) - AppendMenu(hmenu, MF_STRING | MF_CHECKED, frame_menu_skinned, TranslateT("Skinned frame")); - else - AppendMenu(hmenu, MF_STRING, frame_menu_skinned, TranslateT("Skinned frame")); - - if (Frames[framepos].floating) - AppendMenu(hmenu, MF_STRING | MF_CHECKED, frame_menu_floating, TranslateT("Floating")); - else - AppendMenu(hmenu, MF_STRING, frame_menu_floating, TranslateT("Floating")); + if (HIWORD(wParam) == 0) {//mouse events for self created menu + int framepos = id2pos(Frameid); + if (framepos == -1) + break; - ulockfrm(); + switch (LOWORD(wParam)) { + case frame_menu_lock: + Frames[framepos].Locked = !Frames[framepos].Locked; + break; + case frame_menu_visible: + Frames[framepos].visible = !Frames[framepos].visible; + break; + case frame_menu_showtitlebar: + Frames[framepos].TitleBar.ShowTitleBar = !Frames[framepos].TitleBar.ShowTitleBar; + break; + case frame_menu_floating: + CLUIFrameSetFloat(Frameid, 0); + break; } - TrackPopupMenu(hmenu, TPM_LEFTALIGN, pt.x, pt.y, 0, hwnd, 0); - DestroyMenu(hmenu); - } - break; - case WM_LBUTTONDBLCLK: { - Framemod = -1; - lbypos = -1; - oldframeheight = -1; - ReleaseCapture(); - CallService(MS_CLIST_FRAMES_UCOLLFRAME, Frameid, 0); - lbypos = -1; - oldframeheight = -1; - ReleaseCapture(); + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); } - break; - case WM_LBUTTONUP: { - if (GetCapture() != hwnd) { - break; - }; - curdragbar = -1; - lbypos = -1; - oldframeheight = -1; - ReleaseCapture(); - RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); - break; - }; - case WM_LBUTTONDOWN: { + break; + case WM_RBUTTONDOWN: { + HMENU hmenu; + POINT pt; + GetCursorPos(&pt); + if (ServiceExists(MS_CLIST_MENUBUILDFRAMECONTEXT)) { + hmenu = (HMENU)CallService(MS_CLIST_MENUBUILDFRAMECONTEXT, Frameid, 0); + } else { int framepos = id2pos(Frameid); + lockfrm(); if (framepos == -1) { ulockfrm(); break; } - if (Frames[framepos].floating) { + hmenu = CreatePopupMenu(); + AppendMenu(hmenu, MF_STRING | MF_DISABLED | MF_GRAYED, 15, Frames[framepos].name); + AppendMenu(hmenu, MF_SEPARATOR, 16, _T("")); - POINT pt; - GetCursorPos(&pt); - Frames[framepos].TitleBar.oldpos = pt; - } + if (Frames[framepos].Locked) + AppendMenu(hmenu, MF_STRING | MF_CHECKED, frame_menu_lock, TranslateT("Lock Frame")); + else + AppendMenu(hmenu, MF_STRING, frame_menu_lock, TranslateT("Lock Frame")); + + if (Frames[framepos].visible) + AppendMenu(hmenu, MF_STRING | MF_CHECKED, frame_menu_visible, TranslateT("Visible")); + else + AppendMenu(hmenu, MF_STRING, frame_menu_visible, TranslateT("Visible")); + + if (Frames[framepos].TitleBar.ShowTitleBar) + AppendMenu(hmenu, MF_STRING | MF_CHECKED, frame_menu_showtitlebar, TranslateT("Show TitleBar")); + else + AppendMenu(hmenu, MF_STRING, frame_menu_showtitlebar, TranslateT("Show TitleBar")); + + if (Frames[framepos].Skinned) + AppendMenu(hmenu, MF_STRING | MF_CHECKED, frame_menu_skinned, TranslateT("Skinned frame")); + else + AppendMenu(hmenu, MF_STRING, frame_menu_skinned, TranslateT("Skinned frame")); + + if (Frames[framepos].floating) + AppendMenu(hmenu, MF_STRING | MF_CHECKED, frame_menu_floating, TranslateT("Floating")); + else + AppendMenu(hmenu, MF_STRING, frame_menu_floating, TranslateT("Floating")); - if ((!(wParam&MK_CONTROL)) && Frames[framepos].Locked && (!(Frames[framepos].floating))) { - if (cfg::getByte("CLUI", "ClientAreaDrag", 0)) { - POINT pt; - GetCursorPos(&pt); - ulockfrm(); - return SendMessage(GetParent(hwnd), WM_SYSCOMMAND, SC_MOVE | HTCAPTION, MAKELPARAM(pt.x, pt.y)); - } - } - if (Frames[framepos].floating) { - RECT rc; - GetCursorPos(&ptOld); - GetWindowRect(hwnd, &rc); - nLeft = (short)rc.left; - nTop = (short)rc.top; - } ulockfrm(); - SetCapture(hwnd); + } + TrackPopupMenu(hmenu, TPM_LEFTALIGN, pt.x, pt.y, 0, hwnd, 0); + DestroyMenu(hmenu); + } + break; + case WM_LBUTTONDBLCLK: { + Framemod = -1; + lbypos = -1; + oldframeheight = -1; + ReleaseCapture(); + CallService(MS_CLIST_FRAMES_UCOLLFRAME, Frameid, 0); + lbypos = -1; + oldframeheight = -1; + ReleaseCapture(); + } + break; + + case WM_LBUTTONUP: { + if (GetCapture() != hwnd) { break; + }; + curdragbar = -1; + lbypos = -1; + oldframeheight = -1; + ReleaseCapture(); + RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); + break; + }; + case WM_LBUTTONDOWN: { + + int framepos = id2pos(Frameid); + lockfrm(); + if (framepos == -1) { + ulockfrm(); + break; + } + if (Frames[framepos].floating) { + + POINT pt; + GetCursorPos(&pt); + Frames[framepos].TitleBar.oldpos = pt; + } + + if ((!(wParam&MK_CONTROL)) && Frames[framepos].Locked && (!(Frames[framepos].floating))) { + if (cfg::getByte("CLUI", "ClientAreaDrag", 0)) { + POINT pt; + GetCursorPos(&pt); + ulockfrm(); + return SendMessage(GetParent(hwnd), WM_SYSCOMMAND, SC_MOVE | HTCAPTION, MAKELPARAM(pt.x, pt.y)); + } } - case WM_MOUSEMOVE: { + if (Frames[framepos].floating) { + RECT rc; + GetCursorPos(&ptOld); + GetWindowRect(hwnd, &rc); + nLeft = (short)rc.left; + nTop = (short)rc.top; + } + ulockfrm(); + SetCapture(hwnd); + break; + } + case WM_MOUSEMOVE: + { POINT pt, pt2; RECT wndr; int pos; @@ -2817,11 +2781,11 @@ LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA if (pos != -1) { int oldflags; wsprintfA(TBcapt, "%s - h:%d, vis:%d, fl:%d, fl:(%d,%d,%d,%d),or: %d", - Frames[pos].name, Frames[pos].height, Frames[pos].visible, Frames[pos].floating, - Frames[pos].FloatingPos.x, Frames[pos].FloatingPos.y, - Frames[pos].FloatingSize.x, Frames[pos].FloatingSize.y, - Frames[pos].order - ); + Frames[pos].name, Frames[pos].height, Frames[pos].visible, Frames[pos].floating, + Frames[pos].FloatingPos.x, Frames[pos].FloatingPos.y, + Frames[pos].FloatingSize.x, Frames[pos].FloatingSize.y, + Frames[pos].order + ); oldflags = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, Frames[pos].id), 0); if ( !(oldflags&F_SHOWTBTIP)) @@ -2829,7 +2793,7 @@ LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA } ulockfrm(); } - if ((wParam&MK_LBUTTON)/*&&(wParam&MK_CONTROL)*/) { + if (wParam & MK_LBUTTON) { RECT rcMiranda; RECT rcwnd, rcOverlap; POINT newpt, ofspt, curpt, newpos; @@ -2919,7 +2883,7 @@ LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA } ulockfrm(); } - if (wParam&MK_LBUTTON) { + if (wParam & MK_LBUTTON) { int newh = -1, prevold; if (GetCapture() != hwnd) @@ -2931,7 +2895,6 @@ LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA if (Frames[pos].floating) { GetCursorPos(&pt); if ((Frames[pos].TitleBar.oldpos.x != pt.x) || (Frames[pos].TitleBar.oldpos.y != pt.y)) { - pt2 = pt; ScreenToClient(hwnd, &pt2); GetWindowRect(Frames[pos].ContainerWnd, &wndr); @@ -2953,12 +2916,12 @@ LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA } else { SetWindowPos(Frames[pos].ContainerWnd, - 0, - nLeft, - nTop, - 0, - 0, - SWP_NOSIZE | SWP_NOZORDER); + 0, + nLeft, + nTop, + 0, + 0, + SWP_NOSIZE | SWP_NOZORDER); } ptOld = ptNew; } @@ -3032,44 +2995,44 @@ LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA ReleaseCapture(); } break; - case WM_NCPAINT: { - if (GetWindowLongPtr(hwnd, GWL_STYLE) & WS_BORDER) { - HDC hdc = GetWindowDC(hwnd); - HPEN hPenOld = reinterpret_cast(SelectObject(hdc, g_hPenCLUIFrames)); - RECT rcWindow, rc; - HBRUSH brold; - - CallWindowProc(DefWindowProc, hwnd, msg, wParam, lParam); - GetWindowRect(hwnd, &rcWindow); - rc.left = rc.top = 0; - rc.right = rcWindow.right - rcWindow.left; - rc.bottom = rcWindow.bottom - rcWindow.top; - brold = reinterpret_cast(SelectObject(hdc, GetStockObject(HOLLOW_BRUSH))); - Rectangle(hdc, 0, 0, rcWindow.right - rcWindow.left, rcWindow.bottom - rcWindow.top); - SelectObject(hdc, hPenOld); - SelectObject(hdc, brold); - ReleaseDC(hwnd, hdc); - return 0; - } - break; - } - case WM_PRINT: - case WM_PRINTCLIENT: { - GetClientRect(hwnd, &rect); - DrawTitleBar((HDC)wParam, rect, Frameid); - } - case WM_PAINT: { - HDC paintDC; - PAINTSTRUCT paintStruct; - - paintDC = BeginPaint(hwnd, &paintStruct); - rect = paintStruct.rcPaint; - DrawTitleBar(paintDC, rect, Frameid); - EndPaint(hwnd, &paintStruct); + case WM_NCPAINT: { + if (GetWindowLongPtr(hwnd, GWL_STYLE) & WS_BORDER) { + HDC hdc = GetWindowDC(hwnd); + HPEN hPenOld = reinterpret_cast(SelectObject(hdc, g_hPenCLUIFrames)); + RECT rcWindow, rc; + HBRUSH brold; + + CallWindowProc(DefWindowProc, hwnd, msg, wParam, lParam); + GetWindowRect(hwnd, &rcWindow); + rc.left = rc.top = 0; + rc.right = rcWindow.right - rcWindow.left; + rc.bottom = rcWindow.bottom - rcWindow.top; + brold = reinterpret_cast(SelectObject(hdc, GetStockObject(HOLLOW_BRUSH))); + Rectangle(hdc, 0, 0, rcWindow.right - rcWindow.left, rcWindow.bottom - rcWindow.top); + SelectObject(hdc, hPenOld); + SelectObject(hdc, brold); + ReleaseDC(hwnd, hdc); return 0; } - default: - return DefWindowProc(hwnd, msg, wParam, lParam); + break; + } + case WM_PRINT: + case WM_PRINTCLIENT: { + GetClientRect(hwnd, &rect); + DrawTitleBar((HDC)wParam, rect, Frameid); + } + case WM_PAINT: { + HDC paintDC; + PAINTSTRUCT paintStruct; + + paintDC = BeginPaint(hwnd, &paintStruct); + rect = paintStruct.rcPaint; + DrawTitleBar(paintDC, rect, Frameid); + EndPaint(hwnd, &paintStruct); + return 0; + } + default: + return DefWindowProc(hwnd, msg, wParam, lParam); } return TRUE; } @@ -3126,123 +3089,117 @@ static int CLUIFrameOnMainMenuBuild(WPARAM wParam, LPARAM lParam) LRESULT CALLBACK CLUIFrameContainerWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { - + int framepos; RECT rect; INT_PTR Frameid = GetWindowLongPtr(hwnd, GWLP_USERDATA); - memset(&rect, 0, sizeof(rect)); + switch (msg) { - case WM_CREATE: { - int framepos; - lockfrm(); - framepos = id2pos(Frameid); - ulockfrm(); - return(0); - } - case WM_GETMINMAXINFO: { - int framepos; - MINMAXINFO minmax; + case WM_CREATE: + lockfrm(); + framepos = id2pos(Frameid); + ulockfrm(); + return 0; - TitleBarH = cfg::dat.titleBarHeight; - lockfrm(); + case WM_GETMINMAXINFO: + TitleBarH = cfg::dat.titleBarHeight; + lockfrm(); - framepos = id2pos(Frameid); - if (framepos < 0 || framepos >= nFramescount) { - ulockfrm(); - break; - } - if ( !Frames[framepos].minmaxenabled) { - ulockfrm(); - break; - } - if (Frames[framepos].ContainerWnd == 0) { - ulockfrm(); - break; - } - if (Frames[framepos].Locked) { - RECT rct; - - GetWindowRect(hwnd, &rct); - ((LPMINMAXINFO)lParam)->ptMinTrackSize.x = rct.right - rct.left; - ((LPMINMAXINFO)lParam)->ptMinTrackSize.y = rct.bottom - rct.top; - ((LPMINMAXINFO)lParam)->ptMaxTrackSize.x = rct.right - rct.left; - ((LPMINMAXINFO)lParam)->ptMaxTrackSize.y = rct.bottom - rct.top; - } - - memset(&minmax, 0, sizeof(minmax)); - if (SendMessage(Frames[framepos].hWnd, WM_GETMINMAXINFO, 0, (LPARAM)&minmax) == 0) { - RECT border; - int tbh = TitleBarH * btoint(Frames[framepos].TitleBar.ShowTitleBar); - GetBorderSize(hwnd, &border); - if (minmax.ptMaxTrackSize.x != 0 && minmax.ptMaxTrackSize.y != 0) { - - ((LPMINMAXINFO)lParam)->ptMinTrackSize.x = minmax.ptMinTrackSize.x; - ((LPMINMAXINFO)lParam)->ptMinTrackSize.y = minmax.ptMinTrackSize.y; - ((LPMINMAXINFO)lParam)->ptMaxTrackSize.x = minmax.ptMaxTrackSize.x + border.left + border.right; - ((LPMINMAXINFO)lParam)->ptMaxTrackSize.y = minmax.ptMaxTrackSize.y + tbh + border.top + border.bottom; - } - } else { - ulockfrm(); - return(DefWindowProc(hwnd, msg, wParam, lParam)); - } + framepos = id2pos(Frameid); + if (framepos < 0 || framepos >= nFramescount) { ulockfrm(); + break; + } + if ( !Frames[framepos].minmaxenabled) { + ulockfrm(); + break; + } + if (Frames[framepos].ContainerWnd == 0) { + ulockfrm(); + break; + } + if (Frames[framepos].Locked) { + RECT rct; + + GetWindowRect(hwnd, &rct); + ((LPMINMAXINFO)lParam)->ptMinTrackSize.x = rct.right - rct.left; + ((LPMINMAXINFO)lParam)->ptMinTrackSize.y = rct.bottom - rct.top; + ((LPMINMAXINFO)lParam)->ptMaxTrackSize.x = rct.right - rct.left; + ((LPMINMAXINFO)lParam)->ptMaxTrackSize.y = rct.bottom - rct.top; } - case WM_MOVE: { - int framepos; - RECT rect; - - lockfrm(); - framepos = id2pos(Frameid); - if (framepos < 0 || framepos >= nFramescount) { - ulockfrm(); - break; + MINMAXINFO minmax; + memset(&minmax, 0, sizeof(minmax)); + if (SendMessage(Frames[framepos].hWnd, WM_GETMINMAXINFO, 0, (LPARAM)&minmax) == 0) { + RECT border; + int tbh = TitleBarH * btoint(Frames[framepos].TitleBar.ShowTitleBar); + GetBorderSize(hwnd, &border); + if (minmax.ptMaxTrackSize.x != 0 && minmax.ptMaxTrackSize.y != 0) { + + ((LPMINMAXINFO)lParam)->ptMinTrackSize.x = minmax.ptMinTrackSize.x; + ((LPMINMAXINFO)lParam)->ptMinTrackSize.y = minmax.ptMinTrackSize.y; + ((LPMINMAXINFO)lParam)->ptMaxTrackSize.x = minmax.ptMaxTrackSize.x + border.left + border.right; + ((LPMINMAXINFO)lParam)->ptMaxTrackSize.y = minmax.ptMaxTrackSize.y + tbh + border.top + border.bottom; } - if (Frames[framepos].ContainerWnd == 0) { - ulockfrm(); - return(0); - } - GetWindowRect(Frames[framepos].ContainerWnd, &rect); - Frames[framepos].FloatingPos.x = rect.left; - Frames[framepos].FloatingPos.y = rect.top; - Frames[framepos].FloatingSize.x = rect.right - rect.left; - Frames[framepos].FloatingSize.y = rect.bottom - rect.top; - CLUIFramesStoreFrameSettings(framepos); + } + else { ulockfrm(); - return(0); + return DefWindowProc(hwnd, msg, wParam, lParam); } - case WM_SIZE: { - int framepos; - RECT rect; - lockfrm(); + ulockfrm(); - framepos = id2pos(Frameid); + case WM_MOVE: + lockfrm(); + framepos = id2pos(Frameid); - if (framepos < 0 || framepos >= nFramescount) { - ulockfrm(); - break; - } - if (Frames[framepos].ContainerWnd == 0) { - ulockfrm(); - return(0); - } - CLUIFrameResizeFloatingFrame(framepos); + if (framepos < 0 || framepos >= nFramescount) { + ulockfrm(); + break; + } + if (Frames[framepos].ContainerWnd == 0) { + ulockfrm(); + return 0; + } + GetWindowRect(Frames[framepos].ContainerWnd, &rect); + Frames[framepos].FloatingPos.x = rect.left; + Frames[framepos].FloatingPos.y = rect.top; + Frames[framepos].FloatingSize.x = rect.right - rect.left; + Frames[framepos].FloatingSize.y = rect.bottom - rect.top; + CLUIFramesStoreFrameSettings(framepos); + ulockfrm(); + return 0; - GetWindowRect(Frames[framepos].ContainerWnd, &rect); - Frames[framepos].FloatingPos.x = rect.left; - Frames[framepos].FloatingPos.y = rect.top; - Frames[framepos].FloatingSize.x = rect.right - rect.left; - Frames[framepos].FloatingSize.y = rect.bottom - rect.top; + case WM_SIZE: + lockfrm(); + framepos = id2pos(Frameid); - CLUIFramesStoreFrameSettings(framepos); + if (framepos < 0 || framepos >= nFramescount) { ulockfrm(); - return(0); - } - case WM_CLOSE: { - DestroyWindow(hwnd); break; } - case WM_DESTROY: - return(0); + if (Frames[framepos].ContainerWnd == 0) { + ulockfrm(); + return 0; + } + CLUIFrameResizeFloatingFrame(framepos); + + RECT rect; + GetWindowRect(Frames[framepos].ContainerWnd, &rect); + Frames[framepos].FloatingPos.x = rect.left; + Frames[framepos].FloatingPos.y = rect.top; + Frames[framepos].FloatingSize.x = rect.right - rect.left; + Frames[framepos].FloatingSize.y = rect.bottom - rect.top; + + CLUIFramesStoreFrameSettings(framepos); + + ulockfrm(); + return 0; + + case WM_CLOSE: + DestroyWindow(hwnd); + break; + + case WM_DESTROY: + return 0; } return DefWindowProc(hwnd, msg, wParam, lParam); } @@ -3259,14 +3216,15 @@ INT_PTR CLUIFrameSetFloat(WPARAM wParam, LPARAM lParam) lockfrm(); wParam = id2pos((INT_PTR)wParam); - if (wParam >= 0 && (int)wParam < nFramescount) + if (wParam >= 0 && (int)wParam < nFramescount) { if (Frames[wParam].floating) { SetParent(Frames[wParam].hWnd, pcli->hwndContactList); SetParent(Frames[wParam].TitleBar.hwnd, pcli->hwndContactList); Frames[wParam].floating = FALSE; DestroyWindow(Frames[wParam].ContainerWnd); Frames[wParam].ContainerWnd = 0; - } else { + } + else { RECT recttb, rectw, border; int temp; int neww, newh; @@ -3280,9 +3238,9 @@ INT_PTR CLUIFrameSetFloat(WPARAM wParam, LPARAM lParam) GetWindowRect(Frames[wParam].hWnd, &rectw); GetWindowRect(Frames[wParam].TitleBar.hwnd, &recttb); - if ( !Frames[wParam].TitleBar.ShowTitleBar) { + if ( !Frames[wParam].TitleBar.ShowTitleBar) recttb.top = recttb.bottom = recttb.left = recttb.right = 0; - } + Frames[wParam].ContainerWnd = CreateContainerWindow(pcli->hwndContactList, Frames[wParam].FloatingPos.x, Frames[wParam].FloatingPos.y, 10, 10); SetParent(Frames[wParam].hWnd, Frames[wParam].ContainerWnd); @@ -3293,31 +3251,31 @@ INT_PTR CLUIFrameSetFloat(WPARAM wParam, LPARAM lParam) SetWindowLongPtr(Frames[wParam].ContainerWnd, GWLP_USERDATA, Frames[wParam].id); if ((lParam == 1)) { if ((Frames[wParam].FloatingPos.x != 0) && (Frames[wParam].FloatingPos.y != 0)) { - if (Frames[wParam].FloatingPos.x < 20) { + if (Frames[wParam].FloatingPos.x < 20) Frames[wParam].FloatingPos.x = 40; - } - if (Frames[wParam].FloatingPos.y < 20) { + + if (Frames[wParam].FloatingPos.y < 20) Frames[wParam].FloatingPos.y = 40; - } + SetWindowPos(Frames[wParam].ContainerWnd, HWND_TOPMOST, Frames[wParam].FloatingPos.x, Frames[wParam].FloatingPos.y, Frames[wParam].FloatingSize.x, Frames[wParam].FloatingSize.y, SWP_HIDEWINDOW); - } else { - SetWindowPos(Frames[wParam].ContainerWnd, HWND_TOPMOST, 120, 120, 140, 140, SWP_HIDEWINDOW); } - } else { + else SetWindowPos(Frames[wParam].ContainerWnd, HWND_TOPMOST, 120, 120, 140, 140, SWP_HIDEWINDOW); + } + else { neww = rectw.right - rectw.left + border.left + border.right; newh = (rectw.bottom - rectw.top) + (recttb.bottom - recttb.top) + border.top + border.bottom; - if (neww < 20) { + if (neww < 20) neww = 40; - } - if (newh < 20) { + + if (newh < 20) newh = 40; - } - if (Frames[wParam].FloatingPos.x < 20) { + + if (Frames[wParam].FloatingPos.x < 20) Frames[wParam].FloatingPos.x = 40; - } - if (Frames[wParam].FloatingPos.y < 20) { + + if (Frames[wParam].FloatingPos.y < 20) Frames[wParam].FloatingPos.y = 40; - } + SetWindowPos(Frames[wParam].ContainerWnd, HWND_TOPMOST, Frames[wParam].FloatingPos.x, Frames[wParam].FloatingPos.y, neww, newh, SWP_HIDEWINDOW); } SetWindowText(Frames[wParam].ContainerWnd, Frames[wParam].TitleBar.tbname); @@ -3326,8 +3284,9 @@ INT_PTR CLUIFrameSetFloat(WPARAM wParam, LPARAM lParam) SetWindowLongPtr(Frames[wParam].ContainerWnd, GWL_EXSTYLE, temp); Frames[wParam].floating = TRUE; Frames[wParam].Locked = locked; - } + } + CLUIFramesStoreFrameSettings(wParam); Frames[wParam].minmaxenabled = TRUE; hwndtooltiptmp = Frames[wParam].TitleBar.hwndTip; diff --git a/plugins/Clist_nicer/src/Include/clc.h b/plugins/Clist_nicer/src/Include/clc.h index 0b968796ab..c82a916a90 100644 --- a/plugins/Clist_nicer/src/Include/clc.h +++ b/plugins/Clist_nicer/src/Include/clc.h @@ -310,7 +310,6 @@ struct TCluiData { BOOL bMetaEnabled; BOOL bSecIMAvail; BOOL bNoTrayTips; - int exIconScale; BOOL bShowLocalTime; BOOL bShowLocalTimeSelective; BOOL bShowXStatusOnSbar; diff --git a/plugins/Clist_nicer/src/Include/resource.h b/plugins/Clist_nicer/src/Include/resource.h index 56fa48d236..e53c1cec0d 100644 --- a/plugins/Clist_nicer/src/Include/resource.h +++ b/plugins/Clist_nicer/src/Include/resource.h @@ -80,8 +80,6 @@ #define IDC_FULLROWSELECT 1067 #define IDC_CLIPBORDERSPIN 1067 #define IDC_LOCALTIME 1068 -#define IDC_EXICONSCALE 1068 -#define IDC_EXICONSCALESPIN 1069 #define IDC_CLEFT 1070 #define IDC_CLEFTSPIN 1071 #define IDC_GREYOUT 1072 diff --git a/plugins/Clist_nicer/src/clcpaint.cpp b/plugins/Clist_nicer/src/clcpaint.cpp index 5376e02024..5c92e82748 100644 --- a/plugins/Clist_nicer/src/clcpaint.cpp +++ b/plugins/Clist_nicer/src/clcpaint.cpp @@ -47,7 +47,7 @@ extern TCHAR *statusNames[]; extern LONG g_cxsmIcon, g_cysmIcon; extern StatusItems_t *StatusItems; -int g_hottrack, g_center, g_ignoreselforgroups, g_selectiveIcon, g_exIconSpacing, g_hottrack_done; +int g_hottrack, g_center, g_ignoreselforgroups, g_selectiveIcon, g_hottrack_done; HWND g_focusWnd; BYTE selBlend; BYTE saved_alpha; @@ -964,12 +964,12 @@ bgskipped: if (contact->extraIconRightBegin == 0) contact->extraIconRightBegin = rcContent.right; + + rightIcons++; ImageList_DrawEx(dat->himlExtraColumns, contact->iExtraImage[i], hdcMem, - rcContent.right - cfg::dat.exIconScale, - y + ((rowHeight - cfg::dat.exIconScale) >> 1), + rcContent.right - dat->extraColumnSpacing * rightIcons, + y + (rowHeight - g_cysmIcon)/2, 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL); - rcContent.right -= dat->extraColumnSpacing; - rightIcons++; } } } @@ -1131,16 +1131,16 @@ text: idOldFont = dat->currentFontID; ChangeToFont(hdcMem, dat, FONTID_TIMESTAMP, &fHeight); GetTextExtentPoint32(hdcMem, szResult, lstrlen(szResult), &szTime); - verticalfit = (rowHeight - fHeight >= cfg::dat.exIconScale + 1); + verticalfit = (rowHeight - fHeight >= g_cysmIcon+1); if (av_right) { if (verticalfit) - rc.left = rcContent.right + (rightIcons * g_exIconSpacing) - szTime.cx - 2; + rc.left = rcContent.right + (rightIcons * dat->extraColumnSpacing) - szTime.cx - 2; else rc.left = rcContent.right - szTime.cx - 2; } else if (av_rightwithnick) { - if (verticalfit && rightIcons * g_exIconSpacing >= szTime.cx) + if (verticalfit && rightIcons * dat->extraColumnSpacing >= szTime.cx) rc.left = clRect->right - dat->rightMargin - szTime.cx; else if (verticalfit && !avatar_done) rc.left = clRect->right - dat->rightMargin - szTime.cx; @@ -1159,7 +1159,7 @@ text: ChangeToFont(hdcMem, dat, idOldFont, 0); SetTextColor(hdcMem, oldColor); - verticalfit = (rowHeight - fontHeight >= cfg::dat.exIconScale + 1); + verticalfit = (rowHeight - fontHeight >= g_cysmIcon+1); if (verticalfit && av_right) rcContent.right = min(clRect->right - cfg::dat.avatarSize - 2, rc.left - 2); else if (verticalfit && !av_rightwithnick) @@ -1167,7 +1167,7 @@ text: } else { nodisplay: - verticalfit = (rowHeight - fontHeight >= cfg::dat.exIconScale + 1); + verticalfit = (rowHeight - fontHeight >= g_cysmIcon+1); if (avatar_done) { if (verticalfit && av_right) rcContent.right = clRect->right - cfg::dat.avatarSize - 2; @@ -1209,7 +1209,7 @@ nodisplay: DrawText(hdcMem, szText, -1, &rcContent, dtFlags | dt_2ndrowflags); else { DRAWTEXTPARAMS dtp = {0}; - LONG rightIconsTop = rcContent.bottom - g_exIconSpacing; + LONG rightIconsTop = rcContent.bottom - g_cysmIcon; LONG old_right = rcContent.right; ULONG textCounter = 0; ULONG ulLen = lstrlen(szText); @@ -1323,7 +1323,6 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT *rcPaint) g_center = cfg::getByte("CLCExt", "EXBK_CenterGroupnames", 0) && !dat->bisEmbedded; g_ignoreselforgroups = cfg::getByte("CLC", "IgnoreSelforGroups", 0); - g_exIconSpacing = cfg::dat.exIconScale + 2; if (dat->greyoutFlags & pcli->pfnClcStatusToPf2(my_status) || style & WS_DISABLED) grey = 1; diff --git a/plugins/Clist_nicer/src/clcutils.cpp b/plugins/Clist_nicer/src/clcutils.cpp index fc98a70894..4028701cb9 100644 --- a/plugins/Clist_nicer/src/clcutils.cpp +++ b/plugins/Clist_nicer/src/clcutils.cpp @@ -136,8 +136,8 @@ int RTL_HitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact if (hitcontact->iExtraImage[i] == EMPTY_EXTRA_ICON) continue; - rightOffset -= cfg::dat.exIconScale + 2; - if (testx > rightOffset && testx < rightOffset + cfg::dat.exIconScale ) { + rightOffset -= dat->extraColumnSpacing; + if (testx > rightOffset && testx < rightOffset + dat->extraColumnSpacing ) { if (flags) *flags |= (CLCHT_ONITEMEXTRA | (i << 24)); return hit; @@ -277,8 +277,8 @@ int HitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact **c if (hitcontact->iExtraImage[i] == EMPTY_EXTRA_ICON) continue; - rightOffset -= cfg::dat.exIconScale+2; - if (testx > rightOffset && testx < rightOffset + cfg::dat.exIconScale) { + rightOffset -= dat->extraColumnSpacing; + if (testx > rightOffset && testx < rightOffset + dat->extraColumnSpacing) { if (flags) *flags |= (CLCHT_ONITEMEXTRA | (i << 24)); return hit; diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp index 63c8953588..d39e996e73 100644 --- a/plugins/Clist_nicer/src/clui.cpp +++ b/plugins/Clist_nicer/src/clui.cpp @@ -597,7 +597,6 @@ void ReloadThemedOptions() cfg::dat.bUsePerProto = cfg::getByte("CLCExt", "useperproto", 0); cfg::dat.bOverridePerStatusColors = cfg::getByte("CLCExt", "override_status", 0); cfg::dat.bRowSpacing = cfg::getByte("CLC", "RowGap", 0); - cfg::dat.exIconScale = cfg::getByte("CLC", "ExIconScale", 16); cfg::dat.bApplyIndentToBg = cfg::getByte("CLCExt", "applyindentbg", 0); cfg::dat.bWallpaperMode = cfg::getByte("CLUI", "UseBkSkin", 1); cfg::dat.bClipBorder = cfg::getByte("CLUI", "clipborder", 0); diff --git a/plugins/Clist_nicer/src/cluiopts.cpp b/plugins/Clist_nicer/src/cluiopts.cpp index c01e634e74..17e12b7cd9 100644 --- a/plugins/Clist_nicer/src/cluiopts.cpp +++ b/plugins/Clist_nicer/src/cluiopts.cpp @@ -126,11 +126,9 @@ INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l CheckDlgButton(hwndDlg, IDC_ROUNDEDBORDER, cfg::dat.dwFlags & CLUI_FRAME_ROUNDEDFRAME); SendDlgItemMessage(hwndDlg, IDC_FRAMEGAPSPIN, UDM_SETRANGE, 0, MAKELONG(10, 0)); SendDlgItemMessage(hwndDlg, IDC_FRAMEGAPSPIN, UDM_SETPOS, 0, (LPARAM)cfg::dat.gapBetweenFrames); - - SendDlgItemMessage(hwndDlg, IDC_EXICONSCALESPIN, UDM_SETRANGE, 0, MAKELONG(20, 8)); - SendDlgItemMessage(hwndDlg, IDC_EXICONSCALESPIN, UDM_SETPOS, 0, (LPARAM)cfg::dat.exIconScale); - return TRUE; } + return TRUE; + case WM_COMMAND: if (LOWORD(wParam) == IDC_AUTOHIDE) { Utils::enableDlgControl(hwndDlg, IDC_HIDETIME, IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE)); @@ -153,7 +151,7 @@ INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l Utils::enableDlgControl(hwndDlg, IDC_AUTOSIZEUPWARD, IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZE)); } if ((LOWORD(wParam) == IDC_FRAMEGAP || LOWORD(wParam) == IDC_HIDETIME || LOWORD(wParam) == IDC_CLIPBORDER || LOWORD(wParam) == IDC_ROWGAP || LOWORD(wParam) == IDC_TITLETEXT || - LOWORD(wParam) == IDC_MAXSIZEHEIGHT || LOWORD(wParam) == IDC_CLEFT || LOWORD(wParam) == IDC_CRIGHT || LOWORD(wParam) == IDC_CTOP || LOWORD(wParam) == IDC_EXICONSCALE + LOWORD(wParam) == IDC_MAXSIZEHEIGHT || LOWORD(wParam) == IDC_CLEFT || LOWORD(wParam) == IDC_CRIGHT || LOWORD(wParam) == IDC_CTOP || LOWORD(wParam) == IDC_CBOTTOM) && (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus())) return 0; SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); @@ -177,7 +175,6 @@ INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l case WM_NOTIFY: if (((LPNMHDR) lParam)->code == PSN_APPLY) { BOOL translated; - int oldexIconScale = cfg::dat.exIconScale; BYTE oldFading; BYTE windowStyle = (BYTE)SendDlgItemMessage(hwndDlg, IDC_BORDERSTYLE, CB_GETCURSEL, 0, 0); COLORREF clr_cluiframes; @@ -275,14 +272,6 @@ INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l SendMessage(pcli->hwndContactTree, WM_SIZE, 0, 0); } - int oldScale = cfg::dat.exIconScale; - cfg::dat.exIconScale = SendDlgItemMessage(hwndDlg, IDC_EXICONSCALESPIN, UDM_GETPOS, 0, 0); - if (cfg::dat.exIconScale < 8 || cfg::dat.exIconScale > 20) - cfg::dat.exIconScale = 16; - cfg::writeByte("CLC", "ExIconScale", (BYTE)cfg::dat.exIconScale); - if (oldexIconScale != cfg::dat.exIconScale) - IcoLibReloadIcons(); - cfg::writeByte("CLUI", "MaxSizeHeight", (BYTE) GetDlgItemInt(hwndDlg, IDC_MAXSIZEHEIGHT, NULL, FALSE)); cfg::writeByte("CLUI", "AutoSizeUpward", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZEUPWARD)); cfg::writeByte("CList", "AutoHide", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE)); @@ -336,9 +325,6 @@ INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l SFL_SetState(cfg::dat.bUseFloater & CLUI_FLOATER_AUTOHIDE ? (cfg::getByte("CList", "State", SETTING_STATE_NORMAL) == SETTING_STATE_NORMAL ? 0 : 1) : 1); opt_clui_changed = 0; - if (oldexIconScale != cfg::dat.exIconScale) - IcoLibReloadIcons(); - pcli->pfnClcOptionsChanged(); pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0); return TRUE; diff --git a/plugins/Clist_nicer/src/extBackg.cpp b/plugins/Clist_nicer/src/extBackg.cpp index 504bcfa974..29854db114 100644 --- a/plugins/Clist_nicer/src/extBackg.cpp +++ b/plugins/Clist_nicer/src/extBackg.cpp @@ -1391,7 +1391,6 @@ void extbk_import(char *file, HWND hwndDlg) char buffer[255]; char szKey[255], szSection[255]; DWORD data, version = 0; - int oldexIconScale = cfg::dat.exIconScale; for (n = 0; n <= ID_EXTBK_LAST - ID_STATUS_OFFLINE; n++) { if (StatusItems[n].statusID != ID_EXTBKSEPARATOR) { @@ -1500,10 +1499,6 @@ void extbk_import(char *file, HWND hwndDlg) ConfigureCLUIGeometry(1); SendMessage(pcli->hwndContactList, WM_SIZE, 0, 0); RedrawWindow(pcli->hwndContactList,NULL,NULL,RDW_INVALIDATE|RDW_ERASE|RDW_FRAME|RDW_UPDATENOW|RDW_ALLCHILDREN); - if (oldexIconScale != cfg::dat.exIconScale) { - IcoLibReloadIcons(); - pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0); - } } static void ApplyCLUISkin() -- cgit v1.2.3