forked from KolibriOS/kolibrios
rtfread: fixed crash when the window was _too_ minimised, scroll_bar horrible blinking fixed, version 1.034
git-svn-id: svn://kolibrios.org@1524 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
90b65feb59
commit
3533831e62
@ -2,7 +2,7 @@
|
|||||||
\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;
|
\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;
|
||||||
\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}\pard\plain
|
\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}\pard\plain
|
||||||
\qc \li0\ri0\faauto\rin0\lin0 \fs24\cgrid\langnp1049 {\b\fs28\cf11 RTF Reader for KolibriOS
|
\qc \li0\ri0\faauto\rin0\lin0 \fs24\cgrid\langnp1049 {\b\fs28\cf11 RTF Reader for KolibriOS
|
||||||
\par }{\f36\fs20 \'e2\'e5\'f0\'f1\'e8\'ff 1}{\f1\fs20 .}{\f36\fs20 033}{\b\f1\fs20\cf11
|
\par }{\f36\fs20 \'e2\'e5\'f0\'f1\'e8\'ff 1}{\f1\fs20 .}{\f36\fs20 034}{\b\f1\fs20\cf11
|
||||||
\par }{\f36\fs20
|
\par }{\f36\fs20
|
||||||
\par }\pard \qr \li0\ri0\faauto\rin0\lin0 {\f36\fs20 \'ed\'e0\'ef\'e8\'f1\'e0\'ed \'ed\'e0 \'f7\'e8\'f1\'f2\'ee\'ec \'e0\'f1\'f1\'e5\'ec\'e1\'eb\'e5\'f0\'e5 \'c8\'e2\'f3\'f8\'ea\'e8\'ed\'fb\'ec \'c0\'ed\'e4\'f0
|
\par }\pard \qr \li0\ri0\faauto\rin0\lin0 {\f36\fs20 \'ed\'e0\'ef\'e8\'f1\'e0\'ed \'ed\'e0 \'f7\'e8\'f1\'f2\'ee\'ec \'e0\'f1\'f1\'e5\'ec\'e1\'eb\'e5\'f0\'e5 \'c8\'e2\'f3\'f8\'ea\'e8\'ed\'fb\'ec \'c0\'ed\'e4\'f0
|
||||||
\'e5\'e5\'ec}{\f1\fs20 aka Willow
|
\'e5\'e5\'ec}{\f1\fs20 aka Willow
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
; RTF READER FOR MENUET v1.
|
; RTF READER FOR KOLIBRI >= 0.7.7.0
|
||||||
; Written in pure assembler by Ivushkin Andrey aka Willow
|
; Written in pure assembler by Ivushkin Andrey aka Willow
|
||||||
; Menu_bar and scroll_bar from box_lib provided by dunkaist
|
; Menu_bar and scroll_bar from box_lib provided by dunkaist
|
||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
||||||
@ -104,6 +104,7 @@ load_libraries l_libs_start,end_l_libs
|
|||||||
je load_file;top_red
|
je load_file;top_red
|
||||||
jmp noactivate
|
jmp noactivate
|
||||||
prep_load:
|
prep_load:
|
||||||
|
mov [is_scroll_bar_needed], 0
|
||||||
; mcall 18,3,dword[prcinfo+30]
|
; mcall 18,3,dword[prcinfo+30]
|
||||||
noactivate:
|
noactivate:
|
||||||
; and ebp,not RTF_OPENING
|
; and ebp,not RTF_OPENING
|
||||||
@ -168,6 +169,7 @@ still:
|
|||||||
cmp ah,104 ; HELP
|
cmp ah,104 ; HELP
|
||||||
jne .nohelp
|
jne .nohelp
|
||||||
.help:
|
.help:
|
||||||
|
mov [is_scroll_bar_needed], 0
|
||||||
xor [mode],RTF_HELP
|
xor [mode],RTF_HELP
|
||||||
test [mode],RTF_HELP
|
test [mode],RTF_HELP
|
||||||
jz load_file
|
jz load_file
|
||||||
@ -221,7 +223,7 @@ still:
|
|||||||
cmp ah,180 ; Home
|
cmp ah,180 ; Home
|
||||||
je top_red
|
je top_red
|
||||||
|
|
||||||
cmp byte[is_scroll_bar_needed], 0
|
cmp dword[is_scroll_bar_needed], 0
|
||||||
je still
|
je still
|
||||||
|
|
||||||
mov ebx,dword[prcinfo+46]
|
mov ebx,dword[prcinfo+46]
|
||||||
@ -230,7 +232,7 @@ still:
|
|||||||
jne .nopgdn
|
jne .nopgdn
|
||||||
; sub [top],bx
|
; sub [top],bx
|
||||||
|
|
||||||
cmp byte[is_scroll_bar_needed], 0
|
cmp dword[is_scroll_bar_needed], 0
|
||||||
je still
|
je still
|
||||||
|
|
||||||
mov eax, [scroll_bar_data_vertical.position]
|
mov eax, [scroll_bar_data_vertical.position]
|
||||||
@ -249,7 +251,7 @@ still:
|
|||||||
jne .noardn
|
jne .noardn
|
||||||
; sub [top],CHARH
|
; sub [top],CHARH
|
||||||
|
|
||||||
cmp byte[is_scroll_bar_needed], 0
|
cmp dword[is_scroll_bar_needed], 0
|
||||||
je still
|
je still
|
||||||
|
|
||||||
mov eax, [scroll_bar_data_vertical.position]
|
mov eax, [scroll_bar_data_vertical.position]
|
||||||
@ -275,7 +277,7 @@ still:
|
|||||||
; cmp cx,[top]
|
; cmp cx,[top]
|
||||||
; je still
|
; je still
|
||||||
|
|
||||||
cmp byte[is_scroll_bar_needed], 0
|
cmp dword[is_scroll_bar_needed], 0
|
||||||
je still
|
je still
|
||||||
|
|
||||||
cmp dword[scroll_bar_data_vertical.position], AR_OFFSET*7
|
cmp dword[scroll_bar_data_vertical.position], AR_OFFSET*7
|
||||||
@ -290,7 +292,7 @@ still:
|
|||||||
jne .noarup
|
jne .noarup
|
||||||
; add [top],CHARH
|
; add [top],CHARH
|
||||||
|
|
||||||
cmp byte[is_scroll_bar_needed], 0
|
cmp dword[is_scroll_bar_needed], 0
|
||||||
je still
|
je still
|
||||||
|
|
||||||
cmp dword[scroll_bar_data_vertical.position], AR_OFFSET
|
cmp dword[scroll_bar_data_vertical.position], AR_OFFSET
|
||||||
@ -329,10 +331,12 @@ still:
|
|||||||
jne .pre_file_open
|
jne .pre_file_open
|
||||||
.end:
|
.end:
|
||||||
|
|
||||||
cmp byte[is_scroll_bar_needed], 0
|
cmp dword[is_scroll_bar_needed], 0
|
||||||
je still
|
je still
|
||||||
|
|
||||||
mov dword[scroll_bar_data_vertical.position], 250
|
mov eax, [scroll_bar_data_vertical.max_area]
|
||||||
|
sub eax, [scroll_bar_data_vertical.cur_area]
|
||||||
|
mov dword[scroll_bar_data_vertical.position], eax
|
||||||
call Set_position
|
call Set_position
|
||||||
jmp red
|
jmp red
|
||||||
.pre_file_open:
|
.pre_file_open:
|
||||||
@ -446,7 +450,7 @@ mouse:
|
|||||||
jmp red
|
jmp red
|
||||||
|
|
||||||
.scroll_bar:
|
.scroll_bar:
|
||||||
cmp [is_scroll_bar_needed], 0
|
cmp dword[is_scroll_bar_needed], 0
|
||||||
je still
|
je still
|
||||||
.vertical:
|
.vertical:
|
||||||
mov eax,[scroll_bar_data_vertical.max_area]
|
mov eax,[scroll_bar_data_vertical.max_area]
|
||||||
@ -476,12 +480,47 @@ mouse:
|
|||||||
|
|
||||||
draw_window:
|
draw_window:
|
||||||
|
|
||||||
mcall 12, 1
|
mcall 9, procinfo2, -1
|
||||||
|
mov edx, -1
|
||||||
|
mov esi, -1
|
||||||
|
|
||||||
|
mov eax, [procinfo2.box.width]
|
||||||
|
cmp eax, 140
|
||||||
|
je @f
|
||||||
|
mov [is_scroll_bar_needed], 0
|
||||||
|
jg @f
|
||||||
|
mov edx, 140
|
||||||
|
@@:
|
||||||
|
|
||||||
|
mov eax, [procinfo2.box.height]
|
||||||
|
cmp eax, 80
|
||||||
|
je @f
|
||||||
|
mov [is_scroll_bar_needed], 0
|
||||||
|
jg @f
|
||||||
|
mov esi, 80
|
||||||
|
@@:
|
||||||
|
|
||||||
|
mcall 67, -1, -1
|
||||||
|
|
||||||
|
mcall 12, 1
|
||||||
; mcall 0, <10,WINW>, <100,WINH>, WIN_COLOR,0x805080D0, 0x005080D0
|
; mcall 0, <10,WINW>, <100,WINH>, WIN_COLOR,0x805080D0, 0x005080D0
|
||||||
; mcall 4, <8,8>, 0x10DDEEFF, title, titlesize-title
|
; mcall 4, <8,8>, 0x10DDEEFF, title, titlesize-title
|
||||||
mcall 0, <10,WINW>, <100,WINH>, WIN_COLOR,0x80000000, window_title
|
mcall 0, <10,WINW>, <100,WINH>, WIN_COLOR,0x80000000, window_title
|
||||||
|
;---------------------------------------------
|
||||||
|
cmp [is_scroll_bar_needed], 0
|
||||||
|
je @f
|
||||||
|
call Set_scroll_position
|
||||||
|
xor eax,eax
|
||||||
|
inc eax
|
||||||
|
mov [scroll_bar_data_vertical.all_redraw],eax
|
||||||
|
; draw for Vertical ScrollBar
|
||||||
|
push dword scroll_bar_data_vertical
|
||||||
|
call [scrollbar_ver_draw]
|
||||||
|
; reset all_redraw flag
|
||||||
|
xor eax,eax
|
||||||
|
mov [scroll_bar_data_vertical.all_redraw],eax
|
||||||
|
@@:
|
||||||
|
;---------------------------------------------
|
||||||
mov esi,ecx
|
mov esi,ecx
|
||||||
mcall 47,0x30000,isymImplemented,<114,8>
|
mcall 47,0x30000,isymImplemented,<114,8>
|
||||||
add edx,36 shl 16
|
add edx,36 shl 16
|
||||||
@ -492,7 +531,7 @@ draw_window:
|
|||||||
jne .noNA
|
jne .noNA
|
||||||
mov esi,0x10ff0000
|
mov esi,0x10ff0000
|
||||||
.noNA:
|
.noNA:
|
||||||
mcall 4,edx,esi,fileinfo.name,[fname_size]
|
; mcall 4,edx,esi,fileinfo.name,[fname_size]
|
||||||
mov edi,prcinfo
|
mov edi,prcinfo
|
||||||
mcall 9,edi,-1
|
mcall 9,edi,-1
|
||||||
and [mode],not RTF_TOEOF
|
and [mode],not RTF_TOEOF
|
||||||
@ -508,13 +547,7 @@ draw_window:
|
|||||||
.nochg:
|
.nochg:
|
||||||
|
|
||||||
;---------------------------------------------
|
;---------------------------------------------
|
||||||
mov eax, dword[prcinfo+0x3E]
|
call Set_scroll_position
|
||||||
sub eax, scroll_width_size
|
|
||||||
mov word[scroll_bar_data_vertical.start_x], ax
|
|
||||||
|
|
||||||
mov eax, dword[prcinfo+0x42]
|
|
||||||
sub eax, 17
|
|
||||||
mov word[scroll_bar_data_vertical.size_y], ax
|
|
||||||
|
|
||||||
mov ebx, dword[prcinfo+0x3E]
|
mov ebx, dword[prcinfo+0x3E]
|
||||||
mcall 38, , 65536*18+18, 0x8b8b89
|
mcall 38, , 65536*18+18, 0x8b8b89
|
||||||
@ -613,7 +646,7 @@ end if
|
|||||||
.ex:
|
.ex:
|
||||||
call Set_position
|
call Set_position
|
||||||
;---------------------------------------------
|
;---------------------------------------------
|
||||||
cmp [is_scroll_bar_needed], 0
|
cmp dword[is_scroll_bar_needed], 0
|
||||||
je @f
|
je @f
|
||||||
xor eax,eax
|
xor eax,eax
|
||||||
inc eax
|
inc eax
|
||||||
@ -631,12 +664,11 @@ call Set_position
|
|||||||
|
|
||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
||||||
Set_position:
|
Set_position:
|
||||||
|
|
||||||
mov eax, dword[prcinfo+46]
|
mov eax, dword[prcinfo+46]
|
||||||
cmp eax, [HDoc]
|
cmp eax, [HDoc]
|
||||||
mov byte[is_scroll_bar_needed], 0
|
mov dword[is_scroll_bar_needed], 0
|
||||||
jnl .quit
|
jnl .quit
|
||||||
mov byte[is_scroll_bar_needed], 1
|
mov dword[is_scroll_bar_needed], 1
|
||||||
|
|
||||||
mov eax, [scroll_bar_data_vertical.max_area]
|
mov eax, [scroll_bar_data_vertical.max_area]
|
||||||
mul dword[prcinfo+46]
|
mul dword[prcinfo+46]
|
||||||
@ -650,7 +682,7 @@ Set_position:
|
|||||||
mov eax, [HDoc]
|
mov eax, [HDoc]
|
||||||
cmp eax, dword[prcinfo+46]
|
cmp eax, dword[prcinfo+46]
|
||||||
sub eax, dword[prcinfo+46]
|
sub eax, dword[prcinfo+46]
|
||||||
add eax, 100 ; height of clear area under text when you are at the end of document
|
add eax, 20 ; height of clear area under text when you are at the end of document
|
||||||
jg @f
|
jg @f
|
||||||
mov eax, 0
|
mov eax, 0
|
||||||
@@:
|
@@:
|
||||||
@ -665,6 +697,19 @@ Set_position:
|
|||||||
.quit:
|
.quit:
|
||||||
ret
|
ret
|
||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
||||||
|
Set_scroll_position:
|
||||||
|
mcall 9, procinfo2, -1
|
||||||
|
mov eax, dword[procinfo2+0x3E]
|
||||||
|
sub eax, scroll_width_size
|
||||||
|
mov word[scroll_bar_data_vertical.start_x], ax
|
||||||
|
|
||||||
|
mov eax, dword[procinfo2+0x42]
|
||||||
|
sub eax, 17
|
||||||
|
mov word[scroll_bar_data_vertical.size_y], ax
|
||||||
|
|
||||||
|
ret
|
||||||
|
;---------------------------------------------------------------------
|
||||||
|
|
||||||
if GUTTER eq 1
|
if GUTTER eq 1
|
||||||
arrow db 0x19
|
arrow db 0x19
|
||||||
end if
|
end if
|
||||||
@ -675,16 +720,16 @@ end if
|
|||||||
; ¨â¥àä¥©á ¯à®£à ¬¬ë ¬®£®ï§ëçë©
|
; ¨â¥àä¥©á ¯à®£à ¬¬ë ¬®£®ï§ëçë©
|
||||||
; ‚ë ¬®¦¥â¥ § ¤ âì ï§ëª ¢ MACROS.INC (lang fix ï§ëª)
|
; ‚ë ¬®¦¥â¥ § ¤ âì ï§ëª ¢ MACROS.INC (lang fix ï§ëª)
|
||||||
|
|
||||||
window_title: db 'RtfRead v1.033',0
|
window_title: db 'RtfRead v1.034',0
|
||||||
buf_cmd_lin rb 0
|
buf_cmd_lin dd 0x0
|
||||||
is_scroll_bar_needed db 0
|
is_scroll_bar_needed dd 0x0
|
||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
||||||
l_libs_start:
|
l_libs_start:
|
||||||
|
|
||||||
library01 l_libs system_dir_ProcLib+9, cur_dir_path, library_path, system_dir_ProcLib, \
|
library01 l_libs system_dir_ProcLib+9, cur_dir_path, library_path, system_dir_ProcLib, \
|
||||||
err_message_found_lib2, head_f_l, ProcLib_import, err_message_import2, head_f_i
|
err_message_found_lib2, head_f_l, ProcLib_import, err_message_import2, head_f_i
|
||||||
|
|
||||||
library02 l_libs system_dir_Boxlib+9, cur_dir_path, buf_cmd_lin, system_dir_Boxlib, \
|
library02 l_libs system_dir_Boxlib+9, cur_dir_path, library_path, system_dir_Boxlib, \
|
||||||
err_message_found_lib1, head_f_l, Box_lib_import, err_message_import1, head_f_i
|
err_message_found_lib1, head_f_l, Box_lib_import, err_message_import1, head_f_i
|
||||||
|
|
||||||
end_l_libs:
|
end_l_libs:
|
||||||
@ -776,7 +821,7 @@ else
|
|||||||
end if
|
end if
|
||||||
Free BGIfree FONT_NAME,0,0,1.0,1.0,char,1,0x44000000,0
|
Free BGIfree FONT_NAME,0,0,1.0,1.0,char,1,0x44000000,0
|
||||||
end if
|
end if
|
||||||
I_END0:
|
;I_END0:
|
||||||
fname_buf:
|
fname_buf:
|
||||||
rb 1024+16
|
rb 1024+16
|
||||||
fileattr rd 40/4
|
fileattr rd 40/4
|
||||||
@ -1037,14 +1082,14 @@ scroll_bar_data_vertical:
|
|||||||
.all_redraw dd 0 ;+80
|
.all_redraw dd 0 ;+80
|
||||||
.ar_offset dd AR_OFFSET ;+84
|
.ar_offset dd AR_OFFSET ;+84
|
||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
||||||
|
I_END0:
|
||||||
I_END: ; ¬¥âª ª®æ ¯à®£à ¬¬ë
|
I_END: ; ¬¥âª ª®æ ¯à®£à ¬¬ë
|
||||||
|
|
||||||
procinfo process_information
|
procinfo process_information
|
||||||
rb RTFSIZE
|
rb RTFSIZE
|
||||||
esp1:
|
esp1:
|
||||||
rb ESPSIZE
|
rb ESPSIZE
|
||||||
sys_mem:
|
procinfo2 process_information
|
||||||
rb ESPSIZE
|
|
||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
||||||
temp_dir_pach:
|
temp_dir_pach:
|
||||||
rb 4096
|
rb 4096
|
||||||
@ -1053,4 +1098,6 @@ cur_dir_path:
|
|||||||
library_path:
|
library_path:
|
||||||
rb 4096
|
rb 4096
|
||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
||||||
|
rb ESPSIZE ;stack
|
||||||
esp_end:
|
esp_end:
|
||||||
|
sys_mem:
|
||||||
|
Loading…
Reference in New Issue
Block a user