Subversion Repositories Kolibri OS

Rev

Rev 552 | Rev 1636 | 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:
5
 
6
	 ;|||||||||||||||||||FILE||||||||||||||||||||||
7
	 cmp [number_panel],7
8
	 jne no_file
9
 
10
	 ;<<<<>>>>>>
11
	 cmp [number_menu],1
12
	 jne no_new
13
 
14
	 mov eax,80
15
	 mov ebx,100
16
	 mov ecx,150
17
	 mov edx,90
18
	 mov  esi,1
19
	 call draw_volume_rectangle
20
 
21
	 mov eax,177
22
	 mov ebx,115
23
	 mov ecx,40
24
	 mov edx,14
25
	 mov  esi,4
26
	 call draw_volume_rectangle
27
 
28
	 mov eax,177
29
	 mov ebx,115+24
30
	 mov ecx,40
31
	 mov edx,14
32
	 mov  esi,4
33
	 call draw_volume_rectangle
34
 
35
	 mov eax,175
36
	 mov ebx,170
37
	 mov ecx,40
38
	 mov edx,15
39
	 mov  esi,1
40
	 call draw_volume_rectangle
41
 
42
	 mov eax,90
43
	 mov ebx,118
44
	 mov ecx,0xffffff
45
	 mov edx,new_text1
46
	 mov esi,14
47
	 call print_text
48
 
49
	 mov eax,90
50
	 mov ebx,118+24
51
	 mov ecx,0xffffff
52
	 mov edx,new_text2
53
	 mov esi,14
54
	 call print_text
55
 
56
	 mov eax,185
57
	 mov ebx,175
58
	 mov ecx,0xffffff
59
	 mov edx,ok_text
60
	 mov esi,2
61
	 call print_text
62
 
63
	 mov eax,8
64
	 mov ebx,177*65536+40
65
	 mov ecx,115*65536+14
66
	 mov edx,1000000000000000000000000000000b
67
	 add edx,1000
485 heavyiron 68
	 mcall
255 heavyiron 69
 
70
	 mov eax,8
71
	 mov ebx,177*65536+40
72
	 mov ecx,139*65536+14
73
	 mov edx,1000000000000000000000000000000b
74
	 add edx,1001
485 heavyiron 75
	 mcall
255 heavyiron 76
 
77
	 mov eax,8
78
	 mov ebx,175*65536+40
79
	 mov ecx,170*65536+15
80
	 mov edx,1000000000000000000000000000000b
81
	 add edx,1002
485 heavyiron 82
	 mcall
255 heavyiron 83
 
84
	 no_activate_space:
85
 
86
	 mov eax,10
485 heavyiron 87
	 mcall
255 heavyiron 88
 
89
	 cmp eax,1
90
	 je exit_new
91
 
92
	 cmp eax,3
93
	 jne no_activate_space
94
 
95
	 mov eax,17
485 heavyiron 96
	 mcall
255 heavyiron 97
	 shr eax,8
98
 
99
	 cmp eax,1000
100
	 jl no_activate_space
101
 
102
	 cmp eax,1000
103
	 jne no_picture_size_x
104
 
105
	 mov eax,180
106
	 mov ebx,119
107
	 mov ecx,5
108
	 call dialog_line
109
 
110
	 mov eax,string_
111
	 mov ebx,13
112
	 call find_symvol
113
 
114
	 dec eax
115
	 mov [length_number],eax
116
	 mov eax,string_
117
	 call value
118
 
119
	 mov [Picture_SizeX],eax
120
 
121
	 jmp no_activate_space
122
 
123
	 no_picture_size_x:
124
 
125
	 cmp eax,1001
126
	 jne no_picture_size_y
127
 
128
	 mov eax,180
129
	 mov ebx,119+24
130
	 mov ecx,5
131
	 call dialog_line
132
 
133
	 mov eax,string_
134
	 mov ebx,13
135
	 call find_symvol
136
 
137
	 dec eax
138
	 mov [length_number],eax
139
	 mov eax,string_
140
	 call value
141
 
142
	 mov [Picture_SizeY],eax
143
 
144
	 jmp no_activate_space
145
 
146
	 no_picture_size_y:
147
 
148
	 cmp eax,1002
149
	 jne no_activate_space
150
 
151
	 exit_new:
152
 
153
	 mov eax,8
154
	 mov ebx,175*65536+40
155
	 mov ecx,170*65536+15
156
	 mov edx,11100000000000000000000000000000b
157
	 add edx,1002
485 heavyiron 158
	 mcall
255 heavyiron 159
 
160
	 mov eax,8
161
	 mov ebx,177*65536+40
162
	 mov ecx,139*65536+14
163
	 mov edx,11100000000000000000000000000000b
164
	 add edx,1001
485 heavyiron 165
	 mcall
255 heavyiron 166
 
167
	 mov eax,8
168
	 mov ebx,177*65536+40
169
	 mov ecx,115*65536+14
170
	 mov edx,11100000000000000000000000000000b
171
	 add edx,1000
485 heavyiron 172
	 mcall
255 heavyiron 173
 
174
	 ;get memory for new picture
175
 
176
	 call GetMemory
177
 
178
	 and [save_flag],0
179
	 and [number_panel],0
180
	 and [number_menu],0
181
 
182
	 call cleare_work_arrea
183
	 call drawwin
184
 
185
	 jmp still
186
	 no_new:
187
 
188
	 ;<<<<>>>>>>
189
	cmp [number_menu],2
190
	 jne no_open
191
 
1632 mario79 192
;	 opendialog drawwin,open_1,open_2,file_path
193
;---------------------------------------------------------------------
194
	mov	[OpenDialog_data.type],0 ; open
195
 
196
	push    dword OpenDialog_data
197
	call    [OpenDialog_Start]
198
 
199
	cmp	[OpenDialog_data.status],1
200
	jne	still
201
;---------------------------------------------------------------------
202
 
255 heavyiron 203
	 open_1:
204
 
205
	 mov eax,40
206
	 mov ebx,100111b
485 heavyiron 207
	 mcall
255 heavyiron 208
 
209
	 mov eax,file_path
210
	 mov ebx,[ScreenPointer]
211
	 add ebx,0x10000
212
 
213
	 call load_heading_of_file
214
 
215
	 mov esi,[ScreenPointer]
216
	 add esi,0x10000
217
	 ;-------------is this BMP file ?----------------
218
	 xor eax,eax
219
	 mov ax,[esi]
220
	 mov [type],ax
221
 
222
	 cmp [type],word 'BM'
223
	 jne no_bmp_file
224
 
225
	 xor eax,eax
226
	 xor ebx,ebx
227
	 mov eax,[esi+18]
228
	 mov ebx,[esi+22]
229
	 mov [Picture_SizeX],eax
230
	 mov [Picture_SizeY],ebx
231
 
232
	 jmp exit_type
233
 
234
	 no_bmp_file:
235
 
236
	 ;-------------is this GIF file ?----------------
237
	 xor eax,eax
238
	 mov ax,[esi]
239
	 mov [type],ax
240
 
241
	 cmp [type],'GI'
242
	 jne no_gif_file
243
 
244
	 add esi,6
245
	 xor eax,eax
246
	 xor ebx,ebx
247
	 mov ax,word[esi]
248
	 mov bx,word[esi+2]
249
	 mov [Picture_SizeX],eax
250
	 mov [Picture_SizeY],ebx
251
 
252
	 jmp exit_type
253
 
254
	 no_gif_file:
255
 
256
	 jmp no_unpakcing_file
257
 
258
	 exit_type:
259
 
260
	 ;----------------------------------------------------------
261
	 ;Get momory for unpacking picture and for picture's bufers
262
	 ;----------------------------------------------------------
263
	 call GetMemory
264
	 ;----------------------------------------------------------
265
	 ;--------------------Load file in memory-------------------
266
	 ;----------------------------------------------------------
267
 
268
	 mov eax,file_path
269
	 mov ebx,[PointerToCopyPicture]
270
	 add ebx,1000
271
 
272
	 call load_file
273
 
274
	 ;----------------------------------------------------------
275
	 ;-------------------Unpacking picture----------------------
276
	 ;----------------------------------------------------------
277
	 mov esi,[PointerToCopyPicture]
278
	 add esi,1000
279
	 mov edi,[PointerToPicture]
280
	 mov eax,[ScreenPointer]
281
 
282
	 cmp [type],'BM'
283
	 jne no_unpakcing_bmp_file
284
	    ;BMP DECODER
285
	    call bmptoimg
286
	    mov [save_flag],1
287
	 no_unpakcing_bmp_file:
288
 
289
 
290
	 cmp [type],'GI'
291
	 jne no_unpakcing_file
292
	   ;GIF DECODER
552 diamond 293
	   sub edi,8
255 heavyiron 294
	   call ReadGIF
295
	   mov [save_flag],1
296
	 no_unpakcing_file:
297
 
298
	 call load_icons
299
	 call drawwin
300
 
301
	 open_2:
302
 
303
	 mov [Scroll1CoordinatX],9
304
	 mov [Scroll2CoordinatY],89
305
	 and [number_panel],0
306
	 and [number_menu],0
307
 
308
	 jmp still
309
 
310
	 no_open:
311
 
312
	 ;<<<<<<<<<<>>>>>>>>>>>
313
	 cmp [number_menu],3
314
	 jne no_save_
315
 
316
	 mov al,[save_flag]
317
 
318
	 test al,al
319
	 jz no_save_file
320
 
321
	 jmp save_enter
322
 
323
	 no_save_file:
324
 
325
	 and [number_panel],0
326
	 and [number_menu],0
327
 
328
	 jmp still
329
 
330
	 no_save_:
331
 
332
	 ;<<<<<<<<>>>>>>>>>>
333
	 cmp [number_menu],4
334
	 jne no_save
335
 
1632 mario79 336
;	 savedialog drawwin,save1,save2,file_path
337
;---------------------------------------------------------------------
338
	mov	[OpenDialog_data.type],1 ; save
339
 
340
	push    dword OpenDialog_data
341
	call    [OpenDialog_Start]
342
 
343
	cmp	[OpenDialog_data.status],1
344
	jne	still
345
;---------------------------------------------------------------------
255 heavyiron 346
 
347
	 save1:
348
 
349
	 save_enter:
350
	 mov eax,40
351
	 mov ebx,100111b
485 heavyiron 352
	 mcall
255 heavyiron 353
 
354
	 call analizing_picture_to_palette
355
	 ;eax => number of colors in picture
356
	 mov ebx,[PointerToPicture]
357
	 mov ecx,[PointerToEditBufer]
358
	 mov edx,[PointerToPalette]
359
	 mov esi,[Picture_SizeX]
360
	 mov edi,[Picture_SizeY]
361
 
362
	 call coding_bmp
363
 
364
	 mov eax,file_path
365
	 mov ecx,ebx
366
	 mov ebx,[PointerToEditBufer]
367
	 push eax
368
	 push ebx
369
	 push ecx
370
 
371
	 call save_file
372
 
373
	 mov [save_flag],1
374
	 and [number_panel],0
375
	 and [number_menu],0
376
	 call drawwin
377
 
378
	 jmp still
379
 
380
	 save2:
381
 
382
	 and [number_panel],0
383
	 and [number_menu],0
384
 
385
	 jmp still
386
	 no_save:
387
 
388
	 ;<<<<<>>>>>>
389
	 cmp [number_menu],5
390
	 jne no_exit_program
391
 
392
	 mov eax,-1
485 heavyiron 393
	 mcall
255 heavyiron 394
 
395
	 no_exit_program:
396
 
397
	 no_file:
398
 
399
	 ;|||||||||||||||||||||||||||||EDIT|||||||||||||||||||||||||
400
 
401
	 ;<<<<<<<<<>>>>>>>>>
402
	 cmp [number_panel],6
403
	 jne no_edit
404
 
405
	 cmp [number_menu],1
406
	 jne no_undo
407
 
408
	 cmp [number_undo],1
409
	 jne no_one____
410
 
411
	 mov esi,[PointerToCopyPicture]
412
 
413
	 no_one____:
414
 
415
	 cmp [number_undo],2
416
	 jne no_two____
417
 
418
	 mov esi,[PointerToCopyPicture2]
419
 
420
	 no_two____:
421
 
422
	 mov edi,[PointerToPicture]
423
	 mov ecx,[Picture_SizeX]
424
	 imul ecx,[Picture_SizeY]
425
	 lea ecx,[ecx+ecx*2]
426
	 add ecx,4
427
	 shr ecx,2
428
	 cld
429
	 rep movsd
430
	 call MovePictureToWorkScreen
431
 
432
	 dec [number_undo]
433
	 jnz no_null_undo
434
 
435
	 mov [number_undo],1
436
 
437
	 no_null_undo:
438
 
439
	 and [number_panel],0
440
	 and [number_menu],0
441
	 jmp still
442
	 no_undo:
443
 
444
	 ;<<<<<<<<<>>>>>>>>>
445
 
446
	 cmp [number_menu],2
447
	 jne no_copy
448
 
449
	 cmp [instrument_used],1
450
	 jne no_copy
451
	 cmp [Activate_instrument],0
452
	 jne no_copy
453
 
454
	mov eax,[OldX]
455
	mov ebx,[OldY]
456
 
457
	cmp eax,[rectangular_shade_x]
458
	jl no_remove_x_copy
459
 
460
	mov ecx,[rectangular_shade_x]
461
	mov [OldX],ecx			  ; OldX <-----> rectangulare_shade_x
462
	mov [rectangular_shade_x],eax
463
 
464
	no_remove_x_copy:
465
 
466
	cmp ebx,[rectangular_shade_y]
467
	jl no_remove_y_copy
468
 
469
	mov ecx,[rectangular_shade_y]
470
	mov [OldY],ecx			  ; OldY <-----> rectangulare_shade_y
471
	mov [rectangular_shade_y],ebx
472
 
473
	no_remove_y_copy:
474
 
475
	 mov eax,[OldX]
476
	 mov ebx,[OldY]
477
	 mov ecx,[rectangular_shade_x]
478
	 mov edx,[rectangular_shade_y]
479
	 inc eax
480
	 inc ebx
481
	 dec ecx
482
	 dec edx
483
 
484
	 mov [x],eax
485
	 mov [y],ebx
486
	 mov esi,eax
487
	 mov edi,ebx
488
	 mov [Dx_],1
489
	 mov [Dy_],1
490
 
491
	 sub ecx,eax
492
	 jnz no_signum_fill_r_x_copy
493
 
494
	 mov [Dx_],-1
495
 
496
	 no_signum_fill_r_x_copy:
497
 
498
	 sub edx,ebx
499
	 jnz no_signum_fill_r_y_copy
500
 
501
	 mov [Dy_],-1
502
 
503
	 no_signum_fill_r_y_copy:
504
 
505
	 mov ebx,[rectangular_shade_y]
506
	 sub ebx,edi
507
 
508
	 mov edx,[PointerToEditBufer]
509
	 mov [y],edi
510
	 loop_fill_rectangle_y_copy:
511
 
512
	 mov [x],esi
513
	 loop_fill_rectangle_x_copy:
514
 
515
	 push esi
516
	 push edi
517
 
518
	 mov eax,[PointerToPicture]
519
	 mov ebx,[Picture_SizeX]
520
	 mov esi,[x]
521
	 mov edi,[y]
522
	 call GetColorOfPixel
523
 
524
	 mov [edx],ax
525
	 shr eax,16
526
	 mov [edx+2],al
527
 
528
	 pop edi
529
	 pop esi
530
 
531
	 add edx,3
532
 
533
	 mov eax,[x]
534
	 add eax,[Dx_]
535
	 mov [x],eax
536
 
537
	 cmp eax,[rectangular_shade_x]
538
	 jl loop_fill_rectangle_x_copy
539
 
540
	 mov eax,[y]
541
	 add eax,[Dy_]
542
	 mov [y],eax
543
 
544
	 cmp eax,[rectangular_shade_y]
