@open: add keyboard control

git-svn-id: svn://kolibrios.org@5905 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
eAndrew 2015-11-09 22:06:55 +00:00
parent 82ee194a2b
commit a1b4d3ce92

View File

@ -365,43 +365,84 @@ end if
mcall 2 mcall 2
cmpe ah, 27, exit cmpe ah, 27, exit
; cmpe ah, 179, .go_right cmpe ah, 13, list_item_activate
; cmpe ah, 176, .go_left cmpe ah, 179, .go_right
; cmpe ah, 178, .go_up cmpe ah, 176, .go_left
; cmpe ah, 177, .go_down cmpe ah, 178, .go_up
; jmp update cmpe ah, 177, .go_down
; jmp update
; .go_right:
; jmp update .go_right:
; mov esi, 1
; .go_left: jmp .go_anyway
; jmp update
; .go_left:
; .go_up: mov esi, -1
; jmp update jmp .go_anyway
;
; .go_down: .go_up:
; stdcall draw_item, [last_x], [last_y], 0 mov esi, -2
; jmp .go_anyway
; cmpne [last_x], -1, @f
; mov [last_x], 0 .go_down:
; @@: mov esi, 2
;
; cmpne [last_y], LIST_SIZE / 2 - 1, @f .go_anyway:
; mov eax, [sb_apps.position] ;; HIDE OLD SELECTION
; add eax, LIST_SIZE / 2 stdcall draw_item, [last_x], [last_y], 0
; shl eax, 1
; cmpge eax, [list.size], .pre ;; [X, Y] -> INDEX
; inc [sb_apps.position] mov eax, [last_y]
; stdcall draw_list shl eax, 1
; invoke scrollbar.draw, sb_apps add eax, [last_x]
; jmp update mov ebx, [sb_apps.position]
; .pre: shl ebx, 1
; dec [last_y] add eax, ebx
; @@:
; ;; CHANGE INDEX
; inc [last_y] add eax, esi
; stdcall draw_item, [last_x], [last_y], 1
cmpl eax, [list.size], @f
mov eax, [list.size]
dec eax
@@:
cmpge eax, 0, @f
mov eax, 0
@@:
;; INDEX -> [X, Y]
sub eax, ebx
mov ebx, eax
and ebx, 1b
mov [last_x], ebx
shr eax, 1
mov [last_y], eax
cmpl [last_y], 0xFFFF, @f
mov [last_y], 0
dec [sb_apps.position]
jmp .full_redraw
@@:
cmpl [last_y], LIST_SIZE / 2, @f
mov [last_y], LIST_SIZE / 2 - 1
inc [sb_apps.position]
jmp .full_redraw
@@:
;; DRAW NEW SELECTION
.partly_redraw:
stdcall draw_item, [last_x], [last_y], 1
jmp update
.full_redraw:
cmpge [sb_apps.position], 0, @f
mov [sb_apps.position], 0
@@:
stdcall draw_list
invoke scrollbar.draw, sb_apps
jmp update jmp update
;---------------------- ;----------------------
@ -410,23 +451,39 @@ end if
mcall 17 mcall 17
cmpe ah, 1, exit cmpe ah, 1, exit
cmpe ah, 2, .opendialog cmpe ah, 2, .opendialog
jmp list_item_activate
.fromlist: .opendialog:
movzx ebx, ah invoke opendialog.start, opendialog
sub ebx, 10 cmpne [opendialog.status], 1, update
mov ecx, [sb_apps.position]
shl ecx, 1
add ebx, ecx
shl ebx, 5
add ebx, list
cmpe [ebx], byte 0, update
mov [param_a], ebx
invoke libini.get_str, assoc_ini, ebx, assoc_ini.exec, buffer, 256, undefined
cmpe [buffer], byte 0, ini_error
mcall 70, is_openas mcall 70, is_openas
mov edi, 1
.save_assoc: mov edi, 0
jmp save_assoc
;----------------------
list_item_activate:
mov eax, [last_y]
shl eax, 1
add eax, [last_x]
mov ebx, [sb_apps.position]
shl ebx, 1
add eax, ebx
shl eax, 5
add eax, list
cmpe byte [eax], 0, update
mov [param_a], eax
invoke libini.get_str, assoc_ini, eax, assoc_ini.exec, buffer, 256, undefined
cmpe byte [buffer], 0, ini_error
mcall 70, is_openas
mov edi, 1
jmp save_assoc
;----------------------
save_assoc:
mov eax, [cb_always.flags] mov eax, [cb_always.flags]
and eax, ch_flag_en and eax, ch_flag_en
cmpe eax, 0, exit cmpe eax, 0, exit
@ -439,13 +496,6 @@ end if
invoke libini.set_str, assoc_ini, assoc_ini.sec, [param_e], buffer, 33 invoke libini.set_str, assoc_ini, assoc_ini.sec, [param_e], buffer, 33
jmp exit jmp exit
.opendialog:
invoke opendialog.start, opendialog
cmpne [opendialog.status], 1, update
mcall 70, is_openas
mov edi, 0
jmp .save_assoc
;---------------------- ;----------------------
event_mouse: event_mouse: