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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
|
/*
* Miranda NG: the free IM client for Microsoft* Windows*
*
* Copyright 2000-2009 Miranda ICQ/IM project,
* all portions of this codebase are copyrighted to the people
* listed in contributors.txt.
*
* 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.
*
* part of tabSRMM messaging plugin for Miranda.
*
* This code is based on and still contains large parts of the the
* original chat module for Miranda NG, written and copyrighted
* by Joergen Persson in 2005.
*
* (C) 2005-2009 by silvercircle _at_ gmail _dot_ com and contributors
*
* group chat options and generic font handling
*
*/
#include "..\commonheaders.h"
#define FONTF_BOLD 1
#define FONTF_ITALIC 2
struct FontOptionsList
{
TCHAR* szDescr;
COLORREF defColour;
TCHAR* szDefFace;
BYTE defCharset, defStyle;
char defSize;
COLORREF colour;
TCHAR szFace[LF_FACESIZE];
BYTE charset, style;
char size;
};
struct ColorOptionsList
{
int order;
TCHAR* tszGroup;
TCHAR* tszName;
char* szSetting;
COLORREF def;
};
/*
* note: bits 24-31 in default color indicates that color is a system color index
* (GetSysColor(default_color & 0x00ffffff)), not a rgb value.
*/
static ColorOptionsList _clrs[] = {
0, LPGENT("Message Sessions")_T("/")LPGENT("Group Chats"), LPGENT("Group chat log background"), SRMSGSET_BKGCOLOUR_MUC, SRMSGDEFSET_BKGCOLOUR,
1, LPGENT("Message Sessions"), LPGENT("Input area background"), "inputbg", SRMSGDEFSET_BKGCOLOUR,
2, LPGENT("Message Sessions"), LPGENT("Log background"), SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR,
0, LPGENT("Message Sessions")_T("/")LPGENT("Single Messaging"), LPGENT("Outgoing background"), "outbg", SRMSGDEFSET_BKGOUTCOLOUR,
1, LPGENT("Message Sessions")_T("/")LPGENT("Single Messaging"), LPGENT("Incoming background"), "inbg", SRMSGDEFSET_BKGINCOLOUR,
2, LPGENT("Message Sessions")_T("/")LPGENT("Single Messaging"), LPGENT("Status background"), "statbg", SRMSGDEFSET_BKGCOLOUR,
3, LPGENT("Message Sessions")_T("/")LPGENT("Single Messaging"), LPGENT("Incoming background(old)"), "oldinbg", SRMSGDEFSET_BKGINCOLOUR,
4, LPGENT("Message Sessions")_T("/")LPGENT("Single Messaging"), LPGENT("Outgoing background(old)"), "oldoutbg", SRMSGDEFSET_BKGOUTCOLOUR,
5, LPGENT("Message Sessions")_T("/")LPGENT("Single Messaging"), LPGENT("Horizontal Grid Lines"), "hgrid", RGB(224, 224, 224),
0, LPGENT("Message Sessions")_T("/")LPGENT("Info Panel"), LPGENT("Panel background low"), "ipfieldsbg", 0x62caff,
1, LPGENT("Message Sessions")_T("/")LPGENT("Info Panel"), LPGENT("Panel background high"), "ipfieldsbgHigh", 0xf0f0f0,
0, LPGENT("Message Sessions")_T("/")LPGENT("Common colors"), LPGENT("Toolbar background high"), "tbBgHigh", 0,
1, LPGENT("Message Sessions")_T("/")LPGENT("Common colors"), LPGENT("Toolbar background low"), "tbBgLow", 0,
2, LPGENT("Message Sessions")_T("/")LPGENT("Common colors"), LPGENT("Window fill color"), "fillColor", 0,
3, LPGENT("Message Sessions")_T("/")LPGENT("Common colors"), LPGENT("Text area borders"), "cRichBorders", 0,
4, LPGENT("Message Sessions")_T("/")LPGENT("Common colors"), LPGENT("Aero glow effect"), "aeroGlow", RGB(40, 40, 255),
4, LPGENT("Message Sessions")_T("/")LPGENT("Common colors"), LPGENT("Generic text color (only when fill color is set)"), "genericTxtClr", 0xff000000 | COLOR_BTNTEXT,
};
static ColorOptionsList _tabclrs[] = {
0, LPGENT("Message Sessions")_T("/")LPGENT("Tabs"), LPGENT("Normal text"), "tab_txt_normal", 0xff000000 | COLOR_BTNTEXT,
1, LPGENT("Message Sessions")_T("/")LPGENT("Tabs"), LPGENT("Active text"), "tab_txt_active", 0xff000000 | COLOR_BTNTEXT,
2, LPGENT("Message Sessions")_T("/")LPGENT("Tabs"), LPGENT("Hovered text"), "tab_txt_hottrack", 0xff000000 | COLOR_HOTLIGHT,
3, LPGENT("Message Sessions")_T("/")LPGENT("Tabs"), LPGENT("Unread text"), "tab_txt_unread", 0xff000000 | COLOR_HOTLIGHT,
4, LPGENT("Message Sessions")_T("/")LPGENT("Tabs"), LPGENT("Normal background"), "tab_bg_normal", 0xff000000 | COLOR_3DFACE,
5, LPGENT("Message Sessions")_T("/")LPGENT("Tabs"), LPGENT("Active background"), "tab_bg_active", 0xff000000 | COLOR_3DFACE,
6, LPGENT("Message Sessions")_T("/")LPGENT("Tabs"), LPGENT("Hovered background"), "tab_bg_hottrack", 0xff000000 | COLOR_3DFACE,
7, LPGENT("Message Sessions")_T("/")LPGENT("Tabs"), LPGENT("Unread background"), "tab_bg_unread", 0xff000000 | COLOR_3DFACE
};
extern LOGFONT lfDefault;
//remember to put these in the Translate( ) template file too
static FontOptionsList CHAT_fontOptionsList[] = {
{LPGENT("Timestamp"), RGB(50, 50, 240), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
{LPGENT("Others nicknames"), RGB(0, 0, 192), lfDefault.lfFaceName, DEFAULT_CHARSET, FONTF_BOLD, -12},
{LPGENT("Your nickname"), RGB(0, 0, 192), lfDefault.lfFaceName, DEFAULT_CHARSET, FONTF_BOLD, -12},
{LPGENT("User has joined"), RGB(90, 160, 90), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
{LPGENT("User has left"), RGB(160, 160, 90), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
{LPGENT("User has disconnected"), RGB(160, 90, 90), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
{LPGENT("User kicked ..."), RGB(100, 100, 100), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
{LPGENT("User is now known as ..."), RGB(90, 90, 160), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
{LPGENT("Notice from user"), RGB(160, 130, 60), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
{LPGENT("Incoming message"), RGB(90, 90, 90), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
{LPGENT("Outgoing message"), RGB(90, 90, 90), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
{LPGENT("The topic is ..."), RGB(70, 70, 160), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
{LPGENT("Information messages"), RGB(130, 130, 195), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
{LPGENT("User enables status for ..."), RGB(70, 150, 70), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
{LPGENT("User disables status for ..."), RGB(150, 70, 70), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
{LPGENT("Action message"), RGB(160, 90, 160), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
{LPGENT("Highlighted message"), RGB(180, 150, 80), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
{LPGENT("Chat log symbols (Webdings)"), RGB(170, 170, 170), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
{LPGENT("User list members (Online)"), RGB(0, 0, 0), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
{LPGENT("User list members (away)"), RGB(170, 170, 170), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
};
const int msgDlgFontCount = SIZEOF(CHAT_fontOptionsList);
static FontOptionsList IM_fontOptionsList[] = {
{LPGENT(">> Outgoing messages"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
{LPGENT(">> Outgoing misc events"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
{LPGENT("<< Incoming messages"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
{LPGENT("<< Incoming misc events"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
{LPGENT(">> Outgoing name"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, FONTF_BOLD, -12},
{LPGENT(">> Outgoing timestamp"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, FONTF_BOLD, -12},
{LPGENT("<< Incoming name"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, FONTF_BOLD, -12},
{LPGENT("<< Incoming timestamp"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, FONTF_BOLD, -12},
{LPGENT(">> Outgoing messages (old)"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
{LPGENT(">> Outgoing misc events (old)"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
{LPGENT("<< Incoming messages (old)"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
{LPGENT("<< Incoming misc events (old)"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
{LPGENT(">> Outgoing name (old)"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, FONTF_BOLD, -12},
{LPGENT(">> Outgoing timestamp (old)"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, FONTF_BOLD, -12},
{LPGENT("<< Incoming name (old)"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, FONTF_BOLD, -12},
{LPGENT("<< Incoming timestamp (old)"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, FONTF_BOLD, -12},
{LPGENT("* Message Input Area"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
{LPGENT("* Status changes"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
{LPGENT("* Dividers"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
{LPGENT("* Error and warning Messages"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
{LPGENT("* Symbols (incoming)"), RGB(50, 50, 50), _T("Webdings"), SYMBOL_CHARSET, 0, -12},
{LPGENT("* Symbols (outgoing)"), RGB(50, 50, 50), _T("Webdings"), SYMBOL_CHARSET, 0, -12},
};
static FontOptionsList IP_fontOptionsList[] = {
{LPGENT("Nickname"), RGB(0, 0, 0), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
{LPGENT("UIN"), RGB(0, 0, 0), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
{LPGENT("Status"), RGB(0, 0, 0), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
{LPGENT("Protocol"), RGB(0, 0, 0), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
{LPGENT("Contacts local time"), RGB(0, 0, 0), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
{LPGENT("Window caption (skinned mode)"), RGB(255, 255, 255), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
};
static FontOptionsList *fontOptionsList = IM_fontOptionsList;
static int fontCount = MSGDLGFONTCOUNT;
struct branch_t {
TCHAR* szDescr;
char* szDBName;
int iMode;
BYTE bDefault;
HTREEITEM hItem;
};
static branch_t branch1[] = {
{LPGENT("Open new chat rooms in the default container"), "DefaultContainer", 0, 1, NULL},
{LPGENT("Flash window when someone speaks"), "FlashWindow", 0, 0, NULL},
{LPGENT("Flash window when a word is highlighted"), "FlashWindowHighlight", 0, 1, NULL},
//TODO Fix for 3.0 !!!
#if !defined(__DELAYED_FOR_3_1)
{LPGENT("Create tabs or windows for highlight events"), "CreateWindowOnHighlight", 0,0, NULL},
{LPGENT("Activate chat window on highlight"), "AnnoyingHighlight", 0,0, NULL},
#endif
{LPGENT("Show list of users in the chat room"), "ShowNicklist", 0, 1, NULL},
{LPGENT("Colorize nicknames in member list"), "ColorizeNicks", 0, 1, NULL},
{LPGENT("Show button menus when right clicking the buttons"), "RightClickFilter", 0, 1, NULL},
{LPGENT("Show topic as status message on the contact list"), "TopicOnClist", 0, 1, NULL},
{LPGENT("Do not pop up the window when joining a chat room"), "PopupOnJoin", 0, 0, NULL},
{LPGENT("Hide or show the window by double click in the contact list"), "ToggleVisibility", 0, 0, NULL},
{LPGENT("Sync splitter position with standard IM sessions"), "SyncSplitter", 0, 0, NULL},
{LPGENT("Show contact's status modes if supported by the protocol"), "ShowContactStatus", 0, 1, NULL},
{LPGENT("Display contact's status icon before user role icon"), "ContactStatusFirst", 0, 0, NULL},
//MAD: simple customization improvement
{LPGENT("Use IRC style status indicators in the user list"), "ClassicIndicators", 0, 0, NULL},
{LPGENT("Use alternative sorting method in member list"), "AlternativeSorting", 0, 1, NULL},
};
static branch_t branch2[] = {
{LPGENT("Prefix all events with a timestamp"), "ShowTimeStamp", 0, 1, NULL},
{LPGENT("Timestamp only when event time differs"), "ShowTimeStampIfChanged", 0, 0, NULL},
{LPGENT("Timestamp has same color as the event"), "TimeStampEventColour", 0, 0, NULL},
{LPGENT("Indent the second line of a message"), "LogIndentEnabled", 0, 1, NULL},
{LPGENT("Limit user names in the message log to 20 characters"), "LogLimitNames", 0, 1, NULL},
{LPGENT("Add a colon (:) to auto-completed user names"), "AddColonToAutoComplete", 0, 1, NULL},
{LPGENT("Start private conversation on doubleclick in nick list (insert nick if unchecked)"), "DoubleClick4Privat", 0, 0, NULL},
{LPGENT("Strip colors from messages in the log"), "StripFormatting", 0, 0, NULL},
{LPGENT("Enable the \'event filter\' for new rooms"), "FilterEnabled", 0, 0, NULL},
//MAD: simple customization improvement
{LPGENT("Use IRC style status indicators in the log"), "LogClassicIndicators", 0,0, NULL},
//
{LPGENT("Allow clickable user names in the message log"), "ClickableNicks", 0, 1, NULL},
{LPGENT("Colorize user names in message log"), "ColorizeNicksInLog", 0, 1, NULL},
{LPGENT("Scale down icons to 10x10 pixels in the chat log"), "ScaleIcons", 0, 1, NULL},
{LPGENT("Place a separator in the log after a window lost its foreground status"), "UseDividers", 0, 1, NULL},
{LPGENT("Only place a separator when an incoming event is announced with a popup"), "DividersUsePopupConfig", 0, 1, NULL},
{LPGENT("Support the math module plugin"), "MathModSupport", 0, 0, NULL}
};
static HWND hPathTip = 0;
void LoadMsgDlgFont(int section, int i, LOGFONT *lf, COLORREF* colour, char *szMod)
{
char str[32];
int style;
DBVARIANT dbv;
int j = (i >= 100 ? i - 100 : i);
FontOptionsList *fol = fontOptionsList;
switch (section) {
case FONTSECTION_CHAT: fol = CHAT_fontOptionsList; break;
case FONTSECTION_IM: fol = IM_fontOptionsList; break;
case FONTSECTION_IP: fol = IP_fontOptionsList; break;
}
if (colour) {
mir_snprintf(str, SIZEOF(str), "Font%dCol", i);
*colour = M.GetDword(szMod, str, fol[j].defColour);
}
if (lf) {
mir_snprintf(str, SIZEOF(str), "Font%dSize", i);
lf->lfHeight = (char) M.GetByte(szMod, str, fol[j].defSize);
lf->lfWidth = 0;
lf->lfEscapement = 0;
lf->lfOrientation = 0;
mir_snprintf(str, SIZEOF(str), "Font%dSty", i);
style = M.GetByte(szMod, str, fol[j].defStyle);
if (i == MSGFONTID_MESSAGEAREA && section == FONTSECTION_IM && M.GetByte("inputFontFix", 1) == 1) {
lf->lfWeight = FW_NORMAL;
lf->lfItalic = 0;
lf->lfUnderline = 0;
lf->lfStrikeOut = 0;
}
else {
lf->lfWeight = style & FONTF_BOLD ? FW_BOLD : FW_NORMAL;
lf->lfItalic = style & FONTF_ITALIC ? 1 : 0;
lf->lfUnderline = style & FONTF_UNDERLINE ? 1 : 0;
lf->lfStrikeOut = style & FONTF_STRIKEOUT ? 1 : 0;
}
mir_snprintf(str, SIZEOF(str), "Font%dSet", i);
lf->lfCharSet = M.GetByte(szMod, str, fol[j].defCharset);
lf->lfOutPrecision = OUT_DEFAULT_PRECIS;
lf->lfClipPrecision = CLIP_DEFAULT_PRECIS;
lf->lfQuality = DEFAULT_QUALITY;
lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
mir_snprintf(str, SIZEOF(str), "Font%d", i);
if ((i == 17 && !strcmp(szMod, CHAT_FONTMODULE)) || ((i == 20 || i == 21) && !strcmp(szMod, FONTMODULE))) {
lf->lfCharSet = SYMBOL_CHARSET;
lstrcpyn(lf->lfFaceName, _T("Webdings"), SIZEOF(lf->lfFaceName));
} else {
if (db_get_ts(NULL, szMod, str, &dbv)) {
lstrcpy(lf->lfFaceName, fol[j].szDefFace);
} else {
lstrcpyn(lf->lfFaceName, dbv.ptszVal, SIZEOF(lf->lfFaceName));
db_free(&dbv);
}
}
}
}
static HTREEITEM InsertBranch(HWND hwndTree, TCHAR* pszDescr, BOOL bExpanded)
{
TVINSERTSTRUCT tvis;
tvis.hParent = NULL;
tvis.hInsertAfter = TVI_LAST;
tvis.item.mask = TVIF_TEXT | TVIF_STATE;
tvis.item.pszText = TranslateTS(pszDescr);
tvis.item.stateMask = (bExpanded ? TVIS_STATEIMAGEMASK | TVIS_EXPANDED : TVIS_STATEIMAGEMASK) | TVIS_BOLD;
tvis.item.state = (bExpanded ? INDEXTOSTATEIMAGEMASK(0) | TVIS_EXPANDED : INDEXTOSTATEIMAGEMASK(0)) | TVIS_BOLD;
return TreeView_InsertItem(hwndTree, &tvis);
}
static void FillBranch(HWND hwndTree, HTREEITEM hParent, branch_t *branch, int nValues, DWORD defaultval)
{
if (hParent == 0)
return;
TVINSERTSTRUCT tvis;
int iState;
tvis.hParent = hParent;
tvis.hInsertAfter = TVI_LAST;
tvis.item.mask = TVIF_TEXT | TVIF_STATE;
for (int i=0;i < nValues;i++) {
tvis.item.pszText = TranslateTS(branch[i].szDescr);
tvis.item.stateMask = TVIS_STATEIMAGEMASK;
if (branch[i].iMode)
iState = ((M.GetDword("Chat", branch[i].szDBName, defaultval) & branch[i].iMode) & branch[i].iMode) != 0 ? 3 : 2;
else
iState = M.GetByte("Chat", branch[i].szDBName, branch[i].bDefault) != 0 ? 3 : 2;
tvis.item.state = INDEXTOSTATEIMAGEMASK(iState);
branch[i].hItem = TreeView_InsertItem(hwndTree, &tvis);
}
}
static void SaveBranch(HWND hwndTree, branch_t *branch, int nValues)
{
TVITEM tvi;
BYTE bChecked;
int iState = 0;
tvi.mask = TVIF_HANDLE | TVIF_STATE;
for (int i=0;i < nValues;i++) {
tvi.hItem = branch[i].hItem;
TreeView_GetItem(hwndTree, &tvi);
bChecked = ((tvi.state & TVIS_STATEIMAGEMASK) >> 12 == 2) ? 0 : 1;
if (branch[i].iMode) {
if (bChecked)
iState |= branch[i].iMode;
if (iState & GC_EVENT_ADDSTATUS)
iState |= GC_EVENT_REMOVESTATUS;
db_set_dw(0, "Chat", branch[i].szDBName, (DWORD)iState);
} else db_set_b(0, "Chat", branch[i].szDBName, bChecked);
}
}
static void CheckHeading(HWND hwndTree, HTREEITEM hHeading)
{
if (hHeading == 0)
return;
BOOL bChecked = TRUE;
TVITEM tvi;
tvi.mask = TVIF_HANDLE | TVIF_STATE;
tvi.hItem = TreeView_GetNextItem(hwndTree, hHeading, TVGN_CHILD);
while (tvi.hItem && bChecked) {
if (tvi.hItem != branch1[0].hItem && tvi.hItem != branch1[1].hItem) {
TreeView_GetItem(hwndTree, &tvi);
if (((tvi.state&TVIS_STATEIMAGEMASK) >> 12 == 2))
bChecked = FALSE;
}
tvi.hItem = TreeView_GetNextSibling(hwndTree, tvi.hItem);
}
tvi.stateMask = TVIS_STATEIMAGEMASK;
tvi.state = INDEXTOSTATEIMAGEMASK(1); //bChecked ? 3 : 2);
tvi.hItem = hHeading;
TreeView_SetItem(hwndTree, &tvi);
}
static void CheckBranches(HWND hwndTree, HTREEITEM hHeading)
{
if (hHeading == 0)
return;
BOOL bChecked = TRUE;
TVITEM tvi;
tvi.mask = TVIF_HANDLE | TVIF_STATE;
tvi.hItem = hHeading;
TreeView_GetItem(hwndTree, &tvi);
if (((tvi.state&TVIS_STATEIMAGEMASK) >> 12 == 3)||((tvi.state & TVIS_STATEIMAGEMASK) >> 12 == 1))
bChecked = FALSE;
tvi.stateMask = TVIS_STATEIMAGEMASK;
tvi.state = INDEXTOSTATEIMAGEMASK(bChecked ? 2 : 1);
TreeView_SetItem(hwndTree, &tvi);
tvi.hItem = TreeView_GetNextItem(hwndTree, hHeading, TVGN_CHILD);
while (tvi.hItem) {
tvi.state = INDEXTOSTATEIMAGEMASK(bChecked ? 3:2);
if (tvi.hItem != branch1[0].hItem && tvi.hItem != branch1[1].hItem)
TreeView_SetItem(hwndTree, &tvi);
tvi.hItem = TreeView_GetNextSibling(hwndTree, tvi.hItem);
}
}
static INT CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lp, LPARAM pData)
{
char szDir[MAX_PATH];
switch (uMsg) {
case BFFM_INITIALIZED:
SendMessage(hwnd, BFFM_SETSELECTION, TRUE, (LPARAM)M.getUserDir());
break;
case BFFM_SELCHANGED:
if (SHGetPathFromIDListA((LPITEMIDLIST) lp , szDir))
SendMessage(hwnd, BFFM_SETSTATUSTEXT, 0, (LPARAM)szDir);
break;
}
return 0;
}
static void LoadLogFonts(void)
{
for (int i=0; i < OPTIONS_FONTCOUNT; i++)
LoadMsgDlgFont(FONTSECTION_CHAT, i, &aFonts[i].lf, &aFonts[i].color, CHAT_FONTMODULE);
}
static IconItem _icons[] =
{
{ LPGEN("Window Icon"), "chat_window", IDI_CHANMGR },
{ LPGEN("Icon overlay"), "chat_overlay", IDI_OVERLAY },
{ LPGEN("Status 1 (10x10)"), "chat_status0", IDI_STATUS0 },
{ LPGEN("Status 2 (10x10)"), "chat_status1", IDI_STATUS1 },
{ LPGEN("Status 3 (10x10)"), "chat_status2", IDI_STATUS2 },
{ LPGEN("Status 4 (10x10)"), "chat_status3", IDI_STATUS3 },
{ LPGEN("Status 5 (10x10)"), "chat_status4", IDI_STATUS4 },
{ LPGEN("Status 6 (10x10)"), "chat_status5", IDI_STATUS5 }
};
static IconItem _logicons[] =
{
{ LPGEN("Message in (10x10)"), "chat_log_message_in", IDI_MESSAGE },
{ LPGEN("Message out (10x10)"), "chat_log_message_out", IDI_MESSAGEOUT },
{ LPGEN("Action (10x10)"), "chat_log_action", IDI_ACTION },
{ LPGEN("Add Status (10x10)"), "chat_log_addstatus", IDI_ADDSTATUS },
{ LPGEN("Remove Status (10x10)"), "chat_log_removestatus", IDI_REMSTATUS },
{ LPGEN("Join (10x10)"), "chat_log_join", IDI_JOIN },
{ LPGEN("Leave (10x10)"), "chat_log_part", IDI_PART },
{ LPGEN("Quit (10x10)"), "chat_log_quit", IDI_QUIT },
{ LPGEN("Kick (10x10)"), "chat_log_kick", IDI_KICK },
{ LPGEN("Notice (10x10)"), "chat_log_notice", IDI_NOTICE },
{ LPGEN("Nickchange (10x10)"), "chat_log_nick", IDI_NICK },
{ LPGEN("Topic (10x10)"), "chat_log_topic", IDI_TOPIC },
{ LPGEN("Highlight (10x10)"), "chat_log_highlight", IDI_HIGHLIGHT },
{ LPGEN("Information (10x10)"), "chat_log_info", IDI_INFO }
};
// add icons to the skinning module
void Chat_AddIcons(void)
{
Icon_Register(g_hIconDLL, LPGEN("Message Sessions")"/"LPGEN("Group chat windows"), _icons, SIZEOF(_icons));
Icon_Register(g_hIconDLL, LPGEN("Message Sessions")"/"LPGEN("Group chat log"), _logicons, SIZEOF(_logicons));
}
/*
* get icon by name from the core icon library service
*/
HICON LoadIconEx(int iIndex, char * pszIcoLibName, int iX, int iY)
{
char szTemp[256];
mir_snprintf(szTemp, sizeof(szTemp), "chat_%s", pszIcoLibName);
return Skin_GetIcon(szTemp);
}
static void InitSetting(TCHAR* &ppPointer, const char *pszSetting, const TCHAR *pszDefault)
{
ptrT val( db_get_tsa(NULL, "Chat", pszSetting));
replaceStrT(ppPointer, (val != NULL) ? val : pszDefault);
}
#define OPT_FIXHEADINGS (WM_USER+1)
static UINT _o1controls[] = {IDC_CHECKBOXES, IDC_GROUP, IDC_STATIC_ADD};
HWND CreateToolTip(HWND hwndParent, LPTSTR ptszText, LPTSTR ptszTitle)
{
HWND hwndTT = CreateWindowEx(WS_EX_TOPMOST,
TOOLTIPS_CLASS, NULL,
WS_POPUP | TTS_NOPREFIX,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
hwndParent, NULL, g_hInst, NULL);
SetWindowPos(hwndTT, HWND_TOPMOST, 0, 0, 0, 0,
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
TOOLINFO ti = { 0 };
ti.cbSize = sizeof(TOOLINFO);
ti.uFlags = TTF_SUBCLASS | TTF_CENTERTIP;
ti.hwnd = hwndParent;
ti.hinst = g_hInst;
ti.lpszText = ptszText;
GetClientRect (hwndParent, &ti.rect);
ti.rect.left = -65;
SendMessage(hwndTT, TTM_ADDTOOL, 0, (LPARAM)(LPTOOLINFO) &ti);
SendMessage(hwndTT, TTM_SETTITLE, 1, (LPARAM)ptszTitle);
SendMessage(hwndTT, TTM_SETMAXTIPWIDTH, 0, (LPARAM)640);
return hwndTT;
}
INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
static HTREEITEM hListHeading1 = 0;
static HTREEITEM hListHeading2 = 0;
switch (uMsg) {
case WM_INITDIALOG:
{
TranslateDialogDefault(hwndDlg);
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHECKBOXES), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHECKBOXES), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES);
HIMAGELIST himlOptions = (HIMAGELIST)SendDlgItemMessage(hwndDlg, IDC_CHECKBOXES, TVM_SETIMAGELIST, TVSIL_STATE, (LPARAM)CreateStateImageList());
ImageList_Destroy(himlOptions);
hListHeading1 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), TranslateT("Appearance and functionality of chat room windows"), TRUE);
hListHeading2 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), TranslateT("Appearance of the message log"), TRUE);
FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading1, branch1, SIZEOF(branch1), 0x0000);
FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading2, branch2, SIZEOF(branch2), 0x0000);
TCHAR* pszGroup = NULL;
InitSetting(pszGroup, "AddToGroup", _T("Chat rooms"));
SetWindowText(GetDlgItem(hwndDlg, IDC_GROUP), pszGroup);
mir_free(pszGroup);
Utils::showDlgControl(hwndDlg, IDC_STATIC_MESSAGE, SW_HIDE);
}
break;
case WM_COMMAND:
if ((LOWORD(wParam) == IDC_GROUP) && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()))
return 0;
if (lParam != 0)
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
case WM_NOTIFY:
switch (((LPNMHDR)lParam)->idFrom) {
case IDC_CHECKBOXES:
if (((LPNMHDR)lParam)->code == NM_CLICK || (((LPNMHDR)lParam)->code == TVN_KEYDOWN && ((LPNMTVKEYDOWN)lParam)->wVKey == VK_SPACE)) {
TVHITTESTINFO hti;
hti.pt.x = (short)LOWORD(GetMessagePos());
hti.pt.y = (short)HIWORD(GetMessagePos());
ScreenToClient(((LPNMHDR)lParam)->hwndFrom, &hti.pt);
if (TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &hti) || ((LPNMHDR)lParam)->code == TVN_KEYDOWN) {
if (((LPNMHDR)lParam)->code == TVN_KEYDOWN)
hti.flags |= TVHT_ONITEMSTATEICON;
if (hti.flags&TVHT_ONITEMSTATEICON) {
TVITEM tvi = {0};
tvi.mask = TVIF_HANDLE | TVIF_STATE;
tvi.stateMask = TVIS_STATEIMAGEMASK | TVIS_BOLD;
if (((LPNMHDR)lParam)->code == TVN_KEYDOWN)
tvi.hItem = TreeView_GetSelection(((LPNMHDR)lParam)->hwndFrom);
else
tvi.hItem = (HTREEITEM)hti.hItem;
TreeView_GetItem(((LPNMHDR)lParam)->hwndFrom, &tvi);
if (tvi.state & TVIS_BOLD && hti.flags & TVHT_ONITEMSTATEICON) {
tvi.state = INDEXTOSTATEIMAGEMASK(0) | TVIS_BOLD;
SendDlgItemMessageA(hwndDlg, IDC_CHECKBOXES, TVM_SETITEMA, 0, (LPARAM)&tvi);
} else if (hti.flags&TVHT_ONITEMSTATEICON) {
if (((tvi.state & TVIS_STATEIMAGEMASK) >> 12) == 3) {
tvi.state = INDEXTOSTATEIMAGEMASK(1);
SendDlgItemMessageA(hwndDlg, IDC_CHECKBOXES, TVM_SETITEMA, 0, (LPARAM)&tvi);
}
}
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
}
}
break;
case 0:
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
{
int iLen;
TCHAR *pszText = NULL;
BYTE b;
iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_GROUP));
if (iLen > 0) {
pszText = (TCHAR*)mir_realloc(pszText, (iLen + 2) * sizeof(TCHAR));
GetDlgItemText(hwndDlg, IDC_GROUP, pszText, iLen + 1);
db_set_ts(NULL, "Chat", "AddToGroup", pszText);
} else
db_set_ts(NULL, "Chat", "AddToGroup", _T(""));
g_Settings.hGroup = 0;
mir_free(pszText);
b = M.GetByte("Chat", "Tabs", 1);
SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch1, SIZEOF(branch1));
SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch2, SIZEOF(branch2));
LoadGlobalSettings();
MM_FontsChanged();
FreeMsgLogBitmaps();
LoadMsgLogBitmaps();
SM_BroadcastMessage(NULL, GC_SETWNDPROPS, 0, 0, TRUE);
SM_ReconfigureFilters();
}
return TRUE;
}
}
break;
case WM_DESTROY:
BYTE b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading1, TVIS_EXPANDED) & TVIS_EXPANDED ? 1 : 0;
db_set_b(0, "Chat", "Branch1Exp", b);
b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading2, TVIS_EXPANDED) & TVIS_EXPANDED ? 1 : 0;
db_set_b(0, "Chat", "Branch2Exp", b);
}
return FALSE;
}
static TCHAR* chatcolorsnames[] ={
// LPGENT("Your nickname"),
LPGENT("Channel operators"),
LPGENT("Half operators"),
LPGENT("Voiced"),
// LPGENT("Others nicknames"),
LPGENT("Extended mode 1"),
LPGENT("Extended mode 2"),
LPGENT("Selection background"),
LPGENT("Selected text"),
LPGENT("Incremental search highlight")
};
void RegisterFontServiceFonts() {
char szTemp[100];
LOGFONT lf;
FontIDT fid = {0};
ColourIDT cid = {0};
fid.cbSize = sizeof(FontIDT);
cid.cbSize = sizeof(ColourIDT);
strncpy(fid.dbSettingsGroup, FONTMODULE, SIZEOF(fid.dbSettingsGroup));
for (int i=0; i < SIZEOF(IM_fontOptionsList); i++) {
fid.flags = FIDF_DEFAULTVALID|FIDF_ALLOWEFFECTS;
LoadMsgDlgFont(FONTSECTION_IM, i , &lf, &fontOptionsList[i].colour, FONTMODULE);
mir_snprintf(szTemp, SIZEOF(szTemp), "Font%d", i);
strncpy(fid.prefix, szTemp, SIZEOF(fid.prefix));
fid.order = i;
_tcsncpy(fid.name, fontOptionsList[i].szDescr, SIZEOF(fid.name));
fid.deffontsettings.colour = fontOptionsList[i].colour;
fid.deffontsettings.size = (char) lf.lfHeight;
fid.deffontsettings.style = (lf.lfWeight >= FW_BOLD ? FONTF_BOLD : 0) | (lf.lfItalic ? FONTF_ITALIC : 0);
fid.deffontsettings.charset = lf.lfCharSet;
fid.flags = fid.flags & ~FIDF_CLASSMASK | (fid.deffontsettings.style&FONTF_BOLD ? FIDF_CLASSHEADER : FIDF_CLASSGENERAL);
_tcsncpy(fid.deffontsettings.szFace, lf.lfFaceName, LF_FACESIZE);
_tcsncpy(fid.backgroundGroup, LPGENT("Message Sessions")_T("/")LPGENT("Single Messaging"), SIZEOF(fid.backgroundGroup));
_tcsncpy(fid.group, LPGENT("Message Sessions")_T("/")LPGENT("Single Messaging"), SIZEOF(fid.group));
switch (i) {
case MSGFONTID_MYMSG:
case 1:
case MSGFONTID_MYNAME:
case MSGFONTID_MYTIME:
case 21:
_tcsncpy(fid.backgroundName, LPGENT("Outgoing background"), SIZEOF(fid.backgroundName));
break;
case 8:
case 9:
case 12:
case 13:
_tcsncpy(fid.backgroundName, LPGENT("Outgoing background(old)"), SIZEOF(fid.backgroundName));
break;
case 10:
case 11:
case 14:
case 15:
_tcsncpy(fid.backgroundName, LPGENT("Incoming background(old)"), SIZEOF(fid.backgroundName));
break;
case MSGFONTID_MESSAGEAREA:
_tcsncpy(fid.group, LPGENT("Message Sessions"), SIZEOF(fid.group));
_tcsncpy(fid.backgroundGroup, LPGENT("Message Sessions"), SIZEOF(fid.backgroundGroup));
_tcsncpy(fid.backgroundName, LPGENT("Input area background"), SIZEOF(fid.backgroundName));
fid.flags |= FIDF_DISABLESTYLES;
fid.flags &= ~FIDF_ALLOWEFFECTS;
break;
case 17:
_tcsncpy(fid.backgroundName, LPGENT("Status background"), SIZEOF(fid.backgroundName));
break;
case 18:
_tcsncpy(fid.backgroundGroup, LPGENT("Message Sessions"), SIZEOF(fid.backgroundGroup));
_tcsncpy(fid.backgroundName, LPGENT("Log background"), SIZEOF(fid.backgroundName));
break;
case 19:
_tcsncpy(fid.backgroundName, _T(""), SIZEOF(fid.backgroundName));
break;
default:
_tcsncpy(fid.backgroundName, LPGENT("Incoming background"), SIZEOF(fid.backgroundName));
break;
}
FontRegisterT(&fid);
}
fontOptionsList = IP_fontOptionsList;
fid.flags = FIDF_DEFAULTVALID|FIDF_ALLOWEFFECTS;
//fid.flags|=FIDF_SAVEPOINTSIZE;
_tcsncpy(fid.group, LPGENT("Message Sessions")_T("/")LPGENT("Info Panel"), SIZEOF(fid.group));
_tcsncpy(fid.backgroundGroup, LPGENT("Message Sessions")_T("/")LPGENT("Info Panel"), SIZEOF(fid.backgroundGroup));
_tcsncpy(fid.backgroundName, LPGENT("Fields background"), SIZEOF(fid.backgroundName));
for (int i=0; i < IPFONTCOUNT; i++) {
LoadMsgDlgFont(FONTSECTION_IP, i + 100 , &lf, &fontOptionsList[i].colour, FONTMODULE);
mir_snprintf(szTemp, SIZEOF(szTemp), "Font%d", i + 100);
strncpy(fid.prefix, szTemp, SIZEOF(fid.prefix));
fid.order = i + 100 ;
_tcsncpy(fid.name, fontOptionsList[i].szDescr, SIZEOF(fid.name));
fid.deffontsettings.colour = fontOptionsList[i].colour;
fid.deffontsettings.size = (char) lf.lfHeight;
fid.deffontsettings.style = (lf.lfWeight >= FW_BOLD ? FONTF_BOLD : 0) | (lf.lfItalic ? FONTF_ITALIC : 0);
fid.deffontsettings.charset = lf.lfCharSet;
fid.flags = fid.flags & ~FIDF_CLASSMASK | (fid.deffontsettings.style&FONTF_BOLD ? FIDF_CLASSHEADER : FIDF_CLASSGENERAL);
fid.deffontsettings.charset = lf.lfCharSet;
_tcsncpy(fid.deffontsettings.szFace, lf.lfFaceName, LF_FACESIZE);
if (i==IPFONTCOUNT-1){
_tcsncpy(fid.backgroundGroup, _T(""), SIZEOF(fid.backgroundGroup));
_tcsncpy(fid.backgroundName, _T(""), SIZEOF(fid.backgroundName));
_tcsncpy(fid.group, LPGENT("Message Sessions"), SIZEOF(fid.group));
}
FontRegisterT(&fid);
}
fontOptionsList = CHAT_fontOptionsList;
fid.flags = FIDF_DEFAULTVALID|FIDF_ALLOWEFFECTS;
fid.flags&=~FIDF_SAVEPOINTSIZE;
_tcsncpy(fid.group, LPGENT("Message Sessions")_T("/")LPGENT("Group Chats"), SIZEOF(fid.group));
strncpy(fid.dbSettingsGroup, CHAT_FONTMODULE, SIZEOF(fid.dbSettingsGroup));
for (int i=0; i < msgDlgFontCount; i++) {
LoadMsgDlgFont(FONTSECTION_CHAT, i , &lf, &fontOptionsList[i].colour, CHAT_FONTMODULE);
mir_snprintf(szTemp, SIZEOF(szTemp), "Font%d", i);
strncpy(fid.prefix, szTemp, SIZEOF(fid.prefix));
fid.order = i;
_tcsncpy(fid.name, fontOptionsList[i].szDescr, SIZEOF(fid.name));
fid.deffontsettings.colour = fontOptionsList[i].colour;
fid.deffontsettings.size = (char) lf.lfHeight;
fid.deffontsettings.style = (lf.lfWeight >= FW_BOLD ? FONTF_BOLD : 0) | (lf.lfItalic ? FONTF_ITALIC : 0);
fid.flags = fid.flags & ~FIDF_CLASSMASK | (fid.deffontsettings.style&FONTF_BOLD ? FIDF_CLASSHEADER : FIDF_CLASSGENERAL);
fid.deffontsettings.charset = lf.lfCharSet;
_tcsncpy(fid.deffontsettings.szFace, lf.lfFaceName, LF_FACESIZE);
_tcsncpy(fid.backgroundGroup, LPGENT("Message Sessions")_T("/")LPGENT("Group Chats"), SIZEOF(fid.backgroundGroup));
_tcsncpy(fid.backgroundName, LPGENT("Group chat log background"), SIZEOF(fid.backgroundName));
if (i == 18 || i == 19)
_tcsncpy(fid.backgroundName, LPGENT("Userlist background"), SIZEOF(fid.backgroundName));
FontRegisterT(&fid);
}
_tcsncpy(cid.group, LPGENT("Message Sessions")_T("/")LPGENT("Group Chats"), SIZEOF(cid.group));
strncpy(cid.dbSettingsGroup, "Chat", SIZEOF(cid.dbSettingsGroup));
for (int i=0; i <= 7; i++) {
mir_snprintf(szTemp, SIZEOF(szTemp), "NickColor%d", i);
_tcsncpy(cid.name, chatcolorsnames[i], SIZEOF(cid.name));
cid.order=i+1;
strncpy(cid.setting, szTemp, SIZEOF(cid.setting));
switch (i) {
case 5:
cid.defcolour = GetSysColor(COLOR_HIGHLIGHT);
break;
case 6:
cid.defcolour = GetSysColor(COLOR_HIGHLIGHTTEXT);
break;
default:
cid.defcolour =RGB(0, 0, 0);
break;
}
ColourRegisterT(&cid);
}
cid.order=8;
_tcsncpy(cid.name, LPGENT("Userlist background"), SIZEOF(cid.name));
strncpy(cid.setting, "ColorNicklistBG", SIZEOF(cid.setting));
cid.defcolour = SRMSGDEFSET_BKGCOLOUR;
ColourRegisterT(&cid);
/*
* static colors (info panel, tool bar background etc...)
*/
strncpy(fid.dbSettingsGroup, FONTMODULE, SIZEOF(fid.dbSettingsGroup));
strncpy(cid.dbSettingsGroup, FONTMODULE, SIZEOF(fid.dbSettingsGroup));
for (int i=0; i < SIZEOF(_clrs); i++) {
cid.order = _clrs[i].order;
_tcsncpy(cid.group, _clrs[i].tszGroup, SIZEOF(fid.group));
_tcsncpy(cid.name, _clrs[i].tszName, SIZEOF(cid.name));
strncpy(cid.setting, _clrs[i].szSetting, SIZEOF(cid.setting));
if (_clrs[i].def & 0xff000000)
cid.defcolour = GetSysColor(_clrs[i].def & 0x000000ff);
else
cid.defcolour = _clrs[i].def;
ColourRegisterT(&cid);
}
strncpy(cid.dbSettingsGroup, SRMSGMOD_T, SIZEOF(fid.dbSettingsGroup));
/*
* text and background colors for tabs
*/
for (int i=0; i < SIZEOF(_tabclrs); i++) {
cid.order = _tabclrs[i].order;
_tcsncpy(cid.group, _tabclrs[i].tszGroup, SIZEOF(fid.group));
_tcsncpy(cid.name, _tabclrs[i].tszName, SIZEOF(cid.name));
strncpy(cid.setting, _tabclrs[i].szSetting, SIZEOF(cid.setting));
if (_tabclrs[i].def & 0xff000000)
cid.defcolour = GetSysColor(_tabclrs[i].def & 0x000000ff);
else
cid.defcolour = _tabclrs[i].def;
ColourRegisterT(&cid);
}
}
int FontServiceFontsChanged(WPARAM,LPARAM)
{
LoadLogFonts();
FreeMsgLogBitmaps();
LoadMsgLogBitmaps();
LOGFONT lf;
LoadMsgDlgFont(FONTSECTION_CHAT, 0, &lf, NULL, CHAT_FONTMODULE);
HFONT hFont = CreateFontIndirect(&lf);
int iText = GetTextPixelSize(MakeTimeStamp(g_Settings.pszTimeStamp, time(NULL)), hFont, true);
DeleteObject(hFont);
g_Settings.LogTextIndent = iText;
g_Settings.LogTextIndent = g_Settings.LogTextIndent * 12 / 10;
g_Settings.bLogIndentEnabled = M.GetBool("Chat", "LogIndentEnabled", true);
LoadGlobalSettings();
MM_FontsChanged();
MM_FixColors();
SM_BroadcastMessage(NULL, GC_SETWNDPROPS, 0, 0, TRUE);
PluginConfig.reloadSettings();
CSkin::initAeroEffect();
CacheMsgLogIcons();
CacheLogFonts();
FreeTabConfig();
ReloadTabConfig();
Skin->setupAeroSkins();
M.BroadcastMessage(DM_OPTIONSAPPLIED, 1, 0);
return 0;
}
static UINT _o2chatcontrols[] = { IDC_CHAT_SPIN2, IDC_LIMIT, IDC_CHAT_SPIN4, IDC_LOGTIMESTAMP, IDC_TIMESTAMP,
IDC_OUTSTAMP, IDC_FONTCHOOSE, IDC_LOGGING, IDC_LOGDIRECTORY, IDC_INSTAMP, IDC_CHAT_SPIN2, IDC_CHAT_SPIN3, IDC_NICKROW2, IDC_LOGLIMIT,
IDC_STATIC110, IDC_STATIC112, 0};
static UINT _o3chatcontrols[] = {0};
INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
{
SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN2, UDM_SETRANGE, 0, MAKELONG(5000, 0));
SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN2, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, "Chat", "LogLimit", 100), 0));
SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN3, UDM_SETRANGE, 0, MAKELONG(255, 10));
SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN3, UDM_SETPOS, 0, MAKELONG(M.GetByte("Chat", "NicklistRowDist", 12), 0));
SetDlgItemText(hwndDlg, IDC_LOGTIMESTAMP, g_Settings.pszTimeStampLog);
SetDlgItemText(hwndDlg, IDC_TIMESTAMP, g_Settings.pszTimeStamp);
SetDlgItemText(hwndDlg, IDC_OUTSTAMP, g_Settings.pszOutgoingNick);
SetDlgItemText(hwndDlg, IDC_INSTAMP, g_Settings.pszIncomingNick);
CheckDlgButton(hwndDlg, IDC_LOGGING, g_Settings.bLoggingEnabled);
SetDlgItemText(hwndDlg, IDC_LOGDIRECTORY, g_Settings.pszLogDir);
Utils::enableDlgControl(hwndDlg, IDC_LOGDIRECTORY, g_Settings.bLoggingEnabled);
Utils::enableDlgControl(hwndDlg, IDC_FONTCHOOSE, g_Settings.bLoggingEnabled);
SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN4, UDM_SETRANGE, 0, MAKELONG(10000, 0));
SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN4, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, "Chat", "LoggingLimit", 100), 0));
Utils::enableDlgControl(hwndDlg, IDC_LIMIT, g_Settings.bLoggingEnabled);
if (ServiceExists(MS_UTILS_REPLACEVARS)) {
TCHAR tszTooltipText[2048];
mir_sntprintf(tszTooltipText, SIZEOF(tszTooltipText),
_T("%s - %s\n%s - %s\n%s - %s\n\n")
_T("%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n\n")
_T("%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s"),
// contact vars
_T("%nick%"), TranslateT("nick of current contact (if defined)"),
_T("%proto%"), TranslateT("protocol name of current contact (if defined). Account name is used when protocol supports multiaccounts"),
_T("%userid%"), TranslateT("User ID of current contact (if defined). It is like UIN Number for ICQ, JID for Jabber, etc."),
// global vars
_T("%miranda_path%"), TranslateT("path to root miranda folder"),
_T("%miranda_profile%"), TranslateT("path to current miranda profile"),
_T("%miranda_profilename%"), TranslateT("name of current miranda profile (filename, without extension)"),
_T("%miranda_userdata%"), TranslateT("will return parsed string %miranda_profile%\\Profiles\\%miranda_profilename%"),
_T("%miranda_logpath%"), TranslateT("will return parsed string %miranda_userdata%\\Logs"),
_T("%appdata%"), TranslateT("same as environment variable %APPDATA% for currently logged-on Windows user"),
_T("%username%"), TranslateT("username for currently logged-on Windows user"),
_T("%mydocuments%"), TranslateT("\"My Documents\" folder for currently logged-on Windows user"),
_T("%desktop%"), TranslateT("\"Desktop\" folder for currently logged-on Windows user"),
_T("%xxxxxxx%"), TranslateT("any environment variable defined in current Windows session (like %systemroot%, %allusersprofile%, etc.)"),
// date/time vars
_T("%d%"), TranslateT("day of month, 1-31"),
_T("%dd%"), TranslateT("day of month, 01-31"),
_T("%m%"), TranslateT("month number, 1-12"),
_T("%mm%"), TranslateT("month number, 01-12"),
_T("%mon%"), TranslateT("abbreviated month name"),
_T("%month%"), TranslateT("full month name"),
_T("%yy%"), TranslateT("year without century, 01-99"),
_T("%yyyy%"), TranslateT("year with century, 1901-9999"),
_T("%wday%"), TranslateT("abbreviated weekday name"),
_T("%weekday%"), TranslateT("full weekday name"));
hPathTip = CreateToolTip(GetDlgItem(hwndDlg, IDC_LOGDIRECTORY), tszTooltipText, TranslateT("Variables"));
}
}
if (hPathTip)
SetTimer(hwndDlg, 0, 3000, NULL);
break;
case WM_COMMAND:
if ((LOWORD(wParam) == IDC_INSTAMP
|| LOWORD(wParam) == IDC_OUTSTAMP
|| LOWORD(wParam) == IDC_TIMESTAMP
|| LOWORD(wParam) == IDC_LOGLIMIT
|| LOWORD(wParam) == IDC_NICKROW2
|| LOWORD(wParam) == IDC_LOGDIRECTORY
|| LOWORD(wParam) == IDC_LIMIT
|| LOWORD(wParam) == IDC_LOGTIMESTAMP)
&& (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())) return 0;
switch (LOWORD(wParam)) {
/*
* open the base directory for MUC logs, using a standard file selector
* dialog. Simply allows the user to view what log files are there
* and possibly delete archived logs.
*/
case IDC_MUC_OPENLOGBASEDIR: {
OPENFILENAME ofn = {0};
SESSION_INFO si = {0};
TCHAR tszReturnName[MAX_PATH];
TCHAR tszInitialDir[_MAX_DRIVE + _MAX_PATH + 10];
TCHAR tszTemp[MAX_PATH + 20], *p = 0, *p1 = 0;
mir_sntprintf(tszTemp, MAX_PATH + 20, _T("%s"), g_Settings.pszLogDir);
p = tszTemp;
while(*p && (*p == '\\' || *p == '.'))
p++;
if (*p) {
if ((p1 = _tcschr(p, '\\')))
*p1 = 0;
}
mir_sntprintf(tszInitialDir, MAX_PATH, _T("%s%s"), M.getChatLogPath(), p);
if (PathFileExists(tszInitialDir))
ofn.lpstrInitialDir = tszInitialDir;
else {
mir_sntprintf(tszInitialDir, MAX_PATH, _T("%s"), M.getChatLogPath());
ofn.lpstrInitialDir = tszInitialDir;
}
tszReturnName[0] = 0;
mir_sntprintf(tszTemp, SIZEOF(tszTemp), _T("%s%c*.*%c%c"), TranslateT("All Files"), 0, 0, 0);
ofn.lpstrFilter = tszTemp;
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.hwndOwner = 0;
ofn.lpstrFile = tszReturnName;
ofn.nMaxFile = MAX_PATH;
ofn.nMaxFileTitle = MAX_PATH;
ofn.Flags = OFN_HIDEREADONLY | OFN_DONTADDTORECENT;
ofn.lpstrDefExt = _T("log");
GetOpenFileName(&ofn);
break;
}
case IDC_FONTCHOOSE: {
TCHAR tszDirectory[MAX_PATH];
LPITEMIDLIST idList;
LPMALLOC psMalloc;
BROWSEINFO bi = {0};
if (SUCCEEDED(CoGetMalloc(1, &psMalloc))) {
TCHAR tszTemp[MAX_PATH];
bi.hwndOwner = hwndDlg;
bi.pszDisplayName = tszDirectory;
bi.lpszTitle = TranslateT("Select Folder");
bi.ulFlags = BIF_NEWDIALOGSTYLE | BIF_EDITBOX | BIF_RETURNONLYFSDIRS;
bi.lpfn = BrowseCallbackProc;
bi.lParam = (LPARAM)tszDirectory;
idList = SHBrowseForFolder(&bi);
if (idList) {
const TCHAR *szUserDir = M.getUserDir();
SHGetPathFromIDList(idList, tszDirectory);
lstrcat(tszDirectory, _T("\\"));
M.pathToRelative(tszDirectory, tszTemp, const_cast<TCHAR *>(szUserDir));
SetWindowText(GetDlgItem(hwndDlg, IDC_LOGDIRECTORY), lstrlen(tszTemp) > 1 ? tszTemp : DEFLOGFILENAME);
}
psMalloc->Free(idList);
psMalloc->Release();
}
break;
}
case IDC_LOGGING:
Utils::enableDlgControl(hwndDlg, IDC_LOGDIRECTORY, IsDlgButtonChecked(hwndDlg, IDC_LOGGING) == BST_CHECKED ? TRUE : FALSE);
Utils::enableDlgControl(hwndDlg, IDC_FONTCHOOSE, IsDlgButtonChecked(hwndDlg, IDC_LOGGING) == BST_CHECKED ? TRUE : FALSE);
Utils::enableDlgControl(hwndDlg, IDC_LIMIT, IsDlgButtonChecked(hwndDlg, IDC_LOGGING) == BST_CHECKED ? TRUE : FALSE);
break;
}
if (lParam != 0)
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
case WM_NOTIFY:
if (((LPNMHDR)lParam)->idFrom == 0 && ((LPNMHDR)lParam)->code == PSN_APPLY) {
TCHAR *p2 = NULL;
char *pszText = NULL;
TCHAR *ptszPath = NULL;
int iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_LOGDIRECTORY));
if (iLen > 0) {
TCHAR *pszText1 = (TCHAR*)mir_alloc(iLen*sizeof(TCHAR) + 2);
GetDlgItemText(hwndDlg, IDC_LOGDIRECTORY, pszText1, iLen + 1);
db_set_ts(NULL, "Chat", "LogDirectory", pszText1);
mir_free(pszText1);
g_Settings.bLoggingEnabled = IsDlgButtonChecked(hwndDlg, IDC_LOGGING) == BST_CHECKED;
db_set_b(0, "Chat", "LoggingEnabled", g_Settings.bLoggingEnabled);
}
else {
db_unset(NULL, "Chat", "LogDirectory");
db_set_b(0, "Chat", "LoggingEnabled", 0);
}
SM_InvalidateLogDirectories();
iLen = SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN4, UDM_GETPOS, 0, 0);
db_set_w(NULL, "Chat", "LoggingLimit", (WORD)iLen);
iLen = SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN3, UDM_GETPOS, 0, 0);
if (iLen > 0)
db_set_b(0, "Chat", "NicklistRowDist", (BYTE)iLen);
else
db_unset(NULL, "Chat", "NicklistRowDist");
iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_LOGTIMESTAMP));
if (iLen > 0) {
pszText = (char *)mir_realloc(pszText, iLen + 1);
GetDlgItemTextA(hwndDlg, IDC_LOGTIMESTAMP, pszText, iLen + 1);
db_set_s(NULL, "Chat", "LogTimestamp", pszText);
} else db_unset(NULL, "Chat", "LogTimestamp");
iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_TIMESTAMP));
if (iLen > 0) {
pszText = (char *)mir_realloc(pszText, iLen + 1);
GetDlgItemTextA(hwndDlg, IDC_TIMESTAMP, pszText, iLen + 1);
db_set_s(NULL, "Chat", "HeaderTime", pszText);
} else db_unset(NULL, "Chat", "HeaderTime");
iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_INSTAMP));
if (iLen > 0) {
pszText = (char *)mir_realloc(pszText, iLen + 1);
GetDlgItemTextA(hwndDlg, IDC_INSTAMP, pszText, iLen + 1);
db_set_s(NULL, "Chat", "HeaderIncoming", pszText);
} else db_unset(NULL, "Chat", "HeaderIncoming");
iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_OUTSTAMP));
if (iLen > 0) {
pszText = (char *)mir_realloc(pszText, iLen + 1);
GetDlgItemTextA(hwndDlg, IDC_OUTSTAMP, pszText, iLen + 1);
db_set_s(NULL, "Chat", "HeaderOutgoing", pszText);
} else db_unset(NULL, "Chat", "HeaderOutgoing");
iLen = SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN2, UDM_GETPOS, 0, 0);
db_set_w(NULL, "Chat", "LogLimit", (WORD)iLen);
mir_free(pszText);
if (hListBkgBrush)
DeleteObject(hListBkgBrush);
hListBkgBrush = CreateSolidBrush(M.GetDword("Chat", "ColorNicklistBG", SRMSGDEFSET_BKGCOLOUR));
LoadLogFonts();
FreeMsgLogBitmaps();
LoadMsgLogBitmaps();
LOGFONT lf;
LoadMsgDlgFont(FONTSECTION_CHAT, 0, &lf, NULL, CHAT_FONTMODULE);
HFONT hFont = CreateFontIndirect(&lf);
int iText = GetTextPixelSize(MakeTimeStamp(g_Settings.pszTimeStamp, time(NULL)), hFont, true);
DeleteObject(hFont);
g_Settings.LogTextIndent = iText;
g_Settings.LogTextIndent = g_Settings.LogTextIndent * 12 / 10;
g_Settings.bLogIndentEnabled = M.GetBool("Chat", "LogIndentEnabled", true);
LoadGlobalSettings();
MM_FontsChanged();
MM_FixColors();
SM_BroadcastMessage(NULL, GC_SETWNDPROPS, 0, 0, TRUE);
PluginConfig.reloadSettings();
CacheMsgLogIcons();
CacheLogFonts();
return TRUE;
}
break;
case WM_TIMER:
if (IsWindow(hPathTip))
KillTimer(hPathTip, 4); // It will prevent tooltip autoclosing
break;
case WM_DESTROY:
if (hPathTip) {
KillTimer(hwndDlg, 0);
DestroyWindow(hPathTip);
hPathTip = 0;
}
break;
}
return FALSE;
}
#define NR_GC_EVENTS 12
static UINT _eventorder[] =
{
GC_EVENT_ACTION,
GC_EVENT_MESSAGE,
GC_EVENT_NICK,
GC_EVENT_JOIN,
GC_EVENT_PART,
GC_EVENT_TOPIC,
GC_EVENT_ADDSTATUS,
GC_EVENT_INFORMATION,
GC_EVENT_QUIT,
GC_EVENT_KICK,
GC_EVENT_NOTICE,
GC_EVENT_HIGHLIGHT
};
#define GC_EVENT_ALL (GC_EVENT_ACTION | GC_EVENT_MESSAGE | GC_EVENT_NICK | GC_EVENT_JOIN | \
GC_EVENT_PART | GC_EVENT_TOPIC | GC_EVENT_ADDSTATUS | GC_EVENT_INFORMATION | GC_EVENT_QUIT | \
GC_EVENT_KICK | GC_EVENT_NOTICE)
/**
* Dialog procedure for group chat options tab #3 (event filter configuration)
*
* @return
*/
INT_PTR CALLBACK DlgProcOptions3(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
{
DWORD dwFilterFlags = M.GetDword("Chat", "FilterFlags", GC_EVENT_ALL);
DWORD dwTrayFlags = M.GetDword("Chat", "TrayIconFlags", GC_EVENT_ALL);
DWORD dwPopupFlags = M.GetDword("Chat", "PopupFlags", GC_EVENT_ALL);
DWORD dwLogFlags = M.GetDword("Chat", "DiskLogFlags", GC_EVENT_ALL);
for (int i=0; i < SIZEOF(_eventorder); i++) {
if (_eventorder[i] != GC_EVENT_HIGHLIGHT) {
CheckDlgButton(hwndDlg, IDC_1 + i, dwFilterFlags & _eventorder[i] ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_L1 + i, dwLogFlags & _eventorder[i] ? BST_CHECKED : BST_UNCHECKED);
}
CheckDlgButton(hwndDlg, IDC_P1 + i, dwPopupFlags & _eventorder[i] ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_T1 + i, dwTrayFlags & _eventorder[i] ? BST_CHECKED : BST_UNCHECKED);
}
SendDlgItemMessage(hwndDlg, IDC_LOGICONTYPE, CB_ADDSTRING, -1, (LPARAM)TranslateT("No markers"));
SendDlgItemMessage(hwndDlg, IDC_LOGICONTYPE, CB_ADDSTRING, -1, (LPARAM)TranslateT("Show as icons"));
SendDlgItemMessage(hwndDlg, IDC_LOGICONTYPE, CB_ADDSTRING, -1, (LPARAM)TranslateT("Show as text symbols"));
SendDlgItemMessage(hwndDlg, IDC_LOGICONTYPE, CB_SETCURSEL, (g_Settings.bLogSymbols ? 2 : (g_Settings.dwIconFlags ? 1 : 0)), 0);
CheckDlgButton(hwndDlg, IDC_NOPOPUPSFORCLOSEDWINDOWS, M.GetByte("Chat", "SkipWhenNoWindow", 0) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_TRAYONLYFORINACTIVE, M.GetByte("Chat", "TrayIconInactiveOnly", 0) ? BST_CHECKED : BST_UNCHECKED);
}
break;
case WM_COMMAND:
if (lParam != 0)
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
case WM_NOTIFY:
switch (((LPNMHDR)lParam)->idFrom) {
case 0:
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
DWORD dwFilterFlags = 0, dwTrayFlags = 0,
dwPopupFlags = 0, dwLogFlags = 0;
for (int i=0; i < SIZEOF(_eventorder); i++) {
if (_eventorder[i] != GC_EVENT_HIGHLIGHT) {
dwFilterFlags |= (IsDlgButtonChecked(hwndDlg, IDC_1 + i) ? _eventorder[i] : 0);
dwLogFlags |= (IsDlgButtonChecked(hwndDlg, IDC_L1 + i) ? _eventorder[i] : 0);
}
dwPopupFlags |= (IsDlgButtonChecked(hwndDlg, IDC_P1 + i) ? _eventorder[i] : 0);
dwTrayFlags |= (IsDlgButtonChecked(hwndDlg, IDC_T1 + i) ? _eventorder[i] : 0);
}
db_set_dw(0, "Chat", "FilterFlags", dwFilterFlags);
db_set_dw(0, "Chat", "PopupFlags", dwPopupFlags);
db_set_dw(0, "Chat", "TrayIconFlags", dwTrayFlags);
db_set_dw(0, "Chat", "DiskLogFlags", dwLogFlags);
LRESULT lr = SendDlgItemMessage(hwndDlg, IDC_LOGICONTYPE, CB_GETCURSEL, 0, 0);
db_set_dw(0, "Chat", "IconFlags", lr == 1 ? 1 : 0);
db_set_b(0, "Chat", "LogSymbols", lr == 2 ? 1 : 0);
db_set_b(0, "Chat", "SkipWhenNoWindow", IsDlgButtonChecked(hwndDlg, IDC_NOPOPUPSFORCLOSEDWINDOWS) ? 1 : 0);
db_set_b(0, "Chat", "TrayIconInactiveOnly", IsDlgButtonChecked(hwndDlg, IDC_TRAYONLYFORINACTIVE) ? 1 : 0);
LoadGlobalSettings();
MM_FontsChanged();
SM_BroadcastMessage(NULL, GC_SETWNDPROPS, 0, 0, TRUE);
SM_ReconfigureFilters();
return TRUE;
}
}
break;
}
return FALSE;
}
void LoadGlobalSettings(void)
{
LOGFONT lf;
char szBuf[40];
g_Settings.bLogLimitNames = M.GetBool("Chat", "LogLimitNames", true);
g_Settings.bShowTime = M.GetBool("Chat", "ShowTimeStamp", true);
g_Settings.bShowTimeIfChanged = M.GetBool("Chat", "ShowTimeStampIfChanged", false);
g_Settings.bTimeStampEventColour = M.GetBool("Chat", "TimeStampEventColour", false);
g_Settings.iEventLimit = db_get_w(NULL, "Chat", "LogLimit", 100);
g_Settings.iEventLimitThreshold = db_get_w(NULL, "Chat", "LogLimitThreshold", 20);
g_Settings.dwIconFlags = M.GetDword("Chat", "IconFlags", 0x0000);
g_Settings.LoggingLimit = (size_t)db_get_w(NULL, "Chat", "LoggingLimit", 100);
g_Settings.bLoggingEnabled = M.GetBool("Chat", "LoggingEnabled", false);
g_Settings.bOpenInDefault = M.GetBool("Chat", "DefaultContainer", true);
g_Settings.bFlashWindow = M.GetBool("Chat", "FlashWindow", false);
g_Settings.bFlashWindowHightlight = M.GetBool("Chat", "FlashWindowHighlight", false);
g_Settings.UserListColors[CHAT_STATUS_NORMAL] = M.GetDword(CHAT_FONTMODULE, "Font18Col", RGB(0, 0, 0));
g_Settings.UserListColors[CHAT_STATUS_AWAY] = M.GetDword(CHAT_FONTMODULE, "Font19Col", RGB(170, 170, 170));
g_Settings.UserListColors[CHAT_STATUS_OFFLINE] = M.GetDword(CHAT_FONTMODULE, "Font5Col", RGB(160, 90, 90));
g_Settings.crUserListBGColor = M.GetDword("Chat", "ColorNicklistBG", SRMSGDEFSET_BKGCOLOUR);
g_Settings.bStripFormat = M.GetBool("Chat", "StripFormatting", false);
g_Settings.bTrayIconInactiveOnly = M.GetBool("Chat", "TrayIconInactiveOnly", true);
g_Settings.bBBCodeInPopups = M.GetByte("Chat", "BBCodeInPopups", 0) != 0;
g_Settings.bAddColonToAutoComplete = M.GetBool("Chat", "AddColonToAutoComplete", true);
g_Settings.iPopupStyle = M.GetByte("Chat", "PopupStyle", 1);
g_Settings.iPopupTimeout = db_get_w(NULL, "Chat", "PopupTimeout", 3);
g_Settings.crPUBkgColour = M.GetDword("Chat", "PopupColorBG", GetSysColor(COLOR_WINDOW));
g_Settings.crPUTextColour = M.GetDword("Chat", "PopupColorText", 0);
g_Settings.bClassicIndicators = M.GetBool("Chat", "ClassicIndicators", false);
//MAD
g_Settings.bLogClassicIndicators = M.GetBool("Chat", "LogClassicIndicators", false);
g_Settings.bAlternativeSorting = M.GetBool("Chat", "AlternativeSorting", true);
g_Settings.bAnnoyingHighlight = M.GetBool("Chat", "AnnoyingHighlight", false);
g_Settings.bCreateWindowOnHighlight = M.GetBool("Chat", "CreateWindowOnHighlight", true);
//MAD_
g_Settings.bLogSymbols = M.GetBool("Chat", "LogSymbols", true);
g_Settings.bClickableNicks = M.GetBool("Chat", "ClickableNicks", true);
g_Settings.bColorizeNicks = M.GetBool("Chat", "ColorizeNicks", true);
g_Settings.bColorizeNicksInLog = M.GetBool("Chat", "ColorizeNicksInLog", true);
g_Settings.bScaleIcons = M.GetBool("Chat", "ScaleIcons", true);
g_Settings.bUseDividers = M.GetBool("Chat", "UseDividers", true);
g_Settings.bDividersUsePopupConfig = M.GetBool("Chat", "DividersUsePopupConfig", true);
g_Settings.bMathMod = ServiceExists(MATH_RTF_REPLACE_FORMULAE) && M.GetBool("Chat", "MathModSupport", false);
g_Settings.bDoubleClick4Privat = M.GetBool("Chat", "DoubleClick4Privat", false);
g_Settings.bShowContactStatus = M.GetBool("Chat", "ShowContactStatus", true);
g_Settings.bContactStatusFirst = M.GetBool("Chat", "ContactStatusFirst", false);
if (hListBkgBrush)
DeleteObject(hListBkgBrush);
hListBkgBrush = CreateSolidBrush(M.GetDword("Chat", "ColorNicklistBG", SRMSGDEFSET_BKGCOLOUR));
InitSetting(g_Settings.pszTimeStamp, "HeaderTime", _T("[%H:%M]"));
InitSetting(g_Settings.pszTimeStampLog, "LogTimestamp", _T("[%d %b %y %H:%M]"));
InitSetting(g_Settings.pszIncomingNick, "HeaderIncoming", _T("%n:"));
InitSetting(g_Settings.pszOutgoingNick, "HeaderOutgoing", _T("%n:"));
DBVARIANT dbv;
if (!db_get_ts(NULL, "Chat", "LogDirectory", &dbv)) {
lstrcpyn(g_Settings.pszLogDir, dbv.ptszVal, MAX_PATH);
db_free(&dbv);
}
else lstrcpyn(g_Settings.pszLogDir, DEFLOGFILENAME, MAX_PATH);
g_Settings.pszLogDir[MAX_PATH - 1] = 0;
g_Settings.bLogIndentEnabled = M.GetBool("Chat", "LogIndentEnabled", true);
// nicklist
if (g_Settings.UserListFonts[0]) {
DeleteObject(g_Settings.UserListFonts[CHAT_STATUS_NORMAL]);
DeleteObject(g_Settings.UserListFonts[CHAT_STATUS_AWAY]);
DeleteObject(g_Settings.UserListFonts[CHAT_STATUS_OFFLINE]);
}
LoadMsgDlgFont(FONTSECTION_CHAT, 18, &lf, NULL, CHAT_FONTMODULE);
g_Settings.UserListFonts[CHAT_STATUS_NORMAL] = CreateFontIndirect(&lf);
LoadMsgDlgFont(FONTSECTION_CHAT, 19, &lf, NULL, CHAT_FONTMODULE);
g_Settings.UserListFonts[CHAT_STATUS_AWAY] = CreateFontIndirect(&lf);
LoadMsgDlgFont(FONTSECTION_CHAT, 5, &lf, NULL, CHAT_FONTMODULE);
g_Settings.UserListFonts[CHAT_STATUS_OFFLINE] = CreateFontIndirect(&lf);
int ih = GetTextPixelSize(_T("AQGglo"), g_Settings.UserListFonts[CHAT_STATUS_NORMAL], false);
int ih2 = GetTextPixelSize(_T("AQGglo"), g_Settings.UserListFonts[CHAT_STATUS_AWAY], false);
g_Settings.iNickListFontHeight = max(M.GetByte("Chat", "NicklistRowDist", 12), (ih > ih2 ? ih : ih2));
for (int i=0; i < 7; i++) {
mir_snprintf(szBuf, 20, "NickColor%d", i);
g_Settings.nickColors[i] = M.GetDword("Chat", szBuf, g_Settings.UserListColors[0]);
}
g_Settings.nickColors[5] = M.GetDword("Chat", "NickColor5", GetSysColor(COLOR_HIGHLIGHT));
g_Settings.nickColors[6] = M.GetDword("Chat", "NickColor6", GetSysColor(COLOR_HIGHLIGHTTEXT));
if (g_Settings.SelectionBGBrush)
DeleteObject(g_Settings.SelectionBGBrush);
g_Settings.SelectionBGBrush = CreateSolidBrush(g_Settings.nickColors[5]);
}
static void FreeGlobalSettings(void)
{
mir_free(g_Settings.pszTimeStamp);
mir_free(g_Settings.pszTimeStampLog);
mir_free(g_Settings.pszIncomingNick);
mir_free(g_Settings.pszOutgoingNick);
for (int i=0; i < SIZEOF(g_Settings.UserListFonts); i++)
if (g_Settings.UserListFonts[i])
DeleteObject(g_Settings.UserListFonts[i]);
if (g_Settings.SelectionBGBrush)
DeleteObject(g_Settings.SelectionBGBrush);
delete g_Settings.Highlight;
}
int OptionsInit(void)
{
LoadLogFonts();
LOGFONT lf;
LoadMsgDlgFont(FONTSECTION_CHAT, 17, &lf, NULL, CHAT_FONTMODULE);
lstrcpy(lf.lfFaceName, _T("MS Shell Dlg"));
lf.lfUnderline = lf.lfItalic = lf.lfStrikeOut = 0;
lf.lfHeight = -17;
lf.lfWeight = FW_BOLD;
ZeroMemory(&g_Settings, sizeof(TMUCSettings));
g_Settings.NameFont = CreateFontIndirect(&lf);
g_Settings.iSplitterX = db_get_w(NULL, "Chat", "SplitterX", 105);
if (g_Settings.iSplitterX <= 50)
g_Settings.iSplitterX = 105;
g_Settings.iSplitterY = db_get_w(NULL, "Chat", "splitY", 50);
if (g_Settings.iSplitterY <= 20)
g_Settings.iSplitterY = 50;
g_Settings.hGroup = 0;
LoadGlobalSettings();
g_Settings.Highlight = new CMUCHighlight();
SkinAddNewSoundEx("ChatMessage", LPGEN("Group chats"), LPGEN("Incoming message"));
SkinAddNewSoundEx("ChatSent", LPGEN("Group chats"), LPGEN("Outgoing message"));
SkinAddNewSoundEx("ChatHighlight", LPGEN("Group chats"), LPGEN("Message is highlighted"));
SkinAddNewSoundEx("ChatAction", LPGEN("Group chats"), LPGEN("User has performed an action"));
SkinAddNewSoundEx("ChatJoin", LPGEN("Group chats"), LPGEN("User has joined"));
SkinAddNewSoundEx("ChatPart", LPGEN("Group chats"), LPGEN("User has left"));
SkinAddNewSoundEx("ChatKick", LPGEN("Group chats"), LPGEN("User has kicked some other user"));
SkinAddNewSoundEx("ChatMode", LPGEN("Group chats"), LPGEN("User's status was changed"));
SkinAddNewSoundEx("ChatNick", LPGEN("Group chats"), LPGEN("User has changed name"));
SkinAddNewSoundEx("ChatNotice", LPGEN("Group chats"), LPGEN("User has sent a notice"));
SkinAddNewSoundEx("ChatQuit", LPGEN("Group chats"), LPGEN("User has disconnected"));
SkinAddNewSoundEx("ChatTopic", LPGEN("Group chats"), LPGEN("The topic has been changed"));
LoadMsgDlgFont(FONTSECTION_CHAT, 0, &lf, NULL, CHAT_FONTMODULE);
HFONT hFont = CreateFontIndirect(&lf);
int iText = GetTextPixelSize(MakeTimeStamp(g_Settings.pszTimeStamp, time(NULL)), hFont, true);
DeleteObject(hFont);
g_Settings.LogTextIndent = iText;
g_Settings.LogTextIndent = g_Settings.LogTextIndent * 12 / 10;
return 0;
}
int OptionsUnInit(void)
{
FreeGlobalSettings();
DeleteObject(hListBkgBrush);
DeleteObject(g_Settings.NameFont);
return 0;
}
|