~ubuntu-branches/ubuntu/karmic/scilab/karmic

« back to all changes in this revision

Viewing changes to macros/scicos_blocks/AFFICH_f.sci

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2002-03-21 16:57:43 UTC
  • Revision ID: james.westby@ubuntu.com-20020321165743-e9mv12c1tb1plztg
Tags: upstream-2.6
ImportĀ upstreamĀ versionĀ 2.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
function [x,y,typ]=AFFICH_f(job,arg1,arg2)
 
2
// Copyright INRIA
 
3
x=[];y=[];typ=[]
 
4
select job
 
5
case 'plot' then
 
6
  ipar=arg1(3)(9)
 
7
  standard_draw(arg1)
 
8
case 'getinputs' then
 
9
    [x,y,typ]=standard_inputs(arg1)
 
10
case 'getoutputs' then
 
11
  x=[];y=[];typ=[];
 
12
case 'getorigin' then
 
13
  [x,y]=standard_origin(arg1)
 
14
case 'set' then
 
15
  x=arg1;
 
16
  graphics=arg1(2);label=graphics(4)
 
17
  model=arg1(3);
 
18
  if size(label,'*')==5 then label(6)='0';end //compatibility
 
19
  if size(label,'*')==4 then label(4)=' ';label(5)=' ';end //compatibility
 
20
  if size(model(7),'*')<>6 then model(7)=[0;-1;0;0;1;1];end //compatibility
 
21
  while %t do
 
22
    [ok,font,fontsize,color,nt,nd,herit,label]=getvalue(..
 
23
        'Set  parameters',..
 
24
        ['Font number';
 
25
         'Font size';
 
26
         'Color';
 
27
         'Total number of digits';
 
28
         'Number of rational part digits';
 
29
         'Block inherits (1) or not (0)'],..
 
30
         list('vec',1,'vec',1,'vec',1,'vec',1,'vec',1,'vec',1),label)
 
31
    if ~ok then break,end //user cancel modification
 
32
    mess=[]
 
33
 
 
34
    if font<=0 then
 
35
      mess=[mess;'Font number must be positive';' ']
 
36
      ok=%f
 
37
    end
 
38
    if fontsize<=0 then
 
39
      mess=[mess;'Font size must be positive';' ']
 
40
      ok=%f
 
41
    end
 
42
    if nt<=3 then
 
43
      mess=[mess;'Total number of digits must be greater than 3';' ']
 
44
      ok=%f
 
45
    end
 
46
    if nd<0 then
 
47
      mess=[mess;'Number of rational part digits must be '
 
48
          'greater or equal 0';' ']
 
49
      ok=%f
 
50
    end
 
51
    if ~ok then
 
52
      message(['Some specified values are inconsistent:';
 
53
        ' ';mess]);
 
54
    end
 
55
           
 
56
    if ~or(herit==[0 1]) then
 
57
      mess=[mess;'Accept inherited values are 0 and 1';' ']
 
58
      ok=%f
 
59
    end
 
60
     if ~ok then
 
61
      message(['Some specified values are inconsistent:';
 
62
          ' ';mess])
 
63
    end
 
64
    if ok then
 
65
      [model,graphics,ok]=check_io(model,graphics,-1,[],ones(1-herit,1),[])
 
66
    end
 
67
    if ok then
 
68
      ipar=[font;fontsize;color;xget('window');nt;nd]
 
69
      model(9)=ipar;model(4)=ones(1-herit,1)
 
70
      graphics(4)=label;
 
71
      x(2)=graphics;x(3)=model
 
72
      break
 
73
    end
 
74
  end
 
75
case 'define' then
 
76
  font=1
 
77
  fontsize=1
 
78
  color=1
 
79
  nt=9
 
80
  nd=2
 
81
  label=[string(font);
 
82
      string(fontsize);
 
83
      string(color);
 
84
      string(nt);
 
85
      string(nd)]
 
86
  ipar=[font;fontsize;color;0;nt;nd]
 
87
  model=list('affich',1,[],1,[],[],[0;-1;0;0;1;1],[],ipar,'d',[],[%t %f],' ',list())
 
88
      
 
89
  gr_i=['xset(''font'',ipar(1),ipar(2))';
 
90
        'str='' ''+part(''0'',ones(1,ipar(5)-ipar(6)-2))+''.''+part(''0'',ones(1,ipar(6)))'
 
91
        'rr=xstringl(orig(1),orig(2),str)'
 
92
        'xstring(orig(1)+max(0,(sz(1)-rr(3))/2),orig(2)+max(0,(sz(2)-rr(4))/2),str)']
 
93
  x=standard_define([3 2],model,label,gr_i)
 
94
end
 
95