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

« back to all changes in this revision

Viewing changes to macros/metanet/ge_do_move_region.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
function  GraphList=ge_do_move_region(GraphList,xc,yc)
 
2
//Copyright INRIA
 
3
//Author : Serge Steer 2002
 
4
 
 
5
  ge_disablemenus()
 
6
  reg=list();rect=[]
 
7
  [rect,btn]=rubberbox([xc,yc])
 
8
  if btn==2 then ge_enablemenus();return,end
 
9
 
 
10
  
 
11
  [keep,del]=ge_get_nodes_in_rect(GraphList,rect);
 
12
  edited=keep<>[]
 
13
  if ~edited then ge_enablemenus();return,end
 
14
 
 
15
  karcs=[]
 
16
  for ksel=keep
 
17
    //get arcs connected to this node
 
18
    karcs=[karcs,find(GraphList.tail==ksel|GraphList.head==ksel)];
 
19
  end
 
20
  karcs=unique(karcs)
 
21
 
 
22
  [nrect,btn]=dragrect(rect)
 
23
  ge_drawarcs(karcs);ge_drawnodes(keep) //erase
 
24
  GraphList.node_x(keep)=GraphList.node_x(keep)-rect(1)+nrect(1);
 
25
  GraphList.node_y(keep)=GraphList.node_y(keep)-rect(2)+nrect(2);
 
26
  ge_drawnodes(keep);ge_drawarcs(karcs) //redraw at the new position
 
27
  ge_add_history(list("move_region",keep,[rect(1)-nrect(1),rect(2)-nrect(2)]))
 
28
  ge_enablemenus()
 
29
  edited=return(%t)
 
30
endfunction