]> err.no Git - mapper/commitdiff
Small fixes
authorKaj-Michael Lang <milang@onion.tal.org>
Tue, 2 Oct 2007 14:41:59 +0000 (17:41 +0300)
committerKaj-Michael Lang <milang@onion.tal.org>
Tue, 2 Oct 2007 14:41:59 +0000 (17:41 +0300)
src/gtkgps.c
src/gtkgps.h

index e9e2e51e32e3c1950ef7cf70be2a767e8ccad510..9923b228b843c0d8ff65776694f6e55f7e380d27 100644 (file)
@@ -99,9 +99,9 @@ gtk_gps_init(GtkGps *gps)
 {
 g_printf("%s()\n", __PRETTY_FUNCTION__);
 
-gps->gc1=NULL;
-gps->gc2=NULL;
-gps->gc3=NULL;
+gps->gc_w=NULL;
+gps->gc_s=NULL;
+gps->gc_sf=NULL;
 gps->width=300;
 gps->height=300;
 gps->size=300;
@@ -209,9 +209,9 @@ gps->height=allocation->height;
 gps->size=MIN(gps->width, gps->height);
 
 gps->fs=gps->size/20;
-BOUND(gps->fs,8,20);
+BOUND(gps->fs, 8, 20);
 
-pango_font_description_set_size(gps->fontdesc, gps->fs*PANGO_SCALE);
+pango_font_description_set_size(gps->fontdesc, (gps->fs-1)*PANGO_SCALE);
 pango_layout_set_font_description(gps->layout, gps->fontdesc);
 }
 
@@ -245,28 +245,28 @@ widget->style=gtk_style_attach(widget->style, widget->window);
 gdk_window_set_user_data(widget->window, widget);
 gtk_style_set_background(widget->style, widget->window, GTK_STATE_ACTIVE);
 
-if (!gps->gc1) {
+if (!gps->gc_s) {
        color.red=0;
        color.green=0;
        color.blue=0;
-       gps->gc1=gdk_gc_new(widget->window);
-       gdk_gc_set_rgb_fg_color(gps->gc1, &color);
+       gps->gc_s=gdk_gc_new(widget->window);
+       gdk_gc_set_rgb_fg_color(gps->gc_s, &color);
 }
 
-if (!gps->gc2) {
+if (!gps->gc_sf) {
        color.red=0;
-       color.green=0;
-       color.blue=0xffff;
-       gps->gc2=gdk_gc_new(widget->window);
-       gdk_gc_set_rgb_fg_color(gps->gc2, &color);
+       color.green=0xffff;
+       color.blue=0;
+       gps->gc_sf=gdk_gc_new(widget->window);
+       gdk_gc_set_rgb_fg_color(gps->gc_sf, &color);
 }
 
-if (!gps->gc3) {
+if (!gps->gc_w) {
        color.red=0xffff;
        color.green=0xffff;
        color.blue=0xffff;
-       gps->gc3=gdk_gc_new(widget->window);
-       gdk_gc_set_rgb_fg_color(gps->gc3, &color);
+       gps->gc_w=gdk_gc_new(widget->window);
+       gdk_gc_set_rgb_fg_color(gps->gc_w, &color);
 }
 }
 
@@ -379,18 +379,18 @@ gdk_draw_layout(widget->window, widget->style->fg_gc[GTK_STATE_NORMAL],
 
 for (i=0;i<gps->data->satinview;i++) {
        /* Sat used or not */
-       gc=(gps->data->sat[i].fix) ? gps->gc2 : gps->gc1;
+       gc=(gps->data->sat[i].fix) ? gps->gc_sf : gps->gc_s;
 
        tmp = (gps->data->sat[i].azimuth * (1.f / 180.f)) * G_PI;
        x = xoffset + halfsize + (90 - gps->data->sat[i].elevation) * halfsize / 90 * sinf(tmp);
        y = yoffset + halfsize - (90 - gps->data->sat[i].elevation) * halfsize / 90 * cosf(tmp);
 
-       gdk_draw_arc(widget->window, gc, TRUE, x-gps->fs, y-gps->fs, gps->fs+3, gps->fs+3, 0, 64 * 360);
+       gdk_draw_arc(widget->window, gc, TRUE, x-gps->fs, y-gps->fs, gps->fs+4, gps->fs+4, 0, 64 * 360);
 
        g_snprintf(buffer, 6, "%02d", gps->data->sat[i].prn);
        pango_layout_set_text(gps->layout, buffer, -1);
        pango_layout_get_pixel_size(gps->layout, &x1, &y1);
-       gdk_draw_layout(widget->window, gps->gc3, x - x1 / 2, y - y1 / 2, gps->layout);
+       gdk_draw_layout(widget->window, gps->gc_w, x-gps->fs/2-x1/2, y-gps->fs/2-y1/2, gps->layout);
 }
 
 return;
@@ -410,12 +410,18 @@ widget=GTK_WIDGET(gps);
 if (!GTK_WIDGET_MAPPED(widget))
        return;
 
-xoffset = 0;
-yoffset = 0;
+xoffset=0;
+yoffset=0;
 
 /* Bootom margin - 12% */
 bymargin = gps->height * 0.88f;
 
+gtk_paint_flat_box (widget->style,
+       widget->window,
+       GTK_STATE_NORMAL, GTK_SHADOW_NONE,
+       NULL, widget, "trough", 0, 0, 
+       gps->width, gps->height);
+
 /* Bottom line */
 gdk_draw_line(widget->window,
              widget->style->fg_gc[GTK_WIDGET_STATE(widget)],
@@ -432,7 +438,7 @@ if (gps->data->satinview > 0) {
 
        for (i = 0; i < gps->data->satinview; i++) {
                /* Sat used or not */
-               gc=(gps->data->sat[i].fix) ? gps->gc1 : gps->gc2;
+               gc=(gps->data->sat[i].fix) ? gps->gc_sf : gps->gc_s;
 
                x = 5 + i * step;
                snr_height = gps->data->sat[i].snr * gps->height * 0.78f / 100;
index 07cce89f999b41985bceae90d7fbc241897e58d7..6460530186cf1eb2f60bd6afe0b0003de2e2c76d 100644 (file)
@@ -43,8 +43,9 @@ struct _GtkGps {
        GtkWidget parent;
        GtkWidget widget;
        GdkGC *gc1;
-       GdkGC *gc2;
-       GdkGC *gc3;
+       GdkGC *gc_s;
+       GdkGC *gc_sf;
+       GdkGC *gc_w;
        gint width, height;
        gint size;
        gint fs;