Subversion Repositories Kolibri OS

Rev

Rev 5962 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5962 Rev 5980
1
#define MEMSIZE 4096*25
1
#define MEMSIZE 4096*25
2
 
2
 
3
#include "../lib/font.h"
3
#include "../lib/font.h"
4
#include "../lib/io.h"
4
#include "../lib/io.h"
5
#include "../lib/gui.h"
5
#include "../lib/gui.h"
6
#include "../lib/list_box.h"
6
#include "../lib/list_box.h"
7
#include "../lib/obj/box_lib.h"
7
#include "../lib/obj/box_lib.h"
8
#include "../lib/obj/libini.h"
8
#include "../lib/obj/libini.h"
9
#include "../lib/obj/iconv.h"
9
#include "../lib/obj/iconv.h"
10
#include "../lib/obj/proc_lib.h"
10
#include "../lib/obj/proc_lib.h"
11
#include "../lib/patterns/libimg_load_skin.h"
11
#include "../lib/patterns/libimg_load_skin.h"
12
#include "../lib/patterns/simple_open_dialog.h"
12
#include "../lib/patterns/simple_open_dialog.h"
13
 
13
 
14
#define TOOLBAR_H 34
14
#define TOOLBAR_H 34
15
#define TOOLBAR_ICON_WIDTH  26
15
#define TOOLBAR_ICON_WIDTH  26
16
#define TOOLBAR_ICON_HEIGHT 24
16
#define TOOLBAR_ICON_HEIGHT 24
17
 
-
 
18
#define TOOLBAR_OPEN_FILE_LEFT       8
-
 
19
#define TOOLBAR_MAGNIFY_PLUS_LEFT    42
-
 
20
#define TOOLBAR_MAGNIFY_MINUS_LEFT   67
-
 
21
#define TOOLBAR_CHANGE_ENCODING_LEFT 101
-
 
22
#define TOOLBAR_RUN_EDIT_LEFT        135
-
 
23
 
17
 
24
#define DEFAULT_FONT   "/sys/fonts/Tahoma.kf"
18
#define DEFAULT_FONT   "/sys/fonts/Tahoma.kf"
25
#define DEFAULT_EDITOR "/sys/tinypad"
19
#define DEFAULT_EDITOR "/sys/tinypad"
26
 
20
 
27
#define INTRO_TEXT "This is a plain text reader.\nTry to open some text file."
21
#define INTRO_TEXT "This is a plain Text Reader.\nTry to open some text file."
28
#define VERSION "Text Reader v1.02"
22
#define VERSION "Text Reader v1.03"
29
#define ABOUT "Idea: Leency, punk_joker
23
#define ABOUT "Idea: Leency, punk_joker
30
Code: Leency, Veliant, KolibriOS Team
24
Code: Leency, Veliant, KolibriOS Team
31
 
25
 
32
Hotkeys:
26
Hotkeys:
33
Ctrl+O - open file
27
Ctrl+O - open file
34
Ctrl+Up - bigger font
28
Ctrl+Up - bigger font
35
Ctrl+Down - smaller font
29
Ctrl+Down - smaller font
36
Ctrl+Tab - select charset
30
Ctrl+Tab - select charset
37
Ctrl+E - edit current document
31
Ctrl+E - edit current document
38
 
32
 
39
Press any key..."
33
Press any key..."
40
 
34
 
41
char default_dir[] = "/rd/1";
35
char default_dir[] = "/rd/1";
42
od_filter filter2 = {0,0};
36
od_filter filter2 = {0,0};
43
 
37
 
44
scroll_bar scroll = { 15,200,398,44,0,2,115,15,0,0xeeeeee,0xBBBbbb,0xeeeeee,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1};
38
scroll_bar scroll = { 15,200,398,44,0,2,115,15,0,0xeeeeee,0xBBBbbb,0xeeeeee,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1};
45
llist list;
39
llist list;
46
 
40
 
47
proc_info Form;
41
proc_info Form;
48
char title[4196];
42
char title[4196];
49
 
43
 
50
byte help_opened = false;
44
byte help_opened = false;
51
 
-
 
52
char char_width[255];
-
 
53
dword line_offset;
-
 
54
#define DWORD 4;
-
 
55
 
45
 
