Subversion Repositories NedoOS

Rev

Rev 1135 | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
31 Alone 1
htmlview
42 DimkaM 2
        call showtime
3
 
32 Alone 4
        ld hl,(curprintvirtualy)
5
        ld (html_endy),hl
31 Alone 6
        call prcharmc_stateful_resethandler
34 Alone 7
        ;ld hl,0
8
        ;ld (html_curtopy),hl
31 Alone 9
 
32 Alone 10
        ld hl,(firstpointer)
11
        ld (htmlshowline_accessedpointer),hl
12
        ld a,(firstpointerHSB)
13
        ld (htmlshowline_accessedpointerHSB),a
14
 
31 Alone 15
html_redrawloop
500 alone 16
;redraw interface (TODO test)
17
        call cleanstatusline
18
        call browser_editline_print
19
 
31 Alone 20
        call htmlshowpage
21
        ;call setpgs_scr
22
 
23
html_mainloop
24
 
25
htmlcursorxy=$+1
26
        ld de,HTMLTOPY*256
27
        call html_setxy
28
        call setpgs_scr
29
        ld e,(hl)
30
        push de ;e=oldcolor
31
        ld a,0x38
32
        call html_prattr
33
 
444 alone 34
html_getkeyloop0
344 alone 35
        ;YIELD ;halt ;᫨ ᤥ  di:rst #38,  1.ᤢ ⠩  2.  ஢ 뢠,  ᫨  ei,   
32 Alone 36
        ;GET_KEY ;OS_GETKEYNOLANG
444 alone 37
        ; jr nz,html_getkeyloop0 ;no focus
32 Alone 38
        ;ld a,c ;keynolang        
39
        ;cp NOKEY
40
        call yieldgetkeynolang
31 Alone 41
        jr nz,html_mainloop_keyq
444 alone 42
;control_imer_oldmousecoords=$+1
43
;        ld bc,0
44
;        ld (control_imer_oldmousecoords),de
45
;        ld a,b
46
;        sub d
47
;        ld d,a
48
;        ld a,e
49
;        sub c
50
;        ld e,a
51
;        ld (control_imer_mousecoordsdelta),de
52
 
31 Alone 53
        ;call nvview_panel
444 alone 54
        jr html_getkeyloop0
55
;html_mainloop_keyq_nokey
56
;        xor a
31 Alone 57
html_mainloop_keyq
58
 
59
        pop de ;e=oldcolor
60
        push af
61
        push de
62
        ld de,(htmlcursorxy)
63
        call html_setxy
64
        pop de
65
        ld a,e
66
        call html_prattr
444 alone 67
 
68
control_imer_mousecoordsdelta=$+1
69
        ld de,0
70
        call html_mousemove
71
 
31 Alone 72
        pop af
73
        cp key_redraw
74
        jr z,html_redrawloop
116 alone 75
        ;cp key_esc
42 DimkaM 76
        ;jp z,browser_quit
77
        call globalbuttons
31 Alone 78
        ld hl,html_mainloop
79
        push hl
116 alone 80
        cp key_up
31 Alone 81
        jp z,html_up
444 alone 82
        cp key_up_scroll
83
        jp z,html_up_scroll
116 alone 84
        cp key_down
31 Alone 85
        jp z,html_down
444 alone 86
        cp key_down_scroll
87
        jp z,html_down_scroll
116 alone 88
        cp key_right
31 Alone 89
        jp z,html_right
116 alone 90
        cp key_left
31 Alone 91
        jp z,html_left
116 alone 92
        cp key_enter
73 Alone 93
        jp z,html_enter
31 Alone 94
        cp 'l'
33 Alone 95
        jr z,html_download
42 DimkaM 96
        ;cp 's'
97
        ;jp z,browser_downloadthis
98
        ;cp '5'
99
        ;jp z,browser_reload
33 Alone 100
        cp 'u'
101
        jr z,html_changeencoding
116 alone 102
        ;cp key_backspace
42 DimkaM 103
        ;jp z,browser_backspace
116 alone 104
        cp key_pgup
31 Alone 105
        jp z,html_pgup
116 alone 106
        cp key_pgdown
31 Alone 107
        jp z,html_pgdown
116 alone 108
        cp key_home
32 Alone 109
        jp z,html_home
116 alone 110
        cp key_end
32 Alone 111
        jp z,html_endkey
31 Alone 112
        ret
33 Alone 113
 
114
html_changeencoding
115
        ld hl,defaultunicodeflag
116
        ld a,(hl)
117
        xor 1
118
        ld (hl),a
119
        jp browser_reload
31 Alone 120
 
121
html_download
122
        call html_enter_find
73 Alone 123
        call keepcurlink
124
;linkbuf=relative link
125
        call makefulllink
126
;curfulllink=url
127
 
128
wgetloaded_pid=$+1
129
        ld a,0
130
        or a
131
        call z,reloadwget
132
 
344 alone 133
;TODO ஢,  wget :
74 Alone 134
        ld a,(wgetloaded_pid)
135
        ld e,a
875 alone 136
        OS_CHECKPID
74 Alone 137
        or a
875 alone 138
        call z,reloadwget ;dead
73 Alone 139
 
344 alone 140
; ⮢ wget
73 Alone 141
waitwgetinit0
142
        YIELD
143
wgetmainpg=$+1
144
        ld a,0
145
        SETPG32KHIGH
146
        ld a,(0xc000+COMMANDLINE)
147
        inc a
148
        jr z,waitwgetinit0
149
 
150
        ld hl,curfulllink
151
        ld de,0xc000+WGETBUF
152
        call strcopy
74 Alone 153
        ld a,0xff
344 alone 154
        ld (0xc000+COMMANDLINE),a ;ப  ⮢
73 Alone 155
 
156
        jp remembercurlink
157
        ;jp browser_godownload
158
 
159
reloadwget
241 alone 160
        call setpgtemp8000
161
        ld de,0x8000;oldpath
162
        OS_GETPATH
163
 
73 Alone 164
        OS_SETSYSDRV
165
        ld de,wgetfilename
166
        call openstream_file
167
        or a
168
        ret nz
241 alone 169
 
170
        ld de,0x8000;oldpath
171
        OS_CHDIR
172
 
344 alone 173
        OS_NEWAPP ;  ᮧ   祭 ⥪ ४!!!
73 Alone 174
        or a
175
        jr nz,html_download_closeq ;error
344 alone 176
;dehl= ࠭  0000,4000,8000,c000  ਫ, b=id, a=error
73 Alone 177
        push bc ;b=id
178
        ld a,d
179
        ld (wgetmainpg),a
180
        SETPG32KHIGH
181
        ;push de
182
        ;push hl
183
        ld hl,0xc000+COMMANDLINE
184
        ld (hl),0xff ;daemon mode
185
        inc hl
186
        ld (hl),0
187
        ;pop hl
188
        ;pop de
189
        ld de,0xc100
190
        ld hl,0x3f00
191
        call readstream_file
192
        pop af
193
        ld (wgetloaded_pid),a
194
        ld e,a ;e=id
195
        OS_RUNAPP
196
html_download_closeq
197
        jp closestream_file
198
 
31 Alone 199
html_enter
200
;click on href
201
        call html_enter_find
202
        jp browser_go
203
 
204
html_enter_find
205
        ld a,(htmlcursorxy+1)
206
        sub HTMLTOPY
207
        ld c,a
208
        ld b,0
209
        ld hl,(html_curtopy)
210
        add hl,bc
211
        ld (html_enter_virtualy),hl
212
 
32 Alone 213
         ;jr $
31 Alone 214
        ld hl,(first2pointer)
215
        ld a,(first2pointerHSB)
216
html_enter_find0
217
        call isnull
218
        jr z,html_enter_findq
219
        push af
220
        push hl
32 Alone 221
 
222
        if 1==0
223
 
31 Alone 224
        ld bc,HREF_Y
225
        add hl,bc
226
        adc a,0
227
        call readword ;de=beginy
228
        ex de,hl
229
html_enter_virtualy=$+1
230
        ld bc,0
231
        or a
32 Alone 232
        sbc hl,bc ;HREF_Y - y
31 Alone 233
        ex de,hl
344 alone 234
        jr z,html_enter_findlineok ; ࠢ쭮 뫪 HREF_Y<=y
32 Alone 235
         ;jr c,html_enter_findlineok_hrefy_lessthan_y
236
 
237
        endif
238
 
239
;for long linktexts: beginyx<=yx<endyx
344 alone 240
; ࢨ 䨫 (beginy<=y<=endy),  㤮
32 Alone 241
 
242
        ld bc,HREF_Y
243
        add hl,bc
244
        adc a,b;0
245
        call readword ;de=beginy
246
        call readbyte ;c=beginx
247
html_enter_virtualy=$+1
248
        ld hl,0
249
        ld a,(htmlcursorxy)
250
        ;hla=Yyx
251
        ;dec=beginYyx
252
        cp c
253
        sbc hl,de
254
        jr c,html_enter_findnext
255
        pop hl
256
        pop af
257
        push af
258
        push hl
259
        ld bc,HREF_ENDY
260
        add hl,bc
261
        adc a,b;0
262
        call readword ;de=endy
263
        call readbyte ;c=endx
264
        ld hl,(html_enter_virtualy)
265
        ld a,(htmlcursorxy)
266
        ;hla=Yyx
267
        ;dec=endYyx
268
        cp c
269
        sbc hl,de
270
        ;jr nc,html_enter_findnext
271
        jr c,html_enter_findok
272
 
31 Alone 273
html_enter_findnext
274
        pop hl
275
        pop af
276
        call getnextelement
277
        jr html_enter_find0
278
 
32 Alone 279
 
280
        if 1==0
281
 
282
html_enter_findlineok_hrefy_lessthan_y
283
 
284
 
31 Alone 285
html_enter_findlineok
286
        call readbyte ;c=beginx
287
        ld b,a
288
        ld a,(htmlcursorxy)
289
        cp c
290
        ld a,b
291
;x<beginx => fail
292
        jr c,html_enter_findnext
32 Alone 293
         ;jr $
31 Alone 294
        call readword ;de=endy
295
        push hl
296
        ld hl,(html_enter_virtualy)
297
        or a
298
        sbc hl,de
299
        pop hl
32 Alone 300
;y==endy => ok (long linktext)
31 Alone 301
        push af
302
        call readbyte ;c=endx
303
        pop af
32 Alone 304
        ;jr z,html_enter_findok_endy
31 Alone 305
 
306
        ld b,a
307
        ld a,(htmlcursorxy)
308
        cp c
309
        ld a,b
310
;x>=endx =>fail
32 Alone 311
        jr nc,html_enter_findnext
312
        ;jr html_enter_findok
313
 
314
html_enter_findok_endy
315
        endif
316
 
31 Alone 317
html_enter_findok
32 Alone 318
         ;pop bc
319
         ;pop bc
320
        ;call readbyte ;skip VISITED
321
 
322
         pop hl
323
         pop af
324
        ld bc,HREF_TEXT
325
        add hl,bc
326
        adc a,b;0
327
 
31 Alone 328
        ld de,linkbuf
329
html_enter_findok_copyname0
330
        call readbyte
331
        ex de,hl
332
        ld (hl),c
333
        inc hl
334
        ex de,hl
335
        inc c
336
        dec c
337
        jr nz,html_enter_findok_copyname0
1656 dimkam 338
 
32 Alone 339
         ;jr $
31 Alone 340
        ret
341
 
342
html_enter_findq
343
        pop af
344
        ret
345
 
346
html_prattr
347
        ld de,40
348
        ld b,8
349
html_prattr0
350
        ld (hl),a
351
        add hl,de
352
        djnz html_prattr0
353
        ret
354
 
355
html_setxy
356
;de=yx (kept)
357
        push de
358
        sla d
359
        sla d
360
        sla d
361
        call setxymc
362
        res 6,h
363
        pop de
364
        ret
365
 
366
html_left
367
        ld a,(htmlcursorxy)
368
        sub 1
369
        ret c
370
        ld (htmlcursorxy),a
371
        ret
372
 
373
html_right
374
        ld a,(htmlcursorxy)
375
        inc a
376
        cp 80
377
        ret nc
378
        ld (htmlcursorxy),a
379
        ret
444 alone 380
 
381
MOUSEFACTOR=8
382
html_mousemove
383
;de=mouse delta
384
;⮡   १,  ⤥쭮 ࠭ 訥  x,y ( ⮡ࠦ  ࠭)
385
        ld hl,(htmlcursorxy)
386
htmlcursorxylow=$+1
387
        ld bc,0 ;bits 7..5 (for Y) 7..6 (for X), others=0
388
        dup 3
389
        sla b
390
        rl h
391
        edup        
392
        ld a,h
393
        add a,d
394
        bit 7,d
395
        jr z,html_mousemove_yplus
396
        jr nc,html_mousemove_yminus_overflow
397
        cp HTMLTOPY*MOUSEFACTOR
398
        jr nc,html_mousemove_yq
399
html_mousemove_yminus_overflow
400
        ld a,HTMLTOPY*MOUSEFACTOR
401
        jr html_mousemove_yq
402
html_mousemove_yplus
403
        jr c,html_mousemove_yplus_overflow
404
        cp MOUSEFACTOR*(HTMLTOPY+HTMLHGT-1)
405
        jr c,html_mousemove_yq
406
html_mousemove_yplus_overflow
407
        ld a,MOUSEFACTOR*(HTMLTOPY+HTMLHGT-1)
408
html_mousemove_yq  
409
        srl a
410
        rr b
411
        rra
412
        rr b
413
        rra
414
        rr b
415
        ld (htmlcursorxy+1),a
416
 
417
        ld h,0
418
        sla c
419
        rl l
420
        sla c
421
        adc hl,hl
422
        ld a,e
423
        rla
424
        sbc a,a
425
        ld d,a
426
        add hl,de
427
        bit 7,e
428
        jr z,html_mousemove_xplus
429
        jr c,html_mousemove_xq
430
        ld hl,0 ;ld a,HTMLTOPY*MOUSEFACTOR
431
        jr html_mousemove_xq
432
html_mousemove_xplus
433
        ld de,MOUSEFACTOR/2*(80-1)
434
        jr c,html_mousemove_xplus_overflow
435
        ;or a
436
        sbc hl,de
437
        add hl,de
438
        jr c,html_mousemove_xq
439
html_mousemove_xplus_overflow
440
        ex de,hl
441
html_mousemove_xq
442
        ld a,l
443
        rr h
444
        rra
445
        rr c
446
        rra
447
        rr c
448
        ld (htmlcursorxy),a
449
 
450
        ld (htmlcursorxylow),bc
451
        ret
31 Alone 452
 
453
html_up
454
        ld a,(htmlcursorxy+1)
455
        cp HTMLTOPY
444 alone 456
        jr z,html_up_scroll1
31 Alone 457
        dec a
458
        ld (htmlcursorxy+1),a
459
        ret
460
html_up_scroll
444 alone 461
mouse_scrollvalue=$+1
1135 alone 462
        ld a,0 ;*-0x10
444 alone 463
html_up_scroll0
464
        push af
465
        call html_up_scroll1
466
        pop af
1135 alone 467
        add a,0x10;sub 0x10
444 alone 468
        jr nz,html_up_scroll0
469
        ret
470
html_up_scroll1
31 Alone 471
        ld hl,(html_curtopy)
472
        ld a,h
473
        or l
474
        ret z
475
        dec hl
476
        ld (html_curtopy),hl
477
        push hl
478
        call scrollmcdown
479
        pop hl
480
        ld d,HTMLTOPY
481
;hl=virtual Y
482
;d=scry
32 Alone 483
        jp htmlcleanshowline
31 Alone 484
 
485
html_down
486
        ld a,(htmlcursorxy+1)
487
        cp HTMLTOPY+HTMLHGT-1
444 alone 488
        jr z,html_down_scroll1
31 Alone 489
        inc a
490
        ld (htmlcursorxy+1),a
491
        ret
492
html_down_scroll
1135 alone 493
        ld a,(mouse_scrollvalue) ;*+0x10
444 alone 494
html_down_scroll0
495
        push af
496
        call html_down_scroll1
497
        pop af
1135 alone 498
        sub 0x10;add a,0x10
444 alone 499
        jr nz,html_down_scroll0
500
        ret
501
html_down_scroll1
31 Alone 502
        ld hl,(html_curtopy)
503
        inc hl
504
        ld (html_curtopy),hl
505
        push hl
506
        call scrollmcup
507
        pop hl
508
        ld bc,HTMLHGT-1
509
        add hl,bc
510
        ld d,HTMLTOPY+HTMLHGT-1
511
;hl=virtual Y
512
;d=scry
32 Alone 513
        jp htmlcleanshowline
31 Alone 514
 
515
html_pgup
516
        ld hl,(html_curtopy)
517
        ld bc,HTMLHGT-1
518
        xor a
519
        sbc hl,bc
520
        jr nc,$+4
521
        ld h,a
522
        ld l,a
32 Alone 523
topy_showpage_slearkeyboardbuffer
31 Alone 524
        ld (html_curtopy),hl
525
        call htmlshowpage
32 Alone 526
clear_keyboardbuffer
527
        push bc
528
        ld b,5
529
clear_keyboardbuffer0
530
        push bc
531
        GET_KEY
532
        pop bc
533
        djnz clear_keyboardbuffer0
534
        pop bc
31 Alone 535
        ret
536
 
537
html_pgdown
538
        ld hl,(html_curtopy)
539
        ld bc,HTMLHGT-1
540
        add hl,bc
32 Alone 541
        jr topy_showpage_slearkeyboardbuffer
542
        ;ld (html_curtopy),hl
543
        ;call htmlshowpage
544
        ;ret
31 Alone 545
 
32 Alone 546
html_home
547
        ld hl,0
548
        jr topy_showpage_slearkeyboardbuffer
549
 
550
html_endkey
551
html_endy=$+1
552
        ld hl,0
553
        jr topy_showpage_slearkeyboardbuffer
31 Alone 554
 
555
htmlshowpage
556
        ld d,HTMLTOPY
557
html_curtopy=$+1
558
        ld hl,0
559
htmlshowpage0
560
;hl=virtual Y
561
;d=scry
562
        call htmlcleanshowline
563
        inc hl
564
        inc d
565
        ld a,d
566
        cp HTMLTOPY+HTMLHGT
567
        jr nz,htmlshowpage0
568
        ret
569
 
570
htmlcleanshowline
571
;hl=virtual Y
572
;d=scry
573
        push de
574
        push hl
575
        ld e,0
576
        sla d
577
        sla d
578
        sla d
579
        call setxymc ;hl=0xc000+        
580
        call setpgs_scr
32 Alone 581
        xor a
31 Alone 582
        call cleanlinemc
583
        call setpgtemp8000
584
        pop hl
585
        pop de
586
 
587
        ;jr $
588
        push de
589
        push hl
590
        call htmlshowline
591
        pop hl
592
        pop de
593
        ret
594
 
595
htmlshowline
596
;hl=virtual Y
597
;d=scry
598
        ;jr $
599
        ld a,d
600
        add a,a
601
        add a,a
602
        add a,a
603
        ld (htmlshowline_scry),a
604
        ld (htmlshowline_virtualy),hl
605
 
32 Alone 606
htmlshowline_accessedpointer=$+1
607
        ld hl,0
608
htmlshowline_accessedpointerHSB=$+1
609
        ld a,0
610
 
344 alone 611
;饬 , ᫨ (accessedpointer.HREF_Y < y),  饬 
32 Alone 612
        push af
613
        push hl
614
        call getandcompareHREF_Y ;CY = (HREF_Y < y)
615
        jr c,htmlshowline_finddown
616
 
617
;htmlshowline_findup
618
        pop hl
619
        pop af
620
htmlshowline_findup0
31 Alone 621
        call isnull
622
        jr z,htmlshowline_findq
623
        push af
624
        push hl
32 Alone 625
        call getandcompareHREF_Y
626
        jr z,htmlshowline_findok
55 Alone 627
         jr c,htmlshowline_pop2findq
32 Alone 628
        pop hl
629
        pop af
630
        call getprevelement
631
        jr htmlshowline_findup0
632
 
633
htmlshowline_finddown
634
        pop hl
635
        pop af
636
htmlshowline_finddown0
637
        call isnull
638
        jr z,htmlshowline_findq
639
        push af
640
        push hl
641
;        ld bc,HREF_Y
642
;        add hl,bc
643
;        adc a,b;0
644
;        call readword ;de
645
;        ex de,hl
646
;htmlshowline_virtualy=$+1
647
;        ld bc,0
648
;        or a
649
;        sbc hl,bc
650
;        ex de,hl
651
        call getandcompareHREF_Y
652
        jr z,htmlshowline_findok
55 Alone 653
         jr nc,htmlshowline_pop2findq
32 Alone 654
        pop hl
655
        pop af
656
        call getnextelement
657
        jr htmlshowline_finddown0
658
 
659
getandcompareHREF_Y
31 Alone 660
        ld bc,HREF_Y
661
        add hl,bc
32 Alone 662
        adc a,b;0
31 Alone 663
        call readword ;de
664
        ex de,hl
665
htmlshowline_virtualy=$+1
666
        ld bc,0
667
        or a
668
        sbc hl,bc
669
        ex de,hl
32 Alone 670
        ret ;CY = (HREF_Y < y), Z = equal
671
 
672
htmlshowline_findok
673
        push af
674
        push hl
675
        ld bc,HREF_Y+2
676
        or a
677
        sbc hl,bc
678
        sbc a,b;0
679
        ld (htmlshowline_accessedpointer),hl
680
        ld (htmlshowline_accessedpointerHSB),a
31 Alone 681
        pop hl
682
        pop af
32 Alone 683
 
31 Alone 684
        call readbyte ;x
685
        ld e,c
686
htmlshowline_scry=$+1
687
        ld d,0
688
        push af
689
        push hl
690
        call setxymc_stateful
691
        pop hl
692
        pop af
693
htmlshowline_showtext0
694
        call readbyte ;c
695
        inc c
696
        dec c
697
        jr z,htmlshowline_showtextq
698
        push af
699
        push hl
700
        ld a,c
701
        call prcharmc_stateful
702
        pop hl
703
        pop af
704
        jr htmlshowline_showtext0
705
htmlshowline_showtextq
706
 
55 Alone 707
htmlshowline_pop2findq
31 Alone 708
        pop hl
709
        pop af
710
 
711
htmlshowline_findq
712
 
713
        ret
714
 
715
        if 1==0
716
        ld hl,(firstpointer)
717
        ld a,(firstpointerHSB)
718
loadhtml_showtexts0
719
        call isnull
720
        jr z,loadhtml_showtextsq
721
        push af
722
        push hl
723
        ld bc,stringbuf1-stringbuf1header
724
        add hl,bc
725
        adc a,0
726
        ;jr $
727
loadhtml_showtext0
728
        call readbyte ;c
729
        inc c
730
        dec c
731
        jr z,loadhtml_showtextq
732
        push af
733
        push hl
734
        ld a,c
735
        call prcharmc_stateful
736
        pop hl
737
        pop af
738
        jr loadhtml_showtext0
739
loadhtml_showtextq
740
        call prcharmc_crlf_stateful
741
        pop hl
742
        pop af
743
        call getnextelement
744
        jr loadhtml_showtexts0
745
loadhtml_showtextsq
746
 
747
 
748
        ld hl,(first2pointer)
749
        ld a,(first2pointerHSB)
750
loadhtml_showhrefs0
751
        call isnull
752
        jr z,loadhtml_showhrefsq
753
        push af
754
        push hl
755
        ld bc,stringbuf2-stringbuf2header
756
        add hl,bc
757
        adc a,0
758
        ;jr $
759
loadhtml_showhref0
760
        call readbyte ;c
761
        inc c
762
        dec c
763
        jr z,loadhtml_showhrefq
764
        push af
765
        push hl
766
        ld a,c
767
        call prcharmc_stateful
768
        pop hl
769
        pop af
770
        jr loadhtml_showhref0
771
loadhtml_showhrefq
772
        call prcharmc_crlf_stateful
773
        pop hl
774
        pop af
775
        call getnextelement
776
        jr loadhtml_showhrefs0
777
loadhtml_showhrefsq
778
 
779
        jp closequit
780
        endif