Changeset 75

Show
Ignore:
Timestamp:
04/09/07 04:15:48 (20 months ago)
Author:
ashley
Message:

Fixes for problems introduced in build 74
Widget documentation improved

Files:
44 modified

Legend:

Unmodified
Added
Removed
  • create-distribution.r

    r73 r75  
    4747;       remove extra newlines 
    4848replace/all code "^/^/" "^/" 
     49;       tip compression 
     50replace/all code "^^-^^-^^-" "" 
     51replace/all code "^^-^^-" "" 
     52replace/all code "tip: {^/" "tip:{" 
     53replace/all code "^/^^-} " "}" 
    4954;       compact block delimiters 
    5055replace/all code "[ " "[" 
  • functions/display.r

    r74 r75  
    7575                if all [not dialog effects/tooltip-delay] [ 
    7676                        tooltip-time: now/time/precise 
    77                         insert tail spec/pane tooltip: make widgets/tooltip [type: 'tooltip offset: -10000x-10000] 
     77                        insert tail spec/pane tooltip: make widgets/tooltip [type: 'tooltip offset: -10000x-10000 tip: none] 
    7878                ] 
    7979                detect: make function! [face event /local f] [ 
     
    9898                                f: event/face 
    9999                                while [f: find-face event/offset f] [ 
    100                                         if f/tip [ 
     100                                        if all [f/type <> 'face f/tip] [ 
    101101                                                tooltip/text: f/tip 
    102102                                                tooltip/init 
  • functions/examine.r

    r74 r75  
    11set 'examine make function! [ 
    22        "Prints information about widgets and attributes." 
    3         'widget [word!] 
    4         /indent "Indent and return output as an MD2 ready string" 
    5         /local string tmp tabs 
     3        'widget 
     4        /indent "Indent output as an MD2 ready string" 
     5        /no-print "Do not print output to console" 
     6        /local string tmp blk tabs 
    67][ 
     8        unless word? widget [widget: to word! widget] 
    79        unless find tmp: next find first widgets 'choose widget [ 
    810                print "Unknown widget. Supported widgets are:^/" 
     
    1214        tabs: make function! [w /local l] [ 
    1315                l: length? form w 
    14                 join w case [l < 7 [":^-^-^-"] l < 11 [":^-^-"] true [":^-"]] 
     16                join w case [l < 7 [rejoin [":" tab tab tab]] l < 11 [rejoin [":" tab tab]] true [join ":" tab]] 
    1517        ] 
    1618        widget: widgets/:widget 
    1719        ;       usage & description 
    18         string: rejoin [ 
    19                 "^/^-USAGE:^/^-^-" 
    20                 replace/all mold/only load widget/tip "^/" "^/^-^-" 
    21                 "^/^/^/^-DESCRIPTION:^/^-^-" 
    22                 replace/all copy widget/type "^/" "^/^-^-" 
    23                 "^/" 
    24         ] 
     20        string: replace/all copy widget/tip "^/" "^/^-" 
     21        replace/all string "[" join " " "[" 
     22        replace/all string "]" join "]" " " 
     23        replace/all string "^- " "^-" 
     24        replace/all string " ^/" "^/" 
     25        replace string "^-DESCRIPTION:" "^/DESCRIPTION:" 
     26        replace string "^-OPTIONS:" "^/OPTIONS:" 
    2527        ;       standard attributes 
    26         insert tail string "^/^-ATTRIBUTES:^/" 
     28        insert tail string "^/^/^/ATTRIBUTES:" 
    2729        foreach attribute first rebface [ 
    2830                if all [ 
    29                         not find [self type offset show? options face-flags feel action tip] attribute 
     31                        not find [self type offset show? face-flags feel action tip] attribute 
    3032                        get tmp: in widget attribute 
    3133                ][ 
    3234                        tmp: either find ["function" "object" "block" "bitset"] form type? get tmp [join type? get tmp "!"] [mold get tmp] 
    33                         insert tail string rejoin ["^-^-" tabs attribute tmp "^/"] 
     35                        insert tail string rejoin ["^/^-" tabs attribute tmp] 
    3436                ] 
    3537        ] 
    3638        ;       feels 
    3739        unless widget/feel = widgets/default-feel [ 
    38                 insert tail string "^/^-PREDEFINED FEELS:^/" 
     40                insert tail string "^/^/PREDEFINED FEELS:" 
    3941                foreach attribute next first widgets/default-feel [ 
    4042                        if get in widget/feel attribute [ 
    41                                 insert tail string rejoin ["^-^-" attribute "^/"] 
     43                                insert tail string join "^/^-" attribute 
    4244                        ] 
    4345                ] 
     
    4547        ;       actions 
    4648        unless widget/action = widgets/default-action [ 
    47                 insert tail string "^/^-PREDEFINED ACTIONS:^/" 
     49                insert tail string "^/^/PREDEFINED ACTIONS:" 
    4850                foreach attribute next first widgets/default-action [ 
    4951                        if get in widget/action attribute [ 
    50                                 insert tail string rejoin ["^-^-" attribute "^/"] 
     52                                insert tail string join "^/^-" attribute 
    5153                        ] 
    5254                ] 
    5355        ] 
    5456        ;       extended attributes 
    55         unless empty? tmp: difference first rebface first widget [ 
    56                 insert tail string "^/^-EXTENDED ATTRIBUTES:^/" 
    57                 foreach attribute copy tmp [ 
    58                         if get tmp: in widget attribute [ 
     57        unless empty? blk: difference first rebface first widget [ 
     58                insert tail string "^/^/EXTENDED ATTRIBUTES:" 
     59                foreach attribute blk [ 
     60                        if tmp: in widget attribute [ 
    5961                                tmp: either find ["function" "object" "block" "bitset"] form type? get tmp [join type? get tmp "!"] [mold get tmp] 
    60                                 insert tail string rejoin ["^-^-" tabs attribute tmp "^/"] 
     62                                insert tail string rejoin ["^/^-" tabs attribute tmp] 
    6163                        ] 
    6264                ] 
    6365        ] 
    64         either indent [string] [replace/all string "^/^-" "^/" remove string remove back tail string print string] 
     66        if indent [ 
     67                replace/all string "^/" "^/^-" 
     68                replace/all string "^-^/" "^/" 
     69                insert string "^-" 
     70        ] 
     71        if no-print [ 
     72                replace/all string "^-" "    " 
     73        ] 
     74        either any [indent no-print] [string] [print string] 
    6575] 
  • rebgui-ctx.r

    r74 r75  
    104104ctx-rebgui: make object! [ 
    105105 
    106         build:          74 
     106        build:          75 
    107107        view*:          system/view 
    108108        locale*:        system/locale 
     
    143143 
    144144        all-chars: make string! 256 
    145         insert all-chars to char! 0 
    146         repeat i 255 [insert tail all-chars to char! i] 
     145        repeat i 256 [insert tail all-chars to char! i - 1] 
    147146 
    148147        font?: make function! [ 
  • rebgui-edit.r

    r74 r75  
    163163        unfocus: make function! [/local face] [ 
    164164                if face: view*/focal-face [ 
    165                         if get in face/action 'on-unfocus [ 
     165                        if all [face/type <> 'face get in face/action 'on-unfocus] [ 
    166166                                unless face/action/on-unfocus face [return false] 
    167167                        ] 
     
    236236        ;       Cursor movement functions 
    237237 
    238 ;       word-limits: make function! [/local cs] [ 
    239 ;               cs: charset join " ^-^m/[](){}^"" newline       ; required for merge 
    240 ;               reduce [cs complement cs] 
    241 ;       ] 
    242         word-limits: make bitset! join " ^-^m/[](){}^"" newline ; required for merge 
     238        word-limits: make bitset! " ^/^-^m/[](){}^"" 
    243239        word-limits: reduce [word-limits complement word-limits] 
    244240 
     
    264260 
    265261        end-of-line: make function! [str] [ 
    266                 any [find str newline tail str] 
     262                any [find str "^/" tail str] 
    267263        ] 
    268264 
    269265        beg-of-line: make function! [str /local nstr] [ 
    270                 either nstr: find/reverse str newline [next nstr] [head str] 
     266                either nstr: find/reverse str "^/" [next nstr] [head str] 
    271267        ] 
    272268 
     
    367363        insert-char: make function! [face char] [ 
    368364                delete-selected-text 
    369                 unless any [insert? tail? view*/caret newline = first view*/caret] [remove view*/caret] ; AGT #25 
     365                unless any [insert? tail? view*/caret "^/" = first view*/caret] [remove view*/caret] ; AGT #25 
    370366                insert view*/caret char 
    371367                view*/caret: next view*/caret 
     
    444440                                        ][ 
    445441                                                undo-add face 
    446                                                 insert-char face newline 
     442                                                insert-char face "^/" 
    447443                                        ] 
    448444                                ] 
  • rebgui-layout.r

    r74 r75  
    7373        left-to-right?:         true 
    7474        after-count:            1 
    75         after-limit:            1000000 
     75        after-limit:            10000 
    7676 
    7777        view-face: make rebface [ 
     
    121121        append-widget: make function! [] [ 
    122122                if widget [ 
     123if string? widgets/:widget/type [print type] 
    123124                        insert tail view-face/pane make widgets/:widget [ 
    124                                 ;       type (set to word! to clear DESCRIPTION text) 
    125                                 type:   either any [string? widgets/:widget/type widgets/:widget/type = 'face] [widget] [widgets/:widget/type] 
     125                                type:   either widgets/:widget/type = 'face [widget] [widgets/:widget/type] 
    126126                                offset: xy 
    127127                                size:   sizes/cell * any [ 
     
    270270                                xy: as-pair margin-size/x + indent-width max-height + gap-size/y 
    271271                                left-to-right?: true 
    272                                 after-limit: 1000000 
     272                                after-limit: 10000 
    273273                        ) 
    274274                |       'reverse ( 
     
    276276                                xy: as-pair max-width max-height + gap-size/y 
    277277                                left-to-right?: false 
    278                                 after-limit: 1000000 
     278                                after-limit: 10000 
    279279                        ) 
    280280                |       'after set arg integer! ( 
     
    306306                |       'space set arg pair!    (append-widget gap-size: arg * sizes/cell) 
    307307                |       'tight                                  (append-widget margin-size: xy: gap-size: 0x0) 
    308                 |       'at set arg pair!               (append-widget xy: arg * sizes/cell + margin-size after-limit: 1000000) 
     308                |       'at set arg pair!               (append-widget xy: arg * sizes/cell + margin-size after-limit: 10000) 
    309309                |       'effect [set arg word! | set arg block!]        (attribute-effect: arg) 
    310310                |       'options set arg block!                                         (attribute-options: arg) 
  • rebgui-widgets.r

    r74 r75  
    137137 
    138138        default-text: make rebface [ 
    139                 size:   1000000x1000000 
     139                size:   10000x10000 
    140140                text:   "" 
    141141                font:   default-font 
     
    332332                        clear pane 
    333333                        ;END fixed by Cyphre, sponsored by Robert 
    334                         insert pane make rebface [ 
     334                        insert pane make subface [ 
    335335                                size: p/size 
    336336                                span: p/span 
     
    354354                                                                        ] 
    355355                                                                        ;END fixed by Cyphre, sponsored by Robert 
    356                                                                         line/pane/:i/text: replace/all form pick p/data index - 1 * cols + i newline "¶" 
     356                                                                        line/pane/:i/text: replace/all form pick p/data index - 1 * cols + i "^/" "¶" 
    357357                                                                        line/pane/:i/font/color: either find p/options 'no-action [ 
    358358                                                                                black 
     
    363363                                                                ] 
    364364                                                        ][ 
    365                                                                 line/text: replace/all form pick face/parent-face/data index newline "¶" 
     365                                                                line/text: replace/all form pick face/parent-face/data index "^/" "¶" 
    366366                                                                line/font/color: either find p/options 'no-action [ 
    367367                                                                        black 
     
    434434                                pane/1/line/pane: copy [] 
    435435                                repeat i cols [ 
    436                                         insert tail pane/1/line/pane make rebface [ 
     436                                        insert tail pane/1/line/pane make subface [ 
    437437                                                size:   as-pair 0 sizes/line 
    438438                                                font:   make default-font [align: aligns/:i] 
     
    442442                        ;       vertical scroller 
    443443                        insert tail pane make slider [ 
     444                                tip:    none 
    444445                                offset: as-pair p/size/x - sizes/slider 0 
    445446                                size:   as-pair sizes/slider p/size/y 
     
    504505        #include %widgets/button.r 
    505506        #include %widgets/calendar.r 
    506 ;       #include %widgets/chart.r 
    507507        #include %widgets/check.r 
    508508        #include %widgets/check-group.r 
    509509        #include %widgets/drop-list.r 
    510 ;       #include %widgets/drop-tree.r 
    511510        #include %widgets/edit-list.r 
    512511        #include %widgets/field.r 
    513 ;       #include %widgets/grid.r 
    514512        #include %widgets/group-box.r 
    515513        #include %widgets/image.r 
    516 ;       #include %widgets/input-grid.r 
    517514        #include %widgets/label.r 
    518515        #include %widgets/led.r 
  • rebgui.r

    <
    r74 r75  
    5252] 
    5353all-chars: make string! 256  
    54 insert all-chars to char! 0  
    55 repeat i 255[insert tail all-chars to char! i] 
     54repeat i 256[insert tail all-chars to char! i - 1] 
    5655font?: make function![ 
    5756font-name[string!] 
     
    259258unfocus: make function![/local face][ 
    260259if face: view*/focal-face[ 
    261 if get in face/action 'on-unfocus[ 
     260if all[face/type <> 'face get in face/action 'on-unfocus][ 
    262261unless face/action/on-unfocus face[return false] 
    263262] 
     
    318317remove face/undo 
    319318] 
    320 word-limits: make bitset! join { ^-^M/[](){}"} newline  
     319word-limits: make bitset! {  
     320^-^M/[](){}"}  
    321321word-limits: reduce[word-limits complement word-limits] 
    322322current-word: make function![str /local s ns][ 
     
    337337] 
    338338end-of-line: make function![str][ 
    339 any[find str newline tail str] 
     339any[find str "^/" tail str] 
    340340] 
    341341beg-of-line: make function![str /local nstr][ 
    342 either nstr: find/reverse str newline[next nstr][head str] 
     342either nstr: find/reverse str "^/"[next nstr][head str] 
    343343] 
    344344next-field: make function![face /wrap][ 
     
    427427insert-char: make function![face char][ 
    428428delete-selected-text  
    429 unless any[insert? tail? view*/caret newline = first view*/caret][remove view*/caret] 
     429unless any[insert? tail? view*/caret "^/" = first view*/caret][remove view*/caret] 
    430430insert view*/caret char  
    431431view*/caret: next view*/caret 
     
    501501][ 
    502502undo-add face  
    503 insert-char face newline 
     503insert-char face "^/" 
    504504] 
    505505] 
     
    677677] 
    678678default-text: make rebface[ 
    679 size: 1000000x1000000  
     679size: 10000x10000  
    680680text: ""  
    681681font: default-font  
     
    846846p: self  
    847847clear pane  
    848 insert pane make rebface[ 
     848insert pane make subface[ 
    849849size: p/size  
    850850span: p/span  
     
    866866line/pane/:i/size/x: line/pane/:i/size/x + (p/size/x - p/pane/2/size/x - (line/pane/:i/offset/x + line/pane/:i/size/x)) 
    867867] 
    868 line/pane/:i/text: replace/all form pick p/data index - 1 * cols + i newline "¶"  
     868line/pane/:i/text: replace/all form pick p/data index - 1 * cols + i "^/" "¶"  
    869869line/pane/:i/font/color: either find p/options 'no-action[ 
    870870black 
     
    875875] 
    876876][ 
    877 line/text: replace/all form pick face/parent-face/data index newline "¶"  
     877line/text: replace/all form pick face/parent-face/data index "^/" "¶"  
    878878line/font/color: either find p/options 'no-action[ 
    879879black 
     
    941941pane/1/line/pane: copy[] 
    942942repeat i cols[ 
    943 insert tail pane/1/line/pane make rebface[ 
     943insert tail pane/1/line/pane make subface[ 
    944944size: as-pair 0 sizes/line  
    945945font: make default-font[align: aligns/:i] 
     
    948948] 
    949949insert tail pane make slider[ 
     950tip: none  
    950951offset: as-pair p/size/x - sizes/slider 0  
    951952size: as-pair sizes/slider p/size/y  
     
    994995] 
    995996anim: make rebface[ 
    996 type: "Cycles a set of images."  
    997 tip: "anim data[%img1.png img2]rate 2"  
     997tip:{USAGE: 
     998anim data[%img1.png %img2.png] 
     999anim data[img1 img2 img3]rate 2 
     1000DESCRIPTION: 
     1001Cycles a set of images at a specified rate.} 
    9981002size: -1x-1  
    9991003effect: 'fit  
     
    10201024] 
    10211025area: make rebface[ 
    1022 type: "Editable text area with wrapping and scroller."  
    1023 tip: "area options[info]^/area -1^/area 50x-1"  
     1026tip:{USAGE: 
     1027area 
     1028area "Text" -1 
     1029area "Text" 50x-1 
     1030DESCRIPTION: 
     1031Editable text area with wrapping and scroller. 
     1032OPTIONS: 
     1033'info specifies read-only} 
    10241034size: 50x25  
    10251035text: ""  
     
    10831093p: self  
    10841094text-y: second size-text self  
    1085 all[negative? size/x size/x: 1000000 size/x: 4 + first size-text self] 
    1086 all[negative? size/y size/y: 1000000 size/y: 8 + text-y] 
     1095all[negative? size/x size/x: 10000 size/x: 4 + first size-text self] 
     1096all[negative? size/y size/y: 10000 size/y: 8 + text-y] 
    10871097pane: make slider[ 
     1098tip: none  
    10881099offset: as-pair p/size/x - sizes/slider 0  
    10891100size: as-pair sizes/slider p/size/y  
     
    11211132] 
    11221133arrow: make rebface[ 
    1123 type: {An arrow (default down) on a square button face. 
    1124 Height is set to width.}  
    1125 tip: {arrow 10 
     1134tip:{USAGE: 
     1135arrow 
     1136arrow 10 
    11261137arrow data 'up 
    11271138arrow data 'down 
    11281139arrow data 'left 
    1129 arrow data 'right}  
     1140arrow data 'right 
     1141DESCRIPTION: 
     1142An arrow (default down) on a square button face with height set to width.} 
    11301143size: 5x-1  
    11311144data: 'down  
     
    11491162rebind: make function![][effect/2: colors/btn-text] 
    11501163init: make function![][ 
    1151 all[string? type type: 'face tip: none] 
    11521164all[negative? size/y size/y: size/x] 
    11531165effect/rotate: select[up 0 right 90 down 180 left 270]data  
     
    11561168] 
    11571169bar: make rebface[ 
    1158 type: {A thin 3D bar used to separate widgets. 
    1159 Defaults to maximum width.}  
    1160 tip: "bar^/bar 100"  
     1170tip:{USAGE: 
     1171bar 
     1172bar 100 
     1173DESCRIPTION: 
     1174A thin 3D bar used to separate widgets. 
     1175Defaults to maximum display width.} 
    11611176size: -1x1  
    11621177color: colors/window  
     
    11651180] 
    11661181box: make rebface[ 
    1167 type: "The most basic of widgets, a rectangular area."  
    1168 tip: "box^/box red" 
     1182tip:{USAGE: 
     1183box 
     1184box red 
     1185DESCRIPTION: 
     1186The most basic of widgets, a rectangular area. 
     1187^-} 
    11691188] 
    11701189button: make rebface[ 
    1171 type: "Performs action when clicked."  
    1172 tip: {button "Hello"