wolffd@0
|
1 #
|
wolffd@0
|
2 # dotty_ui: user interface functions and data structures
|
wolffd@0
|
3 #
|
wolffd@0
|
4 dotty.protogt.doaction = function (data, s) {
|
wolffd@0
|
5 local vt, gt;
|
wolffd@0
|
6
|
wolffd@0
|
7 vt = dotty.views[data.widget];
|
wolffd@0
|
8 gt = dotty.graphs[vt.gtid];
|
wolffd@0
|
9 data.menuitem = s;
|
wolffd@0
|
10 if (data.obj.nid >= 0) {
|
wolffd@0
|
11 if (gt.actions.node[s]) {
|
wolffd@0
|
12 gt.actions.node[s] (gt, vt, data.obj, data);
|
wolffd@0
|
13 return;
|
wolffd@0
|
14 }
|
wolffd@0
|
15 } else if (data.obj.eid >= 0) {
|
wolffd@0
|
16 if (gt.actions.edge[s]) {
|
wolffd@0
|
17 gt.actions.edge[s] (gt, vt, data.obj, data);
|
wolffd@0
|
18 return;
|
wolffd@0
|
19 }
|
wolffd@0
|
20 }
|
wolffd@0
|
21 if (gt.actions.general[s])
|
wolffd@0
|
22 gt.actions.general[s] (gt, vt, data);
|
wolffd@0
|
23 };
|
wolffd@0
|
24 dotty.protogt.actions.general = [
|
wolffd@0
|
25 "undo" = function (gt, vt, data) {
|
wolffd@0
|
26 gt.undo (gt, 1);
|
wolffd@0
|
27 };
|
wolffd@0
|
28 "paste" = function (gt, vt, data) {
|
wolffd@0
|
29 gt.paste (gt, data.pos, 1);
|
wolffd@0
|
30 };
|
wolffd@0
|
31 "do layout" = function (gt, vt, data) {
|
wolffd@0
|
32 gt.layoutgraph (gt);
|
wolffd@0
|
33 };
|
wolffd@0
|
34 "cancel layout" = function (gt, vt, data) {
|
wolffd@0
|
35 gt.cancellayout (gt);
|
wolffd@0
|
36 };
|
wolffd@0
|
37 "redraw" = function (gt, vt, data) {
|
wolffd@0
|
38 gt.redrawgraph (gt, [vt.vtid = vt;]);
|
wolffd@0
|
39 };
|
wolffd@0
|
40 "new graph" = function (gt, vt, data) {
|
wolffd@0
|
41 gt.erasegraph (gt, null, null);
|
wolffd@0
|
42 };
|
wolffd@0
|
43 "load graph" = function (gt, vt, data) {
|
wolffd@0
|
44 gt.loadgraph (gt, null, 'file', dotty.protogt.graph, 1);
|
wolffd@0
|
45 };
|
wolffd@0
|
46 "reload graph" = function (gt, vt, data) {
|
wolffd@0
|
47 gt.loadgraph (gt, gt.name, gt.type, gt.graph, 1);
|
wolffd@0
|
48 };
|
wolffd@0
|
49 "save graph" = function (gt, vt, data) {
|
wolffd@0
|
50 gt.savegraph (gt, gt.name, gt.type);
|
wolffd@0
|
51 };
|
wolffd@0
|
52 "save graph as" = function (gt, vt, data) {
|
wolffd@0
|
53 gt.savegraph (gt, null, 'file');
|
wolffd@0
|
54 };
|
wolffd@0
|
55 "open view" = function (gt, vt, data) {
|
wolffd@0
|
56 gt = dotty.protogt.creategraph (null);
|
wolffd@0
|
57 gt.createview (gt, null);
|
wolffd@0
|
58 };
|
wolffd@0
|
59 "copy view" = function (gt, vt, data) {
|
wolffd@0
|
60 gt = gt.copygraph (gt);
|
wolffd@0
|
61 gt.createview (gt, vt);
|
wolffd@0
|
62 };
|
wolffd@0
|
63 "birdseye view" = function (gt, vt, data) {
|
wolffd@0
|
64 gt.createview (gt, dotty.protovt.birdseye);
|
wolffd@0
|
65 };
|
wolffd@0
|
66 "clone view" = function (gt, vt, data) {
|
wolffd@0
|
67 gt.createview (gt, vt);
|
wolffd@0
|
68 };
|
wolffd@0
|
69 "close view" = function (gt, vt, data) {
|
wolffd@0
|
70 gt.destroyview (gt, vt);
|
wolffd@0
|
71 if (tablesize (gt.views) == 0)
|
wolffd@0
|
72 gt.destroygraph (gt);
|
wolffd@0
|
73 };
|
wolffd@0
|
74 "set graph attr" = function (gt, vt, data) {
|
wolffd@0
|
75 gt.setattr (gt, ['attr' = gt.graph.graphattr;]);
|
wolffd@0
|
76 };
|
wolffd@0
|
77 "set node attr" = function (gt, vt, data) {
|
wolffd@0
|
78 gt.setattr (gt, ['attr' = gt.graph.nodeattr;]);
|
wolffd@0
|
79 };
|
wolffd@0
|
80 "set edge attr" = function (gt, vt, data) {
|
wolffd@0
|
81 gt.setattr (gt, ['attr' = gt.graph.edgeattr;]);
|
wolffd@0
|
82 };
|
wolffd@0
|
83 "zoom in" = function (gt, vt, data) {
|
wolffd@0
|
84 gt.zoom (gt, vt, 0.5, data.pos);
|
wolffd@0
|
85 };
|
wolffd@0
|
86 "zoom out" = function (gt, vt, data) {
|
wolffd@0
|
87 gt.zoom (gt, vt, 2, data.pos);
|
wolffd@0
|
88 };
|
wolffd@0
|
89 "zoom in slowly" = function (gt, vt, data) {
|
wolffd@0
|
90 gt.zoom (gt, vt, 0.9, data.pos);
|
wolffd@0
|
91 };
|
wolffd@0
|
92 "zoom out slowly" = function (gt, vt, data) {
|
wolffd@0
|
93 gt.zoom (gt, vt, 1.1, data.pos);
|
wolffd@0
|
94 };
|
wolffd@0
|
95 "scroll horizontally" = function (gt, vt, data) {
|
wolffd@0
|
96 vt.scrollmode = 'h';
|
wolffd@0
|
97 };
|
wolffd@0
|
98 "scroll vertically" = function (gt, vt, data) {
|
wolffd@0
|
99 vt.scrollmode = 'v';
|
wolffd@0
|
100 };
|
wolffd@0
|
101 "find node" = function (gt, vt, data) {
|
wolffd@0
|
102 gt.findnode (gt, vt);
|
wolffd@0
|
103 };
|
wolffd@0
|
104 "print graph" = function (gt, vt, data) {
|
wolffd@0
|
105 gt.printorsave (gt, vt, null, null, null, null);
|
wolffd@0
|
106 };
|
wolffd@0
|
107 "text view" = function (gt, vt, data) {
|
wolffd@0
|
108 if (dotty.txtview == 'on')
|
wolffd@0
|
109 dotty.txtview = 'off';
|
wolffd@0
|
110 else
|
wolffd@0
|
111 dotty.txtview = 'on';
|
wolffd@0
|
112 txtview (dotty.txtview);
|
wolffd@0
|
113 };
|
wolffd@0
|
114 "quit" = function (gt, vt, data) {
|
wolffd@0
|
115 exit ();
|
wolffd@0
|
116 };
|
wolffd@0
|
117 ];
|
wolffd@0
|
118 dotty.protogt.actions.node = [
|
wolffd@0
|
119 "cut" = function (gt, vt, obj, data) {
|
wolffd@0
|
120 gt.cut (gt, obj, 'one', 'support', 'cut');
|
wolffd@0
|
121 dotty.clipgt.layoutgraph (dotty.clipgt);
|
wolffd@0
|
122 };
|
wolffd@0
|
123 "Cut" = function (gt, vt, obj, data) {
|
wolffd@0
|
124 gt.cut (gt, obj, 'reachable', 'support', 'cut');
|
wolffd@0
|
125 dotty.clipgt.layoutgraph (dotty.clipgt);
|
wolffd@0
|
126 };
|
wolffd@0
|
127 "copy" = function (gt, vt, obj, data) {
|
wolffd@0
|
128 gt.cut (gt, obj, 'one', 'support', 'copy');
|
wolffd@0
|
129 dotty.clipgt.layoutgraph (dotty.clipgt);
|
wolffd@0
|
130 };
|
wolffd@0
|
131 "Copy" = function (gt, vt, obj, data) {
|
wolffd@0
|
132 gt.cut (gt, obj, 'reachable', 'support', 'copy');
|
wolffd@0
|
133 dotty.clipgt.layoutgraph (dotty.clipgt);
|
wolffd@0
|
134 };
|
wolffd@0
|
135 "group" = function (gt, vt, obj, data) {
|
wolffd@0
|
136 local kv;
|
wolffd@0
|
137
|
wolffd@0
|
138 if ((kv = gt.getattr (gt, obj)))
|
wolffd@0
|
139 gt.groupnodesbyattr (gt, kv.key, kv.val, [
|
wolffd@0
|
140 'label' = kv.val; kv.key = kv.val;
|
wolffd@0
|
141 ], 1, 1);
|
wolffd@0
|
142 };
|
wolffd@0
|
143 "Group" = function (gt, vt, obj, data) {
|
wolffd@0
|
144 local kv;
|
wolffd@0
|
145
|
wolffd@0
|
146 if ((kv = gt.getattr (gt, obj)))
|
wolffd@0
|
147 gt.groupnodesbyattr (gt, kv.key, kv.val, [
|
wolffd@0
|
148 'label' = kv.val; kv.key = kv.val;
|
wolffd@0
|
149 ], 0, 1);
|
wolffd@0
|
150 };
|
wolffd@0
|
151 "delete" = function (gt, vt, obj, data) {
|
wolffd@0
|
152 if (obj.eid >= 0)
|
wolffd@0
|
153 gt.removeedge (gt, obj);
|
wolffd@0
|
154 else
|
wolffd@0
|
155 gt.removenode (gt, obj);
|
wolffd@0
|
156 };
|
wolffd@0
|
157 "Delete" = function (gt, vt, obj, data) {
|
wolffd@0
|
158 gt.removesubtree (gt, obj);
|
wolffd@0
|
159 };
|
wolffd@0
|
160 "remove" = function (gt, vt, obj, data) {
|
wolffd@0
|
161 if (obj.nid >= 0)
|
wolffd@0
|
162 if ((kv = gt.getattr (gt, obj)))
|
wolffd@0
|
163 gt.removenodesbyattr (gt, kv.key, kv.val);
|
wolffd@0
|
164 };
|
wolffd@0
|
165 "Remove" = function (gt, vt, obj, data) {
|
wolffd@0
|
166 if (obj.nid >= 0)
|
wolffd@0
|
167 if ((kv = gt.getattr (gt, obj)))
|
wolffd@0
|
168 gt.removesubtreesbyattr (gt, kv.key, kv.val);
|
wolffd@0
|
169 };
|
wolffd@0
|
170 "set attr" = function (gt, vt, obj, data) {
|
wolffd@0
|
171 gt.setattr (gt, obj);
|
wolffd@0
|
172 };
|
wolffd@0
|
173 "print attr" = function (gt, vt, obj, data) {
|
wolffd@0
|
174 if (obj.nid >= 0)
|
wolffd@0
|
175 echo ('node: ', obj.name);
|
wolffd@0
|
176 dump (obj.attr);
|
wolffd@0
|
177 };
|
wolffd@0
|
178 ];
|
wolffd@0
|
179 dotty.protogt.actions.edge = dotty.protogt.actions.node;
|
wolffd@0
|
180 dotty.protovt.normal.menus = [
|
wolffd@0
|
181 'general' = [
|
wolffd@0
|
182 0 = "undo";
|
wolffd@0
|
183 1 = "paste";
|
wolffd@0
|
184 2 = "do layout";
|
wolffd@0
|
185 3 = "cancel layout";
|
wolffd@0
|
186 4 = "redraw";
|
wolffd@0
|
187 5 = "new graph";
|
wolffd@0
|
188 6 = "load graph";
|
wolffd@0
|
189 7 = "reload graph";
|
wolffd@0
|
190 8 = "save graph";
|
wolffd@0
|
191 9 = "save graph as";
|
wolffd@0
|
192 10 = "open view";
|
wolffd@0
|
193 11 = "copy view";
|
wolffd@0
|
194 12 = "clone view";
|
wolffd@0
|
195 13 = "birdseye view";
|
wolffd@0
|
196 14 = "close view";
|
wolffd@0
|
197 15 = "set graph attr";
|
wolffd@0
|
198 16 = "set node attr";
|
wolffd@0
|
199 17 = "set edge attr";
|
wolffd@0
|
200 18 = "zoom in";
|
wolffd@0
|
201 19 = "zoom out";
|
wolffd@0
|
202 20 = "find node";
|
wolffd@0
|
203 21 = "print graph";
|
wolffd@0
|
204 22 = "text view";
|
wolffd@0
|
205 23 = "quit";
|
wolffd@0
|
206 ];
|
wolffd@0
|
207 'node' = [
|
wolffd@0
|
208 0 = "cut";
|
wolffd@0
|
209 1 = "Cut";
|
wolffd@0
|
210 2 = "copy";
|
wolffd@0
|
211 3 = "Copy";
|
wolffd@0
|
212 4 = "group";
|
wolffd@0
|
213 5 = "Group";
|
wolffd@0
|
214 6 = "delete";
|
wolffd@0
|
215 7 = "Delete";
|
wolffd@0
|
216 8 = "remove";
|
wolffd@0
|
217 9 = "Remove";
|
wolffd@0
|
218 10 = "set attr";
|
wolffd@0
|
219 11 = "print attr";
|
wolffd@0
|
220 ];
|
wolffd@0
|
221 'edge' = [
|
wolffd@0
|
222 0 = "cut";
|
wolffd@0
|
223 1 = "Cut";
|
wolffd@0
|
224 2 = "copy";
|
wolffd@0
|
225 3 = "Copy";
|
wolffd@0
|
226 4 = "delete";
|
wolffd@0
|
227 5 = "Delete";
|
wolffd@0
|
228 6 = "set attr";
|
wolffd@0
|
229 7 = "print attr";
|
wolffd@0
|
230 ];
|
wolffd@0
|
231 ];
|
wolffd@0
|
232 dotty.protovt.normal.keys = [
|
wolffd@0
|
233 'general' = [
|
wolffd@0
|
234 'u' = "undo";
|
wolffd@0
|
235 'p' = "paste";
|
wolffd@0
|
236 'l' = "do layout";
|
wolffd@0
|
237 'k' = "cancel layout";
|
wolffd@0
|
238 ' ' = "redraw";
|
wolffd@0
|
239 'L' = "reload graph";
|
wolffd@0
|
240 's' = "save graph";
|
wolffd@0
|
241 'Z' = "zoom in slowly";
|
wolffd@0
|
242 'z' = "zoom out slowly";
|
wolffd@0
|
243 'h' = "scroll horizontally";
|
wolffd@0
|
244 'v' = "scroll vertically";
|
wolffd@0
|
245 ];
|
wolffd@0
|
246 'node' = [
|
wolffd@0
|
247 'c' = "copy";
|
wolffd@0
|
248 'C' = "Copy";
|
wolffd@0
|
249 'g' = "group";
|
wolffd@0
|
250 'G' = "Group";
|
wolffd@0
|
251 'd' = "delete";
|
wolffd@0
|
252 'D' = "Delete";
|
wolffd@0
|
253 'r' = "remove";
|
wolffd@0
|
254 'R' = "Remove";
|
wolffd@0
|
255 'a' = "set attr";
|
wolffd@0
|
256 ];
|
wolffd@0
|
257 'edge' = [
|
wolffd@0
|
258 'c' = "copy";
|
wolffd@0
|
259 'C' = "Copy";
|
wolffd@0
|
260 'd' = "delete";
|
wolffd@0
|
261 'D' = "Delete";
|
wolffd@0
|
262 'a' = "set attr";
|
wolffd@0
|
263 ];
|
wolffd@0
|
264 ];
|
wolffd@0
|
265 dotty.protovt.birdseye.menus = dotty.protovt.normal.menus;
|
wolffd@0
|
266 dotty.protovt.birdseye.keys = dotty.protovt.normal.keys;
|
wolffd@0
|
267 dotty.protovt.normal.uifuncs = [
|
wolffd@0
|
268 'leftdown' = function (data) {
|
wolffd@0
|
269 local gt;
|
wolffd@0
|
270
|
wolffd@0
|
271 gt = dotty.graphs[dotty.views[data.widget].gtid];
|
wolffd@0
|
272 if (data.obj.nid >= 0) {
|
wolffd@0
|
273 dotty.node2move = data.obj;
|
wolffd@0
|
274 dotty.movewidget = data.widget;
|
wolffd@0
|
275 dotty.rp2 = data.pos;
|
wolffd@0
|
276 }
|
wolffd@0
|
277 };
|
wolffd@0
|
278 'leftmove' = function (data) {
|
wolffd@0
|
279 local gt;
|
wolffd@0
|
280
|
wolffd@0
|
281 gt = dotty.graphs[dotty.views[data.widget].gtid];
|
wolffd@0
|
282 if (dotty.node2move & (
|
wolffd@0
|
283 dotty.rp2.x ~= data.pos.x | dotty.rp2.y ~= data.pos.y
|
wolffd@0
|
284 )) {
|
wolffd@0
|
285 gt.movenode (gt, dotty.node2move, data.pos);
|
wolffd@0
|
286 dotty.rp2 = data.pos;
|
wolffd@0
|
287 }
|
wolffd@0
|
288 };
|
wolffd@0
|
289 'leftup' = function (data) {
|
wolffd@0
|
290 local gt;
|
wolffd@0
|
291
|
wolffd@0
|
292 gt = dotty.graphs[dotty.views[data.widget].gtid];
|
wolffd@0
|
293 if (dotty.node2move) {
|
wolffd@0
|
294 if (dotty.movewidget == data.widget)
|
wolffd@0
|
295 gt.movenode (gt, dotty.node2move, data.pos);
|
wolffd@0
|
296 dotty.node2move = 0;
|
wolffd@0
|
297 } else if (~data.obj)
|
wolffd@0
|
298 gt.insertnode (gt, data.pos, null, null, null, 1);
|
wolffd@0
|
299 };
|
wolffd@0
|
300 'middledown' = function (data) {
|
wolffd@0
|
301 if (~(data.obj.nid >= 0))
|
wolffd@0
|
302 return;
|
wolffd@0
|
303 dotty.rubberband = 1;
|
wolffd@0
|
304 dotty.movewidget = data.widget;
|
wolffd@0
|
305 setgfxattr (data.widget, ['mode' = 'xor';]);
|
wolffd@0
|
306 dotty.rp1 = data.pos;
|
wolffd@0
|
307 dotty.rp2 = data.pos;
|
wolffd@0
|
308 line (data.widget, null, dotty.rp1, dotty.rp2, ['color' = 1;]);
|
wolffd@0
|
309 };
|
wolffd@0
|
310 'middlemove' = function (data) {
|
wolffd@0
|
311 if (dotty.rubberband ~= 1 | (
|
wolffd@0
|
312 dotty.rp2.x == data.pos.x & dotty.rp2.y == data.pos.y
|
wolffd@0
|
313 ))
|
wolffd@0
|
314 return;
|
wolffd@0
|
315 line (data.widget, null, dotty.rp1, dotty.rp2, ['color' = 1;]);
|
wolffd@0
|
316 dotty.rp2 = data.pos;
|
wolffd@0
|
317 line (data.widget, null, dotty.rp1, dotty.rp2, ['color' = 1;]);
|
wolffd@0
|
318 };
|
wolffd@0
|
319 'middleup' = function (data) {
|
wolffd@0
|
320 local gt;
|
wolffd@0
|
321
|
wolffd@0
|
322 gt = dotty.graphs[dotty.views[data.widget].gtid];
|
wolffd@0
|
323 if (dotty.rubberband ~= 1)
|
wolffd@0
|
324 return;
|
wolffd@0
|
325 dotty.rubberband = 0;
|
wolffd@0
|
326 line (dotty.movewidget, null, dotty.rp1, dotty.rp2, ['color' = 1;]);
|
wolffd@0
|
327 setgfxattr (dotty.movewidget, ['mode' = 'src';]);
|
wolffd@0
|
328 if (dotty.movewidget ~= data.widget | ~(
|
wolffd@0
|
329 data.pobj.nid >= 0) | ~(data.obj.nid >= 0
|
wolffd@0
|
330 ))
|
wolffd@0
|
331 return;
|
wolffd@0
|
332 if (data.pobj.attr.support)
|
wolffd@0
|
333 gt.groupnodes (gt, [
|
wolffd@0
|
334 data.obj.nid = data.obj;
|
wolffd@0
|
335 data.pobj.nid = data.pobj;
|
wolffd@0
|
336 ], data.obj, null, null, null, 1, 1);
|
wolffd@0
|
337 else if (data.obj.attr.support)
|
wolffd@0
|
338 gt.groupnodes (gt, [
|
wolffd@0
|
339 data.obj.nid = data.obj;
|
wolffd@0
|
340 data.pobj.nid = data.pobj;
|
wolffd@0
|
341 ], data.pobj, null, null, null, 1, 1);
|
wolffd@0
|
342 else
|
wolffd@0
|
343 gt.insertedge (gt, data.pobj, null, data.obj, null, null, 1);
|
wolffd@0
|
344 };
|
wolffd@0
|
345 'rightdown' = function (data) {
|
wolffd@0
|
346 local vt, gt, menu, i;
|
wolffd@0
|
347
|
wolffd@0
|
348 vt = dotty.views[data.widget];
|
wolffd@0
|
349 gt = dotty.graphs[vt.gtid];
|
wolffd@0
|
350 if (~data.obj)
|
wolffd@0
|
351 menu = vt.menus.general;
|
wolffd@0
|
352 else if (data.obj.nid >= 0)
|
wolffd@0
|
353 menu = vt.menus.node;
|
wolffd@0
|
354 else if (data.obj.eid >= 0)
|
wolffd@0
|
355 menu = vt.menus.edge;
|
wolffd@0
|
356 if ((i = displaymenu (data.widget, menu)) >= 0)
|
wolffd@0
|
357 gt.doaction (data, menu[i]);
|
wolffd@0
|
358 };
|
wolffd@0
|
359 'button3up' = function (data) {
|
wolffd@0
|
360 local vt, attr;
|
wolffd@0
|
361
|
wolffd@0
|
362 vt = dotty.views[data.widget];
|
wolffd@0
|
363 attr = getwidgetattr (vt.scroll, [0 = 'childcenter';]);
|
wolffd@0
|
364 if (vt.scrollmode == 'h')
|
wolffd@0
|
365 attr.childcenter.x = attr.childcenter.x - 40;
|
wolffd@0
|
366 else
|
wolffd@0
|
367 attr.childcenter.y = attr.childcenter.y - 40;
|
wolffd@0
|
368 setwidgetattr (vt.scroll, ['childcenter' = attr.childcenter;]);
|
wolffd@0
|
369 };
|
wolffd@0
|
370 'button4up' = function (data) {
|
wolffd@0
|
371 local vt, attr;
|
wolffd@0
|
372
|
wolffd@0
|
373 vt = dotty.views[data.widget];
|
wolffd@0
|
374 attr = getwidgetattr (vt.scroll, [0 = 'childcenter';]);
|
wolffd@0
|
375 if (vt.scrollmode == 'h')
|
wolffd@0
|
376 attr.childcenter.x = attr.childcenter.x + 40;
|
wolffd@0
|
377 else
|
wolffd@0
|
378 attr.childcenter.y = attr.childcenter.y + 40;
|
wolffd@0
|
379 setwidgetattr (vt.scroll, ['childcenter' = attr.childcenter;]);
|
wolffd@0
|
380 };
|
wolffd@0
|
381 'keyup' = function (data) {
|
wolffd@0
|
382 local vt, gt, action;
|
wolffd@0
|
383
|
wolffd@0
|
384 vt = dotty.views[data.widget];
|
wolffd@0
|
385 gt = dotty.graphs[vt.gtid];
|
wolffd@0
|
386 if (data.obj.nid >= 0) {
|
wolffd@0
|
387 if (vt.keys.node[data.key])
|
wolffd@0
|
388 action = vt.keys.node[data.key];
|
wolffd@0
|
389 } else if (data.obj.eid >= 0) {
|
wolffd@0
|
390 if (vt.keys.edge[data.key])
|
wolffd@0
|
391 action = vt.keys.edge[data.key];
|
wolffd@0
|
392 }
|
wolffd@0
|
393 if (~action)
|
wolffd@0
|
394 if (vt.keys.general[data.key])
|
wolffd@0
|
395 action = vt.keys.general[data.key];
|
wolffd@0
|
396 if (action)
|
wolffd@0
|
397 gt.doaction (data, action);
|
wolffd@0
|
398 };
|
wolffd@0
|
399 'redraw' = function (data) {
|
wolffd@0
|
400 local vt, gt;
|
wolffd@0
|
401
|
wolffd@0
|
402 vt = dotty.views[data.widget];
|
wolffd@0
|
403 gt = dotty.graphs[vt.gtid];
|
wolffd@0
|
404 gt.drawgraph (gt, [vt.vtid = vt;]);
|
wolffd@0
|
405 };
|
wolffd@0
|
406 'closeview' = function (data) {
|
wolffd@0
|
407 local vt, gt;
|
wolffd@0
|
408
|
wolffd@0
|
409 vt = dotty.views[data.widget];
|
wolffd@0
|
410 gt = dotty.graphs[vt.gtid];
|
wolffd@0
|
411 gt.destroyview (gt, vt);
|
wolffd@0
|
412 if (tablesize (gt.views) == 0)
|
wolffd@0
|
413 gt.destroygraph (gt);
|
wolffd@0
|
414 };
|
wolffd@0
|
415 ];
|
wolffd@0
|
416 dotty.protovt.birdseye.uifuncs = [
|
wolffd@0
|
417 'leftdown' = function (data) {
|
wolffd@0
|
418 local gt, vid;
|
wolffd@0
|
419
|
wolffd@0
|
420 gt = dotty.graphs[dotty.views[data.widget].gtid];
|
wolffd@0
|
421 for (vid in gt.views) {
|
wolffd@0
|
422 vt = gt.views[vid];
|
wolffd@0
|
423 if (vt.type ~= 'birdseye')
|
wolffd@0
|
424 gt.setviewcenter ([vid = vt;], data.pos);
|
wolffd@0
|
425 }
|
wolffd@0
|
426 };
|
wolffd@0
|
427 'leftmove' = function (data) {
|
wolffd@0
|
428 local gt, vid;
|
wolffd@0
|
429
|
wolffd@0
|
430 gt = dotty.graphs[dotty.views[data.widget].gtid];
|
wolffd@0
|
431 for (vid in gt.views) {
|
wolffd@0
|
432 vt = gt.views[vid];
|
wolffd@0
|
433 if (vt.type ~= 'birdseye')
|
wolffd@0
|
434 gt.setviewcenter ([vid = vt;], data.pos);
|
wolffd@0
|
435 }
|
wolffd@0
|
436 };
|
wolffd@0
|
437 'leftup' = function (data) {
|
wolffd@0
|
438 local gt, vid;
|
wolffd@0
|
439
|
wolffd@0
|
440 gt = dotty.graphs[dotty.views[data.widget].gtid];
|
wolffd@0
|
441 for (vid in gt.views) {
|
wolffd@0
|
442 vt = gt.views[vid];
|
wolffd@0
|
443 if (vt.type ~= 'birdseye')
|
wolffd@0
|
444 gt.setviewcenter ([vid = vt;], data.pos);
|
wolffd@0
|
445 }
|
wolffd@0
|
446 };
|
wolffd@0
|
447 'middledown' = dotty.protovt.normal.uifuncs.middledown;
|
wolffd@0
|
448 'middlemove' = dotty.protovt.normal.uifuncs.middlemove;
|
wolffd@0
|
449 'middleup' = dotty.protovt.normal.uifuncs.middleup;
|
wolffd@0
|
450 'rightdown' = dotty.protovt.normal.uifuncs.rightdown;
|
wolffd@0
|
451 'keyup' = dotty.protovt.normal.uifuncs.keyup;
|
wolffd@0
|
452 'redraw' = dotty.protovt.normal.uifuncs.redraw;
|
wolffd@0
|
453 'closeview' = dotty.protovt.normal.uifuncs.closeview;
|
wolffd@0
|
454 ];
|
wolffd@0
|
455 dotty.monitorfile = function (data) {
|
wolffd@0
|
456 local gtid, gt, lpt;
|
wolffd@0
|
457
|
wolffd@0
|
458 for (gtid in dotty.layoutpending) {
|
wolffd@0
|
459 lpt = dotty.layoutpending[gtid];
|
wolffd@0
|
460 if (lpt.fd == data.fd) {
|
wolffd@0
|
461 gt = dotty.graphs[lpt.gtid];
|
wolffd@0
|
462 gt.haveinput = 1;
|
wolffd@0
|
463 gt.layoutgraph (gt);
|
wolffd@0
|
464 return 1;
|
wolffd@0
|
465 }
|
wolffd@0
|
466 }
|
wolffd@0
|
467 return 0;
|
wolffd@0
|
468 };
|