Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[ALLY] Viewable Specification

From: mike::myers::cybarite::com at: 26-Nov-2000 11:24

This weekend I dove into %easyvid.r to find out how it does the things it does. I wanted to take its base and use Carl's specification dialect to enable adding help pages to buttons and other faces. The result is attached as %viewable-specification.r. The title line opens an "about face" page ;-) which was created using the topic specification approach. -- Attached file included as plaintext by Listar -- -- File: viewable-specification.r REBOL [ Title: "MikeSpec" Author: [mike--myers--cybarite--com] File: %viewable-specification.r Date: 26-November-2000 Version: 1.0 History: [ 'orig 26-November-2000] ] ;;;;;;;;;;;;;; This parsing section was 'gleaned' from %easyvid.r ;;;;;;;;;;;;;;;;;;;; ; [ parsing section space: charset " ^-" chars: complement charset " ^-^/" rules: [some parts] parts: [ newline | ["===" | "h1"] section ; this is a section heading - like an html h1 | ["---" | "h2"] subsect ; this is a subsection heading - like an html h2 | ".l1" bullet-l1 ; this is a level 1 bullet. | ".l2" bullet-l2 ; this is a level 2 bullet. | "!" note ; this is a note to emphasize - per %easyvid.r | paragraph ; this is a paragraph of text | some space text-line ; this is a line holding spaces only ] text-line: [copy text to newline newline] indented: [some space thru newline] paragraph: [copy para some [chars thru newline] (across-return emit 'txt para)] note: [copy para some [chars thru newline] (across-return emit-note para)] section: [ text-line (across-return emit h1 text ) newline ] across-return: func [] [ emit-control 'across emit-control 'return] bullet-l1: [text-line ( across-return emit check red emit txt text emit-control 'below )] bullet-l2: [text-line ( across-return emit txt 20x10 "" emit check yellow emit txt text emit-control 'below )] subsect: [text-line ( across-return emit h2 text)] emit: func ['style data] [repend layout-current [style data]] emit-control: func [data] [repend layout-current data] emit-note: func [data-to-display] [ remove back tail data-to-display repend layout-current ['text-note 460x-1 data-to-display] ] parse-specification: func [some-content] [ layout-current: copy [] parse/all detab some-content rules return layout-current ] ; ] parsing section ; end of parsing section ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; specification-display: func [aTitle [string!] aSpecification [string!]] [ append base: copy [ styles styles-specification size statics/sizes/sub-page across backdrop statics/colors/backdrop h1 ] aTitle append base 'return append base parse-specification aSpecification append base [at 250x550 button "OK" [unview]] ] styles-specification: stylize [ text-note: txt maroon bold button-with-right-mouse-help: button [] [ view/new layout do [specification-display rejoin ["Notes For Button Labelled " face/texts/1] face/texts/2 ] ] ] statics: [ sizes [ page 600x600 sub-page 660x600 input-size 550x500 ] colors [ backdrop 204.204.153 ] ] view layout [ styles styles-specification size statics/sizes/page backdrop statics/colors/backdrop tabs [20 100 200 300 400 500 600] title "Specification to Visual Interface Display" [ view/new layout do [specification-display "About Face" {h1 Viewable Specification.^/^/.l1 About: ^/^/.l2 Author: [mike--myers--cybarite--com]^/^/.l2 Date: 26-November-2000^/^/.l2 Purpose: Makespec.r and easyvid.r data input in view.^/^/.l2 Uses: Some of the power of REBOL view to make stylized buttons and faces.^/^/.l2 Based on input from Carl Sassenrath's %easyvid.r and [Jeff--rebol--com] notes on utilizing View.^/^/.l1 Contains: .^/^/.l2 Routine for parsing %easyvid.r format which is now currently embedded in %easyvid.r.^/^/.l2 Extends the control codes used in %makespec.r and %easyvid.r by adding two levels of bullets.^/^/.l2 Extended style button for providing 'helpful' buttons. Get information about what a button does by the right mouse button. This is enabled for the 'Display' and 'Quit' button on the main page.^/^/.l1 Next Steps:^/^/.l2 Add save button to write the source text out to a file. This will allow the text to be entered on the input screen and displayed for validation, then saved to a file. It does not need to be sav! ed. It can be clipped out of the face window.^/^/.l2 Refine parsing to remove need for the CRLFs to separate the control records.^/^/.l2 Submit to Rebol Technology Script Library.^/^/} ] ] return below tab tab across tab spec-definition: area wrap statics/sizes/input-size {For 'about' press the title line.^/^/h1 Level 1 heading^/^/=== This is also a level one heading^/^/Can also use === and --- per %makespec.r^/^/Text starts in column 1^/^/Here the indented view is not (yet) supported. That was used in %easyvid.r to support runnable examples and in %makespec.r for code examples (which were not runnable from the user interface).^/^/^/Here is what happens when you don't comply with the limited protocol and start text in column 1.^/ It is ignored!!!!!^/^/!It was ignored. This is not right but that is a minor enhancement to fix.^/^/h2 Level 2 heading^/^/Bullets are displayed by entering them like this.^/^/.l1 First level bullet^/^/.l2 This is a second level bullet with some wrapped text beside. The text should stay indented and align OK.^/h2 Excuse on bullets^/^/.l1 OK they're check boxes. For a presentation I use check boxes because I can mark off the progress in the presentation on the screen. This means it is visually easy to see what ha! s been covered. } return tab tab button-with-right-mouse-help "Display" {^/.l1 Causes a refresh of the display area.^/} [view/new layout do [append ; append the OK button at the end append copy [ ; append the output of the parsing styles styles-specification size statics/sizes/sub-page across backdrop statics/colors/backdrop h1 "Visually Displayed" return ] parse-specification spec-definition/text ; parse the specification found on the input area face [at 250x550 button "OK" [unview]] ] ; end of do block ] across pad 240 button-with-right-mouse-help "Done" {^/^/!Done will close the application.^/^/!No data is saved.^/^/} [quit] ]