compass->gc_w=NULL;
compass->dest_valid=FALSE;
compass->way_valid=FALSE;
-compass->width=400;
+compass->width=300;
compass->height=300;
}
size=compass->size;
hsize=size/2;
+pango_context_set_matrix (compass->context, NULL);
+
g_snprintf(htext, 8, "%3.0f°", compass->data->heading);
pango_layout_set_text(compass->layout, htext, -1);
pango_layout_get_pixel_size(compass->layout, &x, &y);
compass->xoffset + size / 2, compass->yoffset + size - y - 8);
for (i = 0; i < 5; i++) {
+ PangoMatrix matrix = PANGO_MATRIX_INIT;
dir = (gint) (compass->data->heading / 45) * 45 + angle[i];
switch (dir) {
> abs((guint) (compass->data->heading / 45) * 45 + 45 - compass->data->heading) && (i > 0))
x = fsize[i - 1];
+ pango_matrix_rotate (&matrix, dir);
+ pango_context_set_matrix (compass->context, &matrix);
+
pango_font_description_set_size(compass->fontdesc, (10 + x) * PANGO_SCALE);
pango_layout_set_font_description(compass->layout, compass->fontdesc);
pango_layout_set_text(compass->layout, text, -1);
gtk_gps_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
{
GtkGps *gps;
+
g_return_if_fail(GTK_IS_GPS(object));
+
gps=GTK_GPS(object);
switch (prop_id) {
default:
gtk_gps_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
{
GtkGps *gps;
+
g_return_if_fail(GTK_IS_GPS(object));
+
gps=GTK_GPS(object);
switch (prop_id) {
default:
gps->gc1=NULL;
gps->gc2=NULL;
gps->gc3=NULL;
-gps->width=400;
+gps->width=300;
gps->height=300;
+gps->size=300;
}
static gboolean
{
GtkGps *gps;
-printf("%s()\n", __PRETTY_FUNCTION__);
gps=GTK_GPS(widget);
if (event->button==1) {
gps->data=data;
widget=GTK_WIDGET(gps);
g_signal_connect(G_OBJECT(widget), "button_press_event", G_CALLBACK(gtk_gps_cb_button_press), NULL);
+
+gps->context=gtk_widget_get_pango_context(widget);
+gps->layout=pango_layout_new(gps->context);
+gps->fontdesc=pango_font_description_new();
+pango_font_description_set_family(gps->fontdesc, "Sans Serif");
+pango_font_description_set_size(gps->fontdesc, 10*PANGO_SCALE);
+pango_layout_set_font_description(gps->layout, gps->fontdesc);
+pango_layout_set_alignment(gps->layout, PANGO_ALIGN_CENTER);
+
return GTK_WIDGET(gps);
}
{
GtkGps *gps;
-g_printf("%s()\n", __PRETTY_FUNCTION__);
-
g_return_if_fail(GTK_IS_GPS(object));
gps=GTK_GPS(object);
g_printf("%s()\n", __PRETTY_FUNCTION__);
g_return_if_fail(GTK_IS_GPS(widget));
-g_return_if_fail(requisition != NULL);
+g_return_if_fail(requisition!=NULL);
gps = GTK_GPS (widget);
-requisition->width=400;
+requisition->width=300;
requisition->height=300;
-gps->width=400;
+gps->width=300;
gps->height=300;
+gps->size=300;
}
static void
gtk_gps_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
{
GtkGps *gps;
-
-g_printf("%s()\n", __PRETTY_FUNCTION__);
+gint fs;
g_return_if_fail(GTK_IS_GPS(widget));
g_return_if_fail(allocation!=NULL);
allocation->width, allocation->height);
}
-
gps->width=allocation->width;
gps->height=allocation->height;
+gps->size=MIN(gps->width, gps->height);
+
+gps->fs=gps->size/20;
+BOUND(gps->fs,8,20);
+
+pango_font_description_set_size(gps->fontdesc, gps->fs*PANGO_SCALE);
+pango_layout_set_font_description(gps->layout, gps->fontdesc);
}
static void
GdkWindowAttr attributes;
gint attributes_mask;
-g_printf("%s()\n", __PRETTY_FUNCTION__);
-
g_return_if_fail (GTK_IS_GPS(widget));
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
gps=GTK_GPS(widget);
gdk_window_set_user_data(widget->window, widget);
gtk_style_set_background(widget->style, widget->window, GTK_STATE_ACTIVE);
-gps->context=gtk_widget_get_pango_context(widget);
-gps->layout=pango_layout_new(gps->context);
-gps->fontdesc=pango_font_description_new();
-pango_font_description_set_family(gps->fontdesc, "Sans Serif");
-pango_font_description_set_size(gps->fontdesc, 10*PANGO_SCALE);
-pango_layout_set_font_description(gps->layout, gps->fontdesc);
-pango_layout_set_alignment(gps->layout, PANGO_ALIGN_CENTER);
-
if (!gps->gc1) {
color.red=0;
color.green=0;
GdkGC *gc;
GtkWidget *widget;
guint i, x, y, size, halfsize, xoffset, yoffset;
-guint x1, y1, x0, y0;
+guint x1, y1, x0, y0, ds;
gfloat tmp;
gchar buffer[16];
guint line[12]={0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330};
x0=0;
y0=0;
-size=MIN(gps->width, gps->height);
+size=gps->size;
halfsize=size/2;
if (gps->width>gps->height) {
xoffset=x0+(gps->width-gps->height-PADDING)/2;
yoffset=y0+(gps->height-gps->width-PADDING)/2;
}
-if (size<200) {
- pango_font_description_set_size(gps->fontdesc, 10*PANGO_SCALE);
- pango_layout_set_font_description(gps->layout, gps->fontdesc);
-} else {
- pango_font_description_set_size(gps->fontdesc, 12*PANGO_SCALE);
- pango_layout_set_font_description(gps->layout, gps->fontdesc);
-}
-
gtk_paint_flat_box (widget->style,
widget->window,
GTK_STATE_NORMAL, GTK_SHADOW_NONE,
yoffset + halfsize + (halfsize - 2) * cosf(tmp));
}
+if (size > 140) {
for (i = 0; i < 12; i++) {
tmp = (line[i] * (1.f / 180.f)) * G_PI;
/* azimuth */
(xoffset + halfsize + size / 6 * sinf(tmp)) - x / 2,
(yoffset + halfsize - size / 6 * cosf(tmp)) - y / 2,
gps->layout);
+}
for (i=0;i<gps->data->satinview;i++) {
/* Sat used or not */
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 - 10, y - 10, 20, 20, 0, 64 * 360);
+ gdk_draw_arc(widget->window, gc, TRUE, x-gps->fs, y-gps->fs, gps->fs+3, gps->fs+3, 0, 64 * 360);
g_snprintf(buffer, 6, "%02d", gps->data->sat[i].prn);
pango_layout_set_text(gps->layout, buffer, -1);
gdk_draw_layout(widget->window, gps->gc3, x - x1 / 2, y - y1 / 2, gps->layout);
}
-g_printf("%s(): return\n", __PRETTY_FUNCTION__);
return;
}
guint x, y, x1, y1;
gchar tmp[32];
-g_printf("%s()\n", __PRETTY_FUNCTION__);
-
widget=GTK_WIDGET(gps);
if (!GTK_WIDGET_MAPPED(widget))