QScript B6 — File Browser
QScriptB6v6.0 / QScriptB6v6.0 / Extensions / XGrapher.ini
XGrapher.ini — 13.94 KB — Download this file
[main]
name=Equation Grapher Extension 1.1
desc=Equation Grapher && Calculator
author=2001, INSIDES. ( insides@qscripts.cjb.net )
config=grapher
[vars]
gfactor=4
gclines=1
gcdots=1
gdmode=dot
gwclear=0
gscolors=1
gdcolors=1
gdgraphic=1
[mpopup]
n0=.XGrapher ...
n1=..XGrapher ...:xgrapher
n2=..-
n3=..Description ...:ext.desc xgrapher.ini
[script]
n0=; The contents of this script file are copyrighted by Insides Technologies, 2000.
n1=; General idea for the graph ( $greplace ) identifier which is the core of the Grapher by DARYTH, and I thank him for that.
n2=; Definitions hereby supplied are owned by Insides Technologies and INSIDES - insides@qscript.cjb.net, the script author.
n3=; Please read the End User License Agreement supplied in order to understand the copy restrictions.
n4=; Please contact the author of the script for any questions you might have.
n5=; Thanks for understanding.
n6=
n7=alias -l graph {
n8= if ($window(@Graph) == $null) { window -ph +lf @Graph 100 100 300 200 }
n9= if ($gvar(gwclear) == 1) { clear @Graph }
n10= gcenter
n11= set -u %min 0
n12= set -u %max 0
n13= set -u %avg 0
n14= var %cnt $calc(-5 * 2 ^ ($gfactor($gvar(gfactor)) - 1))
n15= var %limit $calc(5 * 2 ^ ($gfactor($gvar(gfactor)) - 1))
n16= var %neg -1
n17= var %xf $calc(300 / ( 5 * 2 ^ $gfactor($gvar(gfactor))))
n18= var %yf $calc(200 / ( 3 * 2 ^ $gfactor($gvar(gfactor))))
n19= set -u %xp $calc($window(@Graph).w / 2)
n20= set -u %yp $calc($window(@Graph).h / 2)
n21= if (%xs == $null) { set -u %xs $calc($int($calc(%cnt * %xf)) + %xp - 5) }
n22= if (%ys == $null) { set -u %ys $calc($calc($calc( %graphic ) * %neg) * %yf + %yp) }
n23= if ($gvar(gdmode) == dot) {
n24= while (%cnt <= %limit) {
n25= set -u %graphic $ggraph(%cnt,$1-)
n26= set -u %results $calc(%graphic)
n27= if (%results > %max) { set -u %max %results }
n28= if (%results < %min) { set -u %min %results }
n29= drawdot @Graph $colour(Normal) 1 $calc($int($calc(%cnt * %xf)) + %xp - 5) $calc($calc($calc( %graphic ) * %neg) * %yf + %yp)
n30= set -u %xs $calc($int($calc(%cnt * %xf)) + %xp - 5)
n31= set -u %ys $calc($calc($calc( %graphic ) * %neg) * %yf + %yp)
n32= inc %cnt .02
n33= }
n34= }
n35= if ($gvar(gdmode) == line) {
n36= while (%cnt <= %limit) {
n37= set -u %graphic $ggraph(%cnt,$1-)
n38= set -u %results $calc(%graphic)
n39= if (%results > %max) { set -u %max %results }
n40= if (%results < %min) { set -u %min %results }
n41= drawline @Graph $colour(Normal) 1 %xs %ys $calc($int($calc(%cnt * %xf)) + %xp - 5) $calc($calc($calc( %graphic ) * %neg) * %yf + %yp)
n42= set -u %xs $calc($int($calc(%cnt * %xf)) + %xp - 5)
n43= set -u %ys $calc($calc($calc( %graphic ) * %neg) * %yf + %yp)
n44= inc %cnt .02
n45= }
n46= }
n47= drawsave @Graph $tempdir $+ graph.bmp
n48= .timer -m 1 500 { did -g grapher 2 $tempdir $+ graph.bmp | gstatus READY. }
n49= set %avg $calc((%max + %min) / 2)
n50= glfield $did(grapher,63).lines %max %min %avg Y = $ucase($did(grapher,60))
n51=}
n52=
n53=alias -l gcenter {
n54= if ($gvar(gclines) != 1) { goto dots }
n55= drawline @Graph $colour(Normal) 1 145 0 145 210
n56= drawline @Graph $colour(Normal) 1 0 100 310 100
n57= :dots
n58= if ($gvar(gcdots) != 1) { return }
n59= var %dot 0
n60= while (%dot < 320) {
n61= var %ydot 0
n62= while (%ydot < 210) {
n63= drawdot @Graph $colour(Normal) 1 $calc(%dot - 5) %ydot
n64= inc %ydot 10
n65= }
n66= inc %dot 10
n67= }
n68=}
n69=
n70=alias -l greplace { return $remove($replace($2-,x,$1,sum,§gsum,!,§gn,fact,§gn,e^,§ge,round,§ground,rand,§grnd,root,§groot,sqrt,§gsqrt,log,§glog,ln,§gln,cos,§gcos,sin,§gsin,tan,§gtan,ctg,§gctg,a§gsin,§gasin,a§gcos,§gacos,a§gtan,§gatan,a§gctg,§gactg,abs,§gabs,int,§gint,[,§[,],]§,§,§$,+§,+,-§,-,*§,*,/§,/,§+,+,§-,-,§/,/,§^,^,[,$chr(40),],$chr(41)),§) }
n71=
n72=alias -l ggraph { return $calc( [ $greplace($1,$2-) ] ) }
n73=
n74=alias -l gsum { var %b $calc($1-) | var %f $calc($1- - 1) | while (%f > 0) { set %b $calc(%b + %f) | dec %f } | return %b }
n75=
n76=alias -l gn { var %b $calc($1-) | var %f $calc($1- - 1) | while (%f > 0) { set %b $calc(%b * %f) | dec %f } | return %b }
n77=
n78=alias -l ge { return $calc(2.71828182846 ^ $1-) }
n79=
n80=alias -l ground { if ($0 > 1) { var %item $2 | var %round $1 } | else { var %item $1 | var %round 5 } | return $round($calc(%item),%round) }
n81=
n82=alias -l grand { return $rand($1,$calc($2-)) }
n83=
n84=alias -l groot { return $calc($calc($2-) ^ (1 / $1)) }
n85=
n86=alias -l gsqrt { return $groot(2,$2-) }
n87=
n88=alias -l glog { return $calc(0.4342944819 * $log($calc($1-))) }
n89=
n90=alias -l gln { return $log($calc($1-)) }
n91=
n92=alias -l gsin { return $sin($calc($1-)) }
n93=
n94=alias -l gcos { return $cos($calc($1-)) }
n95=
n96=alias -l gtan { return $tan($calc($1-)) }
n97=
n98=alias -l gctg { return $calc(1 / $ctg($calc($1-))) }
n99=
n100=alias -l gasin { return $asin($calc($1-)) }
n101=
n102=alias -l gacos { return $acos($calc($1-)) }
n103=
n104=alias -l gatan { return $atan($calc($1-)) }
n105=
n106=alias -l gactg { return $atan($calc(1 / $calc($1-))) }
n107=
n108=alias -l gabs { return $abs($calc($1-)) }
n109=
n110=alias -l gint { return $int($calc($1-)) }
n111=
n112=alias -l gfactor { if ($1 !isnum) { return 1.5 } | if ($1 < 1) { return 5 } | if ($1 > 5) { return 1 } | if ($1 > 5) { return 1 } | return $calc(6 - $1) }
n113=
n114=alias -l gvar { return $readini $script vars $1 }
n115=
n116=alias -l gset { writeini $script vars $1 $2- }
n117=
n118=alias -l gfunction { set -u %function $replace($1,10,ROUND,11,RAND,12,SUM,13,FACT,14,LOG,20,ABS,21,LN,27,EXP,33,ROOT,45,SQRT) | set -u %function %function $+ $chr(40) | return %function }
n119=
n120=alias -l gafunction { if ($2 == 1) { set -u %function $replace($1,25,ASIN,26,ACOS,31,ATAN,32,ACTG) } | else { set -u %function $replace($1,25,SIN,26,COS,31,TAN,32,CTG) } | set -u %function %function $+ $chr(40) | return %function }
n121=
n122=alias -l gdraw { if ($0 == 0) { emsgbox There Is No Equation To Graph.§XGrapher [/xgrapher] | return } | set -u %l $count($1-,$chr(40)) | set -u %r $count($1-,$chr(41)) | if (%l != %r) { emsgbox The Given Equation Is Erroneous. Please Even Up The Number Of Left && Right Brackets.§XGrapher [/xgrapher] } | else { gstatus Please Wait. Plotting Graphic Y = $ucase($1-) $+ . | graph $1- } }
n123=
n124=dialog grapher {
n125= title ""
n126= size -1 -1 156 248
n127= option dbu
n128=
n129= box "",1,-3 -3 400 111
n130= icon 2,3 3 150 102
n131= radio "CALC",3,4 128 23 11,push,group
n132= radio "GRAPH",4,29 128 23 11,push
n133= radio "TABLE",5,54 128 23 11,push
n134= radio "MODE",6,79 128 23 11,push
n135= button "HELP",7,104 128 23 11
n136= button "OFF",8,129 128 23 11,cancel
n137= box "",15,-3 121 400 116
n138= check "SHIFT",46,4 145 23 11,push
n139= button "PICK",47,29 145 23 11,disable
n140= button "SAVE",48,54 145 23 11,disable
n141= button "BACK",49,79 145 23 11,disable
n142= button "CLEAR",50,104 145 23 11
n143= button "HIST",51,129 145 23 11,disable
n144= button "INT",9,4 158 23 11
n145= button "ROUND",10,29 158 23 11
n146= button "RAND",11,54 158 23 11
n147= button "SUM",12,79 158 23 11
n148= button "FACT",13,104 158 23 11
n149= button "LOG",14,129 158 23 11
n150= button "(",16,4 171 23 11
n151= button ")",17,29 171 23 11
n152= button "RCL",18,54 171 23 11,disable
n153= button "STORE",19,79 171 23 11,disable
n154= button "ABS",20,104 171 23 11
n155= button "LN",21,129 171 23 11
n156= button "7",22,4 184 23 11
n157= button "8",23,29 184 23 11
n158= button "9",24,54 184 23 11
n159= button "SIN",25,79 184 23 11
n160= button "COS",26,104 184 23 11
n161= button "EXP",27,129 184 23 11
n162= button "4",28,4 197 23 11
n163= button "5",29,29 197 23 11
n164= button "6",30,54 197 23 11
n165= button "TAN",31,79 197 23 11
n166= button "CTG",32,104 197 23 11
n167= button "ROOT",33,129 197 23 11
n168= button "1",34,4 210 23 11
n169= button "2",35,29 210 23 11
n170= button "3",36,54 210 23 11
n171= button "+",37,79 210 23 11
n172= button "-",38,104 210 23 11
n173= button "^",39,129 210 23 11
n174= button "0",40,4 223 23 11
n175= button ".",41,29 223 23 11
n176= button "PI",42,54 223 23 11
n177= button "x",43,79 223 23 11
n178= button ":",44,104 223 23 11
n179= button "SQRT",45,129 223 23 11
n180= box "",59,-3 138 400 300
n181= edit "",60,4 111 123 11,autohs
n182= button "CALC",61,129 111 23 11,default
n183= edit "",62,3 3 150 102,read,multi,left,autohs,autovs,vsbar
n184= list 63,3 4 150 110,hide
n185= box "",64,3 2 150 102,hide
n186= check "Clear Graphing Space Before Each Graphic.",65,7 10 130 7,hide
n187= check "Draw Coordinate Dots On Graphing Space.",66,7 20 130 7,hide
n188= check "Draw Coordinate Lines On Graphing Space.",67,7 30 130 7,hide
n189= check "Use System Colors On Graphing Space.",68,7 40 130 7,hide
n190= check "Use Different Colors For Each Graphic.",69,7 50 130 7,hide
n191= check "Delete Graphics After Finishing.",70,7 60 130 7,hide
n192= radio "Draw Graphics Using Nonconnected Dots.",71,7 70 130 7,group,hide
n193= radio "Draw Graphics Using Connected Lines.",72,7 80 130 7,hide
n194= edit "",73,7 89 20 11,hide,center,limit 5
n195= text "Define The ZOOMing Factor (1 - 5).",74,30 91 120 7,hide
n196= text "",100,5 239 150 7
n197= button "Positioner",101,0 0 0 0
n198=}
n199=
n200=On *:DIALOG:grapher:init:0:{
n201= qdinit $dname 100 8 XGpaher ( Calculator )
n202= mdx SetBorderStyle $dname 62
n203= mdx SetControlMDX $dname 63 listview rowselect showsel single labeltip headerdrag report > [ $vdll ]
n204= mdx SetDialog $dname style title border raisededge sysmenu minbox
n205= mdx SetControlMDX $dname 101 positioner minbox > [ $ddll ]
n206= did -h $dname 2
n207= did -i $dname 63 1 header @20,132,47,47,47 N $+ $chr(9) $+ Function $+ $chr(9) $+ MAX $+ $chr(9) $+ MIN $+ $chr(9) $+ AVG
n208= mdx MoveControl $dname 63 6 8 300 200
n209= if ($gvar(gwclear) == 1) { did -c $dname 65 }
n210= if ($gvar(gcdots) == 1) { did -c $dname 66 }
n211= if ($gvar(gclines) == 1) { did -c $dname 67 }
n212= if ($gvar(gscolors) == 1) { did -c $dname 68 }
n213= if ($gvar(gdcolors) == 1) { did -c $dname 69 }
n214= if ($gvar(gdgraphic) == 1) { did -c $dname 70 }
n215= if ($gvar(gdmode) == dot) { did -c $dname 71 }
n216= if ($gvar(gdmode) == line) { did -c $dname 72 }
n217= did -ra $dname 73 $gvar(gfactor)
n218= gstatus READY.
n219= did -a grapher 62 Initiating Coordinate Plot. $+ $crlf
n220= did -a grapher 62 Initiating Dot Plot. $+ $crlf
n221= did -a grapher 62 Initiating Line Plot. $+ $crlf
n222= did -a grapher 62 Ready. $+ $crlf $+ $crlf
n223= did -c $dname 3
n224= did -f $dname 60
n225=}
n226=
n227=On *:DIALOG:grapher:sclick:*:{
n228= if ($did == 3) { did -ra $dname 61 CALC | gbhide | did -v $dname 62 | dialog -t $dname XGrapher ( Calculator ) }
n229= if ($did == 4) { did -ra $dname 61 GRAPH | gbhide | did -v $dname 2 | dialog -t $dname XGrapher ( Graph ) }
n230= if ($did == 5) { did -ra $dname 61 TABLE | gbhide | did -v $dname 63 | dialog -t $dname XGrapher ( Table ) }
n231= if ($did == 6) { did -ra $dname 61 MODE | gbhide | did -v $dname 64,65,66,67,68,69,70,71,72,73,74 | dialog -t $dname XGrapher ( Mode ) }
n232= if ($did == 8) { window -c @Graph }
n233= if ($did == 9) { gfield [ INT $+ [ $chr(40) ] ] | return }
n234= if ($istok(10 11 12 13 14 20 21 27 33 45,$did,32) == $true) { gfield $gfunction($did) }
n235= if ($istok(16 17 22 23 24 28 29 30 34 35 36 37 38 39 40 41,$did,32) == $true) { gfield $did($did) }
n236= if ($istok(25 26 31 32,$did,32) == $true) { gfield $gafunction($did,$did(46).state) }
n237= if ($istok(42 43 44,$did,32) == $true) { gfield [ $replace($did($did),PI,3.141592653589,x,*,:,/) ] }
n238= if ($did == 46) {
n239= if ($did(46).state == 1) { did -ra $dname 25 ArcSIN | did -ra $dname 26 ArcCOS | did -ra $dname 31 ArcTAN | did -ra $dname 32 ArcCTG | return }
n240= if ($did(46).state == 0) { did -ra $dname 25 SIN | did -ra $dname 26 COS | did -ra $dname 31 TAN | did -ra $dname 32 CTG | return }
n241= }
n242= if ($did == 50) { did -r grapher 60 }
n243= if ($did == 61) { gcalcbtn $gettok($dialog($dname).title,3,32) }
n244=}
n245=
n246=alias xgrapher { qdlg grapher }
n247=
n248=alias -l gstatus { did -ra grapher 100 $1- }
n249=
n250=alias -l gfield { did -a grapher 60 $1- }
n251=
n252=alias -l gbhide { did -h grapher 2,62,63,64,65,66,67,68,69,70,71,72,73,74 }
n253=
n254=alias -l glfield { did -a grapher 63 [ $1 $+ . ] $+ $chr(9) $+ [ $5- ] $+ $chr(9) $+ [ $2 $+ .00 ] $+ $chr(9) $+ [ $3 $+ .00 ] $+ $chr(9) $+ [ $4 $+ .00 ] }
n255=
n256=alias -l gcalcbtn {
n257= if ($1 == Mode) { goto mode }
n258= if ($did(grapher,60) == $null) { emsgbox Please Enter An Equation In The Field.§XGrapher [/xgrapher] | return }
n259= goto $1
n260= :calculator
n261= gcalc $did(grapher,60)
n262= return
n263= :graph
n264= gdraw $did(grapher,60)
n265= return
n266= :table
n267= gdraw $did(grapher,60)
n268= return
n269= :mode
n270= gset gwclear $did(grapher,65).state
n271= gset gcdots $did(grapher,66).state
n272= gset gclines $did(grapher,67).state
n273= gset gscolors $did(grapher,68).state
n274= gset gdcolors $did(grapher,69).state
n275= gset gdgraphic $did(grapher,70).state
n276= if ($did(grapher,71).state == 1) { gset gdmode dot }
n277= if ($did(grapher,72).state == 1) { gset gdmode line }
n278= var %gfac $did(grapher,73)
n279= gset gfactor %gfac
n280= if (%gfac < 1) { gset gfactor 1 }
n281= if (%gfac > 5) { gset gfactor 5 }
n282= return
n283=}
n284=
n285=alias -l gcalc {
n286= set -u %equation $1-
n287= did -a grapher 62 Equation : Y + $ucase($1-) $+ $crlf
n288= if (x isin $1-) { set -u %x $inputbox(Please Enter A Value For X.§XGrapher [/xgrapher]) | set -u %equation $ggraph(%x,$1-) | did -a grapher 62 X Value : %x $+ $crlf }
n289= did -a grapher 62 Result : $calc(%equation) $+ $crlf $+ $crlf
n290=}