56
enum {
46
enum {
57
	OPEN_FILE,
47
	OPEN_FILE,
58
	MAGNIFY_MINUS,
48
	MAGNIFY_MINUS,
59
	MAGNIFY_PLUS,
49
	MAGNIFY_PLUS,
60
	CHANGE_ENCODING,
50
	CHANGE_ENCODING,
61
	RUN_EDIT,
51
	RUN_EDIT,
62
	SHOW_INFO,
52
	SHOW_INFO,
63
};
53
};
64
 
54
 
65
#include "ini.h"
55
#include "ini.h"
66
#include "menu.h"
56
#include "menu.h"
-
 
57
#include "gui.h"
-
 
58
#include "prepare_page.h"
-
 
59
 
67
 
60
 
68
void InitDlls()
61
void InitDlls()
69
{
62
{
70
	load_dll(boxlib,    #box_lib_init,   0);
63
	load_dll(boxlib,    #box_lib_init,   0);
71
	load_dll(libio,     #libio_init,     1);
64
	load_dll(libio,     #libio_init,     1);
72
	load_dll(libimg,    #libimg_init,    1);
65
	load_dll(libimg,    #libimg_init,    1);
73
	load_dll(libini,    #lib_init,       1);
66
	load_dll(libini,    #lib_init,       1);
74
	load_dll(iconv_lib, #iconv_open,     0);
67
	load_dll(iconv_lib, #iconv_open,     0);
75
	load_dll(Proc_lib,  #OpenDialog_init,0);
68
	load_dll(Proc_lib,  #OpenDialog_init,0);
76
}
69
}
77
 
-
 
78
void EventShowInfo()
-
 
79
{
-
 
80
	ShowAbout();
-
 
81
}
70
 
82
 
71
 
83
void EventOpenFile()
-
 
84
{
-
 
85
	OpenDialog_start stdcall (#o_dialog);
72
void main()
86
	OpenFile(#openfile_path);
-
 
87
	PreparePage();
73
{   	
88
}
74
	InitDlls();
89
 
75
	
90
void EventMagnifyPlus()
76
	OpenDialog_init stdcall (#o_dialog);
-
 
77
	
-
 
78
	font.no_bg_copy = true;
91
{
79
	font.color      = 0;
92
	font.size.text++;
80
	font.bg_color   = 0xFFFFFF;
-
 
81
	
-
 
82
	font.load(DEFAULT_FONT);
93
	if(!font.changeSIZE())
83
	
94
		font.size.text--;
84
	if (!font.data) {
-
 
85
		io.run("/sys/@notify","'Error: Font is not loaded.' -E");
-
 
86
		ExitProcess();
95
	else
87
	}
-
 
88
	
-
 
89
	Libimg_LoadImage(#skin, abspath("toolbar.png"));
-
 
90
	
-
 
91
	LoadIniSettings();
-
 
92
	
96
		PreparePage();
93
	OpenFile(#param);
97
}
94
	list.no_selection = true;
-
 
95
	SetEventMask(10000000000000000000000001100111b);
-
 
96
	loop()
98
 
97
	{
-
 
98
		switch(WaitEvent())
-
 
99
		{
99
void EventMagnifyMinus()
100
			case evMouse:
-
 
101
				HandleMouseEvent();
-
 
102
				break;
-
 
103
			case evKey:
100
{
104
				HandleKeyEvent();
-
 
105
				break;
-
 
106
			case evButton:
-
 
107
				HandleButtonEvent();
101
	font.size.text--;
108
				break;
-
 
109
			case evReDraw:
-
 
110
				if (action_buf) {
-
 
111
					OpenFile(#param); 
102
	if(!font.changeSIZE())
112
					PreparePage();
103
		font.size.text++;
-
 
104
	else
-
 
105
		PreparePage();
-
 
106
}
-
 
107
 
113
					action_buf = false;
108
void EventRunEdit()
-
 
109
{
-
 
110
	io.run(DEFAULT_EDITOR, #param);
-
 
111
}
-
 
112
 
114
				};
-
 
115
				draw_window();
113
void EventChangeEncoding()
116
		}
114
{
117
	}
115
	CreateThread(#menu_rmb,#stak+4092);
118
}
116
}
119
 
117
 
120
 
118
void HandleMouseEvent()
121
void HandleButtonEvent()
119
{
122
{
120
	mouse.get();
123
	
-
 
124
	byte btn = GetButtonID();
-
 
125
	if (btn==1) {
-
 
126
		SaveIniSettings();
-
 
127
		ExitProcess();
-
 
128
	}
-
 
129
	btn-=10;
-
 
130
	switch(btn)
121
	list.wheel_size = 7;
131
	{
-
 
132
		case OPEN_FILE:
-
 
133
			EventOpenFile();
122
	if (list.MouseScroll(mouse.vert)) {
134
			break;
-
 
135
		case MAGNIFY_PLUS:
-
 
136
			EventMagnifyPlus();
123
		DrawPage(); 
137
			break;
-
 
138
		case MAGNIFY_MINUS:
-
 
139
			EventMagnifyMinus();
-
 
140
			break;
-
 
141
		case CHANGE_ENCODING:
-
 
142
			EventChangeEncoding();
-
 
143
			break;
124
		return; 
144
		case RUN_EDIT:
125
	}
145
			EventRunEdit();
126
	scrollbar_v_mouse (#scroll);
146
			break;
127
	if (list.first != scroll.position) {
147
		case SHOW_INFO:
128
		list.first = scroll.position;
148
			EventShowInfo();
129
		DrawPage(); 
149
			break;
130
	}
150
	}
131
}
151
}
-
 
152
 
132
 
153
 
133
void HandleKeyEvent()
154
void HandleKeyEvent()
134
{
155
{
135
	if (help_opened) {
156
	if (help_opened) {
136
		help_opened = false;
157
		help_opened = false;
137
		DrawPage();
158
		DrawPage();
138
		return; 
159
		return; 
139
	}
160
	}
140
	GetKeys();
161
	GetKeys();
141
	if (key_scancode==059) {
162
	if (key_scancode==059) {
142
		EventShowInfo();
163
		EventShowInfo();
143
		return;
164
		return;
144
	}
165
	}
145
	if (key_modifier & KEY_LCTRL) || (key_modifier & KEY_RCTRL) {
166
	if (key_modifier & KEY_LCTRL) || (key_modifier & KEY_RCTRL) {
146
		switch (key_scancode)
167
		switch (key_scancode)
147
		{
168
		{
148
			case 024:
169
			case 024:
149
				EventOpenFile();
170
				EventOpenFile();
150
				break;
171
				break;
151
			case SCAN_CODE_UP:
172
			case SCAN_CODE_UP:
152
				EventMagnifyPlus();
173
				EventMagnifyPlus();
153
				break;
174
				break;
154
			case SCAN_CODE_DOWN:
175
			case SCAN_CODE_DOWN:
155
				EventMagnifyMinus();
176
				EventMagnifyMinus();
156
				break;
177
				break;
157
			case 018:
178
			case 018:
158
				EventRunEdit();
179
				EventRunEdit();
159
				break;
180
				break;
160
			case SCAN_CODE_TAB:
181
			case SCAN_CODE_TAB:
161
				EventChangeEncoding();
182
				EventChangeEncoding();
162
				break;
183
				break;
163
		}
184
		}
164
		return;
185
		return;
165
	}
186
	}
166
	if (list.ProcessKey(key_scancode))
187
	if (list.ProcessKey(key_scancode))
167
		DrawPage();
188
		DrawPage();
168
}
189
}
169
 
-
 
170
void HandleButtonEvent()
-
 
171
{
190
 
172
	
-
 
173
	byte btn = GetButtonID();
-
 
174
	if (btn==1) {
-
 
175
		SaveIniSettings();
-
 
176
		ExitProcess();
-
 
177
	}
-
 
178
	btn-=10;
191
 
179
	switch(btn)
192
void HandleMouseEvent()
180
	{
193
{
181
		case OPEN_FILE:
-
 
182
			EventOpenFile();
-
 
183
			break;
194
	mouse.get();
184
		case MAGNIFY_PLUS:
195
	list.wheel_size = 7;
185
			EventMagnifyPlus();
-
 
186
			break;
-
 
187
		case MAGNIFY_MINUS:
196
	if (list.MouseScroll(mouse.vert)) {
188
			EventMagnifyMinus();
-
 
189
			break;
-
 
190
		case CHANGE_ENCODING:
197
		DrawPage(); 
191
			EventChangeEncoding();
198
		return; 
192
			break;
199
	}
193
		case RUN_EDIT:
-
 
194
			EventRunEdit();
-
 
195
			break;
200
	scrollbar_v_mouse (#scroll);
196
		case SHOW_INFO:
201
	if (list.first != scroll.position) {
197
			EventShowInfo();
202
		list.first = scroll.position;
198
			break;
203
		DrawPage(); 
199
	}
204
	}
200
}
205
}
-
 
206
 
-
 
207
 
-
 
208
/* ----------------------------------------------------- */
201
 
209
 
202
void main()
210
void EventOpenFile()
-
 
211
{
-
 
212
	OpenDialog_start stdcall (#o_dialog);
203
{   	
213
	OpenFile(#openfile_path);
-
 
214
	PreparePage();
-
 
215
}
-
 
216
 
-
 
217
void EventMagnifyPlus()
204
	InitDlls();
218
{
-
 
219
	font.size.text++;
-
 
220
	if(!font.changeSIZE())
-
 
221
		font.size.text--;
-
 
222
	else
-
 
223
		PreparePage();
-
 
224
}
205
	
225
 
206
	OpenDialog_init stdcall (#o_dialog);
226
void EventMagnifyMinus()
207
	
227
{
-
 
228
	font.size.text--;
-
 
229
	if(!font.changeSIZE())
-
 
230
		font.size.text++;
-
 
231
	else
-
 
232
		PreparePage();
208
	font.no_bg_copy = true;
233
}
-
 
234
 
209
	font.color      = 0;
235
void EventRunEdit()
-
 
236
{
210
	font.bg_color   = 0xFFFFFF;
237
	io.run(DEFAULT_EDITOR, #param);
211
	
-
 
212
	font.load(DEFAULT_FONT);
238
}
-
 
239
 
-
 
240
void EventChangeEncoding()
213
	
241
{
-
 
242
	CreateThread(#menu_rmb,#stak+4092);
-
 
243
}
-
 
244
 
214
	if (!font.data) {
245
void EventShowInfo() {
215
		io.run("/sys/@notify","'Error: Font is not loaded.' -E");
-
 
216
		ExitProcess();
-
 
217
	}
-
 
218
	
-
 
219
	Libimg_LoadImage(#skin, abspath("toolbar.png"));
246
	help_opened = true;
220
	
247
	DrawBar(list.x, list.y, list.w, list.h, 0xFFFfff);
221
	LoadIniSettings();
248
	WriteText(list.x + 10, list.y + 10, 10000001b, 0x555555, VERSION);
222
	
-
 
223
	OpenFile(#param);
-
 
224
	list.no_selection = true;
249
	WriteTextLines(list.x + 10, list.y+40, 10110000b, 0, ABOUT, 20);
225
	SetEventMask(10000000000000000000000001100111b);
-
 
226
	loop()
250
}
227
	{
-
 
228
		switch(WaitEvent())
-
 
229
		{
251
 
230
			case evMouse:
-
 
231
				HandleMouseEvent();
252
/* ------------------------------------------- */
232
				break;
-
 
233
			case evKey:
253
 
234
				HandleKeyEvent();
-
 
235
				break;
254
 
236
			case evButton:
-
 
237
				HandleButtonEvent();
-
 
238
				break;
255
void OpenFile(dword f_path) 
-
 
256
{
-
 
257
	int tmp;
-
 
258
	if (ESBYTE[f_path]) {
-
 
259
		strcpy(#param, f_path);
239
			case evReDraw:
260
		io.read(#param);
-
 
261
		strcpy(#title, #param);
-
 
262
		strcat(#title, " - Text Reader"); 
-
 
263
	}
240
				if (action_buf) {
264
	else {
241
					OpenFile(#param); 
265
		if (list.count) return;
242
					PreparePage();
266
		io.buffer_data = INTRO_TEXT;
243
					action_buf = false;
267
		strcpy(#title, "Text Reader"); 
244
				};
268
	}
245
				draw_window();
269
	if (encoding!=CH_CP866) ChangeCharset(charsets[encoding], "CP866", io.buffer_data);
246
		}
270
	list.KeyHome();
247
	}
271
	list.ClearList();
248
}
272
}
249
 
273
 
250
void draw_window()
274
void draw_window()
251
{
275
{
252
	DefineAndDrawWindow(Form.left,Form.top,Form.width,Form.height,0x73,0,#title);
276
	DefineAndDrawWindow(Form.left,Form.top,Form.width,Form.height,0x73,0,#title);
253
	GetProcessInfo(#Form, SelfInfo);
277
	GetProcessInfo(#Form, SelfInfo);
254
	if (Form.status_window>2) return;
278
	if (Form.status_window>2) return;
255
 
279
 
256
	if (Form.width  < 200) { MoveSize(OLD,OLD,200,OLD); return; }
280
	if (Form.width  < 200) { MoveSize(OLD,OLD,200,OLD); return; }
257
	if (Form.height < 200) { MoveSize(OLD,OLD,OLD,200); return; }
281
	if (Form.height < 200) { MoveSize(OLD,OLD,OLD,200); return; }
258
	
282
	
259
	DrawBar(0, 0, Form.cwidth, TOOLBAR_H - 1, 0xe1e1e1);
283
	DrawBar(0, 0, Form.cwidth, TOOLBAR_H - 1, 0xe1e1e1);
260
	DrawBar(0, TOOLBAR_H - 1, Form.cwidth, 1, 0x7F7F7F);
284
	DrawBar(0, TOOLBAR_H - 1, Form.cwidth, 1, 0x7F7F7F);
261
	
285
	
262
	DrawToolbarButton(OPEN_FILE,       TOOLBAR_OPEN_FILE_LEFT);
286
	DrawToolbarButton(OPEN_FILE,       8);
263
	DrawToolbarButton(MAGNIFY_PLUS,    TOOLBAR_MAGNIFY_PLUS_LEFT);
287
	DrawToolbarButton(MAGNIFY_PLUS,    42);
264
	DrawToolbarButton(MAGNIFY_MINUS,   TOOLBAR_MAGNIFY_MINUS_LEFT);
288
	DrawToolbarButton(MAGNIFY_MINUS,   67);
265
	DrawToolbarButton(CHANGE_ENCODING, TOOLBAR_CHANGE_ENCODING_LEFT);
289
	DrawToolbarButton(CHANGE_ENCODING, 101);
266
	DrawToolbarButton(RUN_EDIT,        TOOLBAR_RUN_EDIT_LEFT);
290
	DrawToolbarButton(RUN_EDIT,        135);
267
	DrawToolbarButton(SHOW_INFO,       Form.cwidth - 34);
291
	DrawToolbarButton(SHOW_INFO,       Form.cwidth - 34);
268
	
292
	
269
	if ((Form.cwidth-scroll.size_x-1 == list.w) && 
293
	if ((Form.cwidth-scroll.size_x-1 == list.w) && 
270
		(Form.cheight-TOOLBAR_H == list.h) && 
294
		(Form.cheight-TOOLBAR_H == list.h) && 
271
		(list.count) 
295
		(list.count) 
272
	)
296
	)
273
	{
297
	{
274
		DrawPage(); 
298
		DrawPage(); 
275
	} else {
299
	} else {
276
		PreparePage();
300
		PreparePage();
277
	}
301
	}
278
	DrawRectangle(scroll.start_x, scroll.start_y, scroll.size_x, scroll.size_y-1, scroll.bckg_col);
302
	DrawRectangle(scroll.start_x, scroll.start_y, scroll.size_x, scroll.size_y-1, scroll.bckg_col);
279
}
303
}
280
 
304
 
281
void DrawPage()
305
void DrawPage()
282
{
306
{
283
	_PutImage(list.x,list.y,list.w,list.h,list.first*list.item_h*list.w*3 + font.buffer);
307
	_PutImage(list.x,list.y,list.w,list.h,list.first*list.item_h*list.w*3 + font.buffer);
284
	DrawScroller();
308
	DrawScroller();
285
}
309
}
286
 
-
 
287
void PreparePage() 
-
 
288
{
-
 
289
	char line[4096]=0;
-
 
290
	dword line_start;
-
 
291
	byte ch;
-
 
292
	dword bufoff;
-
 
293
	dword line_length=30;
-
 
294
	dword stroka_y = 5;
-
 
295
	dword stroka=0;
-
 
296
	int i, srch_pos;
-
 
297
	
-
 
298
	font.changeSIZE();
-
 
299
	list.w = Form.cwidth-scroll.size_x-1;
-
 
300
	//get font chars width, need to increase performance
-
 
301
	for (i=0; i<256; i++) char_width[i] = font.symbol_size(i);
-
 
302
	//get font buffer height
-
 
303
	for (bufoff=io.buffer_data; ESBYTE[bufoff]; bufoff++)
-
 
304
	{
-
 
305
		ch = ESBYTE[bufoff];
-
 
306
		line_length += char_width[ch];
-
 
307
		if (line_length>=list.w) || (ch==10) {
-
 
308
			srch_pos = bufoff;
-
 
309
			loop()
-
 
310
			{
-
 
311
				if (__isWhite(ESBYTE[srch_pos])) { bufoff=srch_pos+1; break; } //normal word-break
-
 
312
				if (srch_pos == line_start) break; //no white space found in whole line
-
 
313
				srch_pos--;
-
 
314
			}
-
 
315
			line_start = bufoff;
-
 
316
			line_length = 30;
-
 
317
			stroka++;
-
 
318
		}
-
 
319
	}
-
 
320
	//draw text in buffer
-
 
321
	list.count = stroka+2;
-
 
322
	list.SetSizes(0, TOOLBAR_H, list.w, Form.cheight-TOOLBAR_H, font.size.text+1);
-
 
323
	if (list.count < list.visible) list.count = list.visible;
-
 
324
 
-
 
325
	font.size.height = list.count+1*list.item_h;
-
 
326
	font.buffer_size = 0;
-
 
327
 
-
 
328
	line_length = 30;
-
 
329
	line_start = io.buffer_data;
-
 
330
	for (bufoff=io.buffer_data; ESBYTE[bufoff]; bufoff++)
-
 
331
	{
-
 
332
		ch = ESBYTE[bufoff];
-
 
333
		line_length += char_width[ch];
-
 
334
		if (line_length>=list.w) || (ch==10)
-
 
335
		{
-
 
336
			//set word break
-
 
337
			srch_pos = bufoff;
-
 
338
			loop()
-
 
339
			{
-
 
340
				if (__isWhite(ESBYTE[srch_pos])) { bufoff=srch_pos+1; break; } //normal word-break
-
 
341
				if (srch_pos == line_start) break; //no white space found in whole line
-
 
342
				srch_pos--;
-
 
343
			}
-
 
344
			i = bufoff-line_start;
-
 
345
			strlcpy(#line, line_start, i);
-
 
346
			font.prepare_buf(8,stroka_y,list.w,font.size.height, #line);
-
 
347
			stroka_y += list.item_h;
-
 
348
			line_start = bufoff;
-
 
349
			line_length = 30;
-
 
350
		}
-
 
351
	}
-
 
352
	font.prepare_buf(8,stroka_y,list.w,font.size.height, line_start);
-
 
353
	SmoothFont(font.buffer, font.size.width, font.size.height);
-
 
354
	DrawPage();
-
 
355
}
-
 
356
 
-
 
357
void DrawToolbarButton(char image_id, int x)
-
 
358
{
-
 
359
	DefineButton(x, 5, TOOLBAR_ICON_WIDTH-1, TOOLBAR_ICON_HEIGHT-1, 10+image_id + BT_HIDE, 0);
-
 
360
	img_draw stdcall(skin.image, x, 5, TOOLBAR_ICON_WIDTH, TOOLBAR_ICON_HEIGHT, 0, image_id*TOOLBAR_ICON_HEIGHT);
-
 
361
}
-
 
362
 
-
 
363
void DrawScroller()
-
 
364
{
-
 
365
	scroll.max_area = list.count;
-
 
366
	scroll.cur_area = list.visible;
-
 
367
	scroll.position = list.first;
-
 
368
	scroll.all_redraw = 0;
-
 
369
	scroll.start_x = list.x + list.w;
-
 
370
	scroll.start_y = list.y;
-
 
371
	scroll.size_y = list.h;
-
 
372
	scroll.start_x = list.x + list.w;
-
 
373
	scrollbar_v_draw(#scroll);
-
 
374
}
-
 
375
 
-
 
376
void OpenFile(dword f_path) 
-
 
377
{
-
 
378
	int tmp;
-
 
379
	if (ESBYTE[f_path]) {
-
 
380
		strcpy(#param, f_path);
-
 
381
		io.read(#param);
-
 
382
		strcpy(#title, #param);
-
 
383
		strcat(#title, " - Text Reader"); 
-
 
384
	}
-
 
385
	else {
-
 
386
		if (list.count) return;
-
 
387
		io.buffer_data = INTRO_TEXT;
-
 
388
		strcpy(#title, "Text Reader"); 
-
 
389
	}
-
 
390
	if (encoding!=CH_CP866) ChangeCharset(charsets[encoding], "CP866", io.buffer_data);
-
 
391
	list.KeyHome();
-
 
392
	list.ClearList();
-
 
393
}
-
 
394
 
-
 
395
ShowAbout() {
-
 
396
	help_opened = true;
-
 
397
	DrawBar(list.x, list.y, list.w, list.h, 0xFFFfff);
-
 
398
	WriteText(list.x + 10, list.y + 10, 10000001b, 0x555555, VERSION);
-
 
399
	WriteTextLines(list.x + 10, list.y+40, 10110000b, 0, ABOUT, 20);
-
 
400
}
-