Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
1449 IgorA 1
;Огромная благодарность Maxxxx32, Diamond, Heavyiron
2
;и другим программистам, а также
3
;Теплову Алексею ( www.lrz.land.ru)
1338 IgorA 4
 
5
 
6
use32
7
  org 0x0
1449 IgorA 8
  db 'MENUET01' ;идентиф. исполняемого файла всегда 8 байт
1338 IgorA 9
  dd 0x01
10
  dd start
1449 IgorA 11
  dd i_end ; размер приложения
1338 IgorA 12
  dd mem
13
  dd stacktop
1449 IgorA 14
  dd file_name ; command line
1338 IgorA 15
  dd sys_path
16
 
17
MAX_COLOR_WORD_LEN equ 40
18
maxChars equ 100002 ;(...+2)
19
BUF_SIZE equ 1000 ;bufer for copy|paste
20
maxColWords equ 10000
21
 
1449 IgorA 22
include '../../proc32.inc'
1338 IgorA 23
include '../../macros.inc'
1390 IgorA 24
include '../../develop/libraries/box_lib/load_lib.mac'
1449 IgorA 25
include '../../develop/libraries/box_lib/trunk/box_lib.mac'
1338 IgorA 26
 
1343 IgorA 27
include 'lang.inc'
1338 IgorA 28
include 't_data.inc'
29
include 'strlen.inc'
30
include 't_work.inc' ;text work functions
31
include 't_draw.inc' ;draw main window functions
32
include 't_button.inc'
33
 
34
@use_library
35
 
36
start:
37
  mov eax,48
38
  mov ebx,3
39
  mov ecx,sc
40
  mov edx,sizeof.system_colors
41
  mcall
42
 
43
  m2m [wScr.bckg_col],[sc.work]
44
  m2m [wScr.frnt_col],[sc.work_button]
45
  m2m [wScr.line_col],[sc.work_button_text]
46
 
47
  m2m [hScr.bckg_col],[sc.work]
48
  m2m [hScr.frnt_col],[sc.work_button]
49
  m2m [hScr.line_col],[sc.work_button_text]
50
 
51
 
52
  mcall 68,11
53
  or eax,eax
54
  jz button.exit
55
 
56
  mcall 66,1,1 ;scan code
57
  ;mcall 26,2,1,conv_tabl
58
 
59
  mov ecx,sizeof.symbol*maxChars
60
  call mem_Alloc
61
  mov [tex],eax
62
  mov [tex_1],eax
63
  add [tex_1],sizeof.symbol
64
  mov [tex_end],eax
65
  add [tex_end],sizeof.symbol*maxChars
66
 
67
  mcall 40,0x27
68
 
69
  call Clear
70
 
71
;-------------------------------------------------
1390 IgorA 72
  mov ecx,maxColWords*sizeof.TexColViv+40
73
  ;add ecx,40
1338 IgorA 74
  call mem_Alloc
75
  mov [options_file],eax
76
  mov [options_file_end],eax
77
  add [options_file_end],maxColWords*sizeof.TexColViv
78
  add [options_file_end],40
79
 
80
;-------------------------------------------------
81
; init bmp file
82
  mov ecx,1200*18
83
  call mem_Alloc
84
  mov [bmp_icon],eax
85
 
86
  mov esi,file_name
87
  call strlen
88
  mov ecx,eax
89
  mov edi,buf_cmd_lin
90
  rep movsb
91
 
1390 IgorA 92
  copy_path fn_icon,sys_path,file_name,0x0
1338 IgorA 93
 
94
  mov eax,70 ;load icon file
95
  mov [run_file_70.func_n], 0
96
  mov [run_file_70.param1], 54
97
  mov [run_file_70.param2], 0
98
  mov [run_file_70.param3], 1200*18
99
  m2m [run_file_70.param4], [bmp_icon]
100
  mov [run_file_70.rezerv], 0
101
  mov [run_file_70.name], file_name
102
  mov ebx,run_file_70
103
  int 0x40
104
 
105
  cmp ebx,-1
106
  mov [err_ini0],1
107
  je @f ;if open file
108
    mov [err_ini0],0
109
  @@:
110
 
111
load_libraries l_libs_start,load_lib_end
112
 
113
;проверка на сколько удачно загузилась наша либа
114
	mov	ebp,lib0
115
	cmp	dword [ebp+ll_struc_size-4],0
116
	jz	@f
117
	mcall	-1	;exit not correct
118
@@:
119
	mov	ebp,lib1 ;
120
	cmp	dword [ebp+ll_struc_size-4],0
121
	jz	@f
122
	mcall	-1	;exit not correct
123
@@:
124
 
125
 
126
;---------------------------------------------------------------------
127
  push dword tree1
128
  call dword[tl_data_init]
129
;---------------------------------------------------------------------
1449 IgorA 130
; читаем bmp файл с курсорами и линиями
1390 IgorA 131
  copy_path fn_icon_tl_sys,sys_path,file_name,0x0
1338 IgorA 132
 
133
  mov ecx,3*256*13
134
  call mem_Alloc
135
  mov dword[tree1.data_img_sys],eax
136
 
1343 IgorA 137
  ;mov [run_file_70.func_n], 0
138
  ;mov [run_file_70.param1], 54
139
  ;mov [run_file_70.param2], 0
1338 IgorA 140
  mov [run_file_70.param3], 3*256*13
141
  mov [run_file_70.param4], eax
1343 IgorA 142
  ;mov [run_file_70.rezerv], 0
143
  ;mov [run_file_70.name], file_name
1338 IgorA 144
 
145
  mov eax,70 ;load icon file
146
  mov ebx,run_file_70
147
  int 0x40
148
  cmp ebx,0
149
  jg @f
150
    mov dword[tree1.data_img_sys],0
151
  @@:
152
;---------------------------------------------------------------------
1449 IgorA 153
; читаем bmp файл с иконками узлов
1390 IgorA 154
  copy_path fn_icon_tl_nod,sys_path,file_name,0x0
1338 IgorA 155
 
156
  mov ecx,3*256*2
157
  call mem_Alloc
158
  mov dword[tree1.data_img],eax
159
 
160
;  mov [run_file_70.func_n], 0
161
;  mov [run_file_70.param1], 54
162
;  mov [run_file_70.param2], 0
163
  mov [run_file_70.param3], 3*256*2
164
  mov [run_file_70.param4], eax
165
;  mov [run_file_70.rezerv], 0
166
;  mov [run_file_70.name], file_name
167
 
168
  mov eax,70 ;load icon file
169
  mov ebx,run_file_70
170
  int 0x40
171
  cmp ebx,0
172
  jg @f
173
    mov dword[tree1.data_img],0
174
  @@:
175
;------------------------------------------------------------------------------
1449 IgorA 176
  copy_path fn_syntax_dir,sys_path,file_name,0x0 ;берем путь к папке с файлами синтаксиса
1338 IgorA 177
  mov eax,70
178
  mov ebx,tree_file_struct
179
  int 0x40
180
 
181
cmp ebx,-1
182
je .end_dir_init
183
 
184
  mov eax,dir_mem
185
  add eax,32+4+1+3+4*6+8
186
mov ecx,ebx
187
@@:
1449 IgorA 188
  cmp byte[eax],'.' ;фильтруем файлы с именами '.' и '..'
1338 IgorA 189
  je .filter
190
    push dword tree1
1449 IgorA 191
    push dword 0x10000 ;1*2^16 - где 1 номер иконки с книгой
1338 IgorA 192
    push dword eax
193
    call dword[tl_node_add]
194
 
195
    push dword tree1
196
    call dword[tl_cur_next]
197
  .filter:
198
  add eax,304
199
  loop @b
200
.end_dir_init:
201
 
202
;  push dword tree1
203
;  push dword 0
204
;  push dword file_name
205
;  call dword[tl_node_add]
206
 
207
 
208
;--- load color option file ---
209
  call InitColText
210
 
211
;--- get cmd line ---
212
  cmp byte[buf_cmd_lin+3],0 ;buf_cmd_lin
213
  je @f ;if file names exist
214
    mov esi,buf_cmd_lin
215
    call strlen ;eax=strlen
216
    mov [edit1.size],eax
217
    call but_OpenFile
218
  @@:
219
 
220
 
221
red_win:
1343 IgorA 222
  mcall 12,1
1338 IgorA 223
 
224
  xor eax,eax
225
  mov ebx,10*65536+485
226
  mov ecx,10*65536+280
227
  mov edx,[sc.work]
228
  or  edx,0x73000000
229
  mov edi,hed
1449 IgorA 230
  int 0x40
1338 IgorA 231
 
1449 IgorA 232
  mov edi,tedit0
233
 
1338 IgorA 234
  mcall 9,procinfo,-1
1449 IgorA 235
  stdcall EvSize,edi
1338 IgorA 236
 
1449 IgorA 237
  mov eax,13 ;тхЁїэшщ яЁ ьюєуюы№эшъ, фы  юўшёЄъш тхЁїэхщ ярэхыш
1338 IgorA 238
  xor ebx,ebx
1449 IgorA 239
  mov ecx,ted_wnd_t
1338 IgorA 240
  mov bx,word [procinfo.client_box.width]
241
  inc bx
1449 IgorA 242
  int 0x40
1338 IgorA 243
 
1449 IgorA 244
  stdcall [edit_box_draw], dword edit1
245
  stdcall [menu_bar_draw], dword menu_data_1
1338 IgorA 246
 
247
  call draw_but_toolbar
248
 
249
  cmp [err_ini0],1
250
  jne @f
251
    mov eax,4
1449 IgorA 252
    mov ebx,ted_wnd_l
253
    add ebx,ted_rec_l
1338 IgorA 254
    shl ebx,16
1449 IgorA 255
    add ebx,ted_wnd_t
256
    add ebx,ted_rec_t
1338 IgorA 257
    mov ecx,0x80ff0000
258
    mov edx,txtErrIni0
259
    int 0x40
260
 
261
    add ebx,10 ;move <--y-->
262
    mov ecx,0x80ff0080
263
    mov edx,file_name
264
    int 0x40
265
  @@:
266
 
267
  cmp [err_ini0],1
268
  je @f
1449 IgorA 269
    stdcall draw_main_win, tedit0
1338 IgorA 270
  @@:
271
 
1343 IgorA 272
  mcall 12,2
1338 IgorA 273
 
274
still:
275
  mov eax,10
276
  mcall
277
 
1449 IgorA 278
  cmp al,1 ;изм. положение окна
1338 IgorA 279
  jz red_win
280
  cmp al,2
281
  jz key
282
  cmp al,3
283
  jz button
284
  cmp al,6
285
  jz mouse
286
 
287
  jmp still
288
 
289
 
290
 
291
mouse:
1449 IgorA 292
  stdcall [edit_box_mouse], dword edit1
1338 IgorA 293
 
294
  test word [edit1.flags],10b;ed_focus ; если не в фокусе, выходим
295
  jne still
296
 
297
;-----------------------------------------------
298
  cmp [hScr.delta2],0
299
  jne .horizontal
300
.vertical:
301
  mov eax,[wScr.max_area]
302
  cmp eax,[wScr.cur_area]
303
  jbe .horizontal
304
; mouse event for Vertical ScrollBar
1449 IgorA 305
  stdcall [scrollbar_ver_mouse], dword wScr
1338 IgorA 306
  mov eax,wScr.redraw
307
  xor ebx,ebx
308
  cmp [eax],ebx
309
  je @f
310
  mov [eax],ebx
311
 
1449 IgorA 312
  stdcall draw_main_win, tedit0
1338 IgorA 313
  jmp still
314
@@:
315
  cmp [wScr.delta2],0
316
  jne still
