Subversion Repositories Kolibri OS

Rev

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