Subversion Repositories Kolibri OS

Rev

Rev 7921 | Rev 7941 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
7921 leency 1
/*
2
	Quark Code Edit v0.2
3
	Author: Kiril Lipatov aka Leency
4
	Licence: GPLv2
5
 
6
	The core components of this app are:
7924 leency 7
		1. list: text grid with keyboard and mouse events
7921 leency 8
		2. lines: the mas of pointers for each line start
9
		3. selection
10
*/
11
 
12
#define MEMSIZE 1024*100
13
 
14
//===================================================//
15
//                                                   //
16
//                       LIB                         //
17
//                                                   //
18
//===================================================//
19
 
20
#include "../lib/io.h"
21
#include "../lib/gui.h"
22
#include "../lib/list_box.h"
23
#include "../lib/draw_buf.h"
24
#include "../lib/events.h"
25
#include "../lib/array.h"
26
#include "../lib/clipboard.h"
27
#include "../lib/math.h"
28
 
29
#include "../lib/obj/box_lib.h"
30
#include "../lib/obj/libini.h"
31
#include "../lib/obj/libimg.h"
32
#include "../lib/obj/iconv.h"
33
#include "../lib/obj/proc_lib.h"
34
 
35
#include "../lib/patterns/simple_open_dialog.h"
36
#include "../lib/patterns/toolbar_button.h"
37
 
38
//===================================================//
39
//                                                   //
40
//                 INTERNAL INCLUDES                 //
41
//                                                   //
42
//===================================================//
43
 
44
proc_info Form;
45
llist list;
46
 
47
#define TOOLBAR_H 38
48
#define TOOLBAR_ICON_WIDTH  24
49
#define TOOLBAR_ICON_HEIGHT 22
50
#define STATUSBAR_H 15
51
#define TAB_H 20
52
 
53
int user_encoding;
54
int real_encoding = CH_CP866;
55
int curcol_scheme;
56
int font_size;
57
 
58
#include "data.h"
59
 
60
#include "../txtread/search.h"
61
#include "selection.h"
62
#include "prepare_page.h"
63
 
64
//===================================================//
65
//                                                   //
66
//                       DATA                        //
67
//                                                   //
68
//===================================================//
69
 
70
scroll_bar scroll = { 15,200,398,44,0,2,115,15,0,0xeeeeee,
71
	0xBBBbbb,0xeeeeee,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1};
72
 
73
char title[4196];
74
 
75
bool help_opened = false;
76
 
77
int reopenin_mx,
78
    theme_mx,
79
    burger_mx,
80
    search_mx;
81
 
82
enum {
83
	CHANGE_CHARSET=12,
84
	REOPEN_IN_APP=1,
85
	COLOR_SCHEME=8,
86
	RMB_MENU,
87
	BTN_FIND_NEXT,
7924 leency 88
	BTN_FIND_CLOSE,
89
	BTN_CHANGE_CHARSET
7921 leency 90
};
91
 
92
dword menu_id;
93
 
94
EVENTS button;
95
EVENTS key;
96
 
97
//===================================================//
98
//                                                   //
99
//                       CODE                        //
100
//                                                   //
101
//===================================================//
102
 
