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

« back to all changes in this revision

Viewing changes to macros/scicos/OpenSet_.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 OpenSet_()
 
2
xinfo('Click to open block or make a link')
 
3
%kk=[]
 
4
while %t 
 
5
  if %pt==[] then
 
6
    [btn,%xc,%yc,%win_1,Cmenu]=cosclick()
 
7
 
 
8
    if Cmenu<>[] then
 
9
      %pt=[];break
 
10
    elseif btn>31 then
 
11
      Cmenu=%tableau(min(100,btn-31));%pt=[%xc;%yc];%win=%win_1
 
12
      if Cmenu==emptystr() then 
 
13
        Cmenu=[];%pt=[];
 
14
      end 
 
15
      break
 
16
    end
 
17
  else
 
18
    %xc=%pt(1);%yc=%pt(2);%win_1=%win;%pt=[]
 
19
  end
 
20
  
 
21
  disablemenus()
 
22
  if windows(find(%win_1==windows(:,2)),1)==100000 then
 
23
    //click in navigator
 
24
    [%Path,%kk,ok]=whereintree(%Tree,%xc,%yc)
 
25
    if ok&%kk<>[] then %Path($)=null();%Path($)=null();end
 
26
      if ~ok then %kk=[],end
 
27
  else
 
28
    %kk=getobj(scs_m,[%xc;%yc])
 
29
    %Path=%kk
 
30
  end
 
31
  if %kk<>[] then
 
32
    super_path=[super_path,%kk] 
 
33
    [o,modified,newparametersb,needcompileb,editedb]=clickin(scs_m(%Path))
 
34
    if Cmenu=='Link' then
 
35
      %pt=[%xc,%yc];
 
36
      enablemenus()
 
37
      break
 
38
    end
 
39
    // in case previous window has been destroyed
 
40
    if ~or(curwin==winsid()) then
 
41
      xset('window',curwin);
 
42
      xset('default')
 
43
      xbasc();
 
44
      if pixmap then xset('pixmap',1); end
 
45
      xset('pattern',1)
 
46
      xset('dashes',1)
 
47
      if ~set_cmap(options('Cmap')) then // add colors if required
 
48
        options('3D')(1)=%f //disable 3D block shape
 
49
      end
 
50
      if pixmap then xset('wwpc');end
 
51
      xbasc();xselect()
 
52
      %dr=driver();driver('Rec');
 
53
      set_background()
 
54
      
 
55
      window_set_size()
 
56
      
 
57
      xset('alufunction',6)
 
58
      drawobjs(scs_m)
 
59
      
 
60
      if pixmap then xset('wshow'),end
 
61
      
 
62
      menu_stuff()
 
63
      
 
64
      
 
65
      if ~super_block then
 
66
        delmenu(curwin,'stop')
 
67
        addmenu(curwin,'stop',list(1,'haltscicos'))
 
68
        unsetmenu(curwin,'stop')
 
69
      else
 
70
        unsetmenu(curwin,'Simulate')
 
71
      end
 
72
      //
 
73
    end
 
74
    //end of redrawing deleted parent  
 
75
    
 
76
    if needcompileb==4 then
 
77
      %kw=find(windows(:,1)==100000)
 
78
      if %kw<>[] then
 
79
        xdel(windows(%kw,2))
 
80
        %Tree=list()
 
81
      end
 
82
    end
 
83
    edited=edited|editedb
 
84
    super_path($-size(%kk,2)+1:$)=[]
 
85
    if editedb then
 
86
      scs_m_save=scs_m;nc_save=needcompile
 
87
      if ~pal_mode then
 
88
        needcompile=max(needcompile,needcompileb)
 
89
      end
 
90
      scs_m=update_redraw_obj(scs_m,%Path,o)
 
91
      
 
92
    end
 
93
    
 
94
    //note if block parameters have been modified
 
95
    if modified&~pal_mode  then
 
96
      //model=o(3)
 
97
      newparameters=mark_newpars(%kk,newparametersb,newparameters)
 
98
    end
 
99
  end
 
100
  enablemenus()
 
101
end
 
102
xinfo(' ')
 
103