317
.horizontal:
318
    mov   eax,[hScr.max_area]
319
    cmp   eax,[hScr.cur_area]
320
    jbe   .other
321
; mouse event for Horizontal ScrollBar
322
	push dword hScr
323
	call [scrollbar_hor_mouse]
324
	mov eax,hScr.redraw
325
	xor ebx,ebx
326
	cmp [eax],ebx
327
	je .other
328
	mov [eax],ebx
1449 IgorA 329
  stdcall draw_main_win, tedit0
1338 IgorA 330
  jmp still
331
.other:
332
  cmp [wScr.delta2],0
333
  jne still
334
  cmp [hScr.delta2],0
335
  jne still
336
 
1449 IgorA 337
  stdcall mouse_wnd_main, tedit0
1338 IgorA 338
 
339
  cmp byte[panel_id],TE_PANEL_FIND ;if not panel
340
  jne @f
341
    push dword edit2
342
    call [edit_box_mouse]
343
  @@:
344
  cmp byte[panel_id],TE_PANEL_SYNTAX ;if not panel
345
  jne .menu_bar_1 ;@f
346
  push dword tree1
347
  call [tl_mouse]
348
;-----------------------------------------------
349
.menu_bar_1:
350
  mov [menu_data_1.get_mouse_flag],1
351
; mouse event for Menu 1
352
  push	dword menu_data_1
353
  call	[menu_bar_mouse]
354
  cmp	[menu_data_1.click],dword 1
355
  jne	.mnu_1
356
  cmp [menu_data_1.cursor_out],dword 4
357
  je	button.exit
358
  cmp [menu_data_1.cursor_out],dword 3
359
  jne	@f
360
    call but_SaveFile
361
  @@:
362
  cmp [menu_data_1.cursor_out],dword 2
363
  jne	@f
364
    call but_OpenFile
365
  @@:
366
  cmp [menu_data_1.cursor_out],dword 1
367
  jne	@f
368
    call but_NewFile
369
  @@:
370
  ;cmp [menu_data_1.cursor_out],dword 0
371
  ;jne @f
372
.mnu_1:
373
  jmp still
374
;---------------------------------------------------------------------
375
 
376
KeyConvertToASCII:
377
  mov ebx,conv_tabl ;convert scan to ascii
378
  ror ax,8
379
  xor ah,ah
380
  add bx,ax
381
  mov ah,byte[ebx]
382
  ret
383
 
384
key:
385
  mov ecx,1
386
  mcall 66,3
387
  xor ebx,ebx
388
  test al,0x03 ;[Shift]
389
  jz @f
390
    inc cl
391
    or ebx,KM_SHIFT
392
  @@:
393
  test al,0x0c ;[Ctrl]
394
  jz @f
395
    or ebx,KM_CTRL
396
  @@:
397
  test al,0x30 ;[Alt]
398
  jz @f
399
    or ebx,KM_ALT
400
  @@:
401
  test al,0x80 ;[NumLock]
402
  jz @f
403
    or ebx,KM_NUMLOCK
404
  @@:
405
 
406
  mov [keyUpr],ebx
407
  mcall 26,2,,conv_tabl
408
  mcall 2
409
 
410
;  push dword tree1 ;???
411
;  call [tl_key]    ;???
412
 
413
  test word [edit1.flags],10b;ed_focus ; если не в фокусе, выходим
414
  je @f
415
    cmp ah,0x80 ;if key up
416
    ja still
417
    cmp ah,42 ;[Shift] (left)
418
    je still
419
    cmp ah,54 ;[Shift] (right)
420
    je still
421
    cmp ah,56 ;[Alt]
422
    je still
423
    cmp ah,29 ;[Ctrl]
424
    je still
425
    cmp ah,69 ;[Pause Break]
426
    je still
427
;    cmp [keyUpr],0
428
;    jne still
429
 
430
    call KeyConvertToASCII
431
 
432
    push dword edit1
433
    call [edit_box_key]
434
    jmp still
435
  @@:
