Nerfed GUI for next updates. Now you can press <Enter> to calculate. Added Two buttons in title (keyboard and help), but they don`t work now.

git-svn-id: svn://kolibrios.org@4939 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
eAndrew 2014-05-24 18:24:25 +00:00
parent 3bf41a960f
commit 64e775caec

View File

@ -1,4 +1,5 @@
VERSION equ "0.3Ĺ" VERSION equ "0.4Å"
use32 use32
org 0 org 0
db 'MENUET01' db 'MENUET01'
@ -8,13 +9,14 @@
include "../../macros.inc" include "../../macros.inc"
include "../../dll.inc" include "../../dll.inc"
include "../../develop/libraries/box_lib/trunk/box_lib.mac" include "../../develop/libraries/box_lib/trunk/box_lib.mac"
; include "../../debug.inc" ; include "../../debug.inc"
include "parser.inc" include "parser.inc"
;=============================== ;===============================
sz_cont db "?#"
sz_head db "Calc+ [v", VERSION, "]", 0 sz_head db "Calc+ [v", VERSION, "]", 0
buttons db "789456123()%^-+/*0" ; buttons db "789456123()%^-+/*0"
edb1 edit_box 184, 8, 12, 0, 0, 0, 0, 0, 500, \ edb1 edit_box 184, 8, 12, 0, 0, 0, 0, 0, 500, \
exp, group, ed_always_focus + ed_focus, 0, 0 exp, group, ed_always_focus + ed_focus, 0, 0
@ -27,16 +29,17 @@
;=============================== ;===============================
main: main:
mov [ans.buffer], word "0" mov [ans.buffer], dword "= 0"
mov [ans.size], 15 mov [ans.size], 3 * 6 + 9
mcall 40, 100111b mcall 40, 100111b
mcall 48, 3, scn, 192 mcall 48, 3, scn, 192
m2m [edb1.color], [scn.gui_face] m2m [edb1.color], [scn.gui_face]
m2m [edb1.shift_color], [scn.gui_select] m2m [edb1.shift_color], [scn.gui_select]
m2m [edb1.focus_border_color], [scn.gui_face] m2m [edb1.focus_border_color], [scn.gui_face]
m2m [edb1.text_color], [scn.gui_fctext] m2m [edb1.text_color], [scn.gui_text]
mcall 68, 11 mcall 68, 11
stdcall dll.Load, imports stdcall dll.Load, imports
@ -66,37 +69,50 @@
ev_redraw: ev_redraw:
mov edx, [scn.win_body] mov edx, [scn.win_body]
or edx, 0x34 shl 24 or edx, 0x34 shl 24
mcall 0, <100, 236>, <100, 164>, , , sz_head mcall 0, <100, 236 + 100>, <100, 164 - 102>, , , sz_head
mcall 8, <275, 12>, <-17, 12>, 2 + 1 shl 30
sub ebx, 12 shl 16
inc edx
mcall
mcall 4, <279, -14>, [scn.win_title], sz_cont, 1
add ebx, 1 shl 16
mcall
sub ebx, 13 shl 16
inc edx
mcall
call draw_textbox call draw_textbox
mov [but_id], 0x4000000A ; mov [but_id], 0x0000000A
mov [txt_id], buttons ; mov [txt_id], buttons
mov [txt_x], 16 ; mov [txt_x], 16
mov [but_w], 38 ; mov [but_w], 38
stdcall draw_button, 4, 42 ; stdcall draw_button, 4, 42
stdcall draw_button, 46, 42 ; stdcall draw_button, 46, 42
stdcall draw_button, 88, 42 ; stdcall draw_button, 88, 42
stdcall draw_button, 4, 66 ; stdcall draw_button, 4, 66
stdcall draw_button, 46, 66 ; stdcall draw_button, 46, 66
stdcall draw_button, 88, 66 ; stdcall draw_button, 88, 66
stdcall draw_button, 4, 90 ; stdcall draw_button, 4, 90
stdcall draw_button, 46, 90 ; stdcall draw_button, 46, 90
stdcall draw_button, 88, 90 ; stdcall draw_button, 88, 90
stdcall draw_button, 88, 114 ; stdcall draw_button, 88, 114
;
; stdcall draw_button, 144, 42
; stdcall draw_button, 186, 42
; stdcall draw_button, 144, 66
; stdcall draw_button, 186, 66
; stdcall draw_button, 144, 90
; stdcall draw_button, 186, 90
; stdcall draw_button, 144, 114
; stdcall draw_button, 186, 114
stdcall draw_button, 144, 42 ; mov [txt_x], 37
stdcall draw_button, 186, 42 ; mov [but_w], 80
stdcall draw_button, 144, 66 ; stdcall draw_button, 4, 114
stdcall draw_button, 186, 66
stdcall draw_button, 144, 90
stdcall draw_button, 186, 90
stdcall draw_button, 144, 114
stdcall draw_button, 186, 114
mov [txt_x], 37
mov [but_w], 80
stdcall draw_button, 4, 114
jmp update jmp update
@ -108,6 +124,8 @@
mcall 2 mcall 2
cmp ah, 27 cmp ah, 27
je exit je exit
cmp ah, 13
je calc
invoke editbox.key, edb1 invoke editbox.key, edb1
jmp update jmp update
@ -121,36 +139,9 @@
cmp ah, 1 cmp ah, 1
je exit je exit
cmp ah, 2
jne .not_copy
.copy:
mov eax, exp
mov ebx, ans.buffer
mov ecx, 0
@@:
mov dl, [ebx]
mov [eax], dl
inc eax
inc ebx
inc ecx
cmp [eax - 1], byte 0
jne @b
dec ecx
mov [edb1.size], ecx
m2m [edb1.pos], [edb1.size]
jmp .redraw
.not_copy:
cmp ah, 19 cmp ah, 19
jne .not_del jne .not_del
.del: .del:
cmp [edb1.pos], 0 cmp [edb1.pos], 0
je update je update
mov eax, exp mov eax, exp
@ -171,35 +162,34 @@
dec [edb1.size] dec [edb1.size]
m2m [edb1.shift], [edb1.pos] m2m [edb1.shift], [edb1.pos]
jmp .redraw jmp .redraw
.not_del: .not_del:
cmp ah, 10 ; cmp ah, 10
jl update ; jl update
cmp ah, 50 ; cmp ah, 50
jg update ; jg update
;
movzx eax, ah ; movzx eax, ah
add eax, buttons ; add eax, buttons
sub eax, 10 ; sub eax, 10
mov al, [eax] ; mov al, [eax]
;
mov ebx, exp ; mov ebx, exp
add ebx, [edb1.size] ; add ebx, [edb1.size]
mov ecx, exp ; mov ecx, exp
add ecx, [edb1.pos] ; add ecx, [edb1.pos]
@@: ; @@:
cmp ebx, ecx ; cmp ebx, ecx
je @f ; je @f
mov dl, [ebx - 1] ; mov dl, [ebx - 1]
mov [ebx], dl ; mov [ebx], dl
dec ebx ; dec ebx
jmp @b ; jmp @b
@@: ; @@:
;
mov [ebx], al ; mov [ebx], al
inc [edb1.size] ; inc [edb1.size]
inc [edb1.pos] ; inc [edb1.pos]
.redraw: .redraw:
call draw_textbox call draw_textbox
@ -225,7 +215,10 @@
cmp [error_n], 0 cmp [error_n], 0
jne .error jne .error
stdcall convert_to_str, eax, ans.buffer mov [ans.buffer], word "= "
stdcall convert_to_str, eax, ans.buffer + 2
add eax, 2
imul eax, 6 imul eax, 6
add eax, 9 add eax, 9
mov [ans.size], eax mov [ans.size], eax
@ -271,110 +264,58 @@
;---------------------- ;----------------------
proc draw_button, x, y ; proc draw_button, x, y
mcall 13, <[x], [but_w]>, <[y], 20>, [scn.gui_frame] ; mcall 8, <[x], [but_w]>, <[y], 20>, [but_id], [scn.btn_face]
;
add ebx, 1 shl 16 ; mcall 1, [x], [y], [scn.win_face]
add ecx, 1 shl 16 ; add ebx, [but_w]
sub ebx, 2 ; mcall
sub ecx, 2 ; add ecx, 20
mcall , , , [scn.3d_light] ; mcall
; sub ebx, [but_w]
add ebx, 1 shl 16 ; mcall
add ecx, 1 shl 16 ;
dec ebx ; mov ebx, [x]
dec ecx ; add ebx, [txt_x]
mcall , , , [scn.3d_dark] ; shl ebx, 16
; add ebx, [y]
dec ebx ; add ebx, 7
dec ecx ; mcall 4, , [scn.win_text], [txt_id], 1
mcall , , , [scn.win_face] ;
; inc dword [txt_id]
mcall 1, [x], [y], [scn.win_body] ; inc dword [but_id]
;
add ebx, [but_w] ; ret
dec ebx ; endp
mcall
add ecx, 20
dec ecx
mcall
sub ebx, [but_w]
inc ebx
mcall
mov ebx, [x]
inc ebx
shl ebx, 16
add ebx, [but_w]
sub ebx, 3
mov ecx, [y]
inc ecx
shl ecx, 16
add ecx, 20
sub ecx, 3
mov edx, [but_id]
mcall 8
mov ebx, [x]
add ebx, [txt_x]
shl ebx, 16
add ebx, [y]
add ebx, 7
mcall 4, , [scn.win_text], [txt_id], 1
inc dword [txt_id]
inc dword [but_id]
ret
endp
;---------------------- ;----------------------
proc draw_textbox proc draw_textbox
mcall 13, < 4, 220>, < 8, 23>, [scn.gui_frame] mcall 13, <4, 320>, < 8, 23>, [scn.gui_frame]
mov edx, [scn.gui_face] mov edx, [scn.gui_face]
cmp [error_n], 0 cmp [error_n], 0
je @f je @f
mov edx, 0xFFAAAA mov edx, 0xFFAAAA
@@: @@:
mcall 13, < 5, 218>, < 9, 21> mcall 13, < 5, 318>, < 9, 21>
mcall , < 5, 218>, < 9, 1>, [scn.3d_face] mcall , < 5, 318>, < 9, 1>, [scn.3d_face]
mcall , < 5, 1>, < 10, 20> mcall , < 5, 1>, < 10, 20>
mcall , < 5, 218>, < 31, 1>, [scn.3d_light] mcall , < 5, 318>, < 31, 1>, [scn.3d_light]
mov ebx, 224 mov ebx, 328
sub ebx, [ans.size] sub ebx, [ans.size]
shl ebx, 16 shl ebx, 16
inc ebx add ebx, 16
mcall , , < 9, 21>, [scn.gui_frame] mov ecx, [scn.gui_intext]
add ebx, [ans.size] or ecx, 1 shl 31
add ebx, 1 shl 16
sub ebx, 3
mcall , , , [scn.3d_light]
cmp [error_n], 0
jne .btn_not
mcall 8, , , 0x40000002
.btn_not:
add ebx, 1 shl 16
add ecx, 1 shl 16
dec ebx
dec ecx
mcall 13, , , [scn.win_face]
shr ecx, 16
mov bx, cx
add ebx, 3 shl 16 + 6
mov ecx, [scn.win_text]
or ecx, 1b shl 31
mcall 4, , , ans.buffer mcall 4, , , ans.buffer
mcall 1, 4, 8, [scn.win_body] mcall 1, 4, 8, [scn.win_body]
mcall , 223 mcall , 323
mcall , , 30, [scn.3d_light] mcall , , 30, [scn.3d_light]
mcall , 4 mcall , 4
mov ebx, 214 mov ebx, 318
sub ebx, [ans.size] sub ebx, [ans.size]
cmp ebx, 24 cmp ebx, 24
jg @f jg @f