54 |
/** The key used for the "add paper" function in the vobscene. |
/** The key used for the "add paper" function in the vobscene. |
55 |
*/ |
*/ |
56 |
public static final Object ADDPAPERKEY = new Object(); |
public static final Object ADDPAPERKEY = new Object(); |
|
|
|
|
static Dim d_contains, d_pan, d_association; |
|
|
|
|
|
public static void initDims(Space space) { |
|
|
d_contains = space.getDim("0000000008000000E99BD882A20004A0AD6630BFDA693D810DED76CAE65DA9B7E873053466C52E-5"); |
|
|
d_pan = space.getDim("0000000008000000E99BD882A20004A0AD6630BFDA693D810DED76CAE65DA9B7E873053466C52E-4"); |
|
|
d_association = space.getDim("0000000008000000E99BD882A20004A0AD6630BFDA693D810DED76CAE65DA9B7E873053466C52E-7"); |
|
|
} |
|
|
|
|
57 |
/** The current mode of the client. |
/** The current mode of the client. |
58 |
*/ |
*/ |
59 |
static int mode = MODE_BROWSE; |
static int mode = MODE_BROWSE; |
60 |
|
|
61 |
|
private static PPDims d; |
62 |
|
|
63 |
/** The accursed cell. |
/** The accursed cell. |
64 |
*/ |
*/ |
65 |
Cell cursor; |
Cell cursor; |
109 |
|
|
110 |
/** The view shown in this window. |
/** The view shown in this window. |
111 |
*/ |
*/ |
112 |
BuoyView view = new BuoyView(keyer); |
BuoyView view; |
113 |
|
|
114 |
PPActions ppactions; |
PPActions ppactions; |
115 |
|
|
169 |
|
|
170 |
public Win(Cell cursor, PPActions ppactions, Runnable updateSpaceRun) |
public Win(Cell cursor, PPActions ppactions, Runnable updateSpaceRun) |
171 |
throws RemoteException { |
throws RemoteException { |
172 |
|
view = new BuoyView(cursor.space, keyer); |
173 |
this.updateSpaceRun = updateSpaceRun; |
this.updateSpaceRun = updateSpaceRun; |
174 |
AbstractUpdateManager.addWindow(new Screen( |
AbstractUpdateManager.addWindow(new Screen( |
175 |
GraphicsAPI.getInstance().createWindow(), |
GraphicsAPI.getInstance().createWindow(), |
186 |
|
|
187 |
Space space = cursor.space; |
Space space = cursor.space; |
188 |
|
|
189 |
initDims(space); |
d = new PPDims(space); |
190 |
} |
} |
191 |
|
|
192 |
void startDrag(MouseEvent me, Cell clicked) { |
void startDrag(MouseEvent me, Cell clicked) { |
193 |
drag_x0 = me.getX(); |
drag_x0 = me.getX(); |
194 |
drag_y0 = me.getY(); |
drag_y0 = me.getY(); |
195 |
drag_zoom0 = zoom; |
drag_zoom0 = zoom; |
196 |
if(clicked!=null && clicked.s(d_contains, -1)!=null) { |
if(clicked!=null && clicked.s(d.contains, -1)!=null) { |
197 |
// Dragging a cell |
// Dragging a cell |
198 |
drag_cell = clicked; |
drag_cell = clicked; |
199 |
drag_origin = getNoteXY(clicked); |
drag_origin = getNoteXY(clicked); |
229 |
} |
} |
230 |
|
|
231 |
int[] getNoteXY(Cell note) { |
int[] getNoteXY(Cell note) { |
232 |
if(note.s(d_pan) == null) return null; |
if(note.s(d.pan) == null) return null; |
233 |
return Params.getInts(note.s(d_pan), d_pan, 2, null); |
return Params.getInts(note.s(d.pan), d.pan, 2, null); |
234 |
} |
} |
235 |
|
|
236 |
/** Get the X and Y coordinates in the main viewport of the given mouse event. |
/** Get the X and Y coordinates in the main viewport of the given mouse event. |
297 |
setCursorTo(note); |
setCursorTo(note); |
298 |
offsetInCell = offs[0]; |
offsetInCell = offs[0]; |
299 |
} else { |
} else { |
300 |
setCursorTo(cursor.h(Win.d_contains)); |
setCursorTo(cursor.h(Win.d.contains)); |
301 |
} |
} |
302 |
// We always set the cursor to where the user clicked |
// We always set the cursor to where the user clicked |
303 |
// to give a consistent behaviour. |
// to give a consistent behaviour. |
362 |
return; |
return; |
363 |
} |
} |
364 |
// Text edit |
// Text edit |
365 |
p("Edit text "+c+" "+c.s(d_contains, -1)+"\n"); |
p("Edit text "+c+" "+c.s(d.contains, -1)+"\n"); |
366 |
if(c.s(d_contains, -1) == null) { // Not in edit mode |
if(c.s(d.contains, -1) == null) { // Not in edit mode |
367 |
c = createNewNote(c, xctr, yctr); |
c = createNewNote(c, xctr, yctr); |
368 |
} |
} |
369 |
// allow only on root clone // XXX Should we really? |
// allow only on root clone // XXX Should we really? |
381 |
} else if (c.t().equals("")) { |
} else if (c.t().equals("")) { |
382 |
// If it's empty, delete the cell and all associations. |
// If it's empty, delete the cell and all associations. |
383 |
mode = 0; |
mode = 0; |
384 |
setCursorTo(c.h(d_contains)); |
setCursorTo(c.h(d.contains)); |
385 |
ppactions.deleteNote(c.getId()); |
ppactions.deleteNote(c.getId()); |
386 |
} |
} |
387 |
} else if(key.equalsIgnoreCase("Delete")) { |
} else if(key.equalsIgnoreCase("Delete")) { |
400 |
x = xy[0]; y = xy[1]; |
x = xy[0]; y = xy[1]; |
401 |
} |
} |
402 |
// createNewNote(cursor, x, y + PlaneView.getLineOffset(zoom)); |
// createNewNote(cursor, x, y + PlaneView.getLineOffset(zoom)); |
403 |
if(oldNote.s(d_pan) != null) { |
if(oldNote.s(d.pan) != null) { |
404 |
// There was the earlier note; split the text |
// There was the earlier note; split the text |
405 |
int l = oldNote.t().length(); |
int l = oldNote.t().length(); |
406 |
if(offs < l) { |
if(offs < l) { |