436
 
437
  test word [edit2.flags],10b;ed_focus ; если не в фокусе, выходим
438
  je @f
439
    cmp ah,0x80 ;if key up
440
    ja still
441
    cmp ah,42 ;[Shift] (left)
442
    je still
443
    cmp ah,54 ;[Shift] (right)
444
    je still
445
    cmp ah,56 ;[Alt]
446
    je still
447
    cmp ah,29 ;[Ctrl]
448
    je still
449
    cmp ah,69 ;[Pause Break]
450
    je still
451
;    cmp [keyUpr],0
452
;    jne still
453
 
454
    call KeyConvertToASCII
1449 IgorA 455
    stdcall [edit_box_key], dword edit2
1338 IgorA 456
    jmp still
457
  @@:
458
 
459
  cmp ah,KEY_F1 ;[F1]
460
  jne @f
461
    call ShowHelpF1
462
    jmp still
463
  @@:
464
  cmp ah,KEY_F3 ;[F3]
465
  jne @f
466
    call but_FindText
467
    jmp still
468
  @@:
469
 
470
  test [keyUpr],KM_CTRL ;Ctrl+...
471
  jz .key_Ctrl
472
 
473
    cmp ah,24 ;Ctrl+O
474
    jne @f
475
      call but_OpenFile
476
    @@:
477
    cmp ah,33 ;Ctrl+F
478
    jne @f
479
    cmp byte[panel_id],TE_PANEL_FIND
480
    je @f
1449 IgorA 481
      stdcall but_find, tedit0
1338 IgorA 482
    @@:
483
    cmp ah,44 ;Ctrl+Z
484
    je but_undo
485
    cmp ah,46 ;Ctrl+C
486
    jne @f
487
      call but_Copy
488
    @@:
489
    cmp ah,47 ;Ctrl+V
490
    je but_paste
491
    cmp ah,49 ;Ctrl+N
492
    jne @f
493
      call but_NewFile
494
    @@:
495
    cmp ah,199 ;Ctrl+Home
496
    jne @f
497
      call but_CtrlHome
498
    @@:
499
    ;jmp still
500
  .key_Ctrl:
501
 
502
  test [keyUpr],KM_SHIFT ;Shift+...
503
  jz .key_Shift
504
    cmp ah,72 ;Shift+Up
505
    jne @f
506
      call sel_KeyUp
507
    @@:
508
    cmp ah,75 ;Shift+Left
509
    jne @f
510
      call sel_KeyLeft
511
    @@:
512
    cmp ah,77 ;Shift+Right
513
    jne @f
514
      call sel_KeyRight
515
    @@:
516
    cmp ah,80 ;Shift+Down
517
    jne @f
518
      call sel_KeyDown
519
    @@:
1449 IgorA 520
    ;mov [dragk],1 ;начинаем выделение от клавиатуры
1338 IgorA 521
    jmp .key_MoveCur
522
  .key_Shift:
523
;-------------------------------------------------
524
  cmp ah,72 ;178 ;Up
525
  jne @f
526
    push dx
1449 IgorA 527
    stdcall draw_cursor_sumb, tedit0
1338 IgorA 528
    call CurMoveUp
529
    cmp dl,8
530
    jne .no_red_0
531
      call OnInitialUpdate
1449 IgorA 532
      stdcall draw_main_win, tedit0
1338 IgorA 533
      pop dx
534
      jmp @f
535
    .no_red_0:
1449 IgorA 536
    stdcall draw_main_cursor, tedit0
1338 IgorA 537
    pop dx
1449 IgorA 538
    mov [dragk],0 ;заканчиваем выделение от клавиатуры
1338 IgorA 539
  @@:
540
  cmp ah,80 ;177 ;Down
541
  jne @f
542
    push dx
1449 IgorA 543
    stdcall draw_cursor_sumb, tedit0
1338 IgorA 544
    call CurMoveDown
545
    cmp dl,8
546
    jne .no_red_1
547
      call OnInitialUpdate
