home *** CD-ROM | disk | FTP | other *** search
Helm Multimedia Book | 1995-07-10 | 18.3 KB | 505 lines |
- PlotBook
- Scott Nickerson
- 12-09-93
- TRIGONOMETRY
- on BookOpen
- begin
- set the pointer to 6
- set the brushnumber to 1
- clearplot()
- set the pointer to 0
- on clearplot
- begin
- global cx, cy, TE, BE, LE, RE
- put "\nCLEARING\nPLOT" into textfield "Readout"
- put 6 into Bd
- // this is the border size
- put the id of button "theArea" into Bid
- put the topedge of (button id Bid) + Bd into TE
- put the bottomedge of (button id Bid) - Bd into BE
- put the leftedge of (button id Bid) + Bd into LE
- put the rightedge of (button id Bid) - Bd into RE
- put the width of button id Bid into w
- put the height of button id Bid into h
- put the pencolor into tempcolor
- set the apen to 2
- fillbox LE, TE, RE, BE
- set the apen to 5
- put LE + w / 2 - Bd into cx
- put TE + h / 2 - Bd into cy
- fillbox cx, TE, cx, BE
- fillbox LE, cy, RE, cy
- // Add horizontal marks
- put textfield "Zoom:" into zm
- put 0 into n
- put 0 into k
- put cx into xp
- put cx into xn
- put cx into Lastx
- while xp <= RE {
- if xp - Lastx > 40 {
- moveto xp, cy - 3
- drawto xp, cy + 3
- moveto xp - 3, cy + 15
- drawtext k
- moveto xn, cy - 3
- drawto xn, cy + 3
- moveto xn - 12, cy + 15
- drawtext k * -1
- put xp into Lastx
- add zm to n
- add 1 to k
- put cx - n * zm into xn
- put cx + n * zm into xp
- // Add vertical marks
- put 0 into n
- put 0 into k
- put cy into yp
- put cy into yn
- put cy into Lasty
- while yp <= BE {
- if yp - Lasty > 40 {
- if k > 99 put 30 into offset
- else if k > 9 put 20 into offset
- else put 10 into offset
- moveto cx - 3, yp
- drawto cx + 3, yp
- moveto cx - offset - 10, yp + 3
- drawtext k * -1
- moveto cx - 3, yn
- drawto cx + 3, yn
- moveto cx - offset, yn + 3
- drawtext k
- put yp into Lasty
- add zm to n
- add 1 to k
- put cy - n * zm into yn
- put cy + n * zm into yp
- set the apen to tempcolor
- put empty into textfield "Readout"
- clearplot
- clearplot
- CLEARING
- Readout
- theArea
- Zoom:
- Readout
- New...
- Open...
- Make Copy...
- Streamline...
- Preferences...
- Workbench
- Help...
- About...
- Quit...
- Paste
- Clear
- Select All
- Cut Page
- Copy Page
- Colors
- Load...
- Save...
- Restore Colors
- Default Colors
- Brush Colors
- Image Colors
- Last Color Font
- Cycle
- Grid...
- Stop Sound
- Show All
- Unlock All
- Edit Form
- Share
- Next Page
- Previous Page
- First Page
- Last Page
- Backward
- Forward
- Last Book
- Browse...
- Autobrowse...
- Bookshelf
- New Page
- Delete Page
- New Form
- Load Form...
- Save Form...
- Image
- Load...
- Save...
- Capture...
- Clipboard
- Paste
- Spare
- Swap Frames
- Copy to Spare
- Merge in Front
- Merge in Back
- Delete Spare
- Frame
- Previous
- Delete
- Copy to All
- Color
- Remap
- Transparency
- Paper <-> Pen
- Paper -> Pen
- Count
- Vertical
- Horizontal
- Info...
- Brush
- Load...
- Save...
- Restore
- Clipboard
- Paste
- Color
- Remap
- Transparency
- Paper <-> Pen
- Paper -> Pen
- Center
- Corner
- Any Point
- Any Size
- Halve
- Double
- Halve Width
- Halve Height
- Double Width
- Double Height
- To PAL
- To NTSC
- Vertical
- Horizontal
- Shear
- Vertical
- Horizontal
- Rotate
- Any Angle
- Paint
- Matte
- Color
- Replace
- Smear
- Dissolve
- Spare
- Cycle
- Cycle 2
- Gradient
- Gradient 2
- Smudge
- Chaos
- Count
- Custom
- Dither
- Edges
- Object
- Load...
- Save...
- Bring to Front
- Send to Back
- Bring Closer
- Send Farther
- Group
- Ungroup
- Duplicate...
- Align...
- Info...
- Actions...
- Script...
- Load...
- Save...
- Plain
- Underline
- Italic
- Shadow
- Font...
- Spacing...
- Hypertext
- Actions...
- Script...
- Tools
- Coordinates
- Title Bar
- Palette
- Colors
- Patterns
- Paint Tools
- Paint Types
- Histogram
- Magnifier
- Messages
- Draw Tools
- Layers
- Pages
- Author
- Book...
- Form...
- Page...
- Display...
- Narrator...
- Hypertext...
- Resources...
- Effect...
- Effect Area
- topaz.fontGLOB
- fonts:Book23
- ram:TestBook
- df1:PlotBook
- 0.050
- x * x
- (x * x) / 20
- 3 * sin x
- x * cos x
- tan x
- abs(3 * sin x)
- PlotBook by Eagle Tree Software
- (11 December 93)
- 7This is a unique book because it compiles a script each
- 8time it plots an equation. For the best performance, the
- 5equation is concatenated into a long string to make a
- 7ploting function. The script is compiled when the
- command changes the form script. Here is a simple event
- 6function that also creates and calls another function:
- on SelectUp begin
- * put textfield "Equation" into equation
- " set the script of this page to
- "EvalEquation begin\n" &
- & " put " & equation & " into c\n" &
- " answer c\n" &
- "end"
- EvalEquation()
- end
- 7When dynamically creating and calling a function script
- 6in this way, remember to put the new script in a place
- 8within the current script's event hierarchy. Even though
- 4you can change a page script from a form object, you
- 8will not be able to call the new script because the page
- 8is not in the event hierarchy of a form object. For form
- 8objects, you will want to change either the form or book
- (script. For page objects, you can change
- the page, form, or book script.
- x * cos x
- theArea
- Start:
- theColor
- Step:
- Zoom:
- Elist
- @I Information
- @C Clear
- @B Bookshelf
- ~ Plot
- @D Default
- Lists
- @Q Quit
- Equation
- Presets
- Readout
- on SelectDown
- begin
- popup "1\n2\n3\n4\n5\n10\n15\n20"
- if it is not empty begin
- put it into textfield "Zoom:"
- set the pointer to 6
- clearplot()
- set the pointer to 0
- end
- Zoom:
- clearplot
- on SelectDown
- begin
- popup "-150\n-100\n-75\n-50\n-25\n-15\n-10\n-5\n 0"
- if it is not empty then put it into textfield "Start:"
- Start:
- on SelectDown
- begin
- popup "1.25\n1.00\n0.75\n0.50\n0.25\n0.10\n0.075\n0.050\n0.025\n0.010"
- if it is not empty then put it into textfield "Step:"
- 0.075
- 0.050
- 0.025
- 0.010
- Step:
- yon SelectDown
- begin
- popup "150\n100\n75\n50\n25\n15\n10\n5"
- if it is not empty then put it into textfield "End:"
- on SelectUp
- begin
- set the pointer to 6
- play notes "c6x"
- lock display
- set the visibility of layer "Info" to TRUE
- set the lock of layer "F1" to TRUE
- unlock display with wipe down
- set the pointer to 0
- Ron SelectUp
- begin
- set the pointer to 6
- clearplot()
- set the pointer to 0
- clearplot
- 3on SelectUp
- begin
- go to the book "Bookshelf"
- Bookshelf
- on SelectUp {
- global cx, cy, TE, BE, LE, RE
- set the pointer to 6
- set the apen to selector "theColor"
- put textfield "Equation" into espn
- put the number of characters of espn into NUespn
- put textfield "Zoom:" into zoom
- put (textfield "Start:") * zoom into begun
- put (textfield "End:") * zoom into ended
- put (textfield "Step:") * zoom into theStep
- put 0.0 + begun into z
- while cx + z * zoom < LE
- add theStep to z
- if ended <= begun {
- answer "Bad number"
- break
- put "\nCOMPILING\nFUNCTION" into the textfield "Readout"
- //----------------------------------------------------------
- set the script of this form to
- "plotit x, ended, theStep, zoom {\n" &
- " global cx, cy, TE, BE, LE, RE\n" &
- " put FALSE into fflag\n" &
- " while x <= ended { \n" &
- " put (" & espn & ") into yoff\n" &
- " put cx + x * zoom into theX\n" &
- " put cy + (yoff * -1) * zoom into theY\n" &
- " if theX > RE then break\n" &
- " if theY < TE then put TE into theY\n" &
- " if theY > BE then put BE into theY\n" &
- " if fflag is FALSE { \n" &
- " moveto theX, theY\n" &
- " put theY into LastY\n" &
- " put TRUE into fflag\n" &
- " }\n" &
- " else {\n" &
- " if theY = LastY and (theY = TE or theY = BE) then moveto theX, theY\n" &
- " else drawto theX, theY\n" &
- " put theY into LastY\n" &
- " }\n" &
- " add theStep to x\n" &
- " }\n" &
- //----------------------------------------------------------
- put empty into textfield "Readout" // Gives it a nice blink
- put "\nEXECUTING\nFUNCTION" into textfield "Readout"
- plotit(z, ended, theStep, zoom)
- play notes "c7x c#"
- put empty into textfield "Readout"
- set the pointer to 0
- theColor
- Equation
- Zoom:
- Start:
- Step:
- Bad number
- COMPILING
- FUNCTION
- Readout
- plotit x, ended, theStep, zoom {
- global cx, cy, TE, BE, LE, RE
- put FALSE into fflag
- while x <= ended {
- put (
- ) into yoff
- put cx + x * zoom into theX
- put cy + (yoff * -1) * zoom into theY
- if theX > RE then break
- if theY < TE then put TE into theY
- if theY > BE then put BE into theY
- if fflag is FALSE {
- moveto theX, theY
- put theY into LastY
- put TRUE into fflag
- }
- else {
- if theY = LastY and (theY = TE or theY = BE) then moveto theX, theY
- else drawto theX, theY
- put theY into LastY
- }
- add theStep to x
- Readout
- EXECUTING
- FUNCTION
- Readout
- plotit
- c7x c#
- Readout
- on SelectUp
- begin
- put -5 into textfield "Start:"
- put 5 into textfield "End:"
- put "0.05" into textfield "Step:"
- get textfield "Zoom:"
- if it is not 10 then begin
- put 10 into textfield "Zoom:"
- clearplot()
- end
- put 6 into selector "theColor"
- Start:
- Step:
- Zoom:
- Zoom:
- clearplot
- theColor
- on SelectUp
- begin
- on SelectDown
- begin
- put the bottomedge of me into be
- put the leftedge of me into le
- popup textfield "Elist" topedge be leftedge le
- if it is not empty then put it into textfield "Equation"
- Elist
- Equation
- on SelectUp
- begin
- set the pointer to 6
- play notes "c6x"
- lock display
- set the visibility of layer "Info" to false
- set the lock of layer "F1" to false
- clearplot()
- unlock display with wipe down
- set the pointer to 0
- clearplot
- Yplotit x, ended, theStep, zoom {
- global cx, cy, TE, BE, LE, RE
- put FALSE into fflag
- while x <= ended {
- put (x * cos x) into yoff
- put cx + x * zoom into theX
- put cy + (yoff * -1) * zoom into theY
- if theX > RE then break
- if theY < TE then put TE into theY
- if theY > BE then put BE into theY
- if fflag is FALSE {
- moveto theX, theY
- put theY into LastY
- put TRUE into fflag
- }
- else {
- if theY = LastY and (theY = TE or theY = BE) then moveto theX, theY
- else drawto theX, theY
- put theY into LastY
- }
- add theStep to x
- plotit
- ffUPAGE
- 2sumit z, b, c, d
- begin
- answer z + b + c + d
- sumit
-