Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
1456 IgorA 1
align 4
1457 IgorA 2
draw_but_toolbar: ;функция для рисования панели инструментов
6087 IgorA 3
	pushad
4
	mov edi,tedit0
1338 IgorA 5
 
6087 IgorA 6
	mov ecx,0x40000000
7488 IgorA 7
	mov edx,(5 shl 16)+25
8
	bt word[panel_but],0
9
	jnc @f
10
		call draw_but_icon ;New
11
	@@:
1338 IgorA 12
 
6087 IgorA 13
	inc cx
7488 IgorA 14
	bt word[panel_but+1],0
15
	jnc @f
16
		add edx,25 shl 16
17
		call draw_but_icon ;Open
18
	@@:
1338 IgorA 19
 
6087 IgorA 20
	stdcall [ted_can_save],edi
21
	cmp al,1
22
	je @f
23
		and ecx,0xffff
24
	@@:
25
	inc cx
7488 IgorA 26
	bt word[panel_but+2],0
27
	jnc @f
28
		add edx,25 shl 16
29
		call draw_but_icon ;Save
30
	@@:
6087 IgorA 31
	or ecx,0x40000000
1338 IgorA 32
 
7571 IgorA 33
	inc cx
7488 IgorA 34
	bt word[panel_but+3],0
35
	jnc @f
7571 IgorA 36
		add edx,25 shl 16
37
		call draw_but_icon ;Save as
38
	@@:
39
 
40
	inc cx
41
	bt word[panel_but+4],0
42
	jnc @f
7488 IgorA 43
		add edx,30 shl 16
44
		call draw_but_icon ;Select word
45
	@@:
1338 IgorA 46
 
6087 IgorA 47
	call [ted_is_select]
7488 IgorA 48
	or al,al
49
	jnz @f
6087 IgorA 50
		and ecx,0xffff
51
	@@:
7488 IgorA 52
	inc cx
7571 IgorA 53
	bt word[panel_but+5],0
7488 IgorA 54
	jnc @f
55
		add edx,25 shl 16
56
		call draw_but_icon ;Cut
57
	@@:
1338 IgorA 58
 
7488 IgorA 59
	inc cx
7571 IgorA 60
	bt word[panel_but+6],0
7488 IgorA 61
	jnc @f
62
		add edx,25 shl 16
63
		call draw_but_icon ;Copy
64
	@@:
6087 IgorA 65
	or ecx,0x40000000
1338 IgorA 66
 
6087 IgorA 67
	cmp dword[buf],0
68
	jne @f
69
		and ecx,0xffff
70
	@@:
7488 IgorA 71
	inc cx
7571 IgorA 72
	bt word[panel_but+7],0
7488 IgorA 73
	jnc @f
74
		add edx,25 shl 16
75
		call draw_but_icon ;Paste
76
	@@:
6087 IgorA 77
	or ecx,0x40000000
1338 IgorA 78
 
6087 IgorA 79
	inc cx
7571 IgorA 80
	bt word[panel_but+8],0
7488 IgorA 81
	jnc @f
82
		add edx,25 shl 16
83
		call draw_but_icon ;Found
84
	@@:
1338 IgorA 85
 
6087 IgorA 86
	inc cx
7571 IgorA 87
	bt word[panel_but+9],0
7488 IgorA 88
	jnc @f
89
		add edx,25 shl 16
90
		call draw_but_icon ;Replace
91
	@@:
1338 IgorA 92
 
6087 IgorA 93
	inc cx
7571 IgorA 94
	bt word[panel_but+10],0
7488 IgorA 95
	jnc @f
96
		add edx,25 shl 16
97
		call draw_but_icon ;Key words
98
	@@:
1338 IgorA 99
 
7488 IgorA 100
	call [ted_is_select]
101
	or al,al
102
	jnz @f
103
		and ecx,0xffff
104
	@@:
105
	inc cx
7571 IgorA 106
	bt word[panel_but+11],0
7488 IgorA 107
	jnc @f
108
		add edx,30 shl 16
109
		call draw_but_icon ;Upper
110
	@@:
111
 
112
	inc cx
7571 IgorA 113
	bt word[panel_but+12],0
7488 IgorA 114
	jnc @f
115
		add edx,25 shl 16
116
		call draw_but_icon ;Lower
117
	@@:
118
 
119
	inc cx
7571 IgorA 120
	bt word[panel_but+13],0
