Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Improvements to the download manager. (CVS 1255) |
---|---|
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
dc7b228b2b4af0890e901eb8c0eb8de2 |
User & Date: | danielk1977 2008-02-02 17:15:02.000 |
Context
2008-02-02
| ||
17:17 | Add the new download manager. (CVS 1256) check-in: 57f52b84c9 user: danielk1977 tags: trunk | |
17:15 | Improvements to the download manager. (CVS 1255) check-in: dc7b228b2b user: danielk1977 tags: trunk | |
16:10 | makefile change. (CVS 1254) check-in: fb4d056189 user: danielk1977 tags: trunk | |
Changes
Changes to hv/hv3_browser.tcl.
︙ | ︙ | |||
14 15 16 17 18 19 20 21 22 23 24 25 26 27 | source [sourcefile hv3_notebook.tcl] source [sourcefile hv3_db.tcl] source [sourcefile hv3_home.tcl] source [sourcefile hv3.tcl] source [sourcefile hv3_prop.tcl] source [sourcefile hv3_log.tcl] source [sourcefile hv3_http.tcl] source [sourcefile hv3_frameset.tcl] source [sourcefile hv3_polipo.tcl] source [sourcefile hv3_icons.tcl] source [sourcefile hv3_history.tcl] source [sourcefile hv3_string.tcl] source [sourcefile hv3_bookmarks.tcl] source [sourcefile hv3_bugreport.tcl] | > | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | source [sourcefile hv3_notebook.tcl] source [sourcefile hv3_db.tcl] source [sourcefile hv3_home.tcl] source [sourcefile hv3.tcl] source [sourcefile hv3_prop.tcl] source [sourcefile hv3_log.tcl] source [sourcefile hv3_http.tcl] source [sourcefile hv3_download.tcl] source [sourcefile hv3_frameset.tcl] source [sourcefile hv3_polipo.tcl] source [sourcefile hv3_icons.tcl] source [sourcefile hv3_history.tcl] source [sourcefile hv3_string.tcl] source [sourcefile hv3_bookmarks.tcl] source [sourcefile hv3_bugreport.tcl] |
︙ | ︙ | |||
63 64 65 66 67 68 69 70 71 72 73 74 75 76 | proc new {me browser args} { upvar #0 $me O # The name of this frame (as specified by the "name" attribute of # the <frame> element). set O(-name) "" # If this [::hv3::browser_frame] is used as a replacement object # for an <iframe> element, then this option is set to the Tkhtml3 # node-handle for that <iframe> element. # set O(-iframe) "" | > | 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | proc new {me browser args} { upvar #0 $me O # The name of this frame (as specified by the "name" attribute of # the <frame> element). set O(-name) "" set O(oldname) "" # If this [::hv3::browser_frame] is used as a replacement object # for an <iframe> element, then this option is set to the Tkhtml3 # node-handle for that <iframe> element. # set O(-iframe) "" |
︙ | ︙ | |||
92 93 94 95 96 97 98 | #set O(myHv3) [::hv3::hv3 $O(win).hv3] #pack $O(myHv3) -expand true -fill both set O(myHv3) $O(hull) ::hv3::the_visited_db init $O(myHv3) catch {$O(myHv3) configure -fonttable $::hv3::fontsize_table} | < | 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | #set O(myHv3) [::hv3::hv3 $O(win).hv3] #pack $O(myHv3) -expand true -fill both set O(myHv3) $O(hull) ::hv3::the_visited_db init $O(myHv3) catch {$O(myHv3) configure -fonttable $::hv3::fontsize_table} # Create bindings for motion, right-click and middle-click. $O(myHv3) Subscribe motion [list $me motion] bind $O(win) <3> [list $me rightclick %x %y %X %Y] #bind $O(win) <2> [list $me goto_selection] bind $O(win) <2> [list $me middleclick %x %y] |
︙ | ︙ | |||
130 131 132 133 134 135 136 | ::hv3::menu $O(win).hyperlinkmenu selection handle $O(win).hyperlinkmenu [list $me GetCopiedLinkLocation] } proc destroy {me} { upvar #0 $me O catch {$me ConfigureName -name ""} # Remove this object from the $theFrames list. | | < < < < < < < < < < < | | | > | | | 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | ::hv3::menu $O(win).hyperlinkmenu selection handle $O(win).hyperlinkmenu [list $me GetCopiedLinkLocation] } proc destroy {me} { upvar #0 $me O catch {$me ConfigureName -name ""} # Remove this object from the $theFrames list. catch {$O(myBrowser) del_frame $O(win)} msg catch {::destroy $O(win).hyperlinkmenu} } proc configure-name {me} { upvar #0 $me O # This method is called when the "name" of attribute of this # frame is modified. If javascript is enabled we have to update # the properties on the parent window object (if any). set dom [$me cget -dom] if {$dom ne "" && [$dom cget -enable]} { set parent [$me parent_frame] if {$parent ne ""} { set parent_window [list ::hv3::DOM::Window $dom [$parent hv3]] set this_win [list ::hv3::DOM::Window $dom $O(myHv3)] if {$O(oldname) ne ""} { $dom set_object_property $parent_window $O(oldname) undefined } if {$O(-name) ne ""} { set val [list object $this_win] $dom set_object_property $parent_window $O(-name) $val } } } set O(oldname) $O(-name) } proc Targetcmd {me node} { upvar #0 $me O set target [$node attr -default "" target] if {$target eq ""} { # If there is no target frame specified, see if a default |
︙ | ︙ | |||
529 530 531 532 533 534 535 | if {[llength $slaves]>0} { set isFrameset [expr {[winfo class [lindex $slaves 0]] eq "Frameset"}] } return $isFrameset } set DelegateOption(-forcefontmetrics) myHv3 | | | | | | | | | | > | 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 | if {[llength $slaves]>0} { set isFrameset [expr {[winfo class [lindex $slaves 0]] eq "Frameset"}] } return $isFrameset } set DelegateOption(-forcefontmetrics) myHv3 set DelegateOption(-fonttable) myHv3 set DelegateOption(-fontscale) myHv3 set DelegateOption(-zoom) myHv3 set DelegateOption(-enableimages) myHv3 set DelegateOption(-dom) myHv3 set DelegateOption(-width) myHv3 set DelegateOption(-height) myHv3 set DelegateOption(-requestcmd) myHv3 set DelegateOption(-resetcmd) myHv3 set DelegateOption(-downloadcmd) myHv3 proc stop {me args} { upvar #0 $me O eval $O(myHv3) stop $args } proc titlevar {me args} { upvar #0 $me O |
︙ | ︙ | |||
590 591 592 593 594 595 596 597 598 599 600 601 | # List of all ::hv3::browser_frame objects using this object as # their toplevel browser. set O(myFrames) [list] set O(myDom) [::hv3::dom %AUTO% $me] # The main browser frame (always present). set O(myHistory) "" set O(myMainFrame) [::hv3::browser_frame $O(win).frame $me] #set O(myMainFrame) $O(hull) | > > > < < < | 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 | # List of all ::hv3::browser_frame objects using this object as # their toplevel browser. set O(myFrames) [list] set O(myDom) [::hv3::dom %AUTO% $me] # Create the protocol object. set O(myProtocol) [::hv3::protocol %AUTO%] # The main browser frame (always present). set O(myHistory) "" set O(myMainFrame) [::hv3::browser_frame $O(win).frame $me] #set O(myMainFrame) $O(hull) # The history sub-system. set hv3 [$O(myMainFrame) hv3] set O(myHistory) [::hv3::history %AUTO% $hv3 $O(myProtocol) $me] # The widget may be in one of two states - "pending" or "not pending". # "pending" state is when the browser is still waiting for one or more # downloads to finish before the document is correctly displayed. In |
︙ | ︙ | |||
656 657 658 659 660 661 662 663 664 665 666 667 | eval $O(myMainFrame) titlevar $args } # This method is called to activate the download-manager to download # the specified URI ($uri) to the local file-system. # proc saveuri {me uri} { set handle [::hv3::request %AUTO% \ -uri $uri \ -mimetype application/gzip \ ] $handle configure \ | > > | | > > > > > | 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 | eval $O(myMainFrame) titlevar $args } # This method is called to activate the download-manager to download # the specified URI ($uri) to the local file-system. # proc saveuri {me uri} { upvar #0 $me O set handle [::hv3::request %AUTO% \ -uri $uri \ -mimetype application/gzip \ ] $handle configure \ -incrscript [list ::hv3::the_download_manager savehandle "" $handle] \ -finscript [list ::hv3::the_download_manager savehandle "" $handle] $O(myProtocol) requestcmd $handle } # Interface used by code in class ::hv3::browser_frame for frame management. # proc add_frame {me frame} { upvar #0 $me O lappend O(myFrames) $frame if {$O(myHistory) ne ""} { $O(myHistory) add_hv3 [$frame hv3] } set HTML [[$frame hv3] html] bind $HTML <1> [list focus %W] bind $HTML <KeyPress-slash> [list $me Find] bindtags $HTML [concat Hv3HotKeys $me [bindtags $HTML]] if {[$O(myDom) cget -enable]} { $frame configure -dom $O(myDom) } set cmd [list ::hv3::the_download_manager savehandle $O(myProtocol)] $frame configure -downloadcmd $cmd catch {$::hv3::G(config) configureframe $frame} } proc del_frame {me frame} { upvar #0 $me O set idx [lsearch $O(myFrames) $frame] if {$idx >= 0} { set O(myFrames) [lreplace $O(myFrames) $idx $idx] |
︙ | ︙ | |||
756 757 758 759 760 761 762 | $O(-stopbutton) configure \ -command [list $O(myMainFrame) stop] \ -image hv3_stopimg \ -tooltip "Stop Current Download" } else { $O(hull) configure -cursor "" $O(-stopbutton) configure \ | | | 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 | $O(-stopbutton) configure \ -command [list $O(myMainFrame) stop] \ -image hv3_stopimg \ -tooltip "Stop Current Download" } else { $O(hull) configure -cursor "" $O(-stopbutton) configure \ -command [list $me reload] \ -image hv3_reloadimg \ -tooltip "Reload Current Document" } } set O(myIsPending) $isPending } |
︙ | ︙ | |||
875 876 877 878 879 880 881 | proc reload {me } { upvar #0 $me O $O(myHistory) reload } proc configure-enablejavascript {me} { upvar #0 $me O | | | | 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 | proc reload {me } { upvar #0 $me O $O(myHistory) reload } proc configure-enablejavascript {me} { upvar #0 $me O $O(myDom) configure -enable $O(-enablejavascript) set dom "" if {$O(-enablejavascript)} { set dom $O(myDom) } foreach f $O(myFrames) { $f configure -dom $dom } } proc populate_history_menu {me args} { upvar #0 $me O |
︙ | ︙ |
Changes to hv/hv3_debug.tcl.
|
| | | 1 2 3 4 5 6 7 8 | namespace eval hv3 { set {version($Id: hv3_debug.tcl,v 1.14 2008/02/02 17:15:02 danielk1977 Exp $)} 1 } namespace eval ::hv3 { ::snit::widget console { # Entry field for typing commands (entry widget): variable myEntryField |
︙ | ︙ | |||
609 610 611 612 613 614 615 | proc images {{all_tabs 0}} { set nPix 0 set nImg 0 if {$all_tabs} { set data [list] foreach browser [.notebook tabs] { | | | | 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 | proc images {{all_tabs 0}} { set nPix 0 set nImg 0 if {$all_tabs} { set data [list] foreach browser [.notebook tabs] { eval lappend data [[$browser hv3] html _images] } } else { set data [hv3 html _images] } set header [list URL "Tk image" pixmap width height alpha references] foreach record [concat [list $header] $data] { foreach $header $record break if {[string length $URL] > 15} { set URL "...[string range $URL [expr [string length $URL]-12] end]" |
︙ | ︙ |
Changes to hv/hv3_frameset.tcl.
|
| | | 1 2 3 4 5 6 7 8 | namespace eval hv3 { set {version($Id: hv3_frameset.tcl,v 1.18 2008/02/02 17:15:02 danielk1977 Exp $)} 1 } # This file contains code for implementing HTML frameset documents in Hv3. # # Each <frameset> element is implemented by a single ::hv3::frameset # widget. # |
︙ | ︙ | |||
19 20 21 22 23 24 25 | # Set this global variable to true to enable frameset-related # debugging output on stderr. set FRAMESET_DEBUG 0 # Create a window name to use for a replaced object for node $node. # The first argument is the name of an ::hv3::browser_frame widget. # | | | | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | # Set this global variable to true to enable frameset-related # debugging output on stderr. set FRAMESET_DEBUG 0 # Create a window name to use for a replaced object for node $node. # The first argument is the name of an ::hv3::browser_frame widget. # proc create_widget_name {node} { return [$node html].[string map {: _} $node] } proc multilength_to_list {multilength} { set ret [list] foreach elem [split $multilength ,] { lappend ret [string trim $elem] } |
︙ | ︙ | |||
45 46 47 48 49 50 51 | # Make sure this is not a nested <frameset> element. If it is, ignore # it. Only the outer <frameset> is managed by the hv3 widget. for {set N [$node parent]} {$N ne ""} {set N [$N parent]} { if {[$N tag] eq "frameset"} return } | | | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | # Make sure this is not a nested <frameset> element. If it is, ignore # it. Only the outer <frameset> is managed by the hv3 widget. for {set N [$node parent]} {$N ne ""} {set N [$N parent]} { if {[$N tag] eq "frameset"} return } set win [create_widget_name $node] ::hv3::frameset $win $browser_frame $node # The 'display' property of <frameset> elements is set to "none" by # the default stylesheet. So replacing the <frameset> node with the new # ::hv3::frameset widget does not cause the html widget to map the # frameset widget. Instead we use standard Tk [grid] to put our # widget on top of the html widget. |
︙ | ︙ | |||
71 72 73 74 75 76 77 | # argument is the name of an ::hv3::browser_frame widget. The # second argument is the <iframe> node. # proc iframe_handler {browser_frame node} { set hv3 [$browser_frame hv3] # Create an ::hv3::browser_frame to display the resource. | | | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | # argument is the name of an ::hv3::browser_frame widget. The # second argument is the <iframe> node. # proc iframe_handler {browser_frame node} { set hv3 [$browser_frame hv3] # Create an ::hv3::browser_frame to display the resource. set panel [create_widget_name $node] ::hv3::browser_frame $panel [$browser_frame browser] [[$panel hv3] html] configure -shrink 1 # TODO: Should be properly configured... $panel configure -requestcmd [$browser_frame cget -requestcmd] $panel configure -statusvar [$browser_frame cget -statusvar] $panel configure -name [$node attr -default "" name] |
︙ | ︙ | |||
297 298 299 300 301 302 303 | } $pframe configure -name [$pnode attr -default "" name] } frameset { # For a frameset, we need to create the equivalent HTML document. set doc "<html>[::hv3::get_markup $pnode]</html>" $phv3 seturi [$myHv3 resolve_uri "internal"] | | | 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 | } $pframe configure -name [$pnode attr -default "" name] } frameset { # For a frameset, we need to create the equivalent HTML document. set doc "<html>[::hv3::get_markup $pnode]</html>" $phv3 seturi [$myHv3 resolve_uri "internal"] $phv3 html parse -final $doc } } } foreach pan [array names divwidth] { switch $divwidth($pan) { 0 { |
︙ | ︙ |
Changes to hv/hv3_history.tcl.
|
| | | 1 2 3 4 5 6 7 8 | namespace eval hv3 { set {version($Id: hv3_history.tcl,v 1.32 2008/02/02 17:15:02 danielk1977 Exp $)} 1 } package require snit # History state for a single browser window. # snit::type ::hv3::history_state { |
︙ | ︙ | |||
470 471 472 473 474 475 476 | $myEntry configure -borderwidth 0 -highlightthickness 0 $myButton configure -borderwidth 1 -highlightthickness 0 $hull configure -borderwidth 1 -relief sunken -background white # Create the listbox for the drop-down list. This is a child of # the same top-level as the ::hv3::locationentry widget... # | | > > | 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 | $myEntry configure -borderwidth 0 -highlightthickness 0 $myButton configure -borderwidth 1 -highlightthickness 0 $hull configure -borderwidth 1 -relief sunken -background white # Create the listbox for the drop-down list. This is a child of # the same top-level as the ::hv3::locationentry widget... # set top [winfo toplevel $win] if {$top eq "."} {set top ""} set myListbox $top.[string map {. _} ${win}] ::hv3::scrolledlistbox $myListbox -takefocus 0 # Any button-press anywhere in the GUI folds up the drop-down menu. bind [winfo toplevel $win] <ButtonPress> +[list $self AnyButtonPress %W] bind $myEntry <KeyPress> +[list $self KeyPress] bind $myEntry <KeyPress-Return> +[list $self KeyPressReturn] |
︙ | ︙ | |||
645 646 647 648 649 650 651 | } rename $me "" unset $me } proc add {me handle} { upvar #0 $me O lappend O(handles) $handle | > | > > > > > > | 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 | } rename $me "" unset $me } proc add {me handle} { upvar #0 $me O lappend O(handles) $handle set key catch.[$handle cget -uri] if {[info exists O($key)]} { set idx [lsearch $O(handles) $O($key)] set O(handles) [lreplace $O(handles) $idx $idx] } set O($key) $handle $handle reference if {[llength $O(handles)]>=25} { foreach h [lrange $O(handles) 0 4] { unset O(cache.[$h cget -uri]) $h release } set O(handles) [lrange $O(handles) 5 end] |
︙ | ︙ |
Changes to hv/hv3_home.tcl.
|
| | | 1 2 3 4 5 6 7 8 | namespace eval hv3 { set {version($Id: hv3_home.tcl,v 1.41 2008/02/02 17:15:02 danielk1977 Exp $)} 1 } # Register the home: scheme handler with ::hv3::protocol $protocol. # proc ::hv3::home_scheme_init {hv3 protocol} { set dir $::hv3::maindir $protocol schemehandler home [list ::hv3::home_request $protocol $hv3 $dir] } |
︙ | ︙ | |||
73 74 75 76 77 78 79 80 81 82 83 84 85 86 | } } } else { set obj [string range $path 1 end] set data [::hv3::DOM::docs::${obj}] } } bookmarks_left { } bookmarks { if {$path eq "" || $path eq "/"} { $downloadHandle append { <FRAMESET cols="33%,*"> <FRAME src="home://bookmarks_left"> | > > > > > | 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | } } } else { set obj [string range $path 1 end] set data [::hv3::DOM::docs::${obj}] } } downloads { ::hv3::the_download_manager request $downloadHandle return } bookmarks_left { } bookmarks { if {$path eq "" || $path eq "/"} { $downloadHandle append { <FRAMESET cols="33%,*"> <FRAME src="home://bookmarks_left"> |
︙ | ︙ |
Changes to hv/hv3_http.tcl.
|
| | | 1 2 3 4 5 6 7 8 | namespace eval hv3 { set {version($Id: hv3_http.tcl,v 1.65 2008/02/02 17:15:02 danielk1977 Exp $)} 1 } # # This file contains implementations of the -requestcmd script used with # the hv3 widget for the browser. Supported functions are: # # * http:// (including cookies) # * file:// (code for this is now in hv3_file.tcl) |
︙ | ︙ | |||
463 464 465 466 467 468 469 | [lsearch $O(myInProgressHandles) $downloadHandle] >= 0 || [lsearch $O(myWaitingHandles) $downloadHandle] >= 0 } { catch {$O(myGui) uri_done [$downloadHandle cget -uri]} if {[$downloadHandle cget -cacheable]} { ::hv3::the_httpcache add $downloadHandle } | < > | 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 | [lsearch $O(myInProgressHandles) $downloadHandle] >= 0 || [lsearch $O(myWaitingHandles) $downloadHandle] >= 0 } { catch {$O(myGui) uri_done [$downloadHandle cget -uri]} if {[$downloadHandle cget -cacheable]} { ::hv3::the_httpcache add $downloadHandle } } catch { $downloadHandle finish } ::http::cleanup $token } proc debug_cookies {me} { upvar $me O $O(myCookieManager) debug } |
︙ | ︙ | |||
550 551 552 553 554 555 556 | if {$n > [${win}.text.widget cget -height]} { ${win}.text.widget configure -height $n } ${win}.text yview moveto $yview } } | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 550 551 552 553 554 555 556 557 558 559 560 561 562 563 | if {$n > [${win}.text.widget cget -height]} { ${win}.text.widget configure -height $n } ${win}.text yview moveto $yview } } #----------------------------------------------------------------------- # Work around a bug in http::Finish # # First, make sure the http package is actually loaded. Do this by # invoking ::http::geturl. The call will fail, since the arguments (none) # passed to ::http::geturl are invalid. |
︙ | ︙ |
Changes to hv/hv3_main.tcl.
|
| | | 1 2 3 4 5 6 7 8 | namespace eval hv3 { set {version($Id: hv3_main.tcl,v 1.186 2008/02/02 17:15:02 danielk1977 Exp $)} 1 } catch {memory init on} proc sourcefile {file} [string map \ [list %HV3_DIR% [file dirname [info script]]] \ { return [file join {%HV3_DIR%} $file] |
︙ | ︙ | |||
30 31 32 33 34 35 36 37 38 39 40 41 42 43 | # source [sourcefile hv3_console.tcl] # } namespace eval ::hv3 { set log_source_option 0 set reformat_scripts_option 0 } # ::hv3::config # # An instance of this class manages the application "View" menu, # which contains all the runtime configuration options (font size, # image loading etc.). # | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | # source [sourcefile hv3_console.tcl] # } namespace eval ::hv3 { set log_source_option 0 set reformat_scripts_option 0 } # This class is used to create toplevel "sub-window" widgets. Sub-windows # are toplevel windows that contain a single [::hv3::browser] object. # # Sub-windows are different from the main window in several ways: # # * There is no menubar. # * There is no "new tab", "home" or "bug report button on the toolbar. # * It is not possible to open new tabs in a sub-window. # # These restrictions are because Hv3 is a tabbed browser. New views are # supposed to live in tabs, not separate toplevel windows. If the user # really wants more than one window, more than one copy of the browser # should be started. Sub-windows are provided purely for the benefit of # those javascript applications that have UIs that require multiple # windows. # namespace eval ::hv3::subwindow { set counter 1 proc new {me args} { upvar #0 $me O set O(browser) [::hv3::browser $O(win).browser] set O(label) [::hv3::label $O(win).label -anchor w -width 1] set O(location) [::hv3::locationentry $O(win).location] set O(stop_button) $O(win).stop set O(back_button) $O(win).back set O(next_button) $O(win).next ::hv3::toolbutton $O(stop_button) -text {Stop} -tooltip "Stop" ::hv3::toolbutton $O(next_button) -text {Forward} -tooltip "Go Forward" ::hv3::toolbutton $O(back_button) -text {Back} -tooltip "Go Back" grid $O(back_button) $O(next_button) $O(stop_button) grid $O(location) -column 3 -row 0 -sticky ew grid $O(browser) -column 0 -row 1 -sticky nsew -columnspan 4 grid $O(label) -column 0 -row 2 -sticky nsew -columnspan 4 grid columnconfigure $O(win) 3 -weight 1 grid rowconfigure $O(win) 1 -weight 1 $O(back_button) configure -image hv3_previmg $O(next_button) configure -image hv3_nextimg $O(stop_button) configure -image hv3_reloadimg $O(label) configure -textvar [$O(browser) statusvar] $O(browser) configure -stopbutton $O(stop_button) $O(browser) configure -forwardbutton $O(next_button) $O(browser) configure -backbutton $O(back_button) $O(browser) configure -locationentry $O(location) $O(location) configure -command [list $me GotoLocation] $O(browser) configure -width 600 -height 400 set O(titlevarname) [$O(browser) titlevar] set O(locationvarname) [$O(browser) locationvar] # Set up traces on the browser title and location. Use these to # set the title of the toplevel window. trace add variable $O(titlevarname) write [list $me SetTitle] trace add variable $O(locationvarname) write [list $me SetTitle] } proc SetTitle {me args} { upvar #0 $me O set T [set [$O(browser) titlevar]] if {$T eq ""} { set T [set [$O(browser) locationvar]] } wm title $O(win) $T } proc destroy {me} { upvar #0 $me O trace remove variable $O(titlevarname) write [list $me SetTitle] trace remove variable $O(locationvarname) write [list $me SetTitle] } proc goto {me uri} { upvar #0 $me O $O(browser) goto $uri } proc GotoLocation {me} { upvar #0 $me O set uri [$O(location) get] $O(browser) goto $uri } } ::hv3::make_constructor ::hv3::subwindow toplevel # ::hv3::config # # An instance of this class manages the application "View" menu, # which contains all the runtime configuration options (font size, # image loading etc.). # |
︙ | ︙ | |||
420 421 422 423 424 425 426 | constructor {} { set MENU [list \ "Open File..." [list gui_openfile $::hv3::G(notebook)] o \ "Open Tab" [list $::hv3::G(notebook) add] t \ "Open Location" [list gui_openlocation $::hv3::G(location_entry)] l \ "-----" "" "" \ | | > | 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 | constructor {} { set MENU [list \ "Open File..." [list gui_openfile $::hv3::G(notebook)] o \ "Open Tab" [list $::hv3::G(notebook) add] t \ "Open Location" [list gui_openlocation $::hv3::G(location_entry)] l \ "-----" "" "" \ "Bookmark This Page" [list ::hv3::gui_bookmark] b \ "-----" "" "" \ "Downloads..." [list ::hv3::the_download_manager show] "" \ "Bookmarks..." [list gui_current goto home://bookmarks/] "" \ "-----" "" "" \ "Close Tab" [list $::hv3::G(notebook) close] "" \ "Exit" exit q \ ] } method populate_menu {path} { |
︙ | ︙ | |||
483 484 485 486 487 488 489 490 491 492 493 494 495 496 | "About" [list $::hv3::G(notebook) add home://about] "" \ "Polipo..." [list ::hv3::polipo::popup] "" \ "Events..." [list gui_log_window $::hv3::G(notebook)] "" \ "-----" [list] "" \ "Tree Browser..." [list gui_current browse] "" \ "Debugging Console..." [list ::hv3::launch_console] d \ "-----" [list] "" \ "Exec firefox -remote" [list gui_firefox_remote] "" \ "-----" [list] "" \ "Reset Profiling Data..." [list ::hv3::profile::zero] "" \ "Save Profiling Data..." [list ::hv3::profile::report_to_file] "" \ ] } | > | 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 | "About" [list $::hv3::G(notebook) add home://about] "" \ "Polipo..." [list ::hv3::polipo::popup] "" \ "Events..." [list gui_log_window $::hv3::G(notebook)] "" \ "-----" [list] "" \ "Tree Browser..." [list gui_current browse] "" \ "Debugging Console..." [list ::hv3::launch_console] d \ "-----" [list] "" \ "Sub-Window..." gui_subwindow "" \ "Exec firefox -remote" [list gui_firefox_remote] "" \ "-----" [list] "" \ "Reset Profiling Data..." [list ::hv3::profile::zero] "" \ "Save Profiling Data..." [list ::hv3::profile::report_to_file] "" \ ] } |
︙ | ︙ | |||
555 556 557 558 559 560 561 | #-------------------------------------------------------------------------- # The following functions are all called during startup to construct the # static components of the web browser gui: # # gui_build # gui_menu | < | 650 651 652 653 654 655 656 657 658 659 660 661 662 663 | #-------------------------------------------------------------------------- # The following functions are all called during startup to construct the # static components of the web browser gui: # # gui_build # gui_menu # create_fontsize_menu # create_fontscale_menu # # gui_build -- # # This procedure is called once at the start of the script to build |
︙ | ︙ | |||
665 666 667 668 669 670 671 | } proc goto_gui_location {browser entry args} { set location [$entry get] $browser goto $location } | < < < < < < < < < < < < < < < < < < < < | 759 760 761 762 763 764 765 766 767 768 769 770 771 772 | } proc goto_gui_location {browser entry args} { set location [$entry get] $browser goto $location } proc gui_openlocation {location_entry} { $location_entry selection range 0 end $location_entry OpenDropdown * focus ${location_entry}.entry } proc gui_populate_menu {eMenu menu_widget} { |
︙ | ︙ | |||
961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 | append status " Tcl Heap: ${nBytes} in $nAllocs allocs" } $G(status_label) configure -text $status after 2000 [list gui_set_memstatus $widget_array] } } # Override the [exit] command to check if the widget code leaked memory # or not before exiting. # rename exit tcl_exit proc exit {args} { destroy .notebook catch {destroy .prop.hv3} catch {::tkhtml::htmlalloc} eval [concat tcl_exit $args] } | > > > > > > > > > > > < < < < < | 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 | append status " Tcl Heap: ${nBytes} in $nAllocs allocs" } $G(status_label) configure -text $status after 2000 [list gui_set_memstatus $widget_array] } } # Launch a new sub-window. # proc gui_subwindow {{uri ""}} { set name ".subwindow_[incr ::hv3::subwindow::counter]" ::hv3::subwindow $name if {$uri eq ""} { set uri [[gui_current hv3] uri get] } $name goto $uri } # Override the [exit] command to check if the widget code leaked memory # or not before exiting. # rename exit tcl_exit proc exit {args} { destroy .notebook catch {destroy .prop.hv3} catch {::tkhtml::htmlalloc} eval [concat tcl_exit $args] } #-------------------------------------------------------------------------- # main URI # # The main() program for the application. This proc handles # parsing of command line arguments. # proc main {args} { |
︙ | ︙ |
Changes to hv/hv3_notebook.tcl.
|
| | | 1 2 3 4 5 6 7 8 | namespace eval hv3 { set {version($Id: hv3_notebook.tcl,v 1.9 2008/02/02 17:15:02 danielk1977 Exp $)} 1 } # This file contains the implementation of three snit widgets: # # ::hv3::notebook_header # ::hv3::notebook # ::hv3::tabset # |
︙ | ︙ | |||
498 499 500 501 502 503 504 | set title $myPendingTitle } return $title } method current {} { $hull select } method tabs {} { $hull tabs } | | > > | 498 499 500 501 502 503 504 505 506 507 | set title $myPendingTitle } return $title } method current {} { $hull select } method tabs {} { $hull tabs } delegate method select to hull } |
Changes to hv/hv3_request.tcl.
|
| | | 1 2 3 4 5 6 7 8 | namespace eval hv3 { set {version($Id: hv3_request.tcl,v 1.27 2008/02/02 17:15:02 danielk1977 Exp $)} 1 } #-------------------------------------------------------------------------- # This file contains the implementation of two types used by hv3: # # ::hv3::request # |
︙ | ︙ | |||
164 165 166 167 168 169 170 171 172 173 174 175 176 177 | #---------------------------- set O(chunksize) 2048 # The binary data returned by the protocol implementation is # accumulated in this variable. set O(myRaw) {} # If this variable is non-zero, then the first $myRawPos bytes of # $myRaw have already been passed to Hv3 via the -incrscript # callback. set O(myRawPos) 0 # These objects are referenced counted. Initially the reference count | > | 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | #---------------------------- set O(chunksize) 2048 # The binary data returned by the protocol implementation is # accumulated in this variable. set O(myRaw) {} set O(myRawMode) 0 # If this variable is non-zero, then the first $myRawPos bytes of # $myRaw have already been passed to Hv3 via the -incrscript # callback. set O(myRawPos) 0 # These objects are referenced counted. Initially the reference count |
︙ | ︙ | |||
205 206 207 208 209 210 211 212 213 214 215 216 217 218 | return [::encoding convertfrom [encoding $me] $raw] } return $raw } proc rawdata {me} { upvar $me O return $O(myRaw) } # Increment the object refcount. # proc reference {me} { upvar $me O incr O(myRefCount) | > > > > > | 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 | return [::encoding convertfrom [encoding $me] $raw] } return $raw } proc rawdata {me} { upvar $me O return $O(myRaw) } proc set_rawmode {me} { upvar $me O set O(myRawMode) 1 set O(myRaw) "" } # Increment the object refcount. # proc reference {me} { upvar $me O incr O(myRefCount) |
︙ | ︙ | |||
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 | $obj destroy return $authority } # Interface for returning data. proc append {me raw} { upvar $me O ::append O(myRaw) $raw if {$O(-incrscript) != ""} { # There is an -incrscript callback configured. If enough data is # available, invoke it. set nLast 0 foreach zWhite [list " " "\n" "\t"] { set n [string last $zWhite $O(myRaw)] if {$n>$nLast} {set nLast $n ; break} } set nAvailable [expr {$nLast-$O(myRawPos)}] if {$nAvailable > $O(chunksize)} { | > > > > > > > | 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | $obj destroy return $authority } # Interface for returning data. proc append {me raw} { upvar $me O if {$O(myRawMode)} { eval [linsert $O(-incrscript) end $raw] return } ::append O(myRaw) $raw if {$O(-incrscript) != ""} { # There is an -incrscript callback configured. If enough data is # available, invoke it. set nLast 0 foreach zWhite [list " " "\n" "\t"] { set n [string last $zWhite $O(myRaw)] if {$n>$nLast} {set nLast $n ; break} } set nAvailable [expr {$nLast-$O(myRawPos)}] if {$nAvailable > $O(chunksize)} { |
︙ | ︙ | |||
318 319 320 321 322 323 324 325 326 327 328 329 330 331 | # Called after all data has been passed to [append]. # proc finish {me {raw ""}} { upvar $me O if {$O(myIsFinished)} {error "finish called twice on $me"} set O(myIsFinished) 1 ::append O(myRaw) $raw set zDecoded [string range $O(myRaw) $O(myRawPos) end] if {$O(myIsText)} { set zDecoded [::encoding convertfrom [encoding $me] $zDecoded] } | > > > > > > > > > | 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 | # Called after all data has been passed to [append]. # proc finish {me {raw ""}} { upvar $me O if {$O(myIsFinished)} {error "finish called twice on $me"} set O(myIsFinished) 1 if {$O(myRawMode)} { foreach hook $O(myFinishHookList) { eval $hook } eval [linsert $O(-finscript) end $raw] return } ::append O(myRaw) $raw set zDecoded [string range $O(myRaw) $O(myRawPos) end] if {$O(myIsText)} { set zDecoded [::encoding convertfrom [encoding $me] $zDecoded] } |
︙ | ︙ |
Changes to hv/hv3_util.tcl.
|
| | | 1 2 3 4 5 6 7 8 | namespace eval hv3 { set {version($Id: hv3_util.tcl,v 1.9 2008/02/02 17:15:02 danielk1977 Exp $)} 1 } namespace eval hv3 { proc ReturnWithArgs {retval args} { return $retval } |
︙ | ︙ | |||
430 431 432 433 434 435 436 | namespace eval ::hv3 { variable Counter 1 proc handle_destroy {me obj win} { if {$obj eq $win} { upvar #0 $me O | | > | 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 | namespace eval ::hv3 { variable Counter 1 proc handle_destroy {me obj win} { if {$obj eq $win} { upvar #0 $me O set cmd $O(cmd) $me destroy rename $cmd "" } } proc handle_rename {me oldname newname op} { upvar #0 $me O set O(cmd) $newname } |
︙ | ︙ |
Changes to hv/hv3_widgets.tcl.
|
| | | 1 2 3 4 5 6 7 8 | namespace eval hv3 { set {version($Id: hv3_widgets.tcl,v 1.58 2008/02/02 17:15:02 danielk1977 Exp $)} 1 } package require snit package require Tk set ::hv3::toolkit Tk catch { # package require tile |
︙ | ︙ | |||
109 110 111 112 113 114 115 | # Configure Tk presentation options not required for Tile here. $myButton configure -highlightthickness 0 $myButton configure -borderwidth 1 $myButton configure -relief flat -overrelief raised } set top [winfo toplevel $myButton] | > | | 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | # Configure Tk presentation options not required for Tile here. $myButton configure -highlightthickness 0 $myButton configure -borderwidth 1 $myButton configure -relief flat -overrelief raised } set top [winfo toplevel $myButton] if {$top eq "."} {set top ""} set myPopup ${top}.[string map {. _} $myButton] set myPopupLabel ${myPopup}.label frame $myPopup -bg black ::label $myPopupLabel -fg black -bg white ::hv3::UseHv3Font $myPopupLabel pack $myButton -expand true -fill both pack $myPopup.label -padx 1 -pady 1 -fill both -expand true |
︙ | ︙ | |||
388 389 390 391 392 393 394 | set docbbox [$hv3 html bbox] set docheight "[lindex $docbbox 3].0" set ntop [expr ([lindex $nodebbox 1].0 - 30.0) / $docheight] set nbottom [expr ([lindex $nodebbox 3].0 + 30.0) / $docheight] | | | 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 | set docbbox [$hv3 html bbox] set docheight "[lindex $docbbox 3].0" set ntop [expr ([lindex $nodebbox 1].0 - 30.0) / $docheight] set nbottom [expr ([lindex $nodebbox 3].0 + 30.0) / $docheight] set sheight [expr [winfo height [$hv3 html]].0 / $docheight] set stop [lindex [$hv3 yview] 0] set sbottom [expr $stop + $sheight] if {$ntop < $stop} { $hv3 yview moveto $ntop } elseif {$nbottom > $sbottom} { |
︙ | ︙ |
Changes to src/htmldraw.c.
︙ | ︙ | |||
26 27 28 29 30 31 32 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ | | | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ static const char rcsid[] = "$Id: htmldraw.c,v 1.207 2008/02/02 17:15:02 danielk1977 Exp $"; #include "html.h" #include <assert.h> #include <X11/Xutil.h> /*------------------------------------------------------------------------- |
︙ | ︙ | |||
4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 | HtmlTree *pTree; int x; int y; int w; int h; int windowsrepair; { /* Make sure the widget main window exists before painting anything */ Tk_MakeWindowExist(pTree->tkwin); Tk_MakeWindowExist(pTree->docwin); widgetRepair(pTree, x, y, w, h, windowsrepair); if (windowsrepair) { windowsRepair(pTree, &pTree->canvas); | > > | 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 | HtmlTree *pTree; int x; int y; int w; int h; int windowsrepair; { /* if( !pTree->options.enablelayout ) return; */ /* Make sure the widget main window exists before painting anything */ Tk_MakeWindowExist(pTree->tkwin); Tk_MakeWindowExist(pTree->docwin); widgetRepair(pTree, x, y, w, h, windowsrepair); if (windowsrepair) { windowsRepair(pTree, &pTree->canvas); |
︙ | ︙ |