Subversion Repositories Kolibri OS

Rev

Rev 6169 | Rev 6906 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6169 Rev 6239
Line 12... Line 12...
12
BUF_SIZE equ 4096 ;buffer for copy|paste
12
BUF_SIZE equ 4096 ;buffer for copy|paste
13
maxSyntaxFileSize equ 410000
13
maxSyntaxFileSize equ 410000
14
TOOLBAR_ICONS_SIZE equ 1200*20
14
TOOLBAR_ICONS_SIZE equ 1200*20
Line 15... Line 15...
15
 
15
 
16
include '../../proc32.inc'
-
 
17
;include '../../config.inc'
16
include '../../proc32.inc'
18
include '../../macros.inc'
-
 
19
include '../../dll.inc'
17
include '../../macros.inc'
20
include '../../KOSfuncs.inc'
18
include '../../KOSfuncs.inc'
21
include '../../develop/libraries/box_lib/load_lib.mac'
19
include '../../load_img.inc'
22
include '../../develop/libraries/box_lib/trunk/box_lib.mac'
20
include '../../develop/libraries/box_lib/trunk/box_lib.mac'
23
include '../../system/skincfg/trunk/kglobals.inc'
21
include '../../system/skincfg/trunk/kglobals.inc'
24
include '../../system/skincfg/trunk/unpacker.inc'
22
include '../../system/skincfg/trunk/unpacker.inc'
Line 31... Line 29...
31
include 't_button.inc' ;text work functions
29
include 't_button.inc' ;text work functions
32
include 'wnd_k_words.inc'
30
include 'wnd_k_words.inc'
Line 33... Line 31...
33
 
31
 
Line 34... Line -...
34
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
-
 
35
 
-
 
36
 
-
 
37
;Œ ªà®á ¤«ï § £à㧪¨ ¨§®¡à ¦¥­¨© á ¨á¯®«ì§®¢ ­¨¥¬ ¡¨¡«¨®â¥ª¨ libimg.obj
-
 
38
;¤«ï ¨á¯®«ì§®¢ ­¨ï ¬ ªà®á  ­ã¦­ë ¯¥à¥¬¥­­ë¥:
-
 
39
; - run_file_70 FileInfoBlock
-
 
40
; - image_data dd 0
-
 
41
macro load_image_file path,buf,size
-
 
42
{
-
 
43
	;path - ¬®¦¥â ¡ëâì ¯¥à¥¬¥­­®© ¨«¨ áâப®¢ë¬ ¯ à ¬¥â஬
-
 
44
	if path eqtype '' ;¯à®¢¥à塞 § ¤ ­ «¨ áâப®© ¯ à ¬¥âà path
-
 
45
		jmp @f
-
 
46
			local .path_str
-
 
47
			.path_str db path ;ä®à¬¨à㥬 «®ª «ì­ãî ¯¥à¥¬¥­­ãî
-
 
48
			db 0
-
 
49
		@@:
-
 
50
		;32 - áâ ­¤ àâ­ë©  ¤à¥á ¯® ª®â®à®¬ã ¤®«¦¥­ ¡ëâì ¡ãä¥à á á¨á⥬­ë¬ ¯ã⥬
-
 
51
		copy_path .path_str,[32],file_name,0
-
 
52
	else
-
 
53
		copy_path path,[32],file_name,0 ;ä®à¬¨à㥬 ¯®«­ë© ¯ãâì ª ä ©«ã ¨§®¡à ¦¥­¨ï, ¯®¤à §ã¬¥¢ ¥¬ çâ® ®­ ¢ ®¤­®© ¯ ¯ª¥ á ¯à®£à ¬¬®©
-
 
54
	end if
-
 
55
 
-
 
56
	stdcall mem.Alloc, dword size ;¢ë¤¥«ï¥¬ ¯ ¬ïâì ¤«ï ¨§®¡à ¦¥­¨ï
-
 
57
	mov [buf],eax
-
 
58
 
-
 
59
	mov [run_file_70.Function], SSF_READ_FILE
-
 
60
	mov [run_file_70.Position], 0
-
 
61
	mov [run_file_70.Flags], 0
-
 
62
	mov [run_file_70.Count], dword size
-
 
63
	m2m [run_file_70.Buffer], eax
-
 
64
	mov byte[run_file_70+20], 0
-
 
65
	mov [run_file_70.FileName], file_name
-
 
66
	mcall SF_FILE,run_file_70 ;§ £à㦠¥¬ ä ©« ¨§®¡à ¦¥­¨ï
-
 
67
	cmp ebx,0xffffffff
-
 
68
	je @f
-
 
69
		;®¯à¥¤¥«ï¥¬ ¢¨¤ ¨§®¡à ¦¥­¨ï ¨ ¯¥à¥¢®¤¨¬ ¥£® ¢® ¢à¥¬¥­­ë© ¡ãä¥à image_data
-
 
70
		stdcall dword[img_decode], dword[buf],ebx,0
-
 
71
		mov dword[image_data],eax
-
 
72
		;¯à¥®¡à §ã¥¬ ¨§®¡à ¦¥­¨¥ ª ä®à¬ âã rgb
-
 
73
		stdcall dword[img_to_rgb2], dword[image_data],dword[buf]
-
 
74
		;㤠«ï¥¬ ¢à¥¬¥­­ë© ¡ãä¥à image_data
-
 
75
		stdcall dword[img_destroy], dword[image_data]
-
 
76
	@@:
-
 
77
}
-
 
