Subversion Repositories Kolibri OS

Rev

Rev 6328 | Rev 6352 | 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
	mov	[Scroll1CoordinatX],9
172
	mov	[Scroll2CoordinatY],89
173
	and	[number_panel],0
174
	and	[number_menu],0
175
	jmp	still
176
;---------------------------------------------------------------------
177
no_open:
178
 ;<<<<<<<<<<>>>>>>>>>>>
179
	cmp	[number_menu],3
180
	jne	no_save_
255 heavyiron 181
 
1643 mario79 182
	mov	al,[save_flag]
183
	test	al,al
184
	jz	no_save_file
185
	jmp	save_enter
186
;---------------------------------------------------------------------
187
no_save_file:
188
	and	[number_panel],0
189
	and	[number_menu],0
190
	jmp	still
191
;---------------------------------------------------------------------
192
no_save_:
193
 ;<<<<<<<<>>>>>>>>>>
194
	cmp	[number_menu],4
195
	jne	no_save
255 heavyiron 196
 
1643 mario79 197
; savedialog drawwin,save1,save2,file_path
1632 mario79 198
;---------------------------------------------------------------------
1636 mario79 199
; replace extension to '.bmp'
200
	push	eax esi
201
	mov	esi,[OpenDialog_data.filename_area]
202
	xor	eax,eax
203
	cld
204
@@:
205
	lodsb
206
	test	eax,eax
207
	jnz	@r
1643 mario79 208
	sub	esi,5
1636 mario79 209
	cmp	[esi],byte '.'
210
	jne	@f
1643 mario79 211
	mov	[esi],dword '.bmp'
1636 mario79 212
@@:
213
	pop	esi eax
214
;---------------------------------------------------------------------
1632 mario79 215
	mov	[OpenDialog_data.type],1 ; save
216
 
217
	push    dword OpenDialog_data
218
	call    [OpenDialog_Start]
1643 mario79 219
 
1632 mario79 220
	cmp	[OpenDialog_data.status],1
221
	jne	still
222
;---------------------------------------------------------------------
1643 mario79 223
save1:
224
save_enter:
6342 IgorA 225
	mcall SF_SET_EVENTS_MASK,0x80000027 ;100111b
255 heavyiron 226
 
1643 mario79 227
	call	analizing_picture_to_palette
255 heavyiron 228
 
1643 mario79 229
	;eax => number of colors in picture
230
	mov	ebx,[PointerToPicture]
231
	mov	ecx,[PointerToEditBufer]
232
	mov	edx,[PointerToPalette]
233
	mov	esi,[Picture_SizeX]
234
	mov	edi,[Picture_SizeY]
255 heavyiron 235
 
1643 mario79 236
	call	coding_bmp
255 heavyiron 237
 
1643 mario79 238
	mov	eax,file_path
239
	mov	ecx,ebx
240
	mov	ebx,[PointerToEditBufer]
255 heavyiron 241
 
1643 mario79 242
	call	save_file
255 heavyiron 243
 
1643 mario79 244
	mov	[save_flag],1
245
	and	[number_panel],0
246
	and	[number_menu],0
247
	call	drawwin
248
	jmp	still
249
;---------------------------------------------------------------------
250
;save2:
251
;	and	[number_panel],0
252
;	and	[number_menu],0
253
;	jmp	still
254
;---------------------------------------------------------------------
255
no_save:
256
 ;<<<<<>>>>>>
257
	cmp	[number_menu],5
258
	jne	no_exit_program
255 heavyiron 259
 
1643 mario79 260
	mov	eax,-1
261
	mcall
262
;---------------------------------------------------------------------
263
no_exit_program:
264
no_file:
265
;|||||||||||||||||||||||||||||EDIT|||||||||||||||||||||||||
266
;<<<<<<<<<>>>>>>>>>
267
	cmp	[number_panel],6
268
	jne	still	;no_edit
255 heavyiron 269
 
1643 mario79 270
	cmp	[number_menu],1
271
	jne	no_undo
255 heavyiron 272
 
1643 mario79 273
	cmp	[number_undo],1
274
	jne	no_one____
255 heavyiron 275
 
1643 mario79 276
	mov	esi,[PointerToCopyPicture]
255 heavyiron 277
 
1643 mario79 278
no_one____:
279
	cmp	[number_undo],2
280
	jne	no_two____
255 heavyiron 281
 
1643 mario79 282
	mov	esi,[PointerToCopyPicture2]
255 heavyiron 283
 
1643 mario79 284
no_two____:
285
	mov	edi,[PointerToPicture]
286
	mov	ecx,[Picture_SizeX]
287
	imul	ecx,[Picture_SizeY]
288
	lea	ecx,[ecx+ecx*2]
