Subversion Repositories Kolibri OS

Rev

Rev 7016 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4146 GerdtR 1
idbChange	equ 2
2
idbCreate	equ 3
3
idbLeft 	equ 4
4
idbRight	equ 5
5
idbCancel	equ 1
3853 GerdtR 6
 
7
DlgAdd:
8
DlgProp:
3921 mario79 9
 
4146 GerdtR 10
	mov	eax,[SelIcon]
11
	mov	[DlgSelIcon],eax
12
	cmp	eax,-1
13
	jne	SetProp
3853 GerdtR 14
 
4146 GerdtR 15
    ;-----------
16
	mov	eax,[MouseX]
17
	mov	ebx,[MouseY]
3853 GerdtR 18
 
4146 GerdtR 19
	cmp	ax,[wsX]
20
	jae	@f
21
	mov	ax,[wsX]
22
      @@:
3853 GerdtR 23
 
4146 GerdtR 24
	cmp	bx,[wsY]
25
	jae	@f
26
	mov	bx,[wsY]
5017 GerdtR 27
      @@:			    ;eax,ebx - реальная координата. Все координаты в проге относительно левого верхнего угла рабочей области
3853 GerdtR 28
 
4146 GerdtR 29
	xor	edx,edx
30
	mov	dx,[wsXe]
31
	sub	edx,ICON_SIZE
32
	cmp	eax,edx
33
	jbe	@f
34
	mov	eax,edx
35
      @@:
3853 GerdtR 36
 
4146 GerdtR 37
	mov	dx,[wsYe]
38
	sub	edx,ICON_SIZE
39
	cmp	ebx,edx
40
	jbe	@f
41
	mov	ebx,edx
42
      @@:
3853 GerdtR 43
 
5017 GerdtR 44
	xor	edx,edx 	     ;преобразовываем в относительные
4146 GerdtR 45
	mov	dx,[wsW]
46
	shr	edx,1
47
	add	dx,[wsX]
48
	cmp	eax,edx
49
	jbe	@f
50
	sub	ax,[wsXe]
51
	inc	ax
52
	jmp	.dlg1
53
      @@:
54
	sub	ax,[wsX]
55
    .dlg1:
56
 
57
	xor	edx,edx
58
	mov	dx,[wsH]
59
	shr	edx,1
60
	add	dx,[wsY]
61
	cmp	ebx,edx
62
	jbe	@f
63
	sub	bx,[wsYe]
64
	inc	bx
65
	jmp	.dlg2
66
      @@:
67
	sub	bx,[wsY]
68
    .dlg2:
69
 
70
	mov	[AddX],eax
71
	mov	[AddY],ebx
72
    ;-----------
73
 
74
	mov	ecx,NAME_LENGTH
75
	mov	edi,DAreaName
76
	xor	al,al
77
	rep	stosb
78
	mov	dword[edtName.size],0
79
	mov	dword[edtName.pos],0
80
 
81
	mov	ecx,256
82
	mov	edi,DAreaPath
83
	rep	stosb
84
	mov	dword[edtExePath.size],0
85
	mov	dword[edtExePath.pos],0
86
 
87
	mov	ecx,256
88
	mov	edi,DAreaParams
89
	rep	stosb
90
	mov	dword[edtParams.size],0
91
	mov	dword[edtParams.pos],0
92
 
93
	mov	ecx,256
94
	mov	edi,DAreaIcon
7437 leency 95
 
7012 leency 96
	mov	[DAreaIcon],'0'
97
	mov	dword[edtIcon.size],1
98
	mov	dword[edtIcon.pos],1
4146 GerdtR 99
 
100
	jmp	startDlg
3853 GerdtR 101
    ;--------
102
SetProp:
4146 GerdtR 103
	mov	esi,[IconsOffs+eax*4]
104
	mov	edi,DAreaName
105
	xor	ecx,ecx
3853 GerdtR 106
     @@:
4146 GerdtR 107
	lodsb
108
	stosb
109
	inc	ecx
110
	test	al,al
111
	jnz	@b
112
	dec	ecx
113
	mov	dword[edtName.size],ecx
114
	mov	dword[edtName.pos],ecx
3853 GerdtR 115
 
4146 GerdtR 116
	xor	ecx,ecx
