[gtk-doc] Make navigation header size adaptive



commit aa5717ba8ce873f405d5391521216fea173aa818
Author: William Jon McCann <william jon mccann gmail com>
Date:   Wed Feb 12 11:51:38 2014 -0500

    Make navigation header size adaptive
    
    See http://www.w3.org/TR/css3-mediaqueries/

 gtk-doc-single.xsl |   72 +++++++++++++-----------------------------------
 gtk-doc.xsl        |   76 ++++++++++++++++-----------------------------------
 style/style.css    |   22 ++++++++++++---
 3 files changed, 62 insertions(+), 108 deletions(-)
---
diff --git a/gtk-doc-single.xsl b/gtk-doc-single.xsl
index ff58ea9..b72874d 100644
--- a/gtk-doc-single.xsl
+++ b/gtk-doc-single.xsl
@@ -240,97 +240,65 @@ Get a newer version at http://docbook.sourceforge.net/projects/xsl/
             <a href="#" class="shortcut">Top</a>
             <xsl:if test="count($sections) > 0">
               <xsl:if test="count($sect_desc) > 0">
-                &#160;<span class="dim">|</span>&#160;
+                <span id="nav_description">&#160;<span class="dim">|</span>&#160;
                 <a href="#{$section_id}.description" class="shortcut">
                   <xsl:value-of select="./refsect1[ role='desc']/title"/>
-                </a>
+                </a></span>
               </xsl:if>
               <xsl:if test="count($sect_object_hierarchy) > 0">
-                &#160;<span class="dim">|</span>&#160;
+                <span id="nav_hierarchy">&#160;<span class="dim">|</span>&#160;
                 <a href="#{$section_id}.object-hierarchy" class="shortcut">
                   <xsl:value-of select="./refsect1[ role='object_hierarchy']/title"/>
-                </a>
+                </a></span>
               </xsl:if>
               <xsl:if test="count($sect_impl_interfaces) > 0">
-                &#160;<span class="dim">|</span>&#160;
+                <span id="nav_interfaces">&#160;<span class="dim">|</span>&#160;
                 <a href="#{$section_id}.implemented-interfaces" class="shortcut">
                   <xsl:value-of select="./refsect1[ role='impl_interfaces']/title"/>
-                </a>
+                </a></span>
               </xsl:if>
               <xsl:if test="count($sect_prerequisites) > 0">
-                &#160;<span class="dim">|</span>&#160;
+                <span id="nav_prerequisites">&#160;<span class="dim">|</span>&#160;
                 <a href="#{$section_id}.prerequisites" class="shortcut">
                   <xsl:value-of select="./refsect1[ role='prerequisites']/title"/>
-                </a>
+                </a></span>
               </xsl:if>
               <xsl:if test="count($sect_derived_interfaces) > 0">
-                &#160;<span class="dim">|</span>&#160;
+                <span id="nav_derived_interfaces">&#160;<span class="dim">|</span>&#160;
                 <a href="#{$section_id}.derived-interfaces" class="shortcut">
                   <xsl:value-of select="./refsect1[ role='derived_interfaces']/title"/>
-                </a>
+                </a></span>
               </xsl:if>
               <xsl:if test="count($sect_implementations) > 0">
-                &#160;<span class="dim">|</span>&#160;
+                <span id="nav_implementations">&#160;<span class="dim">|</span>&#160;
                 <a href="#{$section_id}.implementations" class="shortcut">
                   <xsl:value-of select="./refsect1[ role='implementations']/title"/>
-                </a>
+                </a></span>
               </xsl:if>
               <xsl:if test="count($sect_properties) > 0">
-                &#160;<span class="dim">|</span>&#160;
+                <span id="nav_properties">&#160;<span class="dim">|</span>&#160;
                 <a href="#{$section_id}.properties" class="shortcut">
                   <xsl:value-of select="./refsect1[ role='properties']/title"/>