78
 
32
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
Line 79... Line 33...
79
image_data dd 0 ;㪠§ â¥«ì ­  ¢à¥¬¥­­ãî ¯ ¬ïâì. ¤«ï ­ã¦¥­ ¯à¥®¡à §®¢ ­¨ï ¨§®¡à ¦¥­¨ï
33
 
80
icon_tl_sys dd 0 ;㪠§ â¥«ì ­  ¯ ¬ïâì ¤«ï åà ­¥­¨ï á¨á⥬­ëå ¨ª®­®ª
34
icon_tl_sys dd 0 ;㪠§ â¥«ì ­  ¯ ¬ïâì ¤«ï åà ­¥­¨ï á¨á⥬­ëå ¨ª®­®ª
81
 
35
 
Line 188... Line 142...
188
	stdcall [ksubmenu_add], [main_menu_encoding], eax	
142
	stdcall [ksubmenu_add], [main_menu_encoding], eax	
189
	stdcall [kmenuitem_new], KMENUITEM_SUBMENU, sz_main_menu_Encoding, [main_menu_encoding]
143
	stdcall [kmenuitem_new], KMENUITEM_SUBMENU, sz_main_menu_Encoding, [main_menu_encoding]
190
	stdcall [ksubmenu_add], [main_menu], eax
144
	stdcall [ksubmenu_add], [main_menu], eax
Line 191... Line 145...
191
	
145
	
192
; init toolbar file
146
; init toolbar file
193
	load_image_file 'te_icon.png', bmp_icon,TOOLBAR_ICONS_SIZE*2 ;㬭®¦¥­¨¥ ­  2 ¤«ï á¥àëå ª­®¯®ª
147
	load_image_file 'te_icon.png', bmp_icon,,,6 ;6 ¤«ï á¥àëå ª­®¯®ª
194
	mov eax,[bmp_icon]
148
	mov eax,[bmp_icon]
195
	add eax,TOOLBAR_ICONS_SIZE
149
	add eax,TOOLBAR_ICONS_SIZE
196
	stdcall img_to_gray, [bmp_icon],eax,(TOOLBAR_ICONS_SIZE)/3
150
	stdcall img_to_gray, [bmp_icon],eax,(TOOLBAR_ICONS_SIZE)/3
197
;---------------------------------------------------------------------
151
;---------------------------------------------------------------------
198
; ç¨â ¥¬ ä ©« á ªãàá®à ¬¨ ¨ «¨­¨ï¬¨
152
; ç¨â ¥¬ ä ©« á ªãàá®à ¬¨ ¨ «¨­¨ï¬¨
199
	load_image_file 'tl_sys_16.png', icon_tl_sys,54+3*256*13
