summaryrefslogtreecommitdiff
path: root/plugins/Popup/src/config.cpp
blob: 66fba97b46a359dbb937882a273217fcfd17c0ed (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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/*
Popup Plus plugin for Miranda IM

Copyright	© 2002 Luca Santarelli,
			© 2004-2007 Victor Pavlychko
			© 2010 MPK
			© 2010 Merlin_de

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; either version 2
of the License, or (at your option) any later version.

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, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/

#include "headers.h"

//===== General Plugin =====
HINSTANCE hInst;
HANDLE hMainThread;
//MNOTIFYLINK *notifyLink;	//deprecatet

HANDLE hSemaphore;
BOOL closing = FALSE;
MTEXT_INTERFACE		MText = {0};
HANDLE folderId;
BOOL gbPopupLoaded  = FALSE;
BOOL gbHppInstalled = FALSE;
LPCSTR gszMetaProto = "";

//===== Brushes, Colours and Fonts =====
HBITMAP hbmNoAvatar;

//===== Options =====
POPUPOPTIONS PopupOptions;
//SKINELEMENT *skin;
//SKINELEMENT *w_skin;
//SKINELEMENT *n_skin;


//===== Plugin information =====

PLUGININFOEX pluginInfoEx =
{
	sizeof(PLUGININFOEX),
	__PLUGIN_NAME,
	PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
	__DESCRIPTION,
	__AUTHOR,
	__AUTHOREMAIL,
	__COPYRIGHT,
	__AUTHORWEB,
	UNICODE_AWARE,
	// {26A9125D-7863-4E01-AF0E-D14EF95C5054}
	{0x26a9125d, 0x7863, 0x4e01, {0xaf, 0xe, 0xd1, 0x4e, 0xf9, 0x5c, 0x50, 0x54}}
};


HRESULT		(WINAPI *MyDwmEnableBlurBehindWindow)(HWND hWnd, DWM_BLURBEHIND *pBlurBehind);

//====== Common Vars ========================

// common funcs
void LoadOptions() {
	ZeroMemory(&PopupOptions, sizeof(PopupOptions));
	#if defined(_DEBUG)
		PopupOptions.debug = db_get_b(NULL, MODULNAME, "debug", FALSE);
	#endif

	//Load Popup Options
	if (!OptionLoaded){
		LoadOption_General();
		LoadOption_Skins();
		LoadOption_Actions();
		LoadOption_AdvOpts();
	}
	Check_ReorderPopups();
	OptionLoaded = true;
	return;
}

void PopupPreview()
{
	TCHAR *lptzTitle1Eng = TranslateT("The Jabberwocky");
	TCHAR *lptzText1Eng  = TranslateT("`Twas brillig, and the slithy toves\r\nDid gyre and gimble in the wabe:\r\nAll mimsy were the borogoves,\r\nAnd the mome raths outgrabe.\r\n\t[b][i]Lewis Carroll, 1855[/i][/b]");

	TCHAR *lptzTitle2 = TranslateT("Test preview for the popup plugin settings. This is supposed to be long enough not to fit in one line...");
	TCHAR *lptzText2  = TranslateTS(
		LPGENT("This is a special test preview for the popup plugin settings. The text and title are quite long so you can tweak your skin and plugin settings to best fit your needs :)")
		);

	POPUPDATA2 ppd = {0};

	ZeroMemory(&ppd, sizeof(ppd));
	ppd.cbSize		= sizeof(ppd);
	ppd.flags		= PU2_TCHAR;

	ppd.lptzTitle	= lptzTitle1Eng;
	ppd.lptzText	= lptzText1Eng;
	ppd.lchIcon		= LoadSkinnedIcon(SKINICON_EVENT_MESSAGE);
	CallService(MS_POPUP_ADDPOPUP2, (WPARAM)&ppd, APF_NO_HISTORY);
	if (PopupOptions.UseAnimations || PopupOptions.UseEffect) Sleep((ANIM_TIME*2)/3); //Pause

	ZeroMemory(&ppd, sizeof(ppd));
	ppd.cbSize		= sizeof(ppd);
	ppd.flags		= PU2_TCHAR;
	ppd.lptzTitle	= lptzTitle2;
	ppd.lptzText	= lptzText2;
	ppd.lchIcon		= LoadSkinnedIcon(SKINICON_OTHER_MIRANDA);
	ppd.hbmAvatar	= hbmNoAvatar;

	CallService(MS_POPUP_ADDPOPUP2, (WPARAM)&ppd, APF_NO_HISTORY);
	if (PopupOptions.UseAnimations || PopupOptions.UseEffect) Sleep((ANIM_TIME*2)/3); //Pause

	PUShowMessageT(TranslateT("This is a notification message"),	(DWORD)SM_NOTIFY|0x80000000);
	if (PopupOptions.UseAnimations || PopupOptions.UseEffect) Sleep((ANIM_TIME*2)/3); //Pause

	PUShowMessageT(TranslateT("This is a warning message"),			(DWORD)SM_WARNING|0x80000000);
	if (PopupOptions.UseAnimations || PopupOptions.UseEffect) Sleep((ANIM_TIME*2)/3); //Pause

	PUShowMessageT(TranslateT("This is an error message"),			(DWORD)SM_ERROR|0x80000000);
}