10 |
import org.nongnu.libvob.VobScene; |
import org.nongnu.libvob.VobScene; |
11 |
import org.nongnu.libvob.TextStyle; |
import org.nongnu.libvob.TextStyle; |
12 |
import org.nongnu.libvob.vobs.LineVob; |
import org.nongnu.libvob.vobs.LineVob; |
13 |
|
import org.fenfire.swamp.MultiplexerNodeFunction; |
14 |
|
|
15 |
import org.nongnu.libvob.lava.placeable.TextPlaceable; |
import org.nongnu.libvob.lava.placeable.TextPlaceable; |
16 |
|
|
17 |
import java.awt.Color; |
import java.awt.Color; |
18 |
|
import java.util.HashSet; |
19 |
|
|
20 |
public class MMTextCursor { |
public class MMTextCursor { |
21 |
public static final String rcsid = ""; |
public static final String rcsid = ""; |
45 |
} |
} |
46 |
|
|
47 |
public void setAccursed(Object node) { accursed = node; offset = 0; } |
public void setAccursed(Object node) { accursed = node; offset = 0; } |
48 |
|
|
49 |
|
/** unnecessary |
50 |
|
public HashSet setAccursed(Object node, MultiplexerNodeFunction multiplexer) { |
51 |
|
HashSet set = new HashSet(); |
52 |
|
set.add(node); |
53 |
|
setAccursed(node); |
54 |
|
if (multiplexer != null) multiplexer.setMultiplexerNodes(set); |
55 |
|
return set; |
56 |
|
} |
57 |
|
*/ |
58 |
|
|
59 |
public Object getAccursed() { return accursed; } |
public Object getAccursed() { return accursed; } |
60 |
public int setOffset(int offset) { this.offset = offset; return this.offset; } |
public int setOffset(int offset) { this.offset = offset; return this.offset; } |
61 |
public int setOffset(float x, float y) throws NotYetRenderedException { |
public int setOffset(float x, float y) throws NotYetRenderedException { |
137 |
this.length = 0; |
this.length = 0; |
138 |
} |
} |
139 |
|
|
140 |
public void render(VobScene vs, int rootCS, TextPlaceable p) { |
public void render(VobScene vs, int into, TextPlaceable p) { |
141 |
|
render(vs, into, 0, p); |
142 |
|
} |
143 |
|
public void render(VobScene vs, int matchCS, int zoomPanCS, TextPlaceable p) { |
144 |
setTextPlaceable(p); |
setTextPlaceable(p); |
145 |
|
|
|
int nodeCS = vs.matcher.getCS(accursed); |
|
|
float nodeXY[] = {0f, 0f, 0f}; |
|
|
vs.coords.transformPoints3(nodeCS, nodeXY, nodeXY); |
|
|
|
|
146 |
float cursorXY[] = new float[2]; |
float cursorXY[] = new float[2]; |
147 |
this.p.getCursorXY(offset, cursorXY); |
this.p.getCursorXY(offset, cursorXY); |
148 |
|
|
149 |
int cursorCS = vs.orthoCS(rootCS, "CURSOR", -1000, |
int nodeCS; |
150 |
nodeXY[0] + cursorXY[0], |
int cursorCS; |
151 |
nodeXY[1] + cursorXY[1], |
if (zoomPanCS > 0) { |
152 |
1, -style.getHeight(scale)); |
cursorCS = vs.coords.ortho(zoomPanCS, -1000, |
153 |
|
-p.getWidth()/2 + cursorXY[0], |
154 |
|
-p.getHeight()/2 + cursorXY[1], |
155 |
|
1, -style.getHeight(scale)); |
156 |
|
vs.matcher.add(matchCS, cursorCS, "CURSOR"); |
157 |
|
} else { |
158 |
|
nodeCS = vs.matcher.getCS(accursed); |
159 |
|
float nodeXY[] = {0f, 0f, 0f}; |
160 |
|
vs.coords.transformPoints3(nodeCS, nodeXY, nodeXY); |
161 |
|
|
162 |
|
cursorCS = vs.orthoCS(matchCS, "CURSOR", -1000, |
163 |
|
nodeXY[0] + cursorXY[0], |
164 |
|
nodeXY[1] + cursorXY[1], |
165 |
|
1, -style.getHeight(scale)); |
166 |
|
} |
167 |
vs.put(new LineVob(0,0,0,1, color), cursorCS); |
vs.put(new LineVob(0,0,0,1, color), cursorCS); |
168 |
} |
} |
169 |
|
|