[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz/gzz/modules/pp PPActions.java PPActionsImpl...
From: |
Matti Katila |
Subject: |
[Gzz-commits] gzz/gzz/modules/pp PPActions.java PPActionsImpl... |
Date: |
Sat, 11 Jan 2003 12:35:34 -0500 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Matti Katila <address@hidden> 03/01/11 12:35:33
Modified files:
gzz/modules/pp : PPActions.java PPActionsImpl.java
PPMouseEvents.java PPView2.java demotest.py
Log message:
Implemented paper deleting, note deleting and link killing partially.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/modules/pp/PPActions.java.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/modules/pp/PPActionsImpl.java.diff?tr1=1.12&tr2=1.13&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/modules/pp/PPMouseEvents.java.diff?tr1=1.22&tr2=1.23&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/modules/pp/PPView2.java.diff?tr1=1.56&tr2=1.57&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/modules/pp/demotest.py.diff?tr1=1.63&tr2=1.64&r1=text&r2=text
Patches:
Index: gzz/gzz/modules/pp/PPActions.java
diff -u gzz/gzz/modules/pp/PPActions.java:1.3
gzz/gzz/modules/pp/PPActions.java:1.4
--- gzz/gzz/modules/pp/PPActions.java:1.3 Wed Dec 4 16:20:50 2002
+++ gzz/gzz/modules/pp/PPActions.java Sat Jan 11 12:35:33 2003
@@ -68,6 +68,8 @@
*/
void assocNotes(String noteId, int side, String assocId)
throws RemoteException;
+ void detachNotes(String noteId, int side, String assocId)
+ throws RemoteException;
void insertText(String noteId, int offs, String text)
throws RemoteException;
Index: gzz/gzz/modules/pp/PPActionsImpl.java
diff -u gzz/gzz/modules/pp/PPActionsImpl.java:1.12
gzz/gzz/modules/pp/PPActionsImpl.java:1.13
--- gzz/gzz/modules/pp/PPActionsImpl.java:1.12 Fri Jan 10 01:40:16 2003
+++ gzz/gzz/modules/pp/PPActionsImpl.java Sat Jan 11 12:35:33 2003
@@ -53,14 +53,7 @@
public PPActionsImpl(Space space) throws RemoteException {
super();
-
initSpace(space);
- /*
- this.space = space;
- center = space.getHomeCell();
- if(center.t()==null) center.setText("HOME");
- d = new PPDims(space);
- */
}
@@ -76,10 +69,15 @@
public void deletePaper(String paperId) throws RemoteException
{ synchronized(space) {
-
- /* MUST DELETE ALL NOTES FIRST */
-
- space.delete(space.getCell(paperId));
+ /* must delete all notes first */
+ Cell paper = space.getCell(paperId).h(d.contains, -1);
+ Cell c = paper.s(d.contains);
+ while(c != null) {
+ Cell c_next = c.s(d.contains, 1);
+ deleteNote(c.getId());
+ c = c_next;
+ }
+ space.delete(paper);
}}
@@ -103,15 +101,33 @@
/* MUST DELETE ALL ASSOCS FIRST */
+ Cell note = space.getCell(noteId).h(d.clone);
+ if (note.s(d.pan) == null || note.s(d.pan).t() == "")
+ throw new Error("Not a note?!");
- Cell note = space.getCell(noteId);
// Remove all occurrences
- Cell c = note.h(d.clone);
- while(c!=null) {
- c.excise(d.contains);
- c.excise(d.association);
- c = c.s(d.clone);
+ Cell c = note.h(d.clone, -1).s(d.clone);
+ while(c != null) {
+ Cell left = c.s(d.association, -1);
+ Cell right = c.s(d.association, 1);
+
+ Cell assoc = null;
+ int dir = 0;
+ if (left != null) {
+ assoc = left;
+ dir = -1;
+ } else if (right != null) {
+ assoc = right;
+ dir = 1;
+ }
+ Cell next = c.s(d.clone);
+
+ detachNotes(c.getId(), dir, assoc.getId());
+ space.delete(c);
+ c = next;
}
+ note.excise(d.pan);
+ space.delete(note);
}
public void moveNote(String noteId, int x, int y)
@@ -132,14 +148,22 @@
}}
public void detachNotes(String id1, int side, String id2)
throws RemoteException { synchronized(space) {
- /*
- urgh...
-
- Cell c1 = space.getCell(id1).s(d.association);
- Cell c2 = space.getCell(id2).s(d.association);
+ Cell c1 = space.getCell(id1).h(d.clone);
+ Cell c2 = space.getCell(id2).h(d.clone);
- c1.disconnect(d.association, side);
- */
+ for(; c1!=null; c1 = c1.s(d.clone)) {
+ for(c2 = space.getCell(id2).h(d.clone);
+ c2!=null; c2 = c2.s(d.clone))
+ {
+ if ( c1.s(d.association, side) == c2 &&
+ c2.s(d.association, -side) == c1) {
+ c2.disconnect(d.association, side);
+ space.delete(c2);
+ space.delete(c1);
+ return;
+ }
+ }
+ }
}}
Index: gzz/gzz/modules/pp/PPMouseEvents.java
diff -u gzz/gzz/modules/pp/PPMouseEvents.java:1.22
gzz/gzz/modules/pp/PPMouseEvents.java:1.23
--- gzz/gzz/modules/pp/PPMouseEvents.java:1.22 Fri Jan 10 13:57:26 2003
+++ gzz/gzz/modules/pp/PPMouseEvents.java Sat Jan 11 12:35:33 2003
@@ -28,7 +28,7 @@
*/
public class PPMouseEvents {
-public static final String rcsid = "$Id: PPMouseEvents.java,v 1.22 2003/01/10
18:57:26 mudyc Exp $";
+public static final String rcsid = "$Id: PPMouseEvents.java,v 1.23 2003/01/11
17:35:33 mudyc Exp $";
public static boolean dbg = false;
private static void pa(String s) { System.out.println(s); }
@@ -54,6 +54,8 @@
EventHandling.i().assign("Add new paper", new NewPaper() );
EventHandling.i().assign("Add photo to paper", new AddPhoto() );
EventHandling.i().assign("Delete paper", new DeletePaper() );
+ EventHandling.i().assign("Delete a note", new DeleteANote() );
+ EventHandling.i().assign("Link killing", new LinkKillingMode() );
// Shortcut papers
EventHandling.i().assign("Shortcut link", new ShortCutLink() );
@@ -62,6 +64,7 @@
EventHandling.i().assign("Link CLICK", new LinkPaper() );
EventHandling.i().assign("Assoc link", new AssocLink() );
EventHandling.i().assign("Drag buoy", new BuoyDrag() );
+ EventHandling.i().assign("Kill link", new KillLink() );
// Main paper
EventHandling.i().assign("Click MAINVP", new SetCursorToMain() );
@@ -183,15 +186,60 @@
try {
pa("Deleting paper!");
Cell c = context.getAccursed();
- if (ppv.space.getHomeCell() != c) {
- ppactions.deletePaper(c.getId() );
- context.setAccursed(ppv.space.getHomeCell());
- }
+ ppactions.deletePaper(c.getId() );
} catch (Exception e) { pa(e.getMessage()); }
context.setAccursed(ppv.space.getHomeCell().s(ppv.d.d1));
AbstractUpdateManager.chg();
}
}
+
+ public class DeleteANote implements EventHandling.EventMouseObj {
+ public void event(MouseEvent ev, EventHandling.MousePressState p_state,
+ Object[] obs) {
+ Cell c = context.getAccursed();
+ Cell paper = c.h(ppv.d.contains, -1);
+ try {
+ pa("Deleting note!");
+ if (c.s(ppv.d.pan) == null || c.s(ppv.d.pan).t() == ""){
+ pa("Not a note");
+ return;
+ }
+ ppactions.deleteNote(c.getId() );
+ } catch (Exception e) { pa(e.getMessage()); }
+ context.setAccursed(paper);
+ AbstractUpdateManager.chg();
+ }
+ }
+ public class LinkKillingMode implements EventHandling.EventMouseObj {
+ public void event(MouseEvent ev, EventHandling.MousePressState p_state,
+ Object[] obs) {
+ // setup link killing mode not kills the link.
+ Cell c = context.getAccursed();
+ pa("Deleting note!");
+ if (c.s(ppv.d.pan) == null || c.s(ppv.d.pan).t() == ""){
+ pa("Not a note");
+ return;
+ }
+ ppv.viewMode = ppv.LINK_KILLING;
+ AbstractUpdateManager.chg();
+ }
+ }
+ public class KillLink implements EventHandling.EventMouseObj {
+ public void event(MouseEvent ev, EventHandling.MousePressState p_state,
+ Object[] obs) {
+
+ // swap 0 and 1
+ Cell c = (Cell)obs[1];
+ Cell other = (Cell)obs[0];
+ int dir = ((Integer)obs[2]).intValue();
+ context.setAccursed(c);
+ try {
+ pa("nyt lähtee"+c.t()+" -"+dir+"- "+other.t());
+ ppactions.detachNotes(c.getId(), dir, other.getId() );
+ } catch (Exception e) { pa(e.getMessage()); }
+ AbstractUpdateManager.chg();
+ }
+ }
public class ShortCutLink implements EventHandling.EventMouseObj {
public void event(MouseEvent ev, EventHandling.MousePressState p_state,
@@ -288,9 +336,7 @@
int frameCS = ((Integer)obs[1]).intValue();
- // set pan
- context.setAccursed(context.getAccursed().h(ppv.d.contains));
-
+
// Zooming
if (p_state.getButtons() == ev.BUTTON3_MASK) {
ppv.zoom = m_ev.last_zoom * (float)
@@ -313,6 +359,7 @@
ppv.panx = m_ev.last_panx - (ev.getX() -
p_state.getX())/ppv.zoom;
ppv.pany = m_ev.last_pany - (ev.getY() -
p_state.getY())/ppv.zoom;
ppv.replaceNewScene = true;
+
context.setAccursed(context.getAccursed().h(ppv.d.contains));
}
} else return;
Index: gzz/gzz/modules/pp/PPView2.java
diff -u gzz/gzz/modules/pp/PPView2.java:1.56
gzz/gzz/modules/pp/PPView2.java:1.57
--- gzz/gzz/modules/pp/PPView2.java:1.56 Sat Jan 11 08:10:53 2003
+++ gzz/gzz/modules/pp/PPView2.java Sat Jan 11 12:35:33 2003
@@ -36,7 +36,7 @@
import java.util.*;
public class PPView2 implements View {
-public static final String rcsid = "$Id: PPView2.java,v 1.56 2003/01/11
13:10:53 mudyc Exp $";
+public static final String rcsid = "$Id: PPView2.java,v 1.57 2003/01/11
17:35:33 mudyc Exp $";
public static boolean dbg = true;
private static void pa(String s) { System.err.println(s); }
@@ -51,6 +51,7 @@
final public int LINK_KILLING = 3;
+ public int lastViewMode = JUST_BROWSING;
public int viewMode = JUST_BROWSING;
/** Events */
@@ -301,7 +302,7 @@
}
count *= 0.5;
}
- actr = vs.translateCS(actr, "SHIFT_"+count, 0, count * 1.6f);
+ actr = vs.translateCS(actr, "SHIFT_"+count, 0, count * 1.8f);
int buoycs = floater.buoyCoordsys(actr, key);
@@ -325,16 +326,19 @@
-pan[0]*buoyZoom, -pan[1]*buoyZoom, buoyZoom, buoyZoom);
vs.matcher.add(frameCS, c2fCS, "C2F");
- ev_handler.onClick(frameCS, "Link CLICK",
- new Object[]{ c, connectedFrom, new
Integer(MAIN_CS),
- new Integer(frameCS), new
Integer(anchor),
- new Integer(buoycs)});
+ if (viewMode == LINK_KILLING) {
+ ev_handler.onClick(frameCS, "Kill link",
+ new Object[]{ c, connectedFrom, new Integer(dir)});
+ } else {
+ ev_handler.onClick(frameCS, "Link CLICK",
+ new Object[]{ c, connectedFrom, new Integer(MAIN_CS),
+ new Integer(frameCS), new Integer(anchor)});
+ }
ev_handler.onDrag(frameCS, "Drag buoy");
if (interps.get("link"+c.toString()) != null) {
-
((DefaultVobMatcher)vs.matcher).keymapSingleCoordsys(nadir_buoy,
+ ((DefaultVobMatcher)vs.matcher).keymapSingleCoordsys(frameCS,
((Integer)interps.get("link"+c.toString())).intValue());
- pa("FOOOOOOBAR");
}
buoyqueue.add(new Runnable() {
@@ -393,11 +397,12 @@
if(showLinkbuoys)
main_vc.setCellView(cellview);
- else
+ else {
main_vc.setCellView(
new CellViewPlugin(cellview,
- new Cell1DBuoyHook(leftFloater, rightFloater,
- d.clone, d.association)));
+ new Cell1DBuoyHook(leftFloater, rightFloater,
+ d.clone, d.association)));
+ }
Dimension size = vs.getSize();
@@ -479,7 +484,9 @@
Button butt = new Button(vs, ev_handler, style);
butt.add("Add new paper", "Uusi paperi", 0,0);
butt.add("Add photo to paper", "Liita kuva", 200,0);
- butt.add("Delete paper", "Tuhoa paperi", 400,0);
+ butt.add("Delete paper", "Tuhoa paperi", 360,0);
+ butt.add("Delete a note", "Tuhoa merkinta", 570,0);
+ butt.add("Link killing", "Pura linkkaus", 820,0);
// count papers
Cell p = main_vc.getAccursed().h(d.contains).h(d.d1).s(d.d1);
Index: gzz/gzz/modules/pp/demotest.py
diff -u gzz/gzz/modules/pp/demotest.py:1.63 gzz/gzz/modules/pp/demotest.py:1.64
--- gzz/gzz/modules/pp/demotest.py:1.63 Sat Jan 11 08:10:53 2003
+++ gzz/gzz/modules/pp/demotest.py Sat Jan 11 12:35:33 2003
@@ -108,12 +108,11 @@
self.ppv.bgscale = 500
self.poly = ["FILL", "LINE"]
self.map = None
- self.lastViewMode = 0
def setDefaultViewMode(self):
# set default settings
self.ppv.showLinkbuoys = 0
- self.lastViewMode = self.ppv.viewMode
+ self.ppvlastViewMode = self.ppv.viewMode
self.ppv.viewMode = self.ppv.JUST_BROWSING
def key(self, key):
@@ -153,25 +152,6 @@
#os.system('mv '+ PPDIR +'ps_FOO '+ PPDIR+'ps_foo')
os.system('cd '+PPDIR+' && tar -czvf pp.gz b_* d* ps_* pro*')
clean_data()
-
- # Loading
- elif key == "Ctrl-Z":
- print 'Loading scene'
- print 'DOES NOT WORK'
- loadScenes()
-
- self.space = gzz.impl.ModularSpace(self.filer.load(),
*tools.spaceArgList())
-
- # set space to *everywhere* !
- self.ppv.space = self.space
- print 'Does ', n1,' exists?:', self.space.exists(n1)
- #self.avc.setAccursed(self.space.getCell(n1))
- self.avc.setAccursed(space.getHomeCell().s(self.d.d1))
- self.ppv.d = PPDims(self.space)
- self.d = PPDims(self.space)
- self.ppv.ppactions.initSpace(self.space)
- gzz.client.AbstractUpdateManager.chg();
-
elif key == "Ctrl-P":
rotatelist(self.poly)
elif key == "Ctrl-S":
@@ -196,7 +176,7 @@
offs = self.avc.getCursorOffset(c)
print "OFss:", offs
- if self.lastViewMode == self.ppv.viewMode:
+ if self.ppv.lastViewMode == self.ppv.viewMode:
AbstractUpdateManager.setNoAnimation()
if key == "Left":
if offs != 0:
@@ -295,9 +275,9 @@
if m == self.ppv.JUST_BROWSING:
vs.map.put(background((0.4,0.5,0.8)))
elif m == self.ppv.TEXT_EDITING:
- vs.map.put(background((0.7,0.5,0.9)))
- elif m == self.ppv.LINK_KILLING:
vs.map.put(background((0.6,0.7,0.9)))
+ elif m == self.ppv.LINK_KILLING:
+ vs.map.put(background((0.8,0.4,0.7)))
vs.map.put(getDListNocoords("""
PolygonMode FRONT_AND_BACK %s
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] gzz/gzz/modules/pp PPActions.java PPActionsImpl...,
Matti Katila <=