From 429d24ee71e4a27f9e8885af96091e502e525ac1 Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Sun, 24 Jun 2012 10:14:31 +0000 Subject: BasicHistory updated to 1.0.1.6 git-svn-id: http://svn.miranda-ng.org/main/trunk@596 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/BasicHistory/HistoryWindow.cpp | 95 ++++++++++++++++++++++++++++------ plugins/BasicHistory/HistoryWindow.h | 2 + plugins/BasicHistory/Options.cpp | 21 ++++---- plugins/BasicHistory/Options.h | 3 ++ plugins/BasicHistory/version.h | 2 +- 5 files changed, 97 insertions(+), 26 deletions(-) (limited to 'plugins') diff --git a/plugins/BasicHistory/HistoryWindow.cpp b/plugins/BasicHistory/HistoryWindow.cpp index e693693b8c..e69f5f33ad 100644 --- a/plugins/BasicHistory/HistoryWindow.cpp +++ b/plugins/BasicHistory/HistoryWindow.cpp @@ -37,6 +37,8 @@ extern char* metaContactProto; #define MIN_PANELHEIGHT 40 +void ResetCList(HWND hWnd); + HistoryWindow::HistoryWindow(HANDLE _hContact) : isDestroyed(true), OldSplitterProc(0), @@ -56,7 +58,10 @@ HistoryWindow::HistoryWindow(HANDLE _hContact) allIconNumber(0), eventIcoms(NULL), bkBrush(NULL), - hSystem(NULL) + bkFindBrush(NULL), + hSystem(NULL), + splitterXhWnd(NULL), + splitterYhWnd(NULL) { searcher.SetContect(this); hContact = _hContact; @@ -115,6 +120,10 @@ HistoryWindow::~HistoryWindow() { DeleteObject(bkBrush); } + if(bkFindBrush != NULL) + { + DeleteObject(bkFindBrush); + } } std::map HistoryWindow::windows; @@ -324,9 +333,15 @@ void HistoryWindow::FontsChanged() { DeleteObject(bkBrush); } + if(bkFindBrush != NULL) + { + DeleteObject(bkFindBrush); + } bkBrush = CreateSolidBrush(Options::instance->GetColor(Options::WindowBackground)); - + bkFindBrush = CreateSolidBrush(Options::instance->GetColor(Options::FindBackground)); + + ResetCList(hWnd); COLORREF bkColor = Options::instance->GetColor(Options::GroupListBackground); ListView_SetBkColor(listWindow, bkColor); ListView_SetTextBkColor(listWindow, bkColor); @@ -686,7 +701,7 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP SendDlgItemMessage( hwndDlg, IDC_SHOWHIDE, BUTTONADDTOOLTIP, (WPARAM)LPGENT("Hide Contacts"), BATF_TCHAR); historyWindow->isContactList = true; ShowWindow(GetDlgItem(hwndDlg,IDC_LIST_CONTACTS), SW_SHOW); - ShowWindow(GetDlgItem(hwndDlg,IDC_SPLITTERV), SW_SHOW); + ShowWindow(historyWindow->splitterYhWnd, SW_SHOW); } else { @@ -694,7 +709,7 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP SendDlgItemMessage( hwndDlg, IDC_SHOWHIDE, BUTTONADDTOOLTIP, (WPARAM)LPGENT("Show Contacts"), BATF_TCHAR); historyWindow->isContactList = false; ShowWindow(GetDlgItem(hwndDlg,IDC_LIST_CONTACTS), SW_HIDE); - ShowWindow(GetDlgItem(hwndDlg,IDC_SPLITTERV), SW_HIDE); + ShowWindow(historyWindow->splitterYhWnd, SW_HIDE); } SendMessage(hwndDlg, WM_SIZE, 0, 0); @@ -715,7 +730,11 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP if(pNmhdr->code == CLN_LISTREBUILT)// || pNmhdr->code == CLN_CONTACTMOVED || pNmhdr->code == CLN_NEWCONTACT) { HistoryWindow* historyWindow =(HistoryWindow*)GetWindowLongPtr(hwndDlg,GWLP_USERDATA); - historyWindow->ReloadContacts(); + if(historyWindow != NULL) + { + historyWindow->ReloadContacts(); + } + DlgReturn(TRUE); } else if(pNmhdr->code == CLN_MYSELCHANGED) @@ -732,6 +751,11 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP DlgReturn(TRUE); } + else if(pNmhdr->code == CLN_OPTIONSCHANGED) + { + ResetCList(hwndDlg); + return FALSE; + } //fall through //case IDC_LIST_CONTACTS: @@ -1097,6 +1121,32 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP HistoryWindow* historyWindow =(HistoryWindow*)GetWindowLongPtr(hwndDlg,GWLP_USERDATA); DlgReturn((LONG_PTR)historyWindow->bkBrush); } + case WM_CTLCOLORSTATIC: + { + HistoryWindow* historyWindow =(HistoryWindow*)GetWindowLongPtr(hwndDlg,GWLP_USERDATA); + HWND curhWnd = (HWND)lParam; + if(historyWindow->splitterXhWnd == curhWnd || historyWindow->splitterYhWnd == curhWnd) + { + DlgReturn((LONG_PTR)historyWindow->bkBrush); + } + + break; + } + case WM_CTLCOLOREDIT: + { + HistoryWindow* historyWindow =(HistoryWindow*)GetWindowLongPtr(hwndDlg,GWLP_USERDATA); + HWND curhWnd = (HWND)lParam; + if(historyWindow->findWindow == curhWnd) + { + HDC edithdc = (HDC)wParam; + LOGFONT font; + SetTextColor(edithdc, Options::instance->GetFont(Options::Find, &font)); + SetBkColor(edithdc, Options::instance->GetColor(Options::FindBackground)); + DlgReturn((LONG_PTR)historyWindow->bkFindBrush); + } + + break; + } case DM_SPLITTERMOVED: { HistoryWindow* historyWindow =(HistoryWindow*)GetWindowLongPtr(hwndDlg,GWLP_USERDATA); @@ -1138,8 +1188,10 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP void HistoryWindow::Initialise() { - OldSplitterProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hWnd, IDC_SPLITTER), GWLP_WNDPROC, (LONG_PTR) SplitterSubclassProc); - SetWindowLongPtr(GetDlgItem(hWnd, IDC_SPLITTERV), GWLP_WNDPROC, (LONG_PTR) SplitterSubclassProc); + splitterXhWnd = GetDlgItem(hWnd, IDC_SPLITTER); + splitterYhWnd = GetDlgItem(hWnd, IDC_SPLITTERV); + OldSplitterProc = (WNDPROC)SetWindowLongPtr(splitterXhWnd, GWLP_WNDPROC, (LONG_PTR) SplitterSubclassProc); + SetWindowLongPtr(splitterYhWnd, GWLP_WNDPROC, (LONG_PTR) SplitterSubclassProc); editWindow = GetDlgItem(hWnd, IDC_EDIT); findWindow = GetDlgItem(hWnd, IDC_FIND_TEXT); @@ -1148,13 +1200,13 @@ void HistoryWindow::Initialise() RECT rc; POINT pt; - GetWindowRect(GetDlgItem(hWnd, IDC_SPLITTER), &rc); + GetWindowRect(splitterXhWnd, &rc); pt.y = (rc.top + rc.bottom) / 2; pt.x = 0; ScreenToClient(hWnd, &pt); splitterOrgY = pt.y; splitterY = pt.y; - GetWindowRect(GetDlgItem(hWnd, IDC_SPLITTERV), &rc); + GetWindowRect(splitterYhWnd, &rc); pt.y = 0; pt.x = (rc.left + rc.right) / 2; ScreenToClient(hWnd, &pt); @@ -1168,8 +1220,8 @@ void HistoryWindow::Initialise() plusIco = (HICON)CallService(MS_SKIN2_GETICONBYHANDLE, 1, (LPARAM)hPlusIcon); minusIco = (HICON)CallService(MS_SKIN2_GETICONBYHANDLE, 1, (LPARAM)hMinusIcon); - SendDlgItemMessage( hWnd, IDC_SHOWHIDE, BUTTONSETASPUSHBTN, TRUE, 0 ); - SendDlgItemMessage( hWnd, IDC_SHOWHIDE, BUTTONSETASFLATBTN, TRUE, 0 ); + SendDlgItemMessage( hWnd, IDC_SHOWHIDE, BUTTONSETASPUSHBTN, 0, 0 ); + SendDlgItemMessage( hWnd, IDC_SHOWHIDE, BUTTONSETASFLATBTN, 0, 0 ); if(hContact == NULL || Options::instance->showContacts) { SendDlgItemMessage( hWnd, IDC_SHOWHIDE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)minusIco); @@ -1183,13 +1235,13 @@ void HistoryWindow::Initialise() SendDlgItemMessage( hWnd, IDC_SHOWHIDE, BUTTONADDTOOLTIP, (WPARAM)LPGENT("Show Contacts"), BATF_TCHAR); Button_SetCheck(GetDlgItem(hWnd,IDC_SHOWHIDE), BST_UNCHECKED); ShowWindow(GetDlgItem(hWnd,IDC_LIST_CONTACTS), SW_HIDE); - ShowWindow(GetDlgItem(hWnd,IDC_SPLITTERV), SW_HIDE); + ShowWindow(splitterYhWnd, SW_HIDE); isContactList = false; } RegisterHotkeyControl(GetDlgItem(hWnd, IDC_SHOWHIDE)); RegisterHotkeyControl(GetDlgItem(hWnd, IDC_LIST_CONTACTS)); - SendDlgItemMessage(hWnd, IDC_LIST_CONTACTS, CLM_SETUSEGROUPS, Options::instance->showContactGroups, 0); + ResetCList(hWnd); RestorePos(); SendMessage(hWnd, WM_SETICON, ICON_BIG, ( LPARAM )LoadSkinnedIconBig( SKINICON_OTHER_HISTORY )); @@ -1226,6 +1278,7 @@ void HistoryWindow::Initialise() } bkBrush = CreateSolidBrush(Options::instance->GetColor(Options::WindowBackground)); + bkFindBrush = CreateSolidBrush(Options::instance->GetColor(Options::FindBackground)); LVCOLUMN col = {0}; col.mask = LVCF_WIDTH | LVCF_TEXT; @@ -1306,7 +1359,7 @@ void HistoryWindow::SplitterMoved(HWND splitter, LONG pos, bool screenPos) POINT pt1; POINT pt2; - if(splitter == GetDlgItem(hWnd, IDC_SPLITTER)) + if(splitter == splitterXhWnd) { GetWindowRect(listWindow, &rc1); GetWindowRect(editWindow, &rc2); @@ -1666,6 +1719,8 @@ LRESULT CALLBACK HistoryWindow::SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM { HWND hwndParent = GetParent(hwnd); HistoryWindow *dat = (HistoryWindow*)GetWindowLongPtr(hwndParent, GWLP_USERDATA); + if(dat == NULL || dat->isDestroyed) + return FALSE; switch (msg) { case WM_NCHITTEST: @@ -1889,13 +1944,13 @@ void HistoryWindow::RestorePos() LONG pos = DBGetContactSettingDword(contactToLoad, MODULE, "history_splitterv", 0); if(pos > 0) { - SplitterMoved(GetDlgItem(hWnd, IDC_SPLITTERV), pos, false); + SplitterMoved(splitterYhWnd, pos, false); } pos = DBGetContactSettingDword(contactToLoad, MODULE, "history_splitter", 0); if(pos > 0) { - SplitterMoved(GetDlgItem(hWnd, IDC_SPLITTER), pos, false); + SplitterMoved(splitterXhWnd, pos, false); } } @@ -2510,3 +2565,11 @@ void HistoryWindow::SelectContact(HANDLE _hContact) ContactChanged(true); } } + +void ResetCList(HWND hWnd) +{ + COLORREF bkCLColor = Options::instance->GetColor(Options::ContactListBackground); + SendDlgItemMessage(hWnd, IDC_LIST_CONTACTS, CLM_SETBKBITMAP, 0, (LPARAM)(HBITMAP) NULL); + SendDlgItemMessage(hWnd, IDC_LIST_CONTACTS, CLM_SETBKCOLOR, bkCLColor, 0); + SendDlgItemMessage(hWnd, IDC_LIST_CONTACTS, CLM_SETUSEGROUPS, Options::instance->showContactGroups, 0); +} diff --git a/plugins/BasicHistory/HistoryWindow.h b/plugins/BasicHistory/HistoryWindow.h index a28f014c89..8a31d9194a 100644 --- a/plugins/BasicHistory/HistoryWindow.h +++ b/plugins/BasicHistory/HistoryWindow.h @@ -67,7 +67,9 @@ private: bool isGroupImages; HIMAGELIST himlSmall, himlNone; HBRUSH bkBrush; + HBRUSH bkFindBrush; HANDLE hSystem; + HWND splitterXhWnd, splitterYhWnd; protected: virtual void AddGroup(bool isMe, const std::wstring &time, const std::wstring &user, const std::wstring &eventText, int ico); public: diff --git a/plugins/BasicHistory/Options.cpp b/plugins/BasicHistory/Options.cpp index 29988fdd03..be024479ee 100644 --- a/plugins/BasicHistory/Options.cpp +++ b/plugins/BasicHistory/Options.cpp @@ -124,35 +124,35 @@ int Options::InitOptions(WPARAM wParam, LPARAM lParam) odp.cbSize = sizeof(odp); odp.position = 100000000; odp.hInstance = hInst; - odp.flags = ODPF_BOLDGROUPS; - odp.pszTitle = LPGEN("History"); + odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR; + odp.ptszTitle = LPGENT("History"); - odp.pszTab = LPGEN("Group list"); + odp.ptszTab = LPGENT("Group list"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_GROUPLIST); odp.pfnDlgProc = Options::DlgProcOptsGroupList; Options_AddPage(wParam, &odp); - odp.pszTab = LPGEN("Messages"); + odp.ptszTab = LPGENT("Messages"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MESSAGES); odp.pfnDlgProc = Options::DlgProcOptsMessages; Options_AddPage(wParam, &odp); - odp.pszTab = LPGEN("Searching"); + odp.ptszTab = LPGENT("Searching"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_SEARCHING); odp.pfnDlgProc = Options::DlgProcOptsSearching; Options_AddPage(wParam, &odp); - odp.pszTab = LPGEN("Export"); + odp.ptszTab = LPGENT("Export"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_EXPORT); odp.pfnDlgProc = Options::DlgProcOptsExport; Options_AddPage(wParam, &odp); - odp.pszTab = LPGEN("Scheduler"); + odp.ptszTab = LPGENT("Scheduler"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_SCHEDULER); odp.pfnDlgProc = Options::DlgProcOptsScheduler; Options_AddPage(wParam, &odp); - odp.pszTab = LPGEN("Advanced"); + odp.ptszTab = LPGENT("Advanced"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MAIN); odp.pfnDlgProc = Options::DlgProcOptsMain; Options_AddPage(wParam, &odp); @@ -192,6 +192,7 @@ static FontOptionsList g_FontOptionsList[] = { {LPGENT(">> Outgoing messages"), RGB(0, 0, 0), _T("MS Shell Dlg 2"), 0, -11, LPGENT("Outgoing background"), FIDF_ALLOWEFFECTS}, {LPGENT("<< Incoming messages"), RGB(0, 0, 0), _T("MS Shell Dlg 2"), 0, -11, LPGENT("Incoming background"), FIDF_ALLOWEFFECTS}, {LPGENT("Group list"), RGB(0, 0, 0), _T("MS Shell Dlg 2"), 0, -11, LPGENT("Group list background"), FIDF_DISABLESTYLES}, + {LPGENT("Find window"), RGB(0, 0, 0), _T("MS Shell Dlg 2"), 0, -11, LPGENT("Find window background"), FIDF_DISABLESTYLES}, }; static ColorOptionsList g_ColorOptionsList[] = { @@ -199,6 +200,8 @@ static ColorOptionsList g_ColorOptionsList[] = { LPGENT("Incoming background"), RGB(245,255,245), LPGENT("Group list background"), GetSysColor(COLOR_3DFACE), LPGENT("Window background"), GetSysColor(COLOR_3DFACE), + LPGENT("Contact list background"), GetSysColor(COLOR_3DFACE), + LPGENT("Find window background"), GetSysColor(COLOR_WINDOW), }; static HotkeyOptionsList g_HotkeyOptionsList[] = { @@ -258,7 +261,7 @@ void Options::Load() _tcsncpy_s(fid.name, g_FontOptionsList[i].szDescr, SIZEOF(fid.name)); _tcsncpy_s(fid.backgroundName, g_FontOptionsList[i].szBackgroundName, SIZEOF(fid.name)); fid.flags = FIDF_DEFAULTVALID | FIDF_CLASSGENERAL | g_FontOptionsList[i].flags; - CallService(MS_FONT_REGISTERT, (WPARAM)&fid, 0); + FontRegisterT(&fid); } strncpy_s(cid.dbSettingsGroup, "BasicHistory_Fonts", SIZEOF(fid.dbSettingsGroup)); diff --git a/plugins/BasicHistory/Options.h b/plugins/BasicHistory/Options.h index 6eab65d08a..7ff61bb997 100644 --- a/plugins/BasicHistory/Options.h +++ b/plugins/BasicHistory/Options.h @@ -180,6 +180,7 @@ public: OutMessages, InMessages, GroupList, + Find, }; enum Colors @@ -188,6 +189,8 @@ public: InBackground, GroupListBackground, WindowBackground, + ContactListBackground, + FindBackground, }; COLORREF GetFont(Fonts fontId, PLOGFONT font); diff --git a/plugins/BasicHistory/version.h b/plugins/BasicHistory/version.h index 691fb07ebd..8b7d5ce949 100644 --- a/plugins/BasicHistory/version.h +++ b/plugins/BasicHistory/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 1 #define __MINOR_VERSION 0 #define __RELEASE_NUM 1 -#define __BUILD_NUM 5 +#define __BUILD_NUM 6 #define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM #define __FILEVERSION_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM -- cgit v1.2.3