100 |
vs.put(background((.5, .5, .5))) |
vs.put(background((.5, .5, .5))) |
101 |
w.renderStill(vs, 0) |
w.renderStill(vs, 0) |
102 |
|
|
103 |
fen = ff.Fen() |
(fen, ff_structure, contentFunction) = ff.test.fen.newFen() |
104 |
|
|
105 |
if do_load_graph: |
if do_load_graph: |
106 |
m = ModelMem() |
m = ModelMem() |
108 |
fen.constgraph = fen.graph = ff.swamp.Graphs.toGraph(m); |
fen.constgraph = fen.graph = ff.swamp.Graphs.toGraph(m); |
109 |
else: fen.graph = fen.constgraph = ff.swamp.impl.HashGraph() |
else: fen.graph = fen.constgraph = ff.swamp.impl.HashGraph() |
110 |
|
|
|
fen.txt = ff.impl.SimpleNodeContent(fen, myalph); |
|
|
fen.txtfunc = fen.txt.getNodeFunction() |
|
|
fen.enfiladeOverlap = fen.txt.getTransclusionIndex() |
|
|
|
|
111 |
style = vob.GraphicsAPI.getInstance().getTextStyle("sansserif", 0, 24) |
style = vob.GraphicsAPI.getInstance().getTextStyle("sansserif", 0, 24) |
112 |
|
|
113 |
# nodeview for normal nodes |
# nodeview for normal nodes |
114 |
normal_text = ff.view.TextNodeView(fen.txtfunc, style, java.awt.Color(0., 0., 0.), 250.) |
normal_text = ff.view.TextNodeView(contentFunction, style, java.awt.Color(0., 0., 0.), 250.) |
115 |
normal_text_bg = ff.fenmm.WhiteNodeView(normal_text, java.awt.Color(.6, .6, .6)) |
normal_text_bg = ff.fenmm.WhiteNodeView(normal_text, java.awt.Color(.6, .6, .6)) |
116 |
normalf = ff.swamp.CachedPureNodeFunction(100, fen.graph, normal_text_bg) |
normalf = ff.swamp.CachedPureNodeFunction(100, fen.graph, normal_text_bg) |
117 |
|
|
118 |
# nodeview for accursed nodes |
# nodeview for accursed nodes |
119 |
accursed_text = ff.view.TextNodeView(fen.txtfunc, style, java.awt.Color.black, 250.) |
accursed_text = ff.view.TextNodeView(contentFunction, style, java.awt.Color.black, 250.) |
120 |
accursed_text_bg = ff.fenmm.WhiteNodeView(accursed_text, java.awt.Color(.9, .9, .9)) |
accursed_text_bg = ff.fenmm.WhiteNodeView(accursed_text, java.awt.Color(.9, .9, .9)) |
121 |
accursedf = ff.swamp.CachedPureNodeFunction(100, fen.graph, accursed_text_bg) |
accursedf = ff.swamp.CachedPureNodeFunction(100, fen.graph, accursed_text_bg) |
122 |
|
|
123 |
multiplexer = ff.swamp.MultiplexerNodeFunction(normalf, accursedf) |
multiplexer = ff.swamp.MultiplexerNodeFunction(normalf, accursedf) |
124 |
|
|
125 |
structLink = ff.structure.StructLink.create(fen.graph) |
structLink = ff.structure.StructLink.create(fen.graph) |
315 |
cursor.setAccursed(node) |
cursor.setAccursed(node) |
316 |
|
|
317 |
### something easier to allow setOffset(x,y) before rendering |
### something easier to allow setOffset(x,y) before rendering |
318 |
nodeview = ff.view.TextNodeView(self.fen.txtfunc, self.context.style, 250.) |
nodeview = ff.view.TextNodeView(self.contentFunction, self.context.style, 250.) |
319 |
self.context.c.setTextPlaceable(nodeview.f(fen.graph, node)) |
self.context.c.setTextPlaceable(nodeview.f(fen.graph, node)) |
320 |
|
|
321 |
# set cursor, transitions between zoomed and normal should be accounted |
# set cursor, transitions between zoomed and normal should be accounted |
368 |
|
|
369 |
class MMScene: |
class MMScene: |
370 |
def __init__(self): |
def __init__(self): |
371 |
self.alphContent = ff.util.AlphContent(fen) |
self.alphContent = ff.util.AlphContent(fen, ff_structure) |
372 |
components, centered = self.compinit() |
components, centered = self.compinit() |
373 |
|
|
374 |
self.context = Context(fen, w, components, multiplexer, style) |
self.context = Context(fen, w, components, multiplexer, style) |
481 |
|
|
482 |
# draw cursor |
# draw cursor |
483 |
if accursed: |
if accursed: |
484 |
nodeview = ff.view.TextNodeView(fen.txtfunc, style, 250.) |
nodeview = ff.view.TextNodeView(contentFunction, style, 250.) |
485 |
if hasattr(self.view, "zoomPanCS") \ |
if hasattr(self.view, "zoomPanCS") \ |
486 |
and (structLink.isLinked(accursed) or self.context.main.getPlane() == accursed): |
and (structLink.isLinked(accursed) or self.context.main.getPlane() == accursed): |
487 |
self.context.c.render(vs, self.view.zoomPanCS, cs, nodeview.f(fen.graph, accursed)) |
self.context.c.render(vs, self.view.zoomPanCS, cs, nodeview.f(fen.graph, accursed)) |