File: do_ident.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 (73 lines) | stat: -rw-r--r-- 1,796 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
function scs_m = do_ident(scs_m)
// Copyright INRIA
while %t
  [btn,xc,yc,win,Cmenu]=cosclick()
  if Cmenu<>[] then
    Cmenu=resume(Cmenu)
  end
  k=getobj(scs_m,[xc;yc])
  if k<>[] then break,end
end
numero_objet=k
scs_m_save=scs_m

TYPE_OBJET=1;MODELE=3;
IDENTIFICATION=15
IDENTIFICATION_LIAISON=5

objet = scs_m(numero_objet)
type_objet = objet(TYPE_OBJET)

//
if type_objet == 'Block' then

  if size(objet(MODELE)) < IDENTIFICATION then  //compatibility
    for ks=size(objet(MODELE))+1:IDENTIFICATION
      objet(MODELE)(ks)=[]
    end
  end
  
  identification = objet(MODELE)(IDENTIFICATION)
  if identification == [] then
    identification = emptystr()
  end
  //
  texte_1 = 'Set Block identification'
  texte_2 = 'ID'
  [ok, identification] = getvalue(texte_1, texte_2, list('str', 1), ..
      identification)
  if ok then
    drawobj(objet)
    objet(MODELE)(IDENTIFICATION) = stripblanks(identification)
    drawobj(objet)
    scs_m(numero_objet) = objet
  end
elseif type_objet == 'Link' then
  identification = objet(IDENTIFICATION_LIAISON)
  if identification == [] then
    identification = emptystr()
  end
  texte_1 = 'Set link Identification'
  texte_2 = 'ID'
  [ok, identification] = getvalue(texte_1, texte_2, ..
      list('str', 1),identification)
  //
  if ok then
    identification = stripblanks(identification)
    c_links = connected_links(scs_m,numero_objet)
    //- set identification to all connected links
    //
    for numero = c_links
      drawobj(scs_m(numero))
      scs_m(numero)(IDENTIFICATION_LIAISON) = identification
      drawobj(scs_m(numero))
    end
  end				
else
  x_message('It is impossible to set ID for this type of object')
end
//
if pixmap then
  xset('wshow')
end
if ok then [scs_m_save,enable_undo,edited]=resume(scs_m_save,%t,%t),end