Subversion Repositories Kolibri OS

Rev

Rev 1515 | Rev 1525 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1515 Rev 1524
Line 1... Line 1...
1
;   RTF READER FOR MENUET v1.
1
;   RTF READER FOR KOLIBRI >= 0.7.7.0
2
;   Written in pure assembler by Ivushkin Andrey aka Willow
2
;   Written in pure assembler by Ivushkin Andrey aka Willow
3
;   Menu_bar and scroll_bar from box_lib provided by dunkaist
3
;   Menu_bar and scroll_bar from box_lib provided by dunkaist
4
;---------------------------------------------------------------------
4
;---------------------------------------------------------------------
5
M64 equ 64*1024
5
M64 equ 64*1024
6
N_A equ 0x412f4e
6
N_A equ 0x412f4e
Line 102... Line 102...
102
 start2:
102
 start2:
103
    cmp  byte[fname_buf],0
103
    cmp  byte[fname_buf],0
104
    je   load_file;top_red
104
    je   load_file;top_red
105
    jmp  noactivate
105
    jmp  noactivate
106
 prep_load:
106
 prep_load:
-
 
107
    mov  [is_scroll_bar_needed],    0
107
;    mcall 18,3,dword[prcinfo+30]
108
;    mcall 18,3,dword[prcinfo+30]
108
 noactivate:
109
 noactivate:
109
;    and  ebp,not RTF_OPENING
110
;    and  ebp,not RTF_OPENING
110
;    and  ebp,not RTF_HELP
111
;    and  ebp,not RTF_HELP
Line 166... Line 167...
166
  key:                  ; ­ ¦ â  ª« ¢¨è  ­  ª« ¢¨ âãà¥
167
  key:                  ; ­ ¦ â  ª« ¢¨è  ­  ª« ¢¨ âãà¥
167
    mcall 2             ; äã­ªæ¨ï 2 - áç¨â âì ª®¤ ᨬ¢®«  (¢ ah)
168
    mcall 2             ; äã­ªæ¨ï 2 - áç¨â âì ª®¤ ᨬ¢®«  (¢ ah)
168
    cmp  ah,104         ; HELP
169
    cmp  ah,104         ; HELP
169
    jne  .nohelp
170
    jne  .nohelp
170
  .help:
171
  .help:
-
 
172
    mov  [is_scroll_bar_needed],    0
171
    xor  [mode],RTF_HELP
173
    xor  [mode],RTF_HELP
172
    test [mode],RTF_HELP
174
    test [mode],RTF_HELP
173
    jz   load_file
175
    jz   load_file
174
    mov  dword[HDoc],200                        ; it makes the help page not scroll
176
    mov  dword[HDoc],200                        ; it makes the help page not scroll
175
    mov  ecx,help_end-help_file
177
    mov  ecx,help_end-help_file
Line 219... Line 221...
219
    jmp  red
221
    jmp  red
220
  .nopi:
222
  .nopi:
221
    cmp  ah,180         ; Home
223
    cmp  ah,180         ; Home
222
    je   top_red
224
    je   top_red
Line 223... Line 225...
223
    
225
    
224
    cmp  byte[is_scroll_bar_needed], 0
226
    cmp  dword[is_scroll_bar_needed], 0
Line 225... Line 227...
225
     je  still
227
     je  still
226
    
228
    
227
    mov  ebx,dword[prcinfo+46]
229
    mov  ebx,dword[prcinfo+46]
228
    sub  ebx,TOP+15
230
    sub  ebx,TOP+15
229
    cmp  ah,183 ;PgDn
231
    cmp  ah,183 ;PgDn
Line 230... Line 232...
230
    jne  .nopgdn
232
    jne  .nopgdn
231
;    sub  [top],bx
233
;    sub  [top],bx
Line 232... Line 234...
232
 
234
 
233
    cmp  byte[is_scroll_bar_needed], 0
235
    cmp  dword[is_scroll_bar_needed], 0
234
     je  still
236
     je  still
Line 247... Line 249...
247
  .nopgdn:
249
  .nopgdn:
248
    cmp  ah,177 ;arrDn
250
    cmp  ah,177 ;arrDn
249
    jne  .noardn
251
    jne  .noardn
250
;    sub  [top],CHARH
252
;    sub  [top],CHARH
Line 251... Line 253...
251
 
253
 
252
    cmp  byte[is_scroll_bar_needed], 0
254
    cmp  dword[is_scroll_bar_needed], 0
Line 253... Line 255...
253
     je  still
255
     je  still
254
    
256
    
255
    mov  eax, [scroll_bar_data_vertical.position]
257
    mov  eax, [scroll_bar_data_vertical.position]
Line 273... Line 275...
273
;    jl   red
275
;    jl   red
274
;    mov  [top],TOP
276
;    mov  [top],TOP
275
;    cmp  cx,[top]
277
;    cmp  cx,[top]
276
;    je   still
278
;    je   still
Line 277... Line 279...
277
 
279
 
278
    cmp  byte[is_scroll_bar_needed], 0
280
    cmp  dword[is_scroll_bar_needed], 0
Line 279... Line 281...
279
     je  still
281
     je  still
280
    
282
    
281
    cmp  dword[scroll_bar_data_vertical.position], AR_OFFSET*7
283
    cmp  dword[scroll_bar_data_vertical.position], AR_OFFSET*7
Line 288... Line 290...
288
  .nopgup:
290
  .nopgup:
289
    cmp  ah,178 ;arrUp
291
    cmp  ah,178 ;arrUp
290
    jne  .noarup
292
    jne  .noarup
291
;    add  [top],CHARH
293
;    add  [top],CHARH
Line 292... Line 294...
292
 
294
 
293
    cmp  byte[is_scroll_bar_needed], 0
295
    cmp  dword[is_scroll_bar_needed], 0
Line 294... Line 296...
294
     je  still
296
     je  still
295
    
297
    
296
    cmp  dword[scroll_bar_data_vertical.position], AR_OFFSET
298
    cmp  dword[scroll_bar_data_vertical.position], AR_OFFSET
Line 327... Line 329...
327
  end if
329
  end if
328
    cmp  ah,0xB5        ; end
330
    cmp  ah,0xB5        ; end
329
    jne  .pre_file_open
331
    jne  .pre_file_open
330
  .end:
332
  .end:
Line 331... Line 333...
331
 
333
 
332
    cmp  byte[is_scroll_bar_needed], 0
334
    cmp  dword[is_scroll_bar_needed], 0
Line -... Line 335...
-
 
335
     je  still
-
 
336
    
333
     je  still
337
    mov  eax, [scroll_bar_data_vertical.max_area]
334
    
338
    sub  eax, [scroll_bar_data_vertical.cur_area]
335
    mov  dword[scroll_bar_data_vertical.position], 250
339
    mov  dword[scroll_bar_data_vertical.position], eax
336
    call Set_position
340
    call Set_position
337
    jmp  red
341
    jmp  red
338
  .pre_file_open:
342
  .pre_file_open:
Line 444... Line 448...
444
        cmp     [menu_data_3.cursor_out],dword 1
448
        cmp     [menu_data_3.cursor_out],dword 1
445
        je      key.help
449
        je      key.help
446
        jmp     red
450
        jmp     red
Line 447... Line 451...
447
 
451
 
448
.scroll_bar:
452
.scroll_bar:
449
        cmp     [is_scroll_bar_needed], 0
453
        cmp     dword[is_scroll_bar_needed], 0
450
        je      still
454
        je      still
451
.vertical:
455
.vertical:
452
        mov     eax,[scroll_bar_data_vertical.max_area]
456
        mov     eax,[scroll_bar_data_vertical.max_area]
453
        cmp     eax,[scroll_bar_data_vertical.cur_area]
457
        cmp     eax,[scroll_bar_data_vertical.cur_area]
Line 474... Line 478...
474
;---  Ž…„…‹…ˆ… ˆ Ž’ˆ‘Ž‚Š€ ŽŠ€  ----------------------------------
478
;---  Ž…„…‹…ˆ… ˆ Ž’ˆ‘Ž‚Š€ ŽŠ€  ----------------------------------
475
;---------------------------------------------------------------------
479
;---------------------------------------------------------------------
Line 476... Line 480...
476
 
480
 
Line -... Line 481...
-
 
481
draw_window:
-
 
482
 
-
 
483
    mcall 9, procinfo2, -1
-
 
484
    mov  edx, -1
-
 
