diff options
Diffstat (limited to 'js/Sinks/CSCOPE.js')
-rw-r--r-- | js/Sinks/CSCOPE.js | 123 |
1 files changed, 62 insertions, 61 deletions
diff --git a/js/Sinks/CSCOPE.js b/js/Sinks/CSCOPE.js index 7b82402f..666b07a6 100644 --- a/js/Sinks/CSCOPE.js +++ b/js/Sinks/CSCOPE.js @@ -20,76 +20,77 @@ function CSCOPE() { model.dep_ut = [true,false]; exprs = [[strcat(string(clrs)," ")],[string(win)],[sci2exp([])],[sci2exp(wdim)],[string(ymin)],[string(ymax)],[string(per)],[string(N)],[transpose(string(0))],[emptystr()]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } CSCOPE.prototype.details = function CSCOPE() { + return this.x; } CSCOPE.prototype.get = function CSCOPE() { } CSCOPE.prototype.set = function CSCOPE() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,clrs,win,wpos,wdim,ymin,ymax,per,N,heritance,nom,exprs] = scicos_getvalue("Set Scope parameters",[["Color (>0) or mark (<0) vector (8 entries)"],["Output window number (-1 for automatic)"],["Output window position"],["Output window sizes"],["Ymin"],["Ymax"],["Refresh period"],["Buffer size","Accept herited events 0/1","Name of Scope (label&Id)"]],list("vec",8,"vec",1,"vec",-1,"vec",-1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"str",1),exprs); - if (!ok) { -break; -} - mess = []; - if (size(wpos,"*")!=0&&size(wpos,"*")!=2) { - mess = [[mess],["Window position must be [] or a 2 vector"],[" "]]; - ok = false; -} - if (size(wdim,"*")!=0&&size(wdim,"*")!=2) { - mess = [[mess],["Window dim must be [] or a 2 vector"],[" "]]; - ok = false; -} - if (win<-1) { - mess = [[mess],["Window number can\'t be < -1"],[" "]]; - ok = false; -} - if (per<=0) { - mess = [[mess],["Refresh period must be positive"],[" "]]; - ok = false; -} - if (N<2) { - mess = [[mess],["Buffer size must be at least 2"],[" "]]; - ok = false; -} - if (ymin>=ymax) { - mess = [[mess],["Ymax must be greater than Ymin"],[" "]]; - ok = false; -} - if (!or(heritance==[0,1])) { - mess = [[mess],["Accept herited events must be 0 or 1"],[" "]]; - ok = false; -} - if (!ok) { -message([["Some specified values are inconsistent:"],[" "],[mess]]); -} - if (ok) { - [model,graphics,ok] = set_io(model,graphics,list([-1,1],1),list(),ones(1-heritance,1),[]); -} - if (ok) { - if (wpos==[]) { - wpos = [[-1],[-1]]; -} - if (wdim==[]) { - wdim = [[-1],[-1]]; -} - rpar = [[0],[ymin],[ymax],[per]]; - ipar = [[win],[1],[N],[clrs.slice()],[wpos.slice()],[wdim.slice()]]; - model.rpar = rpar; - model.ipar = ipar; - model.evtin = ones(1-heritance,1); - model.label = nom; - graphics.id = nom; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,clrs,win,wpos,wdim,ymin,ymax,per,N,heritance,nom,exprs] = scicos_getvalue("Set Scope parameters",[["Color (>0) or mark (<0) vector (8 entries)"],["Output window number (-1 for automatic)"],["Output window position"],["Output window sizes"],["Ymin"],["Ymax"],["Refresh period"],["Buffer size","Accept herited events 0/1","Name of Scope (label&Id)"]],list("vec",8,"vec",1,"vec",-1,"vec",-1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"str",1),exprs); + if (!ok) { + break; + } + mess = []; + if (size(wpos,"*")!=0&&size(wpos,"*")!=2) { + mess = [[mess],["Window position must be [] or a 2 vector"],[" "]]; + ok = false; + } + if (size(wdim,"*")!=0&&size(wdim,"*")!=2) { + mess = [[mess],["Window dim must be [] or a 2 vector"],[" "]]; + ok = false; + } + if (win<-1) { + mess = [[mess],["Window number can\'t be < -1"],[" "]]; + ok = false; + } + if (per<=0) { + mess = [[mess],["Refresh period must be positive"],[" "]]; + ok = false; + } + if (N<2) { + mess = [[mess],["Buffer size must be at least 2"],[" "]]; + ok = false; + } + if (ymin>=ymax) { + mess = [[mess],["Ymax must be greater than Ymin"],[" "]]; + ok = false; + } + if (!or(heritance==[0,1])) { + mess = [[mess],["Accept herited events must be 0 or 1"],[" "]]; + ok = false; + } + if (!ok) { + message([["Some specified values are inconsistent:"],[" "],[mess]]); + } + if (ok) { + [model,graphics,ok] = set_io(model,graphics,list([-1,1],1),list(),ones(1-heritance,1),[]); + } + if (ok) { + if (wpos==[]) { + wpos = [[-1],[-1]]; + } + if (wdim==[]) { + wdim = [[-1],[-1]]; + } + rpar = [[0],[ymin],[ymax],[per]]; + ipar = [[win],[1],[N],[clrs.slice()],[wpos.slice()],[wdim.slice()]]; + model.rpar = rpar; + model.ipar = ipar; + model.evtin = ones(1-heritance,1); + model.label = nom; + graphics.id = nom; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } |