gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] gzz/gzz/modules/pp PPMouseEvents.java vob/VobCS...


From: Matti Katila
Subject: [Gzz-commits] gzz/gzz/modules/pp PPMouseEvents.java vob/VobCS...
Date: Mon, 23 Dec 2002 11:10:40 -0500

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Matti Katila <address@hidden>   02/12/23 11:10:40

Modified files:
        gzz/modules/pp : PPMouseEvents.java 
        gzz/modules/pp/vob: VobCSGenerator.java 

Log message:
        left panel tuning, new paper tuning.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/modules/pp/PPMouseEvents.java.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/modules/pp/vob/VobCSGenerator.java.diff?tr1=1.6&tr2=1.7&r1=text&r2=text

Patches:
Index: gzz/gzz/modules/pp/PPMouseEvents.java
diff -u gzz/gzz/modules/pp/PPMouseEvents.java:1.9 
gzz/gzz/modules/pp/PPMouseEvents.java:1.10
--- gzz/gzz/modules/pp/PPMouseEvents.java:1.9   Mon Dec 23 09:35:25 2002
+++ gzz/gzz/modules/pp/PPMouseEvents.java       Mon Dec 23 11:10:40 2002
@@ -132,6 +132,11 @@
                pa("Add new paper!");
                ppactions.newPaper();
            } catch (Exception e) { pa(e.getMessage()); }
+
+           // set mainVP to new paper
+           Cell p = 
context.getAccursed().h(ppv.d.contains).h(ppv.d.d1).s(ppv.d.d1);
+           for (; p.s(ppv.d.d1) !=null;) { p = p.s(ppv.d.d1);}
+           context.setAccursed(p);
            AbstractUpdateManager.chg();
        }
     }
Index: gzz/gzz/modules/pp/vob/VobCSGenerator.java
diff -u gzz/gzz/modules/pp/vob/VobCSGenerator.java:1.6 
gzz/gzz/modules/pp/vob/VobCSGenerator.java:1.7
--- gzz/gzz/modules/pp/vob/VobCSGenerator.java:1.6      Fri Dec 20 13:23:58 2002
+++ gzz/gzz/modules/pp/vob/VobCSGenerator.java  Mon Dec 23 11:10:40 2002
@@ -28,11 +28,17 @@
 
 public class VobCSGenerator {
     static public boolean dbg=false;
+    static public void p(String s) { System.out.print(s); }
     static public void pa(String s) { System.out.println(s); }
 
     static public final int HORIZONTAL = 1;
     static public final int VERTICAL = 2;
 
+    public float biggest_percent = 0.5f;
+    public float percent_of_predecessor = 0.7f;
+    public float smallest_percent = 0.2f;
+
+
     private int vob_cs[][];
 
 
@@ -41,16 +47,17 @@
      * focus_index begins from 0
      * or -1 if focus in home paper.
      */
-    public VobCSGenerator(VobScene vs, int cs_into, int vob_count, int 
focus_index, float vob_width, float vob_height) {
+    public VobCSGenerator(VobScene vs, int cs_into, int vob_count,
+                         int focus_index, float vob_width, float vob_height) {
 
-       if (dbg) pa("Vobeja: "+ vob_count+" focus on: "+ focus_index);
+       if (dbg) pa("Vobs: "+ vob_count+" focus on: "+ focus_index);
        if ( vob_count == 0) {
            pa("DEBUG: Might be an error - but there are no vob around!");
            return; 
        }
 
 
-       // check out..
+       // check out..  -1 is exception
        if (focus_index == -1) focus_index++;
        if ( 0 <= focus_index && focus_index < vob_count); 
        else throw new Error("Focus out of vobs");
@@ -58,34 +65,56 @@
        GLVobCoorder glc = (GLVobCoorder)vs.coords;
 
        // count how long the width is in given cs
-       float [] coords = { 0, 0,0,  1, 1,0 };
+       float [] coords = { 0,0,0,  1,1,0 };
        float [] trans = new float[6];
 
        glc.transformPoints3(cs_into, coords, trans);
        float x_diff = trans[3] - trans[0]; 
        float y_diff = trans[4] - trans[1];
 
+
+
+
        final int fake_count = 2 + vob_count;
        final int fake_focus = focus_index + 2;
 
+
+       float spare_space = y_diff/vob_height - 1;
+       pa("spare: " + spare_space);
+
+
+       
+
+
+
        float [] rations = new float[vob_count];
-       float[] sigs = countSigmund(fake_focus);
+       //float[] sigs = countSigmund(fake_focus);
+
+       float[] sigs = countBoxAlgorithm(fake_focus/fake_count * spare_space,
+                                        fake_focus, vob_height);
+
+
        for (int i=focus_index; i>=0; i--) {
            rations[i] = sigs[focus_index-i];
        }
 
-       sigs = countSigmund(fake_count - fake_focus);
+       //sigs = countSigmund(fake_count - fake_focus);
+       sigs = countBoxAlgorithm((fake_count - fake_focus)/fake_count * 
spare_space,
+                                fake_count-fake_focus, vob_height);
        for (int i=focus_index; i<vob_count; i++) {
            rations[i] = sigs[Math.abs(focus_index - i)];
        }
 
+       //for (int i=0; i<vob_count; i++) { p("["+rations[i]+"],");}
+
+
+
        // focus is number ONE(the biggest) - "Uuno on numero yksi..." =)
        rations[focus_index] = 1.0f;
-       proportion(rations, focus_index, y_diff/vob_height );
-
+       //proportion(rations, focus_index, y_diff/vob_height );
 
-       for (int i=0; i<rations.length; i++) {
-           if (dbg) pa(i+": "+ rations[i]);
+       for (int i=0; i<vob_count; i++) { 
+           if (dbg) p("["+rations[i]+"],");
        }
 
        float sum = 0;
@@ -139,12 +168,44 @@
        throw new Error("asked unknown CS: " + i);
     }
 
+    /** Easy algorithm 
+     */
+    private float[] countBoxAlgorithm(float f, int count, float length) {
+
+       if (count <= 1) return new float[]{ biggest_percent };
+
+       // first index is fake or smthng..
+
+       float[] retArray = new float[count];
+       retArray[1] = biggest_percent;
+
+       float summ = retArray[1] * length;
+       float percent = biggest_percent;
+       int i= 2;
+
+       while (summ < length && i < retArray.length) {
+           retArray[i] = percent * percent_of_predecessor;
+           if (retArray[i] < smallest_percent)
+               retArray[i] = smallest_percent;
+
+           summ += retArray[i] * length;
+           percent = retArray[i];
+           i++;
+       }
+
+       for (int j=i; j<retArray.length; j++) {
+           retArray[j] = 0;
+       }
+
+       return retArray;
+    }
+
 
 
     /** Check out the sigmund function." y0 = tanh(y1)" if you like to 
understand ;)
      */
     private float[] countSigmund(int ratio) {
-       float [] retArray = new float[ratio];
+       float [] retArray = new float[ratio];
 
        float I = 10.0f;
        float sigm = I*(float)Math.PI;



reply via email to

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