Subversion Repositories Kolibri OS

Rev

Rev 6352 | Rev 6359 | 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
 
6355 IgorA 258
	mcall SF_TERMINATE_PROCESS
1643 mario79 259
;---------------------------------------------------------------------
260
no_exit_program:
261
no_file:
262
;|||||||||||||||||||||||||||||EDIT|||||||||||||||||||||||||
263
;<<<<<<<<<>>>>>>>>>
264
	cmp	[number_panel],6
6355 IgorA 265
	jne	still ;no_edit
255 heavyiron 266
 
1643 mario79 267
	cmp	[number_menu],1
268
	jne	no_undo
255 heavyiron 269
 
6355 IgorA 270
	cmp	[number_undo],2 ;2 - maximum undo count
271
	jge	no_undo
255 heavyiron 272
 
6355 IgorA 273
;rotate bufers -1
274
	inc	[number_undo]
275
	mov eax,[PointerToPicture]
276
	mov ebx,[PointerToCopyPicture]
277
	mov ecx,[PointerToCopyPicture2]
278
	mov [PointerToPicture],ebx
279
	mov [PointerToCopyPicture],ecx
280
	mov [PointerToCopyPicture2],eax
255 heavyiron 281
 
6355 IgorA 282
	call MovePictureToWorkScreen
1643 mario79 283
	and	[number_panel],0
284
	and	[number_menu],0
285
	jmp	still
286
;---------------------------------------------------------------------
287
no_undo:
288
;<<<<<<<<<>>>>>>>>>
289
	cmp	[number_menu],2
290
	jne	no_copy
255 heavyiron 291
 
1643 mario79 292
	cmp	[instrument_used],1
293
	jne	no_copy
294
	cmp	[Activate_instrument],0
295
	jne	no_copy
255 heavyiron 296
 
1643 mario79 297
	mov	eax,[OldX]
298
	mov	ebx,[OldY]
255 heavyiron 299
 
1643 mario79 300
	cmp	eax,[rectangular_shade_x]
301
	jl	no_remove_x_copy
255 heavyiron 302
 
1643 mario79 303
	mov	ecx,[rectangular_shade_x]
304
	mov	[OldX],ecx			 ; OldX <-----> rectangulare_shade_x
305
	mov	[rectangular_shade_x],eax
255 heavyiron 306
 
1643 mario79 307
no_remove_x_copy:
308
	cmp	ebx,[rectangular_shade_y]
309
	jl	no_remove_y_copy
255 heavyiron 310
 
1643 mario79 311
	mov	ecx,[rectangular_shade_y]
312
	mov	[OldY],ecx			 ; OldY <-----> rectangulare_shade_y
313
	mov	[rectangular_shade_y],ebx
255 heavyiron 314
 
1643 mario79 315
no_remove_y_copy:
316
	mov	eax,[OldX]
317
	mov	ebx,[OldY]
318
	mov	ecx,[rectangular_shade_x]
319
	mov	edx,[rectangular_shade_y]
320
	inc	eax
321
	inc	ebx
322
	dec	ecx
323
	dec	edx
255 heavyiron 324
 
1643 mario79 325
	mov	[x],eax
326
	mov	[y],ebx
327
	mov	esi,eax
328
	mov	edi,ebx
329
	mov	[Dx_],1
330
	mov	[Dy_],1
255 heavyiron 331
 
1643 mario79 332
	sub	ecx,eax
333
	jnz	no_signum_fill_r_x_copy
255 heavyiron 334
 
1643 mario79 335
	mov	[Dx_],-1
255 heavyiron 336
 
1643 mario79 337
no_signum_fill_r_x_copy:
338
	sub	edx,ebx
339
	jnz	no_signum_fill_r_y_copy
255 heavyiron 340
 
1643 mario79 341
	mov	[Dy_],-1
255 heavyiron 342
 
1643 mario79 343
no_signum_fill_r_y_copy:
344
	mov	ebx,[rectangular_shade_y]
345
	sub	ebx,edi
255 heavyiron 346
 
1643 mario79 347
	mov	edx,[PointerToEditBufer]
348
	mov	[y],edi
255 heavyiron 349
 
1643 mario79 350
loop_fill_rectangle_y_copy:
351
	mov	[x],esi
255 heavyiron 352
 
1643 mario79 353
loop_fill_rectangle_x_copy:
354
	push	esi edi
355
	mov	eax,[PointerToPicture]
356
	mov	ebx,[Picture_SizeX]
357
	mov	esi,[x]
358
	mov	edi,[y]
359
	call	GetColorOfPixel
360
	mov	[edx],ax
361
	shr	eax,16
362
	mov	[edx+2],al
363
	pop	edi esi
255 heavyiron 364
 
1643 mario79 365
	add	edx,3
366
	mov	eax,[x]
367
	add	eax,[Dx_]
368
	mov	[x],eax
255 heavyiron 369
 
1643 mario79 370
	cmp	eax,[rectangular_shade_x]
371
	jl	loop_fill_rectangle_x_copy
255 heavyiron 372
 
1643 mario79 373
	mov	eax,[y]
374
	add	eax,[Dy_]
375
	mov	[y],eax
255 heavyiron 376
 
1643 mario79 377
	cmp	eax,[rectangular_shade_y]
378
	jl	loop_fill_rectangle_y_copy
255 heavyiron 379
 
1643 mario79 380
	call	MovePictureToWorkScreen
255 heavyiron 381
 
1643 mario79 382
	and	[number_panel],0
383
	and	[number_menu],0
384
	mov	[DrawSprite_flag],1
385
	jmp	still
386
;---------------------------------------------------------------------
387
no_copy:
388
;<<<<<<<<<>>>>>>>
389
	cmp	[number_menu],3
390
	jne	no_paste
255 heavyiron 391
 
1643 mario79 392
	cmp	[instrument_used],1
393
	jne	no_paste
255 heavyiron 394
 
1643 mario79 395
	cmp	[Activate_instrument],0
396
	jne	no_paste
255 heavyiron 397
 
1643 mario79 398
	mov	eax,[OldX]
399
	mov	ebx,[OldY]
255 heavyiron 400
 
1643 mario79 401
	cmp	eax,[rectangular_shade_x]
402
	jl	no_remove_x_paste
255 heavyiron 403
 
1643 mario79 404
	mov	ecx,[rectangular_shade_x]
405
	mov	[OldX],ecx 		  ; OldX <-----> rectangulare_shade_x
406
	mov	[rectangular_shade_x],eax
255 heavyiron 407
 
1643 mario79 408
no_remove_x_paste:
409
	cmp	ebx,[rectangular_shade_y]
410
	jl	no_remove_y_paste
255 heavyiron 411
 
1643 mario79 412
	mov	ecx,[rectangular_shade_y]
413
	mov	[OldY],ecx 		  ; OldY <-----> rectangulare_shade_y
414
	mov	[rectangular_shade_y],ebx
255 heavyiron 415
 
1643 mario79 416
no_remove_y_paste:
417
	mov	eax,[OldX]
418
	mov	ebx,[OldY]
419
	mov	ecx,[rectangular_shade_x]
420
	mov	edx,[rectangular_shade_y]
421
	inc	eax
422
	inc	ebx
423
	dec	ecx
424
	dec	edx
255 heavyiron 425
 
1643 mario79 426
	mov	[x],eax
427
	mov	[y],ebx
428
	mov	esi,eax
429
	mov	edi,ebx
430
	mov	[Dx_],1
431
	mov	[Dy_],1
255 heavyiron 432
 
1643 mario79 433
	sub	ecx,eax
434
	jnz	no_signum_fill_r_x_paste
255 heavyiron 435
 
1643 mario79 436
	mov	[Dx_],-1
255 heavyiron 437
 
1643 mario79 438
no_signum_fill_r_x_paste:
439
	sub	edx,ebx
440
	jnz	no_signum_fill_r_y_paste
255 heavyiron 441
 
1643 mario79 442
	mov	[Dy_],-1
255 heavyiron 443
 
1643 mario79 444
no_signum_fill_r_y_paste:
445
	mov	edx,[PointerToEditBufer]
446
	mov	[y],edi
255 heavyiron 447
 
1643 mario79 448
loop_fill_rectangle_y_paste:
449
	mov	[x],esi
255 heavyiron 450
 
1643 mario79 451
loop_fill_rectangle_x_paste:
452
	push	esi edi
453
	mov	ecx,[edx]
454
	and	ecx,0xffffff ;color
455
	mov	eax,[PointerToPicture]
456
	mov	ebx,[Picture_SizeX]
457
	mov	esi,[x]
458
	mov	edi,[y]
459
	call	PutPixel
460
	pop	edi esi
255 heavyiron 461
 
1643 mario79 462
	add	edx,3
255 heavyiron 463
 
1643 mario79 464
	mov	eax,[x]
465
	add	eax,[Dx_]
466
	mov	[x],eax
467
	cmp	eax,[rectangular_shade_x]
468
	jl	loop_fill_rectangle_x_paste
255 heavyiron 469
 
1643 mario79 470
	mov	eax,[y]
471
	add	eax,[Dy_]
472
	mov	[y],eax
473
	cmp	eax,[rectangular_shade_y]
474
	jl	loop_fill_rectangle_y_paste
255 heavyiron 475
 
1643 mario79 476
	call	MovePictureToWorkScreen
477
	and	[number_panel],0
478
	and	[number_menu],0
479
	mov	[Paste_flag],1
480
	jmp	still
481
;---------------------------------------------------------------------
482
no_paste:
483
;<<<<<<<<<>>>>>>>>>
484
	cmp	[number_menu],4
485
	jne	no_cut
255 heavyiron 486
 
1643 mario79 487
	cmp	[instrument_used],1
488
	jne	no_cut
255 heavyiron 489
 
1643 mario79 490
	cmp	[Activate_instrument],0
491
	jne	no_cut
255 heavyiron 492
 
1643 mario79 493
	mov	eax,[OldX]
494
	mov	ebx,[OldY]
255 heavyiron 495
 
1643 mario79 496
	cmp	eax,[rectangular_shade_x]
497
	jl	no_remove_x_cut
255 heavyiron 498
 
1643 mario79 499
	mov	ecx,[rectangular_shade_x]
500
	mov	[OldX],ecx 		  ; OldX <-----> rectangulare_shade_x
501
	mov	[rectangular_shade_x],eax
255 heavyiron 502
 
1643 mario79 503
no_remove_x_cut:
504
	cmp	ebx,[rectangular_shade_y]
505
	jl	no_remove_y_cut
255 heavyiron 506
 
1643 mario79 507
	mov	ecx,[rectangular_shade_y]
508
	mov	[OldY],ecx 		  ; OldY <-----> rectangulare_shade_y
509
	mov	[rectangular_shade_y],ebx
255 heavyiron 510
 
1643 mario79 511
no_remove_y_cut:
512
	mov	eax,[OldX]
513
	mov	ebx,[OldY]
514
	mov	ecx,[rectangular_shade_x]
515
	mov	edx,[rectangular_shade_y]
516
	inc	eax
517
	inc	ebx
518
	dec	ecx
519
	dec	edx
255 heavyiron 520
 
1643 mario79 521
	mov	[x],eax
522
	mov	[y],ebx
523
	mov	esi,eax
524
	mov	edi,ebx
525
	mov	[Dx_],1
526
	mov	[Dy_],1
255 heavyiron 527
 
1643 mario79 528
	sub	ecx,eax
529
	jnz	no_signum_fill_r_x
255 heavyiron 530
 
1643 mario79 531
	mov	[Dx_],-1
255 heavyiron 532
 
1643 mario79 533
no_signum_fill_r_x:
534
	sub	edx,ebx
535
	jnz	no_signum_fill_r_y
255 heavyiron 536
 
1643 mario79 537
	mov	[Dy_],-1
255 heavyiron 538
 
1643 mario79 539
no_signum_fill_r_y:
540
	mov	[y],edi
255 heavyiron 541
 
1643 mario79 542
loop_fill_rectangle_y:
543
	mov	[x],esi
255 heavyiron 544
 
1643 mario79 545
loop_fill_rectangle_x:
546
	push	esi edi
547
	mov	eax,[PointerToPicture]
548
	mov	ebx,[Picture_SizeX]
549
	mov	ecx,dword 0xffffff
550
	mov	esi,[x]
551
	mov	edi,[y]
552
	call	PutPixel
553
	pop	edi esi
255 heavyiron 554
 
1643 mario79 555
	mov	eax,[x]
556
	add	eax,[Dx_]
557
	mov	[x],eax
255 heavyiron 558
 
1643 mario79 559
	cmp	eax,[rectangular_shade_x]
560
	jl	loop_fill_rectangle_x
255 heavyiron 561
 
1643 mario79 562
	mov	eax,[y]
563
	add	eax,[Dy_]
564
	mov	[y],eax
255 heavyiron 565
 
1643 mario79 566
	cmp	eax,[rectangular_shade_y]
567
	jl	loop_fill_rectangle_y
255 heavyiron 568
 
1643 mario79 569
	call	MovePictureToWorkScreen
255 heavyiron 570
 
1643 mario79 571
	and	[number_panel],0
572
	and	[number_menu],0
573
	jmp	still
574
;---------------------------------------------------------------------
575
no_cut:
576
;<<<<<>>>>>
577
	cmp	[number_menu],5
578
	jne	no_cleare_all
255 heavyiron 579
 
1643 mario79 580
	call	cleare_work_arrea
581
	call	MovePictureToWorkScreen
255 heavyiron 582
 
1643 mario79 583
	and	[number_panel],0
584
	and	[number_menu],0
585
	jmp	still
586
;---------------------------------------------------------------------
587
no_cleare_all:
588
;<<<<<>>>>>
589
	cmp	[number_menu],6
590
	jne	still	;no_to_allocate_all
255 heavyiron 591
 
1643 mario79 592
	mov	[OldX],1
593
	mov	[OldY],1
594
	mov	eax,[Picture_SizeX]
595
	mov	ebx,[Picture_SizeY]
596
	dec	eax
597
	dec	ebx
598
	mov	[rectangular_shade_x],eax
599
	mov	[rectangular_shade_y],ebx
600
	mov	[instrument_used],1
601
	mov	[Activate_instrument],1
602
	mov	[Current_instrument],30
603
	mov	[crossing],0
604
	and	[number_panel],0
605
	and	[number_menu],0
606
;	call	TakeButtonInstruments
607
;	call	MovePictureToWorkScreen
608
	jmp	still
609
;---------------------------------------------------------------------
610
;no_to_allocate_all:
611
;no_edit:
612
;	jmp	still
613
;---------------------------------------------------------------------