Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
255 heavyiron 1
;-----------------------------------------------------------
2
;-----------instruments of menu-----------------------------
3
;-----------------------------------------------------------
4
TakeInstruments:
1643 mario79 5
;|||||||||||||||||||FILE||||||||||||||||||||||
6
	cmp	[number_panel],7
7
	jne	no_file
255 heavyiron 8
 
1643 mario79 9
;<<<<>>>>>>
10
	cmp	[number_menu],1
11
	jne	no_new
255 heavyiron 12
 
1643 mario79 13
	mov	eax,80
14
	mov	ebx,100
15
	mov	ecx,150
16
	mov	edx,90
17
	mov	 esi,1
18
	call	draw_volume_rectangle
255 heavyiron 19
 
1643 mario79 20
	mov	eax,177
21
	mov	ebx,115
22
	mov	ecx,40
23
	mov	edx,14
24
	mov	 esi,4
25
	call	draw_volume_rectangle
255 heavyiron 26
 
1643 mario79 27
	mov	eax,177
28
	mov	ebx,115+24
29
	mov	ecx,40
30
	mov	edx,14
31
	mov	 esi,4
32
	call	draw_volume_rectangle
255 heavyiron 33
 
1643 mario79 34
	mov	eax,175
35
	mov	ebx,170
36
	mov	ecx,40
37
	mov	edx,15
38
	mov	esi,1
39
	call	draw_volume_rectangle
255 heavyiron 40
 
1643 mario79 41
	mov	eax,90
42
	mov	ebx,118
43
	mov	ecx,0xffffff
44
	mov	edx,new_text1
45
	mov	esi,14
46
	call	print_text
255 heavyiron 47
 
1643 mario79 48
	mov	eax,90
49
	mov	ebx,118+24
50
	mov	ecx,0xffffff
51
	mov	edx,new_text2
52
	mov	esi,14
53
	call	print_text
255 heavyiron 54
 
1643 mario79 55
	mov	eax,185
56
	mov	ebx,175
57
	mov	ecx,0xffffff
58
	mov	edx,ok_text
59
	mov	esi,2
60
	call	print_text
255 heavyiron 61
 
1643 mario79 62
	mov	edx,1000000000000000000000000000000b+1000
6342 IgorA 63
	mcall SF_DEFINE_BUTTON,<177,40>,<115,14>,
255 heavyiron 64
 
1643 mario79 65
	mov	edx,1000000000000000000000000000000b+1001
66
	mcall	,,<139,14>,
255 heavyiron 67
 
1643 mario79 68
	mov	edx,1000000000000000000000000000000b+1002
69
	mcall	,<175,40>,<170,15>
255 heavyiron 70
 
1643 mario79 71
no_activate_space:
6342 IgorA 72
	mcall SF_WAIT_EVENT
255 heavyiron 73
 
1643 mario79 74
	cmp	eax,1
75
	je	exit_new
255 heavyiron 76
 
1643 mario79 77
	cmp	eax,3
78
	jne	no_activate_space
255 heavyiron 79
 
6342 IgorA 80
	mcall SF_GET_BUTTON
1643 mario79 81
	shr	eax,8
255 heavyiron 82
 
1643 mario79 83
	cmp	eax,1000
84
	jl	no_activate_space
255 heavyiron 85
 
1643 mario79 86
	cmp	eax,1000
87
	jne	no_picture_size_x
255 heavyiron 88
 
1643 mario79 89
	mov	eax,180
90
	mov	ebx,119
91
	mov	ecx,5
92
	call	dialog_line
255 heavyiron 93
 
1643 mario79 94
	mov	eax,string_
95
	mov	ebx,13
96
	call	find_symvol
255 heavyiron 97
 
1643 mario79 98
	dec	eax
99
	mov	[length_number],eax
100
	mov	eax,string_
101
	call	value
255 heavyiron 102
 
1643 mario79 103
	mov	[Picture_SizeX],eax
104
	jmp	no_activate_space
105
;---------------------------------------------------------------------
106
no_picture_size_x:
107
	cmp	eax,1001
108
	jne	no_picture_size_y
255 heavyiron 109
 
1643 mario79 110
	mov	eax,180