485
    mov  esi, -1
-
 
486
    
-
 
487
    mov  eax, [procinfo2.box.width]
-
 
488
    cmp  eax, 140
-
 
489
     je  @f
-
 
490
    mov  [is_scroll_bar_needed],    0
-
 
491
     jg  @f
-
 
492
    mov  edx, 140
-
 
493
  @@:
-
 
494
 
-
 
495
    mov  eax, [procinfo2.box.height]
-
 
496
    cmp  eax, 80
-
 
497
     je  @f
-
 
498
    mov  [is_scroll_bar_needed],    0
-
 
499
     jg  @f
-
 
500
    mov  esi, 80
477
draw_window:
501
  @@:
Line -... Line 502...
-
 
502
 
478
 
503
    mcall 67, -1, -1
479
    mcall 12, 1
504
 
480
 
505
    mcall 12, 1
-
 
506
;    mcall 0, <10,WINW>, <100,WINH>, WIN_COLOR,0x805080D0, 0x005080D0
-
 
507
;    mcall 4, <8,8>, 0x10DDEEFF, title, titlesize-title
-
 
508
    mcall 0, <10,WINW>, <100,WINH>, WIN_COLOR,0x80000000, window_title
-
 
509
;---------------------------------------------
-
 
510
    cmp  [is_scroll_bar_needed],    0
-
 
511
     je  @f
-
 
512
    call Set_scroll_position
-
 
513
        xor     eax,eax
-
 
514
        inc     eax
-
 
515
        mov     [scroll_bar_data_vertical.all_redraw],eax
-
 
516
; draw for Vertical ScrollBar
-
 
517
        push    dword scroll_bar_data_vertical
-
 
518
        call    [scrollbar_ver_draw]
481
;    mcall 0, <10,WINW>, <100,WINH>, WIN_COLOR,0x805080D0, 0x005080D0
519
; reset all_redraw flag 
-
 
520
        xor     eax,eax
482
;    mcall 4, <8,8>, 0x10DDEEFF, title, titlesize-title
521
        mov     [scroll_bar_data_vertical.all_redraw],eax
483
    mcall 0, <10,WINW>, <100,WINH>, WIN_COLOR,0x80000000, window_title
522
  @@:
484
 
523
;---------------------------------------------
485
    mov  esi,ecx
524
    mov  esi,ecx
486
    mcall 47,0x30000,isymImplemented,<114,8>
525
    mcall 47,0x30000,isymImplemented,<114,8>
487
    add  edx,36 shl 16
526
    add  edx,36 shl 16
488
    mcall ,,isymMax
527
    mcall ,,isymMax
489
    add  edx,40 shl 16
528
    add  edx,40 shl 16
490
    mov  esi,0x104e00e7;0x10f27840
529
    mov  esi,0x104e00e7;0x10f27840
491
    cmp  dword[fileinfo.name],N_A
530
    cmp  dword[fileinfo.name],N_A
492
    jne  .noNA
531
    jne  .noNA
493
    mov  esi,0x10ff0000
532
    mov  esi,0x10ff0000
494
  .noNA:
533
  .noNA:
495
    mcall 4,edx,esi,fileinfo.name,[fname_size]
534
;    mcall 4,edx,esi,fileinfo.name,[fname_size]
496
    mov  edi,prcinfo
535
    mov  edi,prcinfo
497
    mcall 9,edi,-1
536
    mcall 9,edi,-1
Line 506... Line 545...
506
    and  [line_count],0
545
    and  [line_count],0
507
;    mov  [HClick],-100
546
;    mov  [HClick],-100
508
  .nochg:
547
  .nochg:
Line 509... Line 548...
509
 
548
 
510
;---------------------------------------------
-
 
511
    mov eax, dword[prcinfo+0x3E]
549
;---------------------------------------------
512
    sub eax, scroll_width_size
-
 
513
    mov word[scroll_bar_data_vertical.start_x], ax
-
 
514
 
-
 
515
    mov eax, dword[prcinfo+0x42]
-
 
516
    sub eax, 17
-
 
Line 517... Line 550...
517
    mov word[scroll_bar_data_vertical.size_y], ax
550
    call  Set_scroll_position
518
 
551
 
519
    mov ebx, dword[prcinfo+0x3E]
