Rebol [
    Title: "Anton's User.r Extension"
    File: %anton-user.r
    Date: 29-May-2010
    Version: 1.3.6
    Status: "Working on R2, troubles with the new R3 beta."
    Needs: []
    Author: "Anton Rolls"
    Language: "English"
    Purpose: {Set up the rebol console the way I like it. Called from user.r.}
    History: [
        1.0.0 [15-Sep-2001 {First version} "Anton"]
        1.0.1 [8-Nov-2001 {moved site} "Anton"]
        1.0.2 [25-Nov-2001 {changed default window background colour} "Anton"]
        1.0.3 [2-Jan-2002 {removed set-user-name} "Anton"]
        1.0.4 [17-Feb-2002 {updated using new include framework} "Anton"]
        1.0.5 [18-Feb-2002 {including push-cache} "Anton"]
        1.0.6 [6-Jun-2002 {moved site} "Anton"]
        1.0.7 [21-Jun-2002 {added set-cache-site in line with new push-cache} "Anton"]
        1.0.8 [24-Jun-2002 {added desktop-patch.r} "Anton"]
        1.0.9 [19-Jul-2002 {added edit} "Anton"]
        1.1.0 [28-Jan-2003 {added latest} "Anton"]
        1.1.1 [20-Mar-2003 {moved edit function -> shell/windows/edit.r,
            commented help patch because from Core 2.5 it's built in} "Anton"]
        1.1.2 [9-Sep-2003 {added patch/editor-slider-patch.r, getting site <- reboltech,
            moved some patches into "view" section} "Anton"]
        1.1.3 [3-Oct-2003 {changed site/shell/ -> site/os/} "Anton"]
        1.1.4 [4-Oct-2003 {added os/exec.r} "Anton"]
        1.1.5 [4-Dec-2003 {added patch/ftp-romano-patch/ftp-patch53.r} "Anton"]
        1.1.6 [30-Apr-2004 {check for view or link when including} "Anton"]
        1.1.7 [5-Jul-2004 {added patch/layout-rtn-patch.r} "Anton"]
        1.1.8 [6-Aug-2004 {changed to new dir-utils system} "Anton"]
        1.1.9 [30-Oct-2004 {added Romano's wake-event and inform patches} "Anton"]
        1.2.0 [22-Apr-2005 {added hedit} "Anton"]
        1.2.1 [22-May-2005 {added version check around ftp patch} "Anton"]
        1.2.2 [26-May-2005 {added version check for wake-event stuff and the very old start-view?} "Anton"]
        1.2.3 [26-Nov-2005 {added find-file} "Anton"]
        1.2.4 [5-Dec-2005 {temporarily added svvf/hot/cue: none patch} "Anton"]
        1.2.5 [7-Dec-2005 {removed svvf/hot/cue: none patch (now it's in View 1.3.2 anyway)} "Anton"]
        1.2.6 [13-Nov-2006 {added the include of SEEK from util/find-file.r} "Anton"]
        1.2.7 [21-Nov-2006 {added the include of divider-bar-style needed by SEEK} "Anton"]
        1.2.8 [27-Nov-2006 {added SEARCH-DICTIONARY} "Anton"]
        1.2.9 [13-Feb-2007 {added RECENT} "Anton"]
        1.3.0 [31-Mar-2007 {added CHECKSUM-FILE and BATCH-DOWNLOAD} "Anton"]
        1.3.1 [8-Nov-2007 {added patch/ctx-edit-patch.r} "Anton"]
        1.3.2 [13-Nov-2007 {editor background colour set without having to make ctx-edit an object first} "Anton"]
        1.3.3 [20-Nov-2007 {os/windows/edit.r -> os/edit.r} "Anton"]
        1.3.4 [23-Mar-2009 {Enabled master-style-patch.r (which only patches ANIM.). Added VIEW-IMAGE.} "Anton"]
        1.3.5 [20-May-2009 {Added EXPLORE.} "Anton"]
        1.3.6 [29-May-2010 {Added patch/request-date-patch.r} "Anton"]
    ]
    ToDo: {
    - check these patches with respect to recent betas (ie. View 1.2.113) and changes in desktop etc:
      - patch/layout-rtn-patch.r
      - patch/src.r (looks pretty harmless, because it adds 'src, does not modify :source)
      - DONE patch/grow-facets.r
    - also do the romano ftp patch for Rebol/Cores less than the Core in View1.2.110
    - window with button that starts everything
    - option to update to latest anton-user.r (using acquire ?) -> better to link to download-centre.r
    - rebol script template file
    - to set default colours (for desktop, editor etc.)
    }
    Notes: {
    setup-anton.r appends a call to this file to user.r, eg:

        do load-thru http://anton.wildit.net.au/rebol/anton-user.r

        23-May-2006 Noticed official Rebsite index is now at http://www.rebol.net/reb/index.r
        (See download-centre.r)
    }
]

site: select load-thru http://www.rebol.net/reb/index.r [folder "Anton"]
clear find site %index.r

use [url][
    either none? do load-thru url: site/library/include.r [
        print ["Couldn't load-thru" url]
    ][
        include [
            ;;site/library/dir-utils.r 'all
            site/library/push-cache.r [push-cache]
            site/library/tree.r [tree]
            site/util/latest.r [latest recent]
            site/util/checksum-file.r [checksum-file]
            site/library/search-dictionary.r [search-dictionary]
        ]
        include compose/deep [
            (either view? [[site/gui/divider-bar.r [divider-bar-style]]][]) ; needed by SEEK
            site/util/find-file.r [find-file (either view? ['seek][])]
        ]
        if find [view link] system/product [ ; what better way to test for shell access ? use 'component? 'shell
            include [site/os/edit.r [edit hedit]]
            include [site/os/explore.r [explore]]
        ]
    ]
]
push-cache/quiet/set-cache-site none site

foreach file [
    library/dir-utils.r
    ;patch/help.r
    patch/src.r
][do load-thru site/:file]

dir-utils ; export the dir-utils functions

if find form system/product "view" [

    ; see http://www.rebol.net/article/0225.html
    ;;print "anton-user:  svvf/hot/cue: none   (early testing for View 1.3.61, this change went into View 1.3.2)"
    ;;svvf/hot/cue: none

    if (system/version * 1.1.1.0.0) < 1.2.110.0.0 [ ; View1.2.110 has Romano's FTP handler built in.
        do load-thru site/patch/ftp-romano-patch/ftp-patch53.r
    ]

    if (system/version * 1.1.1.0.0) < 1.2.112.0.0 [ ; View1.2.112 has Gabriele's wake-event (introducing pop-face/feel/pop-detect)
        do load-thru http://www.rebol.it/~romano/wake-event.r
        ;;do load-thru site/freezer/wake-event.r
        ;;do load-thru http://www.rebol.it/~romano/inform.r
        do load-thru site/patch/inform.r ; patches View versions <= 1.2.11.x.x
    ]

    foreach file [
        patch/master-style-patch.r
        patch/grow-facets.r ; patches View versions < 1.2.14.x.x
        patch/desktop-patch.r ; patches View versions < 1.2.14.x.x
        patch/editor-slider-patch.r ; patches View versions < 1.2.14.x.x
        patch/ctx-edit-patch.r ; tested on View 2.7.5.3.1 (in Wine)
        patch/layout-rtn-patch.r
        patch/request-date-patch.r ; tested on View 2.7.6.4.2
        ;os/exec.r
    ][do load-thru site/:file]

    include [
        site/util/batch-download.r [batch-download]
        site/gui/zoom-image.r [zoom-image-style] ; Needed by view-image.
        site/util/view-image.r [view-image]
    ]
    
    if (system/version * 1.1.1.0.0) < 1.2.1.0.0 [
        start-view?: no ; backwards compatibility to older versions of rebol/view
    ]

    ; Change the built-in EDITOR background colour
    ;if block? ctx-edit [ctx-edit: context ctx-edit]
    ;ctx-edit/t1/color: 180.171.158 ; might be better to modify ctx-edit as a block without making ctx
    insert find/tail third find ctx-edit [ed-lo:][t1: area] 180.171.158 ; assumes ctx-edit is still a block

    ; testing local
    ;do %local/library/scroller-style.r

    ; set default color for window backgrounds
    system/view/vid/vid-face/color: 170.164.130

    ; set request-file background color
    ;system/words/ctx-text/view*/vid/vid-face/color: your-color
]

; don't show "connecting to..." net access messages in core console
;system/options/quiet: true ;; rebol betas set this to false after user.r anyway...

; current project directory
;project-dir: %local/util/map/