forked from KolibriOS/kolibrios
fix keys in dialog file -> new,
optimize code, add memory constants git-svn-id: svn://kolibrios.org@6342 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
2e10d14758
commit
c06136cd31
@ -43,14 +43,13 @@ include '../../../libio.inc'
|
||||
|
||||
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
|
||||
|
||||
COLOR_ORDER equ MENUETOS
|
||||
include 'bmplib.inc'
|
||||
include 'dialog2.inc'
|
||||
include 'design.inc'
|
||||
include 'graphlib.inc'
|
||||
|
||||
include 'cursors.inc'
|
||||
|
||||
include 'memory.inc'
|
||||
include 'load_from_parameters.inc'
|
||||
|
||||
START:
|
||||
@ -159,7 +158,6 @@ include 'string.inc'
|
||||
include 'palette.inc'
|
||||
include 'files.inc'
|
||||
include 'time.inc'
|
||||
include 'memory.inc'
|
||||
;-----------------------------------------------------------
|
||||
;------------variables and data of program------------------
|
||||
;-----------------------------------------------------------
|
||||
|
@ -15,28 +15,28 @@ dialog_line:
|
||||
call print_cursor
|
||||
|
||||
opros:
|
||||
mov eax,10
|
||||
mcall
|
||||
mcall SF_WAIT_EVENT
|
||||
|
||||
cmp eax,1
|
||||
cmp eax,1 ;redraw window
|
||||
je exit_cycle
|
||||
cmp eax,3 ;press button
|
||||
je exit_cycle
|
||||
|
||||
cmp eax,2
|
||||
cmp eax,2 ;press key
|
||||
jne opros
|
||||
|
||||
mov eax,2
|
||||
mcall
|
||||
mcall SF_GET_KEY
|
||||
shr eax,8
|
||||
|
||||
cmp eax,13
|
||||
cmp al,13
|
||||
je exit_cycle
|
||||
cmp eax,8
|
||||
cmp al,8
|
||||
je backspace
|
||||
cmp eax,176
|
||||
cmp al,176
|
||||
je left
|
||||
cmp eax,179
|
||||
cmp al,179
|
||||
je right
|
||||
cmp eax,32
|
||||
cmp al,32
|
||||
je probel
|
||||
|
||||
inc [position]
|
||||
@ -99,41 +99,36 @@ dialog_line:
|
||||
ret
|
||||
;---------------------------------------------------------------
|
||||
print_line:
|
||||
mov eax,13
|
||||
mov ebx,[string_x]
|
||||
mov ecx,[string_y]
|
||||
mov edx,[MaxSizeString]
|
||||
shl ebx,16
|
||||
shl ecx,16
|
||||
imul edx,6
|
||||
add ebx,edx
|
||||
add ebx,2
|
||||
add ecx,10
|
||||
mov edx,0xffffff
|
||||
mcall
|
||||
mov eax,4
|
||||
mov ebx,[string_x]
|
||||
shl ebx,16
|
||||
add ebx,[string_y]
|
||||
mov ecx,0
|
||||
mov edx,string_
|
||||
mov esi,[MaxSizeString]
|
||||
mcall
|
||||
ret
|
||||
mov ebx,[string_x]
|
||||
mov ecx,[string_y]
|
||||
mov edx,[MaxSizeString]
|
||||
shl ebx,16
|
||||
shl ecx,16
|
||||
imul edx,6
|
||||
add ebx,edx
|
||||
add ebx,2
|
||||
add ecx,10
|
||||
mov edx,0xffffff
|
||||
mcall SF_DRAW_RECT
|
||||
mov ebx,[string_x]
|
||||
shl ebx,16
|
||||
add ebx,[string_y]
|
||||
mov edx,string_
|
||||
mov esi,[MaxSizeString]
|
||||
mcall SF_DRAW_TEXT,,0
|
||||
ret
|
||||
|
||||
print_cursor:
|
||||
mov eax,13
|
||||
mov ebx,[position]
|
||||
mov ecx,[string_y]
|
||||
imul ebx,6
|
||||
add ebx,[string_x]
|
||||
shl ebx,16
|
||||
shl ecx,16
|
||||
add ebx,2
|
||||
add ecx,8
|
||||
mov edx,0xff6c58
|
||||
mcall
|
||||
ret
|
||||
mov ebx,[position]
|
||||
mov ecx,[string_y]
|
||||
imul ebx,6
|
||||
add ebx,[string_x]
|
||||
shl ebx,16
|
||||
shl ecx,16
|
||||
add ebx,2
|
||||
add ecx,8
|
||||
mcall SF_DRAW_RECT,,,0xff6c58
|
||||
ret
|
||||
;----------------------------------------------------------
|
||||
MinMaxCorrect:
|
||||
mov ebx,[MaxSizeString]
|
||||
|
@ -5,7 +5,7 @@ load_icons:
|
||||
stdcall [img_decode], panel_picture, panel_picture.end-panel_picture, 0
|
||||
mov ebx,eax
|
||||
mov edi,[ScreenPointer]
|
||||
add edi,(1200*1000*3)+8
|
||||
add edi,mem_screen
|
||||
stdcall [img_to_rgb2], ebx,edi ;преобразуем изображение к формату rgb
|
||||
stdcall [img_destroy], ebx ;удаляем временный буфер с параметрами изображения
|
||||
ret
|
||||
@ -20,10 +20,9 @@ draw_icons:
|
||||
shl edx,16
|
||||
add edx,[Icon_Y]
|
||||
mov ebx,[ScreenPointer]
|
||||
add ebx,(1200*1000*3)+8
|
||||
mov eax,7
|
||||
add ebx,mem_screen
|
||||
mov ecx,417*65536+46
|
||||
mcall
|
||||
mcall SF_PUT_IMAGE
|
||||
|
||||
|
||||
;main buttons of instrumnts
|
||||
|
@ -169,11 +169,7 @@ TakeButtonInstruments:
|
||||
and ebx,0xffffff
|
||||
mov [Color],ebx
|
||||
|
||||
mov eax,13
|
||||
mov ebx,136*65536+20
|
||||
mov ecx,65*65536+21
|
||||
mov edx,[Color]
|
||||
mcall
|
||||
mcall SF_DRAW_RECT, 136*65536+20, 65*65536+21, [Color]
|
||||
|
||||
jmp still
|
||||
no_pipetka:
|
||||
@ -341,7 +337,7 @@ TakeButtonInstruments:
|
||||
lea ecx,[ecx+ecx*2]
|
||||
shl ecx,1
|
||||
|
||||
cmp ecx,500000
|
||||
cmp ecx,mem_flood_f
|
||||
ja normal_size_of_bufer
|
||||
|
||||
mov ebx,[ReserveArray]
|
||||
@ -480,7 +476,6 @@ TakeButtonInstruments:
|
||||
mov edi,256
|
||||
xor esi,esi
|
||||
next_rectangle:
|
||||
mov eax,13
|
||||
mov ebx,[x]
|
||||
mov ecx,[y]
|
||||
mov edx,[palitra+esi]
|
||||
@ -489,7 +484,7 @@ TakeButtonInstruments:
|
||||
shl ecx,16
|
||||
add ebx,13
|
||||
add ecx,13
|
||||
mcall
|
||||
mcall SF_DRAW_RECT
|
||||
add [x],15
|
||||
cmp [x],20+15*32
|
||||
jl no_new_line
|
||||
@ -509,15 +504,13 @@ TakeButtonInstruments:
|
||||
cmp eax,2
|
||||
jne no_keys
|
||||
|
||||
mov eax,2
|
||||
mcall
|
||||
mcall SF_GET_KEY
|
||||
|
||||
no_keys:
|
||||
|
||||
cmp eax,3
|
||||
jne no_buttons
|
||||
mov eax,17
|
||||
mcall
|
||||
mcall SF_GET_BUTTON
|
||||
|
||||
no_buttons:
|
||||
|
||||
@ -564,9 +557,7 @@ TakeButtonInstruments:
|
||||
cmp [counter],257
|
||||
jne next_rectangle_column
|
||||
|
||||
mov eax,5
|
||||
mov ebx,10
|
||||
mcall
|
||||
mcall SF_SLEEP,10
|
||||
|
||||
call drawwin
|
||||
|
||||
@ -592,13 +583,10 @@ TakeButtonInstruments:
|
||||
mov [OldX],eax
|
||||
mov [OldY],ebx
|
||||
mov [Activate_instrument],1
|
||||
mov eax,[ReserveArray]
|
||||
mov ecx,60000
|
||||
clear_array_line:
|
||||
mov [eax],dword 0
|
||||
add eax,4
|
||||
dec ecx
|
||||
jnz clear_array_line
|
||||
xor eax,eax
|
||||
mov ecx,mem_flood_f/4
|
||||
mov edi,[ReserveArray]
|
||||
rep stosd
|
||||
jmp still
|
||||
no_new_line_xy:
|
||||
|
||||
@ -791,13 +779,10 @@ TakeButtonInstruments:
|
||||
mov [OldX],eax
|
||||
mov [OldY],ebx
|
||||
mov [Activate_instrument],1
|
||||
mov eax,[ReserveArray]
|
||||
mov ecx,60000
|
||||
clear_array_rectangle:
|
||||
mov [eax],dword 0
|
||||
add eax,4
|
||||
dec ecx
|
||||
jnz clear_array_rectangle
|
||||
xor eax,eax
|
||||
mov ecx,mem_flood_f/4
|
||||
mov edi,[ReserveArray]
|
||||
rep stosd
|
||||
jmp still
|
||||
no_new_rectangle_xy:
|
||||
|
||||
@ -988,13 +973,10 @@ TakeButtonInstruments:
|
||||
mov [OldX],eax
|
||||
mov [OldY],ebx
|
||||
mov [Activate_instrument],1
|
||||
mov eax,[ReserveArray]
|
||||
mov ecx,60000
|
||||
clear_array_circle:
|
||||
mov [eax],dword 0
|
||||
add eax,4
|
||||
dec ecx
|
||||
jnz clear_array_circle
|
||||
xor eax,eax
|
||||
mov ecx,mem_flood_f/4
|
||||
mov edi,[ReserveArray]
|
||||
rep stosd
|
||||
jmp still
|
||||
no_new_circle_xy:
|
||||
|
||||
@ -1348,13 +1330,10 @@ TakeButtonInstruments:
|
||||
mov [instrument_used],1
|
||||
and [crossing],0
|
||||
and [finishing_crossing],0
|
||||
mov eax,[ReserveArray]
|
||||
mov ecx,60000
|
||||
clear_array_allocation:
|
||||
mov [eax],dword 0
|
||||
add eax,4
|
||||
dec ecx
|
||||
jnz clear_array_allocation
|
||||
xor eax,eax
|
||||
mov ecx,mem_flood_f/4
|
||||
mov edi,[ReserveArray]
|
||||
rep stosd
|
||||
jmp still
|
||||
no_new_allocation_xy:
|
||||
instrument_not_finished_work:
|
||||
@ -1931,13 +1910,10 @@ TakeButtonInstruments:
|
||||
instrument_used_true:
|
||||
|
||||
mov [Activate_instrument],1
|
||||
mov eax,[ReserveArray]
|
||||
mov ecx,60000
|
||||
clear_array_konture:
|
||||
mov [eax],dword 0
|
||||
add eax,4
|
||||
dec ecx
|
||||
jnz clear_array_line
|
||||
xor eax,eax
|
||||
mov ecx,mem_flood_f/4
|
||||
mov edi,[ReserveArray]
|
||||
rep stosd
|
||||
|
||||
no_new_konture_xy:
|
||||
|
||||
@ -2137,13 +2113,10 @@ TakeButtonInstruments:
|
||||
mov [OldX],eax
|
||||
mov [OldY],ebx
|
||||
mov [Activate_instrument],1
|
||||
mov eax,[ReserveArray]
|
||||
mov ecx,60000
|
||||
clear_array_ellips:
|
||||
mov [eax],dword 0
|
||||
add eax,4
|
||||
dec ecx
|
||||
jnz clear_array_ellips
|
||||
xor eax,eax
|
||||
mov ecx,mem_flood_f/4
|
||||
mov edi,[ReserveArray]
|
||||
rep stosd
|
||||
jmp still
|
||||
no_new_ellips_xy:
|
||||
|
||||
|
@ -13,20 +13,11 @@
|
||||
mov [MaxWorkScreen_SizeY],100
|
||||
and [PosX],0
|
||||
and [PosY],0
|
||||
mov [Picture_SizeX],640;400
|
||||
mov [Picture_SizeY],400;280
|
||||
mov [Picture_SizeX],640
|
||||
mov [Picture_SizeY],400
|
||||
mov [k],1
|
||||
|
||||
; mov [ScreenPointer],I_END ; S = 0, L = 3600000 + 60000 + 500000 = 4160000 = 3,97 Mb
|
||||
; mov [PointerToPicture], I_END+(1200*1000*3)+50*(20*20*3)+500000 ; S = 4160000, L = 768000 = 750 Kb
|
||||
; mov [PointerToCopyPicture], I_END+(1200*1000*3)+50*(20*20*3)+500000+(640*400*3) ; S = 4928000, L = 768000 = 750 Kb
|
||||
; mov [PointerToCopyPicture2],I_END+(1200*1000*3)+50*(20*20*3)+500000+(640*400*3)*2 ; S = 5696000, L = 768000 = 750 Kb
|
||||
; mov [PointerToEditBufer], I_END+(1200*1000*3)+50*(20*20*3)+500000+(640*400*3)*3 ; S = 6464000, L = 768000 = 750 Kb
|
||||
; mov [PointerToSpriteBufer], I_END+(1200*1000*3)+50*(20*20*3)+500000+(640*400*3)*4 ; S = 7232000, L = 768000 = 750 Kb
|
||||
; mov [PointerToPalette], I_END+(1200*100*3)+50*(20*20*3)+1 ; S = 420001
|
||||
; mov [ReserveArray], I_END+(1200*1000)*3+50*(20*20*3)+8 ; S = 3660008
|
||||
|
||||
mcall 68,12,4096
|
||||
mcall SF_SYS_MISC,SSF_MEM_ALLOC,4096
|
||||
mov [ScreenPointer],eax
|
||||
|
||||
and [save_flag],0
|
||||
|
@ -15,11 +15,11 @@ load_picture:
|
||||
jnz .end_open
|
||||
|
||||
mov ecx,dword[open_b+32] ;+32 qword: размер файла в байтах
|
||||
add ecx,(1200*1000)*3+50*(20*20*3)+500000+16000+0x4000
|
||||
add ecx,mem_screen+mem_panel_b+mem_flood_f
|
||||
mcall SF_SYS_MISC,SSF_MEM_REALLOC,,[ScreenPointer]
|
||||
mov [ScreenPointer],eax
|
||||
add eax,0x10000
|
||||
sub ecx,(1200*1000)*3+50*(20*20*3)+500000+16000+0x4000
|
||||
add eax,mem_screen+mem_panel_b
|
||||
sub ecx,mem_screen+mem_panel_b+mem_flood_f
|
||||
mov [file_information.Function], SSF_READ_FILE
|
||||
mov [file_information.Position], 0
|
||||
mov [file_information.Flags], 0
|
||||
@ -32,7 +32,7 @@ load_picture:
|
||||
je .end_open
|
||||
;определяем вид изображения и пишем его параметры
|
||||
mov eax,[ScreenPointer]
|
||||
add eax,0x10000
|
||||
add eax,mem_screen+mem_panel_b
|
||||
stdcall [img_decode], eax,ebx,0
|
||||
push eax
|
||||
;определяем размер декодированного изображения
|
||||
@ -42,7 +42,7 @@ load_picture:
|
||||
mov dword[Picture_SizeY],eax
|
||||
imul ecx,eax
|
||||
imul ecx,15
|
||||
add ecx,(1200*1000)*3+50*(20*20*3)+500000+16000+0x4000
|
||||
add ecx,mem_screen+mem_panel_b+mem_flood_f
|
||||
mcall SF_SYS_MISC,SSF_MEM_REALLOC,,[ScreenPointer]
|
||||
mov [ScreenPointer],eax
|
||||
call prepare_data_pointers
|
||||
|
@ -1,3 +1,8 @@
|
||||
|
||||
mem_screen equ 1200*1000*3 ;ŕ §ŹĽŕ Ż Źď⨠¤Ťď ŽĄŤ á⨠íŞŕ
|
||||
mem_panel_b equ 50*(20*20*3) ;ŕ §ŹĽŕ Ż Źď⨠¤Ťď Ż ĽŤ¨ ¨áâŕ㏼⎢
|
||||
mem_flood_f equ 500000 ;ŕ §ŹĽŕ ĄăäĽŕ ¤Ťď § Ť¨˘Ş¨, â ŞŚĽ ¤Ťď Ż Ť¨âŕë
|
||||
|
||||
;----------------------------------------------------------
|
||||
;--------change size of memory which use program-----------
|
||||
;----------------------------------------------------------
|
||||
@ -7,10 +12,10 @@ GetMemory:
|
||||
mov edx,[Picture_SizeY]
|
||||
imul ecx,edx
|
||||
lea ecx,[ecx+ecx*2]
|
||||
lea ecx,[ecx+ecx*4] ;(Picture_SizeX*Picture_SizeY*3)*5
|
||||
add ecx,(1200*1000)*3+50*(20*20*3)+500000+16000+0x4000 ; 4192384
|
||||
mcall 68,20,,[ScreenPointer]
|
||||
test eax,eax
|
||||
lea ecx,[ecx+ecx*4] ;(Picture_SizeX*Picture_SizeY*3)*5
|
||||
add ecx,mem_screen+mem_panel_b+mem_flood_f
|
||||
mcall SF_SYS_MISC,SSF_MEM_REALLOC,,[ScreenPointer]
|
||||
test eax,eax
|
||||
jnz have_new_memory
|
||||
mov esi,sound_havent_memory
|
||||
call sound
|
||||
@ -30,7 +35,7 @@ prepare_data_pointers:
|
||||
imul eax,ebx
|
||||
lea eax,[eax+eax*2]
|
||||
mov ebx,[ScreenPointer]
|
||||
add ebx,(1200*1000*3)+50*(20*20*3)+500000
|
||||
add ebx,mem_screen+mem_panel_b+mem_flood_f
|
||||
|
||||
mov [PointerToPicture],ebx
|
||||
mov [PointerToCopyPicture],ebx
|
||||
@ -51,11 +56,8 @@ prepare_data_pointers:
|
||||
add [PointerToSpriteBufer],eax
|
||||
|
||||
mov eax,[ScreenPointer]
|
||||
add eax,(1200*1000*3)+50*(20*20*3)+1
|
||||
add eax,mem_screen+mem_panel_b
|
||||
mov [PointerToPalette],eax
|
||||
|
||||
mov eax,[ScreenPointer]
|
||||
add eax,(1200*1000*3)+50*(20*20*3)+8
|
||||
mov [ReserveArray],eax
|
||||
ret
|
||||
;---------------------------------------------------------
|
@ -60,7 +60,7 @@ TakeInstruments:
|
||||
call print_text
|
||||
|
||||
mov edx,1000000000000000000000000000000b+1000
|
||||
mcall 8,<177,40>,<115,14>,
|
||||
mcall SF_DEFINE_BUTTON,<177,40>,<115,14>,
|
||||
|
||||
mov edx,1000000000000000000000000000000b+1001
|
||||
mcall ,,<139,14>,
|
||||
@ -69,7 +69,7 @@ TakeInstruments:
|
||||
mcall ,<175,40>,<170,15>
|
||||
|
||||
no_activate_space:
|
||||
mcall 10
|
||||
mcall SF_WAIT_EVENT
|
||||
|
||||
cmp eax,1
|
||||
je exit_new
|
||||
@ -77,7 +77,7 @@ no_activate_space:
|
||||
cmp eax,3
|
||||
jne no_activate_space
|
||||
|
||||
mcall 17
|
||||
mcall SF_GET_BUTTON
|
||||
shr eax,8
|
||||
|
||||
cmp eax,1000
|
||||
@ -130,7 +130,7 @@ no_picture_size_y:
|
||||
|
||||
exit_new:
|
||||
mov edx,11100000000000000000000000000000b+1002
|
||||
mcall 8,<175,40>,<170,15>
|
||||
mcall SF_DEFINE_BUTTON,<175,40>,<170,15>
|
||||
|
||||
mov edx,11100000000000000000000000000000b+1001
|
||||
mcall ,<177,40>,<139,14>
|
||||
@ -154,7 +154,6 @@ no_new:
|
||||
cmp [number_menu],2
|
||||
jne no_open
|
||||
|
||||
; opendialog drawwin,open_1,open_2,file_path
|
||||
;---------------------------------------------------------------------
|
||||
mov [OpenDialog_data.type],0 ; open
|
||||
|
||||
@ -164,13 +163,10 @@ no_new:
|
||||
cmp [OpenDialog_data.status],1
|
||||
jne still
|
||||
;---------------------------------------------------------------------
|
||||
;open_1:
|
||||
mcall 40,0x80000027 ; 100111b
|
||||
mcall SF_SET_EVENTS_MASK,0x80000027 ;100111b
|
||||
|
||||
call load_picture
|
||||
|
||||
call load_icons
|
||||
call drawwin
|
||||
call drawwin
|
||||
|
||||
mov [Scroll1CoordinatX],9
|
||||
mov [Scroll2CoordinatY],89
|
||||
@ -226,7 +222,7 @@ no_save_:
|
||||
;---------------------------------------------------------------------
|
||||
save1:
|
||||
save_enter:
|
||||
mcall 40,0x80000027 ; 100111b
|
||||
mcall SF_SET_EVENTS_MASK,0x80000027 ;100111b
|
||||
|
||||
call analizing_picture_to_palette
|
||||
|
||||
|
@ -20,13 +20,8 @@ SaveFonForSprite:
|
||||
mov ecx,[counter]
|
||||
|
||||
next_pixel_sprite_save:
|
||||
mov eax,[esi]
|
||||
and eax,0xffffff
|
||||
mov [edi],ax
|
||||
shr eax,16
|
||||
mov [edi+2],al
|
||||
add esi,3
|
||||
add edi,3
|
||||
movsw
|
||||
movsb
|
||||
dec ecx
|
||||
jnz next_pixel_sprite_save
|
||||
|
||||
@ -57,13 +52,8 @@ PutFonForSprite:
|
||||
mov ecx,[counter]
|
||||
|
||||
next_pixel_sprite_put:
|
||||
mov eax,[esi]
|
||||
and eax,0xffffff
|
||||
mov [edi],ax
|
||||
shr eax,16
|
||||
mov [edi+2],al
|
||||
add esi,3
|
||||
add edi,3
|
||||
movsw
|
||||
movsb
|
||||
dec ecx
|
||||
jnz next_pixel_sprite_put
|
||||
|
||||
@ -94,13 +84,8 @@ DrawSprite:
|
||||
mov ecx,[counter]
|
||||
|
||||
next_pixel_sprite_draw:
|
||||
mov eax,[esi]
|
||||
and eax,0xffffff
|
||||
mov [edi],ax
|
||||
shr eax,16
|
||||
mov [edi+2],al
|
||||
add esi,3
|
||||
add edi,3
|
||||
movsw
|
||||
movsb
|
||||
dec ecx
|
||||
jnz next_pixel_sprite_draw
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user