Fix:core:Update some XSLTs to better support different display sizes
authorrikky <rikky@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Sun, 13 Mar 2011 22:55:40 +0000 (22:55 +0000)
committerrikky <rikky@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Sun, 13 Mar 2011 22:55:40 +0000 (22:55 +0000)
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@4344 ffa7fe5e-494d-0410-b361-a75ebd5db220

navit/navit/xslt/android.xslt
navit/navit/xslt/cursor_scale.xslt [new file with mode: 0644]
navit/navit/xslt/map_sdcard_navitmap_bin.xslt
navit/navit/xslt/osd_minimum.xslt

index 7830cf8..3efe668 100644 (file)
@@ -1,30 +1,66 @@
 <?xml version="1.0"?>
 <xsl:transform version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xi="http://www.w3.org/2001/XInclude">
-        <xsl:output method="xml" doctype-system="navit.dtd" cdata-section-elements="gui"/>
-        <xsl:variable name="OSD_SIZE">1.33</xsl:variable>
-       <xsl:include href="default_plugins.xslt"/>
-       <xsl:include href="map_sdcard_navitmap_bin.xslt"/>
-       <xsl:include href="osd_minimum.xslt"/>
-        <xsl:template match="/config/plugins/plugin[1]" priority="100">
-               <plugin path="$NAVIT_PREFIX/lib/libgraphics_android.so" ondemand="no"/>
-               <xsl:text>&#x0A;        </xsl:text>
-               <plugin path="$NAVIT_PREFIX/lib/libvehicle_android.so" ondemand="no"/>
-               <xsl:text>&#x0A;        </xsl:text>
-               <plugin path="$NAVIT_PREFIX/lib/libspeech_android.so" ondemand="no"/>
-               <xsl:text>&#x0A;        </xsl:text>
-               <xsl:next-match/>
-        </xsl:template>
-        <xsl:template match="/config/navit/graphics">
-                <graphics type="android" />
-        </xsl:template>
-        <xsl:template match="/config/navit/vehicle[1]">
-                <xsl:copy><xsl:copy-of select="@*[not(name()='gpsd_query')]"/>
-                       <xsl:attribute name="source">android:</xsl:attribute>
-                       <xsl:attribute name="follow">1</xsl:attribute>
-               <xsl:apply-templates/></xsl:copy>
-       </xsl:template>
-        <xsl:template match="/config/navit/speech">
-                <xsl:copy><xsl:copy-of select="@*[not(name()='data')]"/><xsl:attribute name="type">android</xsl:attribute><xsl:apply-templates/></xsl:copy>
-       </xsl:template>
-        <xsl:template match="@*|node()"><xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy></xsl:template>
+   <xsl:param name="OSD_SIZE" select="1.33"/>
+   <xsl:param name="ICON_SMALL" select="32"/>
+   <xsl:param name="ICON_MEDIUM" select="32"/>
+   <xsl:param name="ICON_BIG" select="64"/>
+   
+   <xsl:output method="xml" doctype-system="navit.dtd" cdata-section-elements="gui"/>
+   <xsl:include href="default_plugins.xslt"/>
+   <xsl:include href="map_sdcard_navitmap_bin.xslt"/>
+   <xsl:include href="osd_minimum.xslt"/>
+   <xsl:include href="cursor_scale.xslt"/>
+   <xsl:template match="/config/plugins/plugin[1]" priority="100">
+      <plugin path="$NAVIT_PREFIX/lib/libgraphics_android.so" ondemand="no"/>
+      <xsl:text>&#x0A;        </xsl:text>
+      <plugin path="$NAVIT_PREFIX/lib/libvehicle_android.so" ondemand="no"/>
+      <xsl:text>&#x0A;        </xsl:text>
+      <plugin path="$NAVIT_PREFIX/lib/libspeech_android.so" ondemand="no"/>
+      <xsl:text>&#x0A;        </xsl:text>
+      <xsl:next-match/>
+   </xsl:template>
+   <xsl:template match="/config/navit/graphics">
+      <graphics type="android" />
+   </xsl:template>
+   <xsl:template match="/config/navit/gui[2]">
+      <xsl:copy>
+         <xsl:copy-of select="@*[not(name()='font_size')]"/>
+         <xsl:attribute name="font_size"><xsl:value-of select="round(185*number($OSD_SIZE))"/></xsl:attribute>
+         <xsl:attribute name="icon_xs"><xsl:value-of select="number($ICON_MEDIUM)"/></xsl:attribute>
+         <xsl:attribute name="icon_s"><xsl:value-of select="number($ICON_SMALL)"/></xsl:attribute>
+         <xsl:attribute name="icon_l"><xsl:value-of select="number($ICON_BIG)"/></xsl:attribute>
+         <xsl:attribute name="spacing"><xsl:value-of select="round(2*number($OSD_SIZE))"/></xsl:attribute>
+         <xsl:apply-templates/>
+      </xsl:copy>
+   </xsl:template>
+   <xsl:template match="/config/navit[1]">
+      <xsl:copy>
+         <xsl:copy-of select="@*"/>
+         <xsl:attribute name="zoom">32</xsl:attribute>
+         <xsl:apply-templates/>
+      </xsl:copy>
+   </xsl:template>
+   <xsl:template match="/config/navit/vehicle[1]">
+      <xsl:copy><xsl:copy-of select="@*[not(name()='gpsd_query')]"/>
+      <xsl:attribute name="source">android:</xsl:attribute>
+      <xsl:attribute name="follow">1</xsl:attribute>
+      <xsl:apply-templates/></xsl:copy>
+   </xsl:template>
+   <xsl:template match="/config/navit/speech">
+      <xsl:copy>
+         <xsl:copy-of select="@*[not(name()='data')]"/>
+         <xsl:attribute name="type">android</xsl:attribute>
+         <xsl:apply-templates/>
+      </xsl:copy>
+   </xsl:template>
+   <xsl:template match="/config/navit/layout[@name='Car-Android']">
+      <xsl:copy>
+         <xsl:copy-of select="@*"/>
+         <xsl:attribute name="active">1</xsl:attribute>
+         <xsl:apply-templates/>
+      </xsl:copy>
+   </xsl:template>
+   <xsl:template match="@*|node()">
+      <xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy>
+   </xsl:template>
 </xsl:transform>
diff --git a/navit/navit/xslt/cursor_scale.xslt b/navit/navit/xslt/cursor_scale.xslt
new file mode 100644 (file)
index 0000000..c4eeda3
--- /dev/null
@@ -0,0 +1,41 @@
+<?xml version="1.0"?>
+<xsl:transform version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xi="http://www.w3.org/2001/XInclude">
+   <xsl:template match="/config/navit/layout/cursor">
+      <xsl:param name="OLD_W"><xsl:value-of select="@w"/></xsl:param>
+      <xsl:param name="OLD_H"><xsl:value-of select="@h"/></xsl:param>
+      <xsl:copy>
+         <xsl:copy-of select="@*"/>
+         <xsl:attribute name="w"><xsl:value-of select="round($OLD_W*number($OSD_SIZE))"/></xsl:attribute>
+         <xsl:attribute name="h"><xsl:value-of select="round($OLD_H*number($OSD_SIZE))"/></xsl:attribute>
+         <xsl:apply-templates/>
+      </xsl:copy>
+   </xsl:template>
+   <xsl:template match="/config/navit/layout/cursor/itemgra/circle">
+      <xsl:param name="OLD_RADIUS"><xsl:value-of select="@radius"/></xsl:param>
+      <xsl:param name="OLD_WIDTH"><xsl:value-of select="@width"/></xsl:param>
+      <xsl:copy>
+         <xsl:copy-of select="@*"/>
+         <xsl:attribute name="radius"><xsl:value-of select="round($OLD_RADIUS*number($OSD_SIZE))"/></xsl:attribute>
+         <xsl:attribute name="width"><xsl:value-of select="round($OLD_WIDTH*number($OSD_SIZE))"/></xsl:attribute>
+         <xsl:apply-templates/>
+      </xsl:copy>
+   </xsl:template>
+   <xsl:template match="/config/navit/layout/cursor/itemgra/polyline">
+      <xsl:param name="OLD_WIDTH"><xsl:value-of select="@width"/></xsl:param>
+      <xsl:copy>
+         <xsl:copy-of select="@*"/>
+         <xsl:attribute name="width"><xsl:value-of select="round($OLD_WIDTH*number($OSD_SIZE))"/></xsl:attribute>
+         <xsl:apply-templates/>
+      </xsl:copy>
+   </xsl:template>
+   <xsl:template match="/config/navit/layout/cursor/itemgra/*/coord">
+      <xsl:param name="OLD_X"><xsl:value-of select="@x"/></xsl:param>
+      <xsl:param name="OLD_Y"><xsl:value-of select="@y"/></xsl:param>
+      <xsl:copy>
+         <xsl:copy-of select="@*"/>
+         <xsl:attribute name="x"><xsl:value-of select="round(number($OLD_X)*number($OSD_SIZE))"/></xsl:attribute>
+         <xsl:attribute name="y"><xsl:value-of select="round(number($OLD_Y)*number($OSD_SIZE))"/></xsl:attribute>
+         <xsl:apply-templates/>
+      </xsl:copy>
+   </xsl:template>
+</xsl:transform>
index 52495f1..8522272 100644 (file)
@@ -2,5 +2,6 @@
 <xsl:transform version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xi="http://www.w3.org/2001/XInclude">
        <xsl:template match="/config/navit/mapset/xi:include">
                <map type="binfile" enabled="yes" data="/sdcard/navitmap.bin" />
+               <map type="binfile" enabled="yes" data="/sdcard/navit/navitmap.bin" />
        </xsl:template>
 </xsl:transform>
index aad5c67..b44e55a 100644 (file)
@@ -1,24 +1,18 @@
 <?xml version="1.0"?>
 <xsl:transform version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xi="http://www.w3.org/2001/XInclude">
-        <xsl:template match="/config/navit/osd[1]">
-               <xsl:variable name="OSD_SIZE_">
-                       <xsl:choose>
-                               <xsl:when test="string-length($OSD_SIZE)"><xsl:value-of select="$OSD_SIZE"/></xsl:when>
-                               <xsl:otherwise>1</xsl:otherwise>
-                       </xsl:choose>
-               </xsl:variable>
-               <osd type="compass" enabled="yes" x="{round(-60*number($OSD_SIZE_))}" y="{round(-80*number($OSD_SIZE_))}" w="{round(60*number($OSD_SIZE_))}" h="{round(80*number($OSD_SIZE_))}" font_size="{round(200*number($OSD_SIZE_))}" osd_configuration="1"/>
-               <xsl:text>&#x0A;        </xsl:text>
-               <osd type="text" label="${{navigation.item.destination_length[named]}}\n${{navigation.item.destination_time[arrival]}}" x="{round(-60*number($OSD_SIZE_))}" y="0" w="{round(60*number($OSD_SIZE_))}" h="{round(40*number($OSD_SIZE_))}" font_size="{round(200*number($OSD_SIZE_))}" osd_configuration="1"/>
-               <xsl:text>&#x0A;        </xsl:text>
-               <osd type="navigation_next_turn" x="0" y="{round(-60*number($OSD_SIZE_))}" w="{round(60*number($OSD_SIZE_))}" h="{round(40*number($OSD_SIZE_))}" icon_src="%s_wh_{round(44*number($OSD_SIZE_))}_{round(44*number($OSD_SIZE_))}.png" osd_configuration="1"/>
-               <xsl:text>&#x0A;        </xsl:text>
-               <osd type="text" label="${{navigation.item[1].length[named]}}" x="0" y="{round(-20*number($OSD_SIZE_))}" w="{round(60*number($OSD_SIZE_))}" h="{round(20*number($OSD_SIZE_))}" font_size="{round(200*number($OSD_SIZE_))}" osd_configuration="1"/>
-               <xsl:text>&#x0A;        </xsl:text>
-               <osd type="button" src="gui_zoom_in_{round(48*number($OSD_SIZE_))}_{round(48*number($OSD_SIZE_))}.png" command="zoom_in()" x="0" y="0" osd_configuration="1"/>
-               <xsl:text>&#x0A;        </xsl:text>
-               <osd type="button" src="gui_zoom_out_{round(48*number($OSD_SIZE_))}_{round(48*number($OSD_SIZE_))}.png" command="zoom_out()" x="0" y="{round(53*number($OSD_SIZE_))}" osd_configuration="1"/>
-               <xsl:text>&#x0A;        </xsl:text>
-                <xsl:copy><xsl:copy-of select="@*|node()"/></xsl:copy>
-        </xsl:template>
+   <xsl:template match="/config/navit/osd[1]">
+      <osd type="compass" enabled="yes" x="{round(-60*number($OSD_SIZE))}" y="{round(-80*number($OSD_SIZE))}" w="{round(60*number($OSD_SIZE))}" h="{round(80*number($OSD_SIZE))}" font_size="{round(200*number($OSD_SIZE))}" osd_configuration="1"/>
+      <xsl:text>&#x0A;        </xsl:text>
+      <osd type="text" label="${{navigation.item.destination_length[named]}}\n${{navigation.item.destination_time[arrival]}}" x="{round(-60*number($OSD_SIZE))}" y="0" w="{round(60*number($OSD_SIZE))}" h="{round(40*number($OSD_SIZE))}" font_size="{round(200*number($OSD_SIZE))}" osd_configuration="1"/>
+      <xsl:text>&#x0A;        </xsl:text>
+      <osd type="navigation_next_turn" x="0" y="{round(-60*number($OSD_SIZE))}" w="{round(60*number($OSD_SIZE))}" h="{round(40*number($OSD_SIZE))}" icon_src="%s_wh_{$ICON_BIG}_{$ICON_BIG}.png" osd_configuration="1"/>
+      <xsl:text>&#x0A;        </xsl:text>
+      <osd type="text" label="${{navigation.item[1].length[named]}}" x="0" y="{round(-20*number($OSD_SIZE))}" w="{round(60*number($OSD_SIZE))}" h="{round(20*number($OSD_SIZE))}" font_size="{round(200*number($OSD_SIZE))}" osd_configuration="1"/>
+      <xsl:text>&#x0A;        </xsl:text>
+      <osd type="button" src="gui_zoom_in_{number($ICON_BIG)}_{number($ICON_BIG)}.png" command="zoom_in()" x="0" y="0" osd_configuration="1"/>
+      <xsl:text>&#x0A;        </xsl:text>
+      <osd type="button" src="gui_zoom_out_{number($ICON_BIG)}_{number($ICON_BIG)}.png" command="zoom_out()" x="0" y="{round(number($ICON_BIG)+16*number($OSD_SIZE))}" osd_configuration="1"/>
+      <xsl:text>&#x0A;        </xsl:text>
+      <xsl:copy><xsl:copy-of select="@*|node()"/></xsl:copy>
+   </xsl:template>
 </xsl:transform>