1449 IgorA 548
      stdcall draw_main_win, tedit0
1338 IgorA 549
      pop dx
550
      jmp @f
551
    .no_red_1:
1449 IgorA 552
    stdcall draw_main_cursor, tedit0
1338 IgorA 553
    pop dx
1449 IgorA 554
    mov [dragk],0 ;заканчиваем выделение от клавиатуры
1338 IgorA 555
  @@:
556
  cmp ah,75 ;176 ;Left
557
  jne @f
558
    push dx
1449 IgorA 559
    stdcall draw_cursor_sumb, tedit0
1338 IgorA 560
    call CurMoveLeft
561
    cmp dl,8
562
    jne .no_red_2
563
      call OnInitialUpdate
1449 IgorA 564
      stdcall draw_main_win, tedit0
1338 IgorA 565
      pop dx
566
      jmp @f
567
    .no_red_2:
1449 IgorA 568
    stdcall draw_main_cursor, tedit0
1338 IgorA 569
    pop dx
1449 IgorA 570
    mov [dragk],0 ;заканчиваем выделение от клавиатуры
1338 IgorA 571
  @@:
572
  cmp ah,77 ;179 ;Right
573
  jne @f
574
    push dx
1449 IgorA 575
    stdcall draw_cursor_sumb, tedit0
1338 IgorA 576
    call CurMoveRight
577
    cmp dl,8
578
    jne .no_red_3
579
      call OnInitialUpdate
1449 IgorA 580
      stdcall draw_main_win, tedit0
1338 IgorA 581
      pop dx
582
      jmp @f
583
    .no_red_3:
1449 IgorA 584
    stdcall draw_main_cursor, tedit0
1338 IgorA 585
    pop dx
1449 IgorA 586
    mov [dragk],0 ;заканчиваем выделение от клавиатуры
1338 IgorA 587
  @@:
588
  cmp ah,71 ;180 ;Home
589
  jne @f
590
    push dx
1449 IgorA 591
    stdcall draw_cursor_sumb, tedit0
1338 IgorA 592
    call CurMoveX_FirstChar
593
    cmp dl,8
594
    jne .no_red_4
595
      call OnInitialUpdate
1449 IgorA 596
      stdcall draw_main_win, tedit0
1338 IgorA 597
      pop dx
598
      jmp @f
599
    .no_red_4:
1449 IgorA 600
    stdcall draw_main_cursor, tedit0
1338 IgorA 601
    pop dx
1449 IgorA 602
    mov [dragk],0 ;заканчиваем выделение от клавиатуры
1338 IgorA 603
  @@:
604
  cmp ah,79 ;181 ;End
605
  jne @f
606
    push dx
1449 IgorA 607
    stdcall draw_cursor_sumb, tedit0
1338 IgorA 608
    call CurMoveX_LastChar
609
    cmp dl,8
610
    jne .no_red_5
611
      call OnInitialUpdate
1449 IgorA 612
      stdcall draw_main_win, tedit0
1338 IgorA 613
      pop dx
614
      jmp @f
615
    .no_red_5:
1449 IgorA 616
    stdcall draw_main_cursor, tedit0
1338 IgorA 617
    pop dx
1449 IgorA 618
    mov [dragk],0 ;заканчиваем выделение от клавиатуры
1338 IgorA 619
  @@:
620
  cmp ah,73 ;184 ;PageUp
621
  jne @f
622
    push dx
623
    call CurMovePageUp
624
    cmp dl,0
625
    pop dx
626
    je @f
627
    call OnInitialUpdate
1449 IgorA 628
    stdcall draw_main_win, tedit0
1338 IgorA 629
  @@:
630
  cmp ah,81 ;183 ;PageDown
631
  jne @f
632
    push dx
633
    call CurMovePageDown
634
    cmp dl,0
635
    pop dx
636
    je @f
637
    call OnInitialUpdate
1449 IgorA 638
    stdcall draw_main_win, tedit0
639
    mov [dragk],0 ;заканчиваем выделение от клавиатуры
1338 IgorA 640
  @@:
641
;-------------------------------------------------
642
    cmp [keyUpr],0
643
    jne still
644
  .key_MoveCur:
645
 
646
  cmp ah,69 ;[Pause Break]
647
  je still
648
  cmp ah,120 ;[Fn]
649
  je still
650
  cmp ah,0x80 ;if key up
651
  ja still
652
  call KeyConvertToASCII
653
 
1449 IgorA 654
  ;mov [dragk],0 ;заканчиваем выделение от клавиатуры
1338 IgorA 655
 
656
  push ebx
657
  xor ebx,ebx
658
  mov bl,ah
659
  add ebx,EvChar ;add char to text
660
  cmp byte [ebx],1
661
  jne @f
662
    push esi edi
663
    call SetUndo
664
    mov bx,0x0101
665
    call SelTextDel
666
    mov esi,1
667
    mov byte [key_new],ah
668
    mov edi,dword key_new
669
    cmp [curMod],1
670
    je .no_ins_mod
671
      call TextDel
672
      xor bl,1
673
    .no_ins_mod:
674
    call TextAdd
675
    call draw_but_toolbar
676
    cmp byte [key_new],13
677
    jne .dr_m_win
1449 IgorA 678
      stdcall draw_main_win, tedit0
1338 IgorA 679
      jmp .dr_cur_l
680
    .dr_m_win:
1449 IgorA 681
      stdcall draw_cur_line, tedit0
1338 IgorA 682
    .dr_cur_l:
683
    pop edi esi
684
  @@:
685
  pop ebx
686
 
687
  cmp ah,8 ;[<-]
688
  jne @f
689
    push ax bx
690
    call SetUndo
691
 
692
    mov bx,0x0001
693
    call SelTextDel
694
    cmp al,1
695
    je .del_one_b
696
      call TextDel
697
    .del_one_b:
698
    call draw_but_toolbar
1449 IgorA 699
    stdcall draw_main_win, tedit0
1338 IgorA 700
    pop bx ax
701
  @@:
702
 
703
  cmp ah,182 ;Delete
704
  jne @f
705
    push ax bx
706
    call SetUndo
707
 
708
    mov bx,0x0101
709
    call SelTextDel
710
    cmp al,1
711
    je .del_one_d
712
      call TextDel
713
    .del_one_d:
714
    call draw_but_toolbar
1449 IgorA 715
    stdcall draw_main_win, tedit0
1338 IgorA 716
    pop bx ax
717
  @@:
718
 
719
  cmp ah,185 ;Ins
720
  jne @f
1449 IgorA 721
    stdcall draw_cursor_sumb, tedit0
1338 IgorA 722
    xor [curMod],1
1449 IgorA 723
    stdcall draw_main_cursor, tedit0
1338 IgorA 724
  @@:
725
 
726
  jmp still
727
 
728
button:
1449 IgorA 729
;  cmp [menu_active],1 ;если нажали меню, то сначала реакция на меню
1338 IgorA 730
;  jne @f ;mouse.menu_bar_1
731
;    mov [menu_active],0
732
;    jmp still
733
;  @@:
734
 
1449 IgorA 735
  mcall 17 ;получить код нажатой кнопки
1338 IgorA 736
  cmp ah,3
737
  jne @f
738
    call but_NewFile
739
  @@:
740
  cmp ah,4
741
  jne @f
742
    call but_OpenFile
743
  @@:
744
  cmp ah,5
745
  jne @f
746
    call but_SaveFile
747
  @@:
748
  cmp ah,6
749
  jz  but_select_word
750
  cmp ah,7
751
  jz  but_cut
752
  cmp ah,8
753
  jne @f
754
    call but_Copy
755
  @@:
756
  cmp ah,9
757
  jz  but_paste
758
  cmp ah,10
1449 IgorA 759
  jne @f
760
    stdcall but_find, tedit0
761
  @@:
1338 IgorA 762
  cmp ah,11
