From: Enrico Zini Date: Tue, 8 Dec 2009 22:42:50 +0000 (+0000) Subject: More int arithmetic X-Git-Url: https://git.toastfreeware.priv.at/gregoa/zavai.git/commitdiff_plain/54bd9850323255e8d4e55fb38dfae245ac31545a More int arithmetic --- diff --git a/src/fisheye.vala b/src/fisheye.vala index 2eb6bd4..fd0e1c5 100644 --- a/src/fisheye.vala +++ b/src/fisheye.vala @@ -34,7 +34,7 @@ public class FisheyeList : Gtk.DrawingArea protected int focus_size; protected int[] focus_starts; protected bool focus_locked; - protected double focus_centre; + protected int focus_centre; public FisheyeList() { @@ -144,7 +144,7 @@ public class FisheyeList : Gtk.DrawingArea protected void focus_layout() { // Anchor point - focus_centre = (double)cur_el*allocation.height/list.length; + focus_centre = cur_el*allocation.height/list.length; focus_first = cur_el > focus_size/2 ? cur_el-focus_size/2 : 0; focus_end = focus_first + focus_size; @@ -167,17 +167,6 @@ public class FisheyeList : Gtk.DrawingArea protected void draw(Gdk.Drawable drawable) { Gtk.Style style = get_style(); - /* - public enum StateType { - NORMAL, - ACTIVE, - PRELIGHT, - SELECTED, - INSENSITIVE - } - style.bg[Gtk.StateType.NORMAL]; - */ - // Background drawable.draw_rectangle(style.bg_gc[Gtk.StateType.NORMAL], true, 0, 0, allocation.width, allocation.height); @@ -212,7 +201,9 @@ public class FisheyeList : Gtk.DrawingArea var fd = style.font_desc.copy(); //fd.set_size((y1-y0)*Pango.SCALE); - fd.set_absolute_size((y1-y0)*Pango.SCALE*80/100); + int size = (y1-y0)*Pango.SCALE*80/100; + if (size <= 0) size = Pango.SCALE; + fd.set_absolute_size(size); layout.set_font_description(fd); //stderr.printf("AZAZA %p\n", layout.get_attributes()); //var attrlist = layout.get_attributes().copy(); @@ -251,12 +242,12 @@ public class FisheyeList : Gtk.DrawingArea * @param max the end of the display * @return the distorted coordinate */ - private double fisheye(double x, double a, double d, double min, double max) + private double fisheye(double x, int a, double d, int min, int max) { if ( d != 0 ) { bool left = x