From 176e52e14fd0358a7f26ca8d7b0205244dfde2e7 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 23 May 2018 23:29:25 +0300 Subject: no need to initialize pcli variable in each plugin (only in Clist_*) --- plugins/Clist_blind/src/clistmenus.cpp | 2 +- plugins/Clist_blind/src/clistopts.cpp | 2 +- plugins/Clist_blind/src/cluiopts.cpp | 66 +++++++++++++++++----------------- plugins/Clist_blind/src/init.cpp | 36 +++++++++---------- 4 files changed, 53 insertions(+), 53 deletions(-) (limited to 'plugins/Clist_blind/src') diff --git a/plugins/Clist_blind/src/clistmenus.cpp b/plugins/Clist_blind/src/clistmenus.cpp index f8b98f49e8..a9278b4009 100644 --- a/plugins/Clist_blind/src/clistmenus.cpp +++ b/plugins/Clist_blind/src/clistmenus.cpp @@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. INT_PTR CloseAction(WPARAM, LPARAM) { if (Miranda_OkToExit()) - DestroyWindow(pcli->hwndContactList); + DestroyWindow(g_CLI.hwndContactList); return 0; } diff --git a/plugins/Clist_blind/src/clistopts.cpp b/plugins/Clist_blind/src/clistopts.cpp index 69e6a904af..142d70fb8d 100644 --- a/plugins/Clist_blind/src/clistopts.cpp +++ b/plugins/Clist_blind/src/clistopts.cpp @@ -164,7 +164,7 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP Clist_TrayIconIconsChanged(); Clist_LoadContactTree(); /* this won't do job properly since it only really works when changes happen */ - pcli->pfnInvalidateDisplayNameCacheEntry(INVALID_CONTACT_ID); /* force reshuffle */ + g_CLI.pfnInvalidateDisplayNameCacheEntry(INVALID_CONTACT_ID); /* force reshuffle */ return TRUE; } break; diff --git a/plugins/Clist_blind/src/cluiopts.cpp b/plugins/Clist_blind/src/cluiopts.cpp index aba4a28ad1..a3828746f9 100644 --- a/plugins/Clist_blind/src/cluiopts.cpp +++ b/plugins/Clist_blind/src/cluiopts.cpp @@ -170,52 +170,52 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L wchar_t title[256]; GetDlgItemText(hwndDlg, IDC_TITLETEXT, title, _countof(title)); db_set_ws(NULL, "CList", "TitleText", title); - SetWindowText(pcli->hwndContactList, title); + SetWindowText(g_CLI.hwndContactList, title); } - pcli->pfnLoadCluiGlobalOpts(); - SetWindowPos(pcli->hwndContactList, IsDlgButtonChecked(hwndDlg, IDC_ONTOP) ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, + g_CLI.pfnLoadCluiGlobalOpts(); + SetWindowPos(g_CLI.hwndContactList, IsDlgButtonChecked(hwndDlg, IDC_ONTOP) ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); if (IsDlgButtonChecked(hwndDlg, IDC_TOOLWND)) { // Window must be hidden to dynamically remove the taskbar button. // See http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/programmersguide/shell_int/shell_int_programming/taskbar.asp WINDOWPLACEMENT p; p.length = sizeof(p); - GetWindowPlacement(pcli->hwndContactList, &p); - ShowWindow(pcli->hwndContactList, SW_HIDE); - SetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE, - GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE) | WS_EX_TOOLWINDOW | WS_EX_WINDOWEDGE); - SetWindowPlacement(pcli->hwndContactList, &p); + GetWindowPlacement(g_CLI.hwndContactList, &p); + ShowWindow(g_CLI.hwndContactList, SW_HIDE); + SetWindowLongPtr(g_CLI.hwndContactList, GWL_EXSTYLE, + GetWindowLongPtr(g_CLI.hwndContactList, GWL_EXSTYLE) | WS_EX_TOOLWINDOW | WS_EX_WINDOWEDGE); + SetWindowPlacement(g_CLI.hwndContactList, &p); } - else SetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE) & ~WS_EX_TOOLWINDOW); + else SetWindowLongPtr(g_CLI.hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(g_CLI.hwndContactList, GWL_EXSTYLE) & ~WS_EX_TOOLWINDOW); if (IsDlgButtonChecked(hwndDlg, IDC_ONDESKTOP)) { HWND hProgMan = FindWindowA("Progman", nullptr); if (IsWindow(hProgMan)) - SetParent(pcli->hwndContactList, hProgMan); + SetParent(g_CLI.hwndContactList, hProgMan); } - else SetParent(pcli->hwndContactList, nullptr); + else SetParent(g_CLI.hwndContactList, nullptr); if (IsDlgButtonChecked(hwndDlg, IDC_SHOWCAPTION)) - SetWindowLongPtr(pcli->hwndContactList, GWL_STYLE, - GetWindowLongPtr(pcli->hwndContactList, GWL_STYLE) | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX); + SetWindowLongPtr(g_CLI.hwndContactList, GWL_STYLE, + GetWindowLongPtr(g_CLI.hwndContactList, GWL_STYLE) | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX); else - SetWindowLongPtr(pcli->hwndContactList, GWL_STYLE, - GetWindowLongPtr(pcli->hwndContactList, GWL_STYLE) & ~(WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX)); + SetWindowLongPtr(g_CLI.hwndContactList, GWL_STYLE, + GetWindowLongPtr(g_CLI.hwndContactList, GWL_STYLE) & ~(WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX)); if (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_SHOWMAINMENU)) - SetMenu(pcli->hwndContactList, nullptr); + SetMenu(g_CLI.hwndContactList, nullptr); else - SetMenu(pcli->hwndContactList, pcli->hMenuMain); - SetWindowPos(pcli->hwndContactList, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); - RedrawWindow(pcli->hwndContactList, nullptr, nullptr, RDW_FRAME | RDW_INVALIDATE); - if (IsIconic(pcli->hwndContactList) && BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_TOOLWND)) - ShowWindow(pcli->hwndContactList, IsDlgButtonChecked(hwndDlg, IDC_MIN2TRAY) ? SW_HIDE : SW_SHOW); + SetMenu(g_CLI.hwndContactList, g_CLI.hMenuMain); + SetWindowPos(g_CLI.hwndContactList, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); + RedrawWindow(g_CLI.hwndContactList, nullptr, nullptr, RDW_FRAME | RDW_INVALIDATE); + if (IsIconic(g_CLI.hwndContactList) && BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_TOOLWND)) + ShowWindow(g_CLI.hwndContactList, IsDlgButtonChecked(hwndDlg, IDC_MIN2TRAY) ? SW_HIDE : SW_SHOW); if (IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT)) { - SetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE) | WS_EX_LAYERED); - SetLayeredWindowAttributes(pcli->hwndContactList, RGB(0, 0, 0), (BYTE)db_get_b(NULL, "CList", "AutoAlpha", SETTING_AUTOALPHA_DEFAULT), LWA_ALPHA); + SetWindowLongPtr(g_CLI.hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(g_CLI.hwndContactList, GWL_EXSTYLE) | WS_EX_LAYERED); + SetLayeredWindowAttributes(g_CLI.hwndContactList, RGB(0, 0, 0), (BYTE)db_get_b(NULL, "CList", "AutoAlpha", SETTING_AUTOALPHA_DEFAULT), LWA_ALPHA); } - else SetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE) & ~WS_EX_LAYERED); + else SetWindowLongPtr(g_CLI.hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(g_CLI.hwndContactList, GWL_EXSTYLE) & ~WS_EX_LAYERED); - SendMessage(pcli->hwndContactTree, WM_SIZE, 0, 0); //forces it to send a cln_listsizechanged + SendMessage(g_CLI.hwndContactTree, WM_SIZE, 0, 0); //forces it to send a cln_listsizechanged return TRUE; } break; @@ -274,22 +274,22 @@ static INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L db_set_b(NULL, "CLUI", "SBarRightClk", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_RIGHTMIRANDA)); db_set_b(NULL, "CLUI", "EqualSections", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_EQUALSECTIONS)); db_set_b(NULL, "CLUI", "SBarBevel", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SBPANELBEVEL)); - pcli->pfnLoadCluiGlobalOpts(); + g_CLI.pfnLoadCluiGlobalOpts(); if (db_get_b(NULL, "CLUI", "ShowGrip", 1) != (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWGRIP)) { - HWND parent = GetParent(pcli->hwndStatus); + HWND parent = GetParent(g_CLI.hwndStatus); int flags = WS_CHILD | CCS_BOTTOM; db_set_b(NULL, "CLUI", "ShowGrip", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWGRIP)); - ShowWindow(pcli->hwndStatus, SW_HIDE); - DestroyWindow(pcli->hwndStatus); + ShowWindow(g_CLI.hwndStatus, SW_HIDE); + DestroyWindow(g_CLI.hwndStatus); flags |= db_get_b(NULL, "CLUI", "ShowSBar", 1) ? WS_VISIBLE : 0; flags |= db_get_b(NULL, "CLUI", "ShowGrip", 1) ? SBARS_SIZEGRIP : 0; - pcli->hwndStatus = CreateWindow(STATUSCLASSNAME, nullptr, flags, 0, 0, 0, 0, parent, nullptr, g_plugin.getInst(), nullptr); + g_CLI.hwndStatus = CreateWindow(STATUSCLASSNAME, nullptr, flags, 0, 0, 0, 0, parent, nullptr, g_plugin.getInst(), nullptr); } if (IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR)) - ShowWindow(pcli->hwndStatus, SW_SHOW); + ShowWindow(g_CLI.hwndStatus, SW_SHOW); else - ShowWindow(pcli->hwndStatus, SW_HIDE); - SendMessage(pcli->hwndContactList, WM_SIZE, 0, 0); + ShowWindow(g_CLI.hwndStatus, SW_HIDE); + SendMessage(g_CLI.hwndContactList, WM_SIZE, 0, 0); return TRUE; } break; diff --git a/plugins/Clist_blind/src/init.cpp b/plugins/Clist_blind/src/init.cpp index 7d48f3402f..676be214fb 100644 --- a/plugins/Clist_blind/src/init.cpp +++ b/plugins/Clist_blind/src/init.cpp @@ -25,7 +25,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" CMPlugin g_plugin; -CLIST_INTERFACE *pcli = nullptr, coreCli; +CLIST_INTERFACE coreCli; + HIMAGELIST himlCListClc = nullptr; LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); @@ -108,7 +109,7 @@ static int OnOptsInit(WPARAM wParam, LPARAM lParam) static INT_PTR GetStatusMode(WPARAM, LPARAM) { - return pcli->currentDesiredStatusMode; + return g_CLI.currentDesiredStatusMode; } ///////////////////////////////////////////////////////////////////////////////////////// @@ -116,24 +117,23 @@ static INT_PTR GetStatusMode(WPARAM, LPARAM) extern "C" int __declspec(dllexport) CListInitialise() { - pcli = Clist_GetInterface(); g_bSortByStatus = db_get_b(NULL, "CList", "SortByStatus", SETTING_SORTBYSTATUS_DEFAULT); g_bSortByProto = db_get_b(NULL, "CList", "SortByProto", SETTING_SORTBYPROTO_DEFAULT); - coreCli = *pcli; - - pcli->hInst = g_plugin.getInst(); - pcli->pfnPaintClc = PaintClc; - pcli->pfnContactListWndProc = ContactListWndProc; - pcli->pfnContactListControlWndProc = ContactListControlWndProc; - pcli->pfnRebuildEntireList = RebuildEntireList; - pcli->pfnSetGroupExpand = SetGroupExpand; - pcli->pfnRecalcScrollBar = RecalcScrollBar; - pcli->pfnScrollTo = ScrollTo; - pcli->pfnLoadClcOptions = LoadClcOptions; - pcli->pfnGetRowHeight = GetRowHeight; - pcli->pfnSortCLC = SortCLC; - pcli->pfnCompareContacts = CompareContacts; + Clist_GetInterface(); + coreCli = g_CLI; + g_CLI.hInst = g_plugin.getInst(); + g_CLI.pfnPaintClc = PaintClc; + g_CLI.pfnContactListWndProc = ContactListWndProc; + g_CLI.pfnContactListControlWndProc = ContactListControlWndProc; + g_CLI.pfnRebuildEntireList = RebuildEntireList; + g_CLI.pfnSetGroupExpand = SetGroupExpand; + g_CLI.pfnRecalcScrollBar = RecalcScrollBar; + g_CLI.pfnScrollTo = ScrollTo; + g_CLI.pfnLoadClcOptions = LoadClcOptions; + g_CLI.pfnGetRowHeight = GetRowHeight; + g_CLI.pfnSortCLC = SortCLC; + g_CLI.pfnCompareContacts = CompareContacts; CreateServiceFunction(MS_CLIST_GETSTATUSMODE, GetStatusMode); @@ -383,7 +383,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L KillTimer(hwnd, TIMERID_INFOTIP); KillTimer(hwnd, TIMERID_RENAME); dat->szQuickSearch[0] = 0; - pcli->pfnInvalidateRect(hwnd, nullptr, FALSE); + g_CLI.pfnInvalidateRect(hwnd, nullptr, FALSE); Clist_EnsureVisible(hwnd, (ClcData*)dat, dat->selection, 0); UpdateWindow(hwnd); break; -- cgit v1.2.3