Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 1523 → Rev 1524

/programs/other/rtfread/trunk/reader.rtf
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;
\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
\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 }\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
/programs/other/rtfread/trunk/rtfread.asm
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
; Menu_bar and scroll_bar from box_lib provided by dunkaist
;---------------------------------------------------------------------
104,6 → 104,7
je load_file;top_red
jmp noactivate
prep_load:
mov [is_scroll_bar_needed], 0
; mcall 18,3,dword[prcinfo+30]
noactivate:
; and ebp,not RTF_OPENING
168,6 → 169,7
cmp ah,104 ; HELP
jne .nohelp
.help:
mov [is_scroll_bar_needed], 0
xor [mode],RTF_HELP
test [mode],RTF_HELP
jz load_file
221,7 → 223,7
cmp ah,180 ; Home
je top_red
cmp byte[is_scroll_bar_needed], 0
cmp dword[is_scroll_bar_needed], 0
je still
mov ebx,dword[prcinfo+46]
230,7 → 232,7
jne .nopgdn
; sub [top],bx
 
cmp byte[is_scroll_bar_needed], 0
cmp dword[is_scroll_bar_needed], 0
je still
mov eax, [scroll_bar_data_vertical.position]
249,7 → 251,7
jne .noardn
; sub [top],CHARH
 
cmp byte[is_scroll_bar_needed], 0
cmp dword[is_scroll_bar_needed], 0
je still
mov eax, [scroll_bar_data_vertical.position]
275,7 → 277,7
; cmp cx,[top]
; je still
 
cmp byte[is_scroll_bar_needed], 0
cmp dword[is_scroll_bar_needed], 0
je still
cmp dword[scroll_bar_data_vertical.position], AR_OFFSET*7
290,7 → 292,7
jne .noarup
; add [top],CHARH
 
cmp byte[is_scroll_bar_needed], 0
cmp dword[is_scroll_bar_needed], 0
je still
cmp dword[scroll_bar_data_vertical.position], AR_OFFSET
329,10 → 331,12
jne .pre_file_open
.end:
 
cmp byte[is_scroll_bar_needed], 0
cmp dword[is_scroll_bar_needed], 0
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
jmp red
.pre_file_open:
446,7 → 450,7
jmp red
 
.scroll_bar:
cmp [is_scroll_bar_needed], 0
cmp dword[is_scroll_bar_needed], 0
je still
.vertical:
mov eax,[scroll_bar_data_vertical.max_area]
476,12 → 480,47
 
draw_window:
 
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 4, <8,8>, 0x10DDEEFF, title, titlesize-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
mcall 47,0x30000,isymImplemented,<114,8>
add edx,36 shl 16
492,7 → 531,7
jne .noNA
mov esi,0x10ff0000
.noNA:
mcall 4,edx,esi,fileinfo.name,[fname_size]
; mcall 4,edx,esi,fileinfo.name,[fname_size]
mov edi,prcinfo
mcall 9,edi,-1
and [mode],not RTF_TOEOF
508,14 → 547,8
.nochg:
 
;---------------------------------------------
mov eax, dword[prcinfo+0x3E]
sub eax, scroll_width_size
mov word[scroll_bar_data_vertical.start_x], ax
call Set_scroll_position
 
mov eax, dword[prcinfo+0x42]
sub eax, 17
mov word[scroll_bar_data_vertical.size_y], ax
 
mov ebx, dword[prcinfo+0x3E]
mcall 38, , 65536*18+18, 0x8b8b89
inc ebx
613,7 → 646,7
.ex:
call Set_position
;---------------------------------------------
cmp [is_scroll_bar_needed], 0
cmp dword[is_scroll_bar_needed], 0
je @f
xor eax,eax
inc eax
631,12 → 664,11
 
;---------------------------------------------------------------------
Set_position:
 
mov eax, dword[prcinfo+46]
cmp eax, [HDoc]
mov byte[is_scroll_bar_needed], 0
mov dword[is_scroll_bar_needed], 0
jnl .quit
mov byte[is_scroll_bar_needed], 1
mov dword[is_scroll_bar_needed], 1
 
mov eax, [scroll_bar_data_vertical.max_area]
mul dword[prcinfo+46]
650,7 → 682,7
mov eax, [HDoc]
cmp 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
mov eax, 0
@@:
665,6 → 697,19
.quit:
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
arrow db 0x19
end if
675,9 → 720,9
; ¨­â¥àä¥©á ¯à®£à ¬¬ë ¬­®£®ï§ëç­ë©
; ‚ë ¬®¦¥â¥ § ¤ âì ï§ëª ¢ MACROS.INC (lang fix ï§ëª)
 
window_title: db 'RtfRead v1.033',0
buf_cmd_lin rb 0
is_scroll_bar_needed db 0
window_title: db 'RtfRead v1.034',0
buf_cmd_lin dd 0x0
is_scroll_bar_needed dd 0x0
;---------------------------------------------------------------------
l_libs_start:
 
684,7 → 729,7
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
 
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
 
end_l_libs:
776,7 → 821,7
end if
Free BGIfree FONT_NAME,0,0,1.0,1.0,char,1,0x44000000,0
end if
I_END0:
;I_END0:
fname_buf:
rb 1024+16
fileattr rd 40/4
1037,6 → 1082,7
.all_redraw dd 0 ;+80
.ar_offset dd AR_OFFSET ;+84
;---------------------------------------------------------------------
I_END0:
I_END: ; ¬¥âª  ª®­æ  ¯à®£à ¬¬ë
 
procinfo process_information
1043,8 → 1089,7
rb RTFSIZE
esp1:
rb ESPSIZE
sys_mem:
rb ESPSIZE
procinfo2 process_information
;---------------------------------------------------------------------
temp_dir_pach:
rb 4096
1053,4 → 1098,6
library_path:
rb 4096
;---------------------------------------------------------------------
rb ESPSIZE ;stack
esp_end:
sys_mem: