summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan McIntosh <ian_mcintosh@linuxadvocate.org>2005-10-20 01:56:22 +0000
committerIan McIntosh <ian_mcintosh@linuxadvocate.org>2005-10-20 01:56:22 +0000
commitd971066bbc5c89759b5d93eeda1214e836cb7ce9 (patch)
tree101c945f134ea3cbc967f0203c3c78dfbcecbe7b
parent4c4e96550dc6ca440a006d6c968b769a5f64b89f (diff)
Added RPM .spec file contributed by Ofer Achler.
Added file to allow pasting/typing text containing lat and lon coordinates into search box. (Currently not implemented!) Init and use search_coordinate stuff. Disable hittesting related to tooltip for preview release. Make GPS checkboxes insensitive when 'show position on map' is off. Add db_city_get_name(id) Add miter limit. Improve a lot. May not make it into the preview release though.
-rw-r--r--ChangeLog10
-rw-r--r--TODO24
-rw-r--r--data/layers.xml16
-rw-r--r--data/roadster.glade896
-rw-r--r--roadster.spec52
-rw-r--r--src/Makefile.am1
-rw-r--r--src/db.c23
-rw-r--r--src/db.h2
-rw-r--r--src/mainwindow.c40
-rw-r--r--src/mainwindow.h5
-rw-r--r--src/map_draw_cairo.c2
-rw-r--r--src/mapinfowindow.c217
-rw-r--r--src/search.c3
-rw-r--r--src/search.h3
-rw-r--r--src/search_coordinate.c88
-rw-r--r--src/search_coordinate.h34
-rw-r--r--src/search_road.c1
-rw-r--r--src/searchwindow.c2
-rw-r--r--src/searchwindow.h2
-rw-r--r--src/util.c6
-rw-r--r--src/util.h1
21 files changed, 907 insertions, 521 deletions
diff --git a/ChangeLog b/ChangeLog
index fa1950f..cd9b393 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2005-10-20 Ian McIntosh <ian_mcintosh@linuxadvocate.org>
+
+ * roadster.spec: Added RPM .spec file contributed by Ofer Achler.
+ * src/search_coordinate.c: Added file to allow pasting/typing text containing lat and lon coordinates into search box. (Currently not implemented!)
+ * src/search.c: Init and use search_coordinate stuff.
+ * src/mainwindow.c: Disable hittesting related to tooltip for preview release. Make GPS checkboxes insensitive when 'show position on map' is off.
+ * src/db.c: Add db_city_get_name(id)
+ * src/map_draw_cairo.c: Add miter limit.
+ * src/mapinfowindow.c: Improve a lot. May not make it into the preview release though.
+
2005-10-18 Ian McIntosh <ian_mcintosh@linuxadvocate.org>
* src/mainwindow.c:
diff --git a/TODO b/TODO
index 2cac3d0..4a63852 100644
--- a/TODO
+++ b/TODO
@@ -1,3 +1,27 @@
+For preview release:
+
+=== REQUIRED ===
+x Hide sidebar by default
+x Hide all tabs but Results
+x Remove Tooltips
+o Remove Road Search no longer works with just "Main St"
+o Choose logo
+o Tile generator
+o Tile parser
+o Tile cache needs to free tiles
+o Remove Debug menu
+
+=== OPTIONAL ===
+o Better toolbar icons for mouse tools
+o Better mouse cursor for zoom tool
+o River sexifier
+o Polygon stitcher for importer
+o Map makeover
+o Road icons (highway, etc.)
+o Switch to sqlite
+
+======================================
+
State boundaries:
http://www.census.gov/geo/cob/bdy/st/st00ascii/
diff --git a/data/layers.xml b/data/layers.xml
index 38ab077..104febc 100644
--- a/data/layers.xml
+++ b/data/layers.xml
@@ -109,7 +109,7 @@
<property zoom-level="5" name="line-width" value="2" />
<property zoom-level="1-5" name="line-cap" value="square" />
- <property zoom-level="6" name="line-width" value="5" />
+ <property zoom-level="6" name="line-width" value="6" />
<property zoom-level="7" name="line-width" value="7" />
<property zoom-level="8" name="line-width" value="10" />
<property zoom-level="9" name="line-width" value="13" />
@@ -122,7 +122,7 @@
<property zoom-level="5" name="line-width" value="4" />
<property zoom-level="1-5" name="color" value="#DdAe31ff" />
- <property zoom-level="6" name="line-width" value="7" />
+ <property zoom-level="6" name="line-width" value="8" />
<property zoom-level="7" name="line-width" value="9" />
<property zoom-level="8" name="line-width" value="12" />
<property zoom-level="9" name="line-width" value="15" />
@@ -132,16 +132,14 @@
<layer data-source="major-roads" draw-type="lines">
<!-- major road top -->
- <property zoom-level="4-5" name="line-width" value="1" />
+ <property zoom-level="4-5" name="line-width" value="2" />
<property zoom-level="4-5" name="line-cap" value="square" />
- <property zoom-level="4-5" name="color" value="#EFE384FF" />
-
<property zoom-level="6" name="line-width" value="4" />
<property zoom-level="7" name="line-width" value="6" />
<property zoom-level="8" name="line-width" value="8" />
<property zoom-level="9" name="line-width" value="14" />
<property zoom-level="10" name="line-width" value="24" />
- <property zoom-level="6-10" name="color" value="#FFF384FF" />
+ <property zoom-level="4-10" name="color" value="#FFF384FF" />
</layer>
<layer data-source="minor-highway-ramps" draw-type="lines">
<!-- minor highway ramp top -->
@@ -172,15 +170,13 @@
<layer data-source="major-roads" draw-type="lines">
<!-- major roads bottom -->
-<!-- <property zoom-level="4-5" name="line-width" value="3" /> -->
-<!-- <property zoom-level="4-5" name="color" value="#e5e5c0ff" /> -->
-
+ <property zoom-level="4-5" name="line-width" value="4" />
<property zoom-level="6" name="line-width" value="6" />
<property zoom-level="7" name="line-width" value="8" />
<property zoom-level="8" name="line-width" value="10" />
<property zoom-level="9" name="line-width" value="16" />
<property zoom-level="10" name="line-width" value="26" />
- <property zoom-level="6-10" name="color" value="#c0c0c0ff" />
+ <property zoom-level="4-10" name="color" value="#c0c0c0ff" />
</layer>
<layer data-source="minor-roads" draw-type="lines">
diff --git a/data/roadster.glade b/data/roadster.glade
index e4ec365..808eac1 100644
--- a/data/roadster.glade
+++ b/data/roadster.glade
@@ -1474,7 +1474,7 @@ Notes:</property>
<property name="use_underline">True</property>
<child internal-child="image">
- <widget class="GtkImage" id="image10356">
+ <widget class="GtkImage" id="image10366">
<property name="visible">True</property>
<property name="stock">gtk-open</property>
<property name="icon_size">1</property>
@@ -1507,7 +1507,7 @@ Notes:</property>
<property name="use_underline">True</property>
<child internal-child="image">
- <widget class="GtkImage" id="image10357">
+ <widget class="GtkImage" id="image10367">
<property name="visible">True</property>
<property name="stock">gtk-save-as</property>
<property name="icon_size">1</property>
@@ -1534,7 +1534,7 @@ Notes:</property>
<accelerator key="Q" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image10358">
+ <widget class="GtkImage" id="image10368">
<property name="visible">True</property>
<property name="stock">gtk-quit</property>
<property name="icon_size">1</property>
@@ -1576,7 +1576,7 @@ Notes:</property>
<property name="visible">True</property>
<property name="label" translatable="yes">_Sidebar</property>
<property name="use_underline">True</property>
- <property name="active">True</property>
+ <property name="active">False</property>
<signal name="activate" handler="mainwindow_on_sidebarmenuitem_activate" last_modification_time="Fri, 04 Mar 2005 04:20:46 GMT"/>
<accelerator key="S" modifiers="GDK_CONTROL_MASK" signal="activate"/>
</widget>
@@ -1705,7 +1705,7 @@ Notes:</property>
<accelerator key="Left" modifiers="GDK_MOD1_MASK" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image10359">
+ <widget class="GtkImage" id="image10369">
<property name="visible">True</property>
<property name="stock">gtk-go-back</property>
<property name="icon_size">1</property>
@@ -1728,7 +1728,7 @@ Notes:</property>
<accelerator key="Right" modifiers="GDK_MOD1_MASK" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image10360">
+ <widget class="GtkImage" id="image10370">
<property name="visible">True</property>
<property name="stock">gtk-media-forward</property>
<property name="icon_size">1</property>
@@ -1788,7 +1788,7 @@ Notes:</property>
<accelerator key="F9" modifiers="0" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image10361">
+ <widget class="GtkImage" id="image10371">
<property name="visible">True</property>
<property name="stock">gtk-refresh</property>
<property name="icon_size">1</property>
@@ -1836,7 +1836,7 @@ Notes:</property>
<signal name="activate" handler="mainwindow_on_aboutmenuitem_activate" last_modification_time="Sat, 12 Mar 2005 06:48:18 GMT"/>
<child internal-child="image">
- <widget class="GtkImage" id="image10362">
+ <widget class="GtkImage" id="image10372">
<property name="visible">True</property>
<property name="stock">gtk-about</property>
<property name="icon_size">1</property>
@@ -1888,7 +1888,7 @@ Notes:</property>
<signal name="activate" handler="mainwindow_on_import_maps_activate" last_modification_time="Fri, 04 Mar 2005 04:28:20 GMT"/>
<child internal-child="image">
- <widget class="GtkImage" id="image10363">
+ <widget class="GtkImage" id="image10373">
<property name="visible">True</property>
<property name="stock">gtk-open</property>
<property name="icon_size">1</property>
@@ -1933,7 +1933,7 @@ Notes:</property>
<accelerator key="F5" modifiers="0" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image10364">
+ <widget class="GtkImage" id="image10374">
<property name="visible">True</property>
<property name="stock">gtk-refresh</property>
<property name="icon_size">1</property>
@@ -1955,7 +1955,7 @@ Notes:</property>
<accelerator key="F6" modifiers="0" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image10365">
+ <widget class="GtkImage" id="image10375">
<property name="visible">True</property>
<property name="stock">gtk-refresh</property>
<property name="icon_size">1</property>
@@ -1992,7 +1992,7 @@ Notes:</property>
<accelerator key="g" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image10366">
+ <widget class="GtkImage" id="image10376">
<property name="visible">True</property>
<property name="stock">gtk-jump-to</property>
<property name="icon_size">1</property>
@@ -2556,14 +2556,13 @@ Notes:</property>
<child>
<widget class="GtkVBox" id="mainwindowsidebox">
<property name="border_width">1</property>
- <property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">8</property>
<child>
<widget class="GtkNotebook" id="sidebarnotebook">
<property name="visible">True</property>
- <property name="show_tabs">True</property>
+ <property name="show_tabs">False</property>
<property name="show_border">True</property>
<property name="tab_pos">GTK_POS_BOTTOM</property>
<property name="scrollable">False</property>
@@ -2695,6 +2694,59 @@ Notes:</property>
</child>
<child>
+ <widget class="GtkScrolledWindow" id="scrolledwindow9250">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="shadow_type">GTK_SHADOW_IN</property>
+ <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+ <child>
+ <widget class="GtkTreeView" id="treeview1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="headers_visible">True</property>
+ <property name="rules_hint">False</property>
+ <property name="reorderable">False</property>
+ <property name="enable_search">True</property>
+ <property name="fixed_height_mode">False</property>
+ <property name="hover_selection">False</property>
+ <property name="hover_expand">False</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="tab_expand">False</property>
+ <property name="tab_fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label92399">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;small&gt;_2.Tracks&lt;/small&gt;</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">hpaned1</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="type">tab</property>
+ </packing>
+ </child>
+
+ <child>
<widget class="GtkVBox" id="vbox211">
<property name="visible">True</property>
<property name="homogeneous">False</property>
@@ -2866,7 +2918,7 @@ Notes:</property>
<child>
<widget class="GtkLabel" id="sideboxnotebookfindlabel">
<property name="visible">True</property>
- <property name="label" translatable="yes">&lt;small&gt;_2.Results&lt;/small&gt;</property>
+ <property name="label" translatable="yes">&lt;small&gt;_3.Results&lt;/small&gt;</property>
<property name="use_underline">True</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -2893,415 +2945,6 @@ Notes:</property>
<property name="fill">True</property>
</packing>
</child>
-
- <child>
- <widget class="GtkFrame" id="frame61">
- <property name="label_xalign">0.5</property>
- <property name="label_yalign">0.5</property>
- <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
-
- <child>
- <widget class="GtkVBox" id="gpstabvbox">
- <property name="border_width">4</property>
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">8</property>
-
- <child>
- <widget class="GtkHBox" id="gpsstatushbox">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">4</property>
-
- <child>
- <widget class="GtkLabel" id="speedlabel">
- <property name="width_request">90</property>
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;span font_desc='32'&gt;199&lt;/span&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</property>
- <property name="justify">GTK_JUSTIFY_RIGHT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">1</property>
- <property name="yalign">1</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="speedunitslabel">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;span font_desc=&quot;12&quot;&gt;MPH&lt;/span&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.899999976158</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label92242">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkEventBox" id="eventbox11">
- <property name="visible">True</property>
- <property name="tooltip" translatable="yes">GPS signal strength (higher is better)</property>
- <property name="visible_window">True</property>
- <property name="above_child">False</property>
-
- <child>
- <widget class="GtkProgressBar" id="gpssignalprogressbar">
- <property name="height_request">50</property>
- <property name="visible">True</property>
- <property name="orientation">GTK_PROGRESS_BOTTOM_TO_TOP</property>
- <property name="fraction">0</property>
- <property name="pulse_step">0</property>
- <property name="text" translatable="yes"></property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkExpander" id="expander2">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="expanded">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkAlignment" id="alignment62">
- <property name="visible">True</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xscale">1</property>
- <property name="yscale">1</property>
- <property name="top_padding">0</property>
- <property name="bottom_padding">0</property>
- <property name="left_padding">4</property>
- <property name="right_padding">0</property>
-
- <child>
- <widget class="GtkVBox" id="gpsoptionsvbox">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkCheckButton" id="gpsshowpositioncheckbutton">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- <signal name="toggled" handler="mainwindow_on_gps_show_position_toggled" last_modification_time="Sun, 20 Mar 2005 06:20:04 GMT"/>
-
- <child>
- <widget class="GtkLabel" id="label92256">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;span size=&quot;small&quot;&gt;_Show position on map&lt;/span&gt;</property>
- <property name="use_underline">True</property>
- <property name="use_markup">True</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkFrame" id="frame31">
- <property name="visible">True</property>
- <property name="label_xalign">0</property>
- <property name="label_yalign">0.5</property>
- <property name="shadow_type">GTK_SHADOW_NONE</property>
-
- <child>
- <widget class="GtkAlignment" id="alignment63">
- <property name="visible">True</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xscale">1</property>
- <property name="yscale">1</property>
- <property name="top_padding">0</property>
- <property name="bottom_padding">0</property>
- <property name="left_padding">8</property>
- <property name="right_padding">0</property>
-
- <child>
- <widget class="GtkVBox" id="vbox8864">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">4</property>
-
- <child>
- <widget class="GtkCheckButton" id="gpskeeppositioncenteredcheckbutton">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- <signal name="toggled" handler="mainwindow_on_gps_keep_position_centered_toggled" last_modification_time="Sun, 20 Mar 2005 06:23:34 GMT"/>
-
- <child>
- <widget class="GtkLabel" id="label92257">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;span size=&quot;small&quot;&gt;Keep position _centered&lt;/span&gt;</property>
- <property name="use_underline">True</property>
- <property name="use_markup">True</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkCheckButton" id="gpsshowtrailcheckbutton">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- <signal name="toggled" handler="mainwindow_on_gps_show_trail_toggled" last_modification_time="Sun, 20 Mar 2005 06:20:50 GMT"/>
-
- <child>
- <widget class="GtkLabel" id="label92258">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;span size=&quot;small&quot;&gt;Show GPS _trail&lt;/span&gt;</property>
- <property name="use_underline">True</property>
- <property name="use_markup">True</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkCheckButton" id="gpssticktoroadscheckbutton">
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_focus">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- <signal name="toggled" handler="mainwindow_on_gps_stick_to_roads_toggled" last_modification_time="Sun, 20 Mar 2005 06:21:05 GMT"/>
-
- <child>
- <widget class="GtkLabel" id="label92259">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;span size=&quot;small&quot;&gt;Stick to Roads&lt;/span&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label92240">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;span size=&quot;smaller&quot;&gt;GPS Settings&lt;/span&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="type">label_item</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">GTK_PACK_END</property>
- </packing>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label92395">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;b&gt;GPS&lt;/b&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">4</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="type">label_item</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
</widget>
<packing>
<property name="shrink">False</property>
@@ -3325,7 +2968,6 @@ Notes:</property>
<child>
<widget class="GtkVBox" id="statusbar">
- <property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
@@ -3500,10 +3142,10 @@ Notes:</property>
</child>
</widget>
-<widget class="GtkWindow" id="_____gps_tab__not_in_preview">
+<widget class="GtkWindow" id="_____gpswindow__not_in_preview">
<property name="title" translatable="yes">Roadster GPS</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
- <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="window_position">GTK_WIN_POS_CENTER</property>
<property name="modal">False</property>
<property name="resizable">False</property>
<property name="destroy_with_parent">False</property>
@@ -3515,7 +3157,405 @@ Notes:</property>
<property name="focus_on_map">True</property>
<child>
- <placeholder/>
+ <widget class="GtkVBox" id="gpstabvbox">
+ <property name="border_width">4</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">8</property>
+
+ <child>
+ <widget class="GtkVBox" id="vbox8934">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox107">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">4</property>
+
+ <child>
+ <widget class="GtkProgressBar" id="gpssignalprogressbar">
+ <property name="height_request">50</property>
+ <property name="visible">True</property>
+ <property name="orientation">GTK_PROGRESS_BOTTOM_TO_TOP</property>
+ <property name="fraction">0</property>
+ <property name="pulse_step">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ </widget>
+ <packing>
+ <property name="padding">2</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="gpsstatushbox">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">4</property>
+
+ <child>
+ <widget class="GtkLabel" id="label92242">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="speedlabel">
+ <property name="width_request">70</property>
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;span font_desc=&quot;24&quot;&gt;199&lt;/span&gt;</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_RIGHT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">1</property>
+ <property name="yalign">1</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="speedunitslabel">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;span font_desc=&quot;12&quot;&gt;MPH&lt;/span&gt;</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.899999976158</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkExpander" id="expander2">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="expanded">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkAlignment" id="alignment108">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">1</property>
+ <property name="yscale">1</property>
+ <property name="top_padding">0</property>
+ <property name="bottom_padding">0</property>
+ <property name="left_padding">2</property>
+ <property name="right_padding">0</property>
+
+ <child>
+ <widget class="GtkVBox" id="gpsoptionsvbox">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkCheckButton" id="gpsshowpositioncheckbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">False</property>
+ <property name="active">True</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="mainwindow_on_gps_show_position_toggled" last_modification_time="Sun, 20 Mar 2005 06:20:04 GMT"/>
+
+ <child>
+ <widget class="GtkLabel" id="label92256">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;span size=&quot;small&quot;&gt;_Show my position on the map&lt;/span&gt;</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkFrame" id="frame31">
+ <property name="visible">True</property>
+ <property name="label_xalign">0</property>
+ <property name="label_yalign">0.5</property>
+ <property name="shadow_type">GTK_SHADOW_NONE</property>
+
+ <child>
+ <widget class="GtkAlignment" id="alignment63">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">1</property>
+ <property name="yscale">1</property>
+ <property name="top_padding">0</property>
+ <property name="bottom_padding">0</property>
+ <property name="left_padding">8</property>
+ <property name="right_padding">0</property>
+
+ <child>
+ <widget class="GtkVBox" id="vbox8864">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">4</property>
+
+ <child>
+ <widget class="GtkCheckButton" id="gpskeeppositioncenteredcheckbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">False</property>
+ <property name="active">True</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="mainwindow_on_gps_keep_position_centered_toggled" last_modification_time="Sun, 20 Mar 2005 06:23:34 GMT"/>
+
+ <child>
+ <widget class="GtkLabel" id="label92257">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;span size=&quot;small&quot;&gt;Keep position _centered&lt;/span&gt;</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCheckButton" id="gpsshowtrailcheckbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">False</property>
+ <property name="active">True</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="mainwindow_on_gps_show_trail_toggled" last_modification_time="Sun, 20 Mar 2005 06:20:50 GMT"/>
+
+ <child>
+ <widget class="GtkLabel" id="label92258">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;span size=&quot;small&quot;&gt;Show GPS _trail&lt;/span&gt;</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCheckButton" id="gpssticktoroadscheckbutton">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">False</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="mainwindow_on_gps_stick_to_roads_toggled" last_modification_time="Sun, 20 Mar 2005 06:21:05 GMT"/>
+
+ <child>
+ <widget class="GtkLabel" id="label92259">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;span size=&quot;small&quot;&gt;Stick to Roads&lt;/span&gt;</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label92405">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;span size=&quot;small&quot;&gt;&lt;b&gt;GPS Options&lt;/b&gt;&lt;/span&gt;</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="type">label_item</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHSeparator" id="hseparator14">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ </packing>
+ </child>
+ </widget>
</child>
</widget>
diff --git a/roadster.spec b/roadster.spec
new file mode 100644
index 0000000..9153697
--- /dev/null
+++ b/roadster.spec
@@ -0,0 +1,52 @@
+# Define ndiswrapper_version only if it is not already defined.
+%{!?roadster_version: %define roadster_version 0.3.7PR}
+%{!?roadster_release: %define roadster_release 1}
+
+Summary: roadster allows you to view and navigate the US without the internet.
+Name: roadster
+Version: %{roadster_version}
+Release: %{roadster_release}
+License: GPL
+Group: System Environment/Base
+URL: http://linuxadvocate.org/projects/roadster/
+Source: %{name}-%{version}.tar.gz
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+BuildRequires: mysql-devel gtk2 automake autoconf
+Requires: gtk2
+
+%description
+This package allows you to navigate the US and view a roadmap
+for any arbitrary place.
+
+%prep
+%setup -q
+./autogen.sh --prefix='/usr'
+
+%build
+make
+
+%install
+
+%define inst_dir $RPM_BUILD_ROOT%{_inst_dir}
+%define sbindir $RPM_BUILD_ROOT%{_sbinrootdir}
+%define usrsbindir $RPM_BUILD_ROOT%{_sbindir}
+%define mandir $RPM_BUILD_ROOT%{_mandir}
+
+rm -rf $RPM_BUILD_ROOT
+make install DESTDIR=$RPM_BUILD_ROOT INST_DIR=%{inst_dir} sbindir=%{sbindir} usrsbindir=%{usrsbindir} mandir=%{mandir}
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(0755,root,root)
+%{_bindir}/roadster
+%{_datadir}/pixmaps/roadster-icon.png
+%{_datadir}/roadster/layers.xml
+%{_datadir}/roadster/roadster.glade
+%{_datadir}/applications/roadster.desktop
+%doc README
+
+%changelog
+* Tue Oct 11 2005 Ofer Achler <ofer.achler+ROADSTER@gmail.com> -
+- First release of roadster spec file
diff --git a/src/Makefile.am b/src/Makefile.am
index 2056ead..a7e1ec6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -46,6 +46,7 @@ roadster_SOURCES = \
search_road.c\
search_location.c\
search_city.c\
+ search_coordinate.c\
search.c\
scenemanager.c\
glyph.c\
diff --git a/src/db.c b/src/db.c
index df8ac08..83edf36 100644
--- a/src/db.c
+++ b/src/db.c
@@ -401,6 +401,29 @@ gboolean db_city_get_id(const gchar* pszName, gint nStateID, gint* pnReturnID)
return FALSE;
}
+gboolean db_city_get_name(gint nCityID, gchar** ppszReturnName)
+{
+ g_assert(ppszReturnName != NULL);
+
+ // create SQL
+ gchar* pszSQL = g_strdup_printf("SELECT City.Name FROM City WHERE ID='%d';", nCityID);
+
+ // try query
+ db_resultset_t* pResultSet = NULL;
+ db_row_t aRow;
+ db_query(pszSQL, &pResultSet);
+ g_free(pszSQL);
+ // get result?
+ if(pResultSet) {
+ if((aRow = db_fetch_row(pResultSet)) != NULL) {
+ *ppszReturnName = g_strdup(aRow[0]);
+ }
+ db_free_result(pResultSet);
+ return TRUE;
+ }
+ return FALSE;
+}
+
gboolean db_insert_city(const gchar* pszName, gint nStateID, gint* pnReturnCityID)
{
gint nCityID = 0;
diff --git a/src/db.h b/src/db.h
index e54d698..dd1e3a4 100644
--- a/src/db.h
+++ b/src/db.h
@@ -89,6 +89,8 @@ gboolean db_insert_road(gint nLOD, gint nRoadNameID, gint nLayerType, gint nAddr
gboolean db_city_get_id(const gchar* pszName, gint nStateID, gint* pnReturnID);
gboolean db_state_get_id(const gchar* pszName, gint* pnReturnID);
+gboolean db_city_get_name(gint nCityID, gchar** ppszReturnName);
+
void db_lock(void);
void db_unlock(void);
diff --git a/src/mainwindow.c b/src/mainwindow.c
index 8f3aaa9..6c1b18f 100644
--- a/src/mainwindow.c
+++ b/src/mainwindow.c
@@ -58,6 +58,8 @@
#define PROGRAM_DESCRIPTION "Mapping for everyone!"
#define WEBSITE_URL "http://linuxadvocate.org/projects/roadster"
+//#define ENABLE_MAP_TOOLTIP
+
#define MAP_STYLE_FILENAME ("layers.xml")
// how long after stopping various movements should we redraw in high-quality mode
@@ -557,10 +559,11 @@ void mainwindow_refresh_locationset_list()
// Fill locationset list with live data
const GPtrArray* pLocationSetArray = locationset_get_array();
- gint i;
+ g_debug("%d locationsets", pLocationSetArray->len);
gtk_list_store_clear(g_MainWindow.pLocationSetsListStore);
+ gint i;
for(i=0 ; i<pLocationSetArray->len ; i++) {
locationset_t* pLocationSet = g_ptr_array_index(pLocationSetArray, i);
@@ -627,8 +630,9 @@ void mainwindow_set_draw_pretty_timeout(gint nTimeoutInMilliseconds)
g_MainWindow.nDrawPrettyTimeoutID = g_timeout_add(nTimeoutInMilliseconds, mainwindow_on_draw_pretty_timeout, NULL);
g_assert(g_MainWindow.nDrawPrettyTimeoutID != 0);
}
+
//
-// the "scroll" timeout
+// the scroll timeout
//
void mainwindow_scroll_direction(EDirection eScrollDirection, gint nPixels)
{
@@ -1159,6 +1163,7 @@ static gboolean mainwindow_on_mouse_button_click(GtkWidget* w, GdkEventButton *e
g_MainWindow.bMouseDragMovement = FALSE;
g_MainWindow.ptClickLocation.nX = nX;
g_MainWindow.ptClickLocation.nY = nY;
+ tooltip_hide(g_MainWindow.pTooltip);
}
else if(event->type == GDK_BUTTON_RELEASE) {
if(g_MainWindow.bMouseDragging == TRUE) {
@@ -1251,6 +1256,7 @@ static gboolean mainwindow_on_mouse_motion(GtkWidget* w, GdkEventMotion *event)
EDirection eScrollDirection = util_match_border(nX, nY, nWidth, nHeight, BORDER_SCROLL_CLICK_TARGET_SIZE);
if(eScrollDirection == DIRECTION_NONE) {
+#ifdef ENABLE_MAP_TOOLTIP
// get mouse position on screen
screenpoint_t screenpoint;
screenpoint.nX = nX;
@@ -1307,6 +1313,7 @@ static gboolean mainwindow_on_mouse_motion(GtkWidget* w, GdkEventMotion *event)
// no hit. hide the tooltip
tooltip_hide(g_MainWindow.pTooltip);
}
+#endif
}
else {
nCursor = g_aDirectionCursors[eScrollDirection].nCursor;
@@ -1503,20 +1510,22 @@ static gint mainwindow_on_configure_event(GtkWidget *pDrawingArea, GdkEventConfi
return TRUE;
}
-static gboolean mainwindow_on_expose_event(GtkWidget *pDrawingArea, GdkEventExpose *event, gpointer data)
+static gboolean mainwindow_on_expose_event(GtkWidget *_unused, GdkEventExpose *pEvent, gpointer __unused)
{
- GdkPixmap* pMapPixmap = map_get_pixmap(g_MainWindow.pMap);
+ if(pEvent->count > 0) return FALSE;
- // Copy relevant portion of off-screen bitmap to window
- gdk_draw_drawable(GTK_WIDGET(g_MainWindow.pDrawingArea)->window,
- GTK_WIDGET(g_MainWindow.pDrawingArea)->style->fg_gc[GTK_WIDGET_STATE(g_MainWindow.pDrawingArea)],
- pMapPixmap,
- event->area.x, event->area.y,
- event->area.x, event->area.y,
- event->area.width, event->area.height);
+ GdkPixmap* pMapPixmap = map_get_pixmap(g_MainWindow.pMap);
- map_release_pixmap(g_MainWindow.pMap);
- return FALSE;
+ // Copy relevant portion of off-screen bitmap to window
+ gdk_draw_drawable(GTK_WIDGET(g_MainWindow.pDrawingArea)->window,
+ GTK_WIDGET(g_MainWindow.pDrawingArea)->style->fg_gc[GTK_WIDGET_STATE(g_MainWindow.pDrawingArea)],
+ pMapPixmap,
+ pEvent->area.x, pEvent->area.y,
+ pEvent->area.x, pEvent->area.y,
+ pEvent->area.width, pEvent->area.height);
+
+ map_release_pixmap(g_MainWindow.pMap);
+ return FALSE;
}
/*
@@ -1524,7 +1533,10 @@ static gboolean mainwindow_on_expose_event(GtkWidget *pDrawingArea, GdkEventExpo
*/
void mainwindow_on_gps_show_position_toggled(GtkWidget* _unused, gpointer* __unused)
{
-
+ gboolean bShowPosition = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(g_MainWindow.GPS.pShowPositionCheckButton));
+ gtk_widget_set_sensitive(GTK_WIDGET(g_MainWindow.GPS.pKeepPositionCenteredCheckButton), bShowPosition == TRUE);
+ gtk_widget_set_sensitive(GTK_WIDGET(g_MainWindow.GPS.pShowTrailCheckButton), bShowPosition == TRUE);
+ gtk_widget_set_sensitive(GTK_WIDGET(g_MainWindow.GPS.pStickToRoadsCheckButton), FALSE); // XXX: for now.
}
void mainwindow_on_gps_keep_position_centered_toggled(GtkWidget* _unused, gpointer* __unused)
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 5d3d6a0..df64011 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -80,8 +80,9 @@ void mainwindow_add_history();
void mainwindow_scroll_direction(EDirection eScrollDirection, gint nPixels);
#define SIDEBAR_TAB_LOCATIONSETS 0
-//#define SIDEBAR_TAB_TRACKS 1
-#define SIDEBAR_TAB_SEARCH_RESULTS 1
+#define SIDEBAR_TAB_TRACKS 1
+//#define SIDEBAR_TAB_GPS 2
+#define SIDEBAR_TAB_SEARCH_RESULTS 2
void mainwindow_sidebar_set_tab(gint nTab);
diff --git a/src/map_draw_cairo.c b/src/map_draw_cairo.c
index cc6a5df..8ee22b2 100644
--- a/src/map_draw_cairo.c
+++ b/src/map_draw_cairo.c
@@ -66,7 +66,6 @@ static void map_draw_cairo_layer_road_labels(map_t* pMap, cairo_t* pCairo, rende
static void map_draw_cairo_layer_polygon_labels(map_t* pMap, cairo_t* pCairo, rendermetrics_t* pRenderMetrics, GPtrArray* pRoadsArray, maplayerstyle_t* pLayerStyle);
// Draw a single line/polygon/point
-static void map_draw_cairo_background(map_t* pMap, cairo_t *pCairo);
static void map_draw_cairo_layer_points(map_t* pMap, cairo_t* pCairo, rendermetrics_t* pRenderMetrics, GPtrArray* pLocationsArray);
//static void map_draw_cairo_locationset(map_t* pMap, cairo_t *pCairo, rendermetrics_t* pRenderMetrics, locationset_t* pLocationSet, GPtrArray* pLocationsArray);
//static void map_draw_cairo_locationselection(map_t* pMap, cairo_t *pCairo, rendermetrics_t* pRenderMetrics, GPtrArray* pLocationSelectionArray);
@@ -121,6 +120,7 @@ void map_draw_cairo(map_t* pMap, GPtrArray* pTiles, rendermetrics_t* pRenderMetr
gdk_drawable_get_size (pPixmap, &width, &height);
cairo_surface_t *pSurface = cairo_xlib_surface_create (dpy, drawable, visual, width, height);
cairo_t* pCairo = cairo_create (pSurface);
+ cairo_set_miter_limit(pCairo, 10);
// cairo_set_antialias(pCairo, CAIRO_ANTIALIAS_GRAY); // CAIRO_ANTIALIAS_DEFAULT, CAIRO_ANTIALIAS_NONE, CAIRO_ANTIALIAS_GRAY, CAIRO_ANTIALIAS_SUBPIXEL
diff --git a/src/mapinfowindow.c b/src/mapinfowindow.c
index 74bf566..ed76807 100644
--- a/src/mapinfowindow.c
+++ b/src/mapinfowindow.c
@@ -32,6 +32,13 @@
#include "util.h"
#include "db.h"
+#define MSG_NO_COUNTRY ("<i>Select Country</i>")
+#define MSG_NO_STATE ("<i>Select State</i>")
+#define MSG_NO_CITY ("<i>Select City</i>")
+#define MSG_COUNTRY ("<b>%s</b>")
+#define MSG_STATE ("<b>%s</b>")
+#define MSG_CITY ("<b>%s</b>")
+
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
@@ -54,35 +61,23 @@ struct {
gint nCurrentCityID;
} g_MapInfoWindow = {0};
-static void mapinfowindow_load_cities(gint nStateID);
-static void mapinfowindow_load_states(gint nCountryID);
+static void mapinfowindow_on_country_chosen(GtkMenuItem* pMenuItem, gint nCountryID);
+static void mapinfowindow_on_state_chosen(GtkMenuItem* pMenuItem, gint nStateID);
+static void mapinfowindow_on_city_chosen(GtkMenuItem* pMenuItem, gint nCityID);
-static void mapinfowindow_on_country_button_clicked(GtkWidget* _unused, gpointer __unused)
-{
- if(g_MapInfoWindow.nCurrentCountryID != 0) {
- g_debug("recentering on countryID %d", g_MapInfoWindow.nCurrentCountryID);
- }
-}
+static void mapinfowindow_on_state_button_clicked(GtkWidget* _unused, gpointer __unused);
+static void mapinfowindow_on_city_button_clicked(GtkWidget* _unused, gpointer __unused);
+static void mapinfowindow_on_country_button_clicked(GtkWidget* _unused, gpointer __unused);
-static void mapinfowindow_on_state_button_clicked(GtkWidget* _unused, gpointer __unused)
-{
- if(g_MapInfoWindow.nCurrentStateID != 0) {
- g_debug("recentering on StateID %d", g_MapInfoWindow.nCurrentStateID);
- }
-}
-
-static void mapinfowindow_on_city_button_clicked(GtkWidget* _unused, gpointer __unused)
-{
- if(g_MapInfoWindow.nCurrentCityID != 0) {
- g_debug("recentering on cityID %d", g_MapInfoWindow.nCurrentCityID);
- }
-}
+static void mapinfowindow_load_countries();
+static void mapinfowindow_load_cities(gint nStateID);
+static void mapinfowindow_load_states(gint nCountryID);
void mapinfowindow_init(GladeXML* pGladeXML)
{
GLADE_LINK_WIDGET(pGladeXML, g_MapInfoWindow.pCountryButton, GTK_MENU_TOOL_BUTTON, "countrybutton");
GLADE_LINK_WIDGET(pGladeXML, g_MapInfoWindow.pStateButton, GTK_MENU_TOOL_BUTTON, "statebutton");
- GLADE_LINK_WIDGET(pGladeXML, g_MapInfoWindow.pCityButton, GTK_MENU_TOOL_BUTTON, "citybutton");
+ GLADE_LINK_WIDGET(pGladeXML, g_MapInfoWindow.pCityButton, GTK_MENU_TOOL_BUTTON, "citybutton");
g_MapInfoWindow.pCountryLabel = GTK_LABEL(gtk_label_new("")); gtk_widget_show(GTK_WIDGET(g_MapInfoWindow.pCountryLabel));
g_MapInfoWindow.pStateLabel = GTK_LABEL(gtk_label_new("")); gtk_widget_show(GTK_WIDGET(g_MapInfoWindow.pStateLabel));
@@ -99,6 +94,8 @@ void mapinfowindow_init(GladeXML* pGladeXML)
g_MapInfoWindow.nCurrentCountryID = -1; //
g_MapInfoWindow.nCurrentStateID = -1;
g_MapInfoWindow.nCurrentCityID = -1;
+
+ mapinfowindow_load_countries();
}
void mapinfowindow_update(const map_t* pMap)
@@ -108,7 +105,7 @@ void mapinfowindow_update(const map_t* pMap)
gint nNewStateID = 0;
gint nNewCityID = 0;
- gint nZoomScale = map_get_scale(pMap);
+// gint nZoomScale = map_get_scale(pMap);
// Step 2. Set button text and drop-down menus
@@ -119,14 +116,14 @@ void mapinfowindow_update(const map_t* pMap)
// If we are now too high up to have a country selected, we clear the country label and
// hide the state list (of course, the state is 0 too, so
if(nNewCountryID == 0) {
- gtk_label_set_markup(g_MapInfoWindow.pCountryLabel, "<i>Country</i>");
+ gtk_label_set_markup(g_MapInfoWindow.pCountryLabel, MSG_NO_COUNTRY);
// hide state list
gtk_widget_hide(GTK_WIDGET(g_MapInfoWindow.pStateButton));
}
else {
// XXX: Set new country button text
- gchar* pszLabel = g_strdup_printf("<b>%s</b>", "United States");
+ gchar* pszLabel = g_strdup_printf(MSG_COUNTRY, "United States");
gtk_label_set_markup(g_MapInfoWindow.pCountryLabel, pszLabel);
g_free(pszLabel);
@@ -141,7 +138,7 @@ void mapinfowindow_update(const map_t* pMap)
//
if(nNewStateID != g_MapInfoWindow.nCurrentStateID) {
if(nNewStateID == 0) {
- gtk_label_set_markup(g_MapInfoWindow.pStateLabel, "<i>State</i>");
+ gtk_label_set_markup(g_MapInfoWindow.pStateLabel, MSG_NO_STATE);
// hide city list
gtk_widget_hide(GTK_WIDGET(g_MapInfoWindow.pCityButton));
@@ -162,24 +159,70 @@ void mapinfowindow_update(const map_t* pMap)
if(nNewCityID != g_MapInfoWindow.nCurrentCityID) {
if(nNewCityID == 0) {
// XXX: Set new city button text
- gtk_label_set_markup(g_MapInfoWindow.pCityLabel, "<i>City</i>");
- }
- else {
- // XXX: Set new city button text
- gtk_label_set_markup(g_MapInfoWindow.pCityLabel, "<b>City</b>");
+ gtk_label_set_markup(g_MapInfoWindow.pCityLabel, MSG_NO_CITY);
}
g_MapInfoWindow.nCurrentCityID = nNewCityID;
}
}
-static void mapinfowindow_on_city_chosen(GtkWidget* _unused, gint nCityID)
+static void mapinfowindow_load_countries()
{
- g_debug("centering on CityID %d", nCityID);
+ // New menu
+ if(g_MapInfoWindow.pCountryMenu) {
+ gtk_widget_destroy(GTK_WIDGET(g_MapInfoWindow.pCountryMenu));
+ }
+ g_MapInfoWindow.pCountryMenu = GTK_MENU(gtk_menu_new());
+
+ // LOAD AND LOOP
+ {
+ gchar* pszCountryName = "United States";
+ gint nID = 1;
+
+ GtkMenuItem* pNewMenuItem = GTK_MENU_ITEM(gtk_menu_item_new_with_mnemonic(pszCountryName));
+ g_signal_connect(G_OBJECT(pNewMenuItem), "activate", (GCallback)mapinfowindow_on_country_chosen, (gpointer)nID);
+
+ gtk_menu_shell_append(GTK_MENU_SHELL(g_MapInfoWindow.pCountryMenu), GTK_WIDGET(pNewMenuItem));
+ }
+
+ // Install new menu
+ gtk_widget_show_all(GTK_WIDGET(g_MapInfoWindow.pCountryMenu));
+ gtk_menu_tool_button_set_menu(g_MapInfoWindow.pCountryButton, GTK_WIDGET(g_MapInfoWindow.pCountryMenu));
}
-static void mapinfowindow_on_state_chosen(GtkWidget* _unused, gint nStateID)
+static void mapinfowindow_load_states(gint nCountryID)
{
- g_debug("centering on nStateID %d", nStateID);
+ db_resultset_t* pResultSet = NULL;
+ db_row_t aRow;
+
+ //
+ // Load up all states for this country
+ //
+ gchar* pszSQL = g_strdup_printf("SELECT State.ID, State.Name FROM State WHERE CountryID=%d ORDER BY Name ASC;", nCountryID);
+ db_query(pszSQL, &pResultSet);
+ g_free(pszSQL);
+ g_return_if_fail(pResultSet != NULL);
+
+ // New menu
+ if(g_MapInfoWindow.pStateMenu) {
+ gtk_widget_destroy(GTK_WIDGET(g_MapInfoWindow.pStateMenu));
+ }
+ g_MapInfoWindow.pStateMenu = GTK_MENU(gtk_menu_new());
+
+ // Fill menu
+ while((aRow = db_fetch_row(pResultSet)) != NULL) {
+ gint nID = atoi(aRow[0]);
+ gchar* pszName = aRow[1];
+
+ // Add new menu item
+ GtkMenuItem* pNewMenuItem = GTK_MENU_ITEM(gtk_menu_item_new_with_mnemonic(pszName));
+ g_signal_connect(G_OBJECT(pNewMenuItem), "activate", (GCallback)mapinfowindow_on_state_chosen, (gpointer)nID);
+ gtk_menu_shell_append(GTK_MENU_SHELL(g_MapInfoWindow.pStateMenu), GTK_WIDGET(pNewMenuItem));
+ }
+ db_free_result(pResultSet);
+
+ // Install new menu
+ gtk_widget_show_all(GTK_WIDGET(g_MapInfoWindow.pStateMenu));
+ gtk_menu_tool_button_set_menu(g_MapInfoWindow.pStateButton, GTK_WIDGET(g_MapInfoWindow.pStateMenu));
}
static void mapinfowindow_load_cities(gint nStateID)
@@ -193,7 +236,7 @@ static void mapinfowindow_load_cities(gint nStateID)
gchar* pszSQL = g_strdup_printf("SELECT City.ID, City.Name FROM City WHERE StateID=%d ORDER BY Name ASC;", nStateID);
db_query(pszSQL, &pResultSet);
g_free(pszSQL);
- if(pResultSet == NULL) return;
+ g_return_if_fail(pResultSet != NULL);
// New menu
if(g_MapInfoWindow.pCityMenu) {
@@ -206,9 +249,9 @@ static void mapinfowindow_load_cities(gint nStateID)
gint nCityID = atoi(aRow[0]);
gchar* pszName = aRow[1];
+ // Add new menu item
GtkMenuItem* pNewMenuItem = GTK_MENU_ITEM(gtk_menu_item_new_with_mnemonic(pszName));
g_signal_connect(G_OBJECT(pNewMenuItem), "activate", (GCallback)mapinfowindow_on_city_chosen, (gpointer)nCityID);
-
gtk_menu_shell_append(GTK_MENU_SHELL(g_MapInfoWindow.pCityMenu), GTK_WIDGET(pNewMenuItem));
}
db_free_result(pResultSet);
@@ -218,38 +261,88 @@ static void mapinfowindow_load_cities(gint nStateID)
gtk_menu_tool_button_set_menu(g_MapInfoWindow.pCityButton, GTK_WIDGET(g_MapInfoWindow.pCityMenu));
}
-static void mapinfowindow_load_states(gint nCountryID)
+//
+// Country
+//
+void mapinfowindow_select_country(gint nCountryID, const gchar* pszCountryMarkup)
{
- db_resultset_t* pResultSet = NULL;
- db_row_t aRow;
+ g_debug("recentering on countryID %d", nCountryID);
+ g_MapInfoWindow.nCurrentCountryID = nCountryID;
- //
- // Load up all states for this country
- //
- gchar* pszSQL = g_strdup_printf("SELECT State.ID, State.Name FROM State WHERE CountryID=%d ORDER BY Name ASC;", nCountryID);
- db_query(pszSQL, &pResultSet);
- g_free(pszSQL);
- if(pResultSet == NULL) return;
+ g_debug("clearing selection on state list");
+ gtk_label_set_markup(g_MapInfoWindow.pStateLabel, MSG_NO_STATE);
+ g_MapInfoWindow.nCurrentStateID = 0;
- // New menu
- if(g_MapInfoWindow.pStateMenu) {
- gtk_widget_destroy(GTK_WIDGET(g_MapInfoWindow.pStateMenu));
+ // Configure state and city buttons
+ mapinfowindow_load_states(nCountryID);
+ util_gtk_widget_set_visible(GTK_WIDGET(g_MapInfoWindow.pCityButton), FALSE);
+}
+
+static void mapinfowindow_on_country_button_clicked(GtkWidget* _unused, gpointer __unused)
+{
+ // re-zoom to the current country
+ mapinfowindow_select_country(g_MapInfoWindow.nCurrentCountryID, gtk_label_get_label(g_MapInfoWindow.pCountryLabel));
+}
+
+static void mapinfowindow_on_country_chosen(GtkMenuItem* pMenuItem, gint nCountryID)
+{
+ // zoom to selected country
+ gchar* pszName = g_strdup_printf(MSG_COUNTRY, util_gtk_menu_item_get_label_text(pMenuItem));
+ mapinfowindow_select_country(nCountryID, pszName);
+ g_free(pszName);
+}
+
+//
+// State
+//
+void mapinfowindow_select_state(gint nStateID, const gchar* pszStateMarkup)
+{
+ g_debug("recentering on StateID %d", g_MapInfoWindow.nCurrentStateID);
+ g_MapInfoWindow.nCurrentStateID = nStateID;
+ gtk_label_set_markup(g_MapInfoWindow.pStateLabel, pszStateMarkup);
+
+ g_debug("clearing selection on city list");
+ gtk_label_set_markup(g_MapInfoWindow.pCityLabel, MSG_NO_CITY);
+ g_MapInfoWindow.nCurrentCityID = 0;
+
+ if(nStateID != 0) {
+ // Show city button with a new list
+ g_debug("loading cities for nStateID %d", nStateID);
+ mapinfowindow_load_cities(nStateID);
+ util_gtk_widget_set_visible(GTK_WIDGET(g_MapInfoWindow.pCityButton), TRUE);
}
- g_MapInfoWindow.pStateMenu = GTK_MENU(gtk_menu_new());
+}
- // Fill menu
- while((aRow = db_fetch_row(pResultSet)) != NULL) {
- gint nID = atoi(aRow[0]);
- gchar* pszName = aRow[1];
+static void mapinfowindow_on_state_button_clicked(GtkWidget* _unused, gpointer __unused)
+{
+ // Just re-set selected state
+ mapinfowindow_select_state(g_MapInfoWindow.nCurrentStateID, gtk_label_get_label(g_MapInfoWindow.pStateLabel));
+}
- GtkMenuItem* pNewMenuItem = GTK_MENU_ITEM(gtk_menu_item_new_with_mnemonic(pszName));
- g_signal_connect(G_OBJECT(pNewMenuItem), "activate", (GCallback)mapinfowindow_on_state_chosen, (gpointer)nID);
+static void mapinfowindow_on_state_chosen(GtkMenuItem* pMenuItem, gint nStateID)
+{
+ gchar* pszName = g_strdup_printf(MSG_STATE, util_gtk_menu_item_get_label_text(pMenuItem));
+ mapinfowindow_select_state(nStateID, pszName);
+ g_free(pszName);
+}
- gtk_menu_shell_append(GTK_MENU_SHELL(g_MapInfoWindow.pStateMenu), GTK_WIDGET(pNewMenuItem));
+//
+// City
+//
+static void mapinfowindow_on_city_button_clicked(GtkWidget* _unused, gpointer __unused)
+{
+ if(g_MapInfoWindow.nCurrentCityID != 0) {
+ g_debug("recentering on cityID %d", g_MapInfoWindow.nCurrentCityID);
}
- db_free_result(pResultSet);
+}
- // Install new menu
- gtk_widget_show_all(GTK_WIDGET(g_MapInfoWindow.pStateMenu));
- gtk_menu_tool_button_set_menu(g_MapInfoWindow.pStateButton, GTK_WIDGET(g_MapInfoWindow.pStateMenu));
+static void mapinfowindow_on_city_chosen(GtkMenuItem* pMenuItem, gint nCityID)
+{
+ // Set new button text
+ gchar* pszName = g_strdup_printf(MSG_CITY, util_gtk_menu_item_get_label_text(pMenuItem));
+ gtk_label_set_markup(g_MapInfoWindow.pCityLabel, pszName);
+ g_free(pszName);
+
+ g_MapInfoWindow.nCurrentCityID = nCityID;
+ g_debug("centering on CityID %d", nCityID);
}
diff --git a/src/search.c b/src/search.c
index 608a296..f6ebee0 100644
--- a/src/search.c
+++ b/src/search.c
@@ -29,6 +29,7 @@
#include "search_road.h"
#include "search_location.h"
#include "search_city.h"
+#include "search_coordinate.h"
// functions
@@ -37,6 +38,7 @@ void search_init()
search_road_init();
search_location_init();
search_city_init();
+ search_coordinate_init();
}
// functions common to all searches
@@ -114,6 +116,7 @@ void search_all(const gchar* pszSentence)
search_city_execute(pszCleanedSentence);
search_location_execute(pszCleanedSentence);
search_road_execute(pszCleanedSentence);
+ search_coordinate_execute(pszCleanedSentence);
TIMER_END(search, "END SearchAll");
diff --git a/src/search.h b/src/search.h
index a264cc9..f7e6db8 100644
--- a/src/search.h
+++ b/src/search.h
@@ -25,7 +25,8 @@
#define _SEARCH_H
typedef enum {
- SEARCH_RESULT_TYPE_COUNTRY = 0, // in order of importance (for search results)
+ SEARCH_RESULT_TYPE_COORDINATE, // in order of importance (for search results)
+ SEARCH_RESULT_TYPE_COUNTRY,
SEARCH_RESULT_TYPE_STATE,
SEARCH_RESULT_TYPE_CITY,
SEARCH_RESULT_TYPE_LOCATION,
diff --git a/src/search_coordinate.c b/src/search_coordinate.c
new file mode 100644
index 0000000..dc5e02e
--- /dev/null
+++ b/src/search_coordinate.c
@@ -0,0 +1,88 @@
+/***************************************************************************
+ * search_coordinate.c
+ *
+ * Copyright 2005 Ian McIntosh
+ * ian_mcintosh@linuxadvocate.org
+ ****************************************************************************/
+
+/*
+ * 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
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <gtk/gtk.h>
+#include <math.h>
+#include <stdlib.h>
+
+#include "main.h"
+#include "map.h"
+#include "util.h"
+#include "search_coordinate.h"
+#include "glyph.h"
+#include "searchwindow.h" // for defines about glyph size
+
+#define COORDINATE_RESULT_SUGGESTED_ZOOMLEVEL (37) // no idea what to use for this :)
+
+#define FORMAT_COORDINATE_RESULT ("<b>Lat:</b> %10.5f\n<b>Lon:</b> %10.5f")
+
+static void search_coordinate_add_result(const mappoint_t* pPoint);
+
+//
+// globals
+//
+static glyph_t* g_SearchResultTypeCoordinateGlyph = NULL;
+
+//
+// Public API
+//
+void search_coordinate_init()
+{
+ g_SearchResultTypeCoordinateGlyph = glyph_load_at_size("search-result-type-coordinate", SEARCHWINDOW_SEARCH_RESULT_GLYPH_WIDTH, SEARCHWINDOW_SEARCH_RESULT_GLYPH_HEIGHT);
+}
+
+void search_coordinate_execute(const gchar* pszSentence)
+{
+ mappoint_t ptResult = {0};
+
+ // Goals:
+ // Make sure never to match something that could likely be a road or POI search!
+ // That said, be _as flexible as possible_ with input formats.
+
+ // Here are some examples from the web:
+ // 32° 57' N 85° 57' W
+ // 37 degrees N 123 degrees W
+ // 40 02 40
+ // 43° 28' 07" N
+ // 49:30.0-123:30.0
+ // 49.5000-123.5000
+ // h&lat=32.11611&lon=-110.94109&alt=
+
+ // And our own:
+ // Lat: 1.0, Lon: -1.0
+
+ // And of course, don't match things out of valid range (map.h has constants: MIN_LATITUDE, MAX_LATITUDE, MIN_LONGITUDE, MAX_LONGITUDE)
+
+ // Call only if we have a likely match!
+ //search_coordinate_add_result(&ptResult);
+}
+
+//
+// Private
+//
+static void search_coordinate_add_result(const mappoint_t* pPoint)
+{
+ gchar* pszBuffer = g_strdup_printf(FORMAT_COORDINATE_RESULT, pPoint->fLatitude, pPoint->fLongitude);
+ searchwindow_add_result(SEARCH_RESULT_TYPE_COORDINATE, pszBuffer, g_SearchResultTypeCoordinateGlyph, pPoint, COORDINATE_RESULT_SUGGESTED_ZOOMLEVEL);
+ g_free(pszBuffer);
+}
diff --git a/src/search_coordinate.h b/src/search_coordinate.h
new file mode 100644
index 0000000..952db06
--- /dev/null
+++ b/src/search_coordinate.h
@@ -0,0 +1,34 @@
+/***************************************************************************
+ * search_coordinate.h
+ *
+ * Copyright 2005 Ian McIntosh
+ * ian_mcintosh@linuxadvocate.org
+ ****************************************************************************/
+
+/*
+ * 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
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef _SEARCH_COORDINATE_H
+#define _SEARCH_COORDINATE_H
+
+G_BEGIN_DECLS
+
+void search_coordinate_init();
+void search_coordinate_execute(const gchar* pszSentence);
+
+G_END_DECLS
+
+#endif /* _SEARCH_COORDINATE_H */
diff --git a/src/search_road.c b/src/search_road.c
index a46f16d..12441c4 100644
--- a/src/search_road.c
+++ b/src/search_road.c
@@ -52,7 +52,6 @@ typedef struct {
#define SEARCH_RESULT_COUNT_LIMIT (400) // how many rows to get from DB
#define MAX_QUERY (4000)
-
static glyph_t* g_SearchResultTypeRoadGlyph = NULL;
void search_road_init()
diff --git a/src/searchwindow.c b/src/searchwindow.c
index 3c555d6..58c3e16 100644
--- a/src/searchwindow.c
+++ b/src/searchwindow.c
@@ -228,7 +228,7 @@ void searchwindow_on_findbutton_clicked(GtkWidget *pWidget, gpointer* p)
}
// add a result row to the list
-void searchwindow_add_result(ESearchResultType eResultType, const gchar* pszText, glyph_t* pGlyph, mappoint_t* pPoint, gint nZoomLevel)
+void searchwindow_add_result(ESearchResultType eResultType, const gchar* pszText, glyph_t* pGlyph, const mappoint_t* pPoint, gint nZoomLevel)
{
GtkTreeIter iter;
diff --git a/src/searchwindow.h b/src/searchwindow.h
index af03b9f..5f64ebe 100644
--- a/src/searchwindow.h
+++ b/src/searchwindow.h
@@ -38,7 +38,7 @@ G_BEGIN_DECLS
void searchwindow_init(GladeXML* pGladeXML);
-void searchwindow_add_result(ESearchResultType eResultType, const gchar* pszText, glyph_t* pGlyph, mappoint_t* pPoint, gint nZoomLevel);
+void searchwindow_add_result(ESearchResultType eResultType, const gchar* pszText, glyph_t* pGlyph, const mappoint_t* pPoint, gint nZoomLevel);
void searchwindow_clear_results(void);
diff --git a/src/util.c b/src/util.c
index ccc9691..c7a03bd 100644
--- a/src/util.c
+++ b/src/util.c
@@ -242,6 +242,12 @@ void util_gtk_widget_set_visible(GtkWidget* pWidget, gboolean bVisible)
}
}
+const gchar* util_gtk_menu_item_get_label_text(GtkMenuItem* pMenuItem)
+{
+ GtkLabel* pLabel = GTK_LABEL(GTK_BIN(pMenuItem)->child);
+ return gtk_label_get_text(pLabel);
+}
+
#if(!GLIB_CHECK_VERSION(2,6,0))
// This one
diff --git a/src/util.h b/src/util.h
index d5593ef..ef83fbd 100644
--- a/src/util.h
+++ b/src/util.h
@@ -66,6 +66,7 @@ gboolean util_gtk_window_is_fullscreen(GtkWindow* pWindow);
gboolean util_gtk_window_set_fullscreen(GtkWindow* pWindow, gboolean bFullscreen);
gboolean util_gtk_range_instant_set_on_value_changing_callback(GtkRange *range, GtkScrollType scroll, gdouble value, gpointer user_data);
+const gchar* util_gtk_menu_item_get_label_text(GtkMenuItem* pMenuItem);
// if glib < 2.6
#if(!GLIB_CHECK_VERSION(2,6,0))