153
	load_image_file 'tl_sys_16.png', icon_tl_sys
200
	mov eax,dword[icon_tl_sys]
154
	mov eax,dword[icon_tl_sys]
201
	mov dword[tree1.data_img_sys],eax
155
	mov dword[tree1.data_img_sys],eax
202
;---------------------------------------------------------------------
156
;---------------------------------------------------------------------
203
; ç¨â ¥¬ ä ©« á ¨ª®­ª ¬¨ 㧫®¢
157
; ç¨â ¥¬ ä ©« á ¨ª®­ª ¬¨ 㧫®¢
204
	load_image_file 'tl_nod_16.png', icon_tl_sys,54+3*256*2
158
	load_image_file 'tl_nod_16.png', icon_tl_sys
205
	mov eax,dword[icon_tl_sys]
159
	mov eax,dword[icon_tl_sys]
206
	mov dword[tree1.data_img],eax
160
	mov dword[tree1.data_img],eax
207
;------------------------------------------------------------------------------
161
;------------------------------------------------------------------------------
208
	copy_path fn_syntax_dir,sys_path,file_name,0 ;¡¥à¥¬ ¯ãâì ª ¯ ¯ª¥ á ä ©« ¬¨ ᨭ⠪á¨á 
162
	copy_path fn_syntax_dir,sys_path,file_name,0 ;¡¥à¥¬ ¯ãâì ª ¯ ¯ª¥ á ä ©« ¬¨ ᨭ⠪á¨á 
Line 280... Line 234...
280
		call but_no_msg_OpenFile
234
		call but_no_msg_OpenFile
281
	@@:
235
	@@:
Line 282... Line 236...
282
 
236
 
283
 
237
 
284
 
238
 
Line 285... Line 239...
285
align 4
239
align 16
286
red_win:
240
red_win:
287
	call draw_window
241
	call draw_window
288
 
242
 
289
align 4
243
align 16
Line 302... Line 256...
302
	jne @f
256
	jne @f
303
		jmp mouse
257
		jmp mouse
304
	@@:
258
	@@:
305
	jmp still
259
	jmp still
Line 306... Line 260...
306
 
260
 
307
align 4
261
align 16
308
draw_window:
262
draw_window:
Line 309... Line 263...
309
	mcall SF_REDRAW,SSF_BEGIN_DRAW
263
	mcall SF_REDRAW,SSF_BEGIN_DRAW
310
 
264
 
Line 324... Line 278...
324
	stdcall [ted_draw], tedit0
278
	stdcall [ted_draw], tedit0
Line 325... Line 279...
325
 
279
 
326
	mcall SF_REDRAW,SSF_END_DRAW
280
	mcall SF_REDRAW,SSF_END_DRAW
Line 327... Line 281...
327
	ret
281
	ret
328
 
282
 
329
align 4
283
align 16
-
 
284
mouse:
-
 
285
	stdcall [kmainmenu_dispatch_cursorevent], [main_menu]
-
 
286
 
-
 
287
	mcall SF_MOUSE_GET,SSF_WINDOW_POSITION
-
 
288
	cmp word[tedit0.wnd.top],ax
-
 
289
	jg .no_edit
-
 
290
	shr eax,16
-
 
291
	cmp word[tedit0.wnd.left],ax
-
 
292
	jg .no_edit
-
 
293
	mcall SF_MOUSE_GET,SSF_BUTTON_EXT
-
 
294
	bt eax,24 ;¤¢®©­®© 饫çñª «¥¢®© ª­®¯ª®©
-
 
295
	jnc @f
-
 
296
		stdcall [ted_but_select_word], tedit0
330
mouse:
297
		jmp still
-
 
298
	@@:
Line 331... Line 299...
331
	stdcall [kmainmenu_dispatch_cursorevent], [main_menu]
299
		stdcall [ted_mouse], tedit0
332
	stdcall [ted_mouse], tedit0
300
	.no_edit:
333
 
301
 
334
	cmp byte[tedit0.panel_id],TED_PANEL_FIND ;if not panel
302
	cmp byte[tedit0.panel_id],TED_PANEL_FIND ;if not panel
335
	jne @f
303
	jne @f
336
		stdcall [edit_box_mouse], dword edit2
304
		stdcall [edit_box_mouse], edit2
337
	@@:
305
	@@:
338
	cmp byte[tedit0.panel_id],TED_PANEL_SYNTAX ;if not panel
306
	cmp byte[tedit0.panel_id],TED_PANEL_SYNTAX ;if not panel
339
	jne .mouse_end
307
	jne @f
340
	stdcall [tl_mouse], tree1
308
		stdcall [tl_mouse], tree1
Line 341... Line 309...
341
.mouse_end:
309
	@@:
342
	jmp still
310
	jmp still
343
;---------------------------------------------------------------------
311
;---------------------------------------------------------------------
344
 
312
 
345
;output:
313
;output:
346
; ah = symbol
314
; ah = symbol
347
align 4
315
align 16
348
proc KeyConvertToASCII uses ebx, table:dword
316
proc KeyConvertToASCII uses ebx, table:dword
349
	mov ebx,dword[table] ;convert scan to ascii
317
	mov ebx,dword[table] ;convert scan to ascii
350
	ror ax,8
318
	ror ax,8
351
	xor ah,ah
319
	xor ah,ah
Line 352... Line 320...
352
	add bx,ax
320
	add bx,ax
353
	mov ah,byte[ebx]
321
	mov ah,byte[ebx]
354
	ret
322
	ret
355
endp
323
endp
356
 
324
 
357
align 4
325
align 16
Line 403... Line 371...
403
  @@:
371
	@@:
Line 404... Line 372...
404
 
372
 
405
  stdcall [ted_key], tedit0, conv_tabl,esi
373
	stdcall [ted_key], tedit0, conv_tabl,esi
Line 406... Line 374...
406
  jmp still
374
	jmp still
407
 
375
 
408
align 4
-
 
409
button:
376
align 16
410
 
377
button:
411
  mcall SF_GET_BUTTON
378
	mcall SF_GET_BUTTON
412
  cmp ah,3
379
	cmp ah,3
-
 
380
	jne @f
413
  jne @f
381
		call ted_but_new_file
414
    call ted_but_new_file
382
		jmp still
415
  @@:
383
	@@:
416
  cmp ah,4
384
	cmp ah,4
-
 
385
	jne @f
417
  jne @f
386
		call ted_but_open_file
418
    call ted_but_open_file
387
		jmp still
419
  @@:
388
	@@:
420
  cmp ah,5
389
	cmp ah,5
-
 
390
	jne @f
421
  jne @f
391
		call ted_but_save_file
422
    call ted_but_save_file
392
		jmp still
423
  @@:
393
	@@:
424
  cmp ah,6
394
	cmp ah,6
-
 
395
	jne @f
425
  jne @f
396
		stdcall [ted_but_select_word], tedit0
426
    stdcall [ted_but_select_word], tedit0
397
		jmp still
427
  @@:
398
	@@:
428
  cmp ah,7
399
	cmp ah,7
-
 
400
	jne @f
429
  jne @f
401
		stdcall [ted_but_cut], tedit0
430
    stdcall [ted_but_cut], tedit0
402
		jmp still
431
  @@:
403
	@@:
432
  cmp ah,8
404
	cmp ah,8
-
 
405
	jne @f
433
  jne @f
406
		stdcall [ted_but_copy], tedit0
434
    stdcall [ted_but_copy], tedit0
407
		jmp still
435
  @@:
408
	@@:
436
  cmp ah,9
409
	cmp ah,9
-
 
410
	jne @f
437
  jne @f
411
		stdcall [ted_but_paste], tedit0
438
    stdcall [ted_but_paste], tedit0
412
		jmp still
439
  @@:
413
	@@:
440
  cmp ah,10
414
	cmp ah,10
