summaryrefslogtreecommitdiff
path: root/!NotAdopted/SMS/options.cpp
blob: dd5260248420c96e22d7ee2fc80d3aef4f3ee0d8 (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
/*
Miranda-IM SMS Plugin
Copyright (C) 2001-2002  Richard Hughes
Copyright (C) 2007-2009  Rozhuk Ivan

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

This was the original words.
This plugin was modified by Ariel Shulman (NuKe007).
For any comments, problems, etc. contact me at Miranda-IM forums or E-Mail or ICQ.
All the information needed you can find at www.nuke007.tk
Enjoy the code and use it smartly!
*/
#include "main.h"



WORD wSMSSignControlsList[]={
						IDC_BEGIN,
						IDC_END,
						IDC_SIGNATURE,
						IDC_SIGNGROUP
};


BOOL CALLBACK DlgProcEditorOptions(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch(msg){
	case WM_INITDIALOG:
		TranslateDialogDefault(hWndDlg);
		{	
			WCHAR wszSign[1024];
			BOOL bSignBebefore,bUseSign;

			if (DB_SMS_GetStaticStringW(NULL,"Signature",wszSign,SIZEOF(wszSign),NULL)==FALSE)
			{
				mir_sntprintf(wszSign,SIZEOF(wszSign),TranslateW(L"From %s:\r\n\r\n"),GetContactNameW(NULL));
			}
			SET_DLG_ITEM_TEXTW(hWndDlg,IDC_SIGNATURE,wszSign);

			bUseSign=DB_SMS_GetByte(NULL,"UseSignature",SMS_DEFAULT_USESIGNATURE);
			CHECK_DLG_BUTTON(hWndDlg,IDC_USESIGNATURE,bUseSign);
			EnableControlsArray(hWndDlg,(WORD*)&wSMSSignControlsList,SIZEOF(wSMSSignControlsList),bUseSign);

			bSignBebefore=DB_SMS_GetByte(NULL,"SignaturePos",SMS_DEFAULT_SIGNATUREPOS);
			CHECK_DLG_BUTTON(hWndDlg,IDC_BEGIN,bSignBebefore);
			CHECK_DLG_BUTTON(hWndDlg,IDC_END,(!bSignBebefore));

			CHECK_DLG_BUTTON(hWndDlg,IDC_SHOWACK,DB_SMS_GetByte(NULL,"ShowACK",SMS_DEFAULT_SHOWACK));
			CHECK_DLG_BUTTON(hWndDlg,IDC_AUTOPOP,DB_SMS_GetByte(NULL,"AutoPopup",SMS_DEFAULT_AUTOPOP));
			CHECK_DLG_BUTTON(hWndDlg,IDC_SAVEWINPOS,DB_SMS_GetByte(NULL,"SavePerContact",SMS_DEFAULT_SAVEWINPOS));
		}
		return(TRUE);
	case WM_COMMAND:
		SendMessage(GetParent(hWndDlg),PSM_CHANGED,0,0);
		switch(LOWORD(wParam)){
		case IDC_USESIGNATURE:
			EnableControlsArray(hWndDlg,(WORD*)&wSMSSignControlsList,SIZEOF(wSMSSignControlsList),IS_DLG_BUTTON_CHECKED(hWndDlg,IDC_USESIGNATURE));
			break;
		}
		break;
	case WM_NOTIFY:
		switch(((LPNMHDR)lParam)->idFrom){
		case 0:
			switch (((LPNMHDR)lParam)->code){
			case PSN_APPLY:
				{
					WCHAR wszSign[1024];

					GET_DLG_ITEM_TEXTW(hWndDlg,IDC_SIGNATURE,wszSign,SIZEOF(wszSign));
					DB_SMS_SetStringW(NULL,"Signature",wszSign);

					DB_SMS_SetByte(NULL,"UseSignature",IS_DLG_BUTTON_CHECKED(hWndDlg,IDC_USESIGNATURE));
					DB_SMS_SetByte(NULL,"SignaturePos",IS_DLG_BUTTON_CHECKED(hWndDlg,IDC_BEGIN));
					DB_SMS_SetByte(NULL,"ShowACK",IS_DLG_BUTTON_CHECKED(hWndDlg,IDC_SHOWACK));
					DB_SMS_SetByte(NULL,"AutoPopup",IS_DLG_BUTTON_CHECKED(hWndDlg,IDC_AUTOPOP));
					DB_SMS_SetByte(NULL,"SavePerContact",IS_DLG_BUTTON_CHECKED(hWndDlg,IDC_SAVEWINPOS));
				}
				return(TRUE);
			}
			break;
		}
		break;
	}
return(FALSE);
}

int OptInitialise(WPARAM wParam,LPARAM lParam)
{
	OPTIONSDIALOGPAGE odp={0};

	odp.cbSize=sizeof(odp);
	odp.position=910000000;
	odp.hInstance=ssSMSSettings.hInstance;
	odp.ptszGroup=TranslateW(L"Events");
	odp.flags=(ODPF_BOLDGROUPS|ODPF_UNICODE);
	odp.pszTemplate=MAKEINTRESOURCEA(IDD_OPT_SMSPLUGIN);
	odp.ptszTitle=PROTOCOL_DISPLAY_NAME_ORIGW;
	odp.pfnDlgProc=DlgProcEditorOptions;
	CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
return(0);
}