7488 IgorA 121
	jnc @f
122
		add edx,25 shl 16
123
		call draw_but_icon ;Reverse
124
	@@:
125
	or ecx,0x40000000
126
 
6087 IgorA 127
	mov ebx,ted_tim_undo
128
	cmp ted_tim_ch,ebx
129
	jg @f
130
		and ecx,0xffff
131
	@@:
7488 IgorA 132
	inc cx
7571 IgorA 133
	bt word[panel_but+14],0
7488 IgorA 134
	jnc @f
135
		add edx,30 shl 16
136
		call draw_but_icon ;Undo
137
	@@:
6087 IgorA 138
	or ecx,0x40000000
1338 IgorA 139
 
6087 IgorA 140
	cmp ted_tim_undo,1
141
	jge @f
142
		and ecx,0xffff
143
	@@:
144
	inc cx
7571 IgorA 145
	bt word[panel_but+15],0
7488 IgorA 146
	jnc @f
147
		add edx,25 shl 16
148
		call draw_but_icon ;Redo
149
	@@:
6087 IgorA 150
	or ecx,0x40000000
1338 IgorA 151
 
4308 IgorA 152
	inc cx
7571 IgorA 153
	bt word[panel_but+16],0
7488 IgorA 154
	jnc @f
155
		add edx,30 shl 16
156
		call draw_but_icon ;Invisible on|off
157
	@@:
1338 IgorA 158
 
4308 IgorA 159
	inc cx
7571 IgorA 160
	bt word[panel_but+17],0
7488 IgorA 161
	jnc @f
162
		add edx,25 shl 16
7571 IgorA 163
		call draw_but_icon ;Выбор файла подсветки
7488 IgorA 164
	@@:
1338 IgorA 165
 
7488 IgorA 166
	inc cx
7571 IgorA 167
	bt word[panel_but+18],0
7488 IgorA 168
	jnc @f
169
		add edx,25 shl 16
7571 IgorA 170
		call draw_but_icon ;Подсветка вкл|выкл
7488 IgorA 171
	@@:
1338 IgorA 172
 
7488 IgorA 173
	inc cx
7571 IgorA 174
	bt word[panel_but+19],0
7488 IgorA 175
	jnc @f
176
		add edx,30 shl 16
177
		call draw_but_icon ;cp 1251 -> 866
178
	@@:
1338 IgorA 179
 
7488 IgorA 180
	inc cx
7571 IgorA 181
	bt word[panel_but+20],0
7488 IgorA 182
	jnc @f
183
		add edx,25 shl 16
184
		call draw_but_icon ;cp 866 -> 1251
185
	@@:
4308 IgorA 186
 
187
	popad
188
	ret
189
 
1338 IgorA 190
;txtBUp db 24
191
;txtBDn db 25
192
;txtBRi db 26
193
;txtBLe db 27
1457 IgorA 194
 
195
;input:
196
; edi = pointer to tedit struct
1456 IgorA 197
align 4
1457 IgorA 198
proc draw_panel_find
6087 IgorA 199
	cmp ted_panel_id,TED_PANEL_FIND ;if not panel
200
	jne @f
201
	push eax ebx ecx edx
202
		mov ecx,ted_wnd_t
203
		shl ecx,16
204
		mov cx,20
205
		mcall SF_DRAW_RECT,TED_PANEL_WIDTH,,[sc.work]
1338 IgorA 206
 
6087 IgorA 207
		mov ebx,30*65536+25
208
		add ebx,ted_wnd_t
209
		mov ecx,[sc.work_text]
210
		or ecx,0x80000000
211
		mcall SF_DRAW_TEXT,,,txtFindCapt
1338 IgorA 212
 
6087 IgorA 213
		stdcall [edit_box_draw], edit2
1338 IgorA 214
 
6087 IgorA 215
		mov ecx,ted_wnd_t
216
		add cx,20+15 ; 15 - height text box
217
		shl ecx,16
218
		add ecx,ted_wnd_h
219
		mov edx,ted_scr_h
220
		add cx,word[edx+sb_offs_size_y]
221
		sub cx,20+15-1 ; 15 - height text box
222
		mcall SF_DRAW_RECT,TED_PANEL_WIDTH,,[sc.work]
1338 IgorA 223
 
6087 IgorA 224
		mov ecx,ted_wnd_t
225
		add cx,20+15+5
226
		shl ecx,16
227
		mov cx,20
228
		mcall SF_DEFINE_BUTTON,5*65536+85,,201,[sc.work_button] ;201 - button id
1338 IgorA 229
 
6087 IgorA 230
		mov ebx,15*65536+(20+15+10)
231
		add ebx,ted_wnd_t
232
		mov ecx,[sc.work_text]
233
		or ecx,0x80000000
234
		mcall SF_DRAW_TEXT,,,txtFindNext
235
	pop edx ecx ebx eax
236
	jmp .end_f
237
	@@:
238
	push eax edx
239
		mov edx,201
240
		or edx,0x80000000
241
		mcall SF_DEFINE_BUTTON
242
	pop edx eax
243
	.end_f:
244
	ret
1449 IgorA 245
endp
1338 IgorA 246
 
1457 IgorA 247
;input:
248
; edi = pointer to tedit struct
1456 IgorA 249
align 4
1457 IgorA 250
proc draw_panel_syntax
6087 IgorA 251
	cmp ted_panel_id,TED_PANEL_SYNTAX ;if not panel
252
	jne @f
253
	pushad
1338 IgorA 254
 
6087 IgorA 255
	mov ecx,ted_wnd_t
256
	shl ecx,16
257
	mov cx,20
258
	mcall SF_DRAW_RECT,TED_PANEL_WIDTH,,[sc.work] ;рисование верхнего фонового прямоугольника
1338 IgorA 259
 
6087 IgorA 260
	stdcall dword[tl_draw], tree1
261
	mov [ws_dir_lbox.all_redraw],1 ;для полной перерисовки дочернего скроллинга
262
	stdcall dword[scrollbar_ver_draw], dword ws_dir_lbox
1338 IgorA 263
 
6087 IgorA 264
	ror ecx,16
265
	add ecx,dword[tree1.box_height]
266
	add ecx,20
267
	and ecx,0xffff
268
	ror ecx,16
269
	add ecx,ted_wnd_h
270
	mov esi,ted_scr_h
271
	add cx,word[esi+sb_offs_size_y]
272
	sub cx,20
273
	sub ecx,dword[tree1.box_height]
274
	inc cx
275
	int 0x40 ;рисование нижнего фонового прямоугольника
1338 IgorA 276
 
6087 IgorA 277
	mov ecx,ted_wnd_t
278
	add ecx,25
279
	add ecx,dword[tree1.box_height]
280
	shl ecx,16
281
	mov cx,20
282
	mcall SF_DEFINE_BUTTON,(5 shl 16)+65,,200,[sc.work_button] ;200 - button id
1338 IgorA 283
 
6087 IgorA 284
	mov ebx,(30 shl 16)+5
285
	add ebx,ted_wnd_t
286
	mov ecx,[sc.work_text]
287
	or ecx,0x80000000
288
	mcall SF_DRAW_TEXT,,,txtFormatCapt
1338 IgorA 289
 
6087 IgorA 290
	mov ebx,(10 shl 16)+31
291
	add ebx,dword[tree1.box_height]
292
	add ebx,ted_wnd_t
293
	mcall ,,,txtFormatApply
1338 IgorA 294
 
6087 IgorA 295
	popad
296
	jmp .end_f
297
	@@:
298
		push eax edx
299
		mov edx,200
300
		or edx,0x80000000
301
		mcall SF_DEFINE_BUTTON ;если нет панели то удаляем кнопку
302
		pop edx eax
303
	.end_f:
304
	ret
1449 IgorA 305
endp
1338 IgorA 306
 
2125 IgorA 307
MIN_M_WND_H equ 100 ;минимальная высота главного окна
308
;input:
309
; edi = pointer to tedit struct
1456 IgorA 310
align 4
2125 IgorA 311
EvSize:
6087 IgorA 312
	pushad
313
	mov ebx,ted_scr_h
314
	mov esi,ted_scr_w
1338 IgorA 315
 
6087 IgorA 316
	m2m ted_wnd_w,[procinfo.client_box.width] ;ставим ширину окна редактора равной ширине всего окна
317
	mov eax,ted_wnd_l
318
	sub ted_wnd_w,eax ;отнимаем отступ слева
319
	movzx eax,word[esi+sb_offs_size_x]
320
	sub ted_wnd_w,eax ;отнимаем ширину верт. скроллинга
1449 IgorA 321
 
6087 IgorA 322
	m2m ted_wnd_h,[procinfo.client_box.height] ;ставим высоту окна редактора равной высоте всего окна
323
	cmp ted_wnd_h,MIN_M_WND_H
324
	jg @f
325
		mov ted_wnd_h,MIN_M_WND_H
326
	@@:
1338 IgorA 327
 
6087 IgorA 328
	movzx eax,word[ebx+sb_offs_size_y]
329
	sub ted_wnd_h,eax	      ;отнимаем высоту гориз. скроллинга
330
	mov eax,ted_wnd_t
331
	sub ted_wnd_h,eax	      ;отнимаем отступ сверху
1338 IgorA 332
 
6087 IgorA 333
	stdcall [ted_init_scroll_bars], tedit0,2
1338 IgorA 334
 
6087 IgorA 335
	mov eax,ted_wnd_t
336
	mov edi,dword tree1
337
	mov tl_box_top,eax ;=ted_wnd_t
338
	add tl_box_top,20
1338 IgorA 339
 
6087 IgorA 340
	mov [edit2.top],eax ;=ted_wnd_t
341
	add dword[edit2.top],20
1338 IgorA 342
 
6087 IgorA 343
	popad
344
	ret
1338 IgorA 345
 
1456 IgorA 346
;input:
1338 IgorA 347
;  ecx = 0x4000____
348
;   cx = icon index
349
;  edx = x*2^16+y
1456 IgorA 350
align 4
1338 IgorA 351
draw_but_icon:
1457 IgorA 352
	push eax ebx
1338 IgorA 353
 
6087 IgorA 354
	mov eax,SF_DEFINE_BUTTON
1457 IgorA 355
	push ecx edx esi
356
		mov ebx,edx
357
		mov edx,ecx
358
		add edx,3
359
		mov cx,bx
360
		shl ecx,16
361
		mov cx,19 ;=20-1
362
		mov bx,19 ;=20-1
363
		mov esi,ebx
364
		shr esi,16
365
		add esi,20
366
		cmp esi,[procinfo.client_box.width]
4128 IgorA 367
		jge @f ;кнопка не влезла в окно
1457 IgorA 368
			mov esi,[sc.work_button]
369
			int 0x40 ;ставим кнопку
6087 IgorA 370
			mov eax,SF_PUT_IMAGE
1457 IgorA 371
		@@:
372
	pop esi edx ecx
1338 IgorA 373
 
6087 IgorA 374
	cmp eax,SF_PUT_IMAGE
4128 IgorA 375
	jne @f ;кнопка не влезла в окно
1457 IgorA 376
		mov ebx,[bmp_icon]
4308 IgorA 377
		bt ecx,30 ;if (ecx & 0x40000000)
4128 IgorA 378
		jc .gray
379
			add ebx,TOOLBAR_ICONS_SIZE ;перемещаемся на серые кнопки
380
		.gray:
1457 IgorA 381
		push ecx
382
		and ecx,0xffff
383
		imul ecx,1200
384
		add ebx,ecx
7488 IgorA 385
		mov ecx,(20 shl 16)+20
1457 IgorA 386
		int 0x40 ;ставим рисунок на кнопку
387
		pop ecx
388
	@@:
389
	pop ebx eax
390
	ret
1338 IgorA 391
 
4128 IgorA 392
;descrition:
393
; функция для генерирования серых иконок
394
;input:
395
; buf_rgb - буфер с входным 24 битным цветным изображением
396
; buf_g24 - буфер с выходным 24 битным серым изображением
397
; pixels - число пикселей в изображении
398
align 4
4228 IgorA 399
proc img_to_gray, buf_rgb:dword, buf_g24:dword, pixels:dword
400
pushad
4128 IgorA 401
	mov esi,[buf_rgb]
402
	mov edi,[buf_g24]
403
	mov ecx,[pixels]
4228 IgorA 404
	mov ebx,3
4128 IgorA 405
	@@:
406
		movzx eax,byte[esi]
4228 IgorA 407
		movzx edx,byte[esi+1]
408
		add eax,edx
409
		movzx edx,byte[esi+2]
410
		add eax,edx
411
		xor edx,edx
412
		div ebx ;shr eax,2
4128 IgorA 413
		mov ah,al
414
		mov word[edi],ax
415
		mov byte[edi+2],al
416
		add esi,3
417
		add edi,3
418
		loop @b
4228 IgorA 419
popad
4128 IgorA 420
	ret
421
endp
422