Patch #4958 from Dominik Riebeling (bluebrother). Adds a new \screenshot macro to be used when including screenshots. Look at the rockbox_interface/main.tex for examples on how to use it.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9359 a1c6a512-1295-4272-9138-f99709370657
diff --git a/manual/preamble.tex b/manual/preamble.tex
index d76fe9f..40fd601 100644
--- a/manual/preamble.tex
+++ b/manual/preamble.tex
@@ -64,4 +64,35 @@
     \bigskip
     \noindent}
 
+% found on the internet, posting by Donald Arseneau
+% I may as well include my robust expandable definions, which can be
+% used in \edef or \write where the \def would not be executed:
+%
+% \if\blank --- checks if parameter is blank (Spaces count as blank)
+% \if\given --- checks if parameter is not blank: like \if\blank{#1}\else
+% \if\nil --- checks if parameter is null (spaces are NOT null)
+% use \if\given{ } ... \else ... \fi etc.
+%
+{\catcode`\!=8 % funny catcode so ! will be a delimiter
+\catcode`\Q=3 % funny catcode so Q will be a delimiter
+\long\gdef\given#1{88\fi\Ifbl@nk#1QQQ\empty!}
+\long\gdef\blank#1{88\fi\Ifbl@nk#1QQ..!}% if null or spaces
+\long\gdef\nil#1{\IfN@Ught#1* {#1}!}% if null
+\long\gdef\IfN@Ught#1 #2!{\blank{#2}}
+\long\gdef\Ifbl@nk#1#2Q#3!{\ifx#3}% same as above
+} 
+
+% add screenshot image.
+% Usage: \screenshot{filename}{caption}{label}
+% Note: use this only for screenshots!
+% Note: leave caption empty to supress it.
+\newcommand{\screenshot}[3]{
+  \begin{figure}[!ht]
+    \begin{center}
+      \includegraphics[width=4cm]{#1}
+      \if\blank{#3}\else{\label{#3}}\fi\if\blank{#2}\else{
+        \caption{#2}}\fi
+    \end{center}
+  \end{figure}
+}
 
diff --git a/manual/rockbox_interface/main.tex b/manual/rockbox_interface/main.tex
index fc3e81e..9eb7b05 100644
--- a/manual/rockbox_interface/main.tex
+++ b/manual/rockbox_interface/main.tex
@@ -34,9 +34,7 @@
 }
 
 \section{\label{ref:file_browser}File Browser}
-\begin{center}
-  \includegraphics[width=4cm]{rockbox_interface/images/ss-file-browser-\genericimg.png}
-\end{center}
+\screenshot{rockbox_interface/images/ss-file-browser-\genericimg.png}{The file browser}{}
 The file browser helps you navigate through the files on your \dap, entering folders and executing the default action on each file. To help us differentiate files, each file format is displayed with an icon. You can select which file types are displayed (see page \pageref{ref:ShowFiles}).
 
 \subsection{\label{ref:controls}Controls}
@@ -96,9 +94,7 @@
 }
 
 \subsection{\label{ref:Filemenu}\label{ref:PartIISectionFM}File Menu}
-\begin{center}
-  \includegraphics[width=4cm]{rockbox_interface/images/ss-file-menu-\genericimg.png}
-\end{center}
+  \screenshot{rockbox_interface/images/ss-file-menu-\genericimg.png}{The file menu}{}
 
 This menu operates on the file that was selected in the browser. It offers the following options:
 
@@ -116,9 +112,7 @@
 
 \subsection{\label{ref:Playlistsubmenu}Playlist Submenu}
 If the playlist submenu is invoked on a directory, it will act on all the files within that directory.  If invoked on a playlist it will act on all the files in that playlist. Otherwise it acts only on the current file.
-\begin{center}
-  \includegraphics[width=4cm]{rockbox_interface/images/ss-playlist-menu-112x64x1.png}
-\end{center}
+  \screenshot{rockbox_interface/images/ss-playlist-menu-112x64x1.png}{The playlist menu}{}
 This menu provides the following options:
 
 \begin{itemize}
@@ -134,9 +128,7 @@
 \textbf{Note}: The dynamic playlist is saved so resume will restore it exactly as before shutdown.
 
 \subsection{Virtual Keyboard}
-\begin{center}
-  \includegraphics[width=4cm]{rockbox_interface/images/ss-virtual-keyboard-112x64x1.png}
-\end{center}
+  \screenshot{rockbox_interface/images/ss-virtual-keyboard-112x64x1.png}{The virtual keyboard}{}
 This is the virtual keyboard that is used when entering file names in Rockbox.
 
 \opt{IRIVER_H100_PAD,IRIVER_H300_PAD,IAUDIO_X5_PAD,RECORDER_PAD,IPOD_4G_PAD}{
@@ -368,18 +360,14 @@
 }
 
 \subsection{\label{ref:ID3viewer}ID3 Viewer}
-\begin{center}
-  \includegraphics[width=4cm]{rockbox_interface/images/ss-id3-viewer-112x64x1.png}
-\end{center}
+  \screenshot{rockbox_interface/images/ss-id3-viewer-112x64x1.png}{The ID3 viewer}{}
 This screen is accessible from the WPS screen, and provides a detailed view of all the identity information about the current track. This info is known as meta data and is stored in audio file formats to keep information on artist, album etc. To access this screen, \opt{h1xx,h300}{hold \ButtonSelect\ to access the WPS context menu, and select the id3-viewer from there.}\opt{RECORDER_PAD}{press \ButtonFOne+\ButtonOn}\opt{PLAYER_PAD}{press \ButtonMenu+\ButtonOn.}\opt{IAUDIO_X5_PAD,IPOD_4G_PAD}{Please correct this information}\opt{ONDIO_PAD}{hold \ButtonMenu to access the WPS context menu, and select the id3-viewer from there.}\opt{RECORDER_PAD,PLAYER_PAD,ONDIO_PAD}{Use \ButtonLeft\ and \ButtonRight\ to move through the information.}
 
 %********************QUICKSCREENS***********************************************
 \opt{RECORDER_PAD}{
 \section{\label{ref:QuickScreenMenus}Quick Screen Menus}
-\begin{center}
-  \includegraphics[width=4cm]{rockbox_interface/images/ss-quick-screen-112x64x1.png}
-  \includegraphics[width=4cm]{rockbox_interface/images/ss-quick-screen2-112x64x1.png}
-\end{center}
+  \screenshot{rockbox_interface/images/ss-quick-screen-112x64x1.png}{The quick screen}{}
+  \screenshot{rockbox_interface/images/ss-quick-screen2-112x64x1.png}{The quick screen}{}
 Rockbox handles function buttons in a different way to the Archos software. \ButtonFOne\ is always bound to the menu function, while \ButtonFTwo\ and \ButtonFThree\ enable two quick menus.
 
 \ButtonFTwo\ displays some browse and play settings which are likely to be changed frequently. This settings are Shuffle mode, Repeat mode and the Show files options
@@ -418,4 +406,4 @@
     \ButtonDown & Controls upside down screen setting \\\bottomrule
   \end{tabular}
 \end{center}
-}
\ No newline at end of file
+}