289
	add	ecx,4
290
	shr	ecx,2
291
	cld
292
	rep	movsd
293
	call	MovePictureToWorkScreen
255 heavyiron 294
 
1643 mario79 295
	dec	[number_undo]
296
	jnz	no_null_undo
255 heavyiron 297
 
1643 mario79 298
	mov	[number_undo],1
255 heavyiron 299
 
1643 mario79 300
no_null_undo:
301
	and	[number_panel],0
302
	and	[number_menu],0
303
	jmp	still
304
;---------------------------------------------------------------------
305
no_undo:
306
;<<<<<<<<<>>>>>>>>>
307
	cmp	[number_menu],2
308
	jne	no_copy
255 heavyiron 309
 
1643 mario79 310
	cmp	[instrument_used],1
311
	jne	no_copy
312
	cmp	[Activate_instrument],0
313
	jne	no_copy
255 heavyiron 314
 
1643 mario79 315
	mov	eax,[OldX]
316
	mov	ebx,[OldY]
255 heavyiron 317
 
1643 mario79 318
	cmp	eax,[rectangular_shade_x]
319
	jl	no_remove_x_copy
255 heavyiron 320
 
1643 mario79 321
	mov	ecx,[rectangular_shade_x]
322
	mov	[OldX],ecx			 ; OldX <-----> rectangulare_shade_x
323
	mov	[rectangular_shade_x],eax
255 heavyiron 324
 
1643 mario79 325
no_remove_x_copy:
326
	cmp	ebx,[rectangular_shade_y]
327
	jl	no_remove_y_copy
255 heavyiron 328
 
1643 mario79 329
	mov	ecx,[rectangular_shade_y]
330
	mov	[OldY],ecx			 ; OldY <-----> rectangulare_shade_y
331
	mov	[rectangular_shade_y],ebx
255 heavyiron 332
 
1643 mario79 333
no_remove_y_copy:
334
	mov	eax,[OldX]
335
	mov	ebx,[OldY]
336
	mov	ecx,[rectangular_shade_x]
337
	mov	edx,[rectangular_shade_y]
338
	inc	eax
339
	inc	ebx
340
	dec	ecx
341
	dec	edx
255 heavyiron 342
 
1643 mario79 343
	mov	[x],eax
344
	mov	[y],ebx
345
	mov	esi,eax
346
	mov	edi,ebx
347
	mov	[Dx_],1
348
	mov	[Dy_],1
255 heavyiron 349
 
1643 mario79 350
	sub	ecx,eax
351
	jnz	no_signum_fill_r_x_copy
255 heavyiron 352
 
1643 mario79 353
	mov	[Dx_],-1
255 heavyiron 354
 
1643 mario79 355
no_signum_fill_r_x_copy:
356
	sub	edx,ebx
357
	jnz	no_signum_fill_r_y_copy
255 heavyiron 358
 
1643 mario79 359
	mov	[Dy_],-1
255 heavyiron 360
 
1643 mario79 361
no_signum_fill_r_y_copy:
362
	mov	ebx,[rectangular_shade_y]
363
	sub	ebx,edi
255 heavyiron 364
 
1643 mario79 365
	mov	edx,[PointerToEditBufer]
366
	mov	[y],edi
255 heavyiron 367
 
1643 mario79 368
loop_fill_rectangle_y_copy:
369
	mov	[x],esi
255 heavyiron 370
 
1643 mario79 371
loop_fill_rectangle_x_copy:
372
	push	esi edi
373
	mov	eax,[PointerToPicture]
374
	mov	ebx,[Picture_SizeX]
375
	mov	esi,[x]
376
	mov	edi,[y]
377
	call	GetColorOfPixel
378
	mov	[edx],ax
379
	shr	eax,16
380
	mov	[edx+2],al
381
	pop	edi esi
255 heavyiron 382
 
1643 mario79 383
	add	edx,3
384
	mov	eax,[x]
385
	add	eax,[Dx_]
386
	mov	[x],eax
255 heavyiron 387
 
1643 mario79 388
	cmp	eax,[rectangular_shade_x]
389
	jl	loop_fill_rectangle_x_copy
255 heavyiron 390
 
1643 mario79 391
	mov	eax,[y]
392
	add	eax,[Dy_]
393
	mov	[y],eax
255 heavyiron 394
 
1643 mario79 395
	cmp	eax,[rectangular_shade_y]
396
	jl	loop_fill_rectangle_y_copy
255 heavyiron 397
 
1643 mario79 398
	call	MovePictureToWorkScreen
255 heavyiron 399
 
1643 mario79 400
	and	[number_panel],0
401
	and	[number_menu],0
402
	mov	[DrawSprite_flag],1
403
	jmp	still
404
;---------------------------------------------------------------------
405
no_copy:
406
;<<<<<<<<<>>>>>>>
407
	cmp	[number_menu],3
408
	jne	no_paste
255 heavyiron 409
 
1643 mario79 410
	cmp	[instrument_used],1
411
	jne	no_paste
255 heavyiron 412
 
1643 mario79 413
	cmp	[Activate_instrument],0
414
	jne	no_paste
255 heavyiron 415
 
1643 mario79 416
	mov	eax,[OldX]
417
	mov	ebx,[OldY]
255 heavyiron 418
 
1643 mario79 419
	cmp	eax,[rectangular_shade_x]
420
	jl	no_remove_x_paste
255 heavyiron 421
 
1643 mario79 422
	mov	ecx,[rectangular_shade_x]
423
	mov	[OldX],ecx 		  ; OldX <-----> rectangulare_shade_x
424
	mov	[rectangular_shade_x],eax
255 heavyiron 425
 
1643 mario79 426
no_remove_x_paste:
427
	cmp	ebx,[rectangular_shade_y]
428
	jl	no_remove_y_paste
255 heavyiron 429
 
1643 mario79 430
	mov	ecx,[rectangular_shade_y]
431
	mov	[OldY],ecx 		  ; OldY <-----> rectangulare_shade_y
432
	mov	[rectangular_shade_y],ebx
255 heavyiron 433
 
1643 mario79 434
no_remove_y_paste:
435
	mov	eax,[OldX]
436
	mov	ebx,[OldY]
437
	mov	ecx,[rectangular_shade_x]
438
	mov	edx,[rectangular_shade_y]
439
	inc	eax
440
	inc	ebx
441
	dec	ecx
442
	dec	edx
255 heavyiron 443
 
1643 mario79 444
	mov	[x],eax
445
	mov	[y],ebx
446
	mov	esi,eax
447
	mov	edi,ebx
448
	mov	[Dx_],1
449
	mov	[Dy_],1
255 heavyiron 450
 
1643 mario79 451
	sub	ecx,eax
452
	jnz	no_signum_fill_r_x_paste
255 heavyiron 453
 
1643 mario79 454
	mov	[Dx_],-1
255 heavyiron 455
 
1643 mario79 456
no_signum_fill_r_x_paste:
457
	sub	edx,ebx
458
	jnz	no_signum_fill_r_y_paste
255 heavyiron 459
 
1643 mario79 460
	mov	[Dy_],-1
255 heavyiron 461
 
1643 mario79 462
no_signum_fill_r_y_paste:
463
	mov	edx,[PointerToEditBufer]
464
	mov	[y],edi
255 heavyiron 465
 
1643 mario79 466
loop_fill_rectangle_y_paste:
467
	mov	[x],esi
255 heavyiron 468
 
1643 mario79 469
loop_fill_rectangle_x_paste:
470
	push	esi edi
471
	mov	ecx,[edx]
472
	and	ecx,0xffffff ;color
473
	mov	eax,[PointerToPicture]
474
	mov	ebx,[Picture_SizeX]
475
	mov	esi,[x]
476
	mov	edi,[y]
477
	call	PutPixel
478
	pop	edi esi
255 heavyiron 479
 
1643 mario79 480
	add	edx,3
255 heavyiron 481
 
1643 mario79 482
	mov	eax,[x]
483
	add	eax,[Dx_]
484
	mov	[x],eax
485
	cmp	eax,[rectangular_shade_x]
486
	jl	loop_fill_rectangle_x_paste
255 heavyiron 487
 
1643 mario79 488
	mov	eax,[y]
489
	add	eax,[Dy_]
490
	mov	[y],eax
491
	cmp	eax,[rectangular_shade_y]
492
	jl	loop_fill_rectangle_y_paste
255 heavyiron 493
 
1643 mario79 494
	call	MovePictureToWorkScreen
495
	and	[number_panel],0
496
	and	[number_menu],0
497
	mov	[Paste_flag],1
498
	jmp	still
499
;---------------------------------------------------------------------
500
no_paste:
501
;<<<<<<<<<>>>>>>>>>
502
	cmp	[number_menu],4
503
	jne	no_cut
255 heavyiron 504
 
1643 mario79 505
	cmp	[instrument_used],1
506
	jne	no_cut
255 heavyiron 507
 
1643 mario79 508
	cmp	[Activate_instrument],0
509
	jne	no_cut
255 heavyiron 510
 
1643 mario79 511
	mov	eax,[OldX]
512
	mov	ebx,[OldY]
255 heavyiron 513
 
1643 mario79 514
	cmp	eax,[rectangular_shade_x]
515
	jl	no_remove_x_cut
255 heavyiron 516
 
1643 mario79 517
	mov	ecx,[rectangular_shade_x]
518
	mov	[OldX],ecx 		  ; OldX <-----> rectangulare_shade_x
519
	mov	[rectangular_shade_x],eax
255 heavyiron 520
 
1643 mario79 521
no_remove_x_cut:
522
	cmp	ebx,[rectangular_shade_y]
523
	jl	no_remove_y_cut
255 heavyiron 524
 
1643 mario79 525
	mov	ecx,[rectangular_shade_y]
526
	mov	[OldY],ecx 		  ; OldY <-----> rectangulare_shade_y
527
	mov	[rectangular_shade_y],ebx
255 heavyiron 528
 
1643 mario79 529
no_remove_y_cut:
530
	mov	eax,[OldX]
531
	mov	ebx,[OldY]
532
	mov	ecx,[rectangular_shade_x]
533
	mov	edx,[rectangular_shade_y]
534
	inc	eax
535
	inc	ebx
536
	dec	ecx
537
	dec	edx
255 heavyiron 538
 
1643 mario79 539
	mov	[x],eax
540
	mov	[y],ebx
541
	mov	esi,eax
542
	mov	edi,ebx
543
	mov	[Dx_],1
544
	mov	[Dy_],1
255 heavyiron 545
 
1643 mario79 546
	sub	ecx,eax
547
	jnz	no_signum_fill_r_x
255 heavyiron 548
 
1643 mario79 549
	mov	[Dx_],-1
255 heavyiron 550
 
1643 mario79 551
no_signum_fill_r_x:
552
	sub	edx,ebx
553
	jnz	no_signum_fill_r_y
255 heavyiron 554
 
1643 mario79 555
	mov	[Dy_],-1
255 heavyiron 556
 
1643 mario79 557
no_signum_fill_r_y:
558
	mov	[y],edi
255 heavyiron 559
 
1643 mario79 560
loop_fill_rectangle_y:
561
	mov	[x],esi
255 heavyiron 562
 
1643 mario79 563
loop_fill_rectangle_x:
564
	push	esi edi
565
	mov	eax,[PointerToPicture]
566
	mov	ebx,[Picture_SizeX]
567
	mov	ecx,dword 0xffffff
568
	mov	esi,[x]
569
	mov	edi,[y]
570
	call	PutPixel
571
	pop	edi esi
255 heavyiron 572
 
1643 mario79 573
	mov	eax,[x]
574
	add	eax,[Dx_]
575
	mov	[x],eax
255 heavyiron 576
 
1643 mario79 577
	cmp	eax,[rectangular_shade_x]
578
	jl	loop_fill_rectangle_x
255 heavyiron 579
 
1643 mario79 580
	mov	eax,[y]
581
	add	eax,[Dy_]
582
	mov	[y],eax
255 heavyiron 583
 
1643 mario79 584
	cmp	eax,[rectangular_shade_y]
585
	jl	loop_fill_rectangle_y
255 heavyiron 586
 
1643 mario79 587
	call	MovePictureToWorkScreen
255 heavyiron 588
 
1643 mario79 589
	and	[number_panel],0
590
	and	[number_menu],0
591
	jmp	still
592
;---------------------------------------------------------------------
593
no_cut:
594
;<<<<<>>>>>
595
	cmp	[number_menu],5
596
	jne	no_cleare_all
255 heavyiron 597
 
1643 mario79 598
	call	cleare_work_arrea
599
	call	MovePictureToWorkScreen
255 heavyiron 600
 
1643 mario79 601
	and	[number_panel],0
602
	and	[number_menu],0
603
	jmp	still
604
;---------------------------------------------------------------------
605
no_cleare_all:
606
;<<<<<>>>>>
607
	cmp	[number_menu],6
608
	jne	still	;no_to_allocate_all
255 heavyiron 609
 
1643 mario79 610
	mov	[OldX],1
611
	mov	[OldY],1
612
	mov	eax,[Picture_SizeX]
613
	mov	ebx,[Picture_SizeY]
614
	dec	eax
615
	dec	ebx
616
	mov	[rectangular_shade_x],eax
617
	mov	[rectangular_shade_y],ebx
618
	mov	[instrument_used],1
619
	mov	[Activate_instrument],1
620
	mov	[Current_instrument],30
621
	mov	[crossing],0
622
	and	[number_panel],0
623
	and	[number_menu],0
624
;	call	TakeButtonInstruments
625
;	call	MovePictureToWorkScreen
626
	jmp	still
627
;---------------------------------------------------------------------
628
;no_to_allocate_all:
629
;no_edit:
630
;	jmp	still
631
;---------------------------------------------------------------------