]> git.street.me.uk Git - andy/viking.git/blame - src/globals.c
Ensure vtl created in acquire operation runs post read stage.
[andy/viking.git] / src / globals.c
CommitLineData
2936913d
GB
1/*
2 * viking -- GPS Data and Topo Analyzer, Explorer, and Manager
3 *
4 * Copyright (C) 2003-2005, Evan Battaglia <gtoevan@gmx.net>
a482007a
GB
5 * Copyright (C) 2008, Guilhem Bonnefille <guilhem.bonnefille@gmail.com>
6 * Copyright (C) 2010, Rob Norris <rw_norris@hotmail.com>
2936913d
GB
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 */
a58aaed4
GB
23#ifdef HAVE_CONFIG_H
24#include "config.h"
25#endif
26
27#include <glib/gi18n.h>
2936913d
GB
28
29#include "globals.h"
a58aaed4 30#include "preferences.h"
2936913d
GB
31
32gboolean vik_debug = FALSE;
33gboolean vik_verbose = FALSE;
34gboolean vik_version = FALSE;
35
a58aaed4 36static gchar * params_degree_formats[] = {"DDD", "DMM", "DMS", NULL};
6f9336aa 37static gchar * params_units_distance[] = {"Kilometres", "Miles", NULL};
a4c92313 38static gchar * params_units_speed[] = {"km/h", "mph", "m/s", "knots", NULL};
6027a9c5 39static gchar * params_units_height[] = {"Metres", "Feet", NULL};
5210c3d3
GB
40static VikLayerParamScale params_scales_lat[] = { {-90.0, 90.0, 0.05, 2} };
41static VikLayerParamScale params_scales_long[] = { {-180.0, 180.0, 0.05, 2} };
42
6f9336aa 43static VikLayerParam prefs1[] = {
a58aaed4
GB
44 { VIKING_PREFERENCES_NAMESPACE "degree_format", VIK_LAYER_PARAM_UINT, VIK_DEGREE_FORMAT_DMS, N_("Degree format:"), VIK_LAYER_WIDGET_COMBOBOX, params_degree_formats, NULL },
45};
46
6f9336aa
RN
47static VikLayerParam prefs2[] = {
48 { VIKING_PREFERENCES_NAMESPACE "units_distance", VIK_LAYER_PARAM_UINT, VIK_UNITS_DISTANCE_KILOMETRES, N_("Distance units:"), VIK_LAYER_WIDGET_COMBOBOX, params_units_distance, NULL },
49};
50
13bdea80
RN
51static VikLayerParam prefs3[] = {
52 { VIKING_PREFERENCES_NAMESPACE "units_speed", VIK_LAYER_PARAM_UINT, VIK_UNITS_SPEED_KILOMETRES_PER_HOUR, N_("Speed units:"), VIK_LAYER_WIDGET_COMBOBOX, params_units_speed, NULL },
53};
54
6027a9c5
RN
55static VikLayerParam prefs4[] = {
56 { VIKING_PREFERENCES_NAMESPACE "units_height", VIK_LAYER_PARAM_UINT, VIK_UNITS_HEIGHT_METRES, N_("Height units:"), VIK_LAYER_WIDGET_COMBOBOX, params_units_height, NULL },
57};
58
9be0449f
RN
59static VikLayerParam prefs5[] = {
60 { VIKING_PREFERENCES_NAMESPACE "use_large_waypoint_icons", VIK_LAYER_PARAM_BOOLEAN, TRUE, N_("Use large waypoint icons:"), VIK_LAYER_WIDGET_CHECKBUTTON, NULL, NULL },
61};
62
5210c3d3
GB
63static VikLayerParam prefs6[] = {
64 { VIKING_PREFERENCES_NAMESPACE "default_latitude", VIK_LAYER_PARAM_DOUBLE, VIK_LOCATION_LAT, N_("Default latitude:"), VIK_LAYER_WIDGET_SPINBUTTON, params_scales_lat, NULL },
65};
66static VikLayerParam prefs7[] = {
67 { VIKING_PREFERENCES_NAMESPACE "default_longitude", VIK_LAYER_PARAM_DOUBLE, VIK_LOCATION_LONG, N_("Default longitude:"), VIK_LAYER_WIDGET_SPINBUTTON, params_scales_long, NULL },
68};
69
a58aaed4
GB
70void a_vik_preferences_init ()
71{
1b03d66d 72 a_preferences_register_group ( VIKING_PREFERENCES_GROUP_KEY, _("General") );
a58aaed4
GB
73
74 VikLayerParamData tmp;
75 tmp.u = VIK_DEGREE_FORMAT_DMS;
6f9336aa
RN
76 a_preferences_register(prefs1, tmp, VIKING_PREFERENCES_GROUP_KEY);
77
78 tmp.u = VIK_UNITS_DISTANCE_KILOMETRES;
79 a_preferences_register(prefs2, tmp, VIKING_PREFERENCES_GROUP_KEY);
13bdea80
RN
80
81 tmp.u = VIK_UNITS_SPEED_KILOMETRES_PER_HOUR;
82 a_preferences_register(prefs3, tmp, VIKING_PREFERENCES_GROUP_KEY);
6027a9c5
RN
83
84 tmp.u = VIK_UNITS_HEIGHT_METRES;
85 a_preferences_register(prefs4, tmp, VIKING_PREFERENCES_GROUP_KEY);
9be0449f
RN
86
87 tmp.b = TRUE;
88 a_preferences_register(prefs5, tmp, VIKING_PREFERENCES_GROUP_KEY);
5210c3d3
GB
89
90 /* Maintain the default location to New York */
91 tmp.d = 40.714490;
92 a_preferences_register(prefs6, tmp, VIKING_PREFERENCES_GROUP_KEY);
93 tmp.d = -74.007130;
94 a_preferences_register(prefs7, tmp, VIKING_PREFERENCES_GROUP_KEY);
a58aaed4
GB
95}
96
97vik_degree_format_t a_vik_get_degree_format ( )
98{
99 vik_degree_format_t format;
100 format = a_preferences_get(VIKING_PREFERENCES_NAMESPACE "degree_format")->u;
101 return format;
a58aaed4 102}
6f9336aa
RN
103
104vik_units_distance_t a_vik_get_units_distance ( )
105{
106 vik_units_distance_t units;
107 units = a_preferences_get(VIKING_PREFERENCES_NAMESPACE "units_distance")->u;
108 return units;
109}
13bdea80
RN
110
111vik_units_speed_t a_vik_get_units_speed ( )
112{
113 vik_units_speed_t units;
114 units = a_preferences_get(VIKING_PREFERENCES_NAMESPACE "units_speed")->u;
115 return units;
116}
6027a9c5
RN
117
118vik_units_height_t a_vik_get_units_height ( )
119{
120 vik_units_height_t units;
121 units = a_preferences_get(VIKING_PREFERENCES_NAMESPACE "units_height")->u;
122 return units;
123}
9be0449f
RN
124
125gboolean a_vik_get_use_large_waypoint_icons ( )
126{
127 gboolean use_large_waypoint_icons;
128 use_large_waypoint_icons = a_preferences_get(VIKING_PREFERENCES_NAMESPACE "use_large_waypoint_icons")->b;
129 return use_large_waypoint_icons;
130}
5210c3d3
GB
131
132gdouble a_vik_get_default_lat ( )
133{
134 gdouble data;
135 data = a_preferences_get(VIKING_PREFERENCES_NAMESPACE "default_latitude")->d;
136 return data;
137}
138
139gdouble a_vik_get_default_long ( )
140{
141 gdouble data;
142 data = a_preferences_get(VIKING_PREFERENCES_NAMESPACE "default_longitude")->d;
143 return data;
144}