117
	mov	edi,DAreaPath
3853 GerdtR 118
     @@:
4146 GerdtR 119
	lodsb
120
	stosb
121
	inc	ecx
122
	test	al,al
123
	jnz	@b
124
	dec	ecx
125
	mov	dword[edtExePath.size],ecx
126
	mov	dword[edtExePath.pos],ecx
3853 GerdtR 127
 
4146 GerdtR 128
	xor	ecx,ecx
129
	mov	edi,DAreaParams
3853 GerdtR 130
     @@:
4146 GerdtR 131
	lodsb
132
	stosb
133
	inc	ecx
134
	test	al,al
135
	jnz	@b
136
	dec	ecx
137
	mov	dword[edtParams.size],ecx
138
	mov	dword[edtParams.pos],ecx
3853 GerdtR 139
 
4146 GerdtR 140
	xor	ecx,ecx
141
	mov	edi,DAreaIcon
3853 GerdtR 142
     @@:
4146 GerdtR 143
	lodsb
144
	stosb
145
	inc	ecx
146
	test	al,al
147
	jnz	@b
148
	dec	ecx
149
	mov	dword[edtIcon.size],ecx
150
	mov	dword[edtIcon.pos],ecx
3853 GerdtR 151
 
152
 
153
startDlg:
4146 GerdtR 154
	mcall	9,RBProcInfo,-1
155
	mcall	18,21,dword[RBProcInfo+30]
156
	mov	[slotDlgAdd],eax
3921 mario79 157
 
4146 GerdtR 158
	or	[edtName.flags],ed_focus
3853 GerdtR 159
 
7016 leency 160
	mcall	40,EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER
4146 GerdtR 161
	xor	eax,eax
162
	mov	dword[MaxPage],0
3853 GerdtR 163
      @@:
4146 GerdtR 164
	add	eax,ICONS_DRAW_COUNTW
165
	inc	dword[MaxPage]
166
	cmp	eax,[icon_count]
167
	jb	@b
168
	dec	dword[MaxPage]
169
	cmp	dword[MaxPage],0
170
	jne	@f
171
	mov	dword[MaxPage],1
3853 GerdtR 172
      @@:
173
 
174
DReDraw:
4146 GerdtR 175
	mcall	48,3,sc,40
3853 GerdtR 176
 
4146 GerdtR 177
	mov	eax,[sc.work]
178
	rol	eax,16
179
	add	al,9
180
	jnc	@f
181
	mov	al,0FFh
3853 GerdtR 182
      @@:
4146 GerdtR 183
	rol	eax,16
184
	add	al,9
185
	jnc	@f
186
	mov	al,0FFh
3853 GerdtR 187
      @@:
4146 GerdtR 188
	add	ah,9
189
	jnc	@f
190
	mov	ah,0FFh
3853 GerdtR 191
      @@:
192
 
4146 GerdtR 193
	mov	[sbIcons.bckg_col],eax
194
	m2m	[sbIcons.frnt_col],[sc.work]
195
	m2m	[sbIcons.line_col],[sc.work_graph]
3853 GerdtR 196
 
4146 GerdtR 197
	;edit_boxes_set_sys_color edtIcon,endEdits,sc
5017 GerdtR 198
	edit_boxes_set_sys_color edtName,endEdits,sc
7437 leency 199
 
5439 leency 200
	m2m	[edtIcon.color],[sc.work]
201
	m2m	[edtIcon.blur_border_color],[sc.work]
3853 GerdtR 202
 
4146 GerdtR 203
	call	DRedrawWin
3853 GerdtR 204
 
205
DMessages:
4146 GerdtR 206
	mcall	10		;WaitMessage
3853 GerdtR 207
 
4146 GerdtR 208
	dec	eax
209
	jz	DReDraw
210
	dec	eax
211
	jz	DKey
212
	dec	eax
213
	jz	DButton
214
	sub	eax,3
215
	jz	DMouse
3853 GerdtR 216
 
4146 GerdtR 217
	jmp  DMessages
3853 GerdtR 218
 
219
 
220
;---------------------------------------------------------------------
221
DKey:
4146 GerdtR 222
	mcall	2		;GetKeyPressed
223
	cmp	ah,1Bh