-
 
415
	jne @f
441
  jne @f
416
		call ted_but_find
442
    call ted_but_find
417
		jmp still
443
  @@:
418
	@@:
444
  cmp ah,11
419
	cmp ah,11
-
 
420
	jne @f
445
  jne @f
421
		call but_replace
446
    call but_replace
422
		jmp still
447
  @@:
423
	@@:
448
  cmp ah,12
424
	cmp ah,12
-
 
425
	jne @f
449
  jne @f
426
		call but_find_key_w
450
    call but_find_key_w
427
		jmp still
451
  @@:
428
	@@:
452
  cmp ah,13
429
	cmp ah,13
-
 
430
	jne @f
453
  jne @f
431
		stdcall [ted_but_sumb_upper], tedit0
454
    stdcall [ted_but_sumb_upper], tedit0
432
		jmp still
455
  @@:
433
	@@:
456
  cmp ah,14
434
	cmp ah,14
-
 
435
	jne @f
457
  jne @f
436
		stdcall [ted_but_sumb_lover], tedit0
458
    stdcall [ted_but_sumb_lover], tedit0
437
		jmp still
459
  @@:
438
	@@:
460
  cmp ah,15
439
	cmp ah,15
-
 
440
	jne @f
461
  jne @f
441
		stdcall [ted_but_reverse], tedit0
462
    stdcall [ted_but_reverse], tedit0
442
		jmp still
463
  @@:
443
	@@:
464
  cmp ah,16
444
	cmp ah,16
-
 
445
	jne @f
465
  jne @f
446
		stdcall [ted_but_undo], tedit0
466
    stdcall [ted_but_undo], tedit0
447
		jmp still
467
  @@:
448
	@@:
468
  cmp ah,17
449
	cmp ah,17
-
 
450
	jne @f
469
  jne @f
451
		stdcall [ted_but_redo], tedit0
470
    stdcall [ted_but_redo], tedit0
452
		jmp still
471
  @@:
453
	@@:
472
  cmp ah,18
454
	cmp ah,18
-
 
455
	jne @f
473
  jne @f
456
		stdcall but_sumb_invis, tedit0
474
    stdcall but_sumb_invis, tedit0
457
		jmp still
475
  @@:
458
	@@:
476
  cmp ah,19
459
	cmp ah,19
-
 
460
	jne @f
477
  jne @f
461
		stdcall but_k_words_show, tedit0
478
    stdcall but_k_words_show, tedit0
462
		jmp still
479
  @@:
463
	@@:
480
  cmp ah,20
464
	cmp ah,20
-
 
465
	jne @f
481
  jne @f
466
		stdcall but_synt_show, tedit0
482
    stdcall but_synt_show, tedit0
467
		jmp still
483
  @@:
468
	@@:
484
  cmp ah,21
469
	cmp ah,21
-
 
470
	jne @f
485
  jne @f
471
		stdcall [ted_but_convert_by_table],tedit0,tbl_1251_866
486
    stdcall [ted_but_convert_by_table],tedit0,tbl_1251_866
472
		jmp still
487
  @@:
473
	@@:
488
  cmp ah,22
474
	cmp ah,22
-
 
475
	jne @f
489
  jne @f
476
		stdcall [ted_but_convert_by_table],tedit0,tbl_866_1251
Line 490... Line 477...
490
    stdcall [ted_but_convert_by_table],tedit0,tbl_866_1251
477
		jmp still
491
  @@:
478
	@@:
492
 
479
 
-
 
480
	cmp ah,200
493
  cmp ah,200
481
	jne @f
494
  jne @f
482
		stdcall ted_but_open_syntax, tedit0
495
    stdcall ted_but_open_syntax, tedit0
483
		jmp still
496
  @@:
484
	@@:
-
 
485
	cmp ah,201
497
  cmp ah,201
486
	jne @f
Line 498... Line 487...
498
  jne @f
487
		stdcall [ted_but_find_next], tedit0
499
    stdcall [ted_but_find_next], tedit0
488
		jmp still