File: get_region.sci

package info (click to toggle)
scilab 2.6-4
  • links: PTS
  • area: non-free
  • in suites: woody
  • size: 54,632 kB
  • ctags: 40,267
  • sloc: ansic: 267,851; fortran: 166,549; sh: 10,005; makefile: 4,119; tcl: 1,070; cpp: 233; csh: 143; asm: 135; perl: 130; java: 39
file content (45 lines) | stat: -rw-r--r-- 995 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
function [reg,rect]=get_region(xc,yc,win)
// Copyright INRIA
alu=xget('alufunction')
wins=curwin
xset('window',win)
xset('alufunction',6)
reg=list();rect=[]
kc=find(win==windows(:,2))
if kc==[] then
  message('This window is not an active palette')
  xset('window',wins)
  xset('alufunction',alu)
  return
elseif windows(kc,1)<0 then //click dans une palette
  kpal=-windows(kc,1)
  scs_m=palettes(kpal)
elseif win==curwin then //click dans la fenetre courante
  scs_m=scs_m
elseif pal_mode&win==lastwin then 
  scs_m=scs_m_s
elseif slevel>1 then
  execstr('scs_m=scs_m_'+string(windows(kc,1)))
else
  message('This window is not an active palette')
  xset('window',wins)
  xset('alufunction',alu)
  return
end

[ox,oy,w,h,ok]=get_rectangle(xc,yc)
if ~ok then 
  xset('window',wins)
  xset('alufunction',alu)
  return;
end

[keep,del]=get_blocks_in_rect(scs_m,ox,oy,w,h)

[reg,DEL,DELL]=do_delete1(scs_m,del,%f)
reg=do_purge(reg)
rect=[ox,oy-h,w,h]

xset('window',wins)
xset('alufunction',alu)