1964
1968
gint maploaded, simmode, zoom, iszoomed;
1965
1969
gchar homedir[500], mapdir[500];
1966
1970
static gchar const rcsid[] =
1967
"$Id: gpsdrive.c,v 1.525 2004/03/03 20:46:47 ganter Exp $";
1971
"$Id: gpsdrive.c,v 1.526 2004/04/05 18:45:40 ganter Exp $";
1968
1972
gint thisline, thisrouteline = 0, routeitems = 0, routepointer = 0;
1969
1973
gint maxwp, maxfriends = 0;
1970
1974
GtkStyle *style = NULL;
2003
2007
GtkWidget *l1, *l2, *l3, *l4, *l5, *l6, *l7, *l8, *mutebt, *sqlbt;
2004
2008
GtkWidget *trackbt, *wpbt;
2005
2009
GtkWidget *bestmapbt, *maptogglebt, *topotogglebt, *savetrackbt;
2006
GtkWidget *loadtrackbt, *radio1, *radio2, *radio3, *scalerlbt, *scalerrbt;
2010
GtkWidget *loadtrackbt, *radio1, *radio2, *scalerlbt, *scalerrbt;
2007
2011
GtkWidget *setupbt;
2008
2012
gint savetrack = 0, havespeechout, hours, minutes, speechcount = 0;
2009
2013
gint muteflag = 0, sqlflag = 0, trackflag = 1, wpflag = TRUE;
4050
4054
#if PREFER_MinDec
4051
4055
/* Hack alert: there should be a 3-way lat/lon format selection in the GUI */
4053
g_snprintf (text,100, "%d%s%.3f'%c", grad, gradsym, minf,
4057
g_snprintf (text, 100, "%d%s%.3f'%c", grad, gradsym, minf,
4054
4058
(minus) ? 'S' : 'N');
4056
4060
g_snprintf (text, 100, "%d%s%.3f'%c", grad, gradsym, minf,
4421
4425
if (needtosave)
4422
4426
writeconfig ();
4429
/* Check for changed map_koord.txt and reload if changed */
4430
g_strlcpy (mappath, mapdir, sizeof (mappath));
4431
g_strlcat (mappath, "map_koord.txt", sizeof (mappath));
4433
f = stat (mappath, &buf);
4434
if (buf.st_mtime != maptxtstamp)
4437
g_print ("\n%s reloaded\n", "map_koord.txt");
4438
maptxtstamp = buf.st_mtime;
4423
4442
if (needreloadmapconfig)
4424
4443
loadmapconfig ();
5129
Show (in yellow) any downloaded maps with in +/-20% of the currently requested map download
5130
also show bounds of map with a black border
5131
This is currently hooked in to the drawdownloadrectangle() function but may be better else where as
5132
a seperate function that can be turned on and off as requried.
5133
Due to RGB bit masks the map to be downloaded will now be green so that the new download area will be visible
5134
over the top of the previous downloaded maps.
5137
gdouble x, y, la, lo;
5141
for (i = 0; i < nrmaps; i++)
5143
g_strlcpy (sc, newmapsc, sizeof (sc));
5144
g_strdelimit (sc, ",", '.');
5145
scale = g_strtod (sc, NULL);
5147
if (maps[i].scale <= scale * 1.2 && maps[i].scale >= scale * 0.8)
5149
//printf("Selected map at long %lf lat %lf\n",maps[i].lat,maps[i].longitude);
5151
lo = maps[i].longitude;
5152
// scale=maps[i].scale;
5153
calcxy (&x, &y, lo, la, zoom);
5154
xo = 1280.0 * zoom * scale / mapscale;
5155
yo = 1024.0 * zoom * scale / mapscale;
5156
// yellow background
5157
gdk_gc_set_foreground (kontext, &yellow);
5158
gdk_gc_set_function (kontext, GDK_AND);
5159
gdk_gc_set_line_attributes (kontext, 2, 0, 0, 0);
5160
gdk_draw_rectangle (drawable, kontext, 1, x - xo / 2, y - yo / 2,
5163
gdk_gc_set_foreground (kontext, &black);
5164
gdk_gc_set_function (kontext, GDK_SOLID);
5165
gdk_gc_set_line_attributes (kontext, 2, 0, 0, 0);
5166
gdk_draw_rectangle (drawable, kontext, 0, x - xo / 2, y - yo / 2,
5107
5175
drawdownloadrectangle (gint big)
5109
5177
/* draw downloadrectangle */
5125
5195
g_strdelimit (sc, ",", '.');
5126
5196
scale = g_strtod (sc, NULL);
5128
gdk_gc_set_foreground (kontext, &yellow);
5198
gdk_gc_set_foreground (kontext, &green2);
5129
5199
gdk_gc_set_function (kontext, GDK_AND);
5130
5200
gdk_gc_set_line_attributes (kontext, 2, 0, 0, 0);
6772
topoz_select_cb (GtkWidget * widget, guint datum)
6775
gchar buff[300], mappath[500];
6781
if (mapdir[strlen (mapdir) - 1] != '/')
6782
g_strlcat (mapdir, "/", sizeof (mapdir));
6784
g_strlcpy (mappath, mapdir, sizeof (mappath));
6786
g_snprintf (downloadfilename, sizeof (downloadfilename),
6787
"%stop_file%04d.png", mappath, i++);
6788
e = stat (downloadfilename, &buf);
6791
g_snprintf (buff, sizeof (buff), "top_file%04d.png", i - 1);
6792
gtk_entry_set_text (GTK_ENTRY (dltext4), buff);
6798
6846
dlscale_cb (GtkWidget * widget, guint datum)
6915
6963
gtk_signal_connect (GTK_OBJECT (dltext4), "changed",
6916
6964
GTK_SIGNAL_FUNC (dlscale_cb), 0);
6918
table2 = gtk_table_new (3, 1, FALSE); //nested table w/ three columns
6966
table2 = gtk_table_new (2, 1, FALSE); //nested table w/ three columns
6919
6967
gtk_table_attach_defaults (GTK_TABLE (table), table2, 0, 3, 5, 6);
6920
6968
gtk_widget_show (table2);
6931
6979
gtk_signal_connect (GTK_OBJECT (radio2), "clicked",
6932
6980
GTK_SIGNAL_FUNC (other_select_cb), 0);
6934
radio3 = gtk_radio_button_new_with_label (gr, _("TopoZone(US Only)"));
6935
gtk_table_attach_defaults (GTK_TABLE (table2), radio3, 2, 3, 0, 1);
6936
gr = gtk_radio_button_group (GTK_RADIO_BUTTON (radio3));
6937
gtk_signal_connect (GTK_OBJECT (radio3), "clicked",
6938
GTK_SIGNAL_FUNC (topoz_select_cb), 0);
6940
6984
tooltips = gtk_tooltips_new ();
6941
6985
gtk_tooltips_set_tip (GTK_TOOLTIPS (tooltips), radio1,
6947
6991
("If selected, you download the map from the U.S. expedia server (expedia.com)"),
6949
gtk_tooltips_set_tip (GTK_TOOLTIPS (tooltips), radio3,
6951
("If selected, you download the map from the TopoZone Server (US maps only)"),
6954
6994
/* disable mapblast */
6955
6995
/* gtk_widget_set_sensitive (radio1, FALSE); */
6956
6996
/* defaultserver = 1; */
6958
6998
/* gtk_table_attach_defaults (GTK_TABLE (table), radio2, 1, 2, 5, 6); */
6999
if ((defaultserver < 0) && (defaultserver > 1))
6959
7001
switch (defaultserver)
7029
7067
gdouble f, nlongi;
7032
float Lat1, Long1, Lat2, Long2, Lat, Long, scale_f;
7033
float *UTMNorthing, *UTMEasting;
7035
char s_zone[6], typ[8], sctext[40];
7036
char Lat1S[20], Long1S[20], Lat2S[20], Long2S[20];
7038
7073
if (!downloadwindowactive)
7125
7155
* http://www.vicinity.com/gif?&CT=45:-93:10000&IC=&W=1024&H=800&FAM=myblast&LB=
7128
if (topozone) //TopoZone.com supported Added by Russell Harding Jan, 2004
7129
{ //<hardingr at cunap dot com>
7130
UTMNorthing = malloc (sizeof (float));
7131
UTMEasting = malloc (sizeof (float));
7132
UTMZone = malloc (sizeof (int));
7133
scale_f = atof (sctext);
7135
LLtoUTM (Lat, Long, UTMNorthing, UTMEasting, UTMZone);
7137
Lat1 = *UTMNorthing - (1024 * scale_f / PIXELFACT) / 2;
7138
Lat2 = *UTMNorthing + (1024 * scale_f / PIXELFACT) / 2;
7139
Long1 = *UTMEasting - (1280 * scale_f / PIXELFACT) / 2;
7140
Long2 = *UTMEasting + (1280 * scale_f / PIXELFACT) / 2;
7143
g_snprintf (s_zone, sizeof (s_zone), "269%i", *UTMZone);
7145
g_snprintf (s_zone, sizeof (s_zone), "2690%i", *UTMZone);
7147
if (Lat > 50) //Maps in Alaska have different scales
7149
if (scale_f <= 75000)
7150
g_snprintf (typ, sizeof (typ), "DRG50");
7152
g_snprintf (typ, sizeof (typ), "DRG250");
7154
else //Continental U.S.
7156
if (scale_f <= 30000)
7157
g_snprintf (typ, sizeof (typ), "DRG25");
7158
if (scale_f > 30000 && scale_f <= 75000)
7159
g_snprintf (typ, sizeof (typ), "DRG100");
7160
if (scale_f > 75000)
7161
g_snprintf (typ, sizeof (typ), "DRG250");
7163
g_snprintf (Long1S, sizeof (Long1S), "%f", Long1);
7164
g_strdelimit (Long1S, ",", '.');
7165
g_snprintf (Lat1S, sizeof (Lat1S), "%f", Lat1);
7166
g_strdelimit (Lat1S, ",", '.');
7167
g_snprintf (Long2S, sizeof (Long2S), "%f", Long2);
7168
g_strdelimit (Long2S, ",", '.');
7169
g_snprintf (Lat2S, sizeof (Lat2S), "%f", Lat2);
7170
g_strdelimit (Lat2S, ",", '.');
7172
g_snprintf (writebuff, sizeof (writebuff),
7173
"GET http://%s/map.php?map=PNG8|4|%s|%s|%s,%s,%s,%s|1280|1024 HTTP/1.0\r\nUser-Agent: Wget/1.6\r\nHost: %s\r\nAccept: */*\r\nConnection: Keep-Alive\r\n\r\n",
7174
WEBSERVER3, typ, s_zone, Long1S, Lat1S, Long2S, Lat2S,
7182
if (!expedia && !topozone)
7183
7159
g_snprintf (writebuff, sizeof (writebuff),
7184
7160
"GET http://%s/gif?&CT=%s:%s:%s&IC=&W=1280&H=1024&FAM=myblast&LB= HTTP/1.0\r\nUser-Agent: Wget/1.6\r\nHost: %s\r\nAccept: */*\r\nConnection: Keep-Alive\r\n\r\n",
7185
7161
WEBSERVER, lat, longi, sctext, hostname);
7220
7196
printf ("\n%s\n", url);
7221
7197
p = strstr (url, "Location: ");
7202
("http data error, could not find 'Location:' sub string\n");
7222
7205
g_strlcpy (url2, (p + 10), sizeof (url2));
7223
7206
p = strstr (url2, "\n");
7210
printf ("http data error, could not find new line\n");
7224
7214
url2[p - url2] = 0;
7226
7216
printf ("\n**********\n%s\n", url2);
7227
7217
g_strlcpy (hn, (url2 + 7), sizeof (hn));
7228
7218
p = strstr (hn, "/");
7222
printf ("http request error, could not find forward slash\n");
7229
7226
hn[p - hn] = 0;
7230
7227
g_strlcpy (url, (url2 + strlen (hn) + 7), sizeof (url));
7231
7228
url[strlen (url) - 1] = 0;
7232
7229
g_strlcpy (actualhostname, hn, sizeof (actualhostname));
7234
7231
printf ("\nhn: %s, url: %s", hn, url);
7235
g_snprintf (url2, sizeof (url2), "GET %s HTTP/1.1\r\n", url);
7235
// Format the GET request correctly for the proxy server
7236
g_snprintf (url2, sizeof (url2), "GET http://%s/%s HTTP/1.1\r\n", hn,url);
7240
g_snprintf (url2, sizeof (url2), "GET %s HTTP/1.1\r\n", url);
7236
7243
g_strlcat (url2, "Host: ", sizeof (url2));
7237
7244
g_strlcat (url2, hn, sizeof (url2));
7238
7245
g_strlcat (url2, "\r\n", sizeof (url2));
7431
7435
g_strlcpy (sn, WEBSERVER2, sizeof (sn));
7434
g_strlcpy (sn, WEBSERVER3, sizeof (sn));
7435
if (!expedia && !topozone)
7436
7439
g_strlcpy (sn, WEBSERVER, sizeof (sn));
7442
if (expedia==TRUE && haveproxy==FALSE)
7440
7443
g_strlcpy (sn, actualhostname, sizeof (sn));
7442
7445
if ((server_data = gethostbyname (sn)) == NULL)
7444
7447
perror (_("Can't resolve webserver address"));
7445
if (!expedia && !topozone)
7446
7449
g_snprintf (str, sizeof (str), _("Connecting to %s FAILED!"),
7505
7504
g_snprintf (str, sizeof (str), _("Now connected to %s"), WEBSERVER2);
7508
g_snprintf (str, sizeof (str), _("Now connected to %s"), WEBSERVER3);
7509
7507
gtk_statusbar_pop (GTK_STATUSBAR (status), statusid);
7510
7508
gtk_statusbar_push (GTK_STATUSBAR (status), statusid, str);
7511
7509
gtk_timeout_add (100, (GtkFunction) downloadslave_cb, widget);
10495
10501
dlopen ("@PREFIX@/lib/mysql/libmysqlclient.10.dylib", RTLD_LAZY);
10503
handle = dlopen ("/usr/lib/libmysqlclient.so", RTLD_LAZY);
10497
10505
handle = dlopen ("libmysqlclient.so", RTLD_LAZY);
10499
handle = dlopen ("libmysqlclient.so.15", RTLD_LAZY);
10501
handle = dlopen ("/opt/lib/mysql/libmysqlclient.so.15", RTLD_LAZY);
10503
handle = dlopen ("/opt/mysql/lib/libmysqlclient.so.15", RTLD_LAZY);
10505
handle = dlopen ("/usr/lib/mysql/libmysqlclient.so.15", RTLD_LAZY);
10507
handle = dlopen ("/usr/lib/libmysqlclient.so.15", RTLD_LAZY);
10507
handle = dlopen ("libmysqlclient.so.10", RTLD_LAZY);
10509
handle = dlopen ("/opt/lib/mysql/libmysqlclient.so.10", RTLD_LAZY);
10511
handle = dlopen ("/opt/mysql/lib/libmysqlclient.so.10", RTLD_LAZY);
10513
handle = dlopen ("/usr/lib/mysql/libmysqlclient.so.10", RTLD_LAZY);
10515
handle = dlopen ("/usr/lib/libmysqlclient.so.10", RTLD_LAZY);
10510
dlopen ("/usr/local/lib/mysql/libmysqlclient.so.15", RTLD_LAZY);
10512
handle = dlopen ("/usr/local/mysql/libmysqlclient.so.15", RTLD_LAZY);
10514
handle = dlopen ("/usr/local/lib/libmysqlclient.so.15", RTLD_LAZY);
10518
dlopen ("/usr/local/lib/mysql/libmysqlclient.so.10", RTLD_LAZY);
10520
handle = dlopen ("/usr/local/mysql/libmysqlclient.so.10", RTLD_LAZY);
10522
handle = dlopen ("/usr/local/lib/libmysqlclient.so.10", RTLD_LAZY);
10516
10524
handle = dlopen ("/sw/lib/libmysqlclient.dylib", RTLD_LAZY);