From 2105de2e1be94d18a1cb5dfd6afcc33a788bc640 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 26 Apr 2016 14:54:58 +0000 Subject: R.I.P m_clui.h, you helped us alot git-svn-id: http://svn.miranda-ng.org/main/trunk@16767 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/core/stdauth/src/stdafx.h | 1 - src/core/stdchat/src/stdafx.h | 1 - src/core/stdclist/src/stdafx.h | 1 - src/core/stdmsg/src/stdafx.h | 1 - src/core/stduserinfo/src/stdafx.h | 1 - src/mir_app/src/chat_clist.cpp | 4 +- src/mir_app/src/clcutils.cpp | 1 - src/mir_app/src/clistgroups.cpp | 2 +- src/mir_app/src/clistmod.cpp | 3 -- src/mir_app/src/cluiservices.cpp | 79 ++++++++++++++------------------------- src/mir_app/src/contact.cpp | 9 +---- src/mir_app/src/mir_app.def | 2 + src/mir_app/src/mir_app64.def | 2 + src/mir_app/src/stdafx.h | 1 - 14 files changed, 36 insertions(+), 72 deletions(-) (limited to 'src') diff --git a/src/core/stdauth/src/stdafx.h b/src/core/stdauth/src/stdafx.h index 48074554e4..06f20fb566 100644 --- a/src/core/stdauth/src/stdafx.h +++ b/src/core/stdauth/src/stdafx.h @@ -47,7 +47,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include -#include #include #include #include diff --git a/src/core/stdchat/src/stdafx.h b/src/core/stdchat/src/stdafx.h index da9ed84090..ec6be80973 100644 --- a/src/core/stdchat/src/stdafx.h +++ b/src/core/stdchat/src/stdafx.h @@ -48,7 +48,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include -#include #include #include #include diff --git a/src/core/stdclist/src/stdafx.h b/src/core/stdclist/src/stdafx.h index 4bf2523e76..10a16fd245 100644 --- a/src/core/stdclist/src/stdafx.h +++ b/src/core/stdclist/src/stdafx.h @@ -38,7 +38,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include -#include #include #include #include diff --git a/src/core/stdmsg/src/stdafx.h b/src/core/stdmsg/src/stdafx.h index e732c0532e..35acfc8216 100644 --- a/src/core/stdmsg/src/stdafx.h +++ b/src/core/stdmsg/src/stdafx.h @@ -44,7 +44,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include -#include #include #include #include diff --git a/src/core/stduserinfo/src/stdafx.h b/src/core/stduserinfo/src/stdafx.h index 6d2b94a1ec..9136d69408 100644 --- a/src/core/stduserinfo/src/stdafx.h +++ b/src/core/stduserinfo/src/stdafx.h @@ -48,7 +48,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include -#include #include #include #include diff --git a/src/mir_app/src/chat_clist.cpp b/src/mir_app/src/chat_clist.cpp index 767368d911..1abd72c32b 100644 --- a/src/mir_app/src/chat_clist.cpp +++ b/src/mir_app/src/chat_clist.cpp @@ -35,10 +35,8 @@ MCONTACT AddRoom(const char *pszModule, const TCHAR *pszRoom, const TCHAR *pszDi MGROUP hGroup = Clist_GroupExists(pszGroup); if (hGroup == 0) { hGroup = Clist_GroupCreate(0, pszGroup); - if (hGroup) { - CallService(MS_CLUI_GROUPADDED, (WPARAM)hGroup, 0); + if (hGroup) Clist_GroupSetExpanded(hGroup, 1); - } } } diff --git a/src/mir_app/src/clcutils.cpp b/src/mir_app/src/clcutils.cpp index 41231fc40d..951bb61f7a 100644 --- a/src/mir_app/src/clcutils.cpp +++ b/src/mir_app/src/clcutils.cpp @@ -717,7 +717,6 @@ void fnGetFontSetting(int i, LOGFONT* lf, COLORREF* colour) void fnLoadClcOptions(HWND hwnd, struct ClcData *dat, BOOL bFirst) { dat->rowHeight = db_get_b(NULL, "CLC", "RowHeight", CLCDEFAULT_ROWHEIGHT); - dat->leftMargin = db_get_b(NULL, "CLC", "LeftMargin", CLCDEFAULT_LEFTMARGIN); dat->exStyle = db_get_dw(NULL, "CLC", "ExStyle", cli.pfnGetDefaultExStyle()); dat->scrollTime = db_get_w(NULL, "CLC", "ScrollTime", CLCDEFAULT_SCROLLTIME); diff --git a/src/mir_app/src/clistgroups.cpp b/src/mir_app/src/clistgroups.cpp index c5289a1f57..08c377b681 100644 --- a/src/mir_app/src/clistgroups.cpp +++ b/src/mir_app/src/clistgroups.cpp @@ -132,7 +132,7 @@ static INT_PTR CreateGroupInternal(MGROUP hParent, const TCHAR *ptszName) arByIds.insert(pNew); arByName.insert(pNew); - CallService(MS_CLUI_GROUPADDED, newId + 1, 1); + Clist_GroupAdded(newId + 1); CLISTGROUPCHANGE grpChg = { sizeof(grpChg), NULL, newName }; NotifyEventHooks(hGroupChangeEvent, 0, (LPARAM)&grpChg); diff --git a/src/mir_app/src/clistmod.cpp b/src/mir_app/src/clistmod.cpp index 758e34075a..5ae1741942 100644 --- a/src/mir_app/src/clistmod.cpp +++ b/src/mir_app/src/clistmod.cpp @@ -34,7 +34,6 @@ int ContactAdded(WPARAM wParam, LPARAM lParam); INT_PTR GetContactDisplayName(WPARAM wParam, LPARAM lParam); INT_PTR InvalidateDisplayName(WPARAM wParam, LPARAM lParam); int InitGroupServices(void); -void LoadCluiServices(); INT_PTR Docking_IsDocked(WPARAM wParam, LPARAM lParam); int LoadCLUIModule(void); int InitClistHotKeys(void); @@ -427,8 +426,6 @@ int LoadContactListModule2(void) hContactDoubleClicked = CreateHookableEvent(ME_CLIST_DOUBLECLICKED); hContactIconChangedEvent = CreateHookableEvent(ME_CLIST_CONTACTICONCHANGED); - LoadCluiServices(); - CreateServiceFunction(MS_CLIST_CONTACTDOUBLECLICKED, ContactDoubleClicked); CreateServiceFunction(MS_CLIST_CONTACTFILESDROPPED, ContactFilesDropped); CreateServiceFunction(MS_CLIST_CONTACTSCOMPARE, CompareContacts); diff --git a/src/mir_app/src/cluiservices.cpp b/src/mir_app/src/cluiservices.cpp index 416dbdfb13..094535bcf5 100644 --- a/src/mir_app/src/cluiservices.cpp +++ b/src/mir_app/src/cluiservices.cpp @@ -25,30 +25,21 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" #include "clc.h" -static INT_PTR GroupAdded(WPARAM wParam, LPARAM lParam) +EXTERN_C MIR_APP_DLL(void) Clist_GroupAdded(MGROUP hGroup) { - //CLC does this automatically unless it's a new group - if (lParam) { - HANDLE hItem; - TCHAR szFocusClass[64]; - HWND hwndFocus = GetFocus(); - - GetClassName(hwndFocus, szFocusClass, _countof(szFocusClass)); - if (!mir_tstrcmp(szFocusClass, _T(CLISTCONTROL_CLASS))) { - hItem = (HANDLE) SendMessage(hwndFocus, CLM_FINDGROUP, wParam, 0); - if (hItem) - SendMessage(hwndFocus, CLM_EDITLABEL, (WPARAM) hItem, 0); - } + // CLC does this automatically unless it's a new group + HWND hwndFocus = GetFocus(); + + TCHAR szFocusClass[64]; + GetClassName(hwndFocus, szFocusClass, _countof(szFocusClass)); + if (!mir_tstrcmp(szFocusClass, _T(CLISTCONTROL_CLASS))) { + HANDLE hItem = (HANDLE)SendMessage(hwndFocus, CLM_FINDGROUP, hGroup, 0); + if (hItem) + SendMessage(hwndFocus, CLM_EDITLABEL, (WPARAM)hItem, 0); } - return 0; } -static INT_PTR ListBeginRebuild(WPARAM, LPARAM) -{ - return 0; -} - -static INT_PTR ListEndRebuild(WPARAM, LPARAM) +EXTERN_C MIR_APP_DLL(void) Clist_EndRebuild(void) { bool bRebuild = false; LONG_PTR dwStyle = GetWindowLongPtr(cli.hwndContactTree, GWL_STYLE); @@ -61,7 +52,7 @@ static INT_PTR ListEndRebuild(WPARAM, LPARAM) dwStyle &= ~CLS_HIDEOFFLINE; bRebuild = true; } - + if ((db_get_b(NULL, "CList", "HideEmptyGroups", SETTING_HIDEEMPTYGROUPS_DEFAULT) == 0) != ((dwStyle & CLS_HIDEEMPTYGROUPS) == 0)) { if (db_get_b(NULL, "CList", "HideEmptyGroups", SETTING_HIDEEMPTYGROUPS_DEFAULT)) dwStyle |= CLS_HIDEEMPTYGROUPS; @@ -69,7 +60,7 @@ static INT_PTR ListEndRebuild(WPARAM, LPARAM) dwStyle &= ~CLS_HIDEEMPTYGROUPS; bRebuild = true; } - + if ((db_get_b(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT) == 0) != ((dwStyle & CLS_USEGROUPS) == 0)) { if (db_get_b(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT)) dwStyle |= CLS_USEGROUPS; @@ -77,19 +68,11 @@ static INT_PTR ListEndRebuild(WPARAM, LPARAM) dwStyle &= ~CLS_USEGROUPS; bRebuild = true; } - + if (bRebuild) { SetWindowLongPtr(cli.hwndContactTree, GWL_STYLE, dwStyle); cli.pfnInitAutoRebuild(cli.hwndContactTree); } - return 0; -} - -void LoadCluiServices(void) -{ - CreateServiceFunction(MS_CLUI_GROUPADDED, GroupAdded); - CreateServiceFunction(MS_CLUI_LISTBEGINREBUILD, ListBeginRebuild); - CreateServiceFunction(MS_CLUI_LISTENDREBUILD, ListEndRebuild); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -97,35 +80,30 @@ void LoadCluiServices(void) void fnCluiProtocolStatusChanged(int, const char*) { - int i, *partWidths; - int borders[3]; - int flags = 0; - if (cli.menuProtoCount == 0) { SendMessage(cli.hwndStatus, SB_SETPARTS, 0, 0); SendMessage(cli.hwndStatus, SB_SETTEXT, SBT_OWNERDRAW, 0); return; } + int borders[3]; SendMessage(cli.hwndStatus, SB_GETBORDERS, 0, (LPARAM)&borders); - partWidths = (int*)alloca(cli.menuProtoCount * sizeof(int)); + int *partWidths = (int*)alloca(cli.menuProtoCount * sizeof(int)); if (db_get_b(NULL, "CLUI", "EqualSections", 0)) { RECT rc; GetClientRect(cli.hwndStatus, &rc); rc.right -= borders[0] * 2 + (db_get_b(NULL, "CLUI", "ShowGrip", 1) ? GetSystemMetrics(SM_CXVSCROLL) : 0); - for (i=0; i < cli.menuProtoCount; i++) - partWidths[ i ] = (i+1) * rc.right / cli.menuProtoCount - (borders[2] >> 1); + for (int i = 0; i < cli.menuProtoCount; i++) + partWidths[i] = (i + 1) * rc.right / cli.menuProtoCount - (borders[2] >> 1); } else { - HDC hdc; - HFONT hFont; SIZE textSize; BYTE showOpts = db_get_b(NULL, "CLUI", "SBarShow", 1); - hdc = GetDC(NULL); - hFont = (HFONT)SelectObject(hdc, (HFONT) SendMessage(cli.hwndStatus, WM_GETFONT, 0, 0)); - for (i=0; i < cli.menuProtoCount; i++) { //count down since built in ones tend to go at the end + HDC hdc = GetDC(NULL); + HFONT hFont = (HFONT)SelectObject(hdc, (HFONT)SendMessage(cli.hwndStatus, WM_GETFONT, 0, 0)); + for (int i = 0; i < cli.menuProtoCount; i++) { //count down since built in ones tend to go at the end int x = 2; if (showOpts & 1) x += g_IconWidth; @@ -137,31 +115,32 @@ void fnCluiProtocolStatusChanged(int, const char*) else tszName[0] = 0; - if (showOpts & 4 && mir_tstrlen(tszName) < _countof(tszName)-1) + if (showOpts & 4 && mir_tstrlen(tszName) < _countof(tszName) - 1) mir_tstrcat(tszName, _T(" ")); GetTextExtentPoint32(hdc, tszName, (int)mir_tstrlen(tszName), &textSize); x += textSize.cx; x += GetSystemMetrics(SM_CXBORDER) * 4; // The SB panel doesnt allocate enough room } if (showOpts & 4) { - TCHAR* modeDescr = cli.pfnGetStatusModeDescription(CallProtoServiceInt(NULL,cli.menuProtos[i].szProto, PS_GETSTATUS, 0, 0), 0); + TCHAR* modeDescr = cli.pfnGetStatusModeDescription(CallProtoServiceInt(NULL, cli.menuProtos[i].szProto, PS_GETSTATUS, 0, 0), 0); GetTextExtentPoint32(hdc, modeDescr, (int)mir_tstrlen(modeDescr), &textSize); x += textSize.cx; x += GetSystemMetrics(SM_CXBORDER) * 4; // The SB panel doesnt allocate enough room } - partWidths[ i ] = (i ? partWidths[ i-1] : 0) + x + 2; + partWidths[i] = (i ? partWidths[i - 1] : 0) + x + 2; } SelectObject(hdc, hFont); ReleaseDC(NULL, hdc); } - partWidths[ cli.menuProtoCount-1 ] = -1; + partWidths[cli.menuProtoCount - 1] = -1; SendMessage(cli.hwndStatus, SB_SETMINHEIGHT, g_IconHeight, 0); SendMessage(cli.hwndStatus, SB_SETPARTS, cli.menuProtoCount, (LPARAM)partWidths); - flags = SBT_OWNERDRAW; + + int flags = SBT_OWNERDRAW; if (db_get_b(NULL, "CLUI", "SBarBevel", 1) == 0) flags |= SBT_NOBORDERS; - for (i=0; i < cli.menuProtoCount; i++) { + + for (int i = 0; i < cli.menuProtoCount; i++) SendMessage(cli.hwndStatus, SB_SETTEXT, i | flags, (LPARAM)cli.menuProtos[i].szProto); - } } diff --git a/src/mir_app/src/contact.cpp b/src/mir_app/src/contact.cpp index d86c8b8127..ac1d01ab73 100644 --- a/src/mir_app/src/contact.cpp +++ b/src/mir_app/src/contact.cpp @@ -37,20 +37,13 @@ static int GetContactStatus(MCONTACT hContact) void fnLoadContactTree(void) { - CallService(MS_CLUI_LISTBEGINREBUILD, 0, 0); - for (int i = 1;; i++) { - if (Clist_GroupGetName(i, NULL) == NULL) - break; - CallService(MS_CLUI_GROUPADDED, i, 0); - } - int hideOffline = db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT); for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { int status = GetContactStatus(hContact); if ((!hideOffline || status != ID_STATUS_OFFLINE) && !db_get_b(hContact, "CList", "Hidden", 0)) cli.pfnChangeContactIcon(hContact, cli.pfnIconFromStatusMode(GetContactProto(hContact), status, hContact)); } - CallService(MS_CLUI_LISTENDREBUILD, 0, 0); + Clist_EndRebuild(); } INT_PTR ContactChangeGroup(WPARAM wParam, LPARAM lParam) diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 7461945320..e142457c3c 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -257,3 +257,5 @@ Clist_GroupSetExpanded @255 Clist_GroupSetFlags @256 Clist_GroupGetName @257 Clist_GroupRename @258 +Clist_EndRebuild @259 +Clist_GroupAdded @260 diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 70c2db00b7..6fd5286825 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -257,3 +257,5 @@ Clist_GroupSetExpanded @255 Clist_GroupSetFlags @256 Clist_GroupGetName @257 Clist_GroupRename @258 +Clist_EndRebuild @259 +Clist_GroupAdded @260 diff --git a/src/mir_app/src/stdafx.h b/src/mir_app/src/stdafx.h index b0435f664d..ca12a93a5b 100644 --- a/src/mir_app/src/stdafx.h +++ b/src/mir_app/src/stdafx.h @@ -64,7 +64,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include -#include #include #include #include -- cgit v1.2.3