/[fenfire]/fenfire/org/fenfire/demo/mm.py
ViewVC logotype

Diff of /fenfire/org/fenfire/demo/mm.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.22 by humppake, Mon Aug 18 00:50:19 2003 UTC revision 1.23 by mudyc, Mon Aug 18 11:33:19 2003 UTC
# Line 113  fen.txtfunc = fen.txt.getNodeFunction() Line 113  fen.txtfunc = fen.txt.getNodeFunction()
113  fen.enfiladeOverlap = fen.txt.getTransclusionIndex()  fen.enfiladeOverlap = fen.txt.getTransclusionIndex()
114  alphContent = ff.util.AlphContent(fen)  alphContent = ff.util.AlphContent(fen)
115    
116    
117  textstyle = vob.GraphicsAPI.getInstance().getTextStyle("sansserif", 0, 24)  textstyle = vob.GraphicsAPI.getInstance().getTextStyle("sansserif", 0, 24)
118  nodeview = ff.view.TextNodeView(fen.txtfunc, textstyle)  
119  mindView = ff.view.lava.mindMapView2D.MindMapView2D(fen, nodeview)  # normal
120    normal_text = ff.view.TextNodeView(fen.txtfunc, textstyle, java.awt.Color(0.5, 0.1, 1))
121    normal_text_bg = ff.fenmm.WhiteNodeView(normal_text, None)
122    normal = ff.swamp.CachedPureNodeFunction(100, fen.constgraph, normal_text_bg)
123    
124    # accursed
125    accursed_text = ff.view.TextNodeView(fen.txtfunc, textstyle, java.awt.Color.black)
126    accursed = ff.swamp.CachedPureNodeFunction(100, fen.constgraph, accursed_text)
127    multiplexer = ff.swamp.MultiplexerNodeFunction(normal, accursed)
128    
129    
130    mindView = ff.view.lava.mindMapView2D.MindMapView2D(fen, multiplexer)
131    
132    
133  class Context(ff.view.buoy.AbstractMainNode2D.Context):  class Context(ff.view.buoy.AbstractMainNode2D.Context):
# Line 141  class Context(ff.view.buoy.AbstractMainN Line 153  class Context(ff.view.buoy.AbstractMainN
153    
154      def drawCursor(self, vs, node, cs):      def drawCursor(self, vs, node, cs):
155          xy = jarray.zeros(2, 'f')          xy = jarray.zeros(2, 'f')
156          nodeview.getXY(fen.graph, context.getAccursed(), self.offset, xy)          normal_text.getXY(fen.graph, context.getAccursed(), self.offset, xy)
157          cs = vs.orthoCS(cs, "CURSOR", 0, xy[0]*self.scale, xy[1]*self.scale,          cs = vs.orthoCS(cs, "CURSOR", 0, xy[0]*self.scale, xy[1]*self.scale,
158                          0, -textstyle.getHeight(self.scale))                          0, -textstyle.getHeight(self.scale))
159          vs.put(vob.vobs.LineVob(0,0,0,1, java.awt.Color.black), cs)          vs.put(vob.vobs.LineVob(0,0,0,1, java.awt.Color.black), cs)
# Line 242  class Click(Action, vob.mouse.MouseClick Line 254  class Click(Action, vob.mouse.MouseClick
254          rmb = context.rmb_switch[0]          rmb = context.rmb_switch[0]
255          if rmb == 'go':          if rmb == 'go':
256              self.context.setAccursed(node)              self.context.setAccursed(node)
257                set = java.util.HashSet()
258                set.add(node)
259                multiplexer.setMultiplexerNodes(set)
260    
261              # set cursor, transitions between zoomed and normal should be accounted              # set cursor, transitions between zoomed and normal should be accounted
262              cs = vs.getCSAt(0, x,y, None)              cs = vs.getCSAt(0, x,y, None)
# Line 252  class Click(Action, vob.mouse.MouseClick Line 267  class Click(Action, vob.mouse.MouseClick
267              nodeScale = (100+into[2])+4              nodeScale = (100+into[2])+4
268              if mindView.maxDepth > 40: nodeScale *= 40./mindView.maxDepth              if mindView.maxDepth > 40: nodeScale *= 40./mindView.maxDepth
269              nodeScale = 1-math.log10(nodeScale/4.)              nodeScale = 1-math.log10(nodeScale/4.)
270            
271              if node == self.context.main.getPlane():              if node == self.context.main.getPlane():
272                  # from border to linked                  # from border to linked
273                  self.context.scale = self.context.main.getFocus().getZoom()                  self.context.scale = self.context.main.getFocus().getZoom()
274                  self.context.offset = nodeview.getPos(fen.graph, context.getAccursed(),                  self.context.offset = normal_text.getPos(fen.graph, context.getAccursed(),
275                                                    (x-into[0])/self.context.scale/nodeScale,                                                           (x-into[0])/self.context.scale/nodeScale,
276                                                    (y-into[1])/self.context.scale/nodeScale)                                                           (y-into[1])/self.context.scale/nodeScale)
277              elif ff.util.RDFUtil.isLinked(fen.graph, node):              elif ff.util.RDFUtil.isLinked(fen.graph, node):
278                  # from linked or border to another linked                  # from linked or border to another linked
279                  self.context.scale = self.context.main.getFocus().getZoom()                  self.context.scale = self.context.main.getFocus().getZoom()
280                  self.context.offset = nodeview.getPos(fen.graph, context.getAccursed(),                  self.context.offset = normal_text.getPos(fen.graph, context.getAccursed(),
281                                                   (x-into[0])/self.context.scale/nodeScale,                                                           (x-into[0])/self.context.scale/nodeScale,
282                                                   (y-into[1])/self.context.scale/nodeScale)                                                           (y-into[1])/self.context.scale/nodeScale)
283                  self.context.scale = 1                  self.context.scale = 1
284                  self.context.main.setNewPlane(node, 0,0,1)                  self.context.main.setNewPlane(node, 0,0,1)
285              else:              else:
286                  # from border to border                  # from border to border
287                  self.context.scale = 1                  self.context.scale = 1
288                  self.context.offset = nodeview.getPos(fen.graph, context.getAccursed(),                  self.context.offset = normal_text.getPos(fen.graph, context.getAccursed(),
289                                                    (x-into[0])/self.context.scale/nodeScale,                                                           (x-into[0])/self.context.scale/nodeScale,
290                                                    (y-into[1])/self.context.scale/nodeScale)                                                           (y-into[1])/self.context.scale/nodeScale)
   
291          elif rmb == 'link':          elif rmb == 'link':
292              if node == self.context.main.getPlane():              if node == self.context.main.getPlane():
293                  pass                  pass
# Line 326  class VeryStupidBuoyManager: Line 340  class VeryStupidBuoyManager:
340      def __init__(self):      def __init__(self):
341          self.main = ff.view.lava.mindMapView2D.MindMapMainNode2D(context.home, mindView,          self.main = ff.view.lava.mindMapView2D.MindMapMainNode2D(context.home, mindView,
342               ff.view.buoy.AbstractMainNode2D.SimpleFocus(0,0), mindMouse)               ff.view.buoy.AbstractMainNode2D.SimpleFocus(0,0), mindMouse)
343          self.main.init(fen, nodeview)          self.main.init(fen, multiplexer)
344          context.main = self.main          context.main = self.main
345    
346          # contexts for e.g. drawCursor callbacks and delivering accursedNode          # contexts for e.g. drawCursor callbacks and delivering accursedNode

Legend:
Removed from v.1.22  
changed lines
  Added in v.1.23

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26