fix stack error in TakeButtonInstruments

git-svn-id: svn://kolibrios.org@6362 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
IgorA 2016-03-22 14:12:51 +00:00
parent b51837d38b
commit 46d18b25ac
5 changed files with 224 additions and 225 deletions

View File

@ -13,6 +13,7 @@ buttons:
jne @f
mov [finishing_crossing],1
call TakeButtonInstruments
jmp still
@@:
mcall SF_GET_BUTTON
@ -92,5 +93,4 @@ buttons:
no_kontur__:
call TakeButtonInstruments
jmp still

View File

@ -232,7 +232,8 @@ mouse_in_work_arrea:
mov [PointerToCopyPicture2],ebx
;--------------end copy for undo-------------
no_undo___:
call TakeButtonInstruments
call TakeButtonInstruments
jmp still
no_use_instruments:
mov eax,[Current_instrument]

View File

@ -153,8 +153,39 @@ local .no_draw_pixel
;-----------------------------------------------------------
;-----instruments of panel(icon's instruments)--------------
;-----------------------------------------------------------
TakeButtonInstruments:
;input:
; [Current_instrument] - instrument code
;
; *** instrument codes ***
;10 - pensil
;11 - draw brush
;12 - spray
;13 - lastik
;14 - flood fill
;15 - pipetka
;16 - draw line
;17 - draw rectangle
;18 - draw circle
;19 - draw ellips
;20 - draw hard contour
;21 - allocation of a countour
;23 - reflection from left to right
;24 - reflection from up to down
;40 - brush 1
;41 - brush 2
;42 - brush 3
;43 - brush 4
;44 - brush 5
;45 - zoom 1
;46 - zoom 2
;47 - zoom 3
;48 - zoom 4
;49 - zoom 8
;50 - zoom 16
;51 - palette
align 4
TakeButtonInstruments:
mov eax,[Current_instrument]
;*************************brush 1***********************
@ -168,8 +199,7 @@ TakeButtonInstruments:
mov [Current_instrument],ebx
mov [line_width],1
jmp still
ret
no_brush1:
;*************************brush 2***********************
@ -183,8 +213,7 @@ TakeButtonInstruments:
mov [Current_instrument],ebx
mov [line_width],2
jmp still
ret
no_brush2:
;*************************brush 3***********************
@ -198,8 +227,7 @@ TakeButtonInstruments:
mov [Current_instrument],ebx
mov [line_width],3
jmp still
ret
no_brush3:
;*************************brush 4***********************
@ -213,8 +241,7 @@ TakeButtonInstruments:
mov [Current_instrument],ebx
mov [line_width],4
jmp still
ret
no_brush4:
;*************************brush 5***********************
@ -228,8 +255,7 @@ TakeButtonInstruments:
mov [Current_instrument],ebx
mov [line_width],5
jmp still
ret
no_brush5:
;*************************pensil************************
@ -261,9 +287,6 @@ TakeButtonInstruments:
no_activated_later:
; mov eax,[MaxWorkScreen_SizeX] ???
; mov ebx,[MaxWorkScreen_SizeY] ???
mov eax,[PointerToPicture]
mov ebx,[ReserveArray]
mov ecx,[Picture_SizeX]
@ -302,31 +325,9 @@ TakeButtonInstruments:
call MovePictureToWorkScreen
mov [Activate_instrument],1
jmp still
ret
no_pensil:
;*************************pipetka***********************
cmp eax,15
jne no_pipetka
mov eax,[ScreenY]
mov ebx,[Picture_SizeX]
add eax,[PosY]
imul eax,ebx
add eax,[ScreenX]
add eax,[PosX]
lea eax,[eax+eax*2]
add eax,[PointerToPicture]
mov ebx,[eax]
and ebx,0xffffff
mov [Color],ebx
mcall SF_DRAW_RECT, ((ci_panel_x_pos+130) shl 16)+21,\
((ci_panel_y_pos+28) shl 16)+21, [Color]
jmp still
no_pipetka:
;*************************draw brush********************
cmp eax,11
jne no_brush
@ -475,9 +476,40 @@ TakeButtonInstruments:
mov eax,[Current_instrument]
mov [Last_instrument],eax
jmp still
ret
no_brush:
;*************************pipetka***********************
cmp eax,15
jne no_pipetka
mov eax,[ScreenY]
mov ebx,[Picture_SizeX]
add eax,[PosY]
imul eax,ebx
add eax,[ScreenX]
add eax,[PosX]
lea eax,[eax+eax*2]
add eax,[PointerToPicture]
mov ebx,[eax]
and ebx,0xffffff
mov [Color],ebx
mcall SF_DRAW_RECT, ((ci_panel_x_pos+130) shl 16)+21,\
((ci_panel_y_pos+28) shl 16)+21, [Color]
ret
no_pipetka:
;************************lastik*************************
cmp eax,13
jne no_lastik
mov [Last_instrument],eax
mov [lastik_is_active],1
jmp lastik_in
no_lastik:
;************************Flood Fill*********************
cmp eax,14
jne no_FloodFill
@ -513,28 +545,17 @@ TakeButtonInstruments:
call flood_fill
call MovePictureToWorkScreen
jmp still
ret
no_FloodFill:
;************************lastik*************************
cmp eax,13
jne no_lastik
mov [Last_instrument],eax
mov [lastik_is_active],1
jmp lastik_in
no_lastik:
;*******************************************************
;************************spray**************************
cmp eax,12
jne no_spray
jne no_spray
cmp [Activate_instrument],0
jne no_null_spray
mov [Activate_instrument],1
jmp still
ret
no_null_spray:
mov eax,[ScreenX]
@ -610,8 +631,7 @@ TakeButtonInstruments:
jl brush_y_spray
call MovePictureToWorkScreen
jmp still
ret
no_spray:
;************************palette************************
@ -649,24 +669,22 @@ TakeButtonInstruments:
jnz next_rectangle
wait_events:
call event
mcall SF_WAIT_EVENT
cmp eax,1
je still
jne @f
ret
@@:
cmp eax,2
jne no_keys
mcall SF_GET_KEY
mcall SF_GET_KEY
jmp wait_events
no_keys:
cmp eax,3
jne no_buttons
mcall SF_GET_BUTTON
mcall SF_GET_BUTTON
jmp wait_events
no_buttons:
cmp eax,6
jne wait_events
@ -716,8 +734,7 @@ TakeButtonInstruments:
mov eax,[Last_instrument]
mov [Current_instrument],eax
jmp still
ret
no_palette:
;************************draw line**********************
@ -739,8 +756,9 @@ TakeButtonInstruments:
xor eax,eax
mov ecx,mem_flood_f/4
mov edi,[ReserveArray]
cld
rep stosd
jmp still
ret
no_new_line_xy:
;put saved pixels
@ -782,7 +800,7 @@ TakeButtonInstruments:
draw_calc_pixels width_pixels
call MovePictureToWorkScreen
jmp still
ret
no_line:
;************************draw rectangle*****************
@ -804,8 +822,9 @@ TakeButtonInstruments:
xor eax,eax
mov ecx,mem_flood_f/4
mov edi,[ReserveArray]
cld
rep stosd
jmp still
ret
no_new_rectangle_xy:
;put saved pixels
@ -847,7 +866,7 @@ TakeButtonInstruments:
draw_calc_pixels width_pixels_rectangle
call MovePictureToWorkScreen
jmp still
ret
no_rectangle:
;************************draw circle********************
@ -869,8 +888,9 @@ TakeButtonInstruments:
xor eax,eax
mov ecx,mem_flood_f/4
mov edi,[ReserveArray]
cld
rep stosd
jmp still
ret
no_new_circle_xy:
;put saved pixels
@ -999,7 +1019,7 @@ TakeButtonInstruments:
draw_calc_pixels width_pixels
call MovePictureToWorkScreen
jmp still
ret
no_circle:
;************************zoom 1*************************
@ -1009,7 +1029,7 @@ TakeButtonInstruments:
call scrollbar_move_00
and [Current_instrument],0
call drawwin
jmp still
ret
no_1_:
;************************zoom 2*************************
@ -1019,10 +1039,9 @@ TakeButtonInstruments:
call drawwin
call scrollbar_move_00
and [Current_instrument],0
jmp still
ret
no_2_:
;************************zoom 3*************************
cmp eax,47
jne no_3_
@ -1030,7 +1049,7 @@ TakeButtonInstruments:
call drawwin
call scrollbar_move_00
and [Current_instrument],0
jmp still
ret
no_3_:
;************************zoom 4*************************
@ -1040,7 +1059,7 @@ TakeButtonInstruments:
call drawwin
call scrollbar_move_00
and [Current_instrument],0
jmp still
ret
no_4_:
;************************zoom 8*************************
@ -1050,7 +1069,7 @@ TakeButtonInstruments:
call drawwin
call scrollbar_move_00
and [Current_instrument],0
jmp still
ret
no_8_:
;************************zoom 16************************
@ -1060,7 +1079,7 @@ TakeButtonInstruments:
call drawwin
call scrollbar_move_00
and [Current_instrument],0
jmp still
ret
no_16_:
;***************allocation of a countour****************
@ -1090,8 +1109,9 @@ TakeButtonInstruments:
xor eax,eax
mov ecx,mem_flood_f/4
mov edi,[ReserveArray]
cld
rep stosd
jmp still
ret
no_new_allocation_xy:
instrument_not_finished_work:
@ -1186,8 +1206,8 @@ TakeButtonInstruments:
mov edi,[SpriteSizeY]
add ecx,[PosX]
add edx,[PosY]
inc esi;eax
inc edi;ebx
inc esi
inc edi
call columnus
test eax,eax
@ -1316,7 +1336,7 @@ TakeButtonInstruments:
and [instrument_used],0
and [DrawSprite_flag],0
call MovePictureToWorkScreen
jmp still
ret
not_finish_from_instrument_crossing:
;calculate line
@ -1410,7 +1430,7 @@ TakeButtonInstruments:
no_save_shades:
call MovePictureToWorkScreen
jmp still
ret
no_allocation:
;*************reflection from left to right*************
@ -1493,7 +1513,7 @@ TakeButtonInstruments:
jnz next_line_reflection_x
call MovePictureToWorkScreen
jmp still
ret
no_reflection_from_left_to_right:
;*************reflection from up to down****************
@ -1545,7 +1565,7 @@ TakeButtonInstruments:
jnz next_lines_reflection
call MovePictureToWorkScreen
jmp still
ret
no_reflection_from_up_to_down:
;*********************draw hard contour*****************
@ -1636,10 +1656,9 @@ TakeButtonInstruments:
mov [used_OldY],ebx
call MovePictureToWorkScreen
jmp still
ret
no_kontur_:
;************************draw ellips********************
cmp eax,19
jne no_ellips
@ -1659,8 +1678,9 @@ TakeButtonInstruments:
xor eax,eax
mov ecx,mem_flood_f/4
mov edi,[ReserveArray]
cld
rep stosd
jmp still
ret
no_new_ellips_xy:
;put saved pixels
@ -1781,9 +1801,7 @@ TakeButtonInstruments:
draw_calc_pixels width_pixels
call MovePictureToWorkScreen
jmp still
;ret
no_ellips:
jmp still
ret

View File

@ -2,6 +2,18 @@ KMENUITEM_NORMAL equ 0
KMENUITEM_SUBMENU equ 1
KMENUITEM_SEPARATOR equ 2
macro menu_set code, m_group, m_number
{
local no_set
cmp eax, code
jne no_set
mov [number_panel], m_group
mov [number_menu], m_number
jmp TakeInstruments
no_set:
}
init_main_menu:
stdcall [kmenu_init], syscolors
@ -58,6 +70,28 @@ init_main_menu:
; init 'Edit' menu
stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Instr_Pencil, 0x51
stdcall [ksubmenu_add], [main_menu_instr], eax
stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Instr_Brush, 0x52
stdcall [ksubmenu_add], [main_menu_instr], eax
stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Instr_Spray, 0x53
stdcall [ksubmenu_add], [main_menu_instr], eax
stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Instr_Lastik, 0x54
stdcall [ksubmenu_add], [main_menu_instr], eax
stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Instr_Flood_fill, 0x55
stdcall [ksubmenu_add], [main_menu_instr], eax
stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Instr_Pipetka, 0x56
stdcall [ksubmenu_add], [main_menu_instr], eax
stdcall [kmenuitem_new], KMENUITEM_SEPARATOR, 0, 0
stdcall [ksubmenu_add], [main_menu_instr], eax
stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Instr_Line, 0x57
stdcall [ksubmenu_add], [main_menu_instr], eax
stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Instr_Rectangle, 0x58
stdcall [ksubmenu_add], [main_menu_instr], eax
stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Instr_Circle, 0x59
stdcall [ksubmenu_add], [main_menu_instr], eax
stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Instr_Ellips, 0x5a
stdcall [ksubmenu_add], [main_menu_instr], eax
stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Instr_Hard_contour, 0x5b
stdcall [ksubmenu_add], [main_menu_instr], eax
; add 'Instruments' menu to main
stdcall [kmenuitem_new], KMENUITEM_SUBMENU, sz_main_menu_Instr, [main_menu_instr]
@ -70,78 +104,28 @@ put_main_menu:
ret
button_handler_main_menu:
cmp eax, 0x71
jne @f
mov [number_panel], 7
mov [number_menu], 1
jmp TakeInstruments
@@:
cmp eax, 0x72
jne @f
mov [number_panel], 7
mov [number_menu], 2
jmp TakeInstruments
@@:
cmp eax, 0x73
jne @f
mov [number_panel], 7
mov [number_menu], 3
jmp TakeInstruments
@@:
cmp eax, 0x74
jne @f
mov [number_panel], 7
mov [number_menu], 4
jmp TakeInstruments
@@:
cmp eax, 0x75
jne @f
mov [number_panel], 7
mov [number_menu], 5
jmp TakeInstruments
@@:
cmp eax, 0x61
jne @f
mov [number_panel], 6
mov [number_menu], 1
jmp TakeInstruments
@@:
cmp eax, 0x62
jne @f
mov [number_panel], 6
mov [number_menu], 2
jmp TakeInstruments
@@:
cmp eax, 0x63
jne @f
mov [number_panel], 6
mov [number_menu], 3
jmp TakeInstruments
@@:
cmp eax, 0x64
jne @f
mov [number_panel], 6
mov [number_menu], 4
jmp TakeInstruments
@@:
cmp eax, 0x65
jne @f
mov [number_panel], 6
mov [number_menu], 5
jmp TakeInstruments
@@:
cmp eax, 0x66
jne @f
mov [number_panel], 6
mov [number_menu], 6
jmp TakeInstruments
@@:
cmp eax, 0x51
jne @f
mov [number_panel], 5
mov [number_menu], 1
jmp TakeInstruments
@@:
menu_set 0x71, 7,1
menu_set 0x72, 7,2
menu_set 0x73, 7,3
menu_set 0x74, 7,4
menu_set 0x75, 7,5
menu_set 0x61, 6,1
menu_set 0x62, 6,2
menu_set 0x63, 6,3
menu_set 0x64, 6,4
menu_set 0x65, 6,5
menu_set 0x66, 6,6
menu_set 0x51, 5,1
menu_set 0x52, 5,2
menu_set 0x53, 5,3
menu_set 0x54, 5,4
menu_set 0x55, 5,5
menu_set 0x56, 5,6
menu_set 0x57, 5,7
menu_set 0x58, 5,8
menu_set 0x59, 5,9
menu_set 0x5a, 5,10
menu_set 0x5b, 5,11
.end_handler:
ret
@ -166,4 +150,14 @@ sz_main_menu_Edit_Cut db 'Cut', 0
sz_main_menu_Edit_ClS db 'Clear screen', 0
sz_main_menu_Instr db 'Instruments', 0
sz_main_menu_Instr_Pencil db 'Pencil', 0
sz_main_menu_Instr_Pencil db 'Pencil', 0
sz_main_menu_Instr_Brush db 'Brush', 0
sz_main_menu_Instr_Spray db 'Spray', 0
sz_main_menu_Instr_Lastik db 'Lastik', 0
sz_main_menu_Instr_Flood_fill db 'Flood fill', 0
sz_main_menu_Instr_Pipetka db 'Pipetka', 0
sz_main_menu_Instr_Line db 'Line', 0
sz_main_menu_Instr_Rectangle db 'Rectangle', 0
sz_main_menu_Instr_Circle db 'Circle', 0
sz_main_menu_Instr_Ellips db 'Ellips', 0
sz_main_menu_Instr_Hard_contour db 'Hard contour', 0

View File

@ -1,6 +1,18 @@
macro instrument_set m_num, code
{
local no_instrument
cmp [number_menu],m_num
jne no_instrument
mov [Current_instrument],code
call TakeButtonInstruments
jmp end_menu
no_instrument:
}
;-----------------------------------------------------------
;-----------instruments of menu-----------------------------
;-----------------------------------------------------------
align 4
TakeInstruments:
;|||||||||||||||||||FILE||||||||||||||||||||||
cmp [number_panel],7
@ -99,12 +111,10 @@ exit_new:
call GetMemory
and [save_flag],0
and [number_panel],0
and [number_menu],0
call cleare_work_arrea
call drawwin
jmp still
jmp end_menu
;---------------------------------------------------------------------
no_new:
; <<< Open >>>
@ -118,16 +128,13 @@ no_new:
call [OpenDialog_Start]
cmp [OpenDialog_data.status],1
jne still
jne end_menu
;---------------------------------------------------------------------
mcall SF_SET_EVENTS_MASK,0x80000027 ;100111b
call load_picture
call drawwin
and [number_panel],0
and [number_menu],0
jmp still
jmp end_menu
;---------------------------------------------------------------------
no_open:
; <<< Save >>>
@ -135,15 +142,10 @@ no_open:
jne no_save_
mov al,[save_flag]
test al,al
jz no_save_file
test al,al
jz end_menu
jmp save_enter
;---------------------------------------------------------------------
no_save_file:
and [number_panel],0
and [number_menu],0
jmp still
;---------------------------------------------------------------------
no_save_:
; <<< Save as >>>
cmp [number_menu],4
@ -171,7 +173,7 @@ no_save_:
stdcall [OpenDialog_Start],OpenDialog_data
cmp [OpenDialog_data.status],1
jne still
jne end_menu
;---------------------------------------------------------------------
save1:
save_enter:
@ -195,15 +197,8 @@ save_enter:
call save_file
mov [save_flag],1
and [number_panel],0
and [number_menu],0
call drawwin
jmp still
;---------------------------------------------------------------------
;save2:
; and [number_panel],0
; and [number_menu],0
; jmp still
call drawwin
jmp end_menu
;---------------------------------------------------------------------
no_save:
; <<< Exit >>>
@ -235,9 +230,7 @@ no_file:
mov [PointerToCopyPicture2],eax
call MovePictureToWorkScreen
and [number_panel],0
and [number_menu],0
jmp still
jmp end_menu
;---------------------------------------------------------------------
no_undo:
; <<< Redo >>>
@ -257,9 +250,7 @@ no_undo:
mov [PointerToCopyPicture2],ebx
call MovePictureToWorkScreen
and [number_panel],0
and [number_menu],0
jmp still
jmp end_menu
;---------------------------------------------------------------------
no_redo:
; <<< Copy >>>
@ -355,11 +346,8 @@ loop_fill_rectangle_x_copy:
jl loop_fill_rectangle_y_copy
call MovePictureToWorkScreen
and [number_panel],0
and [number_menu],0
mov [DrawSprite_flag],1
jmp still
jmp end_menu
;---------------------------------------------------------------------
no_copy:
; <<< Paste >>>
@ -451,10 +439,8 @@ loop_fill_rectangle_x_paste:
jl loop_fill_rectangle_y_paste
call MovePictureToWorkScreen
and [number_panel],0
and [number_menu],0
mov [Paste_flag],1
jmp still
jmp end_menu
;---------------------------------------------------------------------
no_paste:
; <<< Cut >>>
@ -544,10 +530,7 @@ loop_fill_rectangle_x:
jl loop_fill_rectangle_y
call MovePictureToWorkScreen
and [number_panel],0
and [number_menu],0
jmp still
jmp end_menu
;---------------------------------------------------------------------
no_cut:
; <<< Cleare all >>>
@ -556,15 +539,12 @@ no_cut:
call cleare_work_arrea
call MovePictureToWorkScreen
and [number_panel],0
and [number_menu],0
jmp still
jmp end_menu
;---------------------------------------------------------------------
no_cleare_all:
; <<< To allocate all >>>
cmp [number_menu],7
jne still ;no_to_allocate_all
jne end_menu ;no_to_allocate_all
mov [OldX],1
mov [OldY],1
@ -578,26 +558,32 @@ no_cleare_all:
mov [Activate_instrument],1
mov [Current_instrument],30
mov [crossing],0
and [number_panel],0
and [number_menu],0
; call TakeButtonInstruments
; call MovePictureToWorkScreen
jmp still
jmp end_menu
;---------------------------------------------------------------------
;no_to_allocate_all:
no_edit:
;|||||||||||||||||||||||||INSTRUMENTS||||||||||||||||||||||
cmp [number_panel],5
jne no_instruments
; <<< Pencil >>>
cmp [number_menu],1
jne no_pencil
; ... todo ...
instrument_set 1,10 ; pensil
instrument_set 2,11 ; draw brush
instrument_set 3,12 ; spray
instrument_set 4,13 ; lastik
instrument_set 5,14 ; flood fill
instrument_set 6,15 ; pipetka
instrument_set 7,16 ; draw line
instrument_set 8,17 ; draw rectangle
instrument_set 9,18 ; draw circle
instrument_set 10,19 ; draw ellips
instrument_set 11,20 ; draw hard contour
no_instruments:
end_menu:
and [number_panel],0
and [number_menu],0
no_pencil:
no_instruments:
jmp still
;---------------------------------------------------------------------