Subversion Repositories Kolibri OS

Rev

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