fenfire-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ff-cvs] fenfire ./README.MMDEMO org/fenfire/demo/mm.py ...


From: Asko Soukka
Subject: [ff-cvs] fenfire ./README.MMDEMO org/fenfire/demo/mm.py ...
Date: Tue, 19 Aug 2003 05:34:24 -0400

CVSROOT:        /cvsroot/fenfire
Module name:    fenfire
Branch:         
Changes by:     Asko Soukka <address@hidden>    03/08/19 05:34:24

Modified files:
        .              : README.MMDEMO 
        org/fenfire/demo: mm.py 
        org/fenfire/fenmm: WhiteNodeView.java 
        org/fenfire/view/lava: mindMapView2D.py 

Log message:
        Calibrating custom controller.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/README.MMDEMO.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/demo/mm.py.diff?tr1=1.29&tr2=1.30&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/fenmm/WhiteNodeView.java.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/view/lava/mindMapView2D.py.diff?tr1=1.32&tr2=1.33&r1=text&r2=text

Patches:
Index: fenfire/README.MMDEMO
diff -u fenfire/README.MMDEMO:1.6 fenfire/README.MMDEMO:1.7
--- fenfire/README.MMDEMO:1.6   Fri Aug 15 11:00:07 2003
+++ fenfire/README.MMDEMO       Tue Aug 19 05:34:24 2003
@@ -104,8 +104,24 @@
 Ctrl-End
        Moves the text cursor to the end of the text.
 
-Ctrl-C
+Ctrl-C or Ctrl-K
        Copy the content of the node into the clipboard.
 
 Ctrl-V or Ctrl-Y
        Paste the content of the clipbard (just after the cursor).
+
+-----------------
+Custom Controller
+-----------------
+
+Ctrl-0 (not 'o', but zero)
+       Calibration.
+
+Axe-1
+       Width and size of fillets.
+
+Axe-2
+       Length of fillets.
+
+Axe-3 (wheel)
+       Rotating map.
\ No newline at end of file
Index: fenfire/org/fenfire/demo/mm.py
diff -u fenfire/org/fenfire/demo/mm.py:1.29 fenfire/org/fenfire/demo/mm.py:1.30
--- fenfire/org/fenfire/demo/mm.py:1.29 Tue Aug 19 05:19:16 2003
+++ fenfire/org/fenfire/demo/mm.py      Tue Aug 19 05:34:24 2003
@@ -75,10 +75,12 @@
 
 # storm pool directory and mindmap file
 DIR = 'myFenfire/'
-FILE = DIR+'mindmap.rdf'
+FILE = java.lang.System.getProperty("fenmm.file", DIR+"mindmap.rdf")
+POOLDIR = java.lang.System.getProperty("fenmm.pool", DIR)
 
-os.system('mkdir -p '+DIR)
-pool = storm.impl.DirPool(java.io.File(DIR), java.util.HashSet())
+os.system('mkdir -p '+POOLDIR)
+
+pool = storm.impl.DirPool(java.io.File(POOLDIR), java.util.HashSet())
 myalph = alph.impl.StormAlph(pool)
 
 # set flag to load an old graph or creating new
@@ -331,7 +333,6 @@
 mindMouse.setListener(1, 0,'Moving the pan around or the node if accursed.', \
                       PanMover(context))
 
-
 class VeryStupidBuoyManager:
     def __init__(self):
         self.main = ff.view.lava.mindMapView2D.MindMapMainNode2D(context.home, 
mindView,
@@ -349,14 +350,23 @@
 
         ### custom controller support
         self.naxes = 0
+        self.calibrating = 0
         try:
             self.ps2 = vob.input.impl.PS2MouseDevice("/dev/input/mouse0", 
"main",
                        vob.input.impl.PS2MouseDevice.IMPS_PROTO)
             self.naxes = len(self.ps2.getAxes())
-            self.axes = [
-                vob.input.impl.StandardBoundedFloatModel(0, 400,
-                actionPerformed = lambda x: vob.AbstractUpdateManager.chg())
-                for i in range(0,self.naxes)]
+            if self.naxes > 3: self.naxes = 3
+            self.axes = [None, None, None]
+            if self.naxes >= 1:
+                self.axes[0] = vob.input.impl.StandardBoundedFloatModel(0.001, 
mindView.nodeScale*2,
+                    actionPerformed = lambda x: 
vob.AbstractUpdateManager.chg())
+            if self.naxes >= 2:
+                self.axes[1] = vob.input.impl.StandardBoundedFloatModel(0.001, 
mindView.distanceScale*2,
+                    actionPerformed = lambda x: 
vob.AbstractUpdateManager.chg())
+            if self.naxes >= 3:
+                self.axes[2] = vob.input.impl.WrappingBoundedFloatModel(0, 
Math.PI*2, 
+                    actionPerformed = lambda x: 
vob.AbstractUpdateManager.chg())
+
             for i in range(0,self.naxes):
                 self.ps2.getAxes()[i].setMainListener(
                 vob.input.BoundedFloatLinearAbsoluteAdapter(self.axes[i]))
@@ -371,12 +381,9 @@
         
         
         # custom controller support
-        if self.naxes >= 1:
-            mindView.nodeScale = self.axes[0].getValue() / 10. + 1
-        if self.naxes >= 2:
-            mindView.distanceScale = self.axes[1].getValue() / 50. + 1
-        if self.naxes >= 3:
-            mindView.rotation = self.axes[2].getValue() / -4
+        if self.naxes >= 1: mindView.nodeScale = self.axes[0].getValue()
+        if self.naxes >= 2: mindView.distanceScale = self.axes[1].getValue()
+        if self.naxes >= 3: mindView.rotation = -self.axes[2].getValue()
 
         vs.put(background(context.bgcolor))
         cs = vs.orthoBoxCS(0, "foo",0, 50,50, 1,1, 750,650)
@@ -463,7 +470,7 @@
             """Move the cursor to the end of the text."""
             text = alphContent.getText(fen.graph, context.getAccursed())
             context.offset = len(text)
-        if key == "Ctrl-C":
+        if key == "Ctrl-C" or "Ctrl-K":
             """Copy the content of the node into the clipboard."""
             text = alphContent.getText(fen.graph, context.getAccursed())
             PUIClipboard.puiCopy(text)
@@ -490,6 +497,18 @@
             context.offset = normal_text.getPos(fen.graph, 
context.getAccursed(), xy[0], xy[1])
             text = alphContent.getText(fen.graph, context.getAccursed())
             if context.offset < len(text): context.offset -= 1
+        if key == "Ctrl-0":
+            """Set calibrating state of custom controller on / off."""
+            if self.calibrating and self.naxes: 
+                p("Custom controller calibrated.")
+                self.calibrating = 0
+                for axe in self.ps2.getAxes():
+                    axe.setState(vob.input.InputDeviceManager.STATE_NORMAL)
+            elif self.naxes:
+                p("Calibrate custom controller. Please, move axes to their 
extreme positions.")
+                self.calibrating = 1
+                for axe in self.ps2.getAxes():
+                    
axe.setState(vob.input.InputDeviceManager.STATE_CALIBRATING)
         elif len(key) == 1:
             """Enter a character into the cursor position."""
             context.scale = 1
@@ -499,8 +518,6 @@
             text = alphContent.getText(fen.graph, context.getAccursed())
             print text[0:context.offset], '[cursor]'
         
-        vob.AbstractUpdateManager.chg()
-
 
 currentScene = VeryStupidBuoyManager()
 vob.putil.demo.usingNormalBindings = 0
Index: fenfire/org/fenfire/fenmm/WhiteNodeView.java
diff -u fenfire/org/fenfire/fenmm/WhiteNodeView.java:1.2 
fenfire/org/fenfire/fenmm/WhiteNodeView.java:1.3
--- fenfire/org/fenfire/fenmm/WhiteNodeView.java:1.2    Mon Aug 18 09:07:16 2003
+++ fenfire/org/fenfire/fenmm/WhiteNodeView.java        Tue Aug 19 05:34:24 2003
@@ -1,14 +1,20 @@
 // (c): Matti J. Katila
 
 package org.fenfire.fenmm;
-import org.fenfire.swamp.*;
-import org.nongnu.libvob.*;
-import org.nongnu.libvob.lava.placeable.*;
-import org.nongnu.libvob.gl.*;
+
+import org.fenfire.swamp.PureNodeFunction;
+import org.fenfire.swamp.ConstGraph;
+import org.nongnu.libvob.lava.placeable.TextPlaceable;
+import org.nongnu.libvob.VobScene;
+import org.nongnu.libvob.gl.GLRen;
+import org.nongnu.libvob.gl.Paper;
+import org.nongnu.libvob.gl.SpecialPapers;
 
 import java.awt.Color;
 
-/** Must be placed before TextPlaceable node function XXX
+/**  
+ * Translucent rectangular background for TextNodeView.
+ * XXX: Must be placed before TextPlaceable node function.
  */
 public class WhiteNodeView implements PureNodeFunction {
 
@@ -30,7 +36,6 @@
                public void place(VobScene vs, int cs) {
                    int cs2 = vs.orthoCS(cs, key,0, 0,0, p.getWidth(), 
p.getHeight());
                    vs.put(pq, cs2);
-
                    p.place(vs, cs);
                }
                
Index: fenfire/org/fenfire/view/lava/mindMapView2D.py
diff -u fenfire/org/fenfire/view/lava/mindMapView2D.py:1.32 
fenfire/org/fenfire/view/lava/mindMapView2D.py:1.33
--- fenfire/org/fenfire/view/lava/mindMapView2D.py:1.32 Tue Aug 19 05:18:49 2003
+++ fenfire/org/fenfire/view/lava/mindMapView2D.py      Tue Aug 19 05:34:24 2003
@@ -170,6 +170,7 @@
     def render(self, vs, node,
                matchingParent, box2screen, box2plane):
         self.matchingParent = matchingParent
+        p("Rendering view.")
 
        if dbg:
            dbg1 = vs.unitSqCS(box2screen, "U")




reply via email to

[Prev in Thread] Current Thread [Next in Thread]