111
	mov	ebx,119+24
112
	mov	ecx,5
113
	call	dialog_line
255 heavyiron 114
 
1643 mario79 115
	mov	eax,string_
116
	mov	ebx,13
117
	call	find_symvol
255 heavyiron 118
 
1643 mario79 119
	dec	eax
120
	mov	[length_number],eax
121
	mov	eax,string_
122
	call	value
255 heavyiron 123
 
1643 mario79 124
	mov	[Picture_SizeY],eax
125
	jmp	no_activate_space
126
;---------------------------------------------------------------------
127
no_picture_size_y:
128
	cmp	eax,1002
129
	jne	no_activate_space
255 heavyiron 130
 
1643 mario79 131
exit_new:
132
	mov	edx,11100000000000000000000000000000b+1002
6342 IgorA 133
	mcall SF_DEFINE_BUTTON,<175,40>,<170,15>
255 heavyiron 134
 
1643 mario79 135
	mov	edx,11100000000000000000000000000000b+1001
136
	mcall	,<177,40>,<139,14>
255 heavyiron 137
 
1643 mario79 138
	mov	edx,11100000000000000000000000000000b+1000
139
	mcall	,,<115,14>
255 heavyiron 140
 
1643 mario79 141
;get memory for new picture
142
	call	GetMemory
255 heavyiron 143
 
1643 mario79 144
	and	[save_flag],0
145
	and	[number_panel],0
146
	and	[number_menu],0
255 heavyiron 147
 
1643 mario79 148
	call	cleare_work_arrea
149
	call	drawwin
150
	jmp	still
151
;---------------------------------------------------------------------
152
no_new:
153
;<<<<>>>>>>
154
	cmp	[number_menu],2
155
	jne	no_open
255 heavyiron 156
 
1632 mario79 157
;---------------------------------------------------------------------
158
	mov	[OpenDialog_data.type],0 ; open
159
 
160
	push    dword OpenDialog_data
161
	call    [OpenDialog_Start]
162
 
163
	cmp	[OpenDialog_data.status],1
164
	jne	still
165
;---------------------------------------------------------------------
6342 IgorA 166
	mcall SF_SET_EVENTS_MASK,0x80000027 ;100111b
1632 mario79 167
 
6328 IgorA 168
	call load_picture
6342 IgorA 169
	call drawwin
255 heavyiron 170
 
1643 mario79 171
	and	[number_panel],0
172
	and	[number_menu],0
173
	jmp	still
174
;---------------------------------------------------------------------
175
no_open:
176
 ;<<<<<<<<<<>>>>>>>>>>>
177
	cmp	[number_menu],3
178
	jne	no_save_
255 heavyiron 179
 
1643 mario79 180
	mov	al,[save_flag]
181
	test	al,al
182
	jz	no_save_file
183
	jmp	save_enter
184
;---------------------------------------------------------------------
185
no_save_file:
186
	and	[number_panel],0
187
	and	[number_menu],0
188
	jmp	still
189
;---------------------------------------------------------------------
190
no_save_:
191
 ;<<<<<<<<>>>>>>>>>>
192
	cmp	[number_menu],4
193
	jne	no_save
255 heavyiron 194
 
1643 mario79 195
; savedialog drawwin,save1,save2,file_path
1632 mario79 196
;---------------------------------------------------------------------
1636 mario79 197
; replace extension to '.bmp'
198
	push	eax esi
199
	mov	esi,[OpenDialog_data.filename_area]
200
	xor	eax,eax
201
	cld
202
@@:
203
	lodsb
204
	test	eax,eax
205
	jnz	@r
1643 mario79 206
	sub	esi,5
1636 mario79 207
	cmp	[esi],byte '.'
208
	jne	@f
1643 mario79 209
	mov	[esi],dword '.bmp'
1636 mario79 210
@@:
211
	pop	esi eax
212
;---------------------------------------------------------------------
1632 mario79 213
	mov	[OpenDialog_data.type],1 ; save
214
 
215
	push    dword OpenDialog_data
216
	call    [OpenDialog_Start]
1643 mario79 217
 
1632 mario79 218
	cmp	[OpenDialog_data.status],1
219
	jne	still
220
;---------------------------------------------------------------------
1643 mario79 221
save1:
222
save_enter:
6342 IgorA 223
	mcall SF_SET_EVENTS_MASK,0x80000027 ;100111b
255 heavyiron 224
 
1643 mario79 225
	call	analizing_picture_to_palette
255 heavyiron 226
 
1643 mario79 227
	;eax => number of colors in picture
228
	mov	ebx,[PointerToPicture]
229
	mov	ecx,[PointerToEditBufer]
230
	mov	edx,[PointerToPalette]
231
	mov	esi,[Picture_SizeX]
232
	mov	edi,[Picture_SizeY]
255 heavyiron 233
 
1643 mario79 234
	call	coding_bmp
255 heavyiron 235
 
1643 mario79 236
	mov	eax,file_path
237
	mov	ecx,ebx
238
	mov	ebx,[PointerToEditBufer]
255 heavyiron 239
 
1643 mario79 240
	call	save_file
255 heavyiron 241
 
1643 mario79 242
	mov	[save_flag],1
243
	and	[number_panel],0
244
	and	[number_menu],0
245
	call	drawwin
246
	jmp	still
247
;---------------------------------------------------------------------
248
;save2:
249
;	and	[number_panel],0
250
;	and	[number_menu],0
251
;	jmp	still
252
;---------------------------------------------------------------------
253
no_save:
254
 ;<<<<<>>>>>>
255
	cmp	[number_menu],5
256
	jne	no_exit_program
255 heavyiron 257
 
1643 mario79 258
	mov	eax,-1
259
	mcall
260
;---------------------------------------------------------------------
261
no_exit_program:
262
no_file:
263
;|||||||||||||||||||||||||||||EDIT|||||||||||||||||||||||||
264
;<<<<<<<<<>>>>>>>>>
265
	cmp	[number_panel],6
266
	jne	still	;no_edit
255 heavyiron 267
 
1643 mario79 268
	cmp	[number_menu],1
269
	jne	no_undo
255 heavyiron 270
 
1643 mario79 271
	cmp	[number_undo],1
272
	jne	no_one____
255 heavyiron 273
 
1643 mario79 274
	mov	esi,[PointerToCopyPicture]
255 heavyiron 275
 
1643 mario79 276
no_one____:
277
	cmp	[number_undo],2
278
	jne	no_two____
255 heavyiron 279
 
1643 mario79 280
	mov	esi,[PointerToCopyPicture2]
255 heavyiron 281
 
1643 mario79 282
no_two____:
283
	mov	edi,[PointerToPicture]
284
	mov	ecx,[Picture_SizeX]
285
	imul	ecx,[Picture_SizeY]
286
	lea	ecx,[ecx+ecx*2]
287
	add	ecx,4
288
	shr	ecx,2
289
	cld
290
	rep	movsd
291
	call	MovePictureToWorkScreen
255 heavyiron 292
 
1643 mario79 293
	dec	[number_undo]
294
	jnz	no_null_undo
255 heavyiron 295
 
1643 mario79 296
	mov	[number_undo],1
255 heavyiron 297
 
1643 mario79 298
no_null_undo:
299
	and	[number_panel],0
300
	and	[number_menu],0
301
	jmp	still
302
;---------------------------------------------------------------------
303
no_undo:
304
;<<<<<<<<<>>>>>>>>>
305
	cmp	[number_menu],2
306
	jne	no_copy
255 heavyiron 307
 
1643 mario79 308
	cmp	[instrument_used],1
309
	jne	no_copy
310
	cmp	[Activate_instrument],0
311
	jne	no_copy
255 heavyiron 312
 
1643 mario79 313
	mov	eax,[OldX]
314
	mov	ebx,[OldY]
255 heavyiron 315
 
1643 mario79 316
	cmp	eax,[rectangular_shade_x]
317
	jl	no_remove_x_copy
255 heavyiron 318
 
1643 mario79 319
	mov	ecx,[rectangular_shade_x]
320
	mov	[OldX],ecx			 ; OldX <-----> rectangulare_shade_x
321
	mov	[rectangular_shade_x],eax
255 heavyiron 322
 
1643 mario79 323
no_remove_x_copy:
324
	cmp	ebx,[rectangular_shade_y]
325
	jl	no_remove_y_copy
255 heavyiron 326
 
1643 mario79 327
	mov	ecx,[rectangular_shade_y]
328
	mov	[OldY],ecx			 ; OldY <-----> rectangulare_shade_y
329
	mov	[rectangular_shade_y],ebx
255 heavyiron 330
 
1643 mario79 331
no_remove_y_copy:
332
	mov	eax,[OldX]
333
	mov	ebx,[OldY]
334
	mov	ecx,[rectangular_shade_x]
335
	mov	edx,[rectangular_shade_y]
336
	inc	eax
337
	inc	ebx
338
	dec	ecx
339
	dec	edx
255 heavyiron 340
 
1643 mario79 341
	mov	[x],eax
342
	mov	[y],ebx
343
	mov	esi,eax
344
	mov	edi,ebx
345
	mov	[Dx_],1
346
	mov	[Dy_],1
255 heavyiron 347
 
1643 mario79 348
	sub	ecx,eax
349
	jnz	no_signum_fill_r_x_copy
255 heavyiron 350
 
1643 mario79 351
	mov	[Dx_],-1
255 heavyiron 352
 
1643 mario79 353
no_signum_fill_r_x_copy:
354
	sub	edx,ebx
355
	jnz	no_signum_fill_r_y_copy
255 heavyiron 356
 
1643 mario79 357
	mov	[Dy_],-1
255 heavyiron 358
 
1643 mario79 359
no_signum_fill_r_y_copy:
360
	mov	ebx,[rectangular_shade_y]
361
	sub	ebx,edi
255 heavyiron 362
 
1643 mario79 363
	mov	edx,[PointerToEditBufer]
364
	mov	[y],edi
255 heavyiron 365
 
1643 mario79 366
loop_fill_rectangle_y_copy:
367
	mov	[x],esi
255 heavyiron 368
 
1643 mario79 369
loop_fill_rectangle_x_copy:
370
	push	esi edi
371
	mov	eax,[PointerToPicture]
372
	mov	ebx,[Picture_SizeX]
373
	mov	esi,[x]
374
	mov	edi,[y]
375
	call	GetColorOfPixel
376
	mov	[edx],ax
377
	shr	eax,16
378
	mov	[edx+2],al
379
	pop	edi esi
255 heavyiron 380
 
1643 mario79 381
	add	edx,3
382
	mov	eax,[x]
383
	add	eax,[Dx_]
384
	mov	[x],eax
255 heavyiron 385
 
1643 mario79 386
	cmp	eax,[rectangular_shade_x]
387
	jl	loop_fill_rectangle_x_copy
255 heavyiron 388
 
1643 mario79 389
	mov	eax,[y]
390
	add	eax,[Dy_]
391
	mov	[y],eax
255 heavyiron 392
 
1643 mario79 393
	cmp	eax,[rectangular_shade_y]
394
	jl	loop_fill_rectangle_y_copy
255 heavyiron 395
 
1643 mario79 396
	call	MovePictureToWorkScreen
255 heavyiron 397
 
1643 mario79 398
	and	[number_panel],0
399
	and	[number_menu],0
400
	mov	[DrawSprite_flag],1
401
	jmp	still
402
;---------------------------------------------------------------------
403
no_copy:
404
;<<<<<<<<<>>>>>>>
405
	cmp	[number_menu],3
406
	jne	no_paste
255 heavyiron 407
 
1643 mario79 408
	cmp	[instrument_used],1
409
	jne	no_paste
255 heavyiron 410
 
1643 mario79 411
	cmp	[Activate_instrument],0
412
	jne	no_paste
255 heavyiron 413
 
1643 mario79 414
	mov	eax,[OldX]
415
	mov	ebx,[OldY]
255 heavyiron 416
 
1643 mario79 417
	cmp	eax,[rectangular_shade_x]
418
	jl	no_remove_x_paste
255 heavyiron 419
 
1643 mario79 420
	mov	ecx,[rectangular_shade_x]
421
	mov	[OldX],ecx 		  ; OldX <-----> rectangulare_shade_x
422
	mov	[rectangular_shade_x],eax
255 heavyiron 423
 