224
	je	DExit
225
	cmp	ah,9  ;Tab
226
	je	DNextEdit
227
	stdcall [edit_box_key],edtName
228
	stdcall [edit_box_key],edtExePath
229
	stdcall [edit_box_key],edtParams
230
	;stdcall [edit_box_key],edtIcon
3853 GerdtR 231
 
4146 GerdtR 232
	jmp	DMessages
3853 GerdtR 233
 
234
 
235
DNextEdit:
4146 GerdtR 236
	test	[edtName.flags],ed_focus
237
	jne	 .DNE1
238
	test	[edtExePath.flags],ed_focus
239
	jne	 .DNE2
240
	test	[edtParams.flags],ed_focus
241
	jne	 .DNE3
242
	;test    [edtIcon.flags],ed_focus
243
	;jne      .DNE4
244
	jmp	DMessages
3853 GerdtR 245
 
246
    .DNE1:
4146 GerdtR 247
	and	[edtName.flags],not ed_focus
248
	or	[edtExePath.flags],ed_focus
249
	stdcall [edit_box_draw],edtName
250
	stdcall [edit_box_draw],edtExePath
251
	jmp	DMessages
3853 GerdtR 252
 
253
    .DNE2:
4146 GerdtR 254
	and	[edtExePath.flags],not ed_focus
255
	or	[edtParams.flags],ed_focus
256
	stdcall [edit_box_draw],edtExePath
257
	stdcall [edit_box_draw],edtParams
258
	jmp	DMessages
3853 GerdtR 259
 
260
    .DNE3:
4146 GerdtR 261
	and	[edtParams.flags],not ed_focus
262
	or	[edtName.flags],ed_focus
263
	stdcall [edit_box_draw],edtParams
264
	stdcall [edit_box_draw],edtName
265
	jmp	DMessages
3853 GerdtR 266
 
4003 GerdtR 267
    ;.DNE4:
268
    ;    and     [edtIcon.flags],not ed_focus
269
    ;    or      [edtName.flags],ed_focus
270
    ;    stdcall [edit_box_draw],edtName
271
    ;    stdcall [edit_box_draw],edtIcon
272
    ;    jmp     DMessages
3853 GerdtR 273
;---------------------------------------------------------------------
274
DButton:
4146 GerdtR 275
	mcall	17		;GetButtonPressed
276
	cmp	ah, idbCancel
277
	je	DExit
278
	cmp	ah,idbChange
279
	je	DSetExePath
280
	cmp	ah,idbCreate
281
	je	DSaveIcon
3853 GerdtR 282
 
4146 GerdtR 283
	jmp	DMessages
3853 GerdtR 284
;-------------------------------------------------------------------------------
285
DMouse:
4146 GerdtR 286
	stdcall [edit_box_mouse],edtName
287
	stdcall [edit_box_mouse],edtExePath
288
	stdcall [edit_box_mouse],edtParams
4003 GerdtR 289
;        stdcall [edit_box_mouse],edtIcon
3853 GerdtR 290
 
4146 GerdtR 291
	push	[sbIcons.position]
292
	stdcall [scrollbar_h_mouse],sbIcons
293
	pop	eax
294
	cmp	eax,[sbIcons.position]
295
	je	@f
296
	call	DrawStdIcons
3853 GerdtR 297
      @@:
298
 
4146 GerdtR 299
	mcall	37,2		;GetMouseKey
300
	test	eax,1
301
	jz	DMessages
302
	mcall	37,1		;GetMouseWinPos
3853 GerdtR 303
 
4146 GerdtR 304
	test	eax,10001000h
305
	jne	DMessages
306
	xor	edx,edx
307
	mov	dx,ax	  ;y
308
	shr	eax,16	  ;x
3853 GerdtR 309
 
4146 GerdtR 310
	sub	eax,ICONSX
311
	js	DMessages
312
	sub	edx,ICONSY
313
	js	DMessages
3853 GerdtR 314
 
4146 GerdtR 315
	cmp	eax,(IMG_SIZE+SPCW)*ICONS_DRAW_COUNTW-SPCW
316
	ja	DMessages
317
	cmp	edx,(IMG_SIZE+SPCH)*ICONS_DRAW_COUNTH-SPCH
