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

« back to all changes in this revision

Viewing changes to macros/xdess/getlinestyle.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
1
function k=getlinestyle()
2
2
[lhs,rhs]=argn(0)
3
 
curwin=xget('window')
4
3
win=max(winsid()+1)
5
4
xset('window',win);
6
5
 
7
6
if ~MSDOS then
8
7
  delmenu(win,'3D Rot.')
9
8
  delmenu(win,'UnZoom')
10
 
  delmenu(win,'2D Zoom')
 
9
  delmenu(win,'Zoom')
 
10
  delmenu(win,"Edit")
11
11
  delmenu(win,'File')
12
12
else
13
 
  delmenu(win,'3D &Rot.')
14
 
  delmenu(win,'&UnZoom')
15
 
  delmenu(win,'2D &Zoom')
 
13
  hidetoolbar(win)
 
14
 // French
 
15
  delmenu(win,'&Fichier')
 
16
  delmenu(win,'&Editer')
 
17
  delmenu(win,'&Outils')
 
18
  // English
16
19
  delmenu(win,'&File')
 
20
  delmenu(win,'&Edit')
 
21
  delmenu(win,'&Tools')
17
22
end
18
 
 
 
23
//Event handler and menu definition
 
24
deff('evh(gwin,x,y,ibut)',..
 
25
     ['global pos done'
 
26
      'if or(ibut==(0:2)) then '
 
27
      '   [x,y]=xchange(x,y,''i2f'')'
 
28
      '   pos=[x,y],done=0,'
 
29
      'end'
 
30
      'if ibut==-1000 then ,done=3,end'
 
31
     ])
 
32
deff('menu_ok(k,gwin)','global done;done=1')
 
33
deff('menu_cancel(k,gwin)','global done;done=2')
 
34
 
 
35
 
 
36
set('figure_style','new')
 
37
f=gcf();
 
38
a=gca();
 
39
a.visible='off';
 
40
a.axes_visible='off';
 
41
a.data_bounds=[0 0;5 12];
 
42
a.font_size=3;
19
43
 
20
44
x=(1:5)';
21
 
fsave=xget("font size");
22
 
xset("font size",3);
23
 
 
24
 
plot2d(0,0,1,"010"," ",rect=[0 0 5 12]);
25
 
xtitle(["      Select line style k by clicking in rectangle or line"])
 
45
xtitle("      Select line style k by clicking in rectangle or line")
 
46
R=[]
26
47
for k=1:6
27
 
  xstringb(0,2*k-1,"k = "+string(k),1,2)
28
 
  xrect(0, 2*k+1, 1, 2);
 
48
  xstringb(0,2*k-1,"k = "+string(k),1,2);s=gce();
 
49
  s.font_size=3;
 
50
  xrect(0, 2*k+1, 1, 2);R=[R,gce()]
29
51
end
30
 
 
31
 
lsave=xget("line style");
32
 
tsave=xget("thickness");
33
 
xset("thickness",2);
 
52
a.thickness=2
34
53
for k=1:6
35
54
  xset("line style",k);
36
 
  xpoly(x,2*k*ones(x));
 
55
  xpoly(x,2*k*ones(x));p=gce();
 
56
  p.mark_mode='off',p.line_style=k;
37
57
end
38
 
 
39
 
xset("line style", lsave);
40
 
xset("thickness", tsave);
41
 
xset("font size", fsave);
42
 
 
43
 
done=%f;
44
 
addmenu(win,'File',['Ok','Cancel']);execstr('File_'+string(win)+'=[''done=%t;k=k;'';''done=%t;k=[]'']')
45
 
 
46
 
cmdok='execstr(File_'+string(win)+'(1))'
47
 
cmdcancel='execstr(File_'+string(win)+'(2))'
 
58
a.visible='on'; //draw on the screen
 
59
 
 
60
global pos done;done=-1;
 
61
ksel=1;
 
62
seteventhandler('evh')
 
63
addmenu(win,'Ok',list(2,'menu_ok'));
 
64
addmenu(win,'Cancel',list(2,'menu_cancel'));
 
65
 
 
66
f.pixmap='on';
48
67
while %t
49
 
  [c_i,cx,cy,cw,str]=xclick();
50
 
  k=round(cy/2);
51
 
    if c_i==-2 then
52
 
    if str==cmdok then k=k1;break,end
53
 
    if str==cmdcancel then k=[];break,end
54
 
  end
55
 
  if c_i==-100 then k=[];break, end
56
 
  if c_i==0 then
 
68
  select done
 
69
  case 0 then //click somehere
 
70
    cx=pos(1);cy=pos(2)
57
71
    k1=round(cy/2);k1=min(k1,6);k1=max(1,k1);
58
 
    xinfo('You have chosen style number: '+string(k1))
 
72
    R(ksel).thickness=1;
 
73
    R(k1).thickness=3;
 
74
    ksel=k1
 
75
    show_pixmap()
 
76
  case 1 then  // ok button clicked
 
77
    k=k1;break,
 
78
  case 2 then   // cancel button clicked
 
79
    k=[];break,
 
80
  case 3 then //the window has been blosed
 
81
    k=[],
 
82
    clearglobal pos done
 
83
    return
59
84
  end
60
85
end
 
86
seteventhandler('')
61
87
xdel(win)
62
 
 
63
 
xset('window',curwin)
 
88
clearglobal pos done
 
89
endfunction