Subversion Repositories Kolibri OS

Rev

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