~ubuntu-branches/ubuntu/hoary/scilab/hoary

« back to all changes in this revision

Viewing changes to macros/scicos_blocks/EVENTSCOPE_f.sci

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2005-01-09 22:58:21 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050109225821-473xr8vhgugxxx5j
Tags: 3.0-12
changed configure.in to build scilab's own malloc.o, closes: #255869

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
function [x,y,typ]=EVENTSCOPE_f(job,arg1,arg2)
2
 
// Copyright INRIA
3
 
x=[];y=[];typ=[]
4
 
select job
5
 
case 'plot' then
6
 
  standard_draw(arg1)
7
 
case 'getinputs' then
8
 
  [x,y,typ]=standard_inputs(o)
9
 
case 'getoutputs' then
10
 
  x=[];y=[];typ=[];
11
 
case 'getorigin' then
12
 
  [x,y]=standard_origin(arg1)
13
 
case 'set' then
14
 
  x=arg1;
15
 
  graphics=arg1(2);label=graphics(4)
16
 
  model=arg1(3);
17
 
  while %t do
18
 
    [ok,nclock,clrs,win,wpos,wdim,per,label]=getvalue(..
19
 
        'Set Scope parameters',..
20
 
        ['Number of event inputs';
21
 
        'colors c (>0) or mark (<0)';
22
 
        'Output window number';
23
 
        'Output window position';
24
 
        'Output window sizes';  
25
 
        'Refresh period'],..
26
 
         list('vec',1,'vec',-1,'vec',1,'vec',-1,'vec',-1,'vec',1),label);
27
 
    nclock=int(nclock)
28
 
    clrs=int(clrs)
29
 
    win=int(win)
30
 
    
31
 
    if ~ok then break,end //user cancel modification
32
 
    mess=[]
33
 
    if size(wpos,'*')<>0 &size(wpos,'*')<>2 then
34
 
      mess=[mess;'Window position must be [] or a 2 vector';' ']
35
 
      ok=%f
36
 
    end
37
 
    if size(wdim,'*')<>0 &size(wdim,'*')<>2 then
38
 
      mess=[mess;'Window dim must be [] or a 2 vector';' ']
39
 
      ok=%f
40
 
    end
41
 
    if nclock<=0 then
42
 
      mess=[mess;'Block must have at least one input event';' ']
43
 
      ok=%f
44
 
    end
45
 
    if size(clrs,'*')<>nclock then
46
 
      mess=[mess;'Inputs color c size must be equal to Number of inputs';' ']
47
 
      ok=%f
48
 
    end
49
 
    if win<0 then
50
 
      mess=[mess;'Window number can''t be negative';' ']
51
 
      ok=%f
52
 
    end
53
 
    if per<=0 then
54
 
      mess=[mess;'Refresh period must be positive';' ']
55
 
      ok=%f
56
 
    end
57
 
    if ok then
58
 
      [model,graphics,ok]=check_io(model,graphics,[],[],ones(nclock,1),[])
59
 
    else
60
 
      message(['Some specified values are inconsistent:';
61
 
                 ' ';mess])
62
 
    end
63
 
    if ok then
64
 
      if wpos==[] then wpos=[-1;-1];end
65
 
      if wdim==[] then wdim=[-1;-1];end
66
 
      rpar=per
67
 
      ipar=[win;1;clrs(:);wpos(:);wdim(:)]
68
 
      model(8)=rpar;model(9)=ipar
69
 
      graphics(4)=label;
70
 
      x(2)=graphics;x(3)=model
71
 
      break
72
 
    end
73
 
  end
74
 
  x(3)(11)=[] //comptibility
75
 
case 'define' then
76
 
  nclock=1
77
 
  win=1; clrs=[1;3;5;7;9;11;13;15];
78
 
  wdim=[600;400]
79
 
  wpos=[-1;-1]
80
 
  ipar=[win;1;clrs(nclock);wpos(:);wdim(:)]
81
 
  per=30;
82
 
  rpar=per
83
 
  state=-1
84
 
  model=list('evscpe',[],[],1,[],[],state,rpar,ipar,'d',[],[%f %f],' ',list())
85
 
  label=[sci2exp(nclock);
86
 
        strcat(sci2exp(clrs(nclock)),' ');
87
 
        string(win);
88
 
        sci2exp([]);
89
 
        sci2exp(wdim);  
90
 
        string(per)]
91
 
  gr_i=['thick=xget(''thickness'');xset(''thickness'',2);';
92
 
    'xrect(orig(1)+sz(1)/10,orig(2)+(1-1/10)*sz(2),sz(1)*8/10,sz(2)*8/10);';
93
 
    'xx=[orig(1)+sz(1)/5,orig(1)+sz(1)/5;';
94
 
    'orig(1)+(1-1/5)*sz(1),orig(1)+sz(1)/5];';
95
 
    'yy=[orig(2)+sz(2)/5,orig(2)+sz(2)/5;';
96
 
    'orig(2)+sz(2)/5,orig(2)+(1-1/5)*sz(2)];';
97
 
    'xarrows(xx,yy);';
98
 
    't=(0:0.3:2*%pi)'';';
99
 
    'xx=orig(1)+(1/5+3*t/(10*%pi))*sz(1);';
100
 
    'yy=orig(2)+(1/4.3+(sin(t)+1)*3/10)*sz(2);';
101
 
    'xpoly(xx,yy,''lines'');';
102
 
    'xset(''thickness'',thick);']
103
 
  x=standard_define([2 2],model,label,gr_i)
104
 
end
105
 
 
106
 
 
107
 
 
108