Subversion Repositories Kolibri OS

Rev

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