-                </a>
+                </a></span>
               </xsl:if>
               <xsl:if test="count($sect_child_properties) > 0">
-                &#160;<span class="dim">|</span>&#160;
+                <span id="nav_child_properties">&#160;<span class="dim">|</span>&#160;
                 <a href="#{$section_id}.child-properties" class="shortcut">
                   <xsl:value-of select="./refsect1[ role='child_properties']/title"/>
-                </a>
+                </a></span>
               </xsl:if>
               <xsl:if test="count($sect_style_properties) > 0">
-                &#160;<span class="dim">|</span>&#160;
+                <span id="nav_style_properties">&#160;<span class="dim">|</span>&#160;
                 <a href="#{$section_id}.style-properties" class="shortcut">
                   <xsl:value-of select="./refsect1[ role='style_properties']/title"/>
-                </a>
+                </a></span>
               </xsl:if>
               <xsl:if test="count($sect_signal_proto) > 0">
-                &#160;<span class="dim">|</span>&#160;
+                <span id="nav_signals">&#160;<span class="dim">|</span>&#160;
                 <a href="#{$section_id}.signals" class="shortcut">
                   <xsl:value-of select="./refsect1[ role='signal_proto']/title"/>
-                </a>
-              </xsl:if>
-              <!--
-              <xsl:if test="count($sect_details) > 0">
-                <a href="#details" class="shortcut">
-                  <xsl:value-of select="./refsect1[ id='details']/title"/>
-                </a>
-                &#160;<span class="dim">|</span>&#160;
-              </xsl:if>
-              <xsl:if test="count($sect_property_details) > 0">
-                <a href="#property_details" class="shortcut">
-                  <xsl:value-of select="./refsect1[ id='property_details']/title"/>
-                </a>
-                &#160;<span class="dim">|</span>&#160;
-              </xsl:if>
-              <xsl:if test="count($sect_child_property_details) > 0">
-                <a href="#child_property_details" class="shortcut">
-                  <xsl:value-of select="./refsect1[ id='property_child_details']/title"/>
-                </a>
-                &#160;<span class="dim">|</span>&#160;
-              </xsl:if>
-              <xsl:if test="count($sect_style_property_details) > 0">
-                <a href="#style_property_details" class="shortcut">
-                  <xsl:value-of select="./refsect1[ id='style_property_details']/title"/>
-                </a>
-                &#160;<span class="dim">|</span>&#160;
-              </xsl:if>
-              <xsl:if test="count($sect_signals) > 0">
-                <a href="#signals" class="shortcut">
-                  <xsl:value-of select="./refsect1[ id='signals']/title"/>
-                </a>
-                &#160;<span class="dim">|</span>&#160;
+                </a></span>
               </xsl:if>
-              -->
             </xsl:if>
           </td>
           <xsl:choose>
diff --git a/gtk-doc.xsl b/gtk-doc.xsl
index 033172b..290c1e8 100644
--- a/gtk-doc.xsl
+++ b/gtk-doc.xsl
@@ -475,103 +475,72 @@ Get a newer version at http://docbook.sourceforge.net/projects/xsl/
               <xsl:when test="count($refsections) > 0">
                 <a href="#" class="shortcut">Top</a>
                 <xsl:if test="count($sect_desc) > 0">
-                  &#160;<span class="dim">|</span>&#160;
+                  <span id="nav_description">&#160;<span class="dim">|</span>&#160;
                   <a href="#{$section_id}.description" class="shortcut">
                     <xsl:value-of select="./refsect1[ role='desc']/title"/>
-                  </a>
+                  </a></span>
                 </xsl:if>
                 <xsl:if test="count($sect_object_hierarchy) > 0">
-                  &#160;<span class="dim">|</span>&#160;
+                  <span id="nav_hierarchy">&#160;<span class="dim">|</span>&#160;
                   <a href="#{$section_id}.object-hierarchy" class="shortcut">
                     <xsl:value-of select="./refsect1[ role='object_hierarchy']/title"/>
