[Gpredict-svn] SF.net SVN: gpredict:[579] trunk
Real time satellite tracking and orbit prediction
Status: Beta
Brought to you by:
csete
From: <cs...@us...> - 2010-01-05 16:34:47
|
Revision: 579 http://gpredict.svn.sourceforge.net/gpredict/?rev=579&view=rev Author: csete Date: 2010-01-05 16:34:32 +0000 (Tue, 05 Jan 2010) Log Message: ----------- Added shadow to satellite marker and label to enhance visual appearance over light background map regions. Modified Paths: -------------- trunk/ChangeLog trunk/NEWS trunk/src/config-keys.h trunk/src/gtk-sat-map.c trunk/src/gtk-sat-map.h trunk/src/gtk-sat-selector.c trunk/src/sat-cfg.c trunk/src/sat-cfg.h trunk/src/sat-pref-map-view.c Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2010-01-05 14:04:39 UTC (rev 578) +++ trunk/ChangeLog 2010-01-05 16:34:32 UTC (rev 579) @@ -1,9 +1,16 @@ 2010-01-05 Alexandru Csete <oz9aec at gmail.com> * src/gtk-sat-map-c: - Leave 3px room between satellite label and amrker. + Added shadow under satellite markers and labels to improve visual + appearance on light background (e.g. South Pole). Added missing 3px room + between satellite label and marker. + * src/config-keys.h: + * src/sat-cfg.[ch]: + * src/sat-pref-map-view.c: + Added config parameter for shadow transparency on the GtkSatMap. + 2010-01-04 Alexandru Csete <oz9aec at gmail.com> * src/main.c: Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2010-01-05 14:04:39 UTC (rev 578) +++ trunk/NEWS 2010-01-05 16:34:32 UTC (rev 579) @@ -19,6 +19,8 @@ - Applied patch 2916646: Minor fixes to documentation (thanks to Paul Schulz). - Slightly improved UI for the single-satellite view. - Command line options for cleaning user's TLE and transponder data, see --help for list. +- Satellite Map: Added shadow to satellite marker and label to enhance visual appearance + over light background map regions. Changes in version 1.1 (5 Oct 2009) Modified: trunk/src/config-keys.h =================================================================== --- trunk/src/config-keys.h 2010-01-05 14:04:39 UTC (rev 578) +++ trunk/src/config-keys.h 2010-01-05 16:34:32 UTC (rev 579) @@ -102,6 +102,7 @@ #define MOD_CFG_MAP_TRACK_COL "TRACK_COLOUR" #define MOD_CFG_MAP_TRACK_NUM "TRACK_NUMBER" #define MOD_CFG_MAP_KEEP_RATIO "KEEP_RATIO" +#define MOD_CFG_MAP_SHADOW_ALPHA "SHADOW_ALPHA" /* polar view specific */ #define MOD_CFG_POLAR_SECTION "POLAR" Modified: trunk/src/gtk-sat-map.c =================================================================== --- trunk/src/gtk-sat-map.c 2010-01-05 14:04:39 UTC (rev 578) +++ trunk/src/gtk-sat-map.c 2010-01-05 16:34:32 UTC (rev 579) @@ -1633,7 +1633,7 @@ sat_t *sat = SAT(value); GooCanvasItemModel *root; gint *catnum; - guint32 col,covcol; + guint32 col,covcol,shadowcol; gfloat x,y; /* get satellite and SSP */ @@ -1664,16 +1664,27 @@ SAT_CFG_INT_MAP_SAT_COL); /* area coverage colour */ - /* if ((obj->showcov) && (sat->otype != ORBIT_TYPE_DECAYED)) { */ covcol = mod_cfg_get_int (satmap->cfgdata, MOD_CFG_MAP_SECTION, MOD_CFG_MAP_SAT_COV_COL, SAT_CFG_INT_MAP_SAT_COV_COL); - /* } */ - /* else { */ - /* covcol = 0x00000000; */ - /* } */ + /* shadow colour (only alpha channel) */ + shadowcol = mod_cfg_get_int (satmap->cfgdata, + MOD_CFG_MAP_SECTION, + MOD_CFG_MAP_SHADOW_ALPHA, + SAT_CFG_INT_MAP_SHADOW_ALPHA); + + + /* create satellite marker and label + shadows. We create shadows first */ + obj->shadowm = goo_canvas_rect_model_new (root, + x - MARKER_SIZE_HALF + 1, + y - MARKER_SIZE_HALF + 1, + 2 * MARKER_SIZE_HALF, + 2 * MARKER_SIZE_HALF, + "fill-color-rgba", 0x00, + "stroke-color-rgba", shadowcol, + NULL); obj->marker = goo_canvas_rect_model_new (root, x - MARKER_SIZE_HALF, y - MARKER_SIZE_HALF, @@ -1683,6 +1694,14 @@ "stroke-color-rgba", col, NULL); + obj->shadowl = goo_canvas_text_model_new (root, sat->nickname, + x+1, + y+3, + -1, + GTK_ANCHOR_NORTH, + "font", "Sans 8", + "fill-color-rgba", shadowcol, + NULL); obj->label = goo_canvas_text_model_new (root, sat->nickname, x, y+2, @@ -1692,6 +1711,7 @@ "fill-color-rgba", col, NULL); + g_object_set_data (G_OBJECT (obj->marker), "catnum", GINT_TO_POINTER (*catnum)); g_object_set_data (G_OBJECT (obj->label), "catnum", GINT_TO_POINTER (*catnum)); @@ -1803,6 +1823,10 @@ "x", (gdouble) (x - MARKER_SIZE_HALF), "y", (gdouble) (y - MARKER_SIZE_HALF), NULL); + g_object_set (obj->shadowm, + "x", (gdouble) (x - MARKER_SIZE_HALF + 1), + "y", (gdouble) (y - MARKER_SIZE_HALF + 1), + NULL); /* update sat label */ if (x < 50) { @@ -1811,24 +1835,44 @@ "y", (gdouble) (y), "anchor", GTK_ANCHOR_WEST, NULL); + g_object_set (obj->shadowl, + "x", (gdouble) (x+3+1), + "y", (gdouble) (y+1), + "anchor", GTK_ANCHOR_WEST, + NULL); } else if ((satmap->width - x ) < 50) { g_object_set (obj->label, "x", (gdouble) (x+3), "y", (gdouble) (y), "anchor", GTK_ANCHOR_EAST, NULL); + g_object_set (obj->shadowl, + "x", (gdouble) (x+3+1), + "y", (gdouble) (y+1), + "anchor", GTK_ANCHOR_EAST, + NULL); } else if ((satmap->height - y) < 25) { g_object_set (obj->label, "x", (gdouble) (x), "y", (gdouble) (y-2), "anchor", GTK_ANCHOR_SOUTH, NULL); + g_object_set (obj->shadowl, + "x", (gdouble) (x+1), + "y", (gdouble) (y-2+1), + "anchor", GTK_ANCHOR_SOUTH, + NULL); } else { g_object_set (obj->label, "x", (gdouble) (x), "y", (gdouble) (y+2), "anchor", GTK_ANCHOR_NORTH, NULL); + g_object_set (obj->shadowl, + "x", (gdouble) (x+1), + "y", (gdouble) (y+2+1), + "anchor", GTK_ANCHOR_NORTH, + NULL); } /* initialize points for footprint */ Modified: trunk/src/gtk-sat-map.h =================================================================== --- trunk/src/gtk-sat-map.h 2010-01-05 14:04:39 UTC (rev 578) +++ trunk/src/gtk-sat-map.h 2010-01-05 16:34:32 UTC (rev 579) @@ -91,7 +91,9 @@ /* graphical elements */ GooCanvasItemModel *marker; /*!< A small rectangle showing sat pos. */ + GooCanvasItemModel *shadowm; /*!< Shadow under satellite marker. */ GooCanvasItemModel *label; /*!< Satellite name. */ + GooCanvasItemModel *shadowl; /*!< Shadow under satellite name */ GooCanvasItemModel *range1; /*!< First part of the range circle. */ GooCanvasItemModel *range2; /*!< Second part of the range circle. */ Modified: trunk/src/gtk-sat-selector.c =================================================================== --- trunk/src/gtk-sat-selector.c 2010-01-05 14:04:39 UTC (rev 578) +++ trunk/src/gtk-sat-selector.c 2010-01-05 16:34:32 UTC (rev 579) @@ -294,7 +294,7 @@ gtk_tree_view_set_search_entry (GTK_TREE_VIEW (GTK_SAT_SELECTOR (widget)->tree), GTK_ENTRY (GTK_SAT_SELECTOR (widget)->search)); gtk_table_attach (GTK_TABLE (table), GTK_SAT_SELECTOR (widget)->search, 1, 4, 0, 1, - GTK_FILL, GTK_SHRINK, 0, 0); + GTK_SHRINK, GTK_SHRINK, 0, 0); /* Group selector */ gtk_table_attach (GTK_TABLE (table), gtk_label_new (_("Group")), 0, 1, 1, 2, Modified: trunk/src/sat-cfg.c =================================================================== --- trunk/src/sat-cfg.c 2010-01-05 14:04:39 UTC (rev 578) +++ trunk/src/sat-cfg.c 2010-01-05 16:34:32 UTC (rev 579) @@ -162,6 +162,7 @@ { "MODULES", "MAP_TICK_COLOUR", 0x7F7F7FC8}, { "MODULES", "MAP_TRACK_COLOUR", 0x00FFFFFF}, { "MODULES", "MAP_TRACK_NUM", 1}, + { "MODULES", "MAP_SHADOW_ALPHA", 0xDD}, { "MODULES", "POLAR_REFRESH", 3}, { "MODULES", "POLAR_CHART_ORIENT", POLAR_VIEW_NESW}, { "MODULES", "POLAR_BGD_COLOUR", 0xFFFFFFFF}, Modified: trunk/src/sat-cfg.h =================================================================== --- trunk/src/sat-cfg.h 2010-01-05 14:04:39 UTC (rev 578) +++ trunk/src/sat-cfg.h 2010-01-05 16:34:32 UTC (rev 579) @@ -84,6 +84,7 @@ SAT_CFG_INT_MAP_TICK_COL, /*!< Tick labels colour. */ SAT_CFG_INT_MAP_TRACK_COL, /*!< Ground Track colour. */ SAT_CFG_INT_MAP_TRACK_NUM, /*!< Number of orbits to show ground track for */ + SAT_CFG_INT_MAP_SHADOW_ALPHA, /*!< Tranparency of shadow under satellite marker. */ SAT_CFG_INT_POLAR_REFRESH, /*!< Polar refresh rate (cycle). */ SAT_CFG_INT_POLAR_ORIENTATION, /*!< Orientation of the polar charts. */ SAT_CFG_INT_POLAR_BGD_COL, /*!< Polar view, background colour. */ Modified: trunk/src/sat-pref-map-view.c =================================================================== --- trunk/src/sat-pref-map-view.c 2010-01-05 14:04:39 UTC (rev 578) +++ trunk/src/sat-pref-map-view.c 2010-01-05 16:34:32 UTC (rev 579) @@ -11,7 +11,7 @@ More details can be found at the project home page: http://gpredict.oz9aec.net/ - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or @@ -51,6 +51,7 @@ static GtkWidget *qthc,*gridc,*tickc; static GtkWidget *satc,*ssatc,*trackc; static GtkWidget *covc,*infofg,*infobg; +static GtkWidget *shadow; /* ground track orbit number selector */ static GtkWidget *orbit; @@ -74,7 +75,10 @@ static void select_map_cb (GtkWidget *button, gpointer data); static void update_map_icon (void); +static gboolean shadow_changed (GtkRange *range, GtkScrollType scroll, gdouble value, gpointer data); + + /** \brief Create and initialise widgets for the map preferences tab. * * The widgets must be preloaded with values from config. If a config value @@ -83,109 +87,108 @@ */ GtkWidget *sat_pref_map_view_create (GKeyFile *cfg) { - GtkWidget *vbox; + GtkWidget *vbox; - /* create vertical box */ - vbox = gtk_vbox_new (FALSE, 2); // !!! - gtk_container_set_border_width (GTK_CONTAINER (vbox), 20); + /* create vertical box */ + vbox = gtk_vbox_new (FALSE, 2); // !!! + gtk_container_set_border_width (GTK_CONTAINER (vbox), 20); - /* create the components */ - create_map_selector (cfg, GTK_BOX (vbox)); - gtk_box_pack_start (GTK_BOX (vbox), gtk_hseparator_new (), FALSE, TRUE, 10); - create_bool_selectors (cfg, GTK_BOX (vbox)); - gtk_box_pack_start (GTK_BOX (vbox), gtk_hseparator_new (), FALSE, TRUE, 10); - create_colour_selectors (cfg, GTK_BOX (vbox)); - gtk_box_pack_start (GTK_BOX (vbox), gtk_hseparator_new (), FALSE, TRUE, 10); - create_orbit_selector (cfg, GTK_BOX (vbox)); - gtk_box_pack_start (GTK_BOX (vbox), gtk_hseparator_new (), FALSE, TRUE, 10); - create_reset_button (cfg, GTK_BOX (vbox)); + /* create the components */ + create_map_selector (cfg, GTK_BOX (vbox)); + gtk_box_pack_start (GTK_BOX (vbox), gtk_hseparator_new (), FALSE, TRUE, 10); + create_bool_selectors (cfg, GTK_BOX (vbox)); + gtk_box_pack_start (GTK_BOX (vbox), gtk_hseparator_new (), FALSE, TRUE, 10); + create_colour_selectors (cfg, GTK_BOX (vbox)); + gtk_box_pack_start (GTK_BOX (vbox), gtk_hseparator_new (), FALSE, TRUE, 10); + create_orbit_selector (cfg, GTK_BOX (vbox)); + gtk_box_pack_start (GTK_BOX (vbox), gtk_hseparator_new (), FALSE, TRUE, 10); + create_reset_button (cfg, GTK_BOX (vbox)); - reset = FALSE; - dirty = FALSE; + reset = FALSE; + dirty = FALSE; - return vbox; + return vbox; } /** \brief Create map selector widget. */ -static void -create_map_selector (GKeyFile *cfg, GtkBox *vbox) +static void create_map_selector (GKeyFile *cfg, GtkBox *vbox) { - GtkWidget *button; - GtkWidget *label; - GtkWidget *table; - gchar *mapfile; - GdkPixbuf *obuf,*sbuf; - GtkTooltips *tips; + GtkWidget *button; + GtkWidget *label; + GtkWidget *table; + gchar *mapfile; + GdkPixbuf *obuf,*sbuf; + GtkTooltips *tips; - /* create header */ - label = gtk_label_new (NULL); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_label_set_markup (GTK_LABEL (label), - _("<b>Background Map:</b>")); - gtk_box_pack_start (vbox, label, FALSE, TRUE, 0); + /* create header */ + label = gtk_label_new (NULL); + gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); + gtk_label_set_markup (GTK_LABEL (label), + _("<b>Background Map:</b>")); + gtk_box_pack_start (vbox, label, FALSE, TRUE, 0); - /* create a table to pu the map preview and select button in. + /* create a table to pu the map preview and select button in. using a simple hbox won't do it because the button would have the same height as the map preview */ - table = gtk_table_new (3, 2, TRUE); - gtk_box_pack_start (vbox, table, FALSE, FALSE, 0); + table = gtk_table_new (3, 2, TRUE); + gtk_box_pack_start (vbox, table, FALSE, FALSE, 0); - /* load map file into a pixbuf */ - if (cfg != NULL) { - mapf = mod_cfg_get_str (cfg, - MOD_CFG_MAP_SECTION, - MOD_CFG_MAP_FILE, - SAT_CFG_STR_MAP_FILE); - } - else { - mapf = sat_cfg_get_str (SAT_CFG_STR_MAP_FILE); - } - if (g_path_is_absolute (mapf)) { + /* load map file into a pixbuf */ + if (cfg != NULL) { + mapf = mod_cfg_get_str (cfg, + MOD_CFG_MAP_SECTION, + MOD_CFG_MAP_FILE, + SAT_CFG_STR_MAP_FILE); + } + else { + mapf = sat_cfg_get_str (SAT_CFG_STR_MAP_FILE); + } + if (g_path_is_absolute (mapf)) { /* map is user specific, ie. in USER_CONF_DIR/maps/ */ - mapfile = g_strdup (mapf); - } - else { - /* build complete path */ - mapfile = map_file_name (mapf); - } - obuf = gdk_pixbuf_new_from_file (mapfile, NULL); - g_free (mapfile); + mapfile = g_strdup (mapf); + } + else { + /* build complete path */ + mapfile = map_file_name (mapf); + } + obuf = gdk_pixbuf_new_from_file (mapfile, NULL); + g_free (mapfile); - if (obuf != NULL) { + if (obuf != NULL) { - /* scale the pixbuf */ - sbuf = gdk_pixbuf_scale_simple (obuf, 100, 50, GDK_INTERP_HYPER); - g_object_unref (obuf); + /* scale the pixbuf */ + sbuf = gdk_pixbuf_scale_simple (obuf, 100, 50, GDK_INTERP_HYPER); + g_object_unref (obuf); - /* create a GtkImage from the pixbuf */ - thumb = gtk_image_new_from_pixbuf (sbuf); - g_object_unref (sbuf); - } - else { - thumb = gtk_image_new_from_stock (GTK_STOCK_MISSING_IMAGE, - GTK_ICON_SIZE_LARGE_TOOLBAR); - } + /* create a GtkImage from the pixbuf */ + thumb = gtk_image_new_from_pixbuf (sbuf); + g_object_unref (sbuf); + } + else { + thumb = gtk_image_new_from_stock (GTK_STOCK_MISSING_IMAGE, + GTK_ICON_SIZE_LARGE_TOOLBAR); + } - gtk_table_attach (GTK_TABLE (table), thumb, 0, 1, 0, 3, - GTK_FILL, GTK_FILL, 0, 0); + gtk_table_attach (GTK_TABLE (table), thumb, 0, 1, 0, 3, + GTK_FILL, GTK_FILL, 0, 0); - /* select button */ - button = gtk_button_new_with_label (_("Select map")); - tips = gtk_tooltips_new (); - gtk_tooltips_set_tip (tips, button, - _("Click to select a map"), NULL); - g_signal_connect (G_OBJECT (button), "clicked", - G_CALLBACK (select_map_cb), NULL); - gtk_table_attach (GTK_TABLE (table), button, 1, 2, 1, 2, - GTK_FILL, GTK_FILL, 10, 0); + /* select button */ + button = gtk_button_new_with_label (_("Select map")); + tips = gtk_tooltips_new (); + gtk_tooltips_set_tip (tips, button, + _("Click to select a map"), NULL); + g_signal_connect (G_OBJECT (button), "clicked", + G_CALLBACK (select_map_cb), NULL); + gtk_table_attach (GTK_TABLE (table), button, 1, 2, 1, 2, + GTK_FILL, GTK_FILL, 10, 0); - + } @@ -198,105 +201,104 @@ * the satellites, should be drawn on the polar view. Choices are QTH info, next * event, cursor coordinates, and extra tick marks. */ -static void -create_bool_selectors (GKeyFile *cfg, GtkBox *vbox) +static void create_bool_selectors (GKeyFile *cfg, GtkBox *vbox) { - GtkWidget *label; - GtkTooltips *tips; - GtkWidget *hbox; + GtkWidget *label; + GtkTooltips *tips; + GtkWidget *hbox; - /* create header */ - label = gtk_label_new (NULL); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_label_set_markup (GTK_LABEL (label), - _("<b>Extra Contents:</b>")); - gtk_box_pack_start (vbox, label, FALSE, TRUE, 0); + /* create header */ + label = gtk_label_new (NULL); + gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); + gtk_label_set_markup (GTK_LABEL (label), + _("<b>Extra Contents:</b>")); + gtk_box_pack_start (vbox, label, FALSE, TRUE, 0); - /* horizontal box to contain the radio buttons */ - hbox = gtk_hbox_new (TRUE, 10); - gtk_box_pack_start (vbox, hbox, FALSE, TRUE, 0); + /* horizontal box to contain the radio buttons */ + hbox = gtk_hbox_new (TRUE, 10); + gtk_box_pack_start (vbox, hbox, FALSE, TRUE, 0); - /* QTH info */ - qth = gtk_check_button_new_with_label (_("QTH Info")); - tips = gtk_tooltips_new (); - gtk_tooltips_set_tip (tips, qth, - _("Show location information on the map"), - NULL); - if (cfg != NULL) { - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (qth), - mod_cfg_get_bool (cfg, - MOD_CFG_MAP_SECTION, - MOD_CFG_MAP_SHOW_QTH_INFO, - SAT_CFG_BOOL_MAP_SHOW_QTH_INFO)); - } - else { - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (qth), - sat_cfg_get_bool (SAT_CFG_BOOL_MAP_SHOW_QTH_INFO)); - } - g_signal_connect (qth, "toggled", G_CALLBACK (content_changed), NULL); - gtk_box_pack_start (GTK_BOX (hbox), qth, FALSE, TRUE, 0); + /* QTH info */ + qth = gtk_check_button_new_with_label (_("QTH Info")); + tips = gtk_tooltips_new (); + gtk_tooltips_set_tip (tips, qth, + _("Show location information on the map"), + NULL); + if (cfg != NULL) { + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (qth), + mod_cfg_get_bool (cfg, + MOD_CFG_MAP_SECTION, + MOD_CFG_MAP_SHOW_QTH_INFO, + SAT_CFG_BOOL_MAP_SHOW_QTH_INFO)); + } + else { + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (qth), + sat_cfg_get_bool (SAT_CFG_BOOL_MAP_SHOW_QTH_INFO)); + } + g_signal_connect (qth, "toggled", G_CALLBACK (content_changed), NULL); + gtk_box_pack_start (GTK_BOX (hbox), qth, FALSE, TRUE, 0); - /* Next Event */ - next = gtk_check_button_new_with_label (_("Next Event")); - tips = gtk_tooltips_new (); - gtk_tooltips_set_tip (tips, next, - _("Show which satellite comes up next and at what time"), - NULL); - if (cfg != NULL) { - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (next), - mod_cfg_get_bool (cfg, - MOD_CFG_MAP_SECTION, - MOD_CFG_MAP_SHOW_NEXT_EVENT, - SAT_CFG_BOOL_MAP_SHOW_NEXT_EV)); - } - else { - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (next), - sat_cfg_get_bool (SAT_CFG_BOOL_MAP_SHOW_NEXT_EV)); - } - g_signal_connect (next, "toggled", G_CALLBACK (content_changed), NULL); - gtk_box_pack_start (GTK_BOX (hbox), next, FALSE, TRUE, 0); + /* Next Event */ + next = gtk_check_button_new_with_label (_("Next Event")); + tips = gtk_tooltips_new (); + gtk_tooltips_set_tip (tips, next, + _("Show which satellite comes up next and at what time"), + NULL); + if (cfg != NULL) { + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (next), + mod_cfg_get_bool (cfg, + MOD_CFG_MAP_SECTION, + MOD_CFG_MAP_SHOW_NEXT_EVENT, + SAT_CFG_BOOL_MAP_SHOW_NEXT_EV)); + } + else { + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (next), + sat_cfg_get_bool (SAT_CFG_BOOL_MAP_SHOW_NEXT_EV)); + } + g_signal_connect (next, "toggled", G_CALLBACK (content_changed), NULL); + gtk_box_pack_start (GTK_BOX (hbox), next, FALSE, TRUE, 0); - /* Cursor position */ - curs = gtk_check_button_new_with_label (_("Cursor Position")); - tips = gtk_tooltips_new (); - gtk_tooltips_set_tip (tips, curs, - _("Show the latitude and longitude of the mouse pointer"), - NULL); - if (cfg != NULL) { - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (curs), - mod_cfg_get_bool (cfg, - MOD_CFG_MAP_SECTION, - MOD_CFG_MAP_SHOW_CURS_TRACK, - SAT_CFG_BOOL_MAP_SHOW_CURS_TRACK)); - } - else { - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (curs), - sat_cfg_get_bool (SAT_CFG_BOOL_MAP_SHOW_CURS_TRACK)); - } - g_signal_connect (curs, "toggled", G_CALLBACK (content_changed), NULL); - gtk_box_pack_start (GTK_BOX (hbox), curs, FALSE, TRUE, 0); + /* Cursor position */ + curs = gtk_check_button_new_with_label (_("Cursor Position")); + tips = gtk_tooltips_new (); + gtk_tooltips_set_tip (tips, curs, + _("Show the latitude and longitude of the mouse pointer"), + NULL); + if (cfg != NULL) { + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (curs), + mod_cfg_get_bool (cfg, + MOD_CFG_MAP_SECTION, + MOD_CFG_MAP_SHOW_CURS_TRACK, + SAT_CFG_BOOL_MAP_SHOW_CURS_TRACK)); + } + else { + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (curs), + sat_cfg_get_bool (SAT_CFG_BOOL_MAP_SHOW_CURS_TRACK)); + } + g_signal_connect (curs, "toggled", G_CALLBACK (content_changed), NULL); + gtk_box_pack_start (GTK_BOX (hbox), curs, FALSE, TRUE, 0); - /* Grid */ - grid = gtk_check_button_new_with_label (_("Grid Lines")); - tips = gtk_tooltips_new (); - gtk_tooltips_set_tip (tips, grid, - _("Show horizontal and vertical grid lines"), - NULL); - if (cfg != NULL) { - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (grid), - mod_cfg_get_bool (cfg, - MOD_CFG_MAP_SECTION, - MOD_CFG_MAP_SHOW_GRID, - SAT_CFG_BOOL_MAP_SHOW_GRID)); - } - else { - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (grid), - sat_cfg_get_bool (SAT_CFG_BOOL_MAP_SHOW_GRID)); - } - g_signal_connect (grid, "toggled", G_CALLBACK (content_changed), NULL); - gtk_box_pack_start (GTK_BOX (hbox), grid, FALSE, TRUE, 0); + /* Grid */ + grid = gtk_check_button_new_with_label (_("Grid Lines")); + tips = gtk_tooltips_new (); + gtk_tooltips_set_tip (tips, grid, + _("Show horizontal and vertical grid lines"), + NULL); + if (cfg != NULL) { + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (grid), + mod_cfg_get_bool (cfg, + MOD_CFG_MAP_SECTION, + MOD_CFG_MAP_SHOW_GRID, + SAT_CFG_BOOL_MAP_SHOW_GRID)); + } + else { + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (grid), + sat_cfg_get_bool (SAT_CFG_BOOL_MAP_SHOW_GRID)); + } + g_signal_connect (grid, "toggled", G_CALLBACK (content_changed), NULL); + gtk_box_pack_start (GTK_BOX (hbox), grid, FALSE, TRUE, 0); } @@ -308,276 +310,310 @@ * This function creates the widgets for selecting colours for the plot background, * axes, tick labels, satellites, track, and info text. */ -static void -create_colour_selectors (GKeyFile *cfg, GtkBox *vbox) +static void create_colour_selectors (GKeyFile *cfg, GtkBox *vbox) { - GtkWidget *label; - GtkTooltips *tips; - GtkWidget *table; - guint rgba; /* RRGGBBAA encoded colour */ - guint16 alpha; /* alpha channel 16 bits */ - GdkColor col; /* GdkColor colour representation */ + GtkWidget *label; + GtkTooltips *tips; + GtkWidget *table; + guint rgba; /* RRGGBBAA encoded colour */ + guint16 alpha; /* alpha channel 16 bits */ + GdkColor col; /* GdkColor colour representation */ - /* create header */ - label = gtk_label_new (NULL); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_label_set_markup (GTK_LABEL (label), - _("<b>Colours:</b>")); - gtk_box_pack_start (vbox, label, FALSE, TRUE, 0); + /* create header */ + label = gtk_label_new (NULL); + gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); + gtk_label_set_markup (GTK_LABEL (label), _("<b>Colours:</b>")); + gtk_box_pack_start (vbox, label, FALSE, TRUE, 0); - /* horizontal box to contain the radio buttons */ - table = gtk_table_new (3, 6, TRUE); - gtk_table_set_col_spacings (GTK_TABLE (table), 10); - gtk_table_set_row_spacings (GTK_TABLE (table), 3); - gtk_box_pack_start (vbox, table, FALSE, TRUE, 0); + /* container */ + table = gtk_table_new (4, 6, TRUE); + gtk_table_set_col_spacings (GTK_TABLE (table), 10); + gtk_table_set_row_spacings (GTK_TABLE (table), 3); + gtk_box_pack_start (vbox, table, FALSE, TRUE, 0); - /* background */ - label = gtk_label_new (_("Ground Station:")); - gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); - gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, - GTK_FILL, GTK_FILL, 0, 0); - qthc = gtk_color_button_new (); - gtk_color_button_set_use_alpha (GTK_COLOR_BUTTON (qthc), TRUE); - gtk_table_attach (GTK_TABLE (table), qthc, 1, 2, 0, 1, - GTK_FILL , GTK_FILL, 0, 0); - tips = gtk_tooltips_new (); - gtk_tooltips_set_tip (tips, qthc, - _("Click to select a colour"), - NULL); - if (cfg != NULL) { - rgba = mod_cfg_get_int (cfg, - MOD_CFG_MAP_SECTION, - MOD_CFG_MAP_QTH_COL, - SAT_CFG_INT_MAP_QTH_COL); - } - else { - rgba = sat_cfg_get_int (SAT_CFG_INT_MAP_QTH_COL); - } - rgba2gdk (rgba, &col, &alpha); - gtk_color_button_set_color (GTK_COLOR_BUTTON (qthc), &col); - gtk_color_button_set_alpha (GTK_COLOR_BUTTON (qthc), alpha); - g_signal_connect (qthc, "color-set", G_CALLBACK (colour_changed), NULL); + /* background */ + label = gtk_label_new (_("Ground Station:")); + gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); + gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, + GTK_FILL, GTK_FILL, 0, 0); + qthc = gtk_color_button_new (); + gtk_color_button_set_use_alpha (GTK_COLOR_BUTTON (qthc), TRUE); + gtk_table_attach (GTK_TABLE (table), qthc, 1, 2, 0, 1, + GTK_FILL , GTK_FILL, 0, 0); + tips = gtk_tooltips_new (); + gtk_tooltips_set_tip (tips, qthc, + _("Click to select a colour"), + NULL); + if (cfg != NULL) { + rgba = mod_cfg_get_int (cfg, + MOD_CFG_MAP_SECTION, + MOD_CFG_MAP_QTH_COL, + SAT_CFG_INT_MAP_QTH_COL); + } + else { + rgba = sat_cfg_get_int (SAT_CFG_INT_MAP_QTH_COL); + } + rgba2gdk (rgba, &col, &alpha); + gtk_color_button_set_color (GTK_COLOR_BUTTON (qthc), &col); + gtk_color_button_set_alpha (GTK_COLOR_BUTTON (qthc), alpha); + g_signal_connect (qthc, "color-set", G_CALLBACK (colour_changed), NULL); - /* Grid in case it is enabled */ - label = gtk_label_new (_("Grid:")); - gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); - gtk_table_attach (GTK_TABLE (table), label, 2, 3, 0, 1, - GTK_FILL, GTK_FILL, 0, 0); - gridc = gtk_color_button_new (); - gtk_color_button_set_use_alpha (GTK_COLOR_BUTTON (gridc), TRUE); - gtk_table_attach (GTK_TABLE (table), gridc, 3, 4, 0, 1, - GTK_FILL , GTK_FILL, 0, 0); - tips = gtk_tooltips_new (); - gtk_tooltips_set_tip (tips, gridc, - _("Click to select the grid colour"), - NULL); - if (cfg != NULL) { - rgba = mod_cfg_get_int (cfg, - MOD_CFG_MAP_SECTION, - MOD_CFG_MAP_GRID_COL, - SAT_CFG_INT_MAP_GRID_COL); - } - else { - rgba = sat_cfg_get_int (SAT_CFG_INT_MAP_GRID_COL); - } - rgba2gdk (rgba, &col, &alpha); - gtk_color_button_set_color (GTK_COLOR_BUTTON (gridc), &col); - gtk_color_button_set_alpha (GTK_COLOR_BUTTON (gridc), alpha); - g_signal_connect (gridc, "color-set", G_CALLBACK (colour_changed), NULL); + /* Grid in case it is enabled */ + label = gtk_label_new (_("Grid:")); + gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); + gtk_table_attach (GTK_TABLE (table), label, 2, 3, 0, 1, + GTK_FILL, GTK_FILL, 0, 0); + gridc = gtk_color_button_new (); + gtk_color_button_set_use_alpha (GTK_COLOR_BUTTON (gridc), TRUE); + gtk_table_attach (GTK_TABLE (table), gridc, 3, 4, 0, 1, + GTK_FILL , GTK_FILL, 0, 0); + tips = gtk_tooltips_new (); + gtk_tooltips_set_tip (tips, gridc, + _("Click to select the grid colour"), + NULL); + if (cfg != NULL) { + rgba = mod_cfg_get_int (cfg, + MOD_CFG_MAP_SECTION, + MOD_CFG_MAP_GRID_COL, + SAT_CFG_INT_MAP_GRID_COL); + } + else { + rgba = sat_cfg_get_int (SAT_CFG_INT_MAP_GRID_COL); + } + rgba2gdk (rgba, &col, &alpha); + gtk_color_button_set_color (GTK_COLOR_BUTTON (gridc), &col); + gtk_color_button_set_alpha (GTK_COLOR_BUTTON (gridc), alpha); + g_signal_connect (gridc, "color-set", G_CALLBACK (colour_changed), NULL); - /* tick labels */ - label = gtk_label_new (_("Tick Labels:")); - gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); - gtk_table_attach (GTK_TABLE (table), label, 4, 5, 0, 1, - GTK_FILL, GTK_FILL, 0, 0); - tickc = gtk_color_button_new (); - gtk_color_button_set_use_alpha (GTK_COLOR_BUTTON (tickc), TRUE); - gtk_table_attach (GTK_TABLE (table), tickc, 5, 6, 0, 1, - GTK_FILL , GTK_FILL, 0, 0); - tips = gtk_tooltips_new (); - gtk_tooltips_set_tip (tips, tickc, - _("Click to select the colour for tick labels"), - NULL); - if (cfg != NULL) { - rgba = mod_cfg_get_int (cfg, - MOD_CFG_MAP_SECTION, - MOD_CFG_MAP_TICK_COL, - SAT_CFG_INT_MAP_TICK_COL); - } - else { - rgba = sat_cfg_get_int (SAT_CFG_INT_MAP_TICK_COL); - } - rgba2gdk (rgba, &col, &alpha); - gtk_color_button_set_color (GTK_COLOR_BUTTON (tickc), &col); - gtk_color_button_set_alpha (GTK_COLOR_BUTTON (tickc), alpha); - g_signal_connect (tickc, "color-set", G_CALLBACK (colour_changed), NULL); + /* tick labels */ + label = gtk_label_new (_("Tick Labels:")); + gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); + gtk_table_attach (GTK_TABLE (table), label, 4, 5, 0, 1, + GTK_FILL, GTK_FILL, 0, 0); + tickc = gtk_color_button_new (); + gtk_color_button_set_use_alpha (GTK_COLOR_BUTTON (tickc), TRUE); + gtk_table_attach (GTK_TABLE (table), tickc, 5, 6, 0, 1, + GTK_FILL , GTK_FILL, 0, 0); + tips = gtk_tooltips_new (); + gtk_tooltips_set_tip (tips, tickc, + _("Click to select the colour for tick labels"), + NULL); + if (cfg != NULL) { + rgba = mod_cfg_get_int (cfg, + MOD_CFG_MAP_SECTION, + MOD_CFG_MAP_TICK_COL, + SAT_CFG_INT_MAP_TICK_COL); + } + else { + rgba = sat_cfg_get_int (SAT_CFG_INT_MAP_TICK_COL); + } + rgba2gdk (rgba, &col, &alpha); + gtk_color_button_set_color (GTK_COLOR_BUTTON (tickc), &col); + gtk_color_button_set_alpha (GTK_COLOR_BUTTON (tickc), alpha); + g_signal_connect (tickc, "color-set", G_CALLBACK (colour_changed), NULL); - /* satellite */ - label = gtk_label_new (_("Satellite:")); - gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); - gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2, - GTK_FILL, GTK_FILL, 0, 0); - satc = gtk_color_button_new (); - gtk_color_button_set_use_alpha (GTK_COLOR_BUTTON (satc), TRUE); - gtk_table_attach (GTK_TABLE (table), satc, 1, 2, 1, 2, - GTK_FILL , GTK_FILL, 0, 0); - tips = gtk_tooltips_new (); - gtk_tooltips_set_tip (tips, satc, - _("Click to select satellite colour"), - NULL); - if (cfg != NULL) { - rgba = mod_cfg_get_int (cfg, - MOD_CFG_MAP_SECTION, - MOD_CFG_MAP_SAT_COL, - SAT_CFG_INT_MAP_SAT_COL); - } - else { - rgba = sat_cfg_get_int (SAT_CFG_INT_MAP_SAT_COL); - } - rgba2gdk (rgba, &col, &alpha); - gtk_color_button_set_color (GTK_COLOR_BUTTON (satc), &col); - gtk_color_button_set_alpha (GTK_COLOR_BUTTON (satc), alpha); - g_signal_connect (satc, "color-set", G_CALLBACK (colour_changed), NULL); + /* satellite */ + label = gtk_label_new (_("Satellite:")); + gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); + gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2, + GTK_FILL, GTK_FILL, 0, 0); + satc = gtk_color_button_new (); + gtk_color_button_set_use_alpha (GTK_COLOR_BUTTON (satc), TRUE); + gtk_table_attach (GTK_TABLE (table), satc, 1, 2, 1, 2, + GTK_FILL , GTK_FILL, 0, 0); + tips = gtk_tooltips_new (); + gtk_tooltips_set_tip (tips, satc, + _("Click to select satellite colour"), + NULL); + if (cfg != NULL) { + rgba = mod_cfg_get_int (cfg, + MOD_CFG_MAP_SECTION, + MOD_CFG_MAP_SAT_COL, + SAT_CFG_INT_MAP_SAT_COL); + } + else { + rgba = sat_cfg_get_int (SAT_CFG_INT_MAP_SAT_COL); + } + rgba2gdk (rgba, &col, &alpha); + gtk_color_button_set_color (GTK_COLOR_BUTTON (satc), &col); + gtk_color_button_set_alpha (GTK_COLOR_BUTTON (satc), alpha); + g_signal_connect (satc, "color-set", G_CALLBACK (colour_changed), NULL); - /* selected satellite */ - label = gtk_label_new (_("Selected Sat.:")); - gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); - gtk_table_attach (GTK_TABLE (table), label, 2, 3, 1, 2, - GTK_FILL, GTK_FILL, 0, 0); - ssatc = gtk_color_button_new (); - gtk_color_button_set_use_alpha (GTK_COLOR_BUTTON (ssatc), TRUE); - gtk_table_attach (GTK_TABLE (table), ssatc, 3, 4, 1, 2, - GTK_FILL , GTK_FILL, 0, 0); - tips = gtk_tooltips_new (); - gtk_tooltips_set_tip (tips, ssatc, - _("Click to select colour for selected satellites"), - NULL); - if (cfg != NULL) { - rgba = mod_cfg_get_int (cfg, - MOD_CFG_MAP_SECTION, - MOD_CFG_MAP_SAT_SEL_COL, - SAT_CFG_INT_MAP_SAT_SEL_COL); - } - else { - rgba = sat_cfg_get_int (SAT_CFG_INT_MAP_SAT_SEL_COL); - } - rgba2gdk (rgba, &col, &alpha); - gtk_color_button_set_color (GTK_COLOR_BUTTON (ssatc), &col); - gtk_color_button_set_alpha (GTK_COLOR_BUTTON (ssatc), alpha); - g_signal_connect (ssatc, "color-set", G_CALLBACK (colour_changed), NULL); + /* selected satellite */ + label = gtk_label_new (_("Selected Sat.:")); + gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); + gtk_table_attach (GTK_TABLE (table), label, 2, 3, 1, 2, + GTK_FILL, GTK_FILL, 0, 0); + ssatc = gtk_color_button_new (); + gtk_color_button_set_use_alpha (GTK_COLOR_BUTTON (ssatc), TRUE); + gtk_table_attach (GTK_TABLE (table), ssatc, 3, 4, 1, 2, + GTK_FILL , GTK_FILL, 0, 0); + tips = gtk_tooltips_new (); + gtk_tooltips_set_tip (tips, ssatc, + _("Click to select colour for selected satellites"), + NULL); + if (cfg != NULL) { + rgba = mod_cfg_get_int (cfg, + MOD_CFG_MAP_SECTION, + MOD_CFG_MAP_SAT_SEL_COL, + SAT_CFG_INT_MAP_SAT_SEL_COL); + } + else { + rgba = sat_cfg_get_int (SAT_CFG_INT_MAP_SAT_SEL_COL); + } + rgba2gdk (rgba, &col, &alpha); + gtk_color_button_set_color (GTK_COLOR_BUTTON (ssatc), &col); + gtk_color_button_set_alpha (GTK_COLOR_BUTTON (ssatc), alpha); + g_signal_connect (ssatc, "color-set", G_CALLBACK (colour_changed), NULL); - /* tack */ - label = gtk_label_new (_("Ground Track:")); - gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); - gtk_table_attach (GTK_TABLE (table), label, 4, 5, 1, 2, - GTK_FILL, GTK_FILL, 0, 0); - trackc = gtk_color_button_new (); - gtk_color_button_set_use_alpha (GTK_COLOR_BUTTON (trackc), TRUE); - gtk_table_attach (GTK_TABLE (table), trackc, 5, 6, 1, 2, - GTK_FILL , GTK_FILL, 0, 0); - tips = gtk_tooltips_new (); - gtk_tooltips_set_tip (tips, trackc, - _("Click to select ground track colour"), - NULL); - if (cfg != NULL) { - rgba = mod_cfg_get_int (cfg, - MOD_CFG_MAP_SECTION, - MOD_CFG_MAP_TRACK_COL, - SAT_CFG_INT_MAP_TRACK_COL); - } - else { - rgba = sat_cfg_get_int (SAT_CFG_INT_MAP_TRACK_COL); - } - rgba2gdk (rgba, &col, &alpha); - gtk_color_button_set_color (GTK_COLOR_BUTTON (trackc), &col); - gtk_color_button_set_alpha (GTK_COLOR_BUTTON (trackc), alpha); - g_signal_connect (trackc, "color-set", G_CALLBACK (colour_changed), NULL); + /* tack */ + label = gtk_label_new (_("Ground Track:")); + gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); + gtk_table_attach (GTK_TABLE (table), label, 4, 5, 1, 2, + GTK_FILL, GTK_FILL, 0, 0); + trackc = gtk_color_button_new (); + gtk_color_button_set_use_alpha (GTK_COLOR_BUTTON (trackc), TRUE); + gtk_table_attach (GTK_TABLE (table), trackc, 5, 6, 1, 2, + GTK_FILL , GTK_FILL, 0, 0); + tips = gtk_tooltips_new (); + gtk_tooltips_set_tip (tips, trackc, + _("Click to select ground track colour"), + NULL); + if (cfg != NULL) { + rgba = mod_cfg_get_int (cfg, + MOD_CFG_MAP_SECTION, + MOD_CFG_MAP_TRACK_COL, + SAT_CFG_INT_MAP_TRACK_COL); + } + else { + rgba = sat_cfg_get_int (SAT_CFG_INT_MAP_TRACK_COL); + } + rgba2gdk (rgba, &col, &alpha); + gtk_color_button_set_color (GTK_COLOR_BUTTON (trackc), &col); + gtk_color_button_set_alpha (GTK_COLOR_BUTTON (trackc), alpha); + g_signal_connect (trackc, "color-set", G_CALLBACK (colour_changed), NULL); - /* coverage */ - label = gtk_label_new (_("Area Coverage:")); - gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); - gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3, - GTK_FILL, GTK_FILL, 0, 0); - covc = gtk_color_button_new (); - gtk_color_button_set_use_alpha (GTK_COLOR_BUTTON (covc), TRUE); - gtk_table_attach (GTK_TABLE (table), covc, 1, 2, 2, 3, - GTK_FILL , GTK_FILL, 0, 0); - tips = gtk_tooltips_new (); - gtk_tooltips_set_tip (tips, covc, - _("Colour for coverage Area (make it transparent)"), - NULL); - if (cfg != NULL) { - rgba = mod_cfg_get_int (cfg, - MOD_CFG_MAP_SECTION, - MOD_CFG_MAP_SAT_COV_COL, - SAT_CFG_INT_MAP_SAT_COV_COL); - } - else { - rgba = sat_cfg_get_int (SAT_CFG_INT_MAP_SAT_COV_COL); - } - rgba2gdk (rgba, &col, &alpha); - gtk_color_button_set_color (GTK_COLOR_BUTTON (covc), &col); - gtk_color_button_set_alpha (GTK_COLOR_BUTTON (covc), alpha); - g_signal_connect (covc, "color-set", G_CALLBACK (colour_changed), NULL); + /* coverage */ + label = gtk_label_new (_("Area Coverage:")); + gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); + gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3, + GTK_FILL, GTK_FILL, 0, 0); + covc = gtk_color_button_new (); + gtk_color_button_set_use_alpha (GTK_COLOR_BUTTON (covc), TRUE); + gtk_table_attach (GTK_TABLE (table), covc, 1, 2, 2, 3, + GTK_FILL , GTK_FILL, 0, 0); + tips = gtk_tooltips_new (); + gtk_tooltips_set_tip (tips, covc, + _("Colour for coverage Area (make it transparent)"), + NULL); + if (cfg != NULL) { + rgba = mod_cfg_get_int (cfg, + MOD_CFG_MAP_SECTION, + MOD_CFG_MAP_SAT_COV_COL, + SAT_CFG_INT_MAP_SAT_COV_COL); + } + else { + rgba = sat_cfg_get_int (SAT_CFG_INT_MAP_SAT_COV_COL); + } + rgba2gdk (rgba, &col, &alpha); + gtk_color_button_set_color (GTK_COLOR_BUTTON (covc), &col); + gtk_color_button_set_alpha (GTK_COLOR_BUTTON (covc), alpha); + g_signal_connect (covc, "color-set", G_CALLBACK (colour_changed), NULL); - /* Info foreground */ - label = gtk_label_new (_("Info Text FG:")); - gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); - gtk_table_attach (GTK_TABLE (table), label, 2, 3, 2, 3, - GTK_FILL, GTK_FILL, 0, 0); - infofg = gtk_color_button_new (); - gtk_color_button_set_use_alpha (GTK_COLOR_BUTTON (infofg), TRUE); - gtk_table_attach (GTK_TABLE (table), infofg, 3, 4, 2, 3, - GTK_FILL , GTK_FILL, 0, 0); - tips = gtk_tooltips_new (); - gtk_tooltips_set_tip (tips, infofg, - _("Click to select info text foreground colour"), - NULL); - if (cfg != NULL) { - rgba = mod_cfg_get_int (cfg, - MOD_CFG_MAP_SECTION, - MOD_CFG_MAP_INFO_COL, - SAT_CFG_INT_MAP_INFO_COL); - } - else { - rgba = sat_cfg_get_int (SAT_CFG_INT_MAP_INFO_COL); - } - rgba2gdk (rgba, &col, &alpha); - gtk_color_button_set_color (GTK_COLOR_BUTTON (infofg), &col); - gtk_color_button_set_alpha (GTK_COLOR_BUTTON (infofg), alpha); - g_signal_connect (infofg, "color-set", G_CALLBACK (colour_changed), NULL); + /* Info foreground */ + label = gtk_label_new (_("Info Text FG:")); + gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); + gtk_table_attach (GTK_TABLE (table), label, 2, 3, 2, 3, + GTK_FILL, GTK_FILL, 0, 0); + infofg = gtk_color_button_new (); + gtk_color_button_set_use_alpha (GTK_COLOR_BUTTON (infofg), TRUE); + gtk_table_attach (GTK_TABLE (table), infofg, 3, 4, 2, 3, + GTK_FILL , GTK_FILL, 0, 0); + tips = gtk_tooltips_new (); + gtk_tooltips_set_tip (tips, infofg, + _("Click to select info text foreground colour"), + NULL); + if (cfg != NULL) { + rgba = mod_cfg_get_int (cfg, + MOD_CFG_MAP_SECTION, + MOD_CFG_MAP_INFO_COL, + SAT_CFG_INT_MAP_INFO_COL); + } + else { + rgba = sat_cfg_get_int (SAT_CFG_INT_MAP_INFO_COL); + } + rgba2gdk (rgba, &col, &alpha); + gtk_color_button_set_color (GTK_COLOR_BUTTON (infofg), &col); + gtk_color_button_set_alpha (GTK_COLOR_BUTTON (infofg), alpha); + g_signal_connect (infofg, "color-set", G_CALLBACK (colour_changed), NULL); - /* Info background */ - label = gtk_label_new (_("Info Text BG:")); - gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); - gtk_table_attach (GTK_TABLE (table), label, 4, 5, 2, 3, - GTK_FILL, GTK_FILL, 0, 0); - infobg = gtk_color_button_new (); - gtk_color_button_set_use_alpha (GTK_COLOR_BUTTON (infobg), TRUE); - gtk_table_attach (GTK_TABLE (table), infobg, 5, 6, 2, 3, - GTK_FILL , GTK_FILL, 0, 0); - tips = gtk_tooltips_new (); - gtk_tooltips_set_tip (tips, infobg, - _("Click to select info text background colour"), - NULL); - if (cfg != NULL) { - rgba = mod_cfg_get_int (cfg, - MOD_CFG_MAP_SECTION, - MOD_CFG_MAP_INFO_BGD_COL, - SAT_CFG_INT_MAP_INFO_BGD_COL); - } - else { - rgba = sat_cfg_get_int (SAT_CFG_INT_MAP_INFO_BGD_COL); - } - rgba2gdk (rgba, &col, &alpha); - gtk_color_button_set_color (GTK_COLOR_BUTTON (infobg), &col); - gtk_color_button_set_alpha (GTK_COLOR_BUTTON (infobg), alpha); - g_signal_connect (infobg, "color-set", G_CALLBACK (colour_changed), NULL); + /* Info background */ + label = gtk_label_new (_("Info Text BG:")); + gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); + gtk_table_attach (GTK_TABLE (table), label, 4, 5, 2, 3, + GTK_FILL, GTK_FILL, 0, 0); + infobg = gtk_color_button_new (); + gtk_color_button_set_use_alpha (GTK_COLOR_BUTTON (infobg), TRUE); + gtk_table_attach (GTK_TABLE (table), infobg, 5, 6, 2, 3, + GTK_FILL , GTK_FILL, 0, 0); + tips = gtk_tooltips_new (); + gtk_tooltips_set_tip (tips, infobg, + _("Click to select info text background colour"), + NULL); + if (cfg != NULL) { + rgba = mod_cfg_get_int (cfg, + MOD_CFG_MAP_SECTION, + MOD_CFG_MAP_INFO_BGD_COL, + SAT_CFG_INT_MAP_INFO_BGD_COL); + } + else { + rgba = sat_cfg_get_int (SAT_CFG_INT_MAP_INFO_BGD_COL); + } + rgba2gdk (rgba, &col, &alpha); + gtk_color_button_set_color (GTK_COLOR_BUTTON (infobg), &col); + gtk_color_button_set_alpha (GTK_COLOR_BUTTON (infobg), alpha); + g_signal_connect (infobg, "color-set", G_CALLBACK (colour_changed), NULL); + /* Shadow */ + label = gtk_label_new (_("Shadow:")); + gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); + gtk_table_attach (GTK_TABLE (table), label, 0, 1, 3, 4, + GTK_FILL, GTK_FILL, 0, 0); + label = gtk_label_new (NULL); + gtk_label_set_markup (GTK_LABEL (label), _("<i>Transparent</i>")); + gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); + gtk_table_attach (GTK_TABLE (table), label, 1, 2, 3, 4, + GTK_FILL, GTK_FILL, 0, 0); + label = gtk_label_new (NULL); + gtk_label_set_markup (GTK_LABEL (label), _("<i>Strong</i>")); + gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); + gtk_table_attach (GTK_TABLE (table), label, 5, 6, 3, 4, + GTK_FILL, GTK_FILL, 0, 0); + shadow = gtk_hscale_new_with_range (0, 255, 1); + gtk_scale_set_draw_value (GTK_SCALE (shadow), FALSE); + if (cfg != NULL) { + rgba = mod_cfg_get_int (cfg, + MOD_CFG_MAP_SECTION, + MOD_CFG_MAP_SHADOW_ALPHA, + SAT_CFG_INT_MAP_SHADOW_ALPHA); + } + else { + rgba = sat_cfg_get_int (SAT_CFG_INT_MAP_SHADOW_ALPHA); + } + gtk_range_set_value (GTK_RANGE (shadow), rgba); + gtk_widget_set_tooltip_text (shadow, + _("Specifies how strong the shadow under the satellite marker should be. "\ + "The shadow improves the visibility of the satellites where the colour of "\ + "the background is light, e.g. the South Pole.\n\n"\ + "Transparent corresponds to no shadow.")); + gtk_table_attach (GTK_TABLE (table), shadow, 2, 5, 3, 4, + GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 0, 0); + g_signal_connect (shadow, "value-changed", G_CALLBACK (shadow_changed), NULL); + } @@ -589,40 +625,39 @@ * the satellite ground track for. * */ -static void -create_orbit_selector (GKeyFile *cfg, GtkBox *vbox) +static void create_orbit_selector (GKeyFile *cfg, GtkBox *vbox) { - GtkWidget *label; - GtkWidget *hbox; - gint onum; + GtkWidget *label; + GtkWidget *hbox; + gint onum; - hbox = gtk_hbox_new (FALSE, 10); - gtk_box_pack_start (vbox, hbox, FALSE, TRUE, 0); + hbox = gtk_hbox_new (FALSE, 10); + gtk_box_pack_start (vbox, hbox, FALSE, TRUE, 0); - label = gtk_label_new (_("Display ground track for")); - gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); + label = gtk_label_new (_("Display ground track for")); + gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); - orbit = gtk_spin_button_new_with_range (1, 10, 1); - gtk_spin_button_set_digits (GTK_SPIN_BUTTON (orbit), 0); - gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (orbit), TRUE); + orbit = gtk_spin_button_new_with_range (1, 10, 1); + gtk_spin_button_set_digits (GTK_SPIN_BUTTON (orbit), 0); + gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (orbit), TRUE); - if (cfg != NULL) { - onum = mod_cfg_get_int (cfg, - MOD_CFG_MAP_SECTION, - MOD_CFG_MAP_TRACK_NUM, - SAT_CFG_INT_MAP_TRACK_NUM); - } - else { - onum = sat_cfg_get_int (SAT_CFG_INT_MAP_TRACK_NUM); - } - gtk_spin_button_set_value (GTK_SPIN_BUTTON (orbit), onum); - g_signal_connect (G_OBJECT (orbit), "value-changed", - G_CALLBACK (orbit_changed), NULL); + if (cfg != NULL) { + onum = mod_cfg_get_int (cfg, + MOD_CFG_MAP_SECTION, + MOD_CFG_MAP_TRACK_NUM, + SAT_CFG_INT_MAP_TRACK_NUM); + } + else { + onum = sat_cfg_get_int (SAT_CFG_INT_MAP_TRACK_NUM); + } + gtk_spin_button_set_value (GTK_SPIN_BUTTON (orbit), onum); + g_signal_connect (G_OBJECT (orbit), "value-changed", + G_CALLBACK (orbit_changed), NULL); - gtk_box_pack_start (GTK_BOX (hbox), orbit, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (hbox), orbit, FALSE, FALSE, 0); - label = gtk_label_new (_("orbit(s)")); - gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); + label = gtk_label_new (_("orbit(s)")); + gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); } @@ -633,35 +668,34 @@ * * This function creates and sets up the RESET button. */ -static void -create_reset_button (GKeyFile *cfg, GtkBox *vbox) +static void create_reset_button (GKeyFile *cfg, GtkBox *vbox) { - GtkWidget *button; - GtkWidget *butbox; - GtkTooltips *tips; + GtkWidget *button; + GtkWidget *butbox; + GtkTooltips *tips; - button = gtk_button_new_with_label (_("Reset")); - g_signal_connect (G_OBJECT (button), "clicked", - G_CALLBACK (reset_cb), cfg); + button = gtk_button_new_with_label (_("Reset")); + g_signal_connect (G_OBJECT (button), "clicked", + G_CALLBACK (reset_cb), cfg); - tips = gtk_tooltips_new (); - if (cfg == NULL) { - gtk_tooltips_set_tip (tips, button, - _("Reset settings to the default values."), - NULL); - } - else { - gtk_tooltips_set_tip (tips, button, - _("Reset module settings to the global values."), - NULL); - } + tips = gtk_tooltips_new (); + if (cfg == NULL) { + gtk_tooltips_set_tip (tips, button, + _("Reset settings to the default values."), + NULL); + } + else { + gtk_tooltips_set_tip (tips, button, + _("Reset module settings to the global values."), + NULL); + } - butbox = gtk_hbutton_box_new (); - gtk_button_box_set_layout (GTK_BUTTON_BOX (butbox), GTK_BUTTONBOX_END); - gtk_box_pack_end (GTK_BOX (butbox), button, FALSE, TRUE, 10); + butbox = gtk_hbutton_box_new (); + gtk_button_box_set_layout (GTK_BUTTON_BOX (butbox), GTK_BUTTONBOX_END); + gtk_box_pack_end (GTK_BOX (butbox), button, FALSE, TRUE, 10); - gtk_box_pack_end (vbox, butbox, FALSE, TRUE, 0); + gtk_box_pack_end (vbox, butbox, FALSE, TRUE, 0); } @@ -674,10 +708,9 @@ * We don't need to do anything but set the dirty flag since the values can * always be obtained from the global widgets. */ -static void -content_changed (GtkToggleButton *but, gpointer data) +static void content_changed (GtkToggleButton *but, gpointer data) { - dirty = TRUE; + dirty = TRUE; } @@ -688,20 +721,28 @@ * We don't need to do anything but set the dirty flag since the values can * always be obtained from the global widgets. */ -static void -colour_changed (GtkWidget *but, gpointer data) +static void colour_changed (GtkWidget *but, gpointer data) { - dirty = TRUE; + dirty = TRUE; } -static void -orbit_changed (GtkWidget *spin, gpointer data) +static void orbit_changed (GtkWidget *spin, gpointer data) { - dirty = TRUE; + dirty = TRUE; } +static gboolean shadow_changed (GtkRange *range, GtkScrollType scroll, gdouble value, gpointer data) +{ + dirty = TRUE; + /* prevent other signal handlers from being executed */ + return TRUE; +} + + + + /** \brief Managge RESET button signals. * \param button The RESET button. * \param cfg Pointer to the module configuration or NULL in global mode. @@ -711,427 +752,443 @@ * in "local" mode (when cfg != NULL) the function will reset the module settings to * the global settings. This is done by removing the corresponding key from the GKeyFile. */ -static void -reset_cb (GtkWidget *button, gpointer cfg) +static void reset_cb (GtkWidget *button, gpointer cfg) { - GdkColor col; - guint16 alpha; - guint rgba; + GdkColor col; + guint16 alpha; + guint rgba; - if (cfg == NULL) { - /* global mode, get defaults */ + if (cfg == NULL) { + /* global mode, get defaults */ - /* background map */ - g_free (mapf); - mapf = sat_cfg_get_str_def (SAT_CFG_STR_MAP_FILE); - update_map_icon (); + /* background map */ + g_free (mapf); + mapf = sat_cfg_get_str_def (SAT_CFG_STR_MAP_FILE); + update_map_icon (); - /* extra contents */ - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (qth), - sat_cfg_get_bool_def (SAT_CFG_BOOL_MAP_SHOW_QTH_INFO)); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (next), - sat_cfg_get_bool_def (SAT_CFG_BOOL_MAP_SHOW_NEXT_EV)); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (curs), - sat_cfg_get_bool_def (SAT_CFG_BOOL_MAP_SHOW_CURS_TRACK)); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (grid), - sat_cfg_get_bool_def (SAT_CFG_BOOL_MAP_SHOW_GRID)); + /* extra contents */ + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (qth), + sat_cfg_get_bool_def (SAT_CFG_BOOL_MAP_SHOW_QTH_INFO)); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (next), + sat_cfg_get_bool_def (SAT_CFG_BOOL_MAP_SHOW_NEXT_EV)); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (curs), + sat_cfg_get_bool_def (SAT_CFG_BOOL_MAP_SHOW_CURS_TRACK)); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (grid), + sat_cfg_get_bool_def (SAT_CFG_BOOL_MAP_SHOW_GRID)); - /* colours */ - rgba = sat_cfg_get_int_def (SAT_CFG_INT_MAP_QTH_COL); - rgba2gdk (rgba, &col, &alpha); - gtk_color_button_set_color (GTK_COLOR_BUTTON (qthc), &col); - gtk_color_button_set_alpha (GTK_COLOR_BUTTON (qthc), alpha); + /* colours */ + rgba = sat_cfg_get_int_def (SAT_CFG_INT_MAP_QTH_COL); + rgba2gdk (rgba, &col, &alpha); + gtk_color_button_set_color (GTK_COLOR_BUTTON (qthc), &col); + gtk_color_button_set_alpha (GTK_COLOR_BUTTON (qthc), alpha); - rgba = sat_cfg_get_int_def (SAT_CFG_INT_MAP_GRID_COL); - rgba2gdk (rgba, &col, &alpha); - gtk_color_button_set_color (GTK_COLOR_BUTTON (gridc), &col); - gtk_color_button_set_alpha (GTK_COLOR_BUTTON (gridc), alpha); + rgba = sat_cfg_get_int_def (SAT_CFG_INT_MAP_GRID_COL); + rgba2gdk (rgba, &col, &alpha); + gtk_color_button_set_color (GTK_COLOR_BUTTON (gridc), &col); + gtk_color_button_set_alpha (GTK_COLOR_BUTTON (gridc), alpha); - rgba = sat_cfg_get_int_def (SAT_CFG_INT_MAP_TICK_COL); - rgba2gdk (rgba, &col, &alpha); - gtk_color_button_set_color (GTK_COLOR_BUTTON (tickc), &col); - gtk_color_button_set_alpha (GTK_COLOR_BUTTON (tickc), alpha); - - rgba = sat_cfg_get_int_def (SAT_CFG_INT_MAP_SAT_COL); - rgba2gdk (rgba, &col, &alpha); - gtk_color_button_set_color (GTK_COLOR_BUTTON (satc), &col); - gtk_color_button_set_alpha (GTK_COLOR_BUTTON (satc), alpha); + rgba = sat_cfg_get_int_def (SAT_CFG_INT_MAP_TICK_COL); + rgba2gdk (rgba, &col, &alpha); + gtk_color_button_set_color (GTK_COLOR_BUTTON (tickc), &col); + gtk_color_button_set_alpha (GTK_COLOR_BUTTON (tickc), alpha); - rgba = sat_cfg_get_int_def (SAT_CFG_INT_MAP_SAT_SEL_COL); - rgba2gdk (rgba, &col, &alpha); - gtk_color_button_set_color (GTK_COLOR_BUTTON (ssatc), &col); - gtk_color_button_set_alpha (GTK_COLOR_BUTTON (ssatc), alpha); + rgba = sat_cfg_get_int_def (SAT_CFG_INT_MAP_SAT_COL); + rgba2gdk (rgba, &col, &alpha); + gtk_color_button_set_color (GTK_COLOR_BUTTON (satc), &col); + gtk_color_button_set_alpha (GTK_COLOR_BUTTON (satc), alpha); - rgba = sat_cfg_get_int_def (SAT_CFG_INT_MAP_TRACK_COL); - rgba2gdk (rgba, &col, &alpha); - gtk_color_button_set_color (GTK_COLOR_BUTTON (trackc), &col); - gtk_color_button_set_alpha (GTK_COLOR_BUTTON (trackc), alpha); + rgba = sat_cfg_get_int_def (SAT_CFG_INT_MAP_SAT_SEL_COL); + rgba2gdk (rgba, &col, &alpha); + gtk_color_button_set_color (GTK_COLOR_BUTTON (ssatc), &col); + gtk_color_button_set_alpha (GTK_COLOR_BUTTON (ssatc), alpha); - rgba = sat_cfg_get_int_def (SAT_CFG_INT_MAP_SAT_COV_COL); - rgba2gdk (rgba, &col, &alpha); - gtk_color_button_set_color (GTK_COLOR_BUTTON (covc), &col); - gtk_color_button_set_alpha (GTK_COLOR_BUTTON (covc), alpha); + rgba = sat_cfg_get_int_def (SAT_CFG_INT_MAP_TRACK_COL); + rgba2gdk (rgba, &col, &alpha); + gtk_color_button_set_color (GTK_COLOR_BUTTON (trackc), &col); + gtk_color_button_set_alpha (GTK_COLOR_BUTTON (trackc), alpha); - rgba = sat_cfg_get_int_def (SAT_CFG_INT_MAP_INFO_COL); - rgba2gdk (rgba, &col, &alpha); - gtk_color_button_set_color (GTK_COLOR_BUTTON (infofg), &col); - gtk_color_button_set_alpha (GTK_COLOR_BUTTON (infofg), alpha); + rgba = sat_cfg_get_int_def (SAT_CFG_INT_MAP_SA... [truncated message content] |