763
  jz  but_replace
764
  cmp ah,12
765
  jz  but_find_key_w
766
  cmp ah,13
767
  jz  but_sumb_upper
768
  cmp ah,14
769
  jz  but_sumb_lover
770
  cmp ah,15
771
  jz  but_reverse
772
  cmp ah,16
773
  jz  but_undo
774
  cmp ah,17
775
  jz  but_redo
776
  cmp ah,18
777
  jz  but_sumb_invis
778
  cmp ah,19
779
  jz  but_k_words_show
780
  cmp ah,20
1449 IgorA 781
  jne @f
782
    stdcall but_synt_show, tedit0
783
  @@:
1338 IgorA 784
 
785
  cmp ah,200
786
  jne @f
787
    call but_OpenSyntax
788
  @@:
789
  cmp ah,201
790
  jne @f
791
    call but_FindText
792
  @@:
793
 
794
  cmp ah,1
795
  jne still
796
.exit:
797
  ;push eax
798
  call CanSave
799
  cmp al,1
800
  jne @f
801
    push thread
802
    push msgbox_8
803
    call [mb_create] ;message: save changes in file?
804
    jmp still
805
  @@:
806
  mov ecx,[tex]
807
  call mem_Free
808
  mov ecx,[bmp_icon]
809
  call mem_Free
810
  mov ecx,[options_file]
811
  call mem_Free
812
  push dword tree1
813
  call dword[tl_data_clear]
1449 IgorA 814
  mcall -1 ;выход из программы
1338 IgorA 815
 
816
 
817
 
818
txtErrIni0 db 'Не открылся файл с иконками',0
819
err_ini0 db 0
820
 
821
edit1 edit_box 250, 220, 5, 0xffffff, 0xff80, 0xff0000, 0xff, 0x4080, 300, buf_cmd_lin, mouse_dd, 0
822
edit2 edit_box TE_PANEL_WIDTH-1, 0, 20, 0xffffff, 0xff80, 0xff0000, 0xff, 0x4080, 300, buf_find, mouse_dd, 0
823
 
824
buf_cmd_lin db 302 dup(0)
825
buf_find db 302 dup(0)
826
 
1343 IgorA 827
if lang eq ru
828
  err_message_found_lib0 db 'Извините не удалось найти библиотеку box_lib.obj',0
829
  head_f_i0:
830
  head_f_l0  db 'Системная ошибка',0
831
  err_message_import0 db 'Ошибка при импорте библиотеки box_lib.obj',0
832
  err_message_found_lib1 db 'Извините не удалось найти библиотеку msgbox.obj',0
833
  err_message_import1 db 'Ошибка при импорте библиотеки msgbox.obj',0
834
else
835
  err_message_found_lib0 db 'Sorry I cannot found library box_lib.obj',0
836
  head_f_i0:
837
  head_f_l0  db 'System error',0
838
  err_message_import0 db 'Error on load import library box_lib.obj',0
839
  err_message_found_lib1 db 'Sorry I cannot found library msgbox.obj',0
840
  ;head_f_i1:
841
  ;head_f_l1 db 'System error',0
842
  err_message_import1 db 'Error on load import library msgbox.obj',0
843
end if
1338 IgorA 844
 
845
;library structures
846
l_libs_start:
847
  lib0 l_libs boxlib_name, sys_path, file_name, system_dir0, err_message_found_lib0, head_f_l0, myimport,err_message_import0, head_f_i0
848
  lib1 l_libs msgbox_name, sys_path, file_name, system_dir1, err_message_found_lib1, head_f_l0, msgbox_lib_import, err_message_import1, head_f_i0
849
load_lib_end:
850
 
851
 
852
i_end:
853
  align 16
854
  procinfo process_information
855
  thread:
856
    rb 1024
857
stacktop:
858
  sys_path:
859
    rb 4096
860
  file_name:
861
    rb 4096
862
  file_name_rez:
863
    rb 4096
864
  file_info:
865
    rb 40
866
mem: