18 |
# MA 02111-1307 USA |
# MA 02111-1307 USA |
19 |
# |
# |
20 |
|
|
21 |
|
# This demo is for FenMM - Mind Mapping on Fenfire |
|
# This demo is a for mindmap |
|
22 |
|
|
23 |
import java, jarray, math |
import java, jarray, math |
24 |
from java.lang import Math |
from java.lang import Math |
41 |
print 'mindMapView2D', s |
print 'mindMapView2D', s |
42 |
|
|
43 |
dbg = 0 |
dbg = 0 |
|
|
|
44 |
w.setCursor("wait") |
w.setCursor("wait") |
45 |
vob.putil.demo.usingNormalBindings = 1 |
vob.putil.demo.usingNormalBindings = 1 |
46 |
|
|
47 |
|
print """ |
48 |
|
|
49 |
|
############################### |
50 |
|
## ## |
51 |
|
## LOADING FenMM1.0 v0.0 ## |
52 |
|
## ## |
53 |
|
############################### |
54 |
|
|
55 |
|
|
56 |
|
FenMM is brought to you by the Fenfire team (http://fenfire.org). |
57 |
|
|
58 |
|
Fenfire is free software; you can redistribute it and/or modify it under |
59 |
|
the terms of the GNU Lesser General Public License as published by |
60 |
|
the Free Software Foundation; either version 2 of the License, or |
61 |
|
(at your option) any later version. |
62 |
|
|
63 |
|
Fenfire is distributed in the hope that it will be useful, but WITHOUT |
64 |
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
65 |
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General |
66 |
|
Public License for more details. |
67 |
|
|
68 |
|
You should have received a copy of the GNU Lesser General |
69 |
|
Public License along with Fenfire; if not, write to the Free |
70 |
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
71 |
|
MA 02111-1307 USA |
72 |
|
|
73 |
|
|
74 |
|
""" |
75 |
|
|
76 |
# storm pool directory and mindmap file |
# storm pool directory and mindmap file |
77 |
DIR = 'myFenfire/' |
DIR = 'myFenfire/' |
78 |
FILE = DIR+'mindmap.rdf' |
FILE = DIR+'mindmap.rdf' |
113 |
fen.enfiladeOverlap = fen.txt.getTransclusionIndex() |
fen.enfiladeOverlap = fen.txt.getTransclusionIndex() |
114 |
alphContent = ff.util.AlphContent(fen) |
alphContent = ff.util.AlphContent(fen) |
115 |
|
|
116 |
textstyle = vob.GraphicsAPI.getInstance().getTextStyle("sans", 0, 24) |
textstyle = vob.GraphicsAPI.getInstance().getTextStyle("sansserif", 0, 24) |
117 |
nodeview = ff.view.TextNodeView(fen.txtfunc, textstyle, 1) |
nodeview = ff.view.TextNodeView(fen.txtfunc, textstyle) |
118 |
mindView = ff.view.lava.mindMapView2D.MindMapView2D(fen, nodeview) |
mindView = ff.view.lava.mindMapView2D.MindMapView2D(fen, nodeview) |
119 |
|
|
120 |
|
|
121 |
class Context(ff.view.buoy.AbstractMainNode2D.Context, |
class Context(ff.view.buoy.AbstractMainNode2D.Context): |
|
ff.view.lava.TextHandler.Context): |
|
122 |
def __init__(self): |
def __init__(self): |
123 |
self.rmb_switch = [ 'go', 'link', 'unlink' ] |
self.rmb_switch = [ 'go', 'link', 'unlink' ] |
124 |
self.oldVS = None |
self.oldVS = None |
141 |
|
|
142 |
def drawCursor(self, vs, node, cs): |
def drawCursor(self, vs, node, cs): |
143 |
xy = jarray.zeros(2, 'f') |
xy = jarray.zeros(2, 'f') |
144 |
nodeview.getXY(fen.graph, context.getAccursed(), context.offset, xy) |
nodeview.getXY(fen.graph, context.getAccursed(), self.offset, xy) |
145 |
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, |
146 |
0, -textstyle.getHeight(self.scale)) |
0, -textstyle.getHeight(self.scale)) |
147 |
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) |
211 |
text.setCursorOffset(-1) |
text.setCursorOffset(-1) |
212 |
|
|
213 |
context = Context() |
context = Context() |
214 |
nodeview.setContext(context) |
|
215 |
|
## obsolete |
216 |
|
#nodeview.setContext(context) |
217 |
|
|
218 |
|
|
219 |
if not do_load_graph: |
if not do_load_graph: |
235 |
def clicked(self, x,y): |
def clicked(self, x,y): |
236 |
vs = context.oldVS |
vs = context.oldVS |
237 |
node = vs.getKeyAt(0, x,y, None) |
node = vs.getKeyAt(0, x,y, None) |
238 |
if dbg: p('key', node) |
p('key', node) |
239 |
|
|
240 |
if node == None: return |
if node == None: return |
241 |
|
|