Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
7573 IgorA 1
 
2
 
3
	mcall SF_REDRAW,SSF_BEGIN_DRAW
4
5
	mov edx,[sc.work]
6
 
7
	mcall SF_CREATE_WINDOW,dword[wnd_s_pos],dword[wnd_s_pos+4],,,hed
8
9
	mcall SF_THREAD_INFO,procinfo,-1
10
 
11
	call EvSize
12
13
	movzx ebx,word[procinfo.client_box.width]
14
 
15
	mcall SF_DRAW_RECT,,ted_wnd_t ;верхний прямоугольник, для очистки верхней панели
16
	call draw_but_toolbar
17
	stdcall [kmainmenu_draw], [main_menu]
18
	stdcall [ted_draw], tedit0
19
20
	mcall SF_REDRAW,SSF_END_DRAW
21
 
22
23
align 4
24
 
1456 IgorA 25
	pushad
1457 IgorA 26
	mov edi,tedit0
6087 IgorA 27
28
	mov ecx,0x40000000+ID_BUT_NEW
1338 IgorA 29
 
7573 IgorA 30
	bt word[panel_but],0
7488 IgorA 31
	jnc @f
32
		call draw_but_icon ;New
33
	@@:
34
35
	mov cx,ID_BUT_OPEN
1338 IgorA 36
 
7573 IgorA 37
	jnc @f
7488 IgorA 38
		add edx,25 shl 16
39
		call draw_but_icon ;Open
40
	@@:
41
42
	stdcall [ted_can_save],edi
1338 IgorA 43
 
6087 IgorA 44
	je @f
45
		and ecx,0xffff
46
	@@:
47
	mov cx,ID_BUT_SAVE
48
	bt word[panel_but+2],0
7573 IgorA 49
	jnc @f
7488 IgorA 50
		add edx,25 shl 16
51
		call draw_but_icon ;Save
52
	@@:
53
	or ecx,0x40000000
54
6087 IgorA 55
	mov cx,ID_BUT_SAVE_AS
1338 IgorA 56
 
7573 IgorA 57
	jnc @f
7488 IgorA 58
		add edx,25 shl 16
59
		call draw_but_icon ;Save as
7571 IgorA 60
	@@:
61
62
	mov cx,ID_BUT_SELECT
63
 
7573 IgorA 64
	jnc @f
7571 IgorA 65
		add edx,30 shl 16
66
		call draw_but_icon ;Select word
7488 IgorA 67
	@@:
68
69
	call [ted_is_select]
1338 IgorA 70
 
6087 IgorA 71
	jnz @f
7488 IgorA 72
		and ecx,0xffff
73
	@@:
6087 IgorA 74
	mov cx,ID_BUT_CUT
75
	bt word[panel_but+5],0
7573 IgorA 76
	jnc @f
7571 IgorA 77
		add edx,25 shl 16
7488 IgorA 78
		call draw_but_icon ;Cut
79
	@@:
80
81
	mov cx,ID_BUT_COPY
1338 IgorA 82
 
7573 IgorA 83
	jnc @f
7571 IgorA 84
		add edx,25 shl 16
7488 IgorA 85
		call draw_but_icon ;Copy
86
	@@:
87
	or ecx,0x40000000
88
6087 IgorA 89
	cmp dword[buf],0
1338 IgorA 90
 
6087 IgorA 91
		and ecx,0xffff
92
	@@:
93
	mov cx,ID_BUT_PASTE
94
	bt word[panel_but+7],0
7573 IgorA 95
	jnc @f
7571 IgorA 96
		add edx,25 shl 16
7488 IgorA 97
		call draw_but_icon ;Paste
98
	@@:
99
	or ecx,0x40000000
100
6087 IgorA 101
	mov cx,ID_BUT_FIND
1338 IgorA 102
 
7573 IgorA 103
	jnc @f
7571 IgorA 104
		add edx,25 shl 16
7488 IgorA 105
		call draw_but_icon ;Found
106
	@@:
107
108
	mov cx,ID_BUT_REPLACE
1338 IgorA 109
 
7573 IgorA 110
	jnc @f
7571 IgorA 111
		add edx,25 shl 16
7488 IgorA 112
		call draw_but_icon ;Replace
113
	@@:
114
115
	mov cx,ID_BUT_KEY_WORDS
1338 IgorA 116
 
7573 IgorA 117
	jnc @f
7571 IgorA 118
		add edx,25 shl 16
7488 IgorA 119
		call draw_but_icon ;Key words
120
	@@:
121
122
	call [ted_is_select]
1338 IgorA 123
 
7488 IgorA 124
	jnz @f
125
		and ecx,0xffff
126
	@@:
127
	mov cx,ID_BUT_UPPER
128
	bt word[panel_but+11],0
7573 IgorA 129
	jnc @f
7571 IgorA 130
		add edx,30 shl 16
7488 IgorA 131
		call draw_but_icon ;Upper
132
	@@:
133
134
	mov cx,ID_BUT_LOWER
135
 
7573 IgorA 136
	jnc @f
7571 IgorA 137
		add edx,25 shl 16
7488 IgorA 138
		call draw_but_icon ;Lower
139
	@@:
140
141
	mov cx,ID_BUT_REVERSE
142
 
7573 IgorA 143
	jnc @f
7571 IgorA 144
		add edx,25 shl 16
7488 IgorA 145
		call draw_but_icon ;Reverse
146
	@@:
147
	or ecx,0x40000000
148
149
	mov ebx,ted_tim_undo
150
 
6087 IgorA 151
	jg @f
152
		and ecx,0xffff
153
	@@:
154
	mov cx,ID_BUT_UNDO
155
	bt word[panel_but+14],0
7573 IgorA 156
	jnc @f
7571 IgorA 157
		add edx,30 shl 16
7488 IgorA 158
		call draw_but_icon ;Undo
159
	@@:
160
	or ecx,0x40000000
161
6087 IgorA 162
	cmp ted_tim_undo,1
1338 IgorA 163
 
6087 IgorA 164
		and ecx,0xffff
165
	@@:
166
	mov cx,ID_BUT_REDO
167
	bt word[panel_but+15],0
7573 IgorA 168
	jnc @f
7571 IgorA 169
		add edx,25 shl 16
7488 IgorA 170
		call draw_but_icon ;Redo
171
	@@:
172
	or ecx,0x40000000
173
6087 IgorA 174
	mov cx,ID_BUT_INVISIBLE
1338 IgorA 175
 
7573 IgorA 176
	jnc @f
7571 IgorA 177
		add edx,30 shl 16
7488 IgorA 178
		call draw_but_icon ;Invisible on|off
179
	@@:
180
181
	mov cx,ID_BUT_SYNTAX_LIST
1338 IgorA 182
 
7573 IgorA 183
	jnc @f
7571 IgorA 184
		add edx,25 shl 16
7488 IgorA 185
		call draw_but_icon ;Выбор файла подсветки
186
	@@:
7571 IgorA 187
7488 IgorA 188
	mov cx,ID_BUT_SYNTAX_MODE
1338 IgorA 189
 
7573 IgorA 190
	jnc @f
7571 IgorA 191
		add edx,25 shl 16
7488 IgorA 192
		call draw_but_icon ;Подсветка вкл|выкл
193
	@@:
7571 IgorA 194
7488 IgorA 195
	mov cx,ID_BUT_CONVERT_1251_866
1338 IgorA 196
 
7573 IgorA 197
	jnc @f
7571 IgorA 198
		add edx,30 shl 16
7488 IgorA 199
		call draw_but_icon ;cp 1251 -> 866
200
	@@:
201
202
	mov cx,ID_BUT_CONVERT_866_1251
1338 IgorA 203
 
7573 IgorA 204
	jnc @f
7571 IgorA 205
		add edx,25 shl 16
7488 IgorA 206
		call draw_but_icon ;cp 866 -> 1251
207
	@@:
208
209
	popad
4308 IgorA 210
 
211
212
;txtBUp db 24
213
 
1338 IgorA 214
;txtBRi db 26
215
;txtBLe db 27
216
217
align 4
1457 IgorA 218
 
1456 IgorA 219
	mov edi,[edit]
7579 IgorA 220
	cmp ted_panel_id,TED_PANEL_FIND
221
	jne @f
7576 IgorA 222
		call p_find
6087 IgorA 223
		jmp .end_f
7576 IgorA 224
	@@:
225
	cmp ted_panel_id,TED_PANEL_REPLACE
226
	jne @f
227
		call p_replace
228
		jmp .end_f
229
	@@:
230
	cmp ted_panel_id,TED_PANEL_GOTO
231
	jne @f