552
    mov ebx, dword[prcinfo+0x3E]
520
    mcall     38, , 65536*18+18, 0x8b8b89
553
    mcall     38, , 65536*18+18, 0x8b8b89
Line 611... Line 644...
611
    loop .l0
644
    loop .l0
612
 end if
645
 end if
613
 .ex:
646
 .ex:
614
call Set_position
647
call Set_position
615
;---------------------------------------------
648
;---------------------------------------------
616
    cmp  [is_scroll_bar_needed], 0
649
    cmp  dword[is_scroll_bar_needed], 0
617
     je  @f
650
     je  @f
618
        xor     eax,eax
651
        xor     eax,eax
619
        inc     eax
652
        inc     eax
620
        mov     [scroll_bar_data_vertical.all_redraw],eax
653
        mov     [scroll_bar_data_vertical.all_redraw],eax
621
; draw for Vertical ScrollBar
654
; draw for Vertical ScrollBar
Line 629... Line 662...
629
    mcall 12, 2
662
    mcall 12, 2
630
    ret
663
    ret
Line 631... Line 664...
631
 
664
 
632
;---------------------------------------------------------------------
665
;---------------------------------------------------------------------
633
Set_position:
-
 
634
 
666
Set_position:
635
    mov  eax, dword[prcinfo+46]
667
    mov  eax, dword[prcinfo+46]
636
    cmp  eax, [HDoc]
668
    cmp  eax, [HDoc]
637
    mov  byte[is_scroll_bar_needed], 0
669
    mov  dword[is_scroll_bar_needed], 0
638
     jnl .quit
670
     jnl .quit
Line 639... Line 671...
639
    mov  byte[is_scroll_bar_needed], 1
671
    mov  dword[is_scroll_bar_needed], 1
640
 
672
 
641
    mov  eax, [scroll_bar_data_vertical.max_area]
673
    mov  eax, [scroll_bar_data_vertical.max_area]
642
    mul  dword[prcinfo+46]
674
    mul  dword[prcinfo+46]
Line 648... Line 680...
648
    mov  dword[scroll_bar_data_vertical.cur_area], eax
680
    mov  dword[scroll_bar_data_vertical.cur_area], eax
649
  @@:
681
  @@:
650
    mov eax, [HDoc]
682
    mov eax, [HDoc]
651
    cmp eax, dword[prcinfo+46]
683
    cmp eax, dword[prcinfo+46]
652
    sub eax, dword[prcinfo+46]
684
    sub eax, dword[prcinfo+46]
653
    add eax, 100                    ; height of clear area under text when you are at the end of document
685
    add eax, 20                    ; height of clear area under text when you are at the end of document
654
     jg @f
686
     jg @f
655
    mov eax, 0
687
    mov eax, 0
656
  @@:
688
  @@:
657
    mul [scroll_bar_data_vertical.position]
689
    mul [scroll_bar_data_vertical.position]
658
    mov ebx, [scroll_bar_data_vertical.max_area]
690
    mov ebx, [scroll_bar_data_vertical.max_area]
Line 663... Line 695...
663
    sub dword[top], eax
695
    sub dword[top], eax
Line 664... Line 696...
664
    
696
    
665
  .quit:
697
  .quit:
666
    ret
698
    ret
-
 
699
;---------------------------------------------------------------------
-
 
700
Set_scroll_position:
-
 
701
    mcall 9, procinfo2, -1
-
 
702
    mov eax, dword[procinfo2+0x3E]
-
 
703
    sub eax, scroll_width_size
-
 
704
    mov word[scroll_bar_data_vertical.start_x], ax
-
 
705
 
-
 
706
    mov eax, dword[procinfo2+0x42]
-
 
707
    sub eax, 17
-
 
708
    mov word[scroll_bar_data_vertical.size_y], ax
-
 
709
    
-
 
710
    ret
-
 
711
;---------------------------------------------------------------------
667
;---------------------------------------------------------------------
712
 
668
if GUTTER eq 1
713
if GUTTER eq 1
669
   arrow db 0x19
714
   arrow db 0x19
670
end if
715
end if
671
;---------------------------------------------------------------------
716
;---------------------------------------------------------------------
672
;---  „€›… Žƒ€ŒŒ›  ----------------------------------------------
717
;---  „€›… Žƒ€ŒŒ›  ----------------------------------------------
Line 673... Line 718...
673
;---------------------------------------------------------------------
718
;---------------------------------------------------------------------
674
 
719
 
Line 675... Line 720...
675
; ¨­â¥àä¥©á ¯à®£à ¬¬ë ¬­®£®ï§ëç­ë©
720
; ¨­â¥àä¥©á ¯à®£à ¬¬ë ¬­®£®ï§ëç­ë©
676
;  ‚ë ¬®¦¥â¥ § ¤ âì ï§ëª ¢ MACROS.INC (lang fix ï§ëª)
721
;  ‚ë ¬®¦¥â¥ § ¤ âì ï§ëª ¢ MACROS.INC (lang fix ï§ëª)
677
 
722
 
678
window_title:           db      'RtfRead v1.033',0
723
window_title:           db      'RtfRead v1.034',0
679
buf_cmd_lin             rb      0
724
buf_cmd_lin             dd      0x0
Line 680... Line 725...
680
is_scroll_bar_needed    db      0
725
is_scroll_bar_needed    dd      0x0
681
;---------------------------------------------------------------------
726
;---------------------------------------------------------------------
Line 682... Line 727...
682
l_libs_start:
727
l_libs_start:
683
 
728
 
Line 684... Line 729...
684
library01  l_libs system_dir_ProcLib+9, cur_dir_path, library_path, system_dir_ProcLib, \
729
library01  l_libs system_dir_ProcLib+9, cur_dir_path, library_path, system_dir_ProcLib, \
685
err_message_found_lib2, head_f_l, ProcLib_import, err_message_import2, head_f_i
730
err_message_found_lib2, head_f_l, ProcLib_import, err_message_import2, head_f_i
686
 
731
 
Line 774... Line 819...
774
  Zoomscale dd 1.15
819
  Zoomscale dd 1.15
775
  FreeFontscale dd 0.04
820
  FreeFontscale dd 0.04
776
end if
821
end if
777
  Free BGIfree FONT_NAME,0,0,1.0,1.0,char,1,0x44000000,0
822
  Free BGIfree FONT_NAME,0,0,1.0,1.0,char,1,0x44000000,0
778
end if
823
end if
779
I_END0:
824
;I_END0:
780
fname_buf:
825
fname_buf:
781
        rb      1024+16
826
        rb      1024+16
782
fileattr rd 40/4
827
fileattr rd 40/4
783
if BENCH eq 1
828
if BENCH eq 1
784
  bench dd ?
829
  bench dd ?
Line 1035... Line 1080...
1035
.position2      dd 0    ;+72
1080
.position2      dd 0    ;+72
1036
.work_size      dd 0    ;+76
1081
.work_size      dd 0    ;+76
1037
.all_redraw     dd 0    ;+80
1082
.all_redraw     dd 0    ;+80
1038
.ar_offset      dd AR_OFFSET   ;+84
1083
.ar_offset      dd AR_OFFSET   ;+84
1039
;---------------------------------------------------------------------
1084
;---------------------------------------------------------------------
-
 
1085
I_END0:
1040
I_END:                             ; ¬¥âª  ª®­æ  ¯à®£à ¬¬ë
1086
I_END:                             ; ¬¥âª  ª®­æ  ¯à®£à ¬¬ë
Line 1041... Line 1087...
1041
 
1087
 
1042
procinfo process_information
1088
procinfo process_information
1043
rb RTFSIZE
1089
rb RTFSIZE
1044
esp1:
1090
esp1:
1045
rb ESPSIZE
-
 
1046
sys_mem:
1091
rb ESPSIZE
1047
rb ESPSIZE
1092
procinfo2 process_information
1048
;---------------------------------------------------------------------
1093
;---------------------------------------------------------------------
1049
temp_dir_pach:
1094
temp_dir_pach:
1050
        rb 4096
1095
        rb 4096
1051
cur_dir_path:
1096
cur_dir_path:
1052
        rb 4096
1097
        rb 4096
1053
library_path:
1098
library_path:
1054
        rb 4096
1099
        rb 4096
-
 
1100
;---------------------------------------------------------------------
1055
;---------------------------------------------------------------------
1101
    rb ESPSIZE                      ;stack
-
 
1102
esp_end: