* Bug 16320 fixed: typos in blocks interfaces + a few files
[scilab.git] / scilab / modules / scicos_blocks / macros / Sinks / CSCOPXY.sci
1 //  Scicos
2 //
3 //  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 //
19 // See the file ../license.txt
20 //
21
22 function [x,y,typ]=CSCOPXY(job,arg1,arg2)
23     x=[];
24     y=[];
25     typ=[];
26     select job
27     case "set" then
28         x=arg1;
29         graphics=arg1.graphics;
30         exprs=graphics.exprs
31         model=arg1.model;
32         //dstate=model.dstate;
33         while %t do
34             [ok,nbr_curves,clrs,siz,win,wpos,wdim,xmin,xmax,ymin,ymax,N,exprs]=scicos_getvalue(..
35             msprintf(_("Set %s block parameters"), "CSCOPXY"), ..
36             [_("Number of Curves");
37              _("Curves styles: Colors>0 | marks<0");
38              _("Curves thicknesses | marks sizes");
39              _("Output window number (-1 for automatic)");
40              _("Output window position");
41              _("Output window sizes");
42              "Xmin";
43              "Xmax";
44              "Ymin";
45              "Ymax";
46             _("Buffer size")],..
47             list("vec",1,"vec",1,"vec",1,"vec",1,"vec",-1,"vec",-1,"vec",1,"vec",1,..
48             "vec",1,"vec",1,"vec",1),exprs)
49             if ~ok then
50                 break,
51             end //user cancel modification
52
53             mess=[];
54             if size(wpos,"*")<>0 &size(wpos,"*")<>2 then
55                 mess=[mess ; _("''Window position'' must be [] or a 2 vector") ; " "]
56             end
57             if size(wdim,"*")<>0 &size(wdim,"*")<>2 then
58                 mess=[mess ; _("''Window sizes'' must be [] or a 2 vector") ; " "]
59             end
60             if nbr_curves<=0 then
61                 mess=[mess ; _("The Number of Curves must be > 0") ; " "]
62             end
63             if win<-1 then
64                 mess=[mess ; _("The Window number must be >= -1") ; " "]
65             end
66             if N<1 then
67                 mess=[mess ; _("The Buffer size must be >= 1") ; " "]
68             end
69             if N==1 & clrs>0 then
70                 mess=[mess ; _("The Buffer size must be >= 2") ; " "]
71             end
72             if ymin>=ymax then
73                 mess=[mess ; _("Ymax > Ymin is required.") ; " "]
74             end
75             if xmin>=xmax then
76                 mess=[mess ; _("Xmax > Xmin is required.") ; " "]
77             end
78             if mess<>[] then
79                 message(mess)
80             else
81                 in = nbr_curves*ones(2,1);
82                 in2 = ones(2,1);
83                 [model,graphics,ok]=set_io(model,graphics,list([in in2],ones(2,1)),list(),ones(1,1),[]);
84                 if wpos==[] then
85                     wpos=[-1;-1];
86                 end
87                 if wdim==[] then
88                     wdim=[-1;-1];
89                 end
90                 rpar=[xmin;xmax;ymin;ymax]
91                 ipar=[win;1;N;clrs;siz;1;wpos(:);wdim(:);nbr_curves]
92                 //if prod(size(dstate))<>2*N+1 then dstate=-eye(2*N+1,1),end
93                 //model.dstate=dstate;
94                 model.rpar=rpar;
95                 model.ipar=ipar
96                 graphics.exprs=exprs;
97                 x.graphics=graphics;
98                 x.model=model
99                 break
100             end
101         end
102
103     case "define" then
104         win=-1;
105         clrs=4;siz=1
106         wdim=[600;400]
107         wpos=[-1;-1]
108         N=2;
109         xmin=-15;
110         xmax=15;
111         ymin=-15;
112         ymax=+15
113         nbr_curves = 1;
114
115         model=scicos_model()
116         model.sim=list("cscopxy",4)
117         model.in=[1;1]
118         model.in2=[1;1]
119         model.intyp=[1;1]
120         model.evtin=1
121         model.rpar=[xmin;xmax;ymin;ymax]
122         model.ipar=[win;1;N;clrs;siz;1;wpos(:);wdim(:);nbr_curves]
123         model.blocktype="d"
124         model.dep_ut=[%f %f]
125
126         exprs=[string(nbr_curves);
127         sci2exp(clrs);
128         sci2exp(siz);
129         string(win);
130         sci2exp([]);
131         sci2exp(wdim);
132         string(xmin);
133         string(xmax);
134         string(ymin);
135         string(ymax);
136         string(N)];
137         gr_i=[]
138         x=standard_define([2 2],model,exprs,gr_i)
139     end
140 endfunction