Subversion Repositories Kolibri OS

Rev

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

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