-                  </a>
+                  </a></span>
                 </xsl:if>
                 <xsl:if test="count($sect_impl_interfaces) > 0">
-                  &#160;<span class="dim">|</span>&#160;
+                  <span id="nav_interfaces">&#160;<span class="dim">|</span>&#160;
                   <a href="#{$section_id}.implemented-interfaces" class="shortcut">
                     <xsl:value-of select="./refsect1[ role='impl_interfaces']/title"/>
-                  </a>
+                  </a></span>
                 </xsl:if>
                 <xsl:if test="count($sect_prerequisites) > 0">
-                  &#160;<span class="dim">|</span>&#160;
+                  <span id="nav_prerequisites">&#160;<span class="dim">|</span>&#160;
                   <a href="#{$section_id}.prerequisites" class="shortcut">
                     <xsl:value-of select="./refsect1[ role='prerequisites']/title"/>
-                  </a>
+                  </a></span>
                 </xsl:if>
                 <xsl:if test="count($sect_derived_interfaces) > 0">
-                  &#160;<span class="dim">|</span>&#160;
+                  <span id="nav_derived_interfaces">&#160;<span class="dim">|</span>&#160;
                   <a href="#{$section_id}.derived-interfaces" class="shortcut">
                     <xsl:value-of select="./refsect1[ role='derived_interfaces']/title"/>
-                  </a>
+                  </a></span>
                 </xsl:if>
                 <xsl:if test="count($sect_implementations) > 0">
-                  &#160;<span class="dim">|</span>&#160;
+                  <span id="nav_implementations">&#160;<span class="dim">|</span>&#160;
                   <a href="#{$section_id}.implementations" class="shortcut">
                     <xsl:value-of select="./refsect1[ role='implementations']/title"/>
-                  </a>
+                  </a></span>
                 </xsl:if>
                 <xsl:if test="count($sect_properties) > 0">
-                  &#160;<span class="dim">|</span>&#160;
+                  <span id="nav_properties">&#160;<span class="dim">|</span>&#160;
                   <a href="#{$section_id}.properties" class="shortcut">
                     <xsl:value-of select="./refsect1[ role='properties']/title"/>
-                  </a>
+                  </a></span>
                 </xsl:if>
                 <xsl:if test="count($sect_child_properties) > 0">
-                  &#160;<span class="dim">|</span>&#160;
+                  <span id="nav_child_properties">&#160;<span class="dim">|</span>&#160;
                   <a href="#{$section_id}.child-properties" class="shortcut">
                     <xsl:value-of select="./refsect1[ role='child_properties']/title"/>
-                  </a>
+                  </a></span>
                 </xsl:if>
                 <xsl:if test="count($sect_style_properties) > 0">
-                  &#160;<span class="dim">|</span>&#160;
+                  <span id="nav_style_properties">&#160;<span class="dim">|</span>&#160;
                   <a href="#{$section_id}.style-properties" class="shortcut">
                     <xsl:value-of select="./refsect1[ role='style_properties']/title"/>
-                  </a>
+                  </a></span>
                 </xsl:if>
                 <xsl:if test="count($sect_signal_proto) > 0">
-                  &#160;<span class="dim">|</span>&#160;
+                  <span id="nav_signals">&#160;<span class="dim">|</span>&#160;
                   <a href="#{$section_id}.signals" class="shortcut">
                     <xsl:value-of select="./refsect1[ role='signal_proto']/title"/>
-                  </a>
+                  </a></span>
                 </xsl:if>