103
void InitDlls()
104
{
105
	load_dll(boxlib,    #box_lib_init,   0);
106
	load_dll(libio,     #libio_init,     1);
107
	load_dll(libimg,    #libimg_init,    1);
108
	load_dll(libini,    #lib_init,       1);
109
	load_dll(iconv_lib, #iconv_open,     0);
110
	load_dll(Proc_lib,  #OpenDialog_init,0);
111
	OpenDialog_init stdcall (#o_dialog);
112
}
113
 
114
void LoadFileFromDocPack()
115
{
116
	dword bufsize = atoi(#param + 1) + 20;
117
	dword bufpointer = malloc(bufsize);
118
 
119
	ESDWORD[bufpointer+0] = 0;
120
	ESDWORD[bufpointer+4] = 8;
7924 leency 121
	IpcSetArea(bufpointer, bufsize);
7921 leency 122
 
123
	SetEventMask(EVM_IPC);
124
	if (@WaitEventTimeout(200) != evIPC) {
125
		notify("'IPC FAIL'E");
126
		return;
127
	}
128
 
129
	io.buffer_data = malloc(ESDWORD[bufpointer+12]);
130
	strcpy(io.buffer_data, bufpointer + 16);
131
}
132
 
133
void main()
134
{
135
	InitDlls();
136
	LoadIniSettings();
137
	EventSetColorScheme(curcol_scheme);
138
	if (param[0] == '*') {
139
		LoadFileFromDocPack();
140
		param[0]='\0';
141
		sprintf(#title, "#DOCPACK - %s", #short_app_name);
142
	} else {
143
		if (streq(#param,"-new")) {Form.left+=40;Form.top+=40;}
144
		LoadFile(#param);
145
	}
146
	SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER);
147
	loop()
148
	{
149
		switch(@WaitEventTimeout(400))
150
		{
151
			case evMouse:
152
				HandleMouseEvent();
153
				break;
154
			case evKey:
155
				HandleKeyEvent();
156
				break;
157
			case evButton:
158
				HandleButtonEvent();
159
				break;
160
			case evReDraw:
161
				if (CheckActiveProcess(Form.ID)) EventMenuClick();
162
				draw_window();
163
				break;
164
			default:
165
				DrawStatusBar(" "); //clean DrawStatusBar text with delay
166
		}
167
	}
168
}
169
 
170
//===================================================//
171
//                                                   //
172
//                  EVENT HANDLERS                   //
173
//                                                   //
174
//===================================================//
175
 
176
void HandleButtonEvent()
177
{
178
	int btn = GetButtonID();
179
	if (btn==1) {
180
		SaveIniSettings();
181
		ExitProcess();
182
	}
183
	button.press(btn);
184
	switch(btn-10)
185
	{
186
		case BTN_FIND_NEXT:
187
			EventSearchNext();
188
			break;
189
		case BTN_FIND_CLOSE:
190
			search.hide();
191
			break;
7924 leency 192
		case BTN_CHANGE_CHARSET:
193
			EventShowCharsetsList();
194
			break;
7921 leency 195
	}
196
}
197
 
198
void HandleKeyEvent()
199
{
200
	int new_y;
201
	if (help_opened) {
202
		help_opened = false;
203
		DrawPage();
204
		return;
205
	}
206
	GetKeys();
207
 
208
	if (key_modifier & KEY_LCTRL) || (key_modifier & KEY_RCTRL) {
209
		if (key.press(ECTRL + key_scancode)) return;
210
		switch (key_scancode)
211
		{
212
			case SCAN_CODE_KEY_X:
213
				EventCut();
214
				return;
215
			case SCAN_CODE_KEY_C:
216
				EventCopy();
217
				return;
218
			case SCAN_CODE_KEY_V:
219
				EventPaste();
220
				return;
221
			case SCAN_CODE_UP:
222
				EventMagnifyPlus();
223
				return;
224
			case SCAN_CODE_DOWN:
225
				EventMagnifyMinus();
226
				return;
227
			case SCAN_CODE_TAB:
228
				EventShowCharsetsList();
229
				return;
230
			case SCAN_CODE_KEY_F:
231
				search.show();
232
				return;
233
			case SCAN_CODE_KEY_A:
234
				selection.select_all();
235
				DrawPage();
236
				return;
237
		}
238
	}
239
	switch (key_scancode)
240
	{
241
		case SCAN_CODE_F1:
242
			EventShowInfo();
243
			return;
244
		case SCAN_CODE_ESC:
245
			search.hide();
246
			return;
247
		case SCAN_CODE_ENTER:
248
			if (! search_box.flags & ed_focus) return;
249
		case SCAN_CODE_F3:
250
			EventSearchNext();
251
			return;
252
	}
253
	if (search.edit_key()) {
254
		return;
7924 leency 255
	} else {
256
		if (key_modifier & KEY_LSHIFT) || (key_modifier & KEY_RSHIFT) selection.set_start();
257
		else selection.cancel();
258
		if (list.ProcessKey(key_scancode)) {
259
			if (key_modifier & KEY_LSHIFT) || (key_modifier & KEY_RSHIFT) selection.set_end();
260
			DrawPage();
261
		}
7921 leency 262
		return;
263
	}
7924 leency 264
	//EventInsertCharIntoText();
7921 leency 265
}
266
 
267
void HandleMouseEvent()
268
{
269
	mouse.get();
270
	list.wheel_size = 7;
271
	if (list.MouseScroll(mouse.vert)) {
7924 leency 272
		DrawPage();
7921 leency 273
		return;
274
	}
275
	if (!scroll.delta2) && (list.MouseOver(mouse.x, mouse.y)) {
276
		if (mouse.key&MOUSE_LEFT) {
277
 
278
			GetKeyModifier();
279
			if (key_modifier & KEY_LSHIFT) || (key_modifier & KEY_RSHIFT) {
7924 leency 280
				if (mouse.down) selection.set_start();
7921 leency 281
				list.ProcessMouse(mouse.x, mouse.y);
282
				if (mouse.up) selection.set_end();
283
				DrawPage();
284
				return;
285
			}
286
 
287
			list.ProcessMouse(mouse.x, mouse.y);
288
			if (mouse.down) {
7924 leency 289
				selection.cancel();
7921 leency 290
				selection.set_start();
291
			}
292
			selection.set_end();
293
			DrawPage();
294
		}
295
		if (mouse.key&MOUSE_RIGHT) && (mouse.up) {
296
			EventShowRmbMenu();
297
		}
298
		return;
299
	}
300
	scrollbar_v_mouse (#scroll);
301
	if (list.first != scroll.position) {
302
		list.first = scroll.position;
303
		DrawPage();
304
	}
305
	search.edit_mouse();
306
}
307
 
308
//===================================================//
309
//                                                   //
310
//                      EVENTS                       //
311
//                                                   //
312
//===================================================//
313
 
314
bool EventSearchNext()
315
{
316
	int new_y = search.find_next(list.first, theme.bg);
317
	if (new_y) {
318
		list.first = new_y / list.item_h;
319
		list.CheckDoesValuesOkey();
320
		DrawPage();
321
	}
322
}
323
 
324
void EventNewFile()
325
{
326
	RunProgram(#program_path, "-new");
327
}
328
 
329
void EventOpenDialog()
330
{
331
	OpenDialog_start stdcall (#o_dialog);
332
	if (o_dialog.status) {
333
		LoadFile(#openfile_path);
334
		ParseAndPaint();
335
	}
336
}
337
 
338
void EventSave()
339
{
340
	int res;
341
	char backy_param[4096];
342
	if (io.buffer_data) {
343
		io.dir.make("/tmp0/1/quark_backups");
344
		sprintf(#backy_param, "%s -o /tmp0/1/quark_backups", #param);
345
		io.run("/sys/develop/backy", #backy_param);
346
		if (! io.write(#param, io.buffer_data) ) {
347
			notify(FILE_SAVED_WELL);
348
		} else {
349
			notify(FILE_NOT_SAVED);
350
		}
351
	}
352
}
353
 
354
void EventShowFileInfo()
355
{
356
	char ss_param[4096];
357
	if (!param) return;
358
	strcpy(#ss_param, "-p ");
359
	strcpy(#ss_param+3, #param);
360
	RunProgram("/sys/File managers/Eolite", #ss_param);
361
}
362
 
363
void EventMagnifyMinus()
364
{
365
	SetSizes('S');
366
	ParseAndPaint();
367
}
368
 
369
void EventMagnifyPlus()
370
{
371
	SetSizes('M');
372
	ParseAndPaint();
373
}
374
 
375
void EventShowCharsetsList()
376
{
377
	menu_id = CHANGE_CHARSET;
378
	open_lmenu(Form.left + Form.cwidth, Form.top + skin_height
379
		+ Form.cheight - 6, MENU_ALIGN_BOT_RIGHT, user_encoding+1,
380
		"UTF-8\nKOI8-RU\nCP1251\nCP1252\nISO8859-5\nCP866\nAUTO");
381
}
382
 
383
void EventShowReopenMenu()
384
{
385
	menu_id = REOPEN_IN_APP;
7924 leency 386
	open_lmenu(Form.left+5 + reopenin_mx + 23, Form.top+29+skin_height,
387
		MENU_ALIGN_TOP_RIGHT, NULL,
7921 leency 388
		"Tinypad\nTextEdit\nWebView\nFB2Read\nHexView\nOther");
389
}
390
 
391
void EventShowThemesList()
392
{
393
	menu_id = COLOR_SCHEME;
7924 leency 394
	open_lmenu(Form.left+5 + theme_mx + 23,
7921 leency 395
		Form.top+29+skin_height, MENU_ALIGN_TOP_RIGHT,
396
		curcol_scheme+1, #color_scheme_names);
397
}
398
 
399
void EventShowRmbMenu()
400
{
401
	menu_id = RMB_MENU;
402
	open_lmenu(Form.left + mouse.x+4, Form.top + skin_height + mouse.y,
403
		MENU_ALIGN_TOP_LEFT, NULL, #rmb_menu);
404
}
405
 
406
 
407
void EventSetColorScheme(dword _setn)
408
{
409
	curcol_scheme = _setn;
410
	theme.bg      = color_schemes[curcol_scheme*5];
411
	theme.text    = color_schemes[curcol_scheme*5+1];
412
	scroll.bckg_col = theme.bg;
413
	scroll.frnt_col = scroll.line_col = color_schemes[curcol_scheme*5+2];
414
	selection.color = color_schemes[curcol_scheme*5+3];
415
	theme.cursor    = color_schemes[curcol_scheme*5+4];
416
	if (list.count) ParseAndPaint();
417
}
418
 
419
 
420
void EventShowInfo() {
421
	static dword shared_about;
422
	if (!shared_about) {
423
		shared_about = memopen("QUARK_ABOUT", sizeof(about)+1, SHM_OPEN_ALWAYS + SHM_READ);
424
		strcpy(shared_about, #about);
425
	}
426
	RunProgram("/sys/dialog", "-info 122 *QUARK_ABOUT");
427
}
428
 
429
void EventChangeCharset(dword id)
430
{
431
	if (param[0]=='\0') return;
432
	user_encoding = id;
433
	LoadFile(#openfile_path);
434
	ParseAndPaint();
435
	draw_window();
436
}
437
 
438
void EventOpenFileInOtherApp(dword _id)
439
{
440
	dword app;
441
	byte open_param[4096];
442
	switch(_id) {
443
		case 0: app = "/sys/tinypad"; break;
444
		case 1: app = "/sys/develop/t_edit"; break;
445
		case 2: app = "/sys/network/webview"; break;
446
		case 3: app = "/sys/fb2read"; break;
447
		case 4: app = "/sys/develop/heed"; break;
448
		case 5: open_param[0]='~';
449
			strcpy(#open_param+1,#param);
450
			RunProgram("/sys/@open", #open_param);
451
			return;
452
	}
453
	RunProgram(app, #param);
454
}
455
 
456
void EventMenuClick()
457
{
458
	dword click_id = get_menu_click();
459
 
460
	if (click_id) && (menu_id) switch(menu_id)
461
	{
462
		case CHANGE_CHARSET: EventChangeCharset(click_id-1); break;
463
		case REOPEN_IN_APP:  EventOpenFileInOtherApp(click_id-1); break;
464
		case COLOR_SCHEME:   EventSetColorScheme(click_id-1); break;
465
		case RMB_MENU:       EventRbmMenuClick(click_id-1); break;
466
		default: notify("'Error: wrong menu number'E");
467
	}
468
	menu_id = NULL;
469
}
470
 
471
void EventClickSearch()
472
{
473
	if (search.visible) {
474
		search.hide();
475
	} else {
476
		search.show();
477
	}
478
}
479
 
480
void EventInsertCharIntoText()
481
{
482
	dword cursor_pos = lines.get(list.cur_y) + list.cur_x;
483
 
484
	switch(key_scancode)
485
	{
486
		case SCAN_CODE_DOWN:
487
		case SCAN_CODE_UP:
488
		case SCAN_CODE_HOME:
489
		case SCAN_CODE_END:
490
		case SCAN_CODE_PGUP:
491
		case SCAN_CODE_PGDN:
492
		return;
493
		case SCAN_CODE_BS:
494
		case SCAN_CODE_DEL:
495
		notify("'Not supported yet'A");
496
		return;
497
	}
498
 
499
	if (list.cur_x >= list.column_max) return;
500
 
501
	ESBYTE[cursor_pos] = key_ascii;
502
	list.KeyRight();
503
	PaintVisible();
504
}
505
 
506
void EventOpenSysfuncs()
507
{
508
	if (io.run("/sys/docpack", "f") <= 0) {
509
		notify("'Can not open SysFunctions because\n/rd/1/docpack is not found!'E");
510
	}
511
}
512
 
513
void EventOpenPipet()
514
{
515
	io.run("/sys/develop/pipet", NULL);
516
}
517
 
518
void EventRbmMenuClick(dword id)
519
{
520
	switch(id) {
521
		case 0: EventCut(); break;
522
		case 1: EventCopy(); break;
523
		case 2: EventPaste(); break;
524
		case 3: EventRevealInFolder(); break;
525
		case 4: EventCopyFilePath(); break;
526
	}
527
}
528
 
529
void EventCut()
530
{
531
	//selection.copy();
532
}
533
 
534
void EventCopy()
535
{
536
	char copy_status_text[32];
537
 
538
	dword copy_buf;
539
	dword copy_len;
540
	dword copy_start;
541
	dword copy_end;
542
 
543
	if (selection.is_active()) {
544
		copy_start = selection.start_offset;
545
		copy_end = selection.end_offset;
546
		if (copy_start > copy_end) copy_start >< copy_end;
547
	} else {
548
		copy_start = lines.get(list.cur_y);
549
		copy_end = lines.get(list.cur_y+1);
550
	}
551
	copy_len = copy_end - copy_start;
552
	copy_buf = malloc(copy_len + 2);
553
	strncpy(copy_buf, copy_start, copy_len);
554
	ESBYTE[copy_buf+copy_len] = '\0';
555
	Clipboard__CopyText(copy_buf);
556
	free(copy_buf);
557
 
558
	sprintf(#copy_status_text, #copied_chars, copy_len);
559
	DrawStatusBar(#copy_status_text);
560
}
561
 
562
void EventPaste()
563
{
564
	//selection.copy();
565
}
566
 
567
void EventRevealInFolder()
568
{
569
	RunProgram("/sys/File managers/Eolite", #param);
570
}
571
 
572
void EventCopyFilePath()
573
{
574
	char copy_status_text[32];
575
	Clipboard__CopyText(#param);
576
	sprintf(#copy_status_text, #copied_chars, strlen(#param));
577
	DrawStatusBar(#copy_status_text);
578
}
579
 
580
//===================================================//
581
//                                                   //
582
//               DRAWS AND OTHER FUNCS               //
583
//                                                   //
584
//===================================================//
585
 
586
void EncodeToDos()
587
{
588
	real_encoding = user_encoding;
589
 
590
	// Autodetecting charset
591
	if (real_encoding == CH_AUTO) {
592
		real_encoding = CH_CP866;
593
		if (strstr(io.buffer_data, "\208\190")) real_encoding = CH_UTF8;
594
		else {
595
			if (chrnum(io.buffer_data, '\246')>5)
596
			|| (strstr(io.buffer_data, "пр")) real_encoding = CH_CP1251;
597
		}
598
	}
599
	if (real_encoding != CH_CP866)
600
		ChangeCharset(real_encoding, "CP866", io.buffer_data);
601
}
602
 
603
void LoadFile(dword f_path)
604
{
605
	if (io.buffer_data) free(io.buffer_data);
606
	if (ESBYTE[f_path]) {
607
		strcpy(#param, f_path);
608
		if (!io.read(#param)) goto NO_DATA;
609
		sprintf(#title, "%s - %s", #param, #short_app_name);
610
		EncodeToDos();
611
	}
612
	else {
613
		NO_DATA:
614
		io.buffer_data = malloc(sizeof(intro));
615
		strcpy(io.buffer_data, #intro);
616
		strcpy(#title, #short_app_name);
617
	}
618
	list.ClearList();
619
}
620
 
621
int AddTopBarButton(dword _event, _hotkey, char image_id, int x, pressed) {
622
	if (_hotkey) key.add_n(_hotkey, _event);
623
	return DrawTopPanelButton(button.add(_event), x, 5, image_id, pressed);
624
}
625
 
626
 
627
void DrawToolbar()
628
{
629
	#define SMALL_GAP 26+5
630
	#define BIG_GAP 26+18
631
	incn x;
632
	bool thema = false;
633
	bool reopa = false;
634
 
635
	bool serha = search.draw(BTN_FIND_NEXT+10, BTN_FIND_CLOSE+10, Form.cheight - SEARCH_H - STATUSBAR_H);
636
	if (menu_id == COLOR_SCHEME) thema = true;
637
	if (menu_id == REOPEN_IN_APP) reopa = true;
638
 
639
	DrawBar(0, 0, Form.cwidth, TOOLBAR_H - 1, sc.work);
640
	DrawBar(0, TOOLBAR_H - 1, Form.cwidth, 1, sc.work_graph);
641
 
642
	//AddTopBarButton(#EventNewFile,        ECTRL+SCAN_CODE_KEY_N, 2,  x.set(8),         false);
643
	AddTopBarButton(#EventOpenDialog,     ECTRL+SCAN_CODE_KEY_O, 0,  x.set(8), false);
644
	//AddTopBarButton(#EventSave,           ECTRL+SCAN_CODE_KEY_S, 5,  x.inc(SMALL_GAP), false);
645
	AddTopBarButton(#EventShowFileInfo,   ECTRL+SCAN_CODE_KEY_I, 10, x.inc(SMALL_GAP), false);
7924 leency 646
	AddTopBarButton(#EventMagnifyMinus,   ECTRL+SCAN_CODE_MINUS, 33, x.inc(BIG_GAP),   false);
647
	AddTopBarButton(#EventMagnifyPlus,    ECTRL+SCAN_CODE_PLUS,  32, x.inc(SMALL_GAP), false);
7921 leency 648
	AddTopBarButton(#EventClickSearch,    ECTRL+SCAN_CODE_KEY_F, 49, x.inc(BIG_GAP),   serha);  search_mx = EAX;
649
	x.set(Form.cwidth-4);
7924 leency 650
	//AddTopBarButton(#EventShowInfo,       NULL,                  -1, x.inc(-SMALL_GAP), false); burger_mx = EAX;
651
	AddTopBarButton(#EventShowThemesList, NULL,                  40, x.inc(-SMALL_GAP), thema); theme_mx = EAX;
7921 leency 652
	AddTopBarButton(#EventShowReopenMenu, ECTRL+SCAN_CODE_KEY_E, 16, x.inc(-SMALL_GAP),   reopa); reopenin_mx = EAX;
653
	//AddTopBarButton(#EventOpenSysfuncs,   NULL,                  18, x.inc(-SMALL_GAP), false);
654
	//AddTopBarButton(#EventOpenPipet,      NULL,                  39, x.inc(-SMALL_GAP), false);
655
}
656
 
657
void DrawStatusBar(dword _in_text)
658
{
659
	static char status_text[64];
660
	if (Form.status_window>2) return;
661
	if (_in_text) strncpy(#status_text, _in_text, sizeof(status_text));
662
	DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,1, sc.work_graph);
663
	DrawBar(0,Form.cheight - STATUSBAR_H+1, Form.cwidth,STATUSBAR_H-1, sc.work);
664
	WriteText(5, Form.cheight - STATUSBAR_H + 4, 0x80, sc.work_text, #status_text);
7924 leency 665
	if (param[0]) {
666
		WriteTextCenter(Form.cwidth-70, Form.cheight - STATUSBAR_H + 4,
667
			60, sc.work_text, real_encoding*10+#charsets);
668
		DefineHiddenButton(Form.cwidth-70, Form.cheight - STATUSBAR_H + 1,
669
			60, 12, BTN_CHANGE_CHARSET+10);
670
	}
7921 leency 671
}
672
 
673
void draw_window()
674
{
675
	int old_w = list.w;
676
	DefineAndDrawWindow(Form.left,Form.top,Form.width,Form.height,0x73,0,#title,0);
677
	GetProcessInfo(#Form, SelfInfo);
678
	sc.get();
679
	if (Form.status_window>2) return;
680
	if (Form.width  < 430) { MoveSize(OLD,OLD,430,OLD); return; }
681
	if (Form.height < 200) { MoveSize(OLD,OLD,OLD,200); return; }
682
 
683
	button.init(40);
684
	key.init(40);
685
 
686
	SetSizes(font_size);
687
 
688
	if ((list.w == old_w) && (list.count)) {
689
		DrawPage();
690
	} else {
691
		ParseAndPaint();
692
	}
693
 
694
	DrawToolbar();
695
	DrawStatusBar(NULL);
696
}
697
 
698
void DrawPage()
699
{
700
	scroll.max_area = list.count;
701
	scroll.cur_area = list.visible;
702
	scroll.position = list.first;
703
	scroll.all_redraw = 0;
704
	scroll.start_x = list.x + list.w;
705
	scroll.start_y = list.y;
706
	scroll.size_y = list.h;
707
	scrollbar_v_draw(#scroll);
708
 
709
	DrawRectangle(scroll.start_x, scroll.start_y, scroll.size_x,
710
		scroll.size_y-1, scroll.bckg_col);
711
	PaintVisible();
712
}
713
 
714
 
715
void SetSizes(char _size)
716
{
717
	font_size = _size;
718
	if (font_size == 'S') list.SetFont(6, 9, 00001000b);
719
	if (font_size == 'M') list.SetFont(8, 14, 00011000b);
720
	list.item_w = list.font_w;
721
	list.horisontal_selelection = true;
722
	list.SetSizes(0, TOOLBAR_H, Form.cwidth-scroll.size_x-1,
723
		Form.cheight - TOOLBAR_H - search.height() - STATUSBAR_H /*- TAB_H*/,
724
		math.round(list.font_h * 1.4));
725
}