diff options
author | George Hazan <ghazan@miranda.im> | 2021-05-28 21:17:18 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2021-05-28 21:17:18 +0300 |
commit | 6d45029acb15846f285e36dc7fb05a21c52a9146 (patch) | |
tree | 1ef803646a137b9c05744d90541e16e83db7c362 /plugins/QuickSearch | |
parent | f5d140fac345ff199685e9d6a7fce3e16264580c (diff) |
fixes #2891 (QuickSearch: исправить или удалить работу фрейма)
Diffstat (limited to 'plugins/QuickSearch')
-rw-r--r-- | plugins/QuickSearch/quicksearch.vcxproj | 1 | ||||
-rw-r--r-- | plugins/QuickSearch/quicksearch.vcxproj.filters | 3 | ||||
-rw-r--r-- | plugins/QuickSearch/res/resource.rc | 14 | ||||
-rw-r--r-- | plugins/QuickSearch/src/frame.cpp | 181 | ||||
-rw-r--r-- | plugins/QuickSearch/src/main.cpp | 3 | ||||
-rw-r--r-- | plugins/QuickSearch/src/resource.h | 3 | ||||
-rw-r--r-- | plugins/QuickSearch/src/stdafx.h | 6 | ||||
-rw-r--r-- | plugins/QuickSearch/src/window_misc.cpp | 2 |
8 files changed, 6 insertions, 207 deletions
diff --git a/plugins/QuickSearch/quicksearch.vcxproj b/plugins/QuickSearch/quicksearch.vcxproj index c61516a7d4..3627b36c02 100644 --- a/plugins/QuickSearch/quicksearch.vcxproj +++ b/plugins/QuickSearch/quicksearch.vcxproj @@ -26,7 +26,6 @@ <Import Project="$(ProjectDir)..\..\build\vc.common\plugin.props" /> </ImportGroup> <ItemGroup> - <ClCompile Include="src\frame.cpp" /> <ClCompile Include="src\options.cpp" /> <ClCompile Include="src\main.cpp" /> <ClCompile Include="src\stdafx.cxx"> diff --git a/plugins/QuickSearch/quicksearch.vcxproj.filters b/plugins/QuickSearch/quicksearch.vcxproj.filters index d03459b649..52f77f8d50 100644 --- a/plugins/QuickSearch/quicksearch.vcxproj.filters +++ b/plugins/QuickSearch/quicksearch.vcxproj.filters @@ -11,9 +11,6 @@ <ClCompile Include="src\main.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="src\frame.cpp"> - <Filter>Source Files</Filter> - </ClCompile> <ClCompile Include="src\window.cpp"> <Filter>Source Files</Filter> </ClCompile> diff --git a/plugins/QuickSearch/res/resource.rc b/plugins/QuickSearch/res/resource.rc index cfc9edc634..9f42af7ae0 100644 --- a/plugins/QuickSearch/res/resource.rc +++ b/plugins/QuickSearch/res/resource.rc @@ -24,15 +24,6 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL // Dialog // -IDD_FRAME DIALOGEX 0, 0, 114, 16 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD -EXSTYLE WS_EX_CONTROLPARENT -FONT 8, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - PUSHBUTTON "*",IDC_FRAME_OPEN,2,2,12,12,BS_ICON - EDITTEXT IDC_FRAME_EDIT,16,2,96,12 -END - IDD_OPTIONS DIALOGEX 0, 0, 314, 250 STYLE DS_SETFONT | WS_CHILD EXSTYLE WS_EX_CONTROLPARENT @@ -164,6 +155,11 @@ BEGIN 0 END +IDD_FRAME AFX_DIALOG_LAYOUT +BEGIN + 0 +END + #endif // Neutral resources ///////////////////////////////////////////////////////////////////////////// diff --git a/plugins/QuickSearch/src/frame.cpp b/plugins/QuickSearch/src/frame.cpp deleted file mode 100644 index 2674ebcdb2..0000000000 --- a/plugins/QuickSearch/src/frame.cpp +++ /dev/null @@ -1,181 +0,0 @@ -/* -Copyright (C) 2012-21 Miranda NG team (https://miranda-ng.org) - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation version 2 -of the License. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -#include "stdafx.h" - -#define colorName "Frame background" - -static HWND hwndFrame = nullptr; -static int frameId = -1; -static WNDPROC OldEditProc; -static CMStringW wszPattern; -static HBRUSH hBrush; -static COLORREF frm_bkg; - -///////////////////////////////////////////////////////////////////////////////////////// -// frame window procedure - -static INT_PTR CALLBACK NewEditProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - switch (msg) { - case WM_CHAR: - if (wParam == 27) { // Escape - SendMessage(hwnd, WM_SETTEXT, 0, 0); - return 0; - } - if (wParam == 13) { // Enter - CallService(QS_SHOWSERVICE, WPARAM(wszPattern.c_str()), 0); - return 0; - } - } - return CallWindowProc(OldEditProc, hwnd, msg, wParam, lParam); -} - -static int Resizer(HWND, LPARAM, UTILRESIZECONTROL *urc) -{ - switch (urc->wId) { - case IDC_FRAME_OPEN: return RD_ANCHORX_LEFT | RD_ANCHORY_CENTRE; - case IDC_FRAME_EDIT: return RD_ANCHORX_WIDTH | RD_ANCHORY_CENTRE; - } - return 0; -} - -static INT_PTR CALLBACK FrameWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - RECT rc; - HWND hwndTooltip; - - switch (msg) { - case WM_INITDIALOG: - OldEditProc = (WNDPROC)SetWindowLongPtrW(GetDlgItem(hwndDlg, IDC_FRAME_EDIT), GWLP_WNDPROC, LPARAM(&NewEditProc)); - - hwndTooltip = CreateWindowW(TOOLTIPS_CLASS, nullptr, TTS_ALWAYSTIP, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hwndDlg, 0, g_plugin.getInst(), 0); - { - TOOLINFOW ti = {}; - ti.cbSize = sizeof(ti); - ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS; - ti.hwnd = hwndDlg; - ti.hinst = g_plugin.getInst(); - ti.uId = (UINT_PTR)GetDlgItem(hwndDlg, IDC_FRAME_OPEN); - ti.lpszText = TranslateT("Open QS window"); - SendMessageW(hwndTooltip, TTM_ADDTOOLW, 0, LPARAM(&ti)); - } - SendMessage(GetDlgItem(hwndDlg, IDC_FRAME_OPEN), BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(IDI_QS)); - return TRUE; - - case WM_DESTROY: - DeleteObject(hBrush); - hBrush = nullptr; - break; - - case WM_SIZE: - Utils_ResizeDialog(hwndDlg, g_plugin.getInst(), MAKEINTRESOURCEA(IDD_FRAME), Resizer); - break; - - case WM_ERASEBKGND: - GetClientRect(hwndDlg, &rc); - FillRect(HDC(wParam), &rc, hBrush); - return TRUE; - - case WM_COMMAND: - if (HIWORD(wParam) == EN_CHANGE) { - wchar_t str[100]; - int length = GetDlgItemTextW(hwndDlg, IDC_FRAME_EDIT, str, _countof(str)); - if (length > 0) { - CharLowerW(str); - wszPattern = str; - } - else wszPattern.Empty(); - } - else if (wParam == IDC_FRAME_OPEN) { - CallService(QS_SHOWSERVICE, WPARAM(wszPattern.c_str()), 0); - } - break; - } - - return DefWindowProc(hwndDlg, msg, wParam, lParam); -} - -///////////////////////////////////////////////////////////////////////////////////////// - -static int OnChangeColors(WPARAM, LPARAM) -{ - frm_bkg = Colour_Get("QuickSearch", colorName); - - DeleteObject(hBrush); - hBrush = CreateSolidBrush(frm_bkg); - return 0; -} - -void CreateFrame(HWND hwndParent) -{ - if (!ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) - return; - - if (hwndParent) - hwndParent = g_clistApi.hwndContactList; - - if (hwndFrame == nullptr) - hwndFrame = CreateDialogW(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FRAME), hwndParent, FrameWndProc); - - if (hwndFrame == nullptr) - return; - - RECT tr; - GetWindowRect(hwndFrame, &tr); - - CLISTFrame Frame = { sizeof(Frame) }; - Frame.hWnd = hwndFrame; - Frame.hIcon = g_plugin.getIcon(IDI_QS); - Frame.align = alTop; - Frame.height = tr.bottom - tr.top + 2; - Frame.Flags = F_NOBORDER | F_UNICODE; - Frame.szName.w = TranslateT("Quick search"); - - frameId = CallService(MS_CLIST_FRAMES_ADDFRAME, WPARAM(&Frame), LPARAM(&g_plugin)); - if (frameId <= 0) - return; - - CallService(MS_CLIST_FRAMES_UPDATEFRAME, frameId, FU_FMPOS); - - HWND wnd = g_clistApi.hwndContactList; - DWORD tmp = SendMessage(wnd, CLM_GETEXSTYLE, 0, 0); - SendMessage(wnd, CLM_SETEXSTYLE, tmp | CLS_EX_SHOWSELALWAYS, 0); - - ColourID cid; - strncpy_s(cid.group, MODULENAME, _TRUNCATE); - strncpy_s(cid.dbSettingsGroup, MODULENAME, _TRUNCATE); - strncpy_s(cid.name, colorName, _TRUNCATE); - strncpy_s(cid.setting, "frame_back", _TRUNCATE); - cid.defcolour = GetSysColor(COLOR_3DFACE); - cid.order = 0; - g_plugin.addColor(&cid); - - HookEvent(ME_COLOUR_RELOAD, &OnChangeColors); - OnChangeColors(0,0); -} - -void DestroyFrame() -{ - if (frameId >= 0) { - CallService(MS_CLIST_FRAMES_REMOVEFRAME, frameId, 0); - frameId = -1; - } - - DestroyWindow(hwndFrame); - hwndFrame = nullptr; -} diff --git a/plugins/QuickSearch/src/main.cpp b/plugins/QuickSearch/src/main.cpp index 37ee81b3dc..db6c07b358 100644 --- a/plugins/QuickSearch/src/main.cpp +++ b/plugins/QuickSearch/src/main.cpp @@ -98,8 +98,6 @@ static int OnModulesLoaded(WPARAM, LPARAM) hkd.pszService = QS_SHOWSERVICE; hkd.DefHotKey = HOTKEYCODE(HOTKEYF_ALT, VK_F3); g_plugin.addHotkey(&hkd); - - CreateFrame(0); return 0; } @@ -185,7 +183,6 @@ int CMPlugin::Unload() hTTBButton = 0; } - DestroyFrame(); CloseSrWindow(); return 0; } diff --git a/plugins/QuickSearch/src/resource.h b/plugins/QuickSearch/src/resource.h index 8058dc6038..b339a3a5a2 100644 --- a/plugins/QuickSearch/src/resource.h +++ b/plugins/QuickSearch/src/resource.h @@ -13,9 +13,6 @@ #define IDI_UP 109 #define IDD_MAIN 110 #define IDD_OPTIONS 111 -#define IDD_FRAME 112 -#define IDC_FRAME_OPEN 1001 -#define IDC_FRAME_EDIT 1002 #define IDC_RELOAD 1003 #define IDC_NEW 1004 #define IDC_UP 1005 diff --git a/plugins/QuickSearch/src/stdafx.h b/plugins/QuickSearch/src/stdafx.h index b03499bb40..71481a7b36 100644 --- a/plugins/QuickSearch/src/stdafx.h +++ b/plugins/QuickSearch/src/stdafx.h @@ -215,12 +215,6 @@ struct CMPlugin : public PLUGIN<CMPlugin> extern bool g_bVarsInstalled, g_bTipperInstalled, g_bFingerInstalled; ///////////////////////////////////////////////////////////////////////////////////////// -// frame.cpp - -void CreateFrame(HWND); -void DestroyFrame(); - -///////////////////////////////////////////////////////////////////////////////////////// // utils.cpp int ColumnToListView(int col); diff --git a/plugins/QuickSearch/src/window_misc.cpp b/plugins/QuickSearch/src/window_misc.cpp index a0f75b4201..d0c90b73a3 100644 --- a/plugins/QuickSearch/src/window_misc.cpp +++ b/plugins/QuickSearch/src/window_misc.cpp @@ -165,7 +165,7 @@ void QSMainDlg::AdvancedFilter() UpdateSB(); } -void QSMainDlg::ChangeStatusPicture(CRowItem *pRow, MCONTACT hContact, LPARAM lParam) +void QSMainDlg::ChangeStatusPicture(CRowItem *pRow, MCONTACT, LPARAM lParam) { int idx = FindItem(pRow); if (idx == -1) |