7579 IgorA 232
		call p_goto
233
		jmp .end_f
234
	@@:
235
	cmp ted_panel_id,TED_PANEL_SYNTAX
236
	jne @f
237
		call p_syntax
238
		jmp .end_f
239
	@@:
240
	push eax edx
241
		mcall SF_DEFINE_BUTTON,,,0x80000000+200
7576 IgorA 242
		mcall ,,,0x80000000+201
7579 IgorA 243
		mcall ,,,0x80000000+202
244
		mcall ,,,0x80000000+203
7576 IgorA 245
		mcall ,,,0x80000000+204
246
	pop edx eax
7579 IgorA 247
	.end_f:
7576 IgorA 248
	ret
249
endp
250
251
align 4
252
 
253
	push eax ebx ecx edx
254
		mov ecx,ted_wnd_t
6087 IgorA 255
		shl ecx,16
256
		mov cx,20
257
		mcall SF_DRAW_RECT,TED_PANEL_WIDTH,,[sc.work]
258
259
		mov ecx,ted_wnd_t
1338 IgorA 260
 
7576 IgorA 261
		shl ecx,16
262
		add ecx,ted_wnd_h
263
		mov edx,ted_scr_h
264
		add cx,word[edx+sb_offs_size_y]
265
		sub cx,20+15-1 ; 15 - height text box
266
		mcall ,,,[sc.work]
267
268
		stdcall [edit_box_draw], edit_find
269
 
7579 IgorA 270
		mov ecx,ted_wnd_t
7576 IgorA 271
 
272
		add ecx,(93 shl 16)+20
273
		mcall SF_DEFINE_BUTTON,(5 shl 16)+85,,201,[sc.work_button] ;201 - button id
274
275
		mov ebx,(23 shl 16)+7
276
 
277
		mov ecx,[sc.work_text]
6087 IgorA 278
		or ecx,0x80000000
279
		mcall SF_DRAW_TEXT,,,txtFindCapt
280
281
		mov ecx,[sc.work_button_text]
1338 IgorA 282
 
7576 IgorA 283
		mov ebx,(15 shl 16)+100
284
		add ebx,ted_wnd_t
285
		mcall ,,,txtFindNext
286
287
		stdcall [option_box_draw], opt_grlist1
1338 IgorA 288
 
7576 IgorA 289
	ret
290
291
align 4
292
 
293
	push eax ebx ecx edx
294
		mov ecx,ted_wnd_t
295
		shl ecx,16
6087 IgorA 296
		mov cx,20
7576 IgorA 297
		mcall SF_DRAW_RECT,TED_PANEL_WIDTH,,[sc.work]
298
299
		mov ecx,ted_wnd_t
300
 
301
		shl ecx,16
6087 IgorA 302
		add ecx,ted_wnd_h
303
		mov edx,ted_scr_h
304
		add cx,word[edx+sb_offs_size_y]
305
		sub cx,20+15-1 ; 15 - height text box
306
		mcall ,,,[sc.work]
307
7576 IgorA 308
		stdcall [edit_box_draw], edit_replace
1338 IgorA 309
 
7579 IgorA 310
311
		mov ecx,ted_wnd_t
7576 IgorA 312
 
6087 IgorA 313
		add ecx,(133 shl 16)+20
314
		mcall SF_DEFINE_BUTTON,(5 shl 16)+95,,202,[sc.work_button] ;replace next
7576 IgorA 315
316
		add ecx,(26 shl 16)
1338 IgorA 317
 
7576 IgorA 318
319
		mov ebx,ted_wnd_t
320
 
321
		mov ecx,[sc.work_text]
322
		or ecx,0x80000000
6087 IgorA 323
		mcall SF_DRAW_TEXT,,,txtFindCapt
324
		add ebx,93
7576 IgorA 325
		mcall SF_DRAW_TEXT,,,txtRerlaceCapt
326
327
		mov ecx,[sc.work_button_text]
328
 
329
		mov ebx,ted_wnd_t
330
		add ebx,(15 shl 16)+140
331
		mcall ,,,txtRerlace
332
		add ebx,26
333
		mcall ,,,txtRerlaceAll
334
335
		stdcall [option_box_draw], opt_grlist1
336
 
337
	ret
6087 IgorA 338
339
align 4
1338 IgorA 340
 
7579 IgorA 341
	push eax ebx ecx edx
342
		mov ecx,ted_wnd_t
343
		shl ecx,16
344
		mov cx,20
345
		mcall SF_DRAW_RECT,TED_PANEL_WIDTH,,[sc.work]
346
347
		mov ecx,ted_wnd_t
348
 
349
		shl ecx,16
350
		add ecx,ted_wnd_h
351
		mov edx,ted_scr_h
352
		add cx,word[edx+sb_offs_size_y]
353
		sub cx,20+15-1 ; 15 - height text box
354
		mcall ,,,[sc.work]
355
356
		stdcall [edit_box_draw], edit_goto
357
 
358
		mov ecx,ted_wnd_t
359
 
360
		add ecx,(40 shl 16)+20
361
		mcall SF_DEFINE_BUTTON,(5 shl 16)+85,,204,[sc.work_button]
362
363
		mov ebx,(23 shl 16)+7
364
 
365
		mov ecx,[sc.work_text]
366
		or ecx,0x80000000
367
		mcall SF_DRAW_TEXT,,,txtGotoCapt
368
369
		mov ecx,[sc.work_button_text]
370
 
371
		mov ebx,(15 shl 16)+47
372
		add ebx,ted_wnd_t
373
		mcall ,,,txtGoto
374
	pop edx ecx ebx eax
375
	ret
376
377
;input:
378
 
1457 IgorA 379
align 4
380
p_syntax:
1456 IgorA 381
	pushad
7579 IgorA 382
6087 IgorA 383
	mov ecx,ted_wnd_t
1338 IgorA 384
 
6087 IgorA 385
	mov cx,20
386
	mcall SF_DRAW_RECT,TED_PANEL_WIDTH,,[sc.work] ;рисование верхнего фонового прямоугольника
387
388
	stdcall [tl_draw], tree1
1338 IgorA 389
 
7577 IgorA 390
	stdcall [scrollbar_ver_draw], ws_dir_lbox
6087 IgorA 391
7577 IgorA 392
	ror ecx,16
1338 IgorA 393
 
6087 IgorA 394
	add ecx,20
7577 IgorA 395
	and ecx,0xffff
6087 IgorA 396
	ror ecx,16
397
	add ecx,ted_wnd_h
398
	mov esi,ted_scr_h
399
	add cx,word[esi+sb_offs_size_y]
400
	sub cx,20
401
	sub ecx,[tree1.box_height]
402
	inc cx
7577 IgorA 403
	int 0x40 ;рисование нижнего фонового прямоугольника
6087 IgorA 404
405
	mov ecx,ted_wnd_t
1338 IgorA 406
 
6087 IgorA 407
	add ecx,[tree1.box_height]
408
	shl ecx,16
7577 IgorA 409
	mov cx,20
6087 IgorA 410
	mcall SF_DEFINE_BUTTON,(5 shl 16)+65,,200,[sc.work_button] ;200 - button id
411
412
	mov ebx,(30 shl 16)+5
1338 IgorA 413
 
6087 IgorA 414
	mov ecx,[sc.work_text]
415
	or ecx,0x80000000
416
	mcall SF_DRAW_TEXT,,,txtFormatCapt
417
418
	mov ebx,(10 shl 16)+31
1338 IgorA 419
 
6087 IgorA 420
	add ebx,ted_wnd_t
7577 IgorA 421
	mov ecx,[sc.work_button_text]
6087 IgorA 422
	or ecx,0x80000000
7577 IgorA 423
	mcall ,,,txtFormatApply
424
6087 IgorA 425
	popad
1338 IgorA 426
 
6087 IgorA 427
428
MIN_M_WND_H equ 100 ;минимальная высота главного окна
1338 IgorA 429
 
2125 IgorA 430
; edi = pointer to tedit struct
431
align 4
432
EvSize:
1456 IgorA 433
	pushad
2125 IgorA 434
	mov ebx,ted_scr_h
6087 IgorA 435
	mov esi,ted_scr_w
436
437
	m2m ted_wnd_w,[procinfo.client_box.width] ;ставим ширину окна редактора равной ширине всего окна
1338 IgorA 438
 
6087 IgorA 439
	sub ted_wnd_w,eax ;отнимаем отступ слева
440
	movzx eax,word[esi+sb_offs_size_x]
441
	sub ted_wnd_w,eax ;отнимаем ширину верт. скроллинга
442
443
	m2m ted_wnd_h,[procinfo.client_box.height] ;ставим высоту окна редактора равной высоте всего окна
1449 IgorA 444
 
6087 IgorA 445
	jg @f
446
		mov ted_wnd_h,MIN_M_WND_H
447
	@@:
448
449
	movzx eax,word[ebx+sb_offs_size_y]
1338 IgorA 450
 
6087 IgorA 451
	mov eax,ted_wnd_t
452
	sub ted_wnd_h,eax	      ;отнимаем отступ сверху
453
454
	stdcall [ted_init_scroll_bars], tedit0,2
1338 IgorA 455
 
6087 IgorA 456
	mov eax,ted_wnd_t
1338 IgorA 457
 
6087 IgorA 458
	mov tl_box_top,eax ;=ted_wnd_t
7576 IgorA 459
	add tl_box_top,20
6087 IgorA 460
461
	mov [edit_find.top],eax ;=ted_wnd_t
1338 IgorA 462
 
7579 IgorA 463
	mov [edit_replace.top],eax
464
	add dword[edit_replace.top],113
465
	mov [edit_goto.top],eax
466
	add dword[edit_goto.top],20
467
	popad
468
	ret
6087 IgorA 469
470
;input:
1338 IgorA 471
 
1456 IgorA 472
;   cx = ID button
1338 IgorA 473
;  edx = x*2^16+y
7573 IgorA 474
align 4
1338 IgorA 475
draw_but_icon:
1456 IgorA 476
	push eax ebx
1338 IgorA 477
1457 IgorA 478
	mov eax,SF_DEFINE_BUTTON
1338 IgorA 479
 
6087 IgorA 480
		mov ebx,edx
1457 IgorA 481
		mov edx,ecx
482
		mov cx,bx
483
		shl ecx,16
484
		mov cx,19 ;=20-1
485
		mov bx,19 ;=20-1
486
		mov esi,ebx
487
		shr esi,16
488
		add esi,20
489
		cmp esi,[procinfo.client_box.width]
490
		jge @f ;кнопка не влезла в окно
491
			mov esi,[sc.work_button]
4128 IgorA 492
			int 0x40 ;ставим кнопку
1457 IgorA 493
			mov eax,SF_PUT_IMAGE
494
		@@:
6087 IgorA 495
	pop esi edx ecx
1457 IgorA 496
497
	cmp eax,SF_PUT_IMAGE
1338 IgorA 498
 
6087 IgorA 499
		mov ebx,[bmp_icon]
4128 IgorA 500
		bt ecx,30 ;if (ecx & 0x40000000)
1457 IgorA 501
		jc .gray
4308 IgorA 502
			add ebx,TOOLBAR_ICONS_SIZE ;перемещаемся на серые кнопки
4128 IgorA 503
		.gray:
504
		push ecx
505
		sub ecx,ID_BUT_0
1457 IgorA 506
		and ecx,0xffff
7573 IgorA 507
		imul ecx,1200
1457 IgorA 508
		add ebx,ecx
509
		mov ecx,(20 shl 16)+20
510
		int 0x40 ;ставим рисунок на кнопку
7488 IgorA 511
		pop ecx
1457 IgorA 512
	@@:
513
	pop ebx eax
514
	ret
515
516
;descrition:
1338 IgorA 517
 
4128 IgorA 518
;input:
519
; buf_rgb - буфер с входным 24 битным цветным изображением
520
; buf_g24 - буфер с выходным 24 битным серым изображением
521
; pixels - число пикселей в изображении
522
align 4
523
proc img_to_gray, buf_rgb:dword, buf_g24:dword, pixels:dword
524
pushad
4228 IgorA 525
	mov esi,[buf_rgb]
526
	mov edi,[buf_g24]
4128 IgorA 527
	mov ecx,[pixels]
528
	mov ebx,3
529
	@@:
4228 IgorA 530
		movzx eax,byte[esi]
4128 IgorA 531
		movzx edx,byte[esi+1]
532
		add eax,edx
4228 IgorA 533
		movzx edx,byte[esi+2]
534
		add eax,edx
535
		xor edx,edx
536
		div ebx ;shr eax,2
537
		mov ah,al
538
		mov word[edi],ax
4128 IgorA 539
		mov byte[edi+2],al
540
		add esi,3
541
		add edi,3
542
		loop @b
543
popad
544
	ret
4228 IgorA 545
endp
4128 IgorA 546