summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan FitiƩ <jfitie@gmail.com>2017-08-01 21:26:38 +0200
committerPierre GRANDIN <pgrandin@users.noreply.github.com>2017-08-01 12:26:38 -0700
commitfe72380925d56323f825c28b382527691a66e8c8 (patch)
tree3771774ff3fe3e432e558f6079423990b7b67796
parent48f4f856a8b2fd2dcff0432b3e76fc716f3dd4f9 (diff)
downloadnavit-fe72380925d56323f825c28b382527691a66e8c8.tar.gz
Auto pitch and orientation (#306)
* Initial commit * Use original pitch when autozoom is not active * Apply pitch correction in reverse when reading attribute * Always show zoom in and out buttons * Remove space before closing tag
-rw-r--r--navit/navit.c4
-rw-r--r--navit/xslt/osd_minimum.xslt10
2 files changed, 10 insertions, 4 deletions
diff --git a/navit/navit.c b/navit/navit.c
index 120b96049..fa2db9926 100644
--- a/navit/navit.c
+++ b/navit/navit.c
@@ -2596,7 +2596,7 @@ navit_set_attr_do(struct navit *this_, struct attr *attr, int init)
case attr_pitch:
attr_updated=(this_->pitch != attr->u.num);
this_->pitch=attr->u.num;
- transform_set_pitch(this_->trans, ceil(this_->pitch*sqrt(240*320)/sqrt(this_->w*this_->h))); // Pitch corrected for window resolution
+ transform_set_pitch(this_->trans, round(this_->pitch*sqrt(240*320)/sqrt(this_->w*this_->h))); // Pitch corrected for window resolution
if (!init && attr_updated && this_->ready == 3)
navit_draw(this_);
break;
@@ -2836,7 +2836,7 @@ navit_get_attr(struct navit *this_, enum attr_type type, struct attr *attr, stru
attr->u.num=this_->osd_configuration;
break;
case attr_pitch:
- attr->u.num=transform_get_pitch(this_->trans);
+ attr->u.num=round(transform_get_pitch(this_->trans)*sqrt(this_->w*this_->h)/sqrt(240*320)); // Pitch corrected for window resolution
break;
case attr_projection:
if(this_->trans) {
diff --git a/navit/xslt/osd_minimum.xslt b/navit/xslt/osd_minimum.xslt
index d392a7cce..5c9c8a0b3 100644
--- a/navit/xslt/osd_minimum.xslt
+++ b/navit/xslt/osd_minimum.xslt
@@ -15,9 +15,15 @@
<xsl:text>&#x0A; </xsl:text>
<osd type="text" label="${{navigation.item[1].length[named]}}" x="0" y="{-$NEXT_TURN_TEXT_HIGHT}" w="{$NEXT_TURN_SIZE+$NEXT_TURN_TEXT_HIGHT}" h="{$NEXT_TURN_TEXT_HIGHT}" font_size="{round(200*number($OSD_SIZE))}" enable_expression="navigation.nav_status>=3"/>
<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" use_overlay="{$OSD_USE_OVERLAY}"/>
+ <osd type="button" src="gui_zoom_manual_{number($ICON_BIG)}_{number($ICON_BIG)}.png" command="autozoom_active=0" x="0" y="0" osd_configuration="1" use_overlay="{$OSD_USE_OVERLAY}" enable_expression="autozoom_active!=0"/>
<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)+8*number($OSD_SIZE))}" osd_configuration="1" use_overlay="{$OSD_USE_OVERLAY}"/>
+ <osd type="button" src="gui_zoom_auto_{number($ICON_BIG)}_{number($ICON_BIG)}.png" command="autozoom_active=1" x="0" y="0" osd_configuration="1" use_overlay="{$OSD_USE_OVERLAY}" enable_expression="autozoom_active==0"/>
+ <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="{round(number($ICON_BIG)+8*number($OSD_SIZE))}" osd_configuration="1" use_overlay="{$OSD_USE_OVERLAY}"/>
+ <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(2*(number($ICON_BIG)+8*number($OSD_SIZE)))}" osd_configuration="1" use_overlay="{$OSD_USE_OVERLAY}"/>
+ <xsl:text>&#x0A; </xsl:text>
+ <osd type="cmd_interface" update_period="1" command="pitch=autozoom_active==0?pitch:(follow>1?0:20);orientation=autozoom_active==0?orientation:(follow>1?0:-1)" x="-1" y="-1" w="1" h="1"/>
<xsl:text>&#x0A; </xsl:text>
<osd type="button" src="cursor_{number($ICON_BIG)}_{number($ICON_BIG)}.png" command="follow=0;set_center_cursor()" x="{round(number($ICON_BIG)+8*number($OSD_SIZE))}" y="0" enable_expression="follow>1" use_overlay="{$OSD_USE_OVERLAY}"/>
<xsl:text>&#x0A; </xsl:text>