gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] fenfire ./TODO-loom org/fenfire/loom/Loom.java


From: Benja Fallenstein
Subject: [Gzz-commits] fenfire ./TODO-loom org/fenfire/loom/Loom.java
Date: Fri, 07 Mar 2003 16:28:17 -0500

CVSROOT:        /cvsroot/fenfire
Module name:    fenfire
Changes by:     Benja Fallenstein <address@hidden>      03/03/07 16:28:15

Modified files:
        .              : TODO-loom 
        org/fenfire/loom: Loom.java 

Log message:
        Nicer colors; center text (kludge); ovals for resources,
        rectangles for literals; fix cursor keys (can now
        use either them or j/l/i/,/u/o/n/m/.-- whew)

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/TODO-loom.diff?tr1=1.20&tr2=1.21&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/loom/Loom.java.diff?tr1=1.12&tr2=1.13&r1=text&r2=text

Patches:
Index: fenfire/TODO-loom
diff -u fenfire/TODO-loom:1.20 fenfire/TODO-loom:1.21
--- fenfire/TODO-loom:1.20      Thu Mar  6 04:52:15 2003
+++ fenfire/TODO-loom   Fri Mar  7 16:28:06 2003
@@ -23,7 +23,6 @@
       - currently clicking on literal rotates to it,
         clicking on node makes it focus
 
-    - better colours
     - views proportional to window size
     - clip instead of truncate text
 
Index: fenfire/org/fenfire/loom/Loom.java
diff -u fenfire/org/fenfire/loom/Loom.java:1.12 
fenfire/org/fenfire/loom/Loom.java:1.13
--- fenfire/org/fenfire/loom/Loom.java:1.12     Fri Mar  7 15:48:09 2003
+++ fenfire/org/fenfire/loom/Loom.java  Fri Mar  7 16:28:15 2003
@@ -47,6 +47,8 @@
     protected View[] views;
     int viewcur = 0;
 
+    protected ColorScheme colors;
+
     public static Model load(String filename) throws RDFException, 
                                                     IOException {
        Model model = new ModelMem();
@@ -71,13 +73,16 @@
            System.exit(1);
        }
 
-       new Loom(file);
+       new Loom(file, blue);
     }
 
     protected NodeView.Nodespec lastFocus;
     protected NodeView.Nodespec lastRotation;
 
-    public Loom(String file) throws RDFException, IOException {
+    public Loom(String file, ColorScheme colors0) 
+       throws RDFException, IOException {
+
+       this.colors = colors0;
 
        final Model model = load(file);
        final Statement stmt = model.listStatements().next();
@@ -118,20 +123,30 @@
                    Property prop = spec.prop;
                    int dir = spec.dir;
 
-                   RectBgVob bg = new RectBgVob();
-                   if(spec.equals(cursor.getRotationNodespec(dir))) // if 
selected
-                       bg.addColor(Color.red);
-                   if(!(node instanceof Resource)) // if literal
-                       bg.addColor(Color.yellow);
-                   sc.map.put(bg, into);
+                   if(node instanceof Resource) {
+                       OvalBgVob bg = new OvalBgVob();
+                       if(spec.equals(cursor.getRotationNodespec(dir))) // if 
selected
+                           bg.addColor(colors.getCursorColor());
+                       sc.map.put(bg, into);
+                   } else {
+                       RectBgVob bg = new RectBgVob();
+                       if(spec.equals(cursor.getRotationNodespec(dir))) // if 
selected
+                           bg.addColor(colors.getCursorColor());
+                       sc.map.put(bg, into);
+                   }
 
                    String s = node.toString();
-                   if(s.length() > 25) s = s.substring(s.length()-25);
+                   if(s.length() > 27) s = "..." + s.substring(s.length()-24);
 
-                   int unitSqCs = sc.unitSqCS(into, "text");
-                   int propCs = sc.orthoCS(unitSqCs, "property", 
-                                           0, 0, -.7f, .7f, .7f);
-                   sc.map.put(new TextVob(style, s), unitSqCs);
+                   float w = style.getWidth(s, 1);
+                   float h = style.getHeight(1);
+                   float x = 125-w/2;
+                   float y = 10-h/2;
+
+                   int textCs = sc.orthoCS(into, "text", 0, x, y, h, h);
+                   int propCs = sc.orthoCS(into, "property", 
+                                           0, 0, -h*.8f, h*.8f, h*.8f);
+                   sc.map.put(new TextVob(style, s), textCs);
 
                    if(prop != null) {
                        s = prop.toString();
@@ -150,7 +165,7 @@
                public VobScene generate() {
                    VobScene old = this.screen.getVobSceneForEvents();
                    VobScene sc = this.screen.window.createVobScene();
-                   sc.map.put(new SolidBgVob(java.awt.Color.white), 0);
+                   sc.map.put(new SolidBgVob(colors.getBg()), 0);
                    views[viewcur].render(sc, 0, cursor);
 
                    if(lastFocus != null) {
@@ -183,11 +198,13 @@
 
                public void keystroke(String s) {
                    System.out.println("Keystroke: "+s);
-                   if(s.equals("m") || s.equals("n") || s.equals("o"))
+                   if(s.equals("m") || s.equals("n") || s.equals("o") ||
+                      s.equals("i") || s.equals("Up"))
                        cursor.rotate(-1);
-                   else if(s.equals(".") || s.equals("u"))
+                   else if(s.equals(".") || s.equals("u") || 
+                           s.equals(",") || s.equals("Down"))
                        cursor.rotate(1);
-                   else if(s.equals("j")) {
+                   else if(s.equals("j") || s.equals("Left")) {
                        RDFNode node = cursor.getRotationNode(-1);
                        if(node == null || !(node instanceof Resource)) return;
                        lastFocus = new NodeView.Nodespec(cursor.focus);
@@ -198,7 +215,7 @@
                            new NodeView.Nodespec(stmt.getSubject(),
                                                  stmt.getPredicate(), -1);
                        cursor.move(-1);
-                   } else if(s.equals("l")) {
+                   } else if(s.equals("l") || s.equals("Right")) {
                        RDFNode node = cursor.getRotationNode(1);
                        if(node == null || !(node instanceof Resource)) return;
                        lastFocus = new NodeView.Nodespec(cursor.focus);
@@ -254,4 +271,24 @@
                }
            });
     }
+
+    public interface ColorScheme {
+        public Color getBg();
+        public Color getCursorColor();
+    }
+
+    public static class LightColorScheme implements ColorScheme {
+        float hue;
+        public LightColorScheme(float hue) { this.hue = hue; }
+        public Color getBg() {
+            return Color.getHSBColor(hue, 0.1f, 1f);
+        }
+        public Color getCursorColor() {
+            return Color.getHSBColor(hue, 0.5f, 1f);
+        }
+    }
+
+    public static final ColorScheme 
+       green = new LightColorScheme(0.233f),
+       blue = new LightColorScheme(0.555f);
 }




reply via email to

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