-                <!--
-                    <xsl:if test="count($sect_details) > 0">
-                    <a href="#details" class="shortcut">
-                    <xsl:value-of select="./refsect1[ id='details']/title"/>
-                    </a>
-                    &#160;<span class="dim">|</span>&#160;
-                    </xsl:if>
-                    <xsl:if test="count($sect_property_details) > 0">
-                    <a href="#property_details" class="shortcut">
-                    <xsl:value-of select="./refsect1[ id='property_details']/title"/>
-                    </a>
-                    &#160;<span class="dim">|</span>&#160;
-                    </xsl:if>
-                    <xsl:if test="count($sect_child_property_details) > 0">
-                    <a href="#child_property_details" class="shortcut">
-                    <xsl:value-of select="./refsect1[ id='property_child_details']/title"/>
-                    </a>
-                    &#160;<span class="dim">|</span>&#160;
-                    </xsl:if>
-                    <xsl:if test="count($sect_style_property_details) > 0">
-                    <a href="#style_property_details" class="shortcut">
-                    <xsl:value-of select="./refsect1[ id='style_property_details']/title"/>
-                    </a>
-                    &#160;<span class="dim">|</span>&#160;
-                    </xsl:if>
-                    <xsl:if test="count($sect_signals) > 0">
-                    <a href="#signals" class="shortcut">
-                    <xsl:value-of select="./refsect1[ id='signals']/title"/>
-                    </a>
-                    &#160;<span class="dim">|</span>&#160;
-                    </xsl:if>
-                -->
               </xsl:when>
               <!-- this is not yet very nice, as it requires all glossdic/indexdiv
                    elements having a anchor element. maybe we can customize the xsl
                    to automaticaly create local anchors
               -->
               <xsl:when test="count($glssections) > 0">
+                <span id="nav_glossary">
                 <xsl:for-each select="./glossdiv">
                   <xsl:if test="position() > 1">
                     &#160;<span class="dim">|</span>&#160;
@@ -581,8 +550,10 @@ Get a newer version at http://docbook.sourceforge.net/projects/xsl/
                     <xsl:value-of select="./title"/>
                   </a>
                 </xsl:for-each>
+                </span>
               </xsl:when>
               <xsl:when test="count($idxsections) > 0">
+                <span id="nav_index">
                 <xsl:for-each select="./indexdiv/indexdiv">
                   <xsl:if test="position() > 1">
                     &#160;<span class="dim">|</span>&#160;
@@ -592,6 +563,7 @@ Get a newer version at http://docbook.sourceforge.net/projects/xsl/
                     <xsl:value-of select="./title"/>
                   </a>
                 </xsl:for-each>
+                </span>
               </xsl:when>
             </xsl:choose>
           </td>
diff --git a/style/style.css b/style/style.css
index 367fc3a..002fc94 100644
--- a/style/style.css
+++ b/style/style.css
@@ -35,7 +35,6 @@ body
   {
     position: relative;
     top: 0em ! important;
-    
   }
   /* this is needed so that the local anchors are displayed below the naviagtion */
   div.footnote a[name], div.refnamediv a[name], div.refsect1 a[name], div.refsect2 a[name], div.index 
a[name], div.glossary a[name], div.sect1 a[name]
@@ -56,12 +55,11 @@ body
   {
     padding-top: 5em;
     padding-bottom: 500px;
-    max-width: 800px;
-    margin: auto;
+    max-width: 60em;
   }
   p
   {
-    max-width: 800px
+    max-width: 60em;
   }
   /* style and size the navigation bar */
   table.navigation#top
@@ -98,6 +96,22 @@ body
     color: #babdb6;
   }
 }
+ media screen and (min-width: 60em) {
+  /* screen larger than 60em */
+  body { margin: auto; }
+}
+ media screen and (max-width: 60em) {
+  /* screen less than 60em */
+  #nav_hierarchy { display: none; }
+  #nav_interfaces { display: none; }
+  #nav_prerequisites { display: none; }
+  #nav_derived_interfaces { display: none; }
+  #nav_implementations { display: none; }
+  #nav_child_properties { display: none; }
+  #nav_style_properties { display: none; }
+  #nav_index { display: none; }
+  #nav_glossary { display: none; }
+}
 @media print {
   table.navigation {
     visibility: collapse;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]