icon_new: also fix RMB, thanks Prohor for found issue

asciivju: better code, bigger fonts
quark: bugfixes

git-svn-id: svn://kolibrios.org@7957 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2020-05-20 01:13:52 +00:00
parent 7c4990bd81
commit 4fa1e75fb3
5 changed files with 319 additions and 326 deletions

View File

@ -165,6 +165,7 @@ sh=/sys/shell
asc=/sys/3d/view3ds asc=/sys/3d/view3ds
skn=/sys/skincfg skn=/sys/skincfg
dtp=/sys/skincfg
lif=/kolibrios/demos/life2 lif=/kolibrios/demos/life2
kla=/sys/games/klavisha kla=/sys/games/klavisha
pdf=/kolibrios/media/updf pdf=/kolibrios/media/updf

View File

@ -1,5 +1,5 @@
/* /*
Quark Code Edit v0.2 Quark Code Edit
Author: Kiril Lipatov aka Leency Author: Kiril Lipatov aka Leency
Licence: GPLv2 Licence: GPLv2
@ -432,7 +432,7 @@ void EventChangeCharset(dword id)
{ {
if (param[0]=='\0') return; if (param[0]=='\0') return;
user_encoding = id; user_encoding = id;
LoadFile(#openfile_path); LoadFile(#param);
ParseAndPaint(); ParseAndPaint();
draw_window(); draw_window();
} }
@ -602,11 +602,12 @@ void EncodeToDos()
if (strstr(io.buffer_data, "\208\190")) real_encoding = CH_UTF8; if (strstr(io.buffer_data, "\208\190")) real_encoding = CH_UTF8;
else { else {
if (chrnum(io.buffer_data, '\246')>5) if (chrnum(io.buffer_data, '\246')>5)
|| (strstr(io.buffer_data, "пр")) real_encoding = CH_CP1251; || (strstr(io.buffer_data, "\239\240")) real_encoding = CH_CP1251;
} }
} }
if (real_encoding != CH_CP866) if (real_encoding != CH_CP866) {
ChangeCharset(real_encoding, "CP866", io.buffer_data); ChangeCharset(real_encoding, "CP866", io.buffer_data);
}
} }
void LoadFile(dword f_path) void LoadFile(dword f_path)

View File

@ -115,10 +115,10 @@ draw_magnify:
sub edx, [m_y] sub edx, [m_y]
mov ebx, ecx mov ebx, ecx
shl ebx, 3+16 shl ebx, 3+16
mov bl, 7 mov bl, 8
mov ecx, edx mov ecx, edx
shl ecx, 3+16 shl ecx, 3+16
mov cl, 7 mov cl, 8
mov edx, eax mov edx, eax
mcall 13 mcall 13
pop edx ecx pop edx ecx

View File

@ -1,310 +1,294 @@
use32 use32
org 0x0 org 0x0
db 'MENUET01' db 'MENUET01'
dd 0x01,start,i_end,e_end,e_end,0,0 dd 0x01,start,i_end,e_end,e_end,0,0
include '../../../proc32.inc' include '../../../proc32.inc'
include '../../../macros.inc' include '../../../macros.inc'
BUTTON_SIDE equ 16 ; button are squares BUTTON_SIDE = 28 ; button are squares
BUTTON_SPACE equ 19 ; space between cols and rows BUTTON_SPACE = 34 ; space between cols and rows
BUTTON_ID_SHIFT equ 2 ; button_id = character + BUTTON_ID_SHIFT BUTTON_ID_SHIFT = 2 ; button_id = character + BUTTON_ID_SHIFT
TABLE_BEGIN_X equ 2 TABLE_BEGIN_X = 2
TABLE_BEGIN_Y equ 2 TABLE_BEGIN_Y = 2
PANEL_Y = BUTTON_SPACE*8+TABLE_BEGIN_Y+TABLE_BEGIN_Y
FOCUS_SQUARE_COLOR equ 0x000080FF
PAGE_SWITCHER_BLINK_COLOR equ 0x00808080 FOCUS_SQUARE_COLOR = 0x000080FF
SWITCHER_BLINK_COLOR = 0x00808080
start:
still: start:
mcall 10 still:
dec eax mcall 10
jz redraw dec eax
dec eax jz redraw
jz key dec eax
jz key
button:
mcall 17 button:
shr eax, 8 mcall 17
shr eax, 8
cmp eax, 1
je quit cmp eax, 1
cmp ax, 0xFFAA ; page switcher je quit
je .switch_page ; any button with a character cmp ax, 0xFFAA ; page switcher
.change_focus: je .switch_page ; any button with a character
mov bl, [symbol_focused] .change_focus:
mov [symbol_unfocused], bl mov bl, [symbol_focused]
sub ax, BUTTON_ID_SHIFT ; get the corresponding character mov [symbol_unfocused], bl
mov [symbol_focused], al sub ax, BUTTON_ID_SHIFT ; get the corresponding character
stdcall draw_table, 0 mov [symbol_focused], al
call draw_codes stdcall draw_table, 0
jmp still call draw_codes
.switch_page: jmp still
movzx bx, [symbol_start] .switch_page:
add bx, BUTTON_ID_SHIFT movzx bx, [symbol_start]
mov cx, 128 ; half of page add bx, BUTTON_ID_SHIFT
mov edx, 0x80000000 mov cx, 128 ; half of page
mov dx, bx mov edx, 0x80000000
@@: mcall 8 mov dx, bx
inc edx @@: mcall 8
dec cx inc edx
jnz @b dec cx
jnz @b
@@: add [symbol_start], 128 ; change page
add [symbol_focused], 128 @@: add [symbol_start], 128 ; change page
stdcall draw_table, 1 ; 1 means redraw the whole table add [symbol_focused], 128
call draw_codes stdcall draw_table, 1 ; 1 means redraw the whole table
stdcall draw_page_switcher, 1 ; 1 means dark color, for blinking call draw_codes
mcall 5, 10 stdcall draw_page_switcher, 1 ; 1 means dark color, for blinking
stdcall draw_page_switcher, 0 ; 0 means usual light color mcall 5, 10
jmp still stdcall draw_page_switcher, 0 ; 0 means usual light color
jmp still
redraw:
mcall 9, proc_info, -1 redraw:
mcall 48, 3, sys_colors, 40 mcall 9, proc_info, -1
mcall 12, 1 mcall 12, 1
mcall 48, 4 ; get skin height mcall 48, 4 ; get skin height
mov ecx, 300*0x10000+184 mov ecx, 200*0x10000+PANEL_Y+33
add ecx, eax add ecx, eax
mov edx, 0x34000000 mov ebx, 200*0x10000+BUTTON_SPACE*16+TABLE_BEGIN_X+TABLE_BEGIN_X+9
or edx, [sys_colors.work] mcall 0, , , 0x34AAAaaa, 0x80000000, window_title
mov esi, 0x80000000 test [proc_info.wnd_state], 0x04
or esi, [sys_colors.grab_text] jnz @f
mcall 0, <300,315>, , , , window_title
test [proc_info.wnd_state], 0x04 stdcall draw_table, 1
jnz @f call draw_codes
stdcall draw_page_switcher, 0
stdcall draw_table, 1
call draw_codes @@:
stdcall draw_page_switcher, 0 mcall 12, 2
jmp still
@@:
mcall 12, 2 key:
jmp still mcall 2
cmp ah, 0x09 ; TAB key
key: je button.switch_page
mcall 2
cmp ah, 0x09 ; TAB key cmp ah, 0xB0 ; left
je button.switch_page jne @f
mov bl, [symbol_focused]
cmp ah, 0xB0 ; left mov [symbol_unfocused], bl
jne @f dec bl
mov bl, [symbol_focused] and bl, 0x0f
mov [symbol_unfocused], bl and [symbol_focused], 0xf0
dec bl or [symbol_focused], bl
and bl, 0x0f stdcall draw_table, 0
and [symbol_focused], 0xf0 call draw_codes
or [symbol_focused], bl jmp still
stdcall draw_table, 0
call draw_codes @@: cmp ah, 0xB1 ; down
jmp still jne @f
mov bl, [symbol_focused]
@@: cmp ah, 0xB1 ; down mov [symbol_unfocused], bl
jne @f add bl, 16
mov bl, [symbol_focused] and bl, 0x70
mov [symbol_unfocused], bl and [symbol_focused], 0x8f
add bl, 16 or [symbol_focused], bl
and bl, 0x70 stdcall draw_table, 0
and [symbol_focused], 0x8f call draw_codes
or [symbol_focused], bl jmp still
stdcall draw_table, 0
call draw_codes @@: cmp ah, 0xB2 ; up
jmp still jne @f
mov bl, [symbol_focused]
@@: cmp ah, 0xB2 ; up mov [symbol_unfocused], bl
jne @f sub bl, 16
mov bl, [symbol_focused] and bl, 0x70
mov [symbol_unfocused], bl and [symbol_focused], 0x8f
sub bl, 16 or [symbol_focused], bl
and bl, 0x70 stdcall draw_table, 0
and [symbol_focused], 0x8f call draw_codes
or [symbol_focused], bl jmp still
stdcall draw_table, 0
call draw_codes @@: cmp ah, 0xB3 ; righ
jmp still jne @f
mov bl, [symbol_focused]
@@: cmp ah, 0xB3 ; righ mov [symbol_unfocused], bl
jne @f inc bl
mov bl, [symbol_focused] and bl, 0x0f
mov [symbol_unfocused], bl and [symbol_focused], 0xf0
inc bl or [symbol_focused], bl
and bl, 0x0f stdcall draw_table, 0
and [symbol_focused], 0xf0 call draw_codes
or [symbol_focused], bl jmp still
stdcall draw_table, 0 jne @f
call draw_codes
jmp still @@:
jne @f jmp still
@@:
jmp still
proc draw_table _full_redraw
mov al, [symbol_start]
proc draw_table _full_redraw mov [symbol_current], al
mov al, [symbol_start] .next_button:
mov [symbol_current], al
xor edi, edi ; character focus flag
.next_button: mov al, [symbol_current]
cmp al, [symbol_focused]
xor edi, edi ; character focus flag jne @f
mov al, [symbol_current] inc edi
cmp al, [symbol_focused] @@: cmp [_full_redraw], 1
jne @f je .draw
inc edi cmp al, [symbol_focused]
@@: cmp [_full_redraw], 1 je .draw
je .draw cmp al, [symbol_unfocused] ; previously focused, should redraw to clear focus
cmp al, [symbol_focused] je .draw
je .draw jmp .skip ; skip button if it isn't (un)focused
cmp al, [symbol_unfocused] ; previously focused, should redraw to clear focus
je .draw .draw:
jmp .skip ; skip button if it isn't (un)focused call draw_button
.skip:
.draw: mov bl, [symbol_start]
call draw_button add bl, 127 ; end of current page
.skip: cmp [symbol_current], bl ; the last on page?
mov bl, [symbol_start] jne @f
add bl, 127 ; end of current page mov [button_x], TABLE_BEGIN_X
cmp [symbol_current], bl ; the last on page? mov [button_y], TABLE_BEGIN_Y
jne @f ret
mov [button_x], TABLE_BEGIN_X @@: inc [symbol_current]
mov [button_y], TABLE_BEGIN_Y add [button_x], BUTTON_SPACE
ret cmp [button_x], BUTTON_SPACE*16+TABLE_BEGIN_X ; the last in row?
@@: inc [symbol_current] jne .next_button
add [button_x], BUTTON_SPACE add [button_y], BUTTON_SPACE ; next row
cmp [button_x], 306 ; the last in row? mov [button_x], TABLE_BEGIN_X
jne .next_button jmp .next_button
add [button_y], BUTTON_SPACE ; next row ret
mov [button_x], TABLE_BEGIN_X endp
jmp .next_button
ret
endp proc draw_button
mov edx, 0x80000000
mov dl, [symbol_current]
proc draw_button add edx, BUTTON_ID_SHIFT
mov ebx, [button_x] mov esi, 0xFFFfff
shl ebx, 16 mcall 8, <[button_x],BUTTON_SIDE>, <[button_y],BUTTON_SIDE>
mov bx, BUTTON_SIDE and edx, 0x7FFFFFFF
mov ecx, [button_y] or edx, 0x20000000
shl ecx, 16 mcall
mov cx, BUTTON_SIDE
mov edx, 0x80000000 test edi, edi ; is focused?
mov dl, [symbol_current] jz .symbol ; draw only character, not selection square
add edx, BUTTON_ID_SHIFT .focus_frame: ; draw a blue square (selection), 8 segments
mcall 8, , , mov esi, [button_x]
and edx, 0x7FFFFFFF mov edi, [button_y]
or edx, 0x20000000
mcall , , , , [sys_colors.work_button] mov bx, si
shl ebx, 16
test edi, edi ; is focused? mov bx, si
jz .symbol ; draw only character, not selection square add bx, BUTTON_SIDE
.focus_frame: ; draw a blue square (selection), 8 segments mov cx, di
mov esi, [button_x] shl ecx, 16
mov edi, [button_y] mov cx, di
mcall 38, , , FOCUS_SQUARE_COLOR
mov bx, si add ecx, 0x00010001
shl ebx, 16 mcall
mov bx, si add ecx, (BUTTON_SIDE-2)*0x10000+(BUTTON_SIDE-2)
add bx, BUTTON_SIDE mcall
mov cx, di add ecx, 0x00010001
shl ecx, 16 mcall
mov cx, di
mcall 38, , , FOCUS_SQUARE_COLOR mov bx, si
add ecx, 0x00010001 shl ebx, 16
mcall mov bx, si
add ecx, (BUTTON_SIDE-2)*0x10000+(BUTTON_SIDE-2) mov cx, di
mcall shl ecx, 16
add ecx, 0x00010001 mov cx, di
mcall add ecx, 2*0x10000+(BUTTON_SIDE-2)
mcall 38, , ,
mov bx, si add ebx, 0x00010001
shl ebx, 16 mcall
mov bx, si add ebx, (BUTTON_SIDE-2)*0x10000+(BUTTON_SIDE-2)
mov cx, di mcall
shl ecx, 16 add ebx, 0x00010001
mov cx, di mcall
add ecx, 2*0x10000+(BUTTON_SIDE-2)
mcall 38, , , .symbol:
add ebx, 0x00010001 mov ebx, [button_x]
mcall add ebx, 9
add ebx, (BUTTON_SIDE-2)*0x10000+(BUTTON_SIDE-2) shl ebx, 16
mcall add ebx, [button_y]
add ebx, 0x00010001 add ebx, 7
mcall mcall 4, , 0x01000000, symbol_current, 1
.symbol: ret
mov ebx, [button_x] endp
add ebx, 6
shl ebx, 16
add ebx, [button_y] proc draw_page_switcher _blinking
add ebx, 5
mcall 4, , [sys_colors.work_button_text], symbol_current, 1 mcall 8, , , 0x8000FFAA
mov esi, 0xCCCccc
ret cmp [_blinking], 1 ; blinking?
endp jne @f
mov esi, SWITCHER_BLINK_COLOR
@@: mcall , <2,98>, <PANEL_Y+1,23>, 0x2000FFAA
proc draw_page_switcher _blinking
mov ecx, 0x81000000
mcall 8, , , 0x8000FFAA mov edx, string_000_127
cmp [symbol_start], 0 ; first page?
mov esi, [sys_colors.work_button] je @f
cmp [_blinking], 1 ; blinking? mov edx, string_128_255 ; ok, the second one
jne @f @@: mcall 4, <10,PANEL_Y+6>,
mov esi, PAGE_SWITCHER_BLINK_COLOR mcall , <115,PANEL_Y+6>, 0x81000000, string_ASCII_CODE
@@: mcall , <2,60>, <157,19>, 0x2000FFAA
ret
mov ecx, 0x80000000 endp
or ecx, [sys_colors.work_button_text]
mov edx, string_000_127
cmp [symbol_start], 0 ; first page? proc draw_codes
je @f
mov edx, string_128_255 ; ok, the second one movzx ecx, [symbol_focused]
@@: mcall 4, <11,164>, mcall 47, 0x00030000, , <250,PANEL_Y+6>, 0x41000000, 0xAAAaaa
ret mcall , 0x00020100, , <500,PANEL_Y+6>,
endp
ret
endp
proc draw_codes
mov ecx, 0x80000000 quit:
or ecx, [sys_colors.work_text] mcall -1
mcall 4, <80,164>, , string_ASCII_CODE
mcall , <180,164>, , string_ASCII_HEX_CODE
movzx ecx, [symbol_focused] szZ window_title ,'ASCIIVju'
mov esi, 0x40000000 szZ string_000_127 ,'000-127'
or esi, [sys_colors.work_text] szZ string_128_255 ,'128-255'
mcall 47, 0x00030000, , <152,164>, , [sys_colors.work] szZ string_ASCII_CODE ,'ASCII Code: ASCII Hex-Code:'
mcall , 0x00020100, , <276,164>,
button_x dd 2
ret button_y dd 2
endp
symbol_current db 0
symbol_start db 0
quit:
mcall -1 symbol_unfocused db 0
symbol_focused db 0
i_end:
szZ window_title ,'ASCIIVju v0.4' proc_info process_information
szZ string_000_127 ,'000-127' rb 0x400 ;stack
szZ string_128_255 ,'128-255' e_end:
szZ string_ASCII_CODE ,'ASCII Code: '
szZ string_ASCII_HEX_CODE ,'ASCII Hex-Code: '
button_x dd 2
button_y dd 2
symbol_current db 0
symbol_start db 0
symbol_unfocused db 0
symbol_focused db 0
i_end:
proc_info process_information
sys_colors system_colors
rb 0x400 ;stack
e_end:

View File

@ -195,20 +195,27 @@ MSGMouse:
mov [MouseY],ecx mov [MouseY],ecx
mov [MouseX],ebx mov [MouseX],ebx
MOUSE_STATE_LMB_HOLD = $00000001
MOUSE_STATE_RMB_HOLD = $00000002
MOUSE_EVENT_LMB_DOWN = $00000100
MOUSE_EVENT_RMB_DOWN = $00000200
mcall 37,3 mcall 37,3
test eax,1b ; bit 0 is set = left button is held ;check LMB is pressed
jnz @f test eax, MOUSE_STATE_LMB_HOLD
jmp CheckRB jz @f
test eax, MOUSE_EVENT_LMB_DOWN
jz @f
jmp LButtonPress
@@: @@:
test eax,100000000b ; bit 8 is set = left button is pressed ;check RMB is pressed
jnz @f test eax, MOUSE_STATE_RMB_HOLD
jmp CheckRB jz @f
test eax, MOUSE_EVENT_RMB_DOWN
jz @f
jmp RButtonPress
@@: @@:
jnz LButtonPress jmp messages
CheckRB:
jnz RButtonPress
jmp messages
ErrLoadLibs: ErrLoadLibs:
;dps '婚 网<>ォョ碆 ァ<>」璢ァィ粮 ュ・ョ。螳、ィャ<EFBDA8> 。ィ。ォィョ筵ェィ' ;dps '婚 网<>ォョ碆 ァ<>」璢ァィ粮 ュ・ョ。螳、ィャ<EFBDA8> 。ィ。ォィョ筵ェィ'