Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
9396 leency 1
#define MEMSIZE 1024*100
2
 
3
#include "../lib/gui.h"
4
#include "../lib/random.h"
5
#include "../lib/mem.h"
6
#include "../lib/cursor.h"
7
#include "../lib/list_box.h"
8
#include "../lib/events.h"
9
 
10
#include "../lib/obj/libimg.h"
11
#include "../lib/obj/box_lib.h"
12
#include "../lib/obj/proc_lib.h"
13
 
14
#include "../lib/patterns/rgb.h"
15
#include "../lib/patterns/toolbar_button.h"
16
#include "../lib/patterns/simple_open_dialog.h"
17
 
18
//===================================================//
19
//                                                   //
20
//                       DATA                        //
21
//                                                   //
22
//===================================================//
23
 
9632 leency 24
//Sizes
9597 leency 25
#define PAD 13
9632 leency 26
#define TOOLBAR_ITEM_H PAD + PAD
9597 leency 27
#define TOOLBAR_W 132
28
#define STATUSBAR_H 20
9632 leency 29
#define HEADERH TOOLBAR_ITEM_H + 14
9633 leency 30
#define HEADER_TEXTY HEADERH - 14 / 2
9632 leency 31
#define CANVASX TOOLBAR_W + PAD + PAD
32
#define CANVASY HEADERH + 2
9396 leency 33
 
9632 leency 34
// Colors
35
#define COL_WORK        0x242424
36
#define COL_WORK_TEXT   0xBEBEBE
37
#define COL_LIGHT       0x424242
38
#define COL_DARK        0x1D1D1D
39
#define COL_LINE        0x010101
40
#define COL_BUTTON      0x181818
41
#define COL_BUTTON_TEXT 0x18A2CC
9396 leency 42
 
9632 leency 43
block canvas = { CANVASX, CANVASY, NULL, NULL };
44
 
9396 leency 45
EVENTS button;
46
EVENTS key;
47
 
48
proc_info Form;
9633 leency 49
int pressed_button_id;
9396 leency 50
 
9585 vitalkrilo 51
char default_dir[4096] = "/sys";
9396 leency 52
od_filter filter2 = { 69, "BMP\0GIF\0ICO\0CUR\0JPEG\0JPG\0PNG\0PNM\0TGA\0TIFF\0TIF\0WBMP\0XBM\0XCF\Z80\0\0" };
53
 
54
libimg_image icons18;
9632 leency 55
libimg_image icons18a;
56
libimg_image pixie_skin;
9396 leency 57
libimg_image main_image;
58
 
9632 leency 59
scroll_bar scroll_v = { 15,NULL,NULL,HEADERH+1,15,2,NULL,0,0,COL_DARK,COL_LIGHT,COL_LINE};
60
scroll_bar scroll_h = { NULL,TOOLBAR_W+PAD+PAD,15,NULL,15,2,NULL,0,0,COL_DARK,COL_LIGHT,COL_LINE};
9396 leency 61
 
9597 leency 62
enum { SAVE_AS_PNG=1, SAVE_AS_BMP=2, SAVE_AS_RAW=4 };
63
int saving_type=SAVE_AS_PNG;
64
 
9633 leency 65
char* libimg_bpp[] = { "???", "8pal", "24", "32", "15", "16",
66
"mono", "8gray", "2pal", "4pal", "8gr/a" };
9597 leency 67
 
68
enum {
69
	TOOL_CROP=1,
70
	TOOL_RESIZE=2,
71
	TOOL_COLOR_DEPTH=4,
72
	TOOL_FLIP_ROTATE=8
9396 leency 73
};
9597 leency 74
int active_tool = NULL;
9396 leency 75
 
76
//===================================================//
77
//                                                   //
78
//                       CODE                        //
79
//                                                   //
80
//===================================================//
81
 
82
void init_ui()
83
{
84
	icons18.load("/sys/icons16.png");
9632 leency 85
	icons18.replace_2colors(0xffFFFfff, COL_LIGHT, 0xffCACBD6, COL_LIGHT-0x080808);
86
	icons18a.load("/sys/icons16.png");
87
	icons18a.replace_2colors(0xffFFFfff, COL_BUTTON, 0xffCACBD6, 0);
88
 
89
	pixie_skin.load("/sys/media/pixieskn.png");
9396 leency 90
}
91
 
92
void main()
93
{
94
	load_dll(libimg, #libimg_init, 1);
95
	load_dll(boxlib, #box_lib_init,0);
96
	load_dll(Proc_lib, #OpenDialog_init,0);
97
	OpenDialog_init stdcall (#o_dialog);
98
 
99
	open_image("/sys/home.png");
100
 
101
	SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER);
102
	loop() switch(WaitEvent())
103
	{
104
		case evMouse:
105
			mouse.get();
106
			scrollbar_v_mouse stdcall(#scroll_v);
107
			scrollbar_h_mouse stdcall(#scroll_h);
108
			if (scroll_v.delta) || (scroll_h.delta) draw_canvas();
9597 leency 109
			if (EAX = mouse.vert) {
110
				if (EAX<10) event_scroll_canvas(SCAN_CODE_DOWN);
111
				else event_scroll_canvas(SCAN_CODE_UP);
112
			} if (EAX = mouse.hor) {
113
				if (EAX<10) event_scroll_canvas(SCAN_CODE_RIGHT);
114
				else event_scroll_canvas(SCAN_CODE_LEFT);
115
			}
9396 leency 116
			break;
117
 
118
		case evButton:
119
			pressed_button_id = GetButtonID();
120
			if (pressed_button_id==1) ExitProcess();
121
			button.press(pressed_button_id);
122
			break;
123
 
124
		case evKey:
125
			GetKeys();
9597 leency 126
			if (key_scancode == SCAN_CODE_DOWN) event_scroll_canvas(SCAN_CODE_DOWN);
127
			if (key_scancode == SCAN_CODE_UP) event_scroll_canvas(SCAN_CODE_UP);
128
			if (key_scancode == SCAN_CODE_LEFT) event_scroll_canvas(SCAN_CODE_LEFT);
129
			if (key_scancode == SCAN_CODE_RIGHT) event_scroll_canvas(SCAN_CODE_RIGHT);
130
			key.press(key_scancode);
9396 leency 131
			break;
132
 
133
		case evReDraw:
134
			draw_window();
135
			break;
136
	}
137
}
138
 
139
void draw_window()
140
{
9597 leency 141
	Form.width = screen.w/6*5;
142
	Form.height = screen.h/6*5;
9632 leency 143
	DefineAndDrawWindow(screen.w-Form.width/2, screen.h-Form.height/2, Form.width, Form.height, 0x42, NULL, NULL, 0);
9396 leency 144
	GetProcessInfo(#Form, SelfInfo);
145
	if (Form.status_window&ROLLED_UP) return;
146
	if (Form.width  < 560) { MoveSize(OLD,OLD,560,OLD); return; }
147
	if (Form.height < 430) { MoveSize(OLD,OLD,OLD,430); return; }
9632 leency 148
	scroll_v.all_redraw = scroll_h.all_redraw = 1;
149
	draw_content();
150
}
151
 
152
void draw_content()
153
{
154
	incn tx;
9396 leency 155
	button.init(40);
156
	key.init(40);
157
 
9632 leency 158
	init_ui();
159
	canvas.w = Form.cwidth - CANVASX - 1;
160
	canvas.h = Form.cheight - STATUSBAR_H - CANVASY - 1;
9396 leency 161
	if (main_image.h > canvas.h) canvas.w -= scroll_v.size_x + 1;
162
	if (main_image.w > canvas.w) canvas.h -= scroll_h.size_y + 1;
163
 
9632 leency 164
	//window border and panel border
165
	DrawRectangle(0,0,Form.width,Form.height,COL_LINE);
166
	DrawRectangle(1,1,Form.width-2,Form.height-2,COL_LIGHT);
167
	DrawBar(CANVASX, 0, 1, Form.cheight, COL_LINE);
168
 
169
	//draw title
170
	DrawBar(2, 2, CANVASX-2, HEADERH-1, COL_DARK);
9633 leency 171
	WriteText(PAD+5, HEADER_TEXTY, 0x90, COL_WORK_TEXT, "ImageEditor Pro");
9632 leency 172
 
173
	//draw header
174
	DrawBar(CANVASX+1, 2, Form.width-CANVASX-2, HEADERH-1, COL_WORK);
175
	DrawBar(CANVASX+1, CANVASY-1, Form.width-CANVASX-2, 1, COL_LINE);
176
	img_draw stdcall(pixie_skin.image, Form.width-63, 7, 57, 18, 265, 0);
177
	DefineHiddenButton(Form.width-63, 7, 28, 17, button.add(#MinimizeWindow));
178
	DefineHiddenButton(Form.width-35, 7, 28, 17, 1);
179
	draw_acive_panel();
180
 
181
	//left panel bg
182
	DrawBar(2, 1+HEADERH, CANVASX-2, Form.cheight-2-HEADERH, COL_WORK);
183
 
9396 leency 184
	if (main_image.h > canvas.h) && (main_image.w > canvas.w) {
9632 leency 185
		DrawBar(CANVASX+canvas.w, CANVASY+canvas.h, scroll_v.size_x+1, scroll_h.size_y+1, COL_WORK);
9396 leency 186
	}
187
 
9597 leency 188
	#define GAP_S TOOLBAR_ITEM_H+8
189
	#define GAP_B TOOLBAR_ITEM_H+23
9632 leency 190
	tx.set(PAD-GAP_S+HEADERH);
9597 leency 191
	//draw_tool_btn(10, ECTRL + SCAN_CODE_KEY_N, PAD, tx.inc(GAP_S), 02, "Create image", false);
192
	draw_tool_btn(#event_open, ECTRL + SCAN_CODE_KEY_O, PAD, tx.inc(GAP_S), 00, "Open image", false);
193
	//draw_tool_btn(13, ECTRL + SCAN_CODE_LEFT,  PAD, tx.inc(GAP_B), 30, false);
194
	//draw_tool_btn(14, ECTRL + SCAN_CODE_RIGHT, PAD, tx.inc(GAP_S), 31, false);
195
	//draw_tool_btn(15, ECTRL + SCAN_CODE_UP,    PAD, tx.inc(GAP_S), 32, false);
196
	//draw_tool_btn(16, ECTRL + SCAN_CODE_DOWN,  PAD, tx.inc(GAP_S), 33, false);
9396 leency 197
 
9632 leency 198
 	draw_tool_btn(#event_save, ECTRL + SCAN_CODE_KEY_S, PAD, tx.inc(GAP_B), 05, "Save as", false);
9597 leency 199
 	draw_tool_btn(#event_save_png, 0, PAD, tx.inc(GAP_S), -1, "PNG", saving_type & SAVE_AS_PNG);
200
	draw_tool_btn(#event_save_bmp, 0, PAD*2+34, tx.n,     -1, "BMP", saving_type & SAVE_AS_BMP);
201
	draw_tool_btn(#event_save_raw, 0, PAD*3+68, tx.n,     -1, "RAW", saving_type & SAVE_AS_RAW);
9396 leency 202
 
9597 leency 203
 	draw_tool_btn(#event_activate_crop,  0, PAD, tx.inc(GAP_B), 46, "Crop", active_tool & TOOL_CROP);
204
	draw_tool_btn(#event_activate_resize,0, PAD, tx.inc(GAP_S), 06, "Resize", active_tool & TOOL_RESIZE);
205
	draw_tool_btn(#event_activate_depth, 0, PAD, tx.inc(GAP_S), 52, "Color depth", active_tool & TOOL_COLOR_DEPTH);
206
	draw_tool_btn(#event_activate_flprot,0, PAD, tx.inc(GAP_S), 36, "Flip/Rotate", active_tool & TOOL_FLIP_ROTATE);
9396 leency 207
 
9597 leency 208
	draw_status_bar();
9396 leency 209
	draw_canvas();
210
}
211
 
9597 leency 212
void draw_status_bar()
9396 leency 213
{
9597 leency 214
	char img_info[24];
9633 leency 215
	sprintf(#img_info, "%i\01%i\02%s", main_image.w, main_image.h, libimg_bpp[main_image.type]);
9632 leency 216
	DrawBar(CANVASX+1, Form.cheight - STATUSBAR_H - 1, Form.cwidth - CANVASX -2, STATUSBAR_H, COL_WORK);
217
	WriteText(CANVASX+4, Form.cheight - STATUSBAR_H + 2, 0x90, COL_WORK_TEXT, #img_info);
218
	for (ESI=0; img_info[ESI]!=0; ESI++) {
219
		if (img_info[ESI] == '\01') img_info[ESI]='x';
220
		else if (img_info[ESI] == '\02') img_info[ESI]='@';
221
		else img_info[ESI]=' ';
222
	}
223
	ECX = 0x90 << 24 + COL_BUTTON_TEXT;
224
	$int 64
9396 leency 225
}
226
 
9633 leency 227
int draw_tool_btn(dword _event, _hotkey, _x, _y, _icon_n, _text, _active)
9396 leency 228
{
9597 leency 229
	int w = TOOLBAR_W;
9633 leency 230
	dword img_ptr = icons18.image;
9632 leency 231
	if (!_text) w = PAD + PAD + 6;
9597 leency 232
	if (_icon_n==-1) w = strlen(_text) * 8 + 14;
9633 leency 233
	if (_active==-1) {
234
		EDX = COL_LINE;
235
		$push COL_LIGHT
236
	} else if (_active) {
9632 leency 237
		img_ptr = icons18a.image;
238
		EDX = COL_BUTTON;
9633 leency 239
		$push COL_BUTTON_TEXT
240
 
9632 leency 241
	} else {
9633 leency 242
		$push COL_WORK_TEXT
9632 leency 243
		EDX = COL_LIGHT;
9633 leency 244
	}
9597 leency 245
	DrawBar(_x, _y, w, TOOLBAR_ITEM_H+1, EDX);
9632 leency 246
	PutPixel(_x,_y,COL_WORK);
247
	PutPixel(_x,_y+TOOLBAR_ITEM_H,COL_WORK);
248
	PutPixel(_x+w-1,_y,COL_WORK);
249
	PutPixel(_x+w-1,_y+TOOLBAR_ITEM_H,COL_WORK);
9396 leency 250
	if (_event) DefineHiddenButton(_x, _y, w, TOOLBAR_ITEM_H, button.add(_event));
9597 leency 251
	if (_hotkey) key.add_n(_hotkey, _event);
252
	if (_icon_n!=-1) {
9632 leency 253
		#define ISIZE 18
254
		img_draw stdcall(img_ptr, _x+7, _y+4, ISIZE, ISIZE, 0, _icon_n*ISIZE);
9597 leency 255
		_x += PAD+ISIZE+2;
256
	} else {
257
		_x += 7;
258
	}
9633 leency 259
	$pop EDX
9597 leency 260
	if (_text) {
261
		WriteText(_x, _y+6, 0x90, EDX, _text);
262
	}
9633 leency 263
	return w;
9396 leency 264
}
265
 
9632 leency 266
void draw_canvas()
9396 leency 267
{
9632 leency 268
	int content_w = math.min(main_image.w, canvas.w-1);
269
	int content_h = math.min(main_image.h, canvas.h);
270
	if (main_image.image) {
271
		img_draw stdcall(main_image.image, CANVASX+1, CANVASY,
272
		content_w, content_h, scroll_h.position, scroll_v.position);
273
 	}
274
	DrawBar(CANVASX+1+content_w, CANVASY, canvas.w - content_w - 1, content_h, COL_DARK);
275
	DrawBar(CANVASX+1, CANVASY+content_h, canvas.w - 1, canvas.h - content_h, COL_DARK);
276
	//Draw scroll V
9396 leency 277
	scroll_v.max_area = main_image.h;
9632 leency 278
	scroll_v.cur_area = scroll_v.size_y = canvas.h + 1;
279
	scroll_v.start_x = CANVASX + canvas.w;
9396 leency 280
	if (main_image.h > canvas.h) scrollbar_v_draw stdcall (#scroll_v);
9632 leency 281
	//Draw scroll H
9396 leency 282
	scroll_h.max_area = main_image.w;
283
	scroll_h.cur_area = scroll_h.size_x = canvas.w;
9632 leency 284
	scroll_h.start_y = CANVASY + canvas.h;
9396 leency 285
	if (main_image.w > canvas.w) scrollbar_h_draw stdcall (#scroll_h);
286
 
287
}
288
 
9632 leency 289
void set_file_path(char* _new_title)
9396 leency 290
{
9632 leency 291
	strcpy(#param, _new_title);
292
	draw_status_bar();
9396 leency 293
}
294
 
295
void open_image(char* _path)
296
{
297
	main_image.load(_path);
9632 leency 298
	set_file_path(_path);
9396 leency 299
	scroll_v.position = 0;
300
	scroll_h.position = 0;
301
}
302
 
9633 leency 303
int color_depth_id;
304
void event_set_color_depth() {
305
	//debugval("buttonid", pressed_button_id);
306
	//debugln(libimg_bpp[pressed_button_id-color_depth_id]);
307
	img_convert stdcall(main_image.image, 0, pressed_button_id-color_depth_id, 0, 0);
308
	if (!EAX) {
309
		notify("'ImageEdit Pro\nConvertation error' -Et");
310
	} else {
311
		$push eax
312
        img_destroy stdcall(main_image.image);
313
        $pop eax
314
        main_image.image = EAX;
315
		main_image.set_vars();
316
		draw_acive_panel();
317
		draw_status_bar();
318
		draw_canvas();
319
	}
320
}
321
 
9632 leency 322
void draw_acive_panel()
323
{
9633 leency 324
	int i, x = CANVASX + PAD;
325
	bool a;
9632 leency 326
	switch(active_tool) {
327
		case TOOL_CROP:
9633 leency 328
			WriteText(CANVASX+PAD, HEADER_TEXTY, 0x90, COL_WORK_TEXT, "Crop tool");
9632 leency 329
			break;
330
		case TOOL_RESIZE:
9633 leency 331
			WriteText(CANVASX+PAD, HEADER_TEXTY, 0x90, COL_WORK_TEXT, "New width");
332
			WriteText(CANVASX+PAD+150, HEADER_TEXTY, 0x90, COL_WORK_TEXT, "New height");
9632 leency 333
			draw_tool_btn(#event_rotate_left, SCAN_CODE_ENTER, CANVASX + PAD + 300, 7, -1, "Apply", false);
334
			break;
335
		case TOOL_COLOR_DEPTH:
9633 leency 336
			WriteText(CANVASX+PAD, HEADER_TEXTY, 0x90, COL_WORK_TEXT, "Color depth");
337
			x += 11*8 + PAD;
338
			color_depth_id = button.new_id;
339
			for (i=1; i<11; i++) {
340
				if (main_image.type == i) {
341
					//this is current image depth
342
					a = true;
343
				} else {
344
					//this is image ve san set
345
					a = false;
346
					//probe does libimg support converting current image gepth to i-one
347
					img_create stdcall(1, 1, main_image.type);
348
					img_convert stdcall(EAX, 0, i, 0, 0);
349
					if (EAX) {
350
						img_destroy stdcall(EAX);
351
					} else {
352
						//continue;
353
						a = -1;
354
					}
355
				}
356
				x += draw_tool_btn(#event_set_color_depth, SCAN_CODE_ENTER, x, 7, -1, libimg_bpp[i], a) + PAD;
357
			}
9632 leency 358
			break;
359
		case TOOL_FLIP_ROTATE:
9633 leency 360
			WriteText(CANVASX+PAD, HEADER_TEXTY, 0x90, COL_WORK_TEXT, "Flip");
9632 leency 361
			draw_tool_btn(#event_flip_hor, ECTRL + SCAN_CODE_KEY_H, CANVASX + PAD + 040, 7, 34, NULL, false);
362
			draw_tool_btn(#event_flip_ver, ECTRL + SCAN_CODE_KEY_V, CANVASX + PAD + 080, 7, 35, NULL, false);
9633 leency 363
			WriteText(CANVASX+PAD + 142, HEADER_TEXTY, 0x90, COL_WORK_TEXT, "Rotate");
9632 leency 364
			draw_tool_btn(#event_rotate_left,   ECTRL + SCAN_CODE_KEY_L, CANVASX + PAD + 200, 7, 37, NULL, false);
365
			draw_tool_btn(#event_rotate_right,   ECTRL + SCAN_CODE_KEY_R, CANVASX + PAD + 240, 7, 36, NULL, false);
9633 leency 366
			// WriteText(CANVASX+PAD + 142, HEADER_TEXTY, 0x90, COL_WORK_TEXT, "Move");
9632 leency 367
			// DrawTopPanelButton1(#EventMoveLeft,       ECTRL + SCAN_CODE_LEFT,  tx.inc(GAP_B), 30);
368
			// DrawTopPanelButton1(#EventMoveRight,      ECTRL + SCAN_CODE_RIGHT, tx.inc(GAP_S), 31);
369
			// DrawTopPanelButton1(#EventMoveUp,         ECTRL + SCAN_CODE_UP,    tx.inc(GAP_S), 32);
370
			// DrawTopPanelButton1(#EventMoveDown,       ECTRL + SCAN_CODE_DOWN,  tx.inc(GAP_S), 33);
371
			break;
372
		default:
9633 leency 373
			WriteText(CANVASX+PAD, HEADER_TEXTY, 0x90, COL_WORK_TEXT, "Welcome to ImageEditor Pro! Try to open some file.");
9632 leency 374
	}
375
}
376
 
9396 leency 377
//===================================================//
378
//                                                   //
379
//                      EVENTS                       //
380
//                                                   //
381
//===================================================//
382
 
383
void event_open()
384
{
385
	o_dialog.type = 0; //open file
386
	OpenDialog_start stdcall (#o_dialog);
387
	if (o_dialog.status) {
388
		open_image(#openfile_path);
389
		draw_canvas();
390
	}
391
}
392
 
393
void event_flip_hor()
394
{
395
	img_flip stdcall (main_image.image, FLIP_HORIZONTAL);
396
	draw_canvas();
397
}
398
 
399
void event_flip_ver()
400
{
401
	img_flip stdcall (main_image.image, FLIP_VERTICAL);
402
	draw_canvas();
403
}
404
 
9632 leency 405
void event_rotate_left()
9396 leency 406
{
9632 leency 407
	img_rotate stdcall (main_image.image, ROTATE_270_CW);
408
	main_image.w >< main_image.h;
409
	draw_content();
410
}
411
 
412
void event_rotate_right()
413
{
9396 leency 414
	img_rotate stdcall (main_image.image, ROTATE_90_CW);
415
	main_image.w >< main_image.h;
9632 leency 416
	draw_content();
9396 leency 417
}
418
 
9632 leency 419
void event_save_png() { saving_type = SAVE_AS_PNG; draw_content(); }
420
void event_save_bmp() { saving_type = SAVE_AS_BMP; draw_content(); }
421
void event_save_raw() { saving_type = SAVE_AS_RAW; draw_content(); }
9597 leency 422
 
9632 leency 423
void event_activate_crop() { active_tool = TOOL_CROP; draw_content(); }
424
void event_activate_resize() { active_tool = TOOL_RESIZE; draw_content(); }
425
void event_activate_depth() { active_tool = TOOL_COLOR_DEPTH; draw_content(); }
426
void event_activate_flprot() { active_tool = TOOL_FLIP_ROTATE; draw_content(); }
9597 leency 427
 
9396 leency 428
void event_save()
429
{
430
	o_dialog.type = 1; //save file
9597 leency 431
	switch (saving_type) {
432
		case SAVE_AS_PNG:
433
				strcpy(#filename_area, "image.png");
434
				OpenDialog_start stdcall (#o_dialog);
435
				if (o_dialog.status) {
9632 leency 436
					set_file_path(#openfile_path);
9597 leency 437
					img_to_rgb stdcall (main_image.image);
438
					save_image(main_image.imgsrc, main_image.w, main_image.h, #openfile_path);
439
				}
440
				break;
441
		case SAVE_AS_BMP:
442
				notify("Not implemented yet.");
443
				break;
444
		case SAVE_AS_RAW:
445
				notify("Not implemented yet.");
446
				break;
9396 leency 447
	}
448
}
449
 
9597 leency 450
void event_scroll_canvas(int _direction)
451
{
452
	switch(_direction) {
453
		case SCAN_CODE_DOWN:
454
			scroll_v.position = math.min(scroll_v.position+25,
455
				scroll_v.max_area - scroll_v.cur_area);
456
			break;
457
		case SCAN_CODE_UP:
458
			scroll_v.position = math.max(scroll_v.position-25, 0);
459
			break;
460
		case SCAN_CODE_RIGHT:
461
			scroll_h.position = math.min(scroll_h.position+25,
462
				scroll_h.max_area - scroll_h.cur_area);
463
			break;
464
		case SCAN_CODE_LEFT:
465
			scroll_h.position = math.max(scroll_h.position-25, 0);
466
	}
467
	draw_canvas();
468
}
469
 
9396 leency 470
stop:
471