1643 mario79 424
no_remove_x_paste:
425
	cmp	ebx,[rectangular_shade_y]
426
	jl	no_remove_y_paste
255 heavyiron 427
 
1643 mario79 428
	mov	ecx,[rectangular_shade_y]
429
	mov	[OldY],ecx 		  ; OldY <-----> rectangulare_shade_y
430
	mov	[rectangular_shade_y],ebx
255 heavyiron 431
 
1643 mario79 432
no_remove_y_paste:
433
	mov	eax,[OldX]
434
	mov	ebx,[OldY]
435
	mov	ecx,[rectangular_shade_x]
436
	mov	edx,[rectangular_shade_y]
437
	inc	eax
438
	inc	ebx
439
	dec	ecx
440
	dec	edx
255 heavyiron 441
 
1643 mario79 442
	mov	[x],eax
443
	mov	[y],ebx
444
	mov	esi,eax
445
	mov	edi,ebx
446
	mov	[Dx_],1
447
	mov	[Dy_],1
255 heavyiron 448
 
1643 mario79 449
	sub	ecx,eax
450
	jnz	no_signum_fill_r_x_paste
255 heavyiron 451
 
1643 mario79 452
	mov	[Dx_],-1
255 heavyiron 453
 
1643 mario79 454
no_signum_fill_r_x_paste:
455
	sub	edx,ebx
456
	jnz	no_signum_fill_r_y_paste
255 heavyiron 457
 
1643 mario79 458
	mov	[Dy_],-1
255 heavyiron 459
 
1643 mario79 460
no_signum_fill_r_y_paste:
461
	mov	edx,[PointerToEditBufer]
462
	mov	[y],edi
255 heavyiron 463
 
1643 mario79 464
loop_fill_rectangle_y_paste:
465
	mov	[x],esi
255 heavyiron 466
 
1643 mario79 467
loop_fill_rectangle_x_paste:
468
	push	esi edi
469
	mov	ecx,[edx]
470
	and	ecx,0xffffff ;color
471
	mov	eax,[PointerToPicture]
472
	mov	ebx,[Picture_SizeX]
473
	mov	esi,[x]
474
	mov	edi,[y]
475
	call	PutPixel
476
	pop	edi esi
255 heavyiron 477
 
1643 mario79 478
	add	edx,3
255 heavyiron 479
 
1643 mario79 480
	mov	eax,[x]
481
	add	eax,[Dx_]
482
	mov	[x],eax
483
	cmp	eax,[rectangular_shade_x]
484
	jl	loop_fill_rectangle_x_paste
255 heavyiron 485
 
1643 mario79 486
	mov	eax,[y]
487
	add	eax,[Dy_]
488
	mov	[y],eax
489
	cmp	eax,[rectangular_shade_y]
490
	jl	loop_fill_rectangle_y_paste
255 heavyiron 491
 
1643 mario79 492
	call	MovePictureToWorkScreen
493
	and	[number_panel],0
494
	and	[number_menu],0
495
	mov	[Paste_flag],1
496
	jmp	still
497
;---------------------------------------------------------------------
498
no_paste:
499
;<<<<<<<<<>>>>>>>>>
500
	cmp	[number_menu],4
501
	jne	no_cut
255 heavyiron 502
 
1643 mario79 503
	cmp	[instrument_used],1
504
	jne	no_cut
255 heavyiron 505
 
1643 mario79 506
	cmp	[Activate_instrument],0
507
	jne	no_cut
255 heavyiron 508
 
1643 mario79 509
	mov	eax,[OldX]
510
	mov	ebx,[OldY]
255 heavyiron 511
 
1643 mario79 512
	cmp	eax,[rectangular_shade_x]
513
	jl	no_remove_x_cut
255 heavyiron 514
 
1643 mario79 515
	mov	ecx,[rectangular_shade_x]
516
	mov	[OldX],ecx 		  ; OldX <-----> rectangulare_shade_x
517
	mov	[rectangular_shade_x],eax
255 heavyiron 518
 
1643 mario79 519
no_remove_x_cut:
520
	cmp	ebx,[rectangular_shade_y]
521
	jl	no_remove_y_cut
255 heavyiron 522
 
