# Generic panel coordination
# One process coordinates operations within the tree, so that
# there are no races.
Wtree: module {
PATH: con "/dis/o/wtree.dis";
# to implement tree. internal use only.
Treeop: adt {
rc: chan of ref Wpanel->Panel;
path: string;
pick {
Walk or Update or Sync or Layout or Dump or Tags or Image or Focus =>
Size =>
op: int;
Ptwalk =>
pt: Draw->Point;
atomok: int;
Mouse =>
m: ref Gui->Cpointer;
mc: chan of ref Gui->Cpointer;
Kbd =>
r: int;
}
};
Min, Max, Full: con iota; # for Tree.size and Treeop.Size.to
Tree: adt {
omero: string;
slash: ref Wpanel->Panel; # "/" for the entire tree
dslash: ref Wpanel->Panel; # "/" for the shown portion
opc: chan of ref Treeop; # internal use only
donec: chan of ref Wpanel->Panel;
focus: ref Wpanel->Panel;
lastxy: Draw->Point;
start: fn(omero: string, name: string): ref Tree;
terminate: fn(t: self ref Tree);
path: fn(t: self ref Tree, p: ref Wpanel->Panel): string; # path in tree
walk: fn(t: self ref Tree, path: string): ref Wpanel->Panel;
ptwalk: fn(t: self ref Tree, xy: Draw->Point, atomok: int): ref Wpanel->Panel;
mouse: fn(t: self ref Tree, m: ref Gui->Cpointer, mc: chan of ref Gui->Cpointer): ref Wpanel->Panel;
kbd: fn(t: self ref Tree, r: int): ref Wpanel->Panel;
update: fn(t: self ref Tree, path: string);
sync: fn(t: self ref Tree, path: string);
size: fn(t: self ref Tree, path: string, op: int);
layout: fn(t: self ref Tree, path: string);
image: fn(t: self ref Tree, path: string);
tags: fn(t: self ref Tree, path: string);
dump: fn(t: self ref Tree, path: string);
};
init: fn(d: Livedat);
panelmouse: fn(t: ref Tree, p: ref Wpanel->Panel, m: ref Gui->Cpointer, cm: chan of ref Gui->Cpointer): int;
panelkbd: fn(t: ref Tree, p: ref Wpanel->Panel, k: int);
tagmouse: fn(t: ref Tree, p: ref Wpanel->Panel, m: ref Gui->Cpointer, mc: chan of ref Gui->Cpointer);
panelctl: fn(t: ref Tree, p: ref Wpanel->Panel, s: string): int;
};
|