summaryrefslogtreecommitdiff
path: root/plugins/BasicHistory/src/HistoryWindow.h
blob: 66202937b46c8fc29f87baeca660de696fab526a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/*
Basic History plugin
Copyright (C) 2011-2012 Krzysztof Kral

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/>.
*/

#pragma once
#include "Searcher.h"

class HistoryWindow : public SearchContext
{
private:
	HistoryWindow(HANDLE _hContact);
	void Initialise();
	void Destroy();
	void SplitterMoved(HWND splitter, LONG pos, bool screenPos);
	static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
	static LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
	static int HistoryDlgResizer(HWND, LPARAM, UTILRESIZECONTROL *urc);
	static void FillHistoryThread(void* param);
	static void Close(HistoryWindow* historyWindow);
	static void ChangeToFreeWindow(HistoryWindow* historyWindow);
	void ReplaceIcons(HWND hwndDlg, int selStart, BOOL isSent);
	void EnableWindows(BOOL enable);
	void ReloadContacts();
	bool DoHotkey(UINT msg, LPARAM lParam, WPARAM wParam, int window);
	void RestorePos();
	void SavePos(bool all);
	void FindToolbarClicked(LPNMTOOLBAR lpnmTB);
	void ConfigToolbarClicked(LPNMTOOLBAR lpnmTB);
	void DeleteToolbarClicked(LPNMTOOLBAR lpnmTB);
	void Delete(int what);
	bool ContactChanged(bool sync = false);
	void GroupImagesChanged();
	void FormatQuote(std::wstring& quote, const MessageData& md, const std::wstring& msg);
	void FontsChanged();
	void ReloadMainOptions();
	void DoImport(IImport::ImportType type);

	static std::map<HANDLE, HistoryWindow*> windows;
	static std::vector<HistoryWindow*> freeWindows;
	bool isDestroyed;
	LONG splitterY;
	LONG splitterOrgY;
	LONG splitterX;
	LONG splitterOrgX;
	HICON *eventIcons;
	int allIconNumber;
	HICON plusIco, minusIco, findNextIco, findPrevIco, configIco, deleteIco;
	bool isContactList;
	LONG listOryginalPos;
	bool isLoading;
	Searcher searcher;
	bool isGroupImages;
	HIMAGELIST himlSmall, himlNone;
	HBRUSH bkBrush;
	HBRUSH bkFindBrush;
	HANDLE hSystem;
	HWND splitterXhWnd, splitterYhWnd;
	bool isStartSelect;
protected:
	virtual void AddGroup(bool isMe, const std::wstring &time, const std::wstring &user, const std::wstring &eventText, int ico);
public:
	~HistoryWindow();
	static void Deinit();
	static void Open(HANDLE hContact);
	static void Close(HANDLE hContact);
	static void RebuildEvents(HANDLE hContact);
	static bool IsInList(HWND hWnd);
	static int FontsChanged(WPARAM wParam, LPARAM lParam);
	static INT_PTR DeleteAllUserHistory(WPARAM wParam, LPARAM lParam);
	static void OptionsMainChanged();
	static void OptionsGroupChanged();
	static void OptionsSearchingChanged();
	void Show();
	void Focus();

	// SearchContext interface
	virtual void SelectEventGroup(int sel);
	virtual HANDLE GetNextContact(HANDLE hContact, int adder);
	virtual void SelectContact(HANDLE _hContact);
};