summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan McIntosh <ian_mcintosh@linuxadvocate.org>2005-09-30 00:09:50 +0000
committerIan McIntosh <ian_mcintosh@linuxadvocate.org>2005-09-30 00:09:50 +0000
commit8491b80fabf47b54e34c5219d7f98359ccdb13da (patch)
tree7982d59c748149d03ee1dc258b9b664c060a33cb
parent626ec79ad8e52ae94bc57a2fb08704b5ca938347 (diff)
Removed "constants"-- found out that XML already has this feature!
Don't load the same image twice. Allow loading at image's native resolution. Can now fill polygons with a tiled image. Beginning support for moving POI to the layers.XML file. Add code for GtkEntry "hints". These are messages shown when there is nothing in the entry. May be used for search box.
-rw-r--r--ChangeLog7
-rw-r--r--data/help/roadster-help.xml445
-rw-r--r--data/layers.xml142
-rw-r--r--data/roadster.glade149
-rw-r--r--data/search-result-type-road.svg8
-rw-r--r--src/glyph.c106
-rw-r--r--src/glyph.h7
-rw-r--r--src/gui.c8
-rw-r--r--src/locationset.c3
-rw-r--r--src/locationset.h2
-rw-r--r--src/main.c41
-rw-r--r--src/mainwindow.c39
-rw-r--r--src/mainwindow.h4
-rw-r--r--src/map.c2
-rw-r--r--src/map.h3
-rw-r--r--src/map_draw_cairo.c2
-rw-r--r--src/map_draw_gdk.c137
-rw-r--r--src/map_style.c99
-rw-r--r--src/map_style.h11
-rw-r--r--src/road.h2
-rw-r--r--src/searchwindow.c12
-rw-r--r--src/util.c45
-rw-r--r--src/util.h3
23 files changed, 639 insertions, 638 deletions
diff --git a/ChangeLog b/ChangeLog
index e731353..bd30895 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2005-09-29 Ian McIntosh <ian_mcintosh@linuxadvocate.org>
+
+ * src/map_style.c: Removed "constants"-- found out that XML already has this feature!
+ * src/glyph.c: Don't load the same image twice. Allow loading at image's native resolution.
+ * src/map_draw_gdk.c: Can now fill polygons with a tiled image. Beginning support for moving POI to the layers.XML file.
+ * src/util.c: Add code for GtkEntry "hints". These are messages shown when there is nothing in the entry. May be used for search box.
+
2005-09-26 Ian McIntosh <ian_mcintosh@linuxadvocate.org>
* data/help/roadster-help.xml:
diff --git a/data/help/roadster-help.xml b/data/help/roadster-help.xml
index 21e478e..c12a0a6 100644
--- a/data/help/roadster-help.xml
+++ b/data/help/roadster-help.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"[
<!ENTITY legal SYSTEM "legal.xml">
<!ENTITY appversion "0.4.0">
@@ -8,25 +8,22 @@
<!ENTITY app "Roadster">
]>
-<article id="index" lang="en">
+<book id="index">
+<title>&app; Guide</title>
-<!-- =============Document Header ============================= -->
-<!-- please do not change the id; for translations, change lang to -->
-<!-- appropriate code -->
-
- <articleinfo>
- <title>&app; Manual v&manrevision;</title>
+ <bookinfo>
<copyright>
<year>2005</year>
<holder>Ian McIntosh</holder>
</copyright>
-
+
<!-- translators: uncomment this:
<copyright>
<year>2005</year>
<holder>ME-THE-TRANSLATOR (Latin translation)</holder>
</copyright>
-->
+
<publisher>
<publishername>&app; Documentation Project</publishername>
</publisher>
@@ -41,24 +38,9 @@
</affiliation>
</author>
</authorgroup>
-
+
<!-- According to GNU FDL, revision history is mandatory if you are -->
<!-- modifying/reusing someone else's document. If not, you can omit it. -->
-
- <revhistory>
-
- <!-- Remember to remove the &manrevision; entity from the revision entries
- other than the current revision. -->
-
- <revision>
- <revnumber>&app; Manual v&manrevision;</revnumber>
- <date>&date;</date>
- <revdescription>
- <para role="author">Ian McIntosh</para>
- <para role="publisher">&app; Documentation Project</para>
- </revdescription>
- </revision>
- </revhistory>
<releaseinfo>This manual describes version &appversion; of &app;.</releaseinfo>
@@ -72,292 +54,175 @@
</para>
<!-- Translators may also add here feedback address for translations -->
-
- </legalnotice>
- </articleinfo>
-
- <indexterm><primary>roadster</primary></indexterm>
-
- <!-- ============= Document Body ============================= -->
- <!-- ============= Introduction ============================== -->
- <sect1 id="intro">
- <title>Introduction</title>
- <para>
- <application>&app;</application> is desktop mapping software.
- It was designed to be fun and useful for everyone, not just
- highly technical people.
- </para>
- <para>
- This document will help you go 0 to 60 in no time.
- </para>
- </sect1>
-
- <!-- ======================Window Layout ===================== -->
- <sect1 id="window-layout">
- <title>Window Layout</title>
- <screenshot>
- <mediaobject>
- <imageobject>
- <imagedata fileref="figures/window_layout.png" format="PNG"/>
- </imageobject>
- </mediaobject>
- </screenshot>
+ </legalnotice>
+ </bookinfo>
+<!-- ============= Working with Roadster ============================== -->
+<chapter id="basics">
+ <title>Using &app;</title>
+ <highlights>
+ <para>This chapter explains the windows and XXX of &app;</para>
+ </highlights>
+
+ <section id="mainwindow">
+ <title>Main Window</title>
+ <screenshot>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="figures/window_layout.png" format="PNG"/>
+ </imageobject>
+ </mediaobject>
+ </screenshot>
<para>
- The main window. The individual parts of this window are described below.
+ The main window. The individual parts of this window are described below.
</para>
- <!-- ======================Toolbar ===================== -->
- <sect2 id="toolbar">
- <title>Toolbar</title>
-
- <para>
- The toolbar provides access to the most useful map navigation operations.
- </para>
- <itemizedlist>
- <listitem>
- <para>
- <guibutton>Back Button.</guibutton> The Back button takes you to the last place you were looking at. It works in a similar way to the Back button in your web browser.
- No matter how you move the map, clicking Back will undo the movement.
- </para>
- </listitem>
- <listitem>
- <para>
- <guibutton>Forward Button.</guibutton> After using the Back button, you can click Forward to return to where you were. It works in a similar way to the Forward button in your web browser.
- </para>
- </listitem>
- <listitem>
- <para>
- <guibutton>Zoom-Out Button.</guibutton> Zoom out one level. When you are zoomed out as far as possible, the button will be grayed out. and unavailable.
- </para>
- </listitem>
- <listitem>
- <para>
- <guibutton>Zoom Slider.</guibutton> The slider allows you to quickly zoom to any level. Click and drag the slider to zoom.
- </para>
- </listitem>
- <listitem>
- <para>
- <guibutton>Zoom-In Button.</guibutton> Zoom in one level. When you are zoomed in as far as possible, the button will be grayed out. and unavailable.
- </para>
- </listitem>
- <listitem>
- <para>
- <guibutton>Search Entry.</guibutton> Read more about how to use the search, see the section titled <link linkend="search">How to Search</link>.
- </para>
- </listitem>
- </itemizedlist>
- <note>
- <para>
- Many of the operations available on the toolbar can also be performed using <link linkend="shortcuts">Shortcut Keys</link>.
- </para>
- </note>
- </sect2>
-
- <sect2 id="sidebar">
- <title>Sidebar</title>
- <para>
- To read more about what information shows up on the sidebar and how to use it, head on over to the <link linkend="shortcuts">Using the Sidebar</link> section.
- </para>
- </sect2>
- <sect2 id="map-area">
- <title>Map Area</title>
- <para>
- insert text
- </para>
- </sect2>
-
- <sect2 id="status-bar">
- <title>Statusbar</title>
-
- <para>
- The status bar displays ...
- </para>
- </sect2>
- </sect1>
-
- <!-- ======================How to Search ===================== -->
- <sect1 id="search">
- <title>How to Search</title>
- <para>
- This section will show you how to perform searches in &app; and offers some tips for improving the results you get.
- </para>
- <sect2 id="search-basics">
- <title>Search Basics</title>
+ <section id="toolbar">
+ <title>Toolbar</title>
<para>
- To start a search, enter search words into the search box in the upper right corner of the main window, and then hit the Enter key on your keyboard. Some example searches you could try now:
+ The toolbar is the horizontal bar across the top of the &app; window. It provides access to the most useful map navigation operations:
</para>
<itemizedlist>
- <listitem>120 Main Street, Orleans, Massachusetts</listitem>
- <listitem>Buffalo Street, ND</listitem>
- <listitem>Miami</listitem>
- <listitem>Arizona</listitem>
- <listitem>90210</listitem>
+ <listitem>
+ <para>
+ <guibutton>Back Button.</guibutton> The Back button takes you to the last place you were looking at. It works in a similar way to the Back button in your web browser.
+ No matter how you move the map, clicking Back will undo the movement.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <guibutton>Forward Button.</guibutton> After using the Back button, you can click Forward to return to where you were. It works in a similar way to the Forward button in your web browser.
+ </para>
+ </listitem>
+ <listitem>
+ <para id="back-button">
+ <guibutton>Zoom-Out Button.</guibutton> Zoom out one level. When you are zoomed out as far as possible, the button will be grayed out and unavailable.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <guibutton>Zoom Slider.</guibutton> The slider allows you to quickly zoom to any level. Click and drag the slider to zoom.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <guibutton>Zoom-In Button.</guibutton> Zoom in one level. When you are zoomed in as far as possible, the button will be grayed out and unavailable.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <guibutton>Search Entry.</guibutton> Read more about searching in the section titled <link linkend="search">How to Search</link>.
+ </para>
+ </listitem>
</itemizedlist>
+ <para>To hide the toolbar, choose <menuchoice><guimenu>View</guimenu><guimenuitem>Toolbar</guimenuitem></menuchoice>. To display the
+ toolbar again, choose <menuchoice><guimenu>View</guimenu><guimenuitem>Toolbar</guimenuitem></menuchoice> again. </para>
+ </section>
+
+ <section id="sidebar">
+ <title>Sidebar</title>
<para>
- After performing a search, the <link linkend="">search results sidebar tab</link> will automatically be displayed. Click on one of the results to view the location.
+ The sidebar is the vertical bar on the right edge of the &app; window. It has three tabs:
</para>
- <note>
+ <itemizedlist>
+ <listitem>
+ <para>
+ <guibutton>1.Locations.</guibutton> The Locations list shows a list of types of Locations, and allows you to show or hide each type of Location. For example, you could
+ choose to show all Restaurants. To show a type of Location, set the checkbox next to it to "on" (checked). To hide a type of
+ Location, set the checkbox next to it to "off" (unchecked).
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <guibutton>2.Tracks.</guibutton> The Tracks tab shows a list of your Tracks, and allows you to show or hide individual Tracks. To show a Track, set
+ the checkbox next to it to "on" (checked). To hide a Track, set the checkbox next to it to "off" (unchecked).
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <guibutton>3.Results.</guibutton>
+ The Results Tab shows a list of the search results from your most recent search. Clicking on a search
+ result will move the map to show you that road or Location. Clicking the Back button on the toolbar will return you to where you previously were.
+ </para>
+ </listitem>
+ </itemizedlist>
+ <para>To hide the sidebar, choose <menuchoice><guimenu>View</guimenu><guimenuitem>Sidebar</guimenuitem></menuchoice>. To display the
+ sidebar again, choose <menuchoice><guimenu>View</guimenu><guimenuitem>Sidebar</guimenuitem></menuchoice> again. </para>
+ </section>
+
+ <section id="map-area">
+ <title>Map Area</title>
<para>
- Don't worry about losing your current spot, you can use the <guibutton>Back Button</guibutton> to return to it later.
+ XXX
</para>
- </note>
- </sect2>
- <sect2 id="finding-locations">
- <title>Finding Places</title>
+ </section>
+ </section>
+</chapter>
+
+
+<chapter id="search">
+<title>How to Search</title>
+ <highlights>
+ <para>
+ This chapter will show you how to perform searches in &app; and offers some tips for improving the results you get.
+ </para>
+ </highlights>
+
+ <section id="search-basics">
+ <title>Search Basics</title>
+
+ <section>
+ <title>Search Basics</title>
<para>
- The search box can also find places like restaurants, schools, and police stations. Try these searches:
+ To start a search, enter search words into the search box in the upper right corner of the <link linkend="mainwindow">main window</link>, and then hit the <keycap>Enter</keycap> key on your keyboard. Some example searches you could try now:
</para>
<itemizedlist>
- <listitem>pizza in Portland, OR</listitem>
- <listitem>coffee shop wifi Cambridge</listitem>
- <listitem>gas</listitem>
+ <listitem><para>120 Main Street, Orleans, Massachusetts</para></listitem>
+ <listitem><para>Buffalo Street, ND</para></listitem>
+ <listitem><para>Miami</para></listitem>
+ <listitem><para>Arizona</para></listitem>
+ <listitem><para>90210</para></listitem>
</itemizedlist>
<para>
- Notice that some searches have a city name in them. When you include a city name in your search, &app; will try to find Places in or near that city.
+ After performing a search, the search results sidebar tab will automatically be displayed. Click on one of the results to view the location.
</para>
+ <note>
+ <para>
+ Don't worry about losing your current spot, you can use the <guibutton>Back Button</guibutton> to return to it later.
+ </para>
+ </note>
+ </section>
+
+ <section>
+ <title>Searching for Locations</title>
<para>
- When you don't specify a city in your search, &app; will find Places nearby where you are currently looking.
+ The search box can also find places like restaurants, schools, and police stations. Try these searches:
</para>
- </sect2>
- <sect2 id="find-tips">
- <title>Tips</title>
<itemizedlist>
- <listitem>When searching in &app;, capitalization doesn't matter. The word PIZZA is treated the same as Pizza and even PiZZa. They will all get the same results.</listitem>
- <listitem>Punctuation like commas, quotation marks, pluses, minuses, and parentheses are ignored.</listitem>
- <listitem>Words like "in" or "near" are optional.</listitem>
- <listitem>If you get too many search results, try adding more search words.</listitem>
- <listitem>If you get too few search results, try removing one or more search words.</listitem>
+ <listitem><para>pizza in Portland, OR</para></listitem>
+ <listitem><para>coffee shop wifi Cambridge</para></listitem>
+ <listitem><para>gas</para></listitem>
</itemizedlist>
- </sect2>
- </sect1>
-
- <!-- ======================Shortcuts ===================== -->
- <sect1 id="shortcuts">
- <title>Shortcut Keys</title>
-
- <para>
- You can use the keyboard to perform all of the operations
- available in &app;. Most of these operations have a
- keyboard shortcut. The available shortcuts are listed below.
- </para>
-
- <sect2 id="file-menu-shortcuts-section">
- <title>Shortcut Table</title>
-
- <table frame="topbot" id="file-menu-shortcuts-table">
- <title></title>
- <tgroup cols="2" colsep="0" rowsep="0">
- <colspec colname="colspec0" colwidth="30*"/>
- <colspec colname="colspec1" colwidth="70*"/>
-
- <thead>
- <row rowsep="1">
- <entry valign="top">
- <para>Shortcut</para>
- </entry>
- <entry valign="top">
- <para>Description</para>
- </entry>
- </row>
- </thead>
-
- <tbody>
- <row>
- <entry colname="colspec0" valign="top">
- <para><keycap>Ctrl+T</keycap></para>
- </entry>
-
- <entry colname="colspec1" valign="top">
- <para>Show or Hide the Toolbar</para>
- </entry>
- </row>
- </tbody>
-
- <tbody>
- <row>
- <entry colname="colspec0" valign="top">
- <para><keycap>Ctrl+S</keycap></para>
- </entry>
-
- <entry colname="colspec1" valign="top">
- <para>Show or Hide the Sidebar</para>
- </entry>
- </row>
- </tbody>
-
- <tbody>
- <row>
- <entry colname="colspec0" valign="top">
- <para><keycap>Ctrl+B</keycap></para>
- </entry>
-
- <entry colname="colspec1" valign="top">
- <para>Show or Hide the Statusbar</para>
- </entry>
- </row>
- </tbody>
-
- <tbody>
- <row>
- <entry colname="colspec0" valign="top">
- <para><keycap>Ctrl+-</keycap></para>
- </entry>
-
- <entry colname="colspec1" valign="top">
- <para>Zoom Out one level</para>
- </entry>
- </row>
- </tbody>
-
- <tbody>
- <row>
- <entry colname="colspec0" valign="top">
- <para><keycap>Ctrl+=</keycap></para>
- </entry>
-
- <entry colname="colspec1" valign="top">
- <para>Zoom In one level</para>
- </entry>
- </row>
- </tbody>
-
- <tbody>
- <row>
- <entry colname="colspec0" valign="top">
- <para><keycap>Ctrl-Q</keycap></para>
- </entry>
-
- <entry colname="colspec1" valign="top">
- <para>Close &app;</para>
- </entry>
- </row>
- </tbody>
-
- </tgroup>
- </table>
<para>
- TODO: Finish this list.
+ Notice that some searches have a city name in them. When you include a city name at the end of your search words, &app; will try to find Places in or near that city.
</para>
- </sect2>
- </sect1>
-
- <!-- ======================About ===================== -->
- <sect1 id="about">
- <title>About Roadster</title>
-
- <para>
- The &app; project was started by Ian McIntosh in early 2005.
- His goal was to create a Free Software alternative to the proprietary
- mapping applications available at the time. He also hoped to make
- something more fun to use, and to provide a platform on which
- others could innovate.
- </para>
-
- <para>
- &app; is distributed under the terms of the <ulink url="ghelp:gpl" type="help">GNU General
- Public license</ulink> as published by the Free Software Foundation; either
- version 2 of the License, or any later version.
- </para>
- </sect1>
-</article>
+ <para>
+ When you don't specify a city in your search, &app; will find Places nearby where you are currently looking.
+ </para>
+ </section>
+ </section>
+
+ <section id="search-tips">
+ <title>Search Tips</title>
+ <itemizedlist>
+ <listitem><para>When searching in &app;, capitalization doesn't matter. The word PIZZA is treated the same as Pizza and even PiZZa. They will all get the same results.</para></listitem>
+ <listitem><para>Punctuation like commas, quotation marks, pluses, minuses, and parentheses are ignored.</para></listitem>
+ <listitem><para>Words like "in" or "near" are optional. They wilk not change the results you get.</para></listitem>
+ <listitem><para>If you get too many search results, try adding more search words.</para></listitem>
+ <listitem><para>If you get too few search results, try removing one or more search words.</para></listitem>
+ </itemizedlist>
+ </section>
+
+</chapter>
+
+</book>
diff --git a/data/layers.xml b/data/layers.xml
index e7fd400..1acf7de 100644
--- a/data/layers.xml
+++ b/data/layers.xml
@@ -1,16 +1,24 @@
<?xml version="1.0" standalone="no"?>
-<!DOCTYPE roadster-layers SYSTEM "http://xxx/roadster-1.0.dtd">
+<!DOCTYPE roadster-layers SYSTEM "http://xxx/roadster-1.0.dtd" [
+ <!ENTITY example "value">
+]>
<mapstyle>
-<constants>
- <constant name="shadow-color" value="#C0C0FF80" />
-</constants>
-
<layers>
#
# Labels
#
+
+<layer draw-type="locations">
+<!-- <property zoom-level="1-5" name="size" value="large" /> -->
+</layer>
+
+<layer draw-type="location-labels">
+ <property zoom-level="1-5" name="font-size" value="10" />
+ <property zoom-level="1-5" name="color" value="#000000ff" />
+</layer>
+
<layer data-source="railroads" draw-type="line-labels">
<property zoom-level="1-2" name="font-size" value="10" />
<property zoom-level="3" name="font-size" value="10" />
@@ -113,7 +121,6 @@
<property zoom-level="1-5" name="color" value="#ad8e21ff" />
</layer>
-
<layer data-source="major-roads" draw-type="lines">
<!-- major road top -->
<property zoom-level="1" name="line-width" value="6" />
@@ -121,7 +128,7 @@
<property zoom-level="3" name="line-width" value="10" />
<property zoom-level="4" name="line-width" value="15" />
<property zoom-level="5" name="line-width" value="20" />
- <property zoom-level="1-5" name="color" value="#FFFB73FF" />
+ <property zoom-level="1-5" name="color" value="#FFF384FF" />
</layer>
<layer data-source="minor-highway-ramps" draw-type="lines">
<!-- minor highway ramp top -->
@@ -134,25 +141,17 @@
</layer>
<layer data-source="minor-roads" draw-type="lines">
- <!-- minor roads dashed center lines -->
- <property zoom-level="4-5" name="line-width" value="1" />
- <property zoom-level="4-5" name="dash-pattern" value="5 10" />
- <property zoom-level="4-5" name="line-cap" value="square" />
- <property zoom-level="4-5" name="color" value="#CDCDCDff" />
-</layer>
-
-<layer data-source="minor-roads" draw-type="lines">
<!-- minor roads top -->
<property zoom-level="1" name="line-width" value="1" />
- <property zoom-level="1" name="color" value="#c0c0c0ff" />
+ <property zoom-level="1" name="color" value="#BDB294FF" />
<property zoom-level="1" name="line-cap" value="square" />
<property zoom-level="2" name="line-width" value="2" />
<property zoom-level="2" name="line-cap" value="square" />
- <property zoom-level="3" name="line-width" value="7" />
+ <property zoom-level="3" name="line-width" value="8" />
<property zoom-level="4" name="line-width" value="12" />
<property zoom-level="5" name="line-width" value="24" />
- <property zoom-level="2-5" name="color" value="#fffbffff" />
+ <property zoom-level="2-5" name="color" value="#FFFFFFFF" />
</layer>
<layer data-source="minor-highway-ramps" draw-type="lines">
<!-- minor highway ramps top -->
@@ -177,113 +176,54 @@
<layer data-source="minor-roads" draw-type="lines">
<!-- minor roads bottom -->
<property zoom-level="1" name="line-width" value="2" />
- <property zoom-level="1" name="color" value="#E0E0E0ff" />
<property zoom-level="1" name="line-cap" value="square" />
<property zoom-level="2" name="line-width" value="4" />
<property zoom-level="2" name="line-cap" value="square" />
- <property zoom-level="3" name="line-width" value="9" />
+ <property zoom-level="3" name="line-width" value="10" />
<property zoom-level="4" name="line-width" value="14" />
<property zoom-level="5" name="line-width" value="26" />
- <property zoom-level="2-5" name="color" value="#c0c0c0ff" />
-</layer>
-
-<layer data-source="minor-highways" draw-type="lines">
- <!-- minor highways shadow -->
- <property zoom-level="3" name="line-width" value="12" />
- <property zoom-level="4" name="line-width" value="15" />
- <property zoom-level="5" name="line-width" value="27" />
- <property zoom-level="3-5" name="color" value="shadow-color" />
- <property zoom-level="3-5" name="line-cap" value="round" />
- <property zoom-level="3" name="pixel-offset-x" value="2" />
- <property zoom-level="3" name="pixel-offset-y" value="2" />
- <property zoom-level="4-5" name="pixel-offset-x" value="3" />
- <property zoom-level="4-5" name="pixel-offset-y" value="3" />
-</layer>
-
-<layer data-source="major-roads" draw-type="lines">
- <!-- major roads shadow -->
- <property zoom-level="3" name="line-width" value="12" />
- <property zoom-level="4" name="line-width" value="17" />
- <property zoom-level="5" name="line-width" value="22" />
- <property zoom-level="3-5" name="color" value="shadow-color" />
- <property zoom-level="3-5" name="line-cap" value="round" />
- <property zoom-level="3" name="pixel-offset-x" value="2" />
- <property zoom-level="3" name="pixel-offset-y" value="2" />
- <property zoom-level="4-5" name="pixel-offset-x" value="3" />
- <property zoom-level="4-5" name="pixel-offset-y" value="3" />
-</layer>
-
-<layer data-source="minor-roads" draw-type="lines">
- <!-- minor roads shadow -->
- <property zoom-level="3" name="line-width" value="9" />
- <property zoom-level="4" name="line-width" value="14" />
- <property zoom-level="5" name="line-width" value="26" />
- <property zoom-level="3" name="pixel-offset-x" value="2" />
- <property zoom-level="3" name="pixel-offset-y" value="2" />
- <property zoom-level="4-5" name="pixel-offset-x" value="3" />
- <property zoom-level="4-5" name="pixel-offset-y" value="3" />
- <property zoom-level="3-5" name="color" value="shadow-color" />
- <property zoom-level="3-5" name="line-cap" value="round" />
+ <property zoom-level="2-5" name="color" value="#A59E84ff" />
</layer>
<layer data-source="railroads" draw-type="lines">
<!-- railroad dashed inner line -->
- <property zoom-level="1-2" name="line-width" value="2" />
- <property zoom-level="1-2" name="dash-pattern" value="8 8" />
-
- <property zoom-level="3" name="line-width" value="6" />
- <property zoom-level="3" name="dash-pattern" value="4 20" />
-
- <property zoom-level="4-5" name="line-width" value="3" />
- <property zoom-level="4-5" name="dash-pattern" value="4 20" />
- <property zoom-level="1-5" name="line-cap" value="square" />
- <property zoom-level="1-5" name="color" value="#B5B5B5FF" />
+ <property zoom-level="1-5" name="line-width" value="2" />
+ <property zoom-level="1-5" name="dash-pattern" value="3 4 3" />
+ <property zoom-level="1-5" name="line-cap" value="square" />
+ <property zoom-level="1-5" name="color" value="#9C9A9CFF" />
</layer>
<layer data-source="railroads" draw-type="lines">
<!-- railroad solid inner line -->
- <property zoom-level="1-2" name="line-width" value="1" />
- <property zoom-level="3-5" name="line-width" value="3" />
- <property zoom-level="1-5" name="color" value="#FCFCFCFF" />
+ <property zoom-level="1-5" name="line-width" value="1" />
+ <property zoom-level="1-5" name="color" value="#F7EBDEFF" />
</layer>
<layer data-source="railroads" draw-type="lines">
<!-- railroad solid outer line -->
- <property zoom-level="1-2" name="line-width" value="4" />
- <property zoom-level="3-5" name="line-width" value="5" />
- <property zoom-level="1-5" name="color" value="#A5A5A5FF" />
+ <property zoom-level="1-5" name="line-width" value="3" />
+ <property zoom-level="1-5" name="color" value="#9C9A9CFF" />
</layer>
<layer data-source="rivers" draw-type="lines">
- <property zoom-level="1" name="line-width" value="2" />
- <property zoom-level="2" name="line-width" value="3" />
- <property zoom-level="3" name="line-width" value="4" />
- <property zoom-level="4" name="line-width" value="5" />
- <property zoom-level="5" name="line-width" value="8" />
- <property zoom-level="1-5" name="color" value="#9cb2ceFF" />
+ <property zoom-level="1" name="line-width" value="1" />
+ <property zoom-level="2" name="line-width" value="2" />
+ <property zoom-level="3" name="line-width" value="2" />
+ <property zoom-level="4" name="line-width" value="2" />
+ <property zoom-level="5" name="line-width" value="2" />
+ <property zoom-level="1-5" name="color" value="#B5C6D6FF" />
</layer>
<layer data-source="lakes" draw-type="polygons">
- <property zoom-level="1-5" name="color" value="#9cb2ceFF" />
-</layer>
-
-<layer data-source="rivers" draw-type="lines">
- # gives a fuzzy border to lakes in non-AA render mode
- <property zoom-level="1" name="line-width" value="4" />
- <property zoom-level="2" name="line-width" value="5" />
- <property zoom-level="3" name="line-width" value="6" />
- <property zoom-level="4" name="line-width" value="7" />
- <property zoom-level="5" name="line-width" value="10" />
- <property zoom-level="1-5" name="color" value="#C0C8D5FF" />
-</layer>
-
-<layer data-source="lakes" draw-type="lines">
- # gives a fuzzy border to lakes in non-AA render mode
- <property zoom-level="1-5" name="line-width" value="3" />
- <property zoom-level="1-5" name="color" value="#C0C8D5FF" />
+ <property zoom-level="1-5" name="color" value="#B5C6D6FF" />
</layer>
<layer data-source="parks" draw-type="polygons">
- <property zoom-level="1-5" name="color" value="#afcf94ff" />
+ <property zoom-level="1-5" name="fill-image" value="park-pattern" />
+ <property zoom-level="1-5" name="color" value="#DEDBADff" />
+</layer>
+<layer data-source="parks" draw-type="lines">
+ <property zoom-level="1-5" name="line-width" value="2" />
+ <property zoom-level="1-5" name="color" value="#BEBB8Dff" />
</layer>
<layer data-source="misc-areas" draw-type="polygons">
@@ -295,7 +235,7 @@
<!-- </layer> -->
<layer draw-type="fill">
- <property zoom-level="1-5" name="color" value="#ECE6E6ff" />
+ <property zoom-level="1-5" name="color" value="#F3EDDEFF" />
</layer>
</layers>
diff --git a/data/roadster.glade b/data/roadster.glade
index 1a8d99d..25b6d2c 100644
--- a/data/roadster.glade
+++ b/data/roadster.glade
@@ -1314,7 +1314,7 @@ Banks</property>
<property name="use_underline">True</property>
<child internal-child="image">
- <widget class="GtkImage" id="image10241">
+ <widget class="GtkImage" id="image10265">
<property name="visible">True</property>
<property name="stock">gtk-open</property>
<property name="icon_size">1</property>
@@ -1347,7 +1347,7 @@ Banks</property>
<property name="use_underline">True</property>
<child internal-child="image">
- <widget class="GtkImage" id="image10242">
+ <widget class="GtkImage" id="image10266">
<property name="visible">True</property>
<property name="stock">gtk-save-as</property>
<property name="icon_size">1</property>
@@ -1374,7 +1374,7 @@ Banks</property>
<accelerator key="Q" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image10243">
+ <widget class="GtkImage" id="image10267">
<property name="visible">True</property>
<property name="stock">gtk-quit</property>
<property name="icon_size">1</property>
@@ -1424,7 +1424,6 @@ Banks</property>
<child>
<widget class="GtkCheckMenuItem" id="statusbarmenuitem">
- <property name="visible">True</property>
<property name="label" translatable="yes">Status_bar</property>
<property name="use_underline">True</property>
<property name="active">True</property>
@@ -1462,13 +1461,11 @@ Banks</property>
<child>
<widget class="GtkSeparatorMenuItem" id="separator12">
- <property name="visible">True</property>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="map_style">
- <property name="visible">True</property>
<property name="label" translatable="yes">_Map Style</property>
<property name="use_underline">True</property>
@@ -1480,7 +1477,7 @@ Banks</property>
<property name="visible">True</property>
<property name="label" translatable="yes">_Auto</property>
<property name="use_underline">True</property>
- <property name="active">True</property>
+ <property name="active">False</property>
</widget>
</child>
@@ -1499,7 +1496,7 @@ Banks</property>
<property name="visible">True</property>
<property name="label" translatable="yes">_Night Colors</property>
<property name="use_underline">True</property>
- <property name="active">False</property>
+ <property name="active">True</property>
<property name="group">auto1</property>
</widget>
</child>
@@ -1548,7 +1545,7 @@ Banks</property>
<accelerator key="Left" modifiers="GDK_MOD1_MASK" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image10244">
+ <widget class="GtkImage" id="image10268">
<property name="visible">True</property>
<property name="stock">gtk-go-back</property>
<property name="icon_size">1</property>
@@ -1571,7 +1568,7 @@ Banks</property>
<accelerator key="Right" modifiers="GDK_MOD1_MASK" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image10245">
+ <widget class="GtkImage" id="image10269">
<property name="visible">True</property>
<property name="stock">gtk-media-forward</property>
<property name="icon_size">1</property>
@@ -1596,7 +1593,7 @@ Banks</property>
<property name="label" translatable="yes">_Next Search Result</property>
<property name="use_underline">True</property>
<signal name="activate" handler="searchwindow_on_nextresultbutton_clicked" last_modification_time="Thu, 22 Sep 2005 21:16:04 GMT"/>
- <accelerator key="N" modifiers="GDK_CONTROL_MASK" signal="activate"/>
+ <accelerator key="Down" modifiers="GDK_MOD1_MASK" signal="activate"/>
</widget>
</child>
@@ -1606,7 +1603,7 @@ Banks</property>
<property name="label" translatable="yes">_Previous Search Result</property>
<property name="use_underline">True</property>
<signal name="activate" handler="searchwindow_on_previousresultbutton_clicked" last_modification_time="Thu, 22 Sep 2005 21:30:26 GMT"/>
- <accelerator key="N" modifiers="GDK_CONTROL_MASK | GDK_SHIFT_MASK" signal="activate"/>
+ <accelerator key="Up" modifiers="GDK_MOD1_MASK" signal="activate"/>
</widget>
</child>
</widget>
@@ -1625,14 +1622,13 @@ Banks</property>
<child>
<widget class="GtkImageMenuItem" id="send_and_receive_places1">
- <property name="visible">True</property>
<property name="sensitive">False</property>
<property name="label" translatable="yes">_Send / Receive</property>
<property name="use_underline">True</property>
<accelerator key="F9" modifiers="0" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image10246">
+ <widget class="GtkImage" id="image10270">
<property name="visible">True</property>
<property name="stock">gtk-refresh</property>
<property name="icon_size">1</property>
@@ -1647,7 +1643,6 @@ Banks</property>
<child>
<widget class="GtkSeparatorMenuItem" id="separator18">
- <property name="visible">True</property>
</widget>
</child>
@@ -1681,7 +1676,7 @@ Banks</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="image10247">
+ <widget class="GtkImage" id="image10271">
<property name="visible">True</property>
<property name="stock">gtk-about</property>
<property name="icon_size">1</property>
@@ -1733,7 +1728,7 @@ Banks</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="image10248">
+ <widget class="GtkImage" id="image10272">
<property name="visible">True</property>
<property name="stock">gtk-open</property>
<property name="icon_size">1</property>
@@ -1761,7 +1756,7 @@ Banks</property>
<accelerator key="F5" modifiers="0" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image10249">
+ <widget class="GtkImage" id="image10273">
<property name="visible">True</property>
<property name="stock">gtk-refresh</property>
<property name="icon_size">1</property>
@@ -1783,7 +1778,7 @@ Banks</property>
<accelerator key="F6" modifiers="0" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image10250">
+ <widget class="GtkImage" id="image10274">
<property name="visible">True</property>
<property name="stock">gtk-refresh</property>
<property name="icon_size">1</property>
@@ -1811,7 +1806,7 @@ Banks</property>
<accelerator key="g" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image10251">
+ <widget class="GtkImage" id="image10275">
<property name="visible">True</property>
<property name="stock">gtk-jump-to</property>
<property name="icon_size">1</property>
@@ -1905,22 +1900,14 @@ Banks</property>
<signal name="clicked" handler="searchwindow_on_findbutton_clicked" last_modification_time="Mon, 07 Feb 2005 09:47:42 GMT"/>
<child>
- <widget class="GtkLabel" id="label92349">
+ <widget class="GtkImage" id="image10254">
<property name="visible">True</property>
- <property name="label" translatable="yes">_Find</property>
- <property name="use_underline">True</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="stock">gtk-find</property>
+ <property name="icon_size">1</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>
@@ -1933,8 +1920,7 @@ Banks</property>
</child>
<child>
- <widget class="GtkEntry" id="entry5">
- <property name="sensitive">False</property>
+ <widget class="GtkEntry" id="searchlocationentry">
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
@@ -1943,7 +1929,7 @@ Banks</property>
<property name="has_frame">True</property>
<property name="invisible_char">*</property>
<property name="activates_default">True</property>
- <property name="width_chars">12</property>
+ <property name="width_chars">18</property>
</widget>
<packing>
<property name="padding">0</property>
@@ -1955,7 +1941,6 @@ Banks</property>
<child>
<widget class="GtkLabel" id="label92350">
- <property name="sensitive">False</property>
<property name="label" translatable="yes">near</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
@@ -1980,11 +1965,24 @@ Banks</property>
</child>
<child>
+ <widget class="GtkComboBoxEntry" id="searchcomboboxentry">
+ <property name="add_tearoffs">False</property>
+ <property name="has_frame">True</property>
+ <property name="focus_on_click">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>
+
+ <child>
<widget class="GtkEntry" id="searchentry">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Search for Places, street addresses, cities, states, or countries</property>
<property name="can_focus">True</property>
- <property name="has_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
@@ -1992,7 +1990,7 @@ Banks</property>
<property name="has_frame">True</property>
<property name="invisible_char">*</property>
<property name="activates_default">True</property>
- <property name="width_chars">17</property>
+ <property name="width_chars">20</property>
<signal name="changed" handler="searchwindow_on_searchentry_changed" last_modification_time="Sun, 25 Sep 2005 01:23:34 GMT"/>
</widget>
<packing>
@@ -2116,6 +2114,78 @@ Banks</property>
<property name="fill">False</property>
</packing>
</child>
+
+ <child>
+ <widget class="GtkSeparatorToolItem" id="separatortoolitem12">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="draw">True</property>
+ <property name="visible_horizontal">True</property>
+ <property name="visible_vertical">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkRadioButton" id="radiobutton15">
+ <property name="can_focus">True</property>
+ <property name="relief">GTK_RELIEF_NONE</property>
+ <property name="focus_on_click">False</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">False</property>
+
+ <child>
+ <widget class="GtkImage" id="image10252">
+ <property name="visible">True</property>
+ <property name="stock">gtk-about</property>
+ <property name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">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="GtkRadioButton" id="radiobutton16">
+ <property name="can_focus">True</property>
+ <property name="relief">GTK_RELIEF_NONE</property>
+ <property name="focus_on_click">False</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">False</property>
+ <property name="group">radiobutton15</property>
+
+ <child>
+ <widget class="GtkImage" id="image10253">
+ <property name="visible">True</property>
+ <property name="stock">gtk-sort-ascending</property>
+ <property name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</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>
@@ -2134,7 +2204,7 @@ Banks</property>
<widget class="GtkHPaned" id="hpaned1">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="position">1000</property>
+ <property name="position">500</property>
<child>
<widget class="GtkVBox" id="mainwindowmaparea">
@@ -2500,7 +2570,7 @@ Banks</property>
<child>
<widget class="GtkLabel" id="sideboxnotebookfindlabel">
<property name="visible">True</property>
- <property name="label" translatable="yes">&lt;small&gt;_2.Search&lt;/small&gt;</property>
+ <property name="label" translatable="yes">&lt;small&gt;_2.Results&lt;/small&gt;</property>
<property name="use_underline">True</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -2575,7 +2645,6 @@ Banks</property>
<child>
<widget class="GtkVBox" id="statusbar">
- <property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
diff --git a/data/search-result-type-road.svg b/data/search-result-type-road.svg
index e0946a8..0a33262 100644
--- a/data/search-result-type-road.svg
+++ b/data/search-result-type-road.svg
@@ -53,7 +53,7 @@
inkscape:pageopacity="0.0000000"
inkscape:pageshadow="2"
inkscape:zoom="3.8104332"
- inkscape:cx="29.444196"
+ inkscape:cx="29.444197"
inkscape:cy="9.1676075"
inkscape:current-layer="layer1"
showgrid="true"
@@ -98,18 +98,18 @@
d="M 70.914135 35.409073 A 35.322250 35.187431 0 1 1 0.26963425,35.409073 A 35.322250 35.187431 0 1 1 70.914135 35.409073 z"
transform="matrix(0.872919,0.000000,0.000000,0.872919,4.523054,4.386425)" />
<path
- style="fill:#000000;fill-opacity:1.0000000;stroke:#000000;stroke-width:3.0322678;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000"
+ style="fill:#4d4d4d;fill-opacity:1.0000000;stroke:#000000;stroke-width:3.0322678;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;"
d="M 35.594264,5.0594416 C 30.993989,5.0594416 26.669344,6.1701020 22.747024,7.9720148 L 16.323403,58.527703 C 21.617899,62.792218 28.260438,65.470002 35.594264,65.470001 C 44.124494,65.470001 51.834643,61.995917 57.418615,56.413094 L 51.154587,9.4083526 C 46.572930,6.7195541 41.293080,5.0594416 35.594264,5.0594416 z "
id="path1837"
sodipodi:nodetypes="ccccccc" />
<path
style="fill:#ffffff;fill-opacity:1.0000000;stroke:none;stroke-width:1.1500000;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000"
- d="M 34.082720,3.8075477 L 38.908560,3.8075477 L 40.645672,26.325074 L 32.421135,26.325074 L 34.082720,3.8075477 z "
+ d="M 34.185079,7.0866147 L 39.010919,7.0866147 L 40.748031,28.346457 L 32.523494,28.346457 L 34.185079,7.0866147 z "
id="path1833"
sodipodi:nodetypes="ccccc" />
<path
style="fill:#ffffff;fill-opacity:1.0000000;stroke:none;stroke-width:1.1500000;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000"
- d="M 31.763234,43.011352 L 40.940887,43.011352 L 44.244481,64.383022 C 37.669541,65.744224 35.282920,65.744224 28.603272,64.383022 L 31.763234,43.011352 z "
+ d="M 31.810092,41.386956 L 40.987745,41.386956 L 44.291339,62.758626 C 37.716399,64.119828 35.329778,64.119828 28.650130,62.758626 L 31.810092,41.386956 z "
id="path1834"
sodipodi:nodetypes="ccccc" />
</g>
diff --git a/src/glyph.c b/src/glyph.c
index 95e92d4..1289f80 100644
--- a/src/glyph.c
+++ b/src/glyph.c
@@ -28,10 +28,12 @@
struct {
GPtrArray* pGlyphArray; // to store all glyphs we hand out
-} g_Glyph;
+ GtkWidget* pTargetWidget;
+} g_Glyph = {0};
-void glyph_init(void)
+void glyph_init(GtkWidget* pTargetWidget)
{
+ g_Glyph.pTargetWidget = pTargetWidget;
g_Glyph.pGlyphArray = g_ptr_array_new();
}
@@ -75,6 +77,21 @@ gboolean glyph_is_safe_file_name(const gchar* pszName)
return TRUE;
}
+gboolean glyph_find_by_attributes(const gchar* pszName, gint nMaxWidth, gint nMaxHeight, glyph_t** ppReturnGlyph)
+{
+ gint i;
+ for(i=0 ; i<g_Glyph.pGlyphArray->len ; i++) {
+ glyph_t* pGlyph = g_ptr_array_index(g_Glyph.pGlyphArray, i);
+ if(pGlyph->nMaxWidth == nMaxWidth && pGlyph->nMaxHeight == nMaxHeight && strcmp(pGlyph->pszName, pszName) == 0) {
+ if(ppReturnGlyph) {
+ *ppReturnGlyph = pGlyph;
+ return TRUE;
+ }
+ }
+ }
+ return FALSE;
+}
+
void _glyph_load_at_size_into_struct(glyph_t* pNewGlyph, const gchar* pszName, gint nMaxWidth, gint nMaxHeight)
{
// pszName is an icon name without extension or path
@@ -88,15 +105,30 @@ void _glyph_load_at_size_into_struct(glyph_t* pNewGlyph, const gchar* pszName, g
gint iExtension;
for(iExtension = 0 ; iExtension < G_N_ELEMENTS(apszExtensions) ; iExtension++) {
gchar* pszFilePath = g_strdup_printf("%s%s.%s", pszPath, pszName, apszExtensions[iExtension]);
- pNewPixbuf = gdk_pixbuf_new_from_file_at_scale(pszFilePath, nMaxWidth, nMaxHeight, TRUE, NULL); // NOTE: scales image to fit in this size
+ if(nMaxWidth == -1) {
+ pNewPixbuf = gdk_pixbuf_new_from_file(pszFilePath, NULL);
+ }
+ else {
+ pNewPixbuf = gdk_pixbuf_new_from_file_at_scale(pszFilePath, nMaxWidth, nMaxHeight, TRUE, NULL); // NOTE: scales image to fit in this size
+ }
g_free(pszFilePath);
- if(pNewPixbuf != NULL) break; // got it!
+ if(pNewPixbuf != NULL) {
+ g_print("loaded image '%s' as %s with size (%d,%d)\n", pszName, apszExtensions[iExtension], gdk_pixbuf_get_width(pNewPixbuf), gdk_pixbuf_get_height(pNewPixbuf));
+ break; // got it!
+ }
}
// Create a fake pixbuf if not found
if(pNewPixbuf == NULL) {
- pNewPixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, nMaxWidth, nMaxHeight);
+ g_print("unabled to load image '%s'\n", pszName);
+
+ if(nMaxWidth == -1) {
+ pNewPixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, 16, 16);
+ }
+ else {
+ pNewPixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, nMaxWidth, nMaxHeight);
+ }
gdk_pixbuf_fill(pNewPixbuf, 0xFF000080);
}
pNewGlyph->pPixbuf = pNewPixbuf;
@@ -104,12 +136,52 @@ void _glyph_load_at_size_into_struct(glyph_t* pNewGlyph, const gchar* pszName, g
pNewGlyph->nHeight = gdk_pixbuf_get_height(pNewPixbuf);
}
+// Load at image's default size
+glyph_t* glyph_load(const gchar* pszName)
+{
+ g_assert(g_Glyph.pTargetWidget != NULL);
+ g_assert(g_Glyph.pGlyphArray != NULL);
+ g_assert(pszName != NULL);
+
+ glyph_t* pExistingGlyph = NULL;
+ if(glyph_find_by_attributes(pszName, -1, -1, &pExistingGlyph)) {
+ g_print("Found in cache '%s'\n", pszName);
+ pExistingGlyph->nReferenceCount++;
+ return pExistingGlyph;
+ }
+
+ // NOTE: We always return something!
+ glyph_t* pNewGlyph = g_new0(glyph_t, 1);
+ pNewGlyph->nReferenceCount = 1;
+
+ pNewGlyph->pszName = g_strdup(pszName);
+ pNewGlyph->nMaxWidth = -1;
+ pNewGlyph->nMaxHeight = -1;
+
+ // call internal function to fill the struct
+ _glyph_load_at_size_into_struct(pNewGlyph, pszName, -1, -1);
+
+ g_ptr_array_add(g_Glyph.pGlyphArray, pNewGlyph);
+
+ return pNewGlyph;
+}
+
glyph_t* glyph_load_at_size(const gchar* pszName, gint nMaxWidth, gint nMaxHeight)
{
- g_print("glyph.c: loading %s\n", pszName);
+ g_assert(g_Glyph.pTargetWidget != NULL);
+ g_assert(g_Glyph.pGlyphArray != NULL);
+ g_assert(pszName != NULL);
+
+ glyph_t* pExistingGlyph = NULL;
+ if(glyph_find_by_attributes(pszName, nMaxWidth, nMaxHeight, &pExistingGlyph)) {
+ g_print("Found in cache '%s'\n", pszName);
+ pExistingGlyph->nReferenceCount++;
+ return pExistingGlyph;
+ }
// NOTE: We always return something!
glyph_t* pNewGlyph = g_new0(glyph_t, 1);
+ pNewGlyph->nReferenceCount = 1;
pNewGlyph->pszName = g_strdup(pszName);
pNewGlyph->nMaxWidth = nMaxWidth;
@@ -123,6 +195,9 @@ glyph_t* glyph_load_at_size(const gchar* pszName, gint nMaxWidth, gint nMaxHeigh
return pNewGlyph;
}
+//
+//
+//
GdkPixbuf* glyph_get_pixbuf(const glyph_t* pGlyph)
{
g_assert(pGlyph != NULL);
@@ -131,13 +206,28 @@ GdkPixbuf* glyph_get_pixbuf(const glyph_t* pGlyph)
return pGlyph->pPixbuf;
}
+GdkPixmap* glyph_get_pixmap(glyph_t* pGlyph)
+{
+ g_assert(pGlyph != NULL);
+
+ if(pGlyph->pPixmap == NULL) {
+ GdkGC* pGC = g_Glyph.pTargetWidget->style->fg_gc[GTK_WIDGET_STATE(g_Glyph.pTargetWidget)];
+ pGlyph->pPixmap = gdk_pixmap_new(g_Glyph.pTargetWidget->window, pGlyph->nWidth, pGlyph->nHeight, -1); // -1 is bpp
+ gdk_draw_pixbuf(pGlyph->pPixmap, pGC, pGlyph->pPixbuf,0,0,0,0,-1,-1,
+ GDK_RGB_DITHER_NONE,0,0); // no dithering
+ }
+ g_assert(pGlyph->pPixmap != NULL);
+
+ return pGlyph->pPixmap;
+}
+
void glyph_draw_centered(glyph_t* pGlyph, GdkDrawable* pTargetDrawable, GdkGC* pGC, gdouble fX, gdouble fY)
{
gdk_draw_pixbuf(pTargetDrawable,
pGC,
pGlyph->pPixbuf,
- 0,0, // src
- (gint)(fX - (pGlyph->nWidth/2)), (gint)(fY - (pGlyph->nHeight/2)), // x/y to draw to
+ 0,0, // src
+ (gint)(fX - ((gdouble)(pGlyph->nWidth)/2.0)), (gint)(fY - ((gdouble)(pGlyph->nHeight)/2.0)), // x/y to draw to
pGlyph->nWidth, pGlyph->nHeight, // width/height
GDK_RGB_DITHER_NONE,0,0); // no dithering
}
diff --git a/src/glyph.h b/src/glyph.h
index 5067ba6..e590945 100644
--- a/src/glyph.h
+++ b/src/glyph.h
@@ -28,17 +28,20 @@
#include <cairo.h>
typedef struct {
- GdkPixbuf* pPixbuf;
+ GdkPixbuf* pPixbuf; // pixbuf is just a decoded image
+ GdkPixmap* pPixmap; // pixmap is converted to screen color depth, etc.
gint nWidth;
gint nHeight;
gint nMaxWidth;
gint nMaxHeight;
gchar* pszName;
+ gint nReferenceCount;
} glyph_t;
-void glyph_init(void);
+void glyph_init(GtkWidget* pTargetWidget);
glyph_t* glyph_load_at_size(const gchar* pszName, gint nMaxWidth, gint nMaxHeight);
GdkPixbuf* glyph_get_pixbuf(const glyph_t* pGlyph);
+GdkPixmap* glyph_get_pixmap(glyph_t* pGlyph);
//void glyph_draw_centered(cairo_t* pCairo, gint nGlyphHandle, gdouble fX, gdouble fY);
void glyph_draw_centered(glyph_t* pGlyph, GdkDrawable* pTargetDrawable, GdkGC* pGC, gdouble fX, gdouble fY);
void glyph_deinit(void);
diff --git a/src/gui.c b/src/gui.c
index 47813b5..3cf8fec 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -44,12 +44,18 @@ void gui_init()
glade_xml_signal_autoconnect(pGladeXML);
// init all windows/dialogs
- mainwindow_init(pGladeXML);
+ g_print("- initializing mainwindow\n");
+ mainwindow_init(pGladeXML);
+ g_print("- initializing searchwindow\n");
searchwindow_init(pGladeXML);
+ g_print("- initializing gotowindow\n");
gotowindow_init(pGladeXML);
+ g_print("- initializing importwindow\n");
importwindow_init(pGladeXML);
//datasetwindow_init(pGladeXML);
+ g_print("- initializing welcomewindow\n");
welcomewindow_init(pGladeXML);
+ g_print("- initializing locationeditwindow\n");
locationeditwindow_init(pGladeXML);
}
diff --git a/src/locationset.c b/src/locationset.c
index 807de22..7e26070 100644
--- a/src/locationset.c
+++ b/src/locationset.c
@@ -106,7 +106,8 @@ void locationset_load_locationsets(void)
pNewLocationSet->pszName = g_strdup(aRow[1]);
pNewLocationSet->pszIconName = g_strdup(aRow[2]);
pNewLocationSet->pGlyph = glyph_load_at_size(pNewLocationSet->pszIconName, SEARCHWINDOW_SEARCH_RESULT_GLYPH_WIDTH, SEARCHWINDOW_SEARCH_RESULT_GLYPH_HEIGHT);
- pNewLocationSet->pMapGlyph = glyph_load_at_size(pNewLocationSet->pszIconName, 16, 16);
+ pNewLocationSet->pMapGlyph = glyph_load_at_size(pNewLocationSet->pszIconName, 24, 24);
+ pNewLocationSet->pMapGlyphSmall = glyph_load_at_size(pNewLocationSet->pszIconName, 6, 6);
pNewLocationSet->nLocationCount = atoi(aRow[3]);
// Add the new set to both data structures
diff --git a/src/locationset.h b/src/locationset.h
index 6b5d775..cda94f6 100644
--- a/src/locationset.h
+++ b/src/locationset.h
@@ -45,6 +45,8 @@ typedef struct locationset {
// locationsetstyle_t Style;
glyph_t* pGlyph;
glyph_t* pMapGlyph;
+ glyph_t* pMapGlyphSmall;
+
} locationset_t;
void locationset_init(void);
diff --git a/src/main.c b/src/main.c
index 017401e..e1681d6 100644
--- a/src/main.c
+++ b/src/main.c
@@ -95,8 +95,8 @@ void main_debug_insert_test_data()
// New POI
mappoint_t pt;
- pt.fLatitude = 42.37382;
- pt.fLongitude = -71.10054;
+ pt.fLatitude = 42.37391;
+ pt.fLongitude = -71.10045;
nNewLocationID = 0;
location_insert(nNewLocationSetID, &pt, &nNewLocationID);
location_insert_attribute(nNewLocationID, LOCATION_ATTRIBUTE_ID_NAME, "1369 Coffee House", NULL);
@@ -104,8 +104,8 @@ void main_debug_insert_test_data()
location_insert_attribute(nNewLocationID, nAttributeIDReview, "1369 Coffee House (specifically, the one on Mass Ave) has a special place in my heart; it's sort of my office away from the office, or my vacation home away from my tiny Central Square rented home. It's cozy. It's hip.", NULL);
// New POI
- pt.fLatitude = 42.36650;
- pt.fLongitude = -71.10554;
+ pt.fLatitude = 42.36654;
+ pt.fLongitude = -71.10541;
nNewLocationID = 0;
location_insert(nNewLocationSetID, &pt, &nNewLocationID);
location_insert_attribute(nNewLocationID, LOCATION_ATTRIBUTE_ID_NAME, "1369 Coffee House", NULL);
@@ -151,20 +151,21 @@ gboolean main_init(void)
track_init();
g_print("initializing map styles\n");
map_style_init();
- g_print("initializing glyphs\n");
- glyph_init();
g_print("initializing map\n");
map_init();
- g_print("initializing search\n");
- search_init();
-
g_print("initializing scenemanager\n");
scenemanager_init();
g_print("initializing gpsclient\n");
gpsclient_init();
+ g_print("initializing animator\n");
+ animator_init();
+
+ //
+ // Database
+ //
g_print("initializing db\n");
db_init();
@@ -174,23 +175,25 @@ gboolean main_init(void)
g_print("creating database tables\n");
db_create_tables();
- g_print("initializing locationsets\n");
- locationset_init();
-
- g_print("initializing locations\n");
- location_init();
-
- g_print("initializing animator\n");
- animator_init();
-
main_debug_insert_test_data();
+ //
// Load location sets from DB. This is "coffee shops", "ATMs", etc.
- locationset_load_locationsets();
+ //
+ g_print("initializing locationsets\n");
+ locationset_init();
g_print("initializing gui\n");
gui_init();
+ locationset_load_locationsets(); // needs glyph
+
+ g_print("initializing search\n");
+ search_init();
+
+ g_print("initializing locations\n");
+ location_init();
+
g_print("initialization complete\n");
return TRUE;
diff --git a/src/mainwindow.c b/src/mainwindow.c
index 46b308c..0939191 100644
--- a/src/mainwindow.c
+++ b/src/mainwindow.c
@@ -106,8 +106,6 @@
#define MAX_DISTANCE_FOR_AUTO_SLIDE_IN_PIXELS (3500.0) // when selecting search results, we slide to them instead of jumping if they are within this distance
-#define LOCATIONSET_LIST_MIN_NAME_WIDTH_IN_CHARS (17) // also forces minimum sidebar width
-
// Types
typedef struct {
GdkCursorType CursorType;
@@ -240,6 +238,7 @@ struct {
GtkMenuItem* pWebMapsMenuItem;
} g_MainWindow = {0};
+// XXX: Use GDK_HAND1 for the map
// Data
toolsettings_t g_Tools[] = {
@@ -402,24 +401,17 @@ void mainwindow_init(GladeXML* pGladeXML)
g_MainWindow.pTooltip = tooltip_new();
// Drawing area
- g_MainWindow.pDrawingArea = GTK_DRAWING_AREA(gtk_drawing_area_new());
+ g_MainWindow.pDrawingArea = GTK_DRAWING_AREA(gtk_drawing_area_new());
+ g_print("initializing glyphs\n");
+ glyph_init(g_MainWindow.pDrawingArea);
gtk_widget_show(GTK_WIDGET(g_MainWindow.pDrawingArea));
// create map and load style
map_new(&g_MainWindow.pMap, GTK_WIDGET(g_MainWindow.pDrawingArea));
map_style_load(g_MainWindow.pMap, MAP_STYLE_FILENAME);
-
- // Signal handlers for drawing area
- gtk_widget_add_events(GTK_WIDGET(g_MainWindow.pDrawingArea), GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_KEY_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK);
- g_signal_connect(G_OBJECT(g_MainWindow.pDrawingArea), "expose_event", G_CALLBACK(mainwindow_on_expose_event), NULL);
- g_signal_connect(G_OBJECT(g_MainWindow.pDrawingArea), "configure_event", G_CALLBACK(mainwindow_on_configure_event), NULL);
- g_signal_connect(G_OBJECT(g_MainWindow.pDrawingArea), "button_press_event", G_CALLBACK(mainwindow_on_mouse_button_click), NULL);
- g_signal_connect(G_OBJECT(g_MainWindow.pDrawingArea), "button_release_event", G_CALLBACK(mainwindow_on_mouse_button_click), NULL);
- g_signal_connect(G_OBJECT(g_MainWindow.pDrawingArea), "motion_notify_event", G_CALLBACK(mainwindow_on_mouse_motion), NULL);
- g_signal_connect(G_OBJECT(g_MainWindow.pDrawingArea), "scroll_event", G_CALLBACK(mainwindow_on_mouse_scroll), NULL);
- g_signal_connect(G_OBJECT(g_MainWindow.pDrawingArea), "enter_notify_event", G_CALLBACK(mainwindow_on_enter_notify), NULL);
- g_signal_connect(G_OBJECT(g_MainWindow.pDrawingArea), "leave_notify_event", G_CALLBACK(mainwindow_on_leave_notify), NULL);
- g_signal_connect(G_OBJECT(g_MainWindow.pDrawingArea), "key_press_event", G_CALLBACK(mainwindow_on_key_press), NULL);
+
+ g_assert(g_MainWindow.pContentBox);
+ g_assert(g_MainWindow.pDrawingArea);
// Pack drawing area into application window
gtk_box_pack_end(GTK_BOX(g_MainWindow.pContentBox), GTK_WIDGET(g_MainWindow.pDrawingArea),
@@ -433,17 +425,29 @@ void mainwindow_init(GladeXML* pGladeXML)
mainwindow_refresh_locationset_list();
mainwindow_statusbar_update_zoomscale();
- mainwindow_statusbar_update_position();
+ mainwindow_statusbar_update_position();
// Slide timeout
g_timeout_add(SLIDE_TIMEOUT_MS, (GSourceFunc)mainwindow_on_slide_timeout, (gpointer)NULL);
// GPS check timeout
g_timeout_add(TIMER_GPS_REDRAW_INTERVAL_MS, (GSourceFunc)mainwindow_on_gps_redraw_timeout, (gpointer)NULL);
- mainwindow_on_gps_redraw_timeout(NULL); // give it a call to set all labels, etc.
+ mainwindow_on_gps_redraw_timeout(NULL); // give it a call to set all labels, etc.
// When main window closes, quit.
g_signal_connect(G_OBJECT(g_MainWindow.pWindow), "delete_event", G_CALLBACK(gtk_main_quit), NULL);
+
+ // Signal handlers for drawing area
+ gtk_widget_add_events(GTK_WIDGET(g_MainWindow.pDrawingArea), GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_KEY_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK);
+ g_signal_connect(G_OBJECT(g_MainWindow.pDrawingArea), "expose_event", G_CALLBACK(mainwindow_on_expose_event), NULL);
+ g_signal_connect(G_OBJECT(g_MainWindow.pDrawingArea), "configure_event", G_CALLBACK(mainwindow_on_configure_event), NULL);
+ g_signal_connect(G_OBJECT(g_MainWindow.pDrawingArea), "button_press_event", G_CALLBACK(mainwindow_on_mouse_button_click), NULL);
+ g_signal_connect(G_OBJECT(g_MainWindow.pDrawingArea), "button_release_event", G_CALLBACK(mainwindow_on_mouse_button_click), NULL);
+ g_signal_connect(G_OBJECT(g_MainWindow.pDrawingArea), "motion_notify_event", G_CALLBACK(mainwindow_on_mouse_motion), NULL);
+ g_signal_connect(G_OBJECT(g_MainWindow.pDrawingArea), "scroll_event", G_CALLBACK(mainwindow_on_mouse_scroll), NULL);
+ g_signal_connect(G_OBJECT(g_MainWindow.pDrawingArea), "enter_notify_event", G_CALLBACK(mainwindow_on_enter_notify), NULL);
+ g_signal_connect(G_OBJECT(g_MainWindow.pDrawingArea), "leave_notify_event", G_CALLBACK(mainwindow_on_leave_notify), NULL);
+ g_signal_connect(G_OBJECT(g_MainWindow.pDrawingArea), "key_press_event", G_CALLBACK(mainwindow_on_key_press), NULL);
}
gboolean mainwindow_locationset_list_is_separator_callback(GtkTreeModel *_unused, GtkTreeIter *pIter, gpointer __unused)
@@ -483,7 +487,6 @@ static void mainwindow_configure_locationset_list()
// NEW COLUMN: "Name" column
pCellRenderer = gtk_cell_renderer_text_new();
g_object_set(G_OBJECT(pCellRenderer), "ellipsize", PANGO_ELLIPSIZE_END, NULL);
- //g_object_set(G_OBJECT(pCellRenderer), "width-chars", LOCATIONSET_LIST_MIN_NAME_WIDTH_IN_CHARS, NULL);
pColumn = gtk_tree_view_column_new_with_attributes("Name", pCellRenderer, "markup", LOCATIONSETLIST_COLUMN_NAME, NULL);
gtk_tree_view_column_set_expand(pColumn, TRUE);
gtk_tree_view_append_column(g_MainWindow.pLocationSetsTreeView, pColumn);
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 1818b45..2f3b840 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -81,8 +81,8 @@ typedef enum {
void mainwindow_scroll_direction(EDirection eScrollDirection, gint nPixels);
#define SIDEBAR_TAB_LOCATIONSETS 0
-#define SIDEBAR_TAB_TRACKS 1
-#define SIDEBAR_TAB_SEARCH_RESULTS 2
+//#define SIDEBAR_TAB_TRACKS 1
+#define SIDEBAR_TAB_SEARCH_RESULTS 1
void mainwindow_sidebar_set_tab(gint nTab);
diff --git a/src/map.c b/src/map.c
index 802752e..0801ce8 100644
--- a/src/map.c
+++ b/src/map.c
@@ -1257,7 +1257,7 @@ gboolean map_object_type_atoi(const gchar* pszName, gint* pnReturnObjectTypeID)
gboolean map_layer_render_type_atoi(const gchar* pszName, gint* pnReturnRenderTypeID)
{
- gchar* g_apszMapRenderTypeNames[] = {"lines", "polygons", "line-labels", "polygon-labels", "fill"};
+ gchar* g_apszMapRenderTypeNames[] = {"lines", "polygons", "line-labels", "polygon-labels", "fill", "locations", "location-labels"};
gint i;
for(i=0 ; i<G_N_ELEMENTS(g_apszMapRenderTypeNames) ; i++) {
diff --git a/src/map.h b/src/map.h
index 383467e..3752a5a 100644
--- a/src/map.h
+++ b/src/map.h
@@ -48,6 +48,7 @@
#define MAP_OBJECT_TYPE_FIRST (1)
#define MAP_OBJECT_TYPE_LAST (12)
+
//
// Line CAP styles
//
@@ -249,6 +250,8 @@ typedef enum {
MAP_LAYER_RENDERTYPE_LINE_LABELS,
MAP_LAYER_RENDERTYPE_POLYGON_LABELS,
MAP_LAYER_RENDERTYPE_FILL,
+ MAP_LAYER_RENDERTYPE_LOCATIONS,
+ MAP_LAYER_RENDERTYPE_LOCATION_LABELS,
} EMapLayerRenderType;
typedef struct {
diff --git a/src/map_draw_cairo.c b/src/map_draw_cairo.c
index 25e03da..3bea47d 100644
--- a/src/map_draw_cairo.c
+++ b/src/map_draw_cairo.c
@@ -27,7 +27,7 @@
#define ROUND_DOWN_TEXT_ANGLE (100.0) // 10.0 to keep one decimal place or 100.0 to keep two
#define ENABLE_LABEL_LIMIT_TO_ROAD // take road line length into account when drawing labels!
-#define ACCEPTABLE_LINE_LABEL_OVERDRAW_IN_PIXELS (15) // XXX: make this a run-time variable
+#define ACCEPTABLE_LINE_LABEL_OVERDRAW_IN_PIXELS (18) // XXX: make this a run-time variable
#define ENABLE_DRAW_MAP_SCALE
//#define ENABLE_MAP_DROP_SHADOW
diff --git a/src/map_draw_gdk.c b/src/map_draw_gdk.c
index d08b2cc..6285dc7 100644
--- a/src/map_draw_gdk.c
+++ b/src/map_draw_gdk.c
@@ -105,10 +105,14 @@ void map_draw_gdk(map_t* pMap, rendermetrics_t* pRenderMetrics, GdkPixmap* pPixm
pMap->apLayerData[pLayer->nDataSource]->pRoadsArray, // data
pLayer->paStylesAtZoomLevels[pRenderMetrics->nZoomLevel-1]); // style
}
+ else if(pLayer->nDrawType == MAP_LAYER_RENDERTYPE_LOCATIONS) {
+ map_draw_gdk_locations(pMap, pPixmap, pRenderMetrics);
+ }
+ else if(pLayer->nDrawType == MAP_LAYER_RENDERTYPE_LOCATION_LABELS) {
+ //map_draw_gdk_locations(pMap, pPixmap, pRenderMetrics);
+ }
}
-
map_draw_gdk_tracks(pMap, pPixmap, pRenderMetrics);
- map_draw_gdk_locations(pMap, pPixmap, pRenderMetrics);
}
// 3. Labels
@@ -119,18 +123,6 @@ void map_draw_gdk(map_t* pMap, rendermetrics_t* pRenderMetrics, GdkPixmap* pPixm
TIMER_END(maptimer, "END RENDER MAP (gdk)");
}
-// static void map_draw_gdk_background(map_t* pMap, GdkPixmap* pPixmap)
-// {
-// GdkColor clr;
-// clr.red = 236/255.0 * 65535;
-// clr.green = 230/255.0 * 65535;
-// clr.blue = 230/255.0 * 65535;
-// gdk_gc_set_rgb_fg_color(pMap->pTargetWidget->style->fg_gc[GTK_WIDGET_STATE(pMap->pTargetWidget)], &clr);
-//
-// gdk_draw_rectangle(pPixmap, pMap->pTargetWidget->style->fg_gc[GTK_WIDGET_STATE(pMap->pTargetWidget)],
-// TRUE, 0,0, pMap->MapDimensions.uWidth, pMap->MapDimensions.uHeight);
-// }
-
static void map_draw_gdk_layer_polygons(map_t* pMap, GdkPixmap* pPixmap, rendermetrics_t* pRenderMetrics, GPtrArray* pRoadsArray, maplayerstyle_t* pLayerStyle)
{
mappoint_t* pPoint;
@@ -139,8 +131,25 @@ static void map_draw_gdk_layer_polygons(map_t* pMap, GdkPixmap* pPixmap, renderm
gint iPoint;
if(pLayerStyle->clrPrimary.fAlpha == 0.0) return; // invisible? (not that we respect it in gdk drawing anyway)
+ if(pRoadsArray->len == 0) return;
+
+ GdkGC* pGC = pMap->pTargetWidget->style->fg_gc[GTK_WIDGET_STATE(pMap->pTargetWidget)];
+
+ GdkGCValues gcValues;
+ if(pLayerStyle->pGlyphFill != NULL) {
+ // Instead of filling with a color, fill with a tiled image
+ gdk_gc_get_values(pGC, &gcValues);
+ gdk_gc_set_fill(pGC, GDK_TILED);
+ gdk_gc_set_tile(pGC, glyph_get_pixmap(pLayerStyle->pGlyphFill));
+
+ // This makes the fill image scroll with the map, instead of staying still
+ gdk_gc_set_ts_origin(pGC, SCALE_X(pRenderMetrics, pRenderMetrics->fScreenLongitude), SCALE_Y(pRenderMetrics, pRenderMetrics->fScreenLatitude));
+ }
+ else {
+ // Simple color fill
+ map_draw_gdk_set_color(pGC, &(pLayerStyle->clrPrimary));
+ }
- map_draw_gdk_set_color(pMap->pTargetWidget->style->fg_gc[GTK_WIDGET_STATE(pMap->pTargetWidget)], &(pLayerStyle->clrPrimary));
for(iString=0 ; iString<pRoadsArray->len ; iString++) {
pRoad = g_ptr_array_index(pRoadsArray, iString);
@@ -154,10 +163,11 @@ static void map_draw_gdk_layer_polygons(map_t* pMap, GdkPixmap* pPixmap, renderm
GdkPoint aPoints[MAX_GDK_LINE_SEGMENTS];
if(pRoad->pPointsArray->len > MAX_GDK_LINE_SEGMENTS) {
- //g_warning("not drawing line with > %d segments\n", MAX_GDK_LINE_SEGMENTS);
+ g_warning("not drawing line with > %d segments\n", MAX_GDK_LINE_SEGMENTS);
continue;
}
+ // XXX: the bounding box should be pre-calculated!!!!
for(iPoint=0 ; iPoint<pRoad->pPointsArray->len ; iPoint++) {
pPoint = g_ptr_array_index(pRoad->pPointsArray, iPoint);
@@ -179,18 +189,44 @@ static void map_draw_gdk_layer_polygons(map_t* pMap, GdkPixmap* pPixmap, renderm
{
continue; // not visible
}
+
gdk_draw_polygon(pPixmap, pMap->pTargetWidget->style->fg_gc[GTK_WIDGET_STATE(pMap->pTargetWidget)],
TRUE, aPoints, pRoad->pPointsArray->len);
}
}
+ if(pLayerStyle->pGlyphFill != NULL) {
+ // Restore fill style
+ gdk_gc_set_values(pGC, &gcValues, GDK_GC_FILL);
+ }
}
// useful for filling the screen with a color. not much else.
static void map_draw_gdk_layer_fill(map_t* pMap, GdkPixmap* pPixmap, rendermetrics_t* pRenderMetrics, maplayerstyle_t* pLayerStyle)
{
- map_draw_gdk_set_color(pMap->pTargetWidget->style->fg_gc[GTK_WIDGET_STATE(pMap->pTargetWidget)], &(pLayerStyle->clrPrimary));
+ GdkGC* pGC = pMap->pTargetWidget->style->fg_gc[GTK_WIDGET_STATE(pMap->pTargetWidget)];
+
+ GdkGCValues gcValues;
+ if(pLayerStyle->pGlyphFill != NULL) {
+ // Instead of filling with a color, fill with a tiled image
+ gdk_gc_get_values(pGC, &gcValues);
+ gdk_gc_set_fill(pGC, GDK_TILED);
+ gdk_gc_set_tile(pGC, glyph_get_pixmap(pLayerStyle->pGlyphFill));
+
+ // This makes the fill image scroll with the map, instead of staying still
+ gdk_gc_set_ts_origin(pGC, SCALE_X(pRenderMetrics, pRenderMetrics->fScreenLongitude), SCALE_Y(pRenderMetrics, pRenderMetrics->fScreenLatitude));
+ }
+ else {
+ // Simple color fill
+ map_draw_gdk_set_color(pGC, &(pLayerStyle->clrPrimary));
+ }
+
gdk_draw_rectangle(pPixmap, pMap->pTargetWidget->style->fg_gc[GTK_WIDGET_STATE(pMap->pTargetWidget)],
TRUE, 0,0, pMap->MapDimensions.uWidth, pMap->MapDimensions.uHeight);
+
+ if(pLayerStyle->pGlyphFill != NULL) {
+ // Restore fill style
+ gdk_gc_set_values(pGC, &gcValues, GDK_GC_FILL);
+ }
}
static void map_draw_gdk_layer_lines(map_t* pMap, GdkPixmap* pPixmap, rendermetrics_t* pRenderMetrics, GPtrArray* pRoadsArray, maplayerstyle_t* pLayerStyle)
@@ -336,20 +372,17 @@ static void map_draw_gdk_tracks(map_t* pMap, GdkPixmap* pPixmap, rendermetrics_t
}
}
+// Draw all locations from sets marked visible
static void map_draw_gdk_locations(map_t* pMap, GdkPixmap* pPixmap, rendermetrics_t* pRenderMetrics)
{
const GPtrArray* pLocationSetsArray = locationset_get_array();
- g_print("pLocationSetsArray->len = %d\n", pLocationSetsArray->len);
-
gint i;
for(i=0 ; i<pLocationSetsArray->len ; i++) {
locationset_t* pLocationSet = g_ptr_array_index(pLocationSetsArray, i);
-
if(!locationset_is_visible(pLocationSet)) continue;
- g_print("visible one: %s\n", pLocationSet->pszName);
- // 2. Get array of Locations from the hash table using LocationSetID
+ // 2. Get the array of Locations from the hash table using LocationSetID
GPtrArray* pLocationsArray;
pLocationsArray = g_hash_table_lookup(pMap->pLocationArrayHashTable, &(pLocationSet->nID));
if(pLocationsArray != NULL) {
@@ -364,7 +397,7 @@ static void map_draw_gdk_locations(map_t* pMap, GdkPixmap* pPixmap, rendermetric
static void map_draw_gdk_locationset(map_t* pMap, GdkPixmap* pPixmap, rendermetrics_t* pRenderMetrics, locationset_t* pLocationSet, GPtrArray* pLocationsArray)
{
- g_print("Drawing set with %d\n", pLocationsArray->len);
+ //g_print("Drawing set with %d\n", pLocationsArray->len);
gint i;
for(i=0 ; i<pLocationsArray->len ; i++) {
location_t* pLocation = g_ptr_array_index(pLocationsArray, i);
@@ -378,34 +411,38 @@ static void map_draw_gdk_locationset(map_t* pMap, GdkPixmap* pPixmap, rendermetr
continue; // not visible
}
- gint nX = (gint)SCALE_X(pRenderMetrics, pLocation->Coordinates.fLongitude);
- gint nY = (gint)SCALE_Y(pRenderMetrics, pLocation->Coordinates.fLatitude);
+ gdouble fX = SCALE_X(pRenderMetrics, pLocation->Coordinates.fLongitude);
+ gdouble fY = SCALE_Y(pRenderMetrics, pLocation->Coordinates.fLatitude);
GdkGC* pGC = pMap->pTargetWidget->style->fg_gc[GTK_WIDGET_STATE(pMap->pTargetWidget)];
- glyph_draw_centered(pLocationSet->pMapGlyph, pPixmap, pGC, (gdouble)nX, (gdouble)nY);
-
-// g_print("drawing at %d,%d\n", nX,nY);
-
-// GdkColor clr1;
-// clr1.red = 255/255.0 * 65535;
-// clr1.green = 80/255.0 * 65535;
-// clr1.blue = 80/255.0 * 65535;
-// GdkColor clr2;
-// clr2.red = 255/255.0 * 65535;
-// clr2.green = 255/255.0 * 65535;
-// clr2.blue = 255/255.0 * 65535;
-//
-// gdk_gc_set_rgb_fg_color(pGC, &clr1);
-// gdk_draw_rectangle(pPixmap, pGC, TRUE,
-// nX-3,nY-3,
-// 7, 7);
-// gdk_gc_set_rgb_fg_color(pGC, &clr2);
-// gdk_draw_rectangle(pPixmap, pGC, TRUE,
-// nX-2,nY-2,
-// 5, 5);
-// gdk_gc_set_rgb_fg_color(pGC, &clr1);
-// gdk_draw_rectangle(pPixmap, pGC, TRUE,
-// nX-1,nY-1,
-// 3, 3);
+ if(map_get_zoomlevel(pMap) <= 3) {
+ glyph_draw_centered(pLocationSet->pMapGlyphSmall, pPixmap, pGC, fX, fY);
+ }
+ else {
+ glyph_draw_centered(pLocationSet->pMapGlyph, pPixmap, pGC, fX, fY);
+ }
}
}
+
+// GdkColor clr1;
+// clr1.red = 255/255.0 * 65535;
+// clr1.green = 80/255.0 * 65535;
+// clr1.blue = 80/255.0 * 65535;
+// GdkColor clr2;
+// clr2.red = 255/255.0 * 65535;
+// clr2.green = 255/255.0 * 65535;
+// clr2.blue = 255/255.0 * 65535;
+//
+// gdk_gc_set_rgb_fg_color(pGC, &clr1);
+// gdk_draw_rectangle(pPixmap, pGC, TRUE,
+// nX-3,nY-3,
+// 7, 7);
+// gdk_gc_set_rgb_fg_color(pGC, &clr2);
+// gdk_draw_rectangle(pPixmap, pGC, TRUE,
+// nX-2,nY-2,
+// 5, 5);
+// gdk_gc_set_rgb_fg_color(pGC, &clr1);
+// gdk_draw_rectangle(pPixmap, pGC, TRUE,
+// nX-1,nY-1,
+// 3, 3);
+
diff --git a/src/map_style.c b/src/map_style.c
index 59d08d7..7e4bb15 100644
--- a/src/map_style.c
+++ b/src/map_style.c
@@ -33,8 +33,6 @@
#define EACH_ATTRIBUTE_OF_NODE(a,n) (a) = (n)->properties ; (a) != NULL ; (a) = (a)->next
#define EACH_CHILD_OF_NODE(c,n) (c) = (n)->children ; (c) != NULL ; (c) = (c)->next
-GHashTable* g_pConstantsHash = NULL; // XXX: globals suck. :(
-
static maplayer_t* map_style_new_layer();
static void map_style_load_from_file(map_t* pMap, const gchar* pszFileName);
@@ -42,8 +40,6 @@ static void map_style_parse_file(map_t* pMap, xmlDocPtr pDoc, xmlNodePtr pNode);
static void map_style_parse_layers(map_t* pMap, xmlDocPtr pDoc, xmlNodePtr pParentNode);
static void map_style_parse_layer(map_t* pMap, xmlDocPtr pDoc, xmlNodePtr pNode);
static void map_style_parse_layer_property(map_t* pMap, xmlDocPtr pDoc, maplayer_t *pLayer, xmlNodePtr pNode);
-static void map_style_parse_constants(map_t* pMap, xmlDocPtr pDoc, xmlNodePtr pParentNode);
-static void map_style_parse_constant(map_t* pMap, xmlDocPtr pDoc, xmlNodePtr pNode);
// Debugging
static void map_style_print_layer(maplayer_t *layer);
@@ -86,40 +82,9 @@ void map_style_load(map_t* pMap, const gchar* pszFileName)
}
pMap->pLayersArray = g_ptr_array_new();
-
- if(g_pConstantsHash != NULL) {
- g_hash_table_destroy(g_pConstantsHash); // NOTE: This frees all keys and values for us.
- }
- g_pConstantsHash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); // same as above
map_style_load_from_file(pMap, pszFileName);
}
-//
-// Constants
-//
-gboolean map_style_constant_get(const gchar* pszName, gchar** ppszReturnValue)
-{
- g_assert(pszName);
- g_assert(ppszReturnValue);
- g_assert(*ppszReturnValue == NULL); // require pointer to NULL pointer
-
- gchar* pszValue = g_hash_table_lookup(g_pConstantsHash, pszName);
- if(pszValue != NULL) {
- *ppszReturnValue = pszValue;
- return TRUE;
- }
- return FALSE;
-}
-
-void map_style_constant_set(const gchar* pszName, const gchar* pszValue)
-{
- g_assert(pszName != NULL);
- g_assert(pszValue != NULL);
-
- // NOTE: if there was an existing key with this name, the old key and old value will get auto-freed by glib
- g_hash_table_replace(g_pConstantsHash, (gchar*)pszName, (gchar*)pszValue);
-}
-
static maplayer_t* map_style_new_layer()
{
maplayer_t *pLayer = g_new0(maplayer_t, 1);
@@ -315,9 +280,6 @@ static void map_style_parse_file(map_t* pMap, xmlDocPtr pDoc, xmlNodePtr pParent
if(strcmp(pChildNode->name, "layers") == 0) {
map_style_parse_layers(pMap, pDoc, pChildNode);
}
- else if(strcmp(pChildNode->name, "constants") == 0) {
- map_style_parse_constants(pMap, pDoc, pChildNode);
- }
}
}
}
@@ -340,55 +302,6 @@ static void map_style_parse_layers(map_t* pMap, xmlDocPtr pDoc, xmlNodePtr pPare
}
}
-static void map_style_parse_constants(map_t* pMap, xmlDocPtr pDoc, xmlNodePtr pParentNode)
-{
- g_assert(pMap != NULL);
- g_assert(pDoc != NULL);
- g_assert(pParentNode != NULL);
-
-// g_print("map_style_parse_constants()\n");
- xmlNodePtr pChildNode = NULL;
-
- for(EACH_CHILD_OF_NODE(pChildNode, pParentNode)) {
- if(pChildNode->type == XML_ELEMENT_NODE && strcmp(pChildNode->name, "constant") == 0) {
- map_style_parse_constant(pMap, pDoc, pChildNode);
- }
- }
-}
-
-static void map_style_parse_constant(map_t* pMap, xmlDocPtr pDoc, xmlNodePtr pNode)
-{
- g_assert(pMap != NULL);
- g_assert(pDoc != NULL);
- g_assert(pNode != NULL);
-
-// g_print("map_style_parse_constant()\n");
- xmlAttrPtr pAttribute = NULL;
-
- gchar* pszName = NULL;
- gchar* pszValue = NULL;
-
- for(EACH_ATTRIBUTE_OF_NODE(pAttribute, pNode)) {
- if(strcmp(pAttribute->name, "name") == 0) {
- g_free(pszName);
- pszName = get_attribute_value(pDoc, pAttribute);
- }
- else if(strcmp(pAttribute->name, "value") == 0) {
- g_free(pszValue);
- pszValue = get_attribute_value(pDoc, pAttribute);
- }
- }
-
- if(pszName != NULL && pszValue != NULL) {
- // duplicate strings to keep long-term in the hash table
- map_style_constant_set(g_strdup(pszName), g_strdup(pszValue));
- }
- g_free(pszName);
- g_free(pszValue);
-// g_free(pszName);
-// g_free(pszValue);
-}
-
static void map_style_parse_layer(map_t* pMap, xmlDocPtr pDoc, xmlNodePtr pNode)
{
g_assert(pMap != NULL);
@@ -467,13 +380,6 @@ map_style_parse_layer_property(map_t* pMap, xmlDocPtr pDoc, maplayer_t *pLayer,
map_style_parse_zoomlevel(pszZoomLevel, &nMinZoomLevel, &nMaxZoomLevel);
}
- // If the 'value' is the name of a constant, replace it with the value of the constant
- gchar* pszConstantValue = NULL;
- if(map_style_constant_get(pszValue, &pszConstantValue)) {
- g_free(pszValue);
- pszValue = g_strdup(pszConstantValue);
- }
-
if(pszName != NULL && pszValue != NULL) {
gint i;
if(strcmp(pszName, "line-width") == 0) {
@@ -520,6 +426,11 @@ map_style_parse_layer_property(map_t* pMap, xmlDocPtr pDoc, maplayer_t *pLayer,
}
}
}
+ else if(strcmp(pszName, "fill-image") == 0) {
+ for(i = nMinZoomLevel - 1; i < nMaxZoomLevel ; i++) {
+ pLayer->paStylesAtZoomLevels[i]->pGlyphFill = glyph_load(pszValue);
+ }
+ }
else if(strcmp(pszName, "bold") == 0) {
gboolean bBold = (strcmp(pszValue, "yes") == 0);
for(i = nMinZoomLevel - 1; i < nMaxZoomLevel ; i++) {
diff --git a/src/map_style.h b/src/map_style.h
index c0c4903..3b81289 100644
--- a/src/map_style.h
+++ b/src/map_style.h
@@ -31,6 +31,7 @@ G_BEGIN_DECLS
#include "main.h"
#include "map.h"
+#include "glyph.h"
typedef struct dashstyle {
gdouble* pafDashList; // the dashes, as an array of gdouble's (for Cairo)
@@ -40,17 +41,15 @@ typedef struct dashstyle {
// defines the look of a layer
typedef struct layerstyle {
- color_t clrPrimary; // Color used for polygon fill or line stroke
- gdouble fLineWidth;
+ color_t clrPrimary; // Color used for polygon fill or line stroke
+ glyph_t* pGlyphFill; // glyph image used to fill polygon, or NULL
+ // Used just for lines
+ gdouble fLineWidth;
gint nJoinStyle;
gint nCapStyle;
-
dashstyle_t* pDashStyle;
- // XXX: switch to this:
- //dashstyle_t pDashStyle; // can be NULL
-
// Used just for text
gdouble fFontSize;
gboolean bFontBold;
diff --git a/src/road.h b/src/road.h
index 9dd319b..a369ea9 100644
--- a/src/road.h
+++ b/src/road.h
@@ -26,6 +26,8 @@
typedef struct {
GPtrArray* pPointsArray;
+// maprect_t rcMapBoundingBox;
+
gchar* pszName;
gint nAddressLeftStart;
gint nAddressLeftEnd;
diff --git a/src/searchwindow.c b/src/searchwindow.c
index 97ecc17..40c9288 100644
--- a/src/searchwindow.c
+++ b/src/searchwindow.c
@@ -57,6 +57,10 @@
struct {
GtkEntry* pSearchEntry; // search text box (on the toolbar)
+ GtkComboBoxEntry* pSearchComboBoxEntry;
+
+ GtkEntry* pSearchLocationEntry; // search text box (on the toolbar)
+
GtkButton* pSearchButton; // search button (on the toolbar)
// results list (on the sidebar)
@@ -80,6 +84,8 @@ static void searchwindow_go_to_selected_result(void);
void searchwindow_init(GladeXML* pGladeXML)
{
GLADE_LINK_WIDGET(pGladeXML, g_SearchWindow.pSearchEntry, GTK_ENTRY, "searchentry");
+ GLADE_LINK_WIDGET(pGladeXML, g_SearchWindow.pSearchComboBoxEntry, GTK_COMBO_BOX_ENTRY, "searchcomboboxentry");
+ GLADE_LINK_WIDGET(pGladeXML, g_SearchWindow.pSearchLocationEntry, GTK_ENTRY, "searchlocationentry");
GLADE_LINK_WIDGET(pGladeXML, g_SearchWindow.pSearchButton, GTK_BUTTON, "searchbutton");
GLADE_LINK_WIDGET(pGladeXML, g_SearchWindow.pResultsTreeView, GTK_TREE_VIEW, "searchresultstreeview");
GLADE_LINK_WIDGET(pGladeXML, g_SearchWindow.pNextSearchResultMenuItem, GTK_MENU_ITEM, "nextresultmenuitem");
@@ -112,6 +118,12 @@ void searchwindow_init(GladeXML* pGladeXML)
g_signal_connect(G_OBJECT(pTreeSelection), "changed", (GtkSignalFunc)searchwindow_on_resultslist_selection_changed, NULL);
searchwindow_update_next_and_prev_buttons();
+
+// util_gtk_entry_add_hint_text(g_SearchWindow.pSearchEntry, "type place or address");
+ util_gtk_entry_add_hint_text(g_SearchWindow.pSearchLocationEntry, "near here");
+
+ g_SearchWindow.pSearchComboBoxEntry;
+ GtkComboBoxEntry a;
}
void searchwindow_clear_results(void)
diff --git a/src/util.c b/src/util.c
index 9357252..57aed19 100644
--- a/src/util.c
+++ b/src/util.c
@@ -403,3 +403,48 @@ gchar* util_str_replace_many(const gchar* pszSource, util_str_replace_t* aReplac
g_string_free(pStringBuffer, FALSE); // do NOT free the 'str' memory
return pszReturn;
}
+
+//
+//
+//
+static void _util_gtk_entry_set_hint_text(GtkEntry* pEntry, const gchar* pszHint)
+{
+ gtk_widget_modify_text(pEntry, GTK_STATE_NORMAL, &(GTK_WIDGET(pEntry)->style->text_aa[GTK_WIDGET_STATE(pEntry)]));
+ gtk_entry_set_text(pEntry, pszHint);
+}
+
+static void _util_gtk_entry_clear_hint_text(GtkEntry* pEntry)
+{
+ gtk_widget_modify_text(pEntry, GTK_STATE_NORMAL, NULL);
+ gtk_entry_set_text(pEntry, "");
+}
+
+static gboolean _util_gtk_entry_on_focus_in_event(GtkEntry* pEntry, GdkEventFocus* _unused, gchar* pszHint)
+{
+ // If the box is showing pszHint, clear it
+ gchar* pszExistingText = gtk_entry_get_text(pEntry);
+ if(strcmp(pszExistingText, pszHint) == 0) {
+ _util_gtk_entry_clear_hint_text(pEntry);
+ }
+ return FALSE; // always say we didn't handle it so the normal processing happens
+}
+
+static gboolean _util_gtk_entry_on_focus_out_event(GtkEntry* pEntry, GdkEventFocus* _unused, gchar* pszHint)
+{
+ // If the box is empty, set the hint text
+ gchar* pszExistingText = gtk_entry_get_text(pEntry);
+ if(strcmp(pszExistingText, "") == 0) {
+ _util_gtk_entry_set_hint_text(pEntry, pszHint);
+ }
+ return FALSE; // always say we didn't handle it so the normal processing happens
+}
+
+// The API
+void util_gtk_entry_add_hint_text(GtkEntry* pEntry, const gchar* pszHint)
+{
+ g_signal_connect(G_OBJECT(pEntry), "focus-in-event", _util_gtk_entry_on_focus_in_event, pszHint);
+ g_signal_connect(G_OBJECT(pEntry), "focus-out-event", _util_gtk_entry_on_focus_out_event, pszHint);
+
+ // Init it
+ _util_gtk_entry_on_focus_out_event(pEntry, NULL, pszHint);
+}
diff --git a/src/util.h b/src/util.h
index 8501470..fdd3e34 100644
--- a/src/util.h
+++ b/src/util.h
@@ -73,4 +73,7 @@ typedef struct {
gchar* util_str_replace_many(const gchar* pszSource, util_str_replace_t* aReplacements, gint nNumReplacements);
+// GtkEntry "hint"
+void util_gtk_entry_add_hint_text(GtkEntry* pEntry, const gchar* pszMessage);
+
#endif