5 |
import org.fenfire.view.buoy.*; |
import org.fenfire.view.buoy.*; |
6 |
import org.fenfire.util.*; |
import org.fenfire.util.*; |
7 |
import org.fenfire.*; |
import org.fenfire.*; |
8 |
import org.fenfire.vocab.PP; |
import org.fenfire.vocab.*; |
9 |
import org.nongnu.libvob.*; |
import org.nongnu.libvob.*; |
10 |
import org.nongnu.libvob.gl.*; |
import org.nongnu.libvob.gl.*; |
11 |
import org.nongnu.libvob.impl.*; |
import org.nongnu.libvob.impl.*; |
96 |
|
|
97 |
|
|
98 |
|
|
|
|
|
|
|
|
|
private RDFNode node; |
|
99 |
private NodePlacementHook hook; |
private NodePlacementHook hook; |
100 |
private GraphicsAPI.Window window; |
private GraphicsAPI.Window window; |
101 |
private Space space; |
private Space space; |
102 |
private NodeView nodeview; |
private NodeView nodeview; |
103 |
public PPCanvasCursor(RDFNode node, |
private Pp.Context context; |
104 |
NodePlacementHook hook, |
public PPCanvasCursor(NodePlacementHook hook, |
105 |
GraphicsAPI.Window w, |
GraphicsAPI.Window w, |
106 |
Space space, NodeView nv) { |
Space space, NodeView nv, |
107 |
this.node = node; |
Pp.Context context) |
108 |
|
{ |
109 |
this.hook = hook; |
this.hook = hook; |
110 |
this.window = w; |
this.window = w; |
111 |
this.space = space; |
this.space = space; |
112 |
this.nodeview = nv; |
this.nodeview = nv; |
113 |
|
this.context = context; |
114 |
|
|
115 |
/* |
// center to the associated note/image/whatever.. |
116 |
SimpleVStreamTexter sct = (SimpleVStreamTexter)space.getNodeTexter(); |
RDFNode node = context.getAccursed(); |
|
Enfilade1DImpl enf = (Enfilade1DImpl)sct.getEnfilade(c, null); |
|
|
java.util.List enfList= enf.getList(); |
|
|
Span1D span = (Span1D) enfList.get(0); |
|
|
NodeView cv; |
|
|
if (span instanceof TextSpan) |
|
|
cv = new TextNodeContentView(); |
|
|
else |
|
|
cv = new PageSpanNodeView(); |
|
117 |
float [] bs = new float[3]; |
float [] bs = new float[3]; |
118 |
cv.getSize(c, ((ViewContext)new AbstractViewContext()), bs); |
nodeview.getSize(node, bs); |
119 |
panx = bs[0]/2; |
panx = ShortRDF.getInt(space.getModel(), node, SPATIAL.coordX) + bs[0]/2; |
120 |
pany = bs[1]/2; |
pany = ShortRDF.getInt(space.getModel(), node, SPATIAL.coordY) + bs[1]/2; |
|
*/ |
|
|
|
|
121 |
} |
} |
122 |
|
|
123 |
|
|
135 |
|
|
136 |
private int c2fCS = -1; |
private int c2fCS = -1; |
137 |
public void renderMain(VobScene vs, int into) { |
public void renderMain(VobScene vs, int into) { |
138 |
/* |
RDFNode node = context.getAccursed(); |
|
c2fCS = vs.coords.ortho(0, 0,0,0, 10,10); |
|
|
int c2fCSInv = vs.coords.ortho(0, 0,0,0, 10,10); |
|
|
vs.matcher.add(into, c2fCS, "C2F"); |
|
|
vs.matcher.add(into, c2fCSInv, "C2FINV"); |
|
|
*/ |
|
|
|
|
139 |
if (GraphicsAPI.getInstance() instanceof GLAPI) { |
if (GraphicsAPI.getInstance() instanceof GLAPI) { |
140 |
c2fCS = vs.orthoCS(into, "C2F",0,0,0, 10,10); |
c2fCS = vs.orthoCS(into, "C2F",0,0,0, 10,10); |
141 |
int c2fCSInv = vs.orthoCS(into, "C2FINV",0,0,0, 10,10); |
int c2fCSInv = vs.orthoCS(into, "C2FINV",0,0,0, 10,10); |
157 |
} |
} |
158 |
} |
} |
159 |
|
|
160 |
public void keystroke(String s) { |
public void keystroke(String s) |
161 |
pa("Key occured: "+s); |
{ try { |
162 |
} |
pa("Key occured: '"+s+"'"); |
163 |
|
|
164 |
|
|
165 |
|
if (s.length() == 1) { |
166 |
|
PPActions ppact = context.getPPActions(); |
167 |
|
String paper = context.getCurrentPaper(); |
168 |
|
|
169 |
|
ppact.newNote(paper, (int)panx, (int)pany, s); |
170 |
|
|
171 |
|
AbstractUpdateManager.setNoAnimation(); |
172 |
|
AbstractUpdateManager.chg(); |
173 |
|
} |
174 |
|
|
175 |
|
}catch (java.rmi.RemoteException e) { |
176 |
|
pa("RemoteException: "+e); |
177 |
|
}} |
178 |
|
|
179 |
// Mouse press state |
// Mouse press state |
180 |
// x, y, buttons |
// x, y, buttons |
181 |
private int [] m_state = null; |
private int [] m_state = null; |
182 |
private float m_state_zoom = -1; |
private float m_state_zoom = -1; |
183 |
|
private float pan[] = new float[2]; |
184 |
public boolean mouse(MouseEvent e, VobScene oldVobScene) { |
public boolean mouse(MouseEvent e, VobScene oldVobScene) { |
185 |
if (e.getID() == MouseEvent.MOUSE_PRESSED) { |
if (e.getID() == MouseEvent.MOUSE_PRESSED) { |
186 |
m_state = new int[]{ e.getX(), e.getY(), e.getModifiers()}; |
m_state = new int[]{ e.getX(), e.getY(), e.getModifiers()}; |
187 |
m_state_zoom = zoom; |
m_state_zoom = zoom; |
188 |
|
pan[0] = panx; pan[1] = pany; |
189 |
return false; |
return false; |
190 |
} |
} |
191 |
if (m_state == null) throw new Error("Mouse state not found!"); |
if (m_state == null) throw new Error("Mouse state not found!"); |
192 |
|
|
193 |
|
// let's zoom!! |
194 |
if (m_state[2] == e.BUTTON3_MASK) { |
if (m_state[2] == e.BUTTON3_MASK) { |
|
|
|
|
// let's zoom!! |
|
195 |
zoom = m_state_zoom * (float) |
zoom = m_state_zoom * (float) |
196 |
Math.exp((m_state[1] - e.getY())/150.0); |
Math.exp((m_state[1] - e.getY())/150.0); |
197 |
return true; |
return true; |
198 |
} |
} |
199 |
|
|
200 |
|
// Move by dragging with button 1 |
201 |
|
if (m_state[2] == e.BUTTON1_MASK && e.getID() == MouseEvent.MOUSE_DRAGGED) { |
202 |
|
if (GraphicsAPI.getInstance() instanceof GLAPI) { |
203 |
|
; |
204 |
|
} else { |
205 |
|
panx = pan[0] - (m_state[0] - e.getX())/zoom; |
206 |
|
pany = pan[1] - (m_state[1] - e.getY())/zoom; |
207 |
|
} |
208 |
|
return true; |
209 |
|
} |
210 |
|
|
211 |
|
// Move around by clicking |
212 |
if (m_state[2] == e.BUTTON1_MASK && e.getID() == MouseEvent.MOUSE_CLICKED){ |
if (m_state[2] == e.BUTTON1_MASK && e.getID() == MouseEvent.MOUSE_CLICKED){ |
213 |
|
|
214 |
float[] pt = new float[] { e.getX(), e.getY(), 0 }; |
float[] pt = new float[] { e.getX(), e.getY(), 0 }; |
247 |
return false; |
return false; |
248 |
} |
} |
249 |
|
|
|
if (m_state[2] == e.BUTTON3_MASK) { |
|
|
zoom = m_state_zoom * (float) |
|
|
Math.exp((m_state[0] - e.getY())/150.0); |
|
|
|
|
|
pa("Zoom: " + zoom); |
|
|
AbstractUpdateManager.chg(); |
|
|
return false; |
|
|
} |
|
|
|
|
250 |
|
|
251 |
AbstractUpdateManager.chg(); |
AbstractUpdateManager.chg(); |
252 |
return false; |
return false; |