1643 mario79 523
	mov	ecx,[rectangular_shade_y]
524
	mov	[OldY],ecx 		  ; OldY <-----> rectangulare_shade_y
525
	mov	[rectangular_shade_y],ebx
255 heavyiron 526
 
1643 mario79 527
no_remove_y_cut:
528
	mov	eax,[OldX]
529
	mov	ebx,[OldY]
530
	mov	ecx,[rectangular_shade_x]
531
	mov	edx,[rectangular_shade_y]
532
	inc	eax
533
	inc	ebx
534
	dec	ecx
535
	dec	edx
255 heavyiron 536
 
1643 mario79 537
	mov	[x],eax
538
	mov	[y],ebx
539
	mov	esi,eax
540
	mov	edi,ebx
541
	mov	[Dx_],1
542
	mov	[Dy_],1
255 heavyiron 543
 
1643 mario79 544
	sub	ecx,eax
545
	jnz	no_signum_fill_r_x
255 heavyiron 546
 
1643 mario79 547
	mov	[Dx_],-1
255 heavyiron 548
 
1643 mario79 549
no_signum_fill_r_x:
550
	sub	edx,ebx
551
	jnz	no_signum_fill_r_y
255 heavyiron 552
 
1643 mario79 553
	mov	[Dy_],-1
255 heavyiron 554
 
1643 mario79 555
no_signum_fill_r_y:
556
	mov	[y],edi
255 heavyiron 557
 
1643 mario79 558
loop_fill_rectangle_y:
559
	mov	[x],esi
255 heavyiron 560
 
1643 mario79 561
loop_fill_rectangle_x:
562
	push	esi edi
563
	mov	eax,[PointerToPicture]
564
	mov	ebx,[Picture_SizeX]
565
	mov	ecx,dword 0xffffff
566
	mov	esi,[x]
567
	mov	edi,[y]
568
	call	PutPixel
569
	pop	edi esi
255 heavyiron 570
 
1643 mario79 571
	mov	eax,[x]
572
	add	eax,[Dx_]
573
	mov	[x],eax
255 heavyiron 574
 
1643 mario79 575
	cmp	eax,[rectangular_shade_x]
576
	jl	loop_fill_rectangle_x
255 heavyiron 577
 
1643 mario79 578
	mov	eax,[y]
579
	add	eax,[Dy_]
580
	mov	[y],eax
255 heavyiron 581
 
1643 mario79 582
	cmp	eax,[rectangular_shade_y]
583
	jl	loop_fill_rectangle_y
255 heavyiron 584
 
1643 mario79 585
	call	MovePictureToWorkScreen
255 heavyiron 586
 
1643 mario79 587
	and	[number_panel],0
588
	and	[number_menu],0
589
	jmp	still
590
;---------------------------------------------------------------------
591
no_cut:
592
;<<<<<>>>>>
593
	cmp	[number_menu],5
594
	jne	no_cleare_all
255 heavyiron 595
 
1643 mario79 596
	call	cleare_work_arrea
597
	call	MovePictureToWorkScreen
255 heavyiron 598
 
1643 mario79 599
	and	[number_panel],0
600
	and	[number_menu],0
601
	jmp	still
602
;---------------------------------------------------------------------
603
no_cleare_all:
604
;<<<<<>>>>>
605
	cmp	[number_menu],6
606
	jne	still	;no_to_allocate_all
255 heavyiron 607
 
1643 mario79 608
	mov	[OldX],1
609
	mov	[OldY],1
610
	mov	eax,[Picture_SizeX]
611
	mov	ebx,[Picture_SizeY]
612
	dec	eax
613
	dec	ebx
614
	mov	[rectangular_shade_x],eax
615
	mov	[rectangular_shade_y],ebx
616
	mov	[instrument_used],1
617
	mov	[Activate_instrument],1
618
	mov	[Current_instrument],30
619
	mov	[crossing],0
620
	and	[number_panel],0
621
	and	[number_menu],0
622
;	call	TakeButtonInstruments
623
;	call	MovePictureToWorkScreen
624
	jmp	still
625
;---------------------------------------------------------------------
626
;no_to_allocate_all:
627
;no_edit:
628
;	jmp	still
629
;---------------------------------------------------------------------