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
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
|
/*
* Copyright (C) 2003-2011 Sebastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
* WeeChat 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 3 of the License, or
* (at your option) any later version.
*
* WeeChat 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 WeeChat. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* gui-window.c: window functions (used by all GUI)
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdlib.h>
#include <stddef.h>
#include <stdio.h>
#include <stdarg.h>
#include <unistd.h>
#include <string.h>
#include <signal.h>
#include <time.h>
#include <ctype.h>
#include "../core/weechat.h"
#include "../core/wee-config.h"
#include "../core/wee-hdata.h"
#include "../core/wee-hook.h"
#include "../core/wee-infolist.h"
#include "../core/wee-log.h"
#include "../core/wee-string.h"
#include "../core/wee-utf8.h"
#include "../plugins/plugin.h"
#include "gui-window.h"
#include "gui-bar.h"
#include "gui-bar-window.h"
#include "gui-buffer.h"
#include "gui-filter.h"
#include "gui-input.h"
#include "gui-hotlist.h"
#include "gui-layout.h"
#include "gui-line.h"
int gui_init_ok = 0; /* = 1 if GUI is initialized*/
int gui_ok = 0; /* = 1 if GUI is ok */
/* (0 when size too small) */
int gui_window_refresh_needed = 0; /* = 1 if refresh needed */
/* = 2 for full refresh */
struct t_gui_window *gui_windows = NULL; /* first window */
struct t_gui_window *last_gui_window = NULL; /* last window */
struct t_gui_window *gui_current_window = NULL; /* current window */
struct t_gui_window_tree *gui_windows_tree = NULL; /* windows tree */
struct t_gui_layout_window *gui_window_layout_before_zoom = NULL;
/* layout before zooming on a window */
int gui_window_layout_id_current_window = -1;
/* current window id before zoom */
/*
* gui_window_ask_refresh: set "gui_window_refresh_needed" flag
*/
void
gui_window_ask_refresh (int refresh)
{
if (refresh > gui_window_refresh_needed)
gui_window_refresh_needed = refresh;
}
/*
* gui_window_tree_init: create first entry in windows tree
*/
int
gui_window_tree_init (struct t_gui_window *window)
{
gui_windows_tree = malloc (sizeof (*gui_windows_tree));
if (!gui_windows_tree)
return 0;
gui_windows_tree->parent_node = NULL;
gui_windows_tree->split_pct = 0;
gui_windows_tree->split_horizontal = 0;
gui_windows_tree->child1 = NULL;
gui_windows_tree->child2 = NULL;
gui_windows_tree->window = window;
return 1;
}
/*
* gui_window_tree_node_to_leaf: convert a node to a leaf (free any leafs)
* Called when 2 windows are merging into one
*/
void
gui_window_tree_node_to_leaf (struct t_gui_window_tree *node,
struct t_gui_window *window)
{
node->split_pct = 0;
node->split_horizontal = 0;
if (node->child1)
{
free (node->child1);
node->child1 = NULL;
}
if (node->child2)
{
free (node->child2);
node->child2 = NULL;
}
node->window = window;
window->ptr_tree = node;
}
/*
* gui_window_tree_free: delete entire windows tree
*/
void
gui_window_tree_free (struct t_gui_window_tree **tree)
{
if (*tree)
{
if ((*tree)->child1)
gui_window_tree_free (&((*tree)->child1));
if ((*tree)->child2)
gui_window_tree_free (&((*tree)->child2));
free (*tree);
*tree = NULL;
}
}
/*
* gui_window_scroll_search: search a scroll with buffer pointer
*/
struct t_gui_window_scroll *
gui_window_scroll_search (struct t_gui_window *window,
struct t_gui_buffer *buffer)
{
struct t_gui_window_scroll *ptr_scroll;
if (!window || !buffer)
return NULL;
for (ptr_scroll = window->scroll; ptr_scroll;
ptr_scroll = ptr_scroll->next_scroll)
{
if (ptr_scroll->buffer == buffer)
return ptr_scroll;
}
/* scroll not found for buffer */
return NULL;
}
/*
* gui_window_scroll_init: initialize a window scroll structure
*/
void
gui_window_scroll_init (struct t_gui_window_scroll *window_scroll,
struct t_gui_buffer *buffer)
{
window_scroll->buffer = buffer;
window_scroll->first_line_displayed = 0;
window_scroll->start_line = NULL;
window_scroll->start_line_pos = 0;
window_scroll->scrolling = 0;
window_scroll->start_col = 0;
window_scroll->lines_after = 0;
window_scroll->reset_allowed = 0;
window_scroll->prev_scroll = NULL;
window_scroll->next_scroll = NULL;
}
/*
* gui_window_scroll_free: free a scroll structure in a window
*/
void
gui_window_scroll_free (struct t_gui_window *window,
struct t_gui_window_scroll *scroll)
{
if (scroll->prev_scroll)
(scroll->prev_scroll)->next_scroll = scroll->next_scroll;
if (scroll->next_scroll)
(scroll->next_scroll)->prev_scroll = scroll->prev_scroll;
if (window->scroll == scroll)
window->scroll = scroll->next_scroll;
free (scroll);
}
/*
* gui_window_scroll_free_all: free all scroll structures in a window
*/
void
gui_window_scroll_free_all (struct t_gui_window *window)
{
while (window->scroll)
{
gui_window_scroll_free (window, window->scroll);
}
}
/*
* gui_window_scroll_remove_not_scrolled: remove all scroll structures which
* are empty (not scrolled)
* Note: the first scroll in list
* (current buffer) is NOT removed by
* this function.
*/
void
gui_window_scroll_remove_not_scrolled (struct t_gui_window *window)
{
struct t_gui_window_scroll *ptr_scroll, *next_scroll;
if (window)
{
ptr_scroll = window->scroll->next_scroll;
while (ptr_scroll)
{
next_scroll = ptr_scroll->next_scroll;
if ((ptr_scroll->first_line_displayed == 0)
&& (ptr_scroll->start_line == NULL)
&& (ptr_scroll->start_line_pos == 0)
&& (ptr_scroll->scrolling == 0)
&& (ptr_scroll->start_col == 0)
&& (ptr_scroll->lines_after == 0)
&& (ptr_scroll->reset_allowed == 0))
{
gui_window_scroll_free (window, ptr_scroll);
}
ptr_scroll = next_scroll;
}
}
}
/*
* gui_window_scroll_switch: switch scroll to a buffer
*/
void
gui_window_scroll_switch (struct t_gui_window *window,
struct t_gui_buffer *buffer)
{
struct t_gui_window_scroll *ptr_scroll, *new_scroll;
if (window && buffer)
{
ptr_scroll = gui_window_scroll_search (window, buffer);
/* scroll is already selected (first in list)? */
if (ptr_scroll && (ptr_scroll == window->scroll))
return;
if (ptr_scroll)
{
/* scroll found, move it in first position */
if (ptr_scroll->prev_scroll)
(ptr_scroll->prev_scroll)->next_scroll = ptr_scroll->next_scroll;
if (ptr_scroll->next_scroll)
(ptr_scroll->next_scroll)->prev_scroll = ptr_scroll->prev_scroll;
(window->scroll)->prev_scroll = ptr_scroll;
ptr_scroll->prev_scroll = NULL;
ptr_scroll->next_scroll = window->scroll;
window->scroll = ptr_scroll;
}
else
{
/* scroll not found, create one and add it at first position */
new_scroll = malloc (sizeof (*new_scroll));
if (new_scroll)
{
gui_window_scroll_init (new_scroll, buffer);
new_scroll->next_scroll = window->scroll;
(window->scroll)->prev_scroll = new_scroll;
window->scroll = new_scroll;
}
}
gui_window_scroll_remove_not_scrolled (window);
}
}
/*
* gui_window_scroll_remove_buffer: remove buffer from scroll list in a window
*/
void
gui_window_scroll_remove_buffer (struct t_gui_window *window,
struct t_gui_buffer *buffer)
{
struct t_gui_window_scroll *ptr_scroll;
if (window && buffer)
{
ptr_scroll = gui_window_scroll_search (window, buffer);
if (ptr_scroll)
gui_window_scroll_free (window, ptr_scroll);
}
}
/*
* gui_window_new: create a new window
*/
struct t_gui_window *
gui_window_new (struct t_gui_window *parent_window, struct t_gui_buffer *buffer,
int x, int y, int width, int height,
int width_pct, int height_pct)
{
struct t_gui_window *new_window;
struct t_gui_window_tree *ptr_tree, *child1, *child2, *ptr_leaf;
struct t_gui_bar *ptr_bar;
if (parent_window)
{
child1 = malloc (sizeof (*child1));
if (!child1)
return NULL;
child2 = malloc (sizeof (*child2));
if (!child2)
{
free (child1);
return NULL;
}
ptr_tree = parent_window->ptr_tree;
if (width_pct == 100)
{
ptr_tree->split_horizontal = 1;
ptr_tree->split_pct = height_pct;
}
else
{
ptr_tree->split_horizontal = 0;
ptr_tree->split_pct = width_pct;
}
/*
* parent window leaf becomes node and we add 2 leafs below
* (#1 is parent win, #2 is new win)
*/
parent_window->ptr_tree = child1;
child1->parent_node = ptr_tree;
child1->child1 = NULL;
child1->child2 = NULL;
child1->window = ptr_tree->window;
child2->parent_node = ptr_tree;
child2->child1 = NULL;
child2->child2 = NULL;
child2->window = NULL; /* will be assigned by new window below */
ptr_tree->child1 = child1;
ptr_tree->child2 = child2;
ptr_tree->window = NULL; /* leaf becomes node */
ptr_leaf = child2;
}
else
{
if (!gui_window_tree_init (NULL))
return NULL;
ptr_leaf = gui_windows_tree;
}
if ((new_window = (malloc (sizeof (*new_window)))))
{
/* create scroll structure */
new_window->scroll = malloc (sizeof (*new_window->scroll));
if (!new_window->scroll)
{
free (new_window);
return NULL;
}
/* create window objects */
if (!gui_window_objects_init (new_window))
{
free (new_window->scroll);
free (new_window);
return NULL;
}
/* position & size */
new_window->win_x = x;
new_window->win_y = y;
new_window->win_width = width;
new_window->win_height = height;
new_window->win_width_pct = width_pct;
new_window->win_height_pct = height_pct;
/* chat window */
new_window->win_chat_x = 0;
new_window->win_chat_y = 0;
new_window->win_chat_width = 0;
new_window->win_chat_height = 0;
new_window->win_chat_cursor_x = 0;
new_window->win_chat_cursor_y = 0;
/* bar windows */
new_window->bar_windows = NULL;
new_window->last_bar_window = NULL;
/* refresh */
new_window->refresh_needed = 0;
/* buffer and layout infos */
new_window->buffer = buffer;
new_window->layout_plugin_name = NULL;
new_window->layout_buffer_name = NULL;
/* scroll */
gui_window_scroll_init (new_window->scroll, buffer);
/* tree */
new_window->ptr_tree = ptr_leaf;
ptr_leaf->window = new_window;
/* add window to windows queue */
new_window->prev_window = last_gui_window;
if (gui_windows)
last_gui_window->next_window = new_window;
else
gui_windows = new_window;
last_gui_window = new_window;
new_window->next_window = NULL;
/* create bar windows */
for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar)
{
if (CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_TYPE]) != GUI_BAR_TYPE_ROOT)
gui_bar_window_new (ptr_bar, new_window);
}
}
else
return NULL;
return new_window;
}
/*
* gui_window_valid: check if a buffer pointer exists
* return 1 if buffer exists
* 0 if buffer is not found
*/
int
gui_window_valid (struct t_gui_window *window)
{
struct t_gui_window *ptr_window;
if (!window)
return 0;
for (ptr_window = gui_windows; ptr_window;
ptr_window = ptr_window->next_window)
{
if (ptr_window == window)
return 1;
}
/* window not found */
return 0;
}
/*
* gui_window_search_with_buffer: search window displaying a buffer
* return NULL if no window is displaying given
* buffer
* If many windows are displaying this buffer,
* the first window in list is returned (or
* current window if it is displaying this
* buffer)
*/
struct t_gui_window *
gui_window_search_with_buffer (struct t_gui_buffer *buffer)
{
struct t_gui_window *ptr_window;
if (!buffer)
return NULL;
if (gui_current_window->buffer == buffer)
return gui_current_window;
for (ptr_window = gui_windows; ptr_window;
ptr_window = ptr_window->next_window)
{
if (ptr_window->buffer == buffer)
return ptr_window;
}
/* no window displaying buffer */
return NULL;
}
/*
* gui_window_get_integer: get a window property as integer
*/
int
gui_window_get_integer (struct t_gui_window *window, const char *property)
{
if (window && property)
{
if (string_strcasecmp (property, "win_x") == 0)
return window->win_x;
if (string_strcasecmp (property, "win_y") == 0)
return window->win_y;
if (string_strcasecmp (property, "win_width") == 0)
return window->win_width;
if (string_strcasecmp (property, "win_height") == 0)
return window->win_height;
if (string_strcasecmp (property, "win_width_pct") == 0)
return window->win_width_pct;
if (string_strcasecmp (property, "win_height_pct") == 0)
return window->win_height_pct;
if (string_strcasecmp (property, "win_chat_x") == 0)
return window->win_chat_x;
if (string_strcasecmp (property, "win_chat_y") == 0)
return window->win_chat_y;
if (string_strcasecmp (property, "win_chat_width") == 0)
return window->win_chat_width;
if (string_strcasecmp (property, "win_chat_height") == 0)
return window->win_chat_height;
if (string_strcasecmp (property, "first_line_displayed") == 0)
return window->scroll->first_line_displayed;
if (string_strcasecmp (property, "scrolling") == 0)
return window->scroll->scrolling;
if (string_strcasecmp (property, "lines_after") == 0)
return window->scroll->lines_after;
}
return 0;
}
/*
* gui_window_get_string: get a window property as string
*/
const char *
gui_window_get_string (struct t_gui_window *window, const char *property)
{
if (window && property)
{
}
return NULL;
}
/*
* gui_windowr_get_pointer: get a window property as pointer
*/
void *
gui_window_get_pointer (struct t_gui_window *window, const char *property)
{
if (property)
{
if (string_strcasecmp (property, "current") == 0)
return gui_current_window;
if (window)
{
if (string_strcasecmp (property, "buffer") == 0)
return window->buffer;
}
}
return NULL;
}
/*
* gui_window_set_layout_plugin_name: set layout plugin name for window
*/
void
gui_window_set_layout_plugin_name (struct t_gui_window *window,
const char *plugin_name)
{
if (window->layout_plugin_name)
{
free (window->layout_plugin_name);
window->layout_plugin_name = NULL;
}
if (plugin_name)
window->layout_plugin_name = strdup (plugin_name);
}
/*
* gui_window_set_layout_buffer_name: set layout buffer name for window
*/
void
gui_window_set_layout_buffer_name (struct t_gui_window *window,
const char *buffer_name)
{
if (window->layout_buffer_name)
{
free (window->layout_buffer_name);
window->layout_buffer_name = NULL;
}
if (buffer_name)
window->layout_buffer_name = strdup (buffer_name);
}
/*
* gui_window_free: delete a window
*/
void
gui_window_free (struct t_gui_window *window)
{
if (window->buffer)
gui_buffer_add_value_num_displayed (window->buffer, -1);
/* free data */
if (window->gui_objects)
{
gui_window_objects_free (window, 1);
free (window->gui_objects);
}
/* remove bar windows */
while (window->bar_windows)
{
gui_bar_window_free (window->bar_windows, window);
}
/* free other data */
if (window->layout_plugin_name)
free (window->layout_plugin_name);
if (window->layout_buffer_name)
free (window->layout_buffer_name);
/* remove scroll list */
gui_window_scroll_free_all (window);
/* remove window from windows list */
if (window->prev_window)
(window->prev_window)->next_window = window->next_window;
if (window->next_window)
(window->next_window)->prev_window = window->prev_window;
if (gui_windows == window)
gui_windows = window->next_window;
if (last_gui_window == window)
last_gui_window = window->prev_window;
if (gui_current_window == window)
gui_current_window = gui_windows;
free (window);
}
/*
* gui_window_switch_previous: switch to previous window
*/
void
gui_window_switch_previous (struct t_gui_window *window)
{
if (!gui_ok)
return;
gui_window_switch ((window->prev_window) ?
window->prev_window : last_gui_window);
}
/*
* gui_window_switch_next: switch to next window
*/
void
gui_window_switch_next (struct t_gui_window *window)
{
if (!gui_ok)
return;
gui_window_switch ((window->next_window) ?
window->next_window : gui_windows);
}
/*
* gui_window_switch_by_buffer: switch to next window displaying a buffer
*/
void
gui_window_switch_by_buffer (struct t_gui_window *window, int buffer_number)
{
struct t_gui_window *ptr_win;
if (!gui_ok)
return;
ptr_win = (window->next_window) ? window->next_window : gui_windows;
while (ptr_win != window)
{
if (ptr_win->buffer->number == buffer_number)
{
gui_window_switch (ptr_win);
return;
}
ptr_win = (ptr_win->next_window) ? ptr_win->next_window : gui_windows;
}
}
/*
* gui_window_scroll: scroll window by # messages or time
*/
void
gui_window_scroll (struct t_gui_window *window, char *scroll)
{
int direction, stop, count_msg;
char time_letter, saved_char;
time_t old_date, diff_date;
char *pos, *error;
long number;
struct t_gui_line *ptr_line;
struct tm *date_tmp, line_date, old_line_date;
if (window->buffer->lines->first_line)
{
direction = 1;
number = 0;
time_letter = ' ';
/* search direction */
if (scroll[0] == '-')
{
direction = -1;
scroll++;
}
else if (scroll[0] == '+')
{
direction = +1;
scroll++;
}
/* search number and letter */
pos = scroll;
while (pos && pos[0] && isdigit (pos[0]))
{
pos++;
}
if (pos)
{
if (pos == scroll)
{
if (pos[0])
time_letter = scroll[0];
}
else
{
if (pos[0])
time_letter = pos[0];
saved_char = pos[0];
pos[0] = '\0';
error = NULL;
number = strtol (scroll, &error, 10);
if (!error || error[0])
number = 0;
pos[0] = saved_char;
}
}
/* at least number or letter has to he given */
if ((number == 0) && (time_letter == ' '))
return;
/* do the scroll! */
stop = 0;
count_msg = 0;
if (direction < 0)
{
ptr_line = (window->scroll->start_line) ?
window->scroll->start_line : window->buffer->lines->last_line;
while (ptr_line
&& (!gui_line_is_displayed (ptr_line)
|| ((window->buffer->type == GUI_BUFFER_TYPE_FORMATTED)
&& (ptr_line->data->date == 0))))
{
ptr_line = ptr_line->prev_line;
}
}
else
{
ptr_line = (window->scroll->start_line) ?
window->scroll->start_line : window->buffer->lines->first_line;
while (ptr_line
&& (!gui_line_is_displayed (ptr_line)
|| ((window->buffer->type == GUI_BUFFER_TYPE_FORMATTED)
&& (ptr_line->data->date == 0))))
{
ptr_line = ptr_line->next_line;
}
}
if (ptr_line)
{
old_date = ptr_line->data->date;
date_tmp = localtime (&old_date);
memcpy (&old_line_date, date_tmp, sizeof (struct tm));
}
while (ptr_line)
{
ptr_line = (direction < 0) ?
gui_line_get_prev_displayed (ptr_line) : gui_line_get_next_displayed (ptr_line);
if (ptr_line
&& ((window->buffer->type != GUI_BUFFER_TYPE_FORMATTED)
|| (ptr_line->data->date != 0)))
{
if (time_letter == ' ')
{
count_msg++;
if (count_msg >= number)
stop = 1;
}
else
{
date_tmp = localtime (&(ptr_line->data->date));
memcpy (&line_date, date_tmp, sizeof (struct tm));
if (old_date > ptr_line->data->date)
diff_date = old_date - ptr_line->data->date;
else
diff_date = ptr_line->data->date - old_date;
switch (time_letter)
{
case 's': /* seconds */
if (number == 0)
{
/* stop if line has different second */
if ((line_date.tm_sec != old_line_date.tm_sec)
|| (line_date.tm_min != old_line_date.tm_min)
|| (line_date.tm_hour != old_line_date.tm_hour)
|| (line_date.tm_mday != old_line_date.tm_mday)
|| (line_date.tm_mon != old_line_date.tm_mon)
|| (line_date.tm_year != old_line_date.tm_year))
if (line_date.tm_sec != old_line_date.tm_sec)
stop = 1;
}
else if (diff_date >= number)
stop = 1;
break;
case 'm': /* minutes */
if (number == 0)
{
/* stop if line has different minute */
if ((line_date.tm_min != old_line_date.tm_min)
|| (line_date.tm_hour != old_line_date.tm_hour)
|| (line_date.tm_mday != old_line_date.tm_mday)
|| (line_date.tm_mon != old_line_date.tm_mon)
|| (line_date.tm_year != old_line_date.tm_year))
stop = 1;
}
else if (diff_date >= number * 60)
stop = 1;
break;
case 'h': /* hours */
if (number == 0)
{
/* stop if line has different hour */
if ((line_date.tm_hour != old_line_date.tm_hour)
|| (line_date.tm_mday != old_line_date.tm_mday)
|| (line_date.tm_mon != old_line_date.tm_mon)
|| (line_date.tm_year != old_line_date.tm_year))
stop = 1;
}
else if (diff_date >= number * 60 * 60)
stop = 1;
break;
case 'd': /* days */
if (number == 0)
{
/* stop if line has different day */
if ((line_date.tm_mday != old_line_date.tm_mday)
|| (line_date.tm_mon != old_line_date.tm_mon)
|| (line_date.tm_year != old_line_date.tm_year))
stop = 1;
}
else if (diff_date >= number * 60 * 60 * 24)
stop = 1;
break;
case 'M': /* months */
if (number == 0)
{
/* stop if line has different month */
if ((line_date.tm_mon != old_line_date.tm_mon)
|| (line_date.tm_year != old_line_date.tm_year))
stop = 1;
}
/*
* we consider month is 30 days, who will notice
* I'm too lazy to code exact date diff ? ;)
*/
else if (diff_date >= number * 60 * 60 * 24 * 30)
stop = 1;
break;
case 'y': /* years */
if (number == 0)
{
/* stop if line has different year */
if (line_date.tm_year != old_line_date.tm_year)
stop = 1;
}
/*
* we consider year is 365 days, who will notice
* I'm too lazy to code exact date diff ? ;)
*/
else if (diff_date >= number * 60 * 60 * 24 * 365)
stop = 1;
break;
}
}
if (stop)
{
window->scroll->start_line = ptr_line;
window->scroll->start_line_pos = 0;
window->scroll->first_line_displayed =
(window->scroll->start_line == gui_line_get_first_displayed (window->buffer));
gui_buffer_ask_chat_refresh (window->buffer, 2);
return;
}
}
}
if (direction < 0)
gui_window_scroll_top (window);
else
{
if (window->buffer->type == GUI_BUFFER_TYPE_FORMATTED)
gui_window_scroll_bottom (window);
}
}
}
/*
* gui_window_scroll_horiz: horizontal scroll window
*/
void
gui_window_scroll_horiz (struct t_gui_window *window, char *scroll)
{
int direction, percentage, start_col;
char saved_char, *pos, *error;
long number;
if (window->buffer->lines->first_line)
{
direction = 1;
number = 0;
percentage = 0;
/* search direction */
if (scroll[0] == '-')
{
direction = -1;
scroll++;
}
else if (scroll[0] == '+')
{
direction = +1;
scroll++;
}
/* search number and percentage */
pos = scroll;
while (pos && pos[0] && isdigit (pos[0]))
{
pos++;
}
if (pos && (pos > scroll))
{
percentage = (pos[0] == '%') ? 1 : 0;
saved_char = pos[0];
pos[0] = '\0';
error = NULL;
number = strtol (scroll, &error, 10);
if (!error || error[0])
number = 0;
pos[0] = saved_char;
}
/* for percentage, compute number of columns */
if (percentage)
{
number = (window->win_chat_width * number) / 100;
}
/* number must be different from 0 */
if (number == 0)
return;
/* do the horizontal scroll! */
start_col = window->scroll->start_col + (number * direction);
if (start_col < 0)
start_col = 0;
if (start_col != window->scroll->start_col)
{
window->scroll->start_col = start_col;
gui_buffer_ask_chat_refresh (window->buffer, 2);
}
}
}
/*
* gui_window_scroll_previous_highlight: scroll to previous highlight
*/
void
gui_window_scroll_previous_highlight (struct t_gui_window *window)
{
struct t_gui_line *ptr_line;
if ((window->buffer->type == GUI_BUFFER_TYPE_FORMATTED)
&& (window->buffer->text_search == GUI_TEXT_SEARCH_DISABLED))
{
if (window->buffer->lines->first_line)
{
ptr_line = (window->scroll->start_line) ?
window->scroll->start_line->prev_line : window->buffer->lines->last_line;
while (ptr_line)
{
if (ptr_line->data->highlight)
{
window->scroll->start_line = ptr_line;
window->scroll->start_line_pos = 0;
window->scroll->first_line_displayed =
(window->scroll->start_line == window->buffer->lines->first_line);
gui_buffer_ask_chat_refresh (window->buffer, 2);
return;
}
ptr_line = ptr_line->prev_line;
}
}
}
}
/*
* gui_window_scroll_next_highlight: scroll to next highlight
*/
void
gui_window_scroll_next_highlight (struct t_gui_window *window)
{
struct t_gui_line *ptr_line;
if ((window->buffer->type == GUI_BUFFER_TYPE_FORMATTED)
&& (window->buffer->text_search == GUI_TEXT_SEARCH_DISABLED))
{
if (window->buffer->lines->first_line)
{
ptr_line = (window->scroll->start_line) ?
window->scroll->start_line->next_line : window->buffer->lines->first_line->next_line;
while (ptr_line)
{
if (ptr_line->data->highlight)
{
window->scroll->start_line = ptr_line;
window->scroll->start_line_pos = 0;
window->scroll->first_line_displayed =
(window->scroll->start_line == window->buffer->lines->first_line);
gui_buffer_ask_chat_refresh (window->buffer, 2);
return;
}
ptr_line = ptr_line->next_line;
}
}
}
}
/*
* gui_window_search_text: search text in a buffer
* return 1 if line has been found with text, otherwise 0
*/
int
gui_window_search_text (struct t_gui_window *window)
{
struct t_gui_line *ptr_line;
if (window->buffer->text_search == GUI_TEXT_SEARCH_BACKWARD)
{
if (window->buffer->lines->first_line
&& window->buffer->input_buffer && window->buffer->input_buffer[0])
{
ptr_line = (window->scroll->start_line) ?
gui_line_get_prev_displayed (window->scroll->start_line) :
gui_line_get_last_displayed (window->buffer);
while (ptr_line)
{
if (gui_line_search_text (ptr_line,
window->buffer->input_buffer,
window->buffer->text_search_exact))
{
window->scroll->start_line = ptr_line;
window->scroll->start_line_pos = 0;
window->scroll->first_line_displayed =
(window->scroll->start_line == gui_line_get_first_displayed (window->buffer));
gui_buffer_ask_chat_refresh (window->buffer, 2);
return 1;
}
ptr_line = gui_line_get_prev_displayed (ptr_line);
}
}
}
else if (window->buffer->text_search == GUI_TEXT_SEARCH_FORWARD)
{
if (window->buffer->lines->first_line
&& window->buffer->input_buffer && window->buffer->input_buffer[0])
{
ptr_line = (window->scroll->start_line) ?
gui_line_get_next_displayed (window->scroll->start_line) :
gui_line_get_first_displayed (window->buffer);
while (ptr_line)
{
if (gui_line_search_text (ptr_line,
window->buffer->input_buffer,
window->buffer->text_search_exact))
{
window->scroll->start_line = ptr_line;
window->scroll->start_line_pos = 0;
window->scroll->first_line_displayed =
(window->scroll->start_line == window->buffer->lines->first_line);
gui_buffer_ask_chat_refresh (window->buffer, 2);
return 1;
}
ptr_line = gui_line_get_next_displayed (ptr_line);
}
}
}
return 0;
}
/*
* gui_window_search_start: start search in a buffer
*/
void
gui_window_search_start (struct t_gui_window *window)
{
window->buffer->text_search = GUI_TEXT_SEARCH_BACKWARD;
window->buffer->text_search_exact = 0;
window->buffer->text_search_found = 0;
if (window->buffer->text_search_input)
{
free (window->buffer->text_search_input);
window->buffer->text_search_input = NULL;
}
if (window->buffer->input_buffer && window->buffer->input_buffer[0])
window->buffer->text_search_input =
strdup (window->buffer->input_buffer);
gui_input_delete_line (window->buffer);
}
/*
* gui_window_search_restart: restart search (after input changes or exact
* flag (un)set)
*/
void
gui_window_search_restart (struct t_gui_window *window)
{
window->scroll->start_line = NULL;
window->scroll->start_line_pos = 0;
window->buffer->text_search = GUI_TEXT_SEARCH_BACKWARD;
window->buffer->text_search_found = 0;
if (gui_window_search_text (window))
window->buffer->text_search_found = 1;
else
{
if (CONFIG_BOOLEAN(config_look_search_text_not_found_alert)
&& window->buffer->input_buffer && window->buffer->input_buffer[0])
{
printf ("\a");
}
gui_buffer_ask_chat_refresh (window->buffer, 2);
}
}
/*
* gui_window_search_stop: stop search in a buffer
*/
void
gui_window_search_stop (struct t_gui_window *window)
{
window->buffer->text_search = GUI_TEXT_SEARCH_DISABLED;
window->buffer->text_search = 0;
gui_input_delete_line (window->buffer);
if (window->buffer->text_search_input)
{
gui_input_insert_string (window->buffer,
window->buffer->text_search_input, -1);
gui_input_text_changed_modifier_and_signal (window->buffer, 0);
free (window->buffer->text_search_input);
window->buffer->text_search_input = NULL;
}
window->scroll->start_line = NULL;
window->scroll->start_line_pos = 0;
gui_hotlist_remove_buffer (window->buffer);
gui_buffer_ask_chat_refresh (window->buffer, 2);
}
/*
* gui_window_zoom: zoom window (maximize it or restore layout before previous
* zoom)
*/
void
gui_window_zoom (struct t_gui_window *window)
{
if (!gui_ok)
return;
if (gui_window_layout_before_zoom)
{
/* restore layout as it was before zooming a window */
hook_signal_send ("window_unzoom",
WEECHAT_HOOK_SIGNAL_POINTER, gui_current_window);
gui_layout_window_apply (gui_window_layout_before_zoom,
gui_window_layout_id_current_window);
gui_layout_window_remove_all (&gui_window_layout_before_zoom);
gui_window_layout_id_current_window = -1;
hook_signal_send ("window_unzoomed",
WEECHAT_HOOK_SIGNAL_POINTER, gui_current_window);
}
else
{
/* save layout and zoom on current window */
hook_signal_send ("window_zoom",
WEECHAT_HOOK_SIGNAL_POINTER, gui_current_window);
gui_window_layout_id_current_window =
gui_layout_window_save (&gui_window_layout_before_zoom);
gui_window_merge_all (window);
hook_signal_send ("window_zoomed",
WEECHAT_HOOK_SIGNAL_POINTER, gui_current_window);
}
}
/*
* gui_window_hdata_window_cb: return hdata for window
*/
struct t_hdata *
gui_window_hdata_window_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
hdata = hdata_new (NULL, hdata_name, "prev_window", "next_window");
if (hdata)
{
HDATA_VAR(struct t_gui_window, win_x, INTEGER, NULL);
HDATA_VAR(struct t_gui_window, win_y, INTEGER, NULL);
HDATA_VAR(struct t_gui_window, win_width, INTEGER, NULL);
HDATA_VAR(struct t_gui_window, win_height, INTEGER, NULL);
HDATA_VAR(struct t_gui_window, win_width_pct, INTEGER, NULL);
HDATA_VAR(struct t_gui_window, win_height_pct, INTEGER, NULL);
HDATA_VAR(struct t_gui_window, win_chat_x, INTEGER, NULL);
HDATA_VAR(struct t_gui_window, win_chat_y, INTEGER, NULL);
HDATA_VAR(struct t_gui_window, win_chat_width, INTEGER, NULL);
HDATA_VAR(struct t_gui_window, win_chat_height, INTEGER, NULL);
HDATA_VAR(struct t_gui_window, win_chat_cursor_x, INTEGER, NULL);
HDATA_VAR(struct t_gui_window, win_chat_cursor_y, INTEGER, NULL);
HDATA_VAR(struct t_gui_window, bar_windows, POINTER, NULL);
HDATA_VAR(struct t_gui_window, last_bar_window, POINTER, NULL);
HDATA_VAR(struct t_gui_window, refresh_needed, INTEGER, NULL);
HDATA_VAR(struct t_gui_window, gui_objects, POINTER, NULL);
HDATA_VAR(struct t_gui_window, buffer, POINTER, "buffer");
HDATA_VAR(struct t_gui_window, layout_plugin_name, STRING, NULL);
HDATA_VAR(struct t_gui_window, layout_buffer_name, STRING, NULL);
HDATA_VAR(struct t_gui_window, scroll, POINTER, "window_scroll");
HDATA_VAR(struct t_gui_window, ptr_tree, POINTER, "window_tree");
HDATA_VAR(struct t_gui_window, prev_window, POINTER, hdata_name);
HDATA_VAR(struct t_gui_window, next_window, POINTER, hdata_name);
HDATA_LIST(gui_windows);
HDATA_LIST(last_gui_window);
HDATA_LIST(gui_current_window);
}
return hdata;
}
/*
* gui_window_hdata_window_scroll_cb: return hdata for window scroll
*/
struct t_hdata *
gui_window_hdata_window_scroll_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
hdata = hdata_new (NULL, hdata_name, "prev_scroll", "next_scroll");
if (hdata)
{
HDATA_VAR(struct t_gui_window_scroll, buffer, POINTER, "buffer");
HDATA_VAR(struct t_gui_window_scroll, first_line_displayed, INTEGER, NULL);
HDATA_VAR(struct t_gui_window_scroll, start_line, POINTER, "line");
HDATA_VAR(struct t_gui_window_scroll, start_line_pos, INTEGER, NULL);
HDATA_VAR(struct t_gui_window_scroll, scrolling, INTEGER, NULL);
HDATA_VAR(struct t_gui_window_scroll, start_col, INTEGER, NULL);
HDATA_VAR(struct t_gui_window_scroll, lines_after, INTEGER, NULL);
HDATA_VAR(struct t_gui_window_scroll, reset_allowed, INTEGER, NULL);
HDATA_VAR(struct t_gui_window_scroll, prev_scroll, POINTER, hdata_name);
HDATA_VAR(struct t_gui_window_scroll, next_scroll, POINTER, hdata_name);
}
return hdata;
}
/*
* gui_window_hdata_window_tree_cb: return hdata for window tree
*/
struct t_hdata *
gui_window_hdata_window_tree_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
hdata = hdata_new (NULL, hdata_name, NULL, NULL);
if (hdata)
{
HDATA_VAR(struct t_gui_window_tree, parent_node, POINTER, hdata_name);
HDATA_VAR(struct t_gui_window_tree, split_pct, INTEGER, NULL);
HDATA_VAR(struct t_gui_window_tree, split_horizontal, INTEGER, NULL);
HDATA_VAR(struct t_gui_window_tree, child1, POINTER, hdata_name);
HDATA_VAR(struct t_gui_window_tree, child2, POINTER, hdata_name);
HDATA_VAR(struct t_gui_window_tree, window, POINTER, "window");
HDATA_LIST(gui_windows_tree);
}
return hdata;
}
/*
* gui_window_add_to_infolist: add a window in an infolist
* return 1 if ok, 0 if error
*/
int
gui_window_add_to_infolist (struct t_infolist *infolist,
struct t_gui_window *window)
{
struct t_infolist_item *ptr_item;
if (!infolist || !window)
return 0;
ptr_item = infolist_new_item (infolist);
if (!ptr_item)
return 0;
if (!infolist_new_var_pointer (ptr_item, "pointer", window))
return 0;
if (!infolist_new_var_integer (ptr_item, "x", window->win_x))
return 0;
if (!infolist_new_var_integer (ptr_item, "y", window->win_y))
return 0;
if (!infolist_new_var_integer (ptr_item, "width", window->win_width))
return 0;
if (!infolist_new_var_integer (ptr_item, "height", window->win_height))
return 0;
if (!infolist_new_var_integer (ptr_item, "width_pct", window->win_width_pct))
return 0;
if (!infolist_new_var_integer (ptr_item, "height_pct", window->win_height_pct))
return 0;
if (!infolist_new_var_integer (ptr_item, "chat_x", window->win_chat_x))
return 0;
if (!infolist_new_var_integer (ptr_item, "chat_y", window->win_chat_y))
return 0;
if (!infolist_new_var_integer (ptr_item, "chat_width", window->win_chat_width))
return 0;
if (!infolist_new_var_integer (ptr_item, "chat_height", window->win_chat_height))
return 0;
if (!infolist_new_var_pointer (ptr_item, "buffer", window->buffer))
return 0;
if (!infolist_new_var_integer (ptr_item, "start_line_y",
((window->buffer->type == GUI_BUFFER_TYPE_FREE)
&& (window->scroll->start_line)) ?
window->scroll->start_line->data->y : 0))
return 0;
return 1;
}
/*
* gui_window_print_log: print window infos in log (usually for crash dump)
*/
void
gui_window_print_log ()
{
struct t_gui_window *ptr_window;
struct t_gui_window_scroll *ptr_scroll;
struct t_gui_bar_window *ptr_bar_win;
log_printf ("");
log_printf ("gui_windows . . . . . . . . . : 0x%lx", gui_windows);
log_printf ("last_gui_window . . . . . . . : 0x%lx", last_gui_window);
log_printf ("gui_current window. . . . . . : 0x%lx", gui_current_window);
log_printf ("gui_windows_tree. . . . . . . : 0x%lx", gui_windows_tree);
log_printf ("gui_window_layout_before_zoom : 0x%lx", gui_window_layout_before_zoom);
for (ptr_window = gui_windows; ptr_window; ptr_window = ptr_window->next_window)
{
log_printf ("");
log_printf ("[window (addr:0x%lx)]", ptr_window);
log_printf (" win_x . . . . . . . : %d", ptr_window->win_x);
log_printf (" win_y . . . . . . . : %d", ptr_window->win_y);
log_printf (" win_width . . . . . : %d", ptr_window->win_width);
log_printf (" win_height. . . . . : %d", ptr_window->win_height);
log_printf (" win_width_pct . . . : %d", ptr_window->win_width_pct);
log_printf (" win_height_pct. . . : %d", ptr_window->win_height_pct);
log_printf (" win_chat_x. . . . . : %d", ptr_window->win_chat_x);
log_printf (" win_chat_y. . . . . : %d", ptr_window->win_chat_y);
log_printf (" win_chat_width. . . : %d", ptr_window->win_chat_width);
log_printf (" win_chat_height . . : %d", ptr_window->win_chat_height);
log_printf (" win_chat_cursor_x . : %d", ptr_window->win_chat_cursor_x);
log_printf (" win_chat_cursor_y . : %d", ptr_window->win_chat_cursor_y);
log_printf (" refresh_needed. . . : %d", ptr_window->refresh_needed);
log_printf (" gui_objects . . . . : 0x%lx", ptr_window->gui_objects);
gui_window_objects_print_log (ptr_window);
log_printf (" buffer. . . . . . . : 0x%lx", ptr_window->buffer);
log_printf (" layout_plugin_name. : '%s'", ptr_window->layout_plugin_name);
log_printf (" layout_buffer_name. : '%s'", ptr_window->layout_buffer_name);
log_printf (" scroll. . . . . . . : 0x%lx", ptr_window->scroll);
log_printf (" ptr_tree. . . . . . : 0x%lx", ptr_window->ptr_tree);
log_printf (" prev_window . . . . : 0x%lx", ptr_window->prev_window);
log_printf (" next_window . . . . : 0x%lx", ptr_window->next_window);
for (ptr_scroll = ptr_window->scroll; ptr_scroll;
ptr_scroll = ptr_scroll->next_scroll)
{
log_printf ("");
log_printf (" [scroll (addr:0x%lx)]", ptr_scroll);
log_printf (" buffer. . . . . . . : 0x%lx", ptr_scroll->buffer);
log_printf (" first_line_displayed: %d", ptr_scroll->first_line_displayed);
log_printf (" start_line. . . . . : 0x%lx", ptr_scroll->start_line);
log_printf (" start_line_pos. . . : %d", ptr_scroll->start_line_pos);
log_printf (" scrolling . . . . . : %d", ptr_scroll->scrolling);
log_printf (" start_col . . . . . : %d", ptr_scroll->start_col);
log_printf (" lines_after . . . . : %d", ptr_scroll->lines_after);
log_printf (" reset_allowed . . . : %d", ptr_scroll->reset_allowed);
log_printf (" prev_scroll . . . . : 0x%lx", ptr_scroll->prev_scroll);
log_printf (" next_scroll . . . . : 0x%lx", ptr_scroll->next_scroll);
}
for (ptr_bar_win = ptr_window->bar_windows; ptr_bar_win;
ptr_bar_win = ptr_bar_win->next_bar_window)
{
gui_bar_window_print_log (ptr_bar_win);
}
}
}
|