@open: navigation by entering first char of name; tab and space hotkeys

git-svn-id: svn://kolibrios.org@5906 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
eAndrew 2015-11-10 16:10:00 +00:00
parent a1b4d3ce92
commit be110571f5

View File

@ -366,10 +366,87 @@ end if
cmpe ah, 27, exit cmpe ah, 27, exit
cmpe ah, 13, list_item_activate cmpe ah, 13, list_item_activate
cmpe ah, 9, event_button.opendialog
cmpe ah, 32, .toggle_cb
cmpe ah, 179, .go_right cmpe ah, 179, .go_right
cmpe ah, 176, .go_left cmpe ah, 176, .go_left
cmpe ah, 178, .go_up cmpe ah, 178, .go_up
cmpe ah, 177, .go_down cmpe ah, 177, .go_down
cmpl ah, "a", @f
cmpg ah, "z", @f
jmp .letter
@@:
cmpl ah, " ", @f
cmpg ah, "ï", @f
jmp .letter
@@:
cmpl ah, "A", @f
cmpg ah, "Z", @f
jmp .letter_big
@@:
cmpl ah, "€", @f
cmpg ah, "Ÿ", @f
jmp .letter_big
@@:
cmpl ah, "0", @f
cmpg ah, "9", @f
jmp .letter
@@:
jmp update
.letter_big:
movzx ebx, ah
stdcall downcase_char, ebx
mov ah, al
.letter:
push eax
stdcall get_index
inc eax
mov ecx, eax
imul ebx, eax, 32
add ebx, list
pop eax
@@:
cmpe byte [ebx], 0, @f
movzx edx, byte [ebx]
stdcall downcase_char, edx
cmpne ah, al, .next
stdcall set_index, ecx
stdcall draw_list
jmp update
.next:
inc ecx
add ebx, 32
jmp @b
@@:
jmp update
.toggle_cb:
mov eax, [cb_always.flags]
mov ebx, eax
and ebx, ch_flag_en
cmpe ebx, 0, @f
sub eax, ch_flag_en
jmp .toggle_cb.redraw
@@:
add eax, ch_flag_en
.toggle_cb.redraw:
mov [cb_always.flags], eax
invoke checkbox.draw, cb_always
jmp update jmp update
.go_right: .go_right:
@ -392,12 +469,7 @@ end if
stdcall draw_item, [last_x], [last_y], 0 stdcall draw_item, [last_x], [last_y], 0
;; [X, Y] -> INDEX ;; [X, Y] -> INDEX
mov eax, [last_y] stdcall get_index
shl eax, 1
add eax, [last_x]
mov ebx, [sb_apps.position]
shl ebx, 1
add eax, ebx
;; CHANGE INDEX ;; CHANGE INDEX
add eax, esi add eax, esi
@ -412,37 +484,16 @@ end if
@@: @@:
;; INDEX -> [X, Y] ;; INDEX -> [X, Y]
sub eax, ebx stdcall set_index, eax
mov ebx, eax cmpe eax, 1, @f
and ebx, 1b
mov [last_x], ebx
shr eax, 1
mov [last_y], eax
cmpl [last_y], 0xFFFF, @f ;; PARTLY REDRAW
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 stdcall draw_item, [last_x], [last_y], 1
jmp update jmp update
.full_redraw: ;; FULL REDRAW
cmpge [sb_apps.position], 0, @f
mov [sb_apps.position], 0
@@: @@:
stdcall draw_list stdcall draw_list
invoke scrollbar.draw, sb_apps
jmp update jmp update
;---------------------- ;----------------------
@ -464,12 +515,7 @@ end if
;---------------------- ;----------------------
list_item_activate: list_item_activate:
mov eax, [last_y] stdcall get_index
shl eax, 1
add eax, [last_x]
mov ebx, [sb_apps.position]
shl ebx, 1
add eax, ebx
shl eax, 5 shl eax, 5
add eax, list add eax, list
cmpe byte [eax], 0, update cmpe byte [eax], 0, update
@ -530,14 +576,12 @@ end if
cmpge eax, [list.size], @f cmpge eax, [list.size], @f
inc [sb_apps.position] inc [sb_apps.position]
stdcall draw_list stdcall draw_list
invoke scrollbar.draw, sb_apps
jmp update jmp update
.scroll_up: .scroll_up:
cmpe [sb_apps.position], 0, @f cmpe [sb_apps.position], 0, @f
dec [sb_apps.position] dec [sb_apps.position]
stdcall draw_list stdcall draw_list
invoke scrollbar.draw, sb_apps
jmp update jmp update
@@: @@:
@ -588,7 +632,6 @@ end if
or edx, 0x34 shl 24 or edx, 0x34 shl 24
mcall 0, <[win.x], WIN_WIDTH>, <[win.y], WIN_HEIGHT>, , , win.title mcall 0, <[win.x], WIN_WIDTH>, <[win.y], WIN_HEIGHT>, , , win.title
stdcall draw_list stdcall draw_list
invoke scrollbar.draw, sb_apps
invoke pathshow.draw, ps_addres invoke pathshow.draw, ps_addres
invoke checkbox.draw, cb_always invoke checkbox.draw, cb_always
@ -654,6 +697,8 @@ end if
@@: @@:
cmpne edi, -1, .draw_loop cmpne edi, -1, .draw_loop
invoke scrollbar.draw, sb_apps
ret ret
endp endp
@ -661,12 +706,8 @@ end if
proc draw_item uses edx edi esi, _x, _y, _sel proc draw_item uses edx edi esi, _x, _y, _sel
;; get index ;; get index
mov edi, [_y] stdcall get_index_cur, [_x], [_y]
shl edi, 1 mov edi, eax
add edi, [_x]
mov esi, [sb_apps.position]
shl esi, 1
add edi, esi
cmpge edi, [list.size], .break cmpge edi, [list.size], .break
@ -763,6 +804,87 @@ end if
;---------------------- ;----------------------
proc downcase_char uses ebx, _ch
mov ebx, [_ch]
cmpl bl, "A", @f
cmpg bl, "Z", @f
sub bl, "A" - "a"
jmp .ret
@@:
cmpl bl, "€", @f
cmpg bl, "Ÿ", @f
sub bl, "€" - " "
@@:
.ret:
mov al, bl
ret
endp
;----------------------
proc get_index_cur uses ebx, _x, _y
mov eax, [_y]
shl eax, 1
add eax, [_x]
mov ebx, [sb_apps.position]
shl ebx, 1
add eax, ebx
ret
endp
;----------------------
proc get_index
stdcall get_index_cur, [last_x], [last_y]
ret
endp
;----------------------
proc set_index uses ebx,_index
mov eax, [_index]
mov ebx, [sb_apps.position]
shl ebx, 1
sub eax, ebx
mov ebx, eax
and ebx, 1b
mov [last_x], ebx
shr eax, 1
mov [last_y], eax
mov eax, 0
cmpl [last_y], 0xFFFF, @f
mov [last_y], 0
dec [sb_apps.position]
mov eax, 1
jmp .exit
@@:
cmpl [last_y], LIST_SIZE / 2, @f
mov ebx, [last_y]
sub ebx, LIST_SIZE / 2 - 1
mov [last_y], LIST_SIZE / 2 - 1
add [sb_apps.position], ebx
mov eax, 1
jmp .exit
@@:
.exit:
cmpge [sb_apps.position], 0, @f
mov [sb_apps.position], 0
@@:
ret
endp
;----------------------
proc section_cb, _file, _sec proc section_cb, _file, _sec
;; CHECK IF EXISTS ;; CHECK IF EXISTS
invoke libini.get_str, assoc_ini, [_sec], assoc_ini.exec, buffer, 2048, undefined invoke libini.get_str, assoc_ini, [_sec], assoc_ini.exec, buffer, 2048, undefined