File: tree.g

package info (click to toggle)
genesis 2.1-1.1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 14,288 kB
  • ctags: 10,667
  • sloc: ansic: 111,959; makefile: 2,240; yacc: 1,797; lex: 976; csh: 54; sh: 13
file content (41 lines) | stat: -rw-r--r-- 1,028 bytes parent folder | download | duplicates (5)
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
//genesis
//
// This example demonstrates the use of the xtree widget.
// In this case it is set up so that drag-drop operations
// cause elements to be moved around in the element
// hierarchy.
// Double click as usual causes truncation of the tree.

int side = 10

// Here is the xodus startup stuff
xcolorscale rainbow2
create xform /form [0,0,1100,500]
xshow /form
create xdraw /form/draw [0,0,100%,100%]
	setfield /form/draw xmin -2 xmax 20 ymin -1 ymax 5
create xtree /form/draw/tree

// Set up icons for tree
include icons
// set up some things for the tree to display
include manytabs
include cell



// Set tree parameters
setfield /form/draw/tree \
	path /##[] \
	treemode tree \
	sizescale 0.4 \
	script "echo on item <v>"

// This is the crucial step where I tell the xtree to move 
// elements around on drag-drop operations. The reset is
// necessary to tell the xtree to redraw
call /form/draw/tree ADDMSGARROW all all all all green 0 0 \
	"move.p <S> <D>; reset.p" "" ""
call /form/draw/tree SHOWMSGARROW

reset