[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ff-cvs] fenfire docs/pegboard/cvs_to_tla--tjl/peg.rst o...
From: |
Tuomas J. Lukka |
Subject: |
[ff-cvs] fenfire docs/pegboard/cvs_to_tla--tjl/peg.rst o... |
Date: |
Thu, 11 Sep 2003 13:26:10 -0400 |
CVSROOT: /cvsroot/fenfire
Module name: fenfire
Branch:
Changes by: Tuomas J. Lukka <address@hidden> 03/09/11 13:26:09
Modified files:
docs/pegboard/cvs_to_tla--tjl: peg.rst
org/fenfire/fenpdf: fenpdf.py
org/fenfire/fenpdf/actions: keyboard.py
org/fenfire/fenpdf/appearance: papers.py views.py
org/fenfire/functional: FunctionCacheEntry.java
SuperFunctional1.java
org/fenfire/spanimages/gl: PoolManager.java
org/fenfire/view/buoy: NodeType2D.java PPConnector.java
Log message:
patch-44
Fix white background
patch-45
merge
patch-46
Fix some vital bugs in SuperFunctional - now it works reasonably well
again. Our decached entries were living a life of their own..
patch-47
Aha -- *that's* why it was constantly updating and we only got one node
at a time
patch-48
Don't delete empty notes - it feels quite unnatural. At the same time,
magically fix the backspace key - it was getText that was the problem
patch-49
Addition to previous: ignore the return value of setCursorOffset
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/docs/pegboard/cvs_to_tla--tjl/peg.rst.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/fenpdf/fenpdf.py.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/fenpdf/actions/keyboard.py.diff?tr1=1.12&tr2=1.13&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/fenpdf/appearance/papers.py.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/fenpdf/appearance/views.py.diff?tr1=1.23&tr2=1.24&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/functional/FunctionCacheEntry.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/functional/SuperFunctional1.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/spanimages/gl/PoolManager.java.diff?tr1=1.11&tr2=1.12&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/view/buoy/NodeType2D.java.diff?tr1=1.16&tr2=1.17&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/view/buoy/PPConnector.java.diff?tr1=1.23&tr2=1.24&r1=text&r2=text
Patches:
Index: fenfire/docs/pegboard/cvs_to_tla--tjl/peg.rst
diff -u fenfire/docs/pegboard/cvs_to_tla--tjl/peg.rst:1.4
fenfire/docs/pegboard/cvs_to_tla--tjl/peg.rst:1.5
--- fenfire/docs/pegboard/cvs_to_tla--tjl/peg.rst:1.4 Wed Sep 3 07:19:14 2003
+++ fenfire/docs/pegboard/cvs_to_tla--tjl/peg.rst Thu Sep 11 13:26:08 2003
@@ -3,8 +3,8 @@
=============================================================
:Author: Tuomas J. Lukka
-:Last-Modified: $Date: 2003/09/03 11:19:14 $
-:Revision: $Revision: 1.4 $
+:Last-Modified: $Date: 2003/09/11 17:26:08 $
+:Revision: $Revision: 1.5 $
:Status: Incomplete
Having the FenPDF prototype in production use requires more
@@ -228,7 +228,7 @@
The initial policy (at least of Tjl) is:
- accept changes to Storm only from Benja
-- accept changes to Alph only from humppake
+- accept changes to Navidoc only from humppake
- accept changes to CallGL only from Jvk
- accept any changes to ``lava/`` dirs
Index: fenfire/org/fenfire/fenpdf/actions/keyboard.py
diff -u fenfire/org/fenfire/fenpdf/actions/keyboard.py:1.12
fenfire/org/fenfire/fenpdf/actions/keyboard.py:1.13
--- fenfire/org/fenfire/fenpdf/actions/keyboard.py:1.12 Sun Sep 7 12:03:28 2003
+++ fenfire/org/fenfire/fenpdf/actions/keyboard.py Thu Sep 11 13:26:08 2003
@@ -95,18 +95,7 @@
if offs >= 1:
p('delete:', offs)
alphContent.deleteText(node, offs - 1, offs)
- offs = cur.setCursorOffset(offs - 1)
- text = alphContent.getText(self.fenPDF.fen.constgraph, node)
- if offs == 0 and len(text) == 0:
- # If text went to nothingness
- if self.fenPDF.structure.structLink.isLinked(node):
- # Kludge workaround: insert # if it is linked
- self.fenPDF.structure.alphContent.insertText(node, 0, "#")
- else:
- # Delete the note
- self.fenPDF.structure.structLink.detach(node)
- self.fenPDF.structure.canvas2d.removeNode(node)
- cur.setAccursed(None)
+ cur.setCursorOffset(offs - 1)
self.fenPDF.animation.regenerateVS()
Index: fenfire/org/fenfire/fenpdf/appearance/papers.py
diff -u fenfire/org/fenfire/fenpdf/appearance/papers.py:1.10
fenfire/org/fenfire/fenpdf/appearance/papers.py:1.11
--- fenfire/org/fenfire/fenpdf/appearance/papers.py:1.10 Mon Sep 1
06:20:57 2003
+++ fenfire/org/fenfire/fenpdf/appearance/papers.py Thu Sep 11 13:26:08 2003
@@ -94,7 +94,7 @@
.fancyPaperMakers[
self.fancyPaperMakerIndex]
else:
- paperMaker = ff.spanimages.gl.papermakers\
+ makerEntry = ff.spanimages.gl.papermakers\
.whitePaperMakers[
self.whitePaperMakerIndex]
p("Set paper maker: ", makerEntry)
@@ -107,10 +107,10 @@
raise 'FIX ME! Got None makeEntry.'
self.spanImageFactory.paperMaker = paperMaker
- # Then, make it cache stuff
- self.spanImageFactory = \
- ff.spanimages.gl.CachingSpanImageFactory(
- self.spanImageFactory)
+ # # Then, make it cache stuff
+ # self.spanImageFactory = \
+ # ff.spanimages.gl.CachingSpanImageFactory(
+ # self.spanImageFactory)
def getSpanImageFactory(self):
return self.spanImageFactory
Index: fenfire/org/fenfire/fenpdf/appearance/views.py
diff -u fenfire/org/fenfire/fenpdf/appearance/views.py:1.23
fenfire/org/fenfire/fenpdf/appearance/views.py:1.24
--- fenfire/org/fenfire/fenpdf/appearance/views.py:1.23 Wed Sep 10 09:00:46 2003
+++ fenfire/org/fenfire/fenpdf/appearance/views.py Thu Sep 11 13:26:08 2003
@@ -42,7 +42,9 @@
self.functional = ff.functional.SuperFunctional1(
self.fenPDF.fen.constgraph,
- vob.AbstractUpdateManager.getInstance()
+ vob.util.PrioritizeBackground(
+ vob.AbstractUpdateManager.getInstance(),
+ 10)
)
self.functional.addSuperLazyObs(self)
@@ -52,10 +54,13 @@
"AccursedDispatching", 10);
self.functional.cache(
"NormalDispatching", 500);
+ # "NormalDispatching", 10);
self.functional.cache(
- "PageNodeView", 200, 1, 10); # superlazy cache as it *is* slow.
+ # "PageNodeView", 200, 1, 10); # superlazy cache as it *is* slow.
+ "PageNodeView", 100, 1, 4); # superlazy cache as it *is* slow.
self.functional.cache(
- "PageScroll2Layout", 200, 10); # superlazy cache as it *is* slow.
+ # "PageScroll2Layout", 200, 10); # superlazy cache as it *is* slow.
+ "PageScroll2Layout", 100, 1, 4); # superlazy cache as it *is* slow.
self.textFunction = self.functional.createFunctionInstance(
@@ -311,7 +316,7 @@
We clear Accursed and NodeContent caches for the given entry.
"""
self.fenPDF.animation.regenerateVS(0)
- vob.AbstractUpdateManager.chgAfter(400)
+ vob.AbstractUpdateManager.chgAfter(1000)
vob.AbstractUpdateManager.setNoAnimation()
Index: fenfire/org/fenfire/fenpdf/fenpdf.py
diff -u fenfire/org/fenfire/fenpdf/fenpdf.py:1.13
fenfire/org/fenfire/fenpdf/fenpdf.py:1.14
--- fenfire/org/fenfire/fenpdf/fenpdf.py:1.13 Wed Sep 10 09:00:46 2003
+++ fenfire/org/fenfire/fenpdf/fenpdf.py Thu Sep 11 13:26:08 2003
@@ -27,8 +27,16 @@
self.animate = 0
def regenerateVS(self, callChg = 1):
+ """Set us to regenerate the vobscene for the next frame
+ instead of reusing it.
+
+ params:
+ callChg -- Whether to call AbstractUpdateManager.chg() as well,
+ default: yes.
+ """
self.reuseVs = 0
- vob.AbstractUpdateManager.chg()
+ if callChg:
+ vob.AbstractUpdateManager.chg()
def noAnimation(self):
self.reuseVs = 0
Index: fenfire/org/fenfire/functional/FunctionCacheEntry.java
diff -u fenfire/org/fenfire/functional/FunctionCacheEntry.java:1.1
fenfire/org/fenfire/functional/FunctionCacheEntry.java:1.2
--- fenfire/org/fenfire/functional/FunctionCacheEntry.java:1.1 Wed Sep 10
09:01:15 2003
+++ fenfire/org/fenfire/functional/FunctionCacheEntry.java Thu Sep 11
13:26:08 2003
@@ -17,6 +17,7 @@
public class FunctionCacheEntry implements Obs {
static final public Object DIRTY = new Object();
+
/** The input this cache entry is for.
* Stored here so that it may be used as the hash key.
*/
@@ -33,6 +34,11 @@
public FunctionCacheEntry(Object input) {
this.input = input;
+ }
+
+ protected void releaseAll() {
+ value = null;
+ obses = null;
}
public void addObs(Obs o) {
Index: fenfire/org/fenfire/functional/SuperFunctional1.java
diff -u fenfire/org/fenfire/functional/SuperFunctional1.java:1.1
fenfire/org/fenfire/functional/SuperFunctional1.java:1.2
--- fenfire/org/fenfire/functional/SuperFunctional1.java:1.1 Wed Sep 10
09:00:46 2003
+++ fenfire/org/fenfire/functional/SuperFunctional1.java Thu Sep 11
13:26:08 2003
@@ -135,7 +135,7 @@
private final PureNodeFunction realNodeFunction;
private class WrapperFunction implements Function, NodeFunction {
- CachingMap cache;
+ private CachingMap cache;
CacheInfo cacheInfo;
Object placeHolder;
public WrapperFunction(CacheInfo cacheInfo) {
@@ -143,7 +143,9 @@
cache = new CachingMap(cacheInfo.n);
}
private class Entry extends FunctionCacheEntry
- implements Runnable, Ticker {
+ implements Runnable, Ticker, CachingMap.Removable {
+ boolean closed;
+
public Entry(Object input) { super(input); }
/** The set of Obs object that want to know
@@ -151,14 +153,38 @@
*/
protected Set tickers;
+ // Implement Ticker
public void tick() {
- background.addTask(this, cacheInfo.priority);
+ if(closed) {
+ // Ticking a closed entry means we're a superlazy
+ // entry that hasn't been calculated. We *should* be.
+ addEntryBack(this);
+ }
+ if(value == DIRTY)
+ background.addTask(this, cacheInfo.priority);
+ }
+ // Implement CachingMap.Removable
+ public void wasRemoved(Object key) {
+ background.removeTask(this);
+
+ closed = true;
+
+ value = DIRTY; // allow value to be reclaimed
}
+ // Implement Runnable
public void run() {
+ if(closed) {
+ // This isn't impossible, as there are no guarantees
that
+ // the priorityqueue got the removal in time
+ p("run closed entry");
+ return;
+ }
if(dbg) p("Entry: run");
+ if(value != DIRTY) return;
+
observer_deepwards = this;
- if(tickers != null) tickers.clear();
+ if(tickers != null) tickers = null;
int startticks = ntickers_upwards;
if(realFunction != null) {
@@ -183,7 +209,14 @@
if(cacheInfo.superLazy)
callSuperLazyObses();
}
+
+ // The real set
public Object getValue() {
+ if(closed) {
+ // This is REALLY screwed up. Should NEVER
+ // happen.
+ throw new Error("getvalue closed entry");
+ }
// Recalculate
if(value == DIRTY) {
if(dbg) p("Entry: getValue: recalc");
@@ -210,17 +243,51 @@
addObs(observer_deepwards);
return value;
}
+
+ // override FunctionCacheEntry to detect closed ones
+ public void addObs(Obs o) {
+ if(closed) {
+ throw new Error("addObs closed entry");
+ }
+ super.addObs(o);
+ }
+ public void triggerObs() {
+ if(closed) {
+ throw new Error("triggerObs closed entry");
+ }
+ super.triggerObs();
+ }
+ public void chg() {
+ if(closed) {
+ p("chg closed entry");
+ return;
+ }
+ super.chg();
+ }
}
public Object f(ConstGraph g, Object x) {
return f(x);
}
public Object f(Object x) {
- Entry cac = (Entry)cache.get(x);
- if(cac == null) {
- cac = new Entry(x);
- cache.put(x, cac);
+ synchronized(cache) {
+ Entry cac = (Entry)cache.get(x);
+ if(cac == null) {
+ cac = new Entry(x);
+ // Have to get return value first.
+ // It might not get cached at all,
+ // i.e. removed at once.
+ Object ret = cac.getValue();
+ cache.put(x, cac);
+ return ret;
+ }
+ return cac.getValue();
}
- return cac.getValue();
+ }
+ private void addEntryBack(Entry entry) {
+ // If it's been superseded by another entry, do nothing
+ if(cache.get(entry.input) != null) return;
+ entry.closed = false;
+ cache.put(entry.input, entry);
}
}
Index: fenfire/org/fenfire/spanimages/gl/PoolManager.java
diff -u fenfire/org/fenfire/spanimages/gl/PoolManager.java:1.11
fenfire/org/fenfire/spanimages/gl/PoolManager.java:1.12
--- fenfire/org/fenfire/spanimages/gl/PoolManager.java:1.11 Sun Aug 31
08:28:05 2003
+++ fenfire/org/fenfire/spanimages/gl/PoolManager.java Thu Sep 11 13:26:08 2003
@@ -143,7 +143,8 @@
public void run() {
while(true) {
try {
- Thread.sleep(1000);
+ // Slow down when debugging
+ Thread.sleep(dbg ? 10000 : 1000);
updateAllocs();
} catch(Exception e) {
e.printStackTrace();
@@ -182,9 +183,9 @@
continue;
}
int l = 0;
- if(dbg) p("Loop: "+i+" "+actives.length);
+ // if(dbg) p("Loop: "+i+" "+actives.length);
for(; l < actives[i].missingPixels.length; l++) {
- if(dbg) p("l "+l+" miss: "+actives[i].missingPixels[l]);
+ // if(dbg) p("l "+l+" miss: "+actives[i].missingPixels[l]);
if(actives[i].missingPixels[l] > .15 * actives[i].nPixels()) {
l--;
break;
@@ -204,6 +205,7 @@
if(i >= MIN_ACTIVES && l == actives[i].loader.getNLevels()-1)
activeSet.remove(actives[i]);
}
+ if(dbg) p("Memory left: "+left);
}
}
Index: fenfire/org/fenfire/view/buoy/NodeType2D.java
diff -u fenfire/org/fenfire/view/buoy/NodeType2D.java:1.16
fenfire/org/fenfire/view/buoy/NodeType2D.java:1.17
--- fenfire/org/fenfire/view/buoy/NodeType2D.java:1.16 Sat Aug 16 06:29:40 2003
+++ fenfire/org/fenfire/view/buoy/NodeType2D.java Thu Sep 11 13:26:09 2003
@@ -99,9 +99,10 @@
box = vs.matcher.getCS(containerCS, anchor.node);
if (dbg) p("box is: "+box);
}
+ // May happen due to superlaziness, if the other node wasn't
+ // rendered.
if (box < 0) {
box = into;
- throw new Error("Heyhey boys!! this doesn't work!");
}
return vs.coords.unitSq(box);
}
Index: fenfire/org/fenfire/view/buoy/PPConnector.java
diff -u fenfire/org/fenfire/view/buoy/PPConnector.java:1.23
fenfire/org/fenfire/view/buoy/PPConnector.java:1.24
--- fenfire/org/fenfire/view/buoy/PPConnector.java:1.23 Wed Sep 10 09:28:24 2003
+++ fenfire/org/fenfire/view/buoy/PPConnector.java Thu Sep 11 13:26:09 2003
@@ -105,6 +105,7 @@
Object plane = fen.constgraph.find1_X11(CANVAS2D.contains, obj);
if (container == plane) continue;
Object anchor = getAnchor(plane, obj);
+ if(anchor == null) continue;
if (dbg) p("anchor:"+anchor);
l.link(1, cs, nodeType, new Pair(node, obj), anchor, shift);
shift++;
@@ -118,6 +119,7 @@
Object plane = fen.constgraph.find1_X11(CANVAS2D.contains, obj);
if (container == plane) continue;
Object anchor = getAnchor(plane, obj);
+ if(anchor == null) continue;
if (dbg) p("anchor:"+anchor);
l.link(-1, cs, nodeType, new Pair(obj, node), anchor, shift);
shift++;
@@ -132,6 +134,8 @@
float y = RDFUtil.getFloat(fen.graph, node, CANVAS2D.y);
org.nongnu.libvob.lava.placeable.Placeable p =
(org.nongnu.libvob.lava.placeable.Placeable)nodeView.f(fen.constgraph, node);
+ if(p == null)
+ return null;
return new View2D.Anchor(plane,
x-dx, y-dy,
p.getWidth()+dx+dx,
- [ff-cvs] fenfire docs/pegboard/cvs_to_tla--tjl/peg.rst o...,
Tuomas J. Lukka <=