Warning, /office/kile/doc/usermenu.docbook is written in an unsupported language. File is not indexed.

0001 <chapter id="id_usermenu">
0002 <title>User-Configurable Menu</title>
0003 
0004 <sect1 id="id_usermenu_configuration">
0005 <title>Configuration</title>
0006 
0007 <para>&kile; supports a user-configurable menu, which will appear as a part of &kile;'s menu. This menu can be configured using &kile;'s configuration dialog with <menuchoice><guimenu>Settings</guimenu><guisubmenu>Configure Kile</guisubmenu><guimenuitem>User Menu</guimenuitem></menuchoice>.</para>
0008 
0009         <screenshot>
0010                 <screeninfo>Configure the user menu</screeninfo>
0011                 <mediaobject>
0012                 <imageobject>
0013                 <imagedata fileref="usermenu_01.png" format="PNG" />
0014                 </imageobject>
0015                 <textobject>
0016                 <phrase>Configure the user menu</phrase>
0017                 </textobject>
0018                 </mediaobject>
0019         </screenshot>
0020 
0021 <para>You have two options where to place this menu:</para>
0022 
0023 <itemizedlist>
0024 <listitem>
0025 <para>either the menu <guimenu>User Menu</guimenu> will appear in the main menu bar between the menus <guimenu>LaTeX</guimenu> and <guimenu>Wizard</guimenu> and the configuration wizard <guimenuitem>Edit User Menu</guimenuitem> in the <guimenu>Wizard</guimenu> menu</para>
0026 
0027         <screenshot>
0028                 <screeninfo>User Menu is placed in the main menu</screeninfo>
0029                 <mediaobject>
0030                 <imageobject>
0031                 <imagedata fileref="usermenu_02.png" format="PNG" />
0032                 </imageobject>
0033                 <textobject>
0034                 <phrase>User Menu is placed in the main menu</phrase>
0035                 </textobject>
0036                 </mediaobject>
0037         </screenshot>
0038 </listitem>
0039 
0040 <listitem>
0041 <para>or both items will appear at the bottom of the <guimenu>LaTeX</guimenu> menu.</para>
0042 
0043         <screenshot>
0044                 <screeninfo>User Menu as a part of the LaTeX menu</screeninfo>
0045                 <mediaobject>
0046                 <imageobject>
0047                 <imagedata fileref="usermenu_03.png" format="PNG" />
0048                 </imageobject>
0049                 <textobject>
0050                 <phrase>User Menu as a part of the LaTeX menu</phrase>
0051                 </textobject>
0052                 </mediaobject>
0053         </screenshot>
0054 </listitem>
0055 </itemizedlist>
0056 
0057 
0058 <para>Already existing user-defined tags from older versions of &kile; are automatically transformed into the new user-configurable menu. The tags are saved in a file called <filename>usertags.xml</filename> and like all menu definition files, they can be found in the local user menu directory of &kile;: <filename>KILE_APP_DIR/usermenu/</filename>, &eg; <filename>/home/user/.kde/share/apps/kile/usermenu/</filename>.</para>
0059 
0060 <para>You can use different menu definition files for different tasks. Call the user menu wizard <menuchoice><guimenu>Wizard</guimenu><guisubmenu>Edit User Menu</guisubmenu></menuchoice> or <menuchoice><guimenu>LaTeX</guimenu><guisubmenu>Edit User Menu</guisubmenu></menuchoice> to install or edit a menu definition file.</para>
0061 
0062 </sect1>
0063 
0064 
0065 <sect1 id="id_usermenu_wizard">
0066 <title>Wizard</title>
0067 
0068 <para>You can create new or change existing menus with a comfortable user menu configuration wizard found at <menuchoice><guimenu>Wizard</guimenu><guisubmenu>Edit User Menu</guisubmenu></menuchoice>.</para>
0069 
0070         <screenshot>
0071                 <screeninfo>User Menu Wizard</screeninfo>
0072                 <mediaobject>
0073                 <imageobject>
0074                 <imagedata fileref="usermenu_04.png" format="PNG" />
0075                 </imageobject>
0076                 <textobject>
0077                 <phrase>User Menu Wizard</phrase>
0078                 </textobject>
0079                 </mediaobject>
0080         </screenshot>
0081 
0082 <para>On the left side you will see an existing menu-tree. Like a standard menu, three different kinds of menu items are available:</para>
0083 
0084 <itemizedlist>
0085 <listitem><para>standard menu entries, which are assigned to an action</para></listitem>
0086 <listitem><para>submenus, which contain more menu items</para></listitem>
0087 <listitem><para>separators, to get a visible structure of all entries.</para></listitem>
0088 </itemizedlist>
0089 
0090 <para>To modify this menu, use the six buttons on the left side. More possible actions are available in the context menu of already existing menu items.</para>
0091 
0092         <screenshot>
0093                 <screeninfo>User-Defined Menutree</screeninfo>
0094                 <mediaobject>
0095                 <imageobject>
0096                 <imagedata fileref="usermenu_05.png" format="PNG" />
0097                 </imageobject>
0098                 <textobject>
0099                 <phrase>User-Defined Menutree</phrase>
0100                 </textobject>
0101                 </mediaobject>
0102         </screenshot>
0103 
0104 <para>Each standard menu item is assigned to one of three action types, where each of them has different attributes, which could be set:</para>
0105 
0106 <itemizedlist>
0107 <listitem><para><guilabel>Text:</guilabel>&nbsp; &kile; gives you the ability to make your own tags. A tag is similar to a shortcut that launches some command or writes frequently-used texts, &eg; Joe Sixpack often uses the sentences <userinput>Hi, I have been inserted ...</userinput>. This tag will be inserted at the current cursor position, when this action is called (see above). Metachars are also available (see <xref linkend="id_usermenu_placeholders" role="select: title pageabbrv"/>).</para>
0108 </listitem>
0109 
0110 <listitem><para><guilabel>Insert file contents:</guilabel>&nbsp; Inserts the complete contents of a given file.</para>
0111 
0112         <screenshot>
0113                 <screeninfo>Insert file contents</screeninfo>
0114                 <mediaobject>
0115                 <imageobject>
0116                 <imagedata fileref="usermenu_06a.png" format="PNG" />
0117                 </imageobject>
0118                 <textobject>
0119                 <phrase>Insert file contents</phrase>
0120                 </textobject>
0121                 </mediaobject>
0122         </screenshot>
0123 </listitem>
0124 
0125   <listitem><para><guilabel>Execute an external program:</guilabel>&nbsp; The output of this program can be inserted into the opened document. Metachar <userinput>%M</userinput> is also possible in the command line of this program, as the selected text will be saved in a temporary file. Use <userinput>%M</userinput> for the filename of this temporary file.</para>
0126 
0127         <screenshot>
0128                 <screeninfo>Execute an external program</screeninfo>
0129                 <mediaobject>
0130                 <imageobject>
0131                 <imagedata fileref="usermenu_06b.png" format="PNG" />
0132                 </imageobject>
0133                 <textobject>
0134                 <phrase>Execute an external program</phrase>
0135                 </textobject>
0136                 </mediaobject>
0137         </screenshot>
0138 </listitem>
0139 
0140 </itemizedlist>
0141 
0142 <para>If some important information for an action is missing, menu items are colored red. This may be a nonexisting file</para>
0143 
0144         <screenshot>
0145                 <screeninfo>Nonexisting file</screeninfo>
0146                 <mediaobject>
0147                 <imageobject>
0148                 <imagedata fileref="usermenu_07a.png" format="PNG" />
0149                 </imageobject>
0150                 <textobject>
0151                 <phrase>Nonexisting file</phrase>
0152                 </textobject>
0153                 </mediaobject>
0154         </screenshot>
0155 
0156 <para>or a missing title for the menu entry, which will be shown with question marks as <userinput>???</userinput>.</para>
0157 
0158         <screenshot>
0159                 <screeninfo>Missing title of a menu entry</screeninfo>
0160                 <mediaobject>
0161                 <imageobject>
0162                 <imagedata fileref="usermenu_07b.png" format="PNG" />
0163                 </imageobject>
0164                 <textobject>
0165                 <phrase>Missing title of a menu entry</phrase>
0166                 </textobject>
0167                 </mediaobject>
0168         </screenshot>
0169 
0170 <para>If you open the context menu of such a red colored menu item, you will get an additional option for more information concerning this error.</para>
0171 
0172         <screenshot>
0173                 <screeninfo>Additional info</screeninfo>
0174                 <mediaobject>
0175                 <imageobject>
0176                 <imagedata fileref="usermenu_07c.png" format="PNG" />
0177                 </imageobject>
0178                 <textobject>
0179                 <phrase>Additional info</phrase>
0180                 </textobject>
0181                 </mediaobject>
0182         </screenshot>
0183 
0184 <para>More information may also be available using the <guilabel>What's this</guilabel> feature of most widgets.</para>
0185 
0186 </sect1>
0187 
0188 
0189 <sect1 id="id_usermenu_placeholders">
0190 <title>Placeholders</title>
0191 
0192 <sect2 id="id_usermenu_placeholders_text">
0193 <title>Insert Text</title>
0194 
0195 <para>There are some placeholders you can use in your user-defined tags: <userinput>%C</userinput>, <userinput>%B</userinput>, <userinput>%M</userinput>, <userinput>%E</userinput>, <userinput>%R</userinput> and <userinput>%T</userinput>.</para>
0196 
0197 <itemizedlist>
0198 <listitem>
0199 <para><userinput>%C</userinput>:&nbsp; this is where the cursor will be placed after the insertion of a user-defined tag.</para>
0200 
0201         <screenshot>
0202                 <screeninfo>Cursor Position (%C)</screeninfo>
0203                 <mediaobject>
0204                 <imageobject>
0205                 <imagedata fileref="usermenu_08a.png" format="PNG" />
0206                 </imageobject>
0207                 <textobject>
0208                 <phrase>Cursor Position (%C)</phrase>
0209                 </textobject>
0210                 </mediaobject>
0211         </screenshot>
0212 </listitem>
0213 
0214 <listitem>
0215 <para><userinput>%B</userinput>:&nbsp; will be replaced by a bullet (see <xref linkend="editing_bullets" role="select: title pageabbrv"/>).</para>
0216 
0217         <screenshot>
0218                 <screeninfo>Bullet (%B)</screeninfo>
0219                 <mediaobject>
0220                 <imageobject>
0221                 <imagedata fileref="usermenu_08b.png" format="PNG" />
0222                 </imageobject>
0223                 <textobject>
0224                 <phrase>Bullet (%B)</phrase>
0225                 </textobject>
0226                 </mediaobject>
0227         </screenshot>
0228 </listitem>
0229 
0230 <listitem>
0231 <para><userinput>%M</userinput>:&nbsp; will be replaced by the selected text.</para>
0232 
0233         <screenshot>
0234                 <screeninfo>Selected Text (%M)</screeninfo>
0235                 <mediaobject>
0236                 <imageobject>
0237                 <imagedata fileref="usermenu_08c.png" format="PNG" />
0238                 </imageobject>
0239                 <textobject>
0240                 <phrase>Selected Text (%M)</phrase>
0241                 </textobject>
0242                 </mediaobject>
0243         </screenshot>
0244 </listitem>
0245 
0246 <listitem>
0247 <para><userinput>%E</userinput>:&nbsp; denotes the indentation depth of text inside an environment.</para>
0248 
0249         <screenshot>
0250                 <screeninfo>Indentation of environment text (%E)</screeninfo>
0251                 <mediaobject>
0252                 <imageobject>
0253                 <imagedata fileref="usermenu_08d.png" format="PNG" />
0254                 </imageobject>
0255                 <textobject>
0256                 <phrase>Indentation of environment text (%E)</phrase>
0257                 </textobject>
0258                 </mediaobject>
0259         </screenshot>
0260 </listitem>
0261 
0262 <listitem>
0263 <para><userinput>%R</userinput>:&nbsp; will call a reference-dialog to choose a label which has already been defined. This can be used to refer to a predefined label, which you can choose from a drop-down list (see also <menuchoice><guimenu>LaTeX</guimenu><guimenuitem>References</guimenuitem><guimenuitem>ref</guimenuitem></menuchoice> or
0264 <menuchoice><guimenu>LaTeX</guimenu><guimenuitem>References</guimenuitem><guimenuitem>pageref</guimenuitem></menuchoice>).</para>
0265 
0266         <screenshot>
0267                 <screeninfo>References (%R)</screeninfo>
0268                 <mediaobject>
0269                 <imageobject>
0270                 <imagedata fileref="usermenu_08e.png" format="PNG" />
0271                 </imageobject>
0272                 <textobject>
0273                 <phrase>References (%R)</phrase>
0274                 </textobject>
0275                 </mediaobject>
0276         </screenshot>
0277 </listitem>
0278 
0279 <listitem>
0280 <para><userinput>%T</userinput>:&nbsp; will call a citation-dialog to choose an already defined citation. The same as using <menuchoice><guimenu>LaTeX</guimenu><guimenuitem>References</guimenuitem><guimenuitem>cite</guimenuitem></menuchoice> a list with all the citation keys pops up.</para>
0281 
0282         <screenshot>
0283                 <screeninfo>Citation Keys (%T)</screeninfo>
0284                 <mediaobject>
0285                 <imageobject>
0286                 <imagedata fileref="usermenu_08f.png" format="PNG" />
0287                 </imageobject>
0288                 <textobject>
0289                 <phrase>Citation Keys (%T)</phrase>
0290                 </textobject>
0291                 </mediaobject>
0292         </screenshot>
0293 </listitem>
0294 </itemizedlist>
0295 
0296 <para>Let's consider another example, with the following macro <userinput>\frac{%M}{%C}</userinput>. First, we select a number in our text, let's say <userinput>42</userinput>.
0297 Now we invoke this macro and obtain <userinput>\frac{42}{}</userinput> with the cursor located within the second pair of brackets.</para>
0298 
0299 </sect2>
0300 
0301 <sect2 id="id_usermenu_placeholders_file">
0302 <title>Insert File Contents</title>
0303 
0304 <para>If you want to insert the contents of a text file, you could use the same placeholders.</para>
0305 
0306 </sect2>
0307 
0308 <sect2 id="id_usermenu_placeholders_program">
0309 <title>Execute A Program</title>
0310 
0311 <para>If you want to execute an external program, only the <userinput>%M</userinput> for selected text is recognized in the command line. The selection will be saved in a temporary file and the placeholder <userinput>%M</userinput> is replaced with this filename.</para>
0312 
0313         <screenshot>
0314                 <screeninfo>Execute an external program (%M)</screeninfo>
0315                 <mediaobject>
0316                 <imageobject>
0317                 <imagedata fileref="usermenu_09.png" format="PNG" />
0318                 </imageobject>
0319                 <textobject>
0320                 <phrase>Execute an external program (%M)</phrase>
0321                 </textobject>
0322                 </mediaobject>
0323         </screenshot>
0324 
0325 <para>Another placeholder is <userinput>%S</userinput>, which is replaced by the complete base name of the current document without the path. This base name consists of all characters in the file up to (but not including) the last '.' character.</para>
0326 
0327 </sect2>
0328 
0329 </sect1>
0330 
0331 
0332 <sect1 id="id_usermenu_parameter">
0333 <title>Parameter</title>
0334 
0335 <para>Most menu entries may have additional self-explaining parameters, which may be checked. If some of these parameters are not available for some kind of action, they are disabled.</para>
0336 
0337         <screenshot>
0338                 <screeninfo>User Menu Parameter</screeninfo>
0339                 <mediaobject>
0340                 <imageobject>
0341                 <imagedata fileref="usermenu_10.png" format="PNG" />
0342                 </imageobject>
0343                 <textobject>
0344                 <phrase>User Menu Parameter</phrase>
0345                 </textobject>
0346                 </mediaobject>
0347         </screenshot>
0348 
0349 <para>Here is one example for executing an external program:</para>
0350 
0351         <screenshot>
0352                 <screeninfo>Parameter example</screeninfo>
0353                 <mediaobject>
0354                 <imageobject>
0355                 <imagedata fileref="usermenu_11.png" format="PNG" />
0356                 </imageobject>
0357                 <textobject>
0358                 <phrase>Parameter example</phrase>
0359                 </textobject>
0360                 </mediaobject>
0361         </screenshot>
0362 
0363 <para>You can see that a <userinput>perl</userinput> script is called, which should work with current selection. The <guilabel>Needs selected text</guilabel> parameter is checked to assure a selection. The output of this script will be inserted (<guilabel>Insert the output of the chosen program</guilabel>) and replace the current  selection (<guilabel>Replace selected text</guilabel>), but not selected itself.</para>
0364 
0365 <para>Of course you can also call your own programs or scripts. For example select a list of numbers, separated by spaces, and call a script or Perl program, which transforms this selection into &latex; code for a matrix. Whatever your ideas may be, you can realize them using the following usermenu entry.</para>
0366 
0367         <screenshot>
0368                 <screeninfo>Parameter example 2</screeninfo>
0369                 <mediaobject>
0370                 <imageobject>
0371                 <imagedata fileref="usermenu_11b.png" format="PNG" />
0372                 </imageobject>
0373                 <textobject>
0374                 <phrase>Parameter example 2</phrase>
0375                 </textobject>
0376                 </mediaobject>
0377         </screenshot>
0378 
0379 </sect1>
0380 
0381 
0382 <sect1 id="id_usermenu_files">
0383 <title>Menu Definition Files</title>
0384 
0385 <para>You can install different menus at runtime for different tasks. When you call the user menu wizard, the current menu definition file is loaded. If you modify it and close the dialog with <guibutton>OK</guibutton>, your changes will be saved and installed as the new user menu. Closing the dialog with <guibutton>Cancel</guibutton> will discard all changes.</para>
0386 
0387         <screenshot>
0388                 <screeninfo>Menu Definition Files</screeninfo>
0389                 <mediaobject>
0390                 <imageobject>
0391                 <imagedata fileref="usermenu_12.png" format="PNG" />
0392                 </imageobject>
0393                 <textobject>
0394                 <phrase>Menu Definition Files</phrase>
0395                 </textobject>
0396                 </mediaobject>
0397         </screenshot>
0398 
0399 
0400 <para>You are also free to save the modified file in the user menu directory or to load another menu definition file and install it. All user menu definition files must be saved in the local user menu directory of &kile;: <filename>KILE_APP_DIR/usermenu/</filename>.</para>
0401 
0402 <para>Look at the example menu definition file <userinput>example.xml</userinput> to see more menu entries with their parameters.</para>
0403 
0404 </sect1>
0405 
0406 </chapter>