545
	 jl loop_fill_rectangle_y_copy
546
 
547
	 call MovePictureToWorkScreen
548
 
549
	 and [number_panel],0
550
	 and [number_menu],0
551
	 mov [DrawSprite_flag],1
552
 
553
	 jmp still
554
 
555
	 no_copy:
556
 
557
	 ;<<<<<<<<<>>>>>>>
558
	 cmp [number_menu],3
559
	 jne no_paste
560
 
561
	 cmp [instrument_used],1
562
	 jne no_paste
563
 
564
	 cmp [Activate_instrument],0
565
	 jne no_paste
566
 
567
	 mov eax,[OldX]
568
	 mov ebx,[OldY]
569
 
570
	 cmp eax,[rectangular_shade_x]
571
	 jl no_remove_x_paste
572
 
573
	 mov ecx,[rectangular_shade_x]
574
	 mov [OldX],ecx 		   ; OldX <-----> rectangulare_shade_x
575
	 mov [rectangular_shade_x],eax
576
 
577
	 no_remove_x_paste:
578
 
579
	 cmp ebx,[rectangular_shade_y]
580
	 jl no_remove_y_paste
581
 
582
	 mov ecx,[rectangular_shade_y]
583
	 mov [OldY],ecx 		   ; OldY <-----> rectangulare_shade_y
584
	 mov [rectangular_shade_y],ebx
585
 
586
	 no_remove_y_paste:
587
 
588
	 mov eax,[OldX]
589
	 mov ebx,[OldY]
590
	 mov ecx,[rectangular_shade_x]
591
	 mov edx,[rectangular_shade_y]
592
	 inc eax
593
	 inc ebx
594
	 dec ecx
595
	 dec edx
596
 
597
	 mov [x],eax
598
	 mov [y],ebx
599
	 mov esi,eax
600
	 mov edi,ebx
601
	 mov [Dx_],1
602
	 mov [Dy_],1
603
 
604
	 sub ecx,eax
605
	 jnz no_signum_fill_r_x_paste
606
 
607
	 mov [Dx_],-1
608
 
609
	 no_signum_fill_r_x_paste:
610
 
611
	 sub edx,ebx
612
	 jnz no_signum_fill_r_y_paste
613
 
614
	 mov [Dy_],-1
615
 
616
	 no_signum_fill_r_y_paste:
617
 
618
	 mov edx,[PointerToEditBufer]
619
	 mov [y],edi
620
 
621
	 loop_fill_rectangle_y_paste:
622
 
623
	 mov [x],esi
624
	 loop_fill_rectangle_x_paste:
625
 
626
	 push esi
627
	 push edi
628
 
629
	 mov ecx,[edx]
630
	 and ecx,0xffffff ;color
631
 
632
	 mov eax,[PointerToPicture]
633
	 mov ebx,[Picture_SizeX]
634
	 mov esi,[x]
635
	 mov edi,[y]
636
	 call PutPixel
637
 
638
	 pop edi
639
	 pop esi
640
 
641
	 add edx,3
642
 
643
	 mov eax,[x]
644
	 add eax,[Dx_]
645
	 mov [x],eax
646
	 cmp eax,[rectangular_shade_x]
647
	 jl loop_fill_rectangle_x_paste
648
 
649
	 mov eax,[y]
650
	 add eax,[Dy_]
651
	 mov [y],eax
652
	 cmp eax,[rectangular_shade_y]
653
 
654
	 jl loop_fill_rectangle_y_paste
655
 
656
	 call MovePictureToWorkScreen
657
	 and [number_panel],0
658
	 and [number_menu],0
659
	 mov [Paste_flag],1
660
 
661
	 jmp still
662
 
663
	 no_paste:
664
 
665
	 ;<<<<<<<<<>>>>>>>>>
666
	 cmp [number_menu],4
667
	 jne no_cut
668
 
669
	 cmp [instrument_used],1
670
	 jne no_cut
671
 
672
	 cmp [Activate_instrument],0
673
	 jne no_cut
674
 
675
	 mov eax,[OldX]
676
	 mov ebx,[OldY]
677
 
678
	 cmp eax,[rectangular_shade_x]
679
	 jl no_remove_x_cut
680
 
681
	 mov ecx,[rectangular_shade_x]
682
	 mov [OldX],ecx 		   ; OldX <-----> rectangulare_shade_x
683
	 mov [rectangular_shade_x],eax
684
 
685
	 no_remove_x_cut:
686
 
687
	 cmp ebx,[rectangular_shade_y]
688
	 jl no_remove_y_cut
689
 
690
	 mov ecx,[rectangular_shade_y]
691
	 mov [OldY],ecx 		   ; OldY <-----> rectangulare_shade_y
692
	 mov [rectangular_shade_y],ebx
693
 
694
	 no_remove_y_cut:
695
 
696
	 mov eax,[OldX]
697
	 mov ebx,[OldY]
698
	 mov ecx,[rectangular_shade_x]
699
	 mov edx,[rectangular_shade_y]
700
	 inc eax
701
	 inc ebx
702
	 dec ecx
703
	 dec edx
704
 
705
	 mov [x],eax
706
	 mov [y],ebx
707
	 mov esi,eax
708
	 mov edi,ebx
709
	 mov [Dx_],1
710
	 mov [Dy_],1
711
 
712
	 sub ecx,eax
713
	 jnz no_signum_fill_r_x
714
 
715
	 mov [Dx_],-1
716
 
717
	 no_signum_fill_r_x:
718
 
719
	 sub edx,ebx
720
	 jnz no_signum_fill_r_y
721
 
722
	 mov [Dy_],-1
723
 
724
	 no_signum_fill_r_y:
725
 
726
	 mov [y],edi
727
	 loop_fill_rectangle_y:
728
 
729
	 mov [x],esi
730
	 loop_fill_rectangle_x:
731
 
732
	 push esi
733
	 push edi
734
 
735
	 mov eax,[PointerToPicture]
736
	 mov ebx,[Picture_SizeX]
737
	 mov ecx,dword 0xffffff
738
	 mov esi,[x]
739
	 mov edi,[y]
740
	 call PutPixel
741
 
742
	 pop edi
743
	 pop esi
744
 
745
	 mov eax,[x]
746
	 add eax,[Dx_]
747
	 mov [x],eax
748
 
749
	 cmp eax,[rectangular_shade_x]
750
	 jl loop_fill_rectangle_x
751
 
752
	 mov eax,[y]
753
	 add eax,[Dy_]
754
	 mov [y],eax
755
 
756
	 cmp eax,[rectangular_shade_y]
757
	 jl loop_fill_rectangle_y
758
 
759
	 call MovePictureToWorkScreen
760
 
761
	 and [number_panel],0
762
	 and [number_menu],0
763
 
764
	 jmp still
765
	 no_cut:
766
 
767
	 ;<<<<<>>>>>
768
	 cmp [number_menu],5
769
	 jne no_cleare_all
770
 
771
	 call cleare_work_arrea
772
 
773
	 call MovePictureToWorkScreen
774
 
775
	 and [number_panel],0
776
	 and [number_menu],0
777
 
778
	 jmp still
779
	 no_cleare_all:
780
	 ;<<<<<>>>>>
781
 
782
	 cmp [number_menu],6
783
	 jne no_to_allocate_all
784
 
785
	 mov [OldX],1
786
	 mov [OldY],1
787
	 mov eax,[Picture_SizeX]
788
	 mov ebx,[Picture_SizeY]
789
	 dec eax
790
	 dec ebx
791
	 mov [rectangular_shade_x],eax
792
	 mov [rectangular_shade_y],ebx
793
	 mov [instrument_used],1
794
	 mov [Activate_instrument],1
795
	 mov [Current_instrument],30
796
	 mov [crossing],0
797
	 and [number_panel],0
798
	 and [number_menu],0
799
	 ;call TakeButtonInstruments
800
	 ;call MovePictureToWorkScreen
801
	 jmp still
802
 
803
	 no_to_allocate_all:
804
 
805
	 no_edit:
806
 
807
 
808
	 jmp still
809
 
810
	 ret