From 60c047405034d51359bdfbaac56bfa97ec06a352 Mon Sep 17 00:00:00 2001
From: Alex Parker <rockbox@aeparker.com>
Date: Sat, 20 Jun 2009 19:17:06 +0000
Subject: Prepare the manual to have two or three column button map tables so
 that remote keymaps can be added. btnmap is set to be either two or three
 columns wide depending on whether remote_kaymap is defined in the platform
 file for the target in question.  If it is, then every button table needs to
 have three columns of the form Main Unit Key  &  Remote Key  &  Description
 \\   or the manual will fail to build.  For some reason, it doesn't seem
 possible to put the \end{btnmap} in a macro, so leave it as it is in the
 keymaps.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21411 a1c6a512-1295-4272-9138-f99709370657
---
 manual/preamble.tex | 84 ++++++++++++++++++++++++++++++++++++++---------------
 1 file changed, 61 insertions(+), 23 deletions(-)

(limited to 'manual/preamble.tex')

diff --git a/manual/preamble.tex b/manual/preamble.tex
index 07a13fa392..0e22b1c8bb 100644
--- a/manual/preamble.tex
+++ b/manual/preamble.tex
@@ -194,30 +194,9 @@
 \setcounter{bottomnumber}{2} % default: 1
 \setcounter{totalnumber}{5}  % default: 3
 
-% command to set the default table heading for button lists
-\newcommand{\btnhead}{\textbf{Key} & \textbf{Action} \\\midrule}
 
-% environment intended to be used with button maps
-% usage: \begin{btnmap}{caption}{label} Button & ButtonAction \\ \end{btnmap}
-% Note: this automatically sets the table lines.
-% Note: you *need* to terminate the last line with a linebreak \\
-% Note: you still need to enclose this with \begin{table} / \end{table}
-% Cheers for the usenet helping me building this up :)
-\newenvironment{btnmap}[2]{%
-  \expandafter\let\expandafter\SavedEndTab\csname endtabular*\endcsname
-  \expandafter\renewcommand\expandafter*\csname endtabular*\endcsname{%
-    \bottomrule
-    \SavedEndTab%
-    \if\given{#1}\caption{#1}\fi%
-    \if\given{#2}\label{#2}\fi%
-    \endcenter%
-  }
-  \center
-\tabularx{.75\textwidth}{>{\raggedright\arraybackslash}p{.22\textwidth}X}\toprule % here is the table width defined
-  \btnhead
-}{%
-  \endtabularx
-}
+
+
 
 % command to set the default table heading for button lists
 \newcommand{\taghead}{\textbf{Tag} & \textbf{Description} \\\midrule}
@@ -320,3 +299,62 @@
 % generate index
 \usepackage{makeidx}
 \makeindex
+
+
+% command to set the default table heading for button lists
+\newcommand{\btnhead}{\textbf{Key} \opt{remote_keymap}{%
+  & \textbf{Remote Key}} & \textbf{Action} \\\midrule}
+% environment intended to be used with button maps
+% usage: \begin{btnmap}{caption}{label} Button & ButtonAction \\ \end{btnmap}
+% Note: this automatically sets the table lines.
+% Note: you *need* to terminate the last line with a linebreak \\
+% Note: you still need to enclose this with \begin{table} / \end{table}
+% Cheers for the usenet helping me building this up :)
+
+% btnmap is set to be either two or three columns wide depending on whether
+% remote_kaymap is defined in the platform file for the target in question.
+% If it is, then every button table needs to have three columns of the form
+% Main Unit Key  &  Remote Key  &  Description \\
+% or the manual will fail to build.  For some reason, it doesn't seem possible
+% to put the \end{btnmap} in a macro, so leave it as it is in the keymaps.
+
+\opt{remote_keymap}{
+\newenvironment{btnmap}[3]{%
+  \expandafter\let\expandafter\SavedEndTab\csname endtabular*\endcsname
+  \expandafter\renewcommand\expandafter*\csname endtabular*\endcsname{%
+    \bottomrule
+    \SavedEndTab%
+     \if\given{#1}\caption{#1}\fi%
+     \if\given{#2}\caption{#2}\fi%
+     \if\given{#3}\label{#3}\fi%
+    \endcenter%
+  }
+  \center
+  \tabularx{.9\textwidth}{>{\raggedright\arraybackslash}p{.2\textwidth}X>{\raggedright\arraybackslash}p{.2\textwidth}X}\toprule % here is the table width defined
+  \btnhead
+}{%
+  \endtabularx
+}
+\newcommand{\beginbuttonmap}{\begin{btnmap}{}{}{}}
+}
+
+\nopt{remote_keymap}{
+\newenvironment{btnmap}[2]{%
+  \expandafter\let\expandafter\SavedEndTab\csname endtabular*\endcsname
+  \expandafter\renewcommand\expandafter*\csname endtabular*\endcsname{%
+    \bottomrule
+    \SavedEndTab%
+    \if\given{#1}\caption{#1}\fi%
+    \if\given{#2}\label{#2}\fi%
+  \endcenter%
+  }
+  \center
+  \tabularx{.75\textwidth}{>{\raggedright\arraybackslash}p{.22\textwidth}X}\toprule % here is the table width defined
+  \btnhead
+}{%
+  \endtabularx
+}
+\newcommand{\beginbuttonmap}{\begin{btnmap}{}{}}
+}
+
+%\newcommand{\closebuttonmap}{\end{btnmap}}
\ No newline at end of file
-- 
cgit v1.2.3