318
	ja	DMessages
3853 GerdtR 319
 
4146 GerdtR 320
	xor	ebx,ebx
321
	mov	ecx,[sbIcons.position]
322
	test	ecx,ecx
323
	jz	.DM
3853 GerdtR 324
     @@:
4146 GerdtR 325
	add	ebx,ICONS_DRAW_COUNTH
326
	loop	@b
3853 GerdtR 327
     .DM:
328
 
4146 GerdtR 329
	sub	eax,IMG_SIZE+SPCW
330
	js     .DM1
3853 GerdtR 331
     @@:
4146 GerdtR 332
	add	ebx,ICONS_DRAW_COUNTH
333
	sub	eax,IMG_SIZE+SPCW
334
	jns	@b
3853 GerdtR 335
     .DM1:
336
 
337
 
4146 GerdtR 338
	sub	edx,IMG_SIZE+SPCH
339
	js     .DM2
3853 GerdtR 340
     @@:
4146 GerdtR 341
	inc	ebx
342
	sub	edx,IMG_SIZE+SPCH
343
	jns	@b
3853 GerdtR 344
     .DM2:
345
 
4146 GerdtR 346
	mov	eax,ebx
3853 GerdtR 347
 
4146 GerdtR 348
	cmp	eax,[icon_count]
349
	jae	DMessages
3853 GerdtR 350
 
7437 leency 351
;       stdcall byteToHex,al,DAreaIcon  ;2
352
	stdcall intToStr,eax,DAreaIcon
353
	mov	dword[edtIcon.size],edx
3853 GerdtR 354
 
5439 leency 355
    ; stdcall [edit_box_draw],edtIcon
3853 GerdtR 356
 
7012 leency 357
	call DrawSelIcon
358
	jmp	 DMessages
3853 GerdtR 359
;-------------------------------------------------------------------------------
360
DSetExePath:
4146 GerdtR 361
	stdcall [OpenDialog_Start],OpenDialog_data
362
	mov	edi,DAreaPath
363
	xor	al,al
364
	or	ecx,-1
365
	repne	scasb
366
	sub	edi,DAreaPath
367
	dec	edi
368
	mov	dword[edtExePath+12*4],edi
3853 GerdtR 369
 
4146 GerdtR 370
	jmp	DMessages;DReDraw;
3853 GerdtR 371
 
372
DSaveIcon:
4146 GerdtR 373
	mov	edi,DAreaName
374
	mov	esi,secRButt
4003 GerdtR 375
    @@: lodsb
4146 GerdtR 376
	scasb
377
	jne	@f
378
	test	al,al
379
	jnz	@b
4003 GerdtR 380
 
4146 GerdtR 381
	mov	dword[fiRunProg+8],ErrName
382
	mov	dword[fiRunProg+21],pthNotify
383
	mcall	70,fiRunProg
4003 GerdtR 384
 
4146 GerdtR 385
	jmp	DMessages
4003 GerdtR 386
    @@:
4146 GerdtR 387
	mov	dword[fiRunProg+8],WarningSave
388
	mov	dword[fiRunProg+21],pthNotify
389
	mcall	70,fiRunProg
3853 GerdtR 390
 
391
 
4146 GerdtR 392
	cmp	[DlgSelIcon],-1
393
	je	@f
5017 GerdtR 394
 
4336 GerdtR 395
	stdcall EditIcon,[DlgSelIcon],DAreaIcon,DAreaName,DAreaPath,DAreaParams
4146 GerdtR 396
	mov	ebx,[DlgSelIcon]
4336 GerdtR 397
	mov	eax,[IconsID+ebx*4]
4146 GerdtR 398
	jmp	DExitAndSave
3853 GerdtR 399
     @@:
4336 GerdtR 400
 
401
	call	GenerateID
402
 
403
	mov	ebx,[MaxNumIcon]
404
	mov	[IconsID+ebx*4],eax
405
	push	eax
4146 GerdtR 406
	stdcall AddIcon,[AddX],[AddY],DAreaIcon,DAreaName,DAreaPath,DAreaParams
4336 GerdtR 407
	pop	eax
408
 
3853 GerdtR 409
;-------------------------------------------------------------------------------
410
DExitAndSave:
411
 
4336 GerdtR 412
	mov	dword[nameSection],eax
413
	stdcall [ini_set_str],IconIni,nameSection,keyName,DAreaName,dword[edtName.size]
414
	stdcall [ini_set_str],IconIni,nameSection,keyPath,DAreaPath,dword[edtExePath.size]
415
	stdcall [ini_set_str],IconIni,nameSection,keyParams,DAreaParams,dword[edtParams.size]
416
	stdcall [ini_set_str],IconIni,nameSection,keyIco,DAreaIcon,dword[edtIcon.size]
3853 GerdtR 417
 
4336 GerdtR 418
	cmp	[DlgSelIcon],-1
419
	jne	@f
420
	stdcall [ini_set_int],IconIni,nameSection,keyX,[MouseX]
421
	stdcall [ini_set_int],IconIni,nameSection,keyY,[MouseY]
422
      @@:
3853 GerdtR 423
DExit:
4146 GerdtR 424
	mov	[DlgAddActiv],0
425
	mov	[slotDlgAdd],0
426
	mcall	-1		;ExitThread
3853 GerdtR 427
 
428
;##################################################################
4007 GerdtR 429
proc DRedrawWin
4146 GerdtR 430
	mcall	12,1		;RedrawWinBeg
431
	mov	edx,[sc.work]
432
	or	edx,34000000h
433
	cmp	[DlgSelIcon],-1
434
	jne	 @f
435
	mov	edi,DTitleAdd
436
	jmp	.l1
3962 GerdtR 437
      @@:
4146 GerdtR 438
	mov	edi,DTitleProp
3962 GerdtR 439
      .l1:
7012 leency 440
	mcall	0,<100,END_ICONS_AREAW+ICONSX+10>,<100,(IMG_SIZE+SPCH)*ICONS_DRAW_COUNTH+178>,,,
3853 GerdtR 441
 
4146 GerdtR 442
	stdcall [edit_box_draw],edtName
443
	stdcall [edit_box_draw],edtExePath
444
	stdcall [edit_box_draw],edtParams
3853 GerdtR 445
 
4146 GerdtR 446
	call	DrawStdIcons
3853 GerdtR 447
 
448
 
4146 GerdtR 449
	stdcall [scrollbar_h_draw],sbIcons
7012 leency 450
	mcall 38,,,[sc.work_graph]
7437 leency 451
	mcall	,,,[sc.work_graph]
3853 GerdtR 452
 
7437 leency 453
	mcall	,,,[sc.work_graph]
454
	mcall	,,,[sc.work_graph]
3853 GerdtR 455
 
7012 leency 456
	;BUTTONS
457
	mcall	8,<265,75>,<30+END_ICONS_AREAH,24>,idbCreate,[sc.work_button]
7437 leency 458
	mcall	 ,<360,77>,			  ,idbCancel
7012 leency 459
	mcall	 ,,<30,20> ,idbChange
3853 GerdtR 460
 
7012 leency 461
	;CAPTIONS
4146 GerdtR 462
	mov	ecx,[sc.work_text]
7012 leency 463
	or	ecx,90000000h
4146 GerdtR 464
	mcall	4,<30+IMG_SIZE,10>,,DCaptName
7012 leency 465
	mcall	 ,<30+IMG_SIZE,35>,,DCaptPath
466
	mcall	 ,<30+IMG_SIZE,59>,,DCaptParams
3853 GerdtR 467
 
468
if lang eq ru
4146 GerdtR 469
	mov	ecx,[sc.work_button_text]
7012 leency 470
	or	ecx,90000000h
471
	mcall	 ,<369,35+END_ICONS_AREAH>,,DCaptCancel
3853 GerdtR 472
 
4146 GerdtR 473
	cmp	[DlgSelIcon],-1
474
	jne	@f
7012 leency 475
	mpack	ebx,275,35+END_ICONS_AREAH
4146 GerdtR 476
	mov	edx,DCaptCreate
477
	jmp	.DRD1
3853 GerdtR 478
      @@:
7012 leency 479
	mpack	ebx,272,35+END_ICONS_AREAH
4146 GerdtR 480
	mov	edx,DCaptProperties
3853 GerdtR 481
     .DRD1:
482
else
4146 GerdtR 483
	mov	ecx,[sc.work_button_text]
7012 leency 484
	or	ecx,90000000h
485
	mcall	 ,<372,35+END_ICONS_AREAH>,,DCaptCancel
3853 GerdtR 486
 
487
 
4146 GerdtR 488
	cmp	[DlgSelIcon],-1
489
	jne	@f
7012 leency 490
	mpack	ebx,277,35+END_ICONS_AREAH
4146 GerdtR 491
	mov	edx,DCaptCreate
492
	jmp	.DRD1
3853 GerdtR 493
      @@:
7012 leency 494
	mpack	ebx,277,35+END_ICONS_AREAH
4146 GerdtR 495
	mov	edx,DCaptProperties
3853 GerdtR 496
     .DRD1:
497
end if
4146 GerdtR 498
	mcall
3853 GerdtR 499
 
7012 leency 500
	pusha
501
	mov	ecx,[sc.work_button_text]
502
	or	ecx,90000000h
503
	mcall 4,,,DCaptDots
504
	popa
3853 GerdtR 505
 
4146 GerdtR 506
	call DrawSelIcon
3853 GerdtR 507
 
4146 GerdtR 508
	mcall	12,2		;RedrawWinEnd
509
	ret
3853 GerdtR 510
endp
511
 
512
 
513
proc DrawStdIcons
514
local IcoX:DWORD,\
515
      IcoY:DWORD,\
516
      iIcon:DWORD
517
 
4146 GerdtR 518
	mov	ecx,[sbIcons.position]
519
	xor	eax,eax
520
	m2m	dword[iIcon],0
3853 GerdtR 521
 
4146 GerdtR 522
	test	ecx,ecx
523
	jz	.DST1
3853 GerdtR 524
     @@:
4146 GerdtR 525
	add	[iIcon],ICONS_DRAW_COUNTH
526
	add	eax,IMG_SIZE*IMG_SIZE*4*ICONS_DRAW_COUNTH
527
	loop	@b
3853 GerdtR 528
   .DST1:
529
 
4146 GerdtR 530
	lea	esi,[eax+44]
531
	add	esi,[raw_pointer]
3853 GerdtR 532
 
4146 GerdtR 533
	mov	[IcoX],ICONSX
3853 GerdtR 534
 
4146 GerdtR 535
	mov	ecx,ICONS_DRAW_COUNTW
3853 GerdtR 536
  .DrawIcons:
4146 GerdtR 537
	push	ecx
3853 GerdtR 538
 
4146 GerdtR 539
	mov	[IcoY],ICONSY
3853 GerdtR 540
 
4146 GerdtR 541
	mov	ecx,ICONS_DRAW_COUNTH
3853 GerdtR 542
  .DrawIcoStolb:
4146 GerdtR 543
	push	ecx
3853 GerdtR 544
 
4146 GerdtR 545
	mov	edi,DlgBufImg
546
	mov	edx,IMG_SIZE
3853 GerdtR 547
 
548
    .DrawLine:
549
 
550
 
4146 GerdtR 551
	mov	ecx,IMG_SIZE
3853 GerdtR 552
     .DrawPix:
553
 
4146 GerdtR 554
	lodsd
555
	test	eax,0FF000000h
556
	jnz	@f
557
	mov	eax,[sc.work]
3853 GerdtR 558
     @@:
559
 
4146 GerdtR 560
	mov	[edi],ax
561
	shr	eax,16
562
	mov	[edi+2],al
563
	add	edi,3
3853 GerdtR 564
 
4146 GerdtR 565
	loop	.DrawPix
3853 GerdtR 566
 
4146 GerdtR 567
	dec	edx
568
	jnz    .DrawLine
3853 GerdtR 569
 
4146 GerdtR 570
	mov	edx,[IcoX]
571
	shl	edx,16
572
	mov	dx,word[IcoY]
573
	mcall	7,DlgBufImg,
3853 GerdtR 574
 
4146 GerdtR 575
	inc	[iIcon]
576
	mov	eax,[iIcon]
577
	cmp	eax,[icon_count]
578
	jae	.endDrawIcon
3853 GerdtR 579
 
4146 GerdtR 580
	add	dword[IcoY],IMG_SIZE+SPCH
581
	pop	ecx
582
	loop	.DrawIcoStolb
3853 GerdtR 583
 
4146 GerdtR 584
	add	dword[IcoX],IMG_SIZE+SPCW
585
	pop	ecx
586
	loop	.DrawIcons
587
	jmp	.endProc
3853 GerdtR 588
 
589
    .endDrawIcon:
590
 
4146 GerdtR 591
	mov	ecx,IMG_SIZE*IMG_SIZE
592
	mov	edi,DlgBufImg
593
	mov	eax,[sc.work]
594
	mov	ebx,eax
595
	shr	ebx,16
3853 GerdtR 596
     @@:
4146 GerdtR 597
	mov	word[edi],ax
598
	mov	[edi+2],bl
599
	add	edi,3
600
	loop	@b
3853 GerdtR 601
 
5017 GerdtR 602
				     ;затирание не использованых мест
4146 GerdtR 603
	jmp	.Dalee
3853 GerdtR 604
 
605
  .DrawIcons2:
4146 GerdtR 606
	push	ecx
3853 GerdtR 607
 
4146 GerdtR 608
	mov	[IcoY],ICONSY
609
	mov	ecx,ICONS_DRAW_COUNTH
3853 GerdtR 610
  .DrawIcoStolb2:
4146 GerdtR 611
	push	ecx
3853 GerdtR 612
 
4146 GerdtR 613
	mov	edx,[IcoX]
614
	shl	edx,16
615
	mov	dx,word[IcoY]
616
	mcall	7,DlgBufImg,
3853 GerdtR 617
 
618
     .Dalee:
4146 GerdtR 619
	add	dword[IcoY],IMG_SIZE+SPCH
620
	pop	ecx
621
	loop	.DrawIcoStolb2
3853 GerdtR 622
 
4146 GerdtR 623
	add	dword[IcoX],IMG_SIZE+SPCW
624
	pop	ecx
625
	loop	.DrawIcons2
3853 GerdtR 626
 
627
   .endProc:
4007 GerdtR 628
 
4146 GerdtR 629
	ret
3853 GerdtR 630
endp
631
 
632
proc DrawSelIcon
7012 leency 633
	mov	edx,[sc.work]
634
	mcall 13,,<59,12>
7437 leency 635
 
7012 leency 636
	mov	ecx,[sc.work_text]
637
	or	ecx,90000000h
638
	mcall 4,,,DAreaIcon
639
 
4146 GerdtR 640
	mov	edi,DAreaIcon
641
	cmp	byte[edi],0
642
	jne	@f
643
	ret
3853 GerdtR 644
      @@:
645
 
7437 leency 646
	;stdcall hexToInt, edi
647
	stdcall strToInt, edi
4146 GerdtR 648
     @@:	     ;eax=num icon
649
	cmp	eax,[icon_count]
650
	jb	@f
651
	xor	eax,eax
3853 GerdtR 652
     @@:
4146 GerdtR 653
	test	eax,eax
654
	je	.DI1
655
	mov	ecx,eax
656
	xor	eax,eax
3853 GerdtR 657
      @@:
4146 GerdtR 658
	add	eax,IMG_SIZE*IMG_SIZE*4
659
	loop	@b
3853 GerdtR 660
     .DI1:
4146 GerdtR 661
	mov	esi,eax
662
	add	esi,[raw_pointer]
663
	add	esi,44
3853 GerdtR 664
 
4146 GerdtR 665
	mov	edi,DlgBufImg
666
	mov	edx,IMG_SIZE
3853 GerdtR 667
    .DrawLine:
668
 
4146 GerdtR 669
	mov	ecx,IMG_SIZE
3853 GerdtR 670
     .DrawPix:
671
 
4146 GerdtR 672
	lodsd
673
	test	eax,0FF000000h
674
	jnz	@f
675
	mov	eax,[sc.work]
3853 GerdtR 676
     @@:
677
 
4146 GerdtR 678
	mov	word[edi],ax
679
	shr	eax,16
680
	mov	[edi+2],al
681
	add	edi,3
3853 GerdtR 682
 
4146 GerdtR 683
	loop	.DrawPix
3853 GerdtR 684
 
4146 GerdtR 685
	dec	edx
686
	jnz	.DrawLine
3853 GerdtR 687
 
7012 leency 688
	mcall	7,DlgBufImg,,<30,15>
3853 GerdtR 689
 
4146 GerdtR 690
	ret
7437 leency 691
endp
692
 
693
;NOT USED
694
proc hexToInt strz:DWORD
695
	push	ebx
696
	mov	ebx,[strz]
697
	mov	al,[ebx]
698
	xor	edx,edx
699
.loop:
700
	xor	ecx,ecx
701
	inc	ebx
702
	shl	edx,4
703
	cmp	al,'0'
704
	jb	.err
705
	cmp	al,'9'
706
	jbe	.conv
707
	mov	ecx,10
708
	sub	al,11h
709
	cmp	al,'0'
710
	jb	.err
711
	cmp	al,'6'
712
	ja	.err
713
.conv:
714
	sub	al,30h
715
	add	dl,al
716
	mov	al,[ebx]
717
	add	dl,cl
718
	test	al,al
719
	jnz	.loop
720
	mov	eax,edx
721
	pop	ebx
722
	ret
723
.err:
724
	xor	eax,eax
725
	pop	ebx
726
	ret
727
endp
728
 
729
 
730
;NOT USED
731
proc byteToHex byti:BYTE,target:DWORD
732
	push	ebx
733
	mov	ebx,[target]
734
	mov	dl,[byti]
735
	rol	dl,4
736
	mov	ecx,2
737
.loop:
738
	mov	al,dl
739
	and	al,0xF
740
	cmp	al,10
741
	jae	@f
742
	add	al,0x30
743
	jmp	.n
744
@@:
745
	add	al,0x41-10
746
.n:
747
	mov	[ebx],al
748
	inc	ebx
749
	rol	dl,4
750
	loop	.loop
751
 
752
	mov	byte[ebx],0
753
@@:	pop	ebx
754
	ret
755
	jmp	@b
756
endp
757
 
758
 
759
proc strToInt strz:DWORD
760
	push	ebx edi esi
761
	stdcall strLen, [strz]
762
	xor	edx,edx
763
	xor	ebx,ebx
764
	xor	edi,edi
765
	std
766
	inc	ebx
767
	mov	esi,[strz]
768
	lea	esi,[esi+eax-2]
769
.loop:
770
	xor	eax,eax
771
	lodsb
772
	cmp	al,'0'
773
	jb	.err
774
	cmp	al,'9'
775
	ja	.err
776
 
777
	sub	al,0x30
778
	mul	ebx
779
	lea	ebx,[ebx*4+ebx] 	;ebx = ebx*10
780
	shl	ebx,1
781
	add	edi,eax
782
	cmp	esi,[strz]
783
	jae	.loop
784
	cld
785
	mov	eax,edi
786
	pop	esi edi ebx
787
	ret
788
.err:
789
	cld
790
	or	eax,-1
791
	pop	esi edi ebx
792
	ret
793
endp
794
 
795
 
796
;ret: target - string, edx - length string
797
proc intToStr inti:DWORD, target:DWORD
798
locals
799
   resl rb 16
800
endl
801
	lea	edi,[resl]
802
	mov	eax,[inti]
803
	xor	ecx,ecx
804
	mov	ebx,10
805
	jmp	.stlp
806
.loop:
807
	xor	edx,edx
808
	div	ebx
809
	mov	[edi],dl
810
	inc	edi
811
	inc	ecx
812
.stlp:	cmp	eax,10
813
	jae	.loop
814
	mov	[edi],al
815
	inc	ecx
816
	mov	edx,ecx
817
	mov	ebx,[target]
818
.conv:
819
	mov	al,[edi]
820
	add	al,0x30
821
	mov	[ebx],al
822
	inc	ebx
823
	dec	edi
824
	loop	.conv
825
	mov	byte[ebx],0
826
	ret
827
endp
828
 
829
;for 'ab',0  strLen = 3
830
proc strLen stringZ:DWORD
831
	push	edi
832
	xor	al,al
833
	mov	edi,[stringZ]
834
	or	ecx,-1
835
	repne	scasb
836
	sub	edi,[stringZ]
837
	mov	eax,edi
838
	pop	edi
839
	ret
840
endp
841