SF.net SVN: geany:[3941] branches/build-system

elextr at users.sourceforge.net elextr at xxxxx
Thu Jul 9 06:49:42 UTC 2009


Revision: 3941
          http://geany.svn.sourceforge.net/geany/?rev=3941&view=rev
Author:   elextr
Date:     2009-07-09 06:49:42 +0000 (Thu, 09 Jul 2009)

Log Message:
-----------
Configurable Build Menu Alpha

Modified Paths:
--------------
    branches/build-system/ChangeLog
    branches/build-system/doc/geany.html
    branches/build-system/doc/geany.txt
    branches/build-system/src/build.c
    branches/build-system/src/build.h
    branches/build-system/src/filetypes.c
    branches/build-system/src/filetypes.h
    branches/build-system/src/keybindings.c
    branches/build-system/src/keybindings.h
    branches/build-system/src/keyfile.c
    branches/build-system/src/msgwindow.c
    branches/build-system/src/project.c
    branches/build-system/src/project.h

Modified: branches/build-system/ChangeLog
===================================================================
--- branches/build-system/ChangeLog	2009-07-09 05:59:07 UTC (rev 3940)
+++ branches/build-system/ChangeLog	2009-07-09 06:49:42 UTC (rev 3941)
@@ -1,3 +1,25 @@
+2009-07-09  geany test  <elextr(at)gmail(dot)com>
+
+Configurable Build Menu Changes
+
+ * doc/geany.html, doc/geany.txt:
+   Updated build menu section to new functionality
+ * src/build.h, src/build.c:
+   Largly re-written, configurability added, Latex code removed
+ * src/filetypes.h, src/filetypes.c:
+   Filetype structure updated to add new command pointers, configuration
+   load and store changed
+ * src/keybindings.h, src/keybindings.c:
+   Changed to address new command storage structure.
+ * src/keyfile.c:
+   Changed to load/store new configuration.
+ * src/main.c:
+   Minor change to initialisation order.
+ * src/msgwindow.c:
+   Changed to address new menu item storage structure.
+ * src/project.h, src/project.c:
+   Changed to load/store the new configuration info.
+
 2009-06-14  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>
 
  * src/encodings.c, src/encodings.h, src/plugindata.h:

Modified: branches/build-system/doc/geany.html
===================================================================
--- branches/build-system/doc/geany.html	2009-07-09 05:59:07 UTC (rev 3940)
+++ branches/build-system/doc/geany.html	2009-07-09 06:49:42 UTC (rev 3941)
@@ -6,7 +6,7 @@
 <meta name="generator" content="Docutils 0.4: http://docutils.sourceforge.net/" />
 <title>Geany</title>
 <meta name="authors" content="Enrico Tröger  Nick Treleaven  Frank Lanitz" />
-<meta name="date" content="2009-06-01" />
+<meta name="date" content="2009-06-04" />
 <style type="text/css">
 
 /*
@@ -139,7 +139,7 @@
 <br />Nick Treleaven
 <br />Frank Lanitz</td></tr>
 <tr><th class="docinfo-name">Date:</th>
-<td>2009-06-01</td></tr>
+<td>2009-06-04</td></tr>
 <tr><th class="docinfo-name">Version:</th>
 <td>0.18</td></tr>
 </tbody>
@@ -328,99 +328,101 @@
 <li><a class="reference" href="#close-project" id="id123" name="id123">Close Project</a></li>
 </ul>
 </li>
-<li><a class="reference" href="#build-system" id="id124" name="id124">Build system</a><ul>
-<li><a class="reference" href="#compile" id="id125" name="id125">Compile</a></li>
-<li><a class="reference" href="#build" id="id126" name="id126">Build</a></li>
-<li><a class="reference" href="#make-all" id="id127" name="id127">Make all</a></li>
-<li><a class="reference" href="#make-custom-target" id="id128" name="id128">Make custom target</a></li>
-<li><a class="reference" href="#make-object" id="id129" name="id129">Make object</a></li>
-<li><a class="reference" href="#execute" id="id130" name="id130">Execute</a></li>
-<li><a class="reference" href="#stopping-running-processes" id="id131" name="id131">Stopping running processes</a><ul>
-<li><a class="reference" href="#terminal-emulators" id="id132" name="id132">Terminal emulators</a></li>
+<li><a class="reference" href="#build-menu" id="id124" name="id124">Build Menu</a><ul>
+<li><a class="reference" href="#indicators" id="id125" name="id125">Indicators</a></li>
+<li><a class="reference" href="#default-build-menu-items" id="id126" name="id126">Default Build Menu Items</a><ul>
+<li><a class="reference" href="#compile" id="id127" name="id127">Compile</a></li>
+<li><a class="reference" href="#build" id="id128" name="id128">Build</a></li>
+<li><a class="reference" href="#make" id="id129" name="id129">Make</a></li>
+<li><a class="reference" href="#make-custom-target" id="id130" name="id130">Make custom target</a></li>
+<li><a class="reference" href="#make-object" id="id131" name="id131">Make object</a></li>
+<li><a class="reference" href="#execute" id="id132" name="id132">Execute</a></li>
+<li><a class="reference" href="#stopping-running-processes" id="id133" name="id133">Stopping running processes</a><ul>
+<li><a class="reference" href="#terminal-emulators" id="id134" name="id134">Terminal emulators</a></li>
 </ul>
 </li>
-<li><a class="reference" href="#set-includes-and-arguments" id="id133" name="id133">Set Includes and Arguments</a><ul>
-<li><a class="reference" href="#one-step-compilation" id="id134" name="id134">One step compilation</a></li>
+<li><a class="reference" href="#set-build-commands" id="id135" name="id135">Set Build Commands</a></li>
 </ul>
 </li>
-<li><a class="reference" href="#indicators" id="id135" name="id135">Indicators</a></li>
+<li><a class="reference" href="#build-menu-configuration" id="id136" name="id136">Build Menu Configuration</a></li>
+<li><a class="reference" href="#build-menu-commands-dialog" id="id137" name="id137">Build Menu Commands Dialog</a></li>
 </ul>
 </li>
-<li><a class="reference" href="#printing-support" id="id136" name="id136">Printing support</a></li>
-<li><a class="reference" href="#plugins" id="id137" name="id137">Plugins</a></li>
-<li><a class="reference" href="#keybindings" id="id138" name="id138">Keybindings</a><ul>
-<li><a class="reference" href="#switching-documents" id="id139" name="id139">Switching documents</a></li>
-<li><a class="reference" href="#configurable-keybindings" id="id140" name="id140">Configurable keybindings</a></li>
+<li><a class="reference" href="#printing-support" id="id138" name="id138">Printing support</a></li>
+<li><a class="reference" href="#plugins" id="id139" name="id139">Plugins</a></li>
+<li><a class="reference" href="#keybindings" id="id140" name="id140">Keybindings</a><ul>
+<li><a class="reference" href="#switching-documents" id="id141" name="id141">Switching documents</a></li>
+<li><a class="reference" href="#configurable-keybindings" id="id142" name="id142">Configurable keybindings</a></li>
 </ul>
 </li>
 </ul>
 </li>
-<li><a class="reference" href="#configuration-files" id="id141" name="id141">Configuration files</a><ul>
-<li><a class="reference" href="#global-configuration-file" id="id142" name="id142">Global configuration file</a></li>
-<li><a class="reference" href="#filetype-definition-files" id="id143" name="id143">Filetype definition files</a><ul>
-<li><a class="reference" href="#format" id="id144" name="id144">Format</a><ul>
-<li><a class="reference" href="#styling-section" id="id145" name="id145">[styling] Section</a></li>
-<li><a class="reference" href="#keywords-section" id="id146" name="id146">[keywords] Section</a></li>
-<li><a class="reference" href="#settings-section" id="id147" name="id147">[settings] Section</a></li>
-<li><a class="reference" href="#build-settings-section" id="id148" name="id148">[build_settings] Section</a></li>
+<li><a class="reference" href="#configuration-files" id="id143" name="id143">Configuration files</a><ul>
+<li><a class="reference" href="#global-configuration-file" id="id144" name="id144">Global configuration file</a></li>
+<li><a class="reference" href="#filetype-definition-files" id="id145" name="id145">Filetype definition files</a><ul>
+<li><a class="reference" href="#format" id="id146" name="id146">Format</a><ul>
+<li><a class="reference" href="#styling-section" id="id147" name="id147">[styling] Section</a></li>
+<li><a class="reference" href="#keywords-section" id="id148" name="id148">[keywords] Section</a></li>
+<li><a class="reference" href="#settings-section" id="id149" name="id149">[settings] Section</a></li>
+<li><a class="reference" href="#build-settings-section" id="id150" name="id150">[build_settings] Section</a></li>
 </ul>
 </li>
-<li><a class="reference" href="#special-file-filetypes-common" id="id149" name="id149">Special file filetypes.common</a><ul>
-<li><a class="reference" href="#named-styles-section" id="id150" name="id150">[named_styles] Section</a></li>
-<li><a class="reference" href="#id4" id="id151" name="id151">[styling] Section</a></li>
-<li><a class="reference" href="#id5" id="id152" name="id152">[settings] Section</a></li>
+<li><a class="reference" href="#special-file-filetypes-common" id="id151" name="id151">Special file filetypes.common</a><ul>
+<li><a class="reference" href="#named-styles-section" id="id152" name="id152">[named_styles] Section</a></li>
+<li><a class="reference" href="#id4" id="id153" name="id153">[styling] Section</a></li>
+<li><a class="reference" href="#id5" id="id154" name="id154">[settings] Section</a></li>
 </ul>
 </li>
 </ul>
 </li>
-<li><a class="reference" href="#filetype-extensions" id="id153" name="id153">Filetype extensions</a></li>
-<li><a class="reference" href="#templates" id="id154" name="id154">Templates</a><ul>
-<li><a class="reference" href="#template-meta-data" id="id155" name="id155">Template meta data</a></li>
-<li><a class="reference" href="#file-templates" id="id156" name="id156">File templates</a><ul>
-<li><a class="reference" href="#custom-file-templates" id="id157" name="id157">Custom file templates</a></li>
-<li><a class="reference" href="#filetype-templates" id="id158" name="id158">Filetype templates</a></li>
+<li><a class="reference" href="#filetype-extensions" id="id155" name="id155">Filetype extensions</a></li>
+<li><a class="reference" href="#templates" id="id156" name="id156">Templates</a><ul>
+<li><a class="reference" href="#template-meta-data" id="id157" name="id157">Template meta data</a></li>
+<li><a class="reference" href="#file-templates" id="id158" name="id158">File templates</a><ul>
+<li><a class="reference" href="#custom-file-templates" id="id159" name="id159">Custom file templates</a></li>
+<li><a class="reference" href="#filetype-templates" id="id160" name="id160">Filetype templates</a></li>
 </ul>
 </li>
-<li><a class="reference" href="#customizing-templates" id="id159" name="id159">Customizing templates</a><ul>
-<li><a class="reference" href="#template-wildcards" id="id160" name="id160">Template wildcards</a></li>
+<li><a class="reference" href="#customizing-templates" id="id161" name="id161">Customizing templates</a><ul>
+<li><a class="reference" href="#template-wildcards" id="id162" name="id162">Template wildcards</a></li>
 </ul>
 </li>
 </ul>
 </li>
-<li><a class="reference" href="#customizing-the-toolbar" id="id161" name="id161">Customizing the toolbar</a><ul>
-<li><a class="reference" href="#available-toolbar-elements" id="id162" name="id162">Available toolbar elements</a></li>
+<li><a class="reference" href="#customizing-the-toolbar" id="id163" name="id163">Customizing the toolbar</a><ul>
+<li><a class="reference" href="#available-toolbar-elements" id="id164" name="id164">Available toolbar elements</a></li>
 </ul>
 </li>
 </ul>
 </li>
-<li><a class="reference" href="#plugin-documentation" id="id163" name="id163">Plugin documentation</a><ul>
-<li><a class="reference" href="#instant-save" id="id164" name="id164">Instant Save</a></li>
-<li><a class="reference" href="#backup-copy" id="id165" name="id165">Backup Copy</a></li>
+<li><a class="reference" href="#plugin-documentation" id="id165" name="id165">Plugin documentation</a><ul>
+<li><a class="reference" href="#instant-save" id="id166" name="id166">Instant Save</a></li>
+<li><a class="reference" href="#backup-copy" id="id167" name="id167">Backup Copy</a></li>
 </ul>
 </li>
-<li><a class="reference" href="#contributing-to-this-document" id="id166" name="id166">Contributing to this document</a></li>
-<li><a class="reference" href="#scintilla-keyboard-commands" id="id167" name="id167">Scintilla keyboard commands</a><ul>
-<li><a class="reference" href="#keyboard-commands" id="id168" name="id168">Keyboard commands</a></li>
+<li><a class="reference" href="#contributing-to-this-document" id="id168" name="id168">Contributing to this document</a></li>
+<li><a class="reference" href="#scintilla-keyboard-commands" id="id169" name="id169">Scintilla keyboard commands</a><ul>
+<li><a class="reference" href="#keyboard-commands" id="id170" name="id170">Keyboard commands</a></li>
 </ul>
 </li>
-<li><a class="reference" href="#tips-and-tricks" id="id169" name="id169">Tips and tricks</a><ul>
-<li><a class="reference" href="#document-notebook" id="id170" name="id170">Document notebook</a></li>
-<li><a class="reference" href="#editor" id="id171" name="id171">Editor</a></li>
-<li><a class="reference" href="#interface" id="id172" name="id172">Interface</a></li>
-<li><a class="reference" href="#gtk-related" id="id173" name="id173">GTK-related</a></li>
+<li><a class="reference" href="#tips-and-tricks" id="id171" name="id171">Tips and tricks</a><ul>
+<li><a class="reference" href="#document-notebook" id="id172" name="id172">Document notebook</a></li>
+<li><a class="reference" href="#editor" id="id173" name="id173">Editor</a></li>
+<li><a class="reference" href="#interface" id="id174" name="id174">Interface</a></li>
+<li><a class="reference" href="#gtk-related" id="id175" name="id175">GTK-related</a></li>
 </ul>
 </li>
-<li><a class="reference" href="#hidden-preferences" id="id174" name="id174">Hidden preferences</a></li>
-<li><a class="reference" href="#compile-time-options" id="id175" name="id175">Compile-time options</a><ul>
-<li><a class="reference" href="#src-geany-h" id="id176" name="id176">src/geany.h</a></li>
-<li><a class="reference" href="#project-h" id="id177" name="id177">project.h</a></li>
-<li><a class="reference" href="#editor-h" id="id178" name="id178">editor.h</a></li>
-<li><a class="reference" href="#keyfile-c" id="id179" name="id179">keyfile.c</a></li>
-<li><a class="reference" href="#build-h" id="id180" name="id180">build.h</a></li>
+<li><a class="reference" href="#hidden-preferences" id="id176" name="id176">Hidden preferences</a></li>
+<li><a class="reference" href="#compile-time-options" id="id177" name="id177">Compile-time options</a><ul>
+<li><a class="reference" href="#src-geany-h" id="id178" name="id178">src/geany.h</a></li>
+<li><a class="reference" href="#project-h" id="id179" name="id179">project.h</a></li>
+<li><a class="reference" href="#editor-h" id="id180" name="id180">editor.h</a></li>
+<li><a class="reference" href="#keyfile-c" id="id181" name="id181">keyfile.c</a></li>
+<li><a class="reference" href="#build-h" id="id182" name="id182">build.h</a></li>
 </ul>
 </li>
-<li><a class="reference" href="#gnu-general-public-license" id="id181" name="id181">GNU General Public License</a></li>
-<li><a class="reference" href="#license-for-scintilla-and-scite" id="id182" name="id182">License for Scintilla and SciTE</a></li>
+<li><a class="reference" href="#gnu-general-public-license" id="id183" name="id183">GNU General Public License</a></li>
+<li><a class="reference" href="#license-for-scintilla-and-scite" id="id184" name="id184">License for Scintilla and SciTE</a></li>
 </ul>
 </div>
 <div class="section">
@@ -2414,24 +2416,42 @@
 </div>
 </div>
 <div class="section">
-<h2><a class="toc-backref" href="#id124" id="build-system" name="build-system">Build system</a></h2>
-<p>Geany has an integrated build system. Firstly this means that the
-current source file will be saved before it is processed. This is
-for convenience so that you don't need to keep saving small changes
-to the current file before building.</p>
-<p>Secondly the output for Compile, Build and Make actions will be captured
-in the Compiler notebook tab of the messages window. If there are
-any warnings or errors with line numbers shown in red in the Compiler
-output tab, you can click on them and Geany will switch to the relevant
-source file (or open it) and mark the line number so the problem can be
-corrected. Geany will also set indicators for warnings or errors with
-line numbers.</p>
+<h2><a class="toc-backref" href="#id124" id="build-menu" name="build-menu">Build Menu</a></h2>
+<p>After editing code with Geany, the next step is to compile, link, build,
+interpret, run etc.  As Geany supports many languages each with a different
+approach to such operations, and as there are also many language independant
+software building systems, Geany does not have a built in build system, nor
+does it limit which system you can use.  Instead the build menu provides
+a configurable and flexible means of running any external commands required.</p>
+<p>Running the commands from within Geany has two benefits:</p>
+<ul class="simple">
+<li>the current file is automatically saved before the command is run</li>
+<li>the output is captured in the Compiler notebook tab and parsed for
+warnings or errors</li>
+</ul>
+<p>Warnings and errors that can be parsed for line numbers will be shown in
+red in the Compiler tab and you can click on them to switch to the relevant
+source file (or open it) and mark the line number.  Also lines with
+warnings or errors are marked in the source, see Indicators below.</p>
+<p>This section provides a description of the default configuration of the
+build menu and then of how to configure it and where the defaults fit in.</p>
 <div class="tip">
 <p class="first admonition-title">Tip</p>
 <p class="last">If Geany's default error message parsing does not parse errors for
-the tool you're using, you can set a custom regex. See <a class="reference" href="#filetype-definition-files">Filetype
-definition files</a> and the <a class="reference" href="#build-settings-section">[build_settings] Section</a>.</p>
+the tool you're using, you can set a custom regex in the Build Commands
+Dialog, see ...</p>
 </div>
+<div class="section">
+<h3><a class="toc-backref" href="#id125" id="indicators" name="indicators">Indicators</a></h3>
+<p>Indicators are red squiggly underlines which are used to highlight
+errors which occurred while compiling the current file. So you can
+easily see where your code failed to compile. To remove the indicators,
+just click on "Remove all indicators" in the document file menu.</p>
+<p>If you do not like this feature, you can disable it in the preferences
+dialog.</p>
+</div>
+<div class="section">
+<h3><a class="toc-backref" href="#id126" id="default-build-menu-items" name="default-build-menu-items">Default Build Menu Items</a></h3>
 <p>Depending on the current file's filetype, the Build menu will contain
 the following items:</p>
 <ul class="simple">
@@ -2441,10 +2461,10 @@
 <li>Make Custom Target</li>
 <li>Make Object</li>
 <li>Execute</li>
-<li>Set Includes and Arguments</li>
+<li>Set Build Menu Commands</li>
 </ul>
 <div class="section">
-<h3><a class="toc-backref" href="#id125" id="compile" name="compile">Compile</a></h3>
+<h4><a class="toc-backref" href="#id127" id="compile" name="compile">Compile</a></h4>
 <p>The Compile command has different uses for different kinds of files.</p>
 <p>For compilable languages such as C and C++, the Compile command is
 setup to compile the current source file into a binary object file.</p>
@@ -2454,7 +2474,7 @@
 will run the file in its language interpreter.</p>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id126" id="build" name="build">Build</a></h3>
+<h4><a class="toc-backref" href="#id128" id="build" name="build">Build</a></h4>
 <p>For compilable languages such as C and C++, the Build command will link
 the current source file's equivalent object file into an executable. If
 the object file does not exist, the source will be compiled and linked
@@ -2462,29 +2482,24 @@
 <p>Interpreted languages do not use the Build command.</p>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id127" id="make-all" name="make-all">Make all</a></h3>
-<p>This effectively runs "make all" in the same directory as the
+<h4><a class="toc-backref" href="#id129" id="make" name="make">Make</a></h4>
+<p>This effectively runs "make" in the same directory as the
 current file.</p>
-<div class="note">
-<p class="first admonition-title">Note</p>
-<p class="last">For each of the Make commands, The Make tool path must be correctly
-set in the Tools tab of the Preferences dialog.</p>
 </div>
-</div>
 <div class="section">
-<h3><a class="toc-backref" href="#id128" id="make-custom-target" name="make-custom-target">Make custom target</a></h3>
-<p>This is similar to running 'Make all' but you will be prompted for
+<h4><a class="toc-backref" href="#id130" id="make-custom-target" name="make-custom-target">Make custom target</a></h4>
+<p>This is similar to running 'Make' but you will be prompted for
 the make target name to be passed to the Make tool. For example,
 typing 'clean' in the dialog prompt will run "make clean".</p>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id129" id="make-object" name="make-object">Make object</a></h3>
+<h4><a class="toc-backref" href="#id131" id="make-object" name="make-object">Make object</a></h4>
 <p>Make object will run "make current_file.o" in the same directory as
 the current file, using its prefix for 'current_file'. It is useful
 for compiling just the current file without building the whole project.</p>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id130" id="execute" name="execute">Execute</a></h3>
+<h4><a class="toc-backref" href="#id132" id="execute" name="execute">Execute</a></h4>
 <p>Execute will run the corresponding executable file, shell script or
 interpreted script in a terminal window. Note that the Terminal tool
 path must be correctly set in the Tools tab of the Preferences dialog -
@@ -2493,18 +2508,20 @@
 <p>After your program or script has finished executing, you will be
 prompted to press the return key. This allows you to review any text
 output from the program before the terminal window is closed.</p>
+<p>The execute command output is not parsed for errors.</p>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id131" id="stopping-running-processes" name="stopping-running-processes">Stopping running processes</a></h3>
-<p>When there is a running program, the Run button in the toolbar
+<h4><a class="toc-backref" href="#id133" id="stopping-running-processes" name="stopping-running-processes">Stopping running processes</a></h4>
+<p>When there is a running program, the Execute menu item in the menu and
+the Run button in the toolbar
 becomes a stop button and you can stop the current action. This
 works by sending a signal to the process (and its child process(es))
 to stop the process. The used signal is SIGQUIT.</p>
-<p>Depending on the process you started it might occur that the process
-cannot be stopped. This can happen when the process creates more than
-one child process.</p>
+<p>Depending on the process you started it might be that the process
+cannot be stopped. For example this can happen when the process creates
+more than one child process.</p>
 <div class="section">
-<h4><a class="toc-backref" href="#id132" id="terminal-emulators" name="terminal-emulators">Terminal emulators</a></h4>
+<h5><a class="toc-backref" href="#id134" id="terminal-emulators" name="terminal-emulators">Terminal emulators</a></h5>
 <p>Xterm is known to work properly. If you are using "Terminal"
 (the terminal program of Xfce), you should add the command line
 option <tt class="docutils literal"><span class="pre">--disable-server</span></tt> otherwise the started process cannot be
@@ -2513,10 +2530,10 @@
 </div>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id133" id="set-includes-and-arguments" name="set-includes-and-arguments">Set Includes and Arguments</a></h3>
-<p>By default the Compile and Build commands invoke the compiler and
+<h4><a class="toc-backref" href="#id135" id="set-build-commands" name="set-build-commands">Set Build Commands</a></h4>
+<p>By default the Compile and Build commands invoke the GCC compiler and
 linker with only the basic arguments needed by all programs. Using
-Set Includes and Arguments you can add any include paths and compile
+Set Build Commands you can add any include paths and compile
 flags for the compiler, any library names and paths for the linker,
 and any arguments you want to use when running Execute.</p>
 <div class="note">
@@ -2533,25 +2550,185 @@
 <li>%e -- filename without path and without extension</li>
 </ul>
 <p>See <a class="reference" href="#build-settings-section">[build_settings] Section</a> for details.</p>
-<div class="section">
-<h4><a class="toc-backref" href="#id134" id="one-step-compilation" name="one-step-compilation">One step compilation</a></h4>
-<p>If you are using the Build command to compile and link in one step,
-you will need to set both the compiler arguments and the linker
-arguments in the linker command setting.</p>
 </div>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id135" id="indicators" name="indicators">Indicators</a></h3>
-<p>Indicators are red squiggly underlines which are used to highlight
-errors which occurred while compiling the current file. So you can
-easily see where your code failed to compile. To remove the indicators,
-just click on "Remove all indicators" in the document file menu.</p>
-<p>If you do not like this feature, you can disable it in the preferences
-dialog.</p>
+<h3><a class="toc-backref" href="#id136" id="build-menu-configuration" name="build-menu-configuration">Build Menu Configuration</a></h3>
+<p>The build menu has considerable flexibility and configurability, allowing
+both menu labels and the commands they execute to be configured.  If you change
+one of the default make commands to run say 'waf' you can also change the
+label to match.  Underlines in the labels set mnemonic characters.</p>
+<p>The build menu is divided into four groups of items each with different
+behaviors:</p>
+<ul class="simple">
+<li>file items - are configurable and depend on the filetype of the current
+document, put the output in the compiler tab and parse it for errors</li>
+<li>non-file items - are configurable and mostly don't depend on the filetype
+of the current document, put the output in the compiler tab and parse
+it for errors</li>
+<li>execute items - are configurable and intended for executing your
+program or other long running programs.  The output is not parsed for errors.</li>
+<li>fixed items - are not configurable because they perform Geany built in actions
+go to next error, go to the previous error and show the build menu
+commands dialog</li>
+</ul>
+<p>The maximum numbers of items in each of the configurable groups can be
+configured when Geany starts (see...).  Even though the maximum number of
+items may have been increased, only those menu items that are actually configured
+are shown in the menu.</p>
+<p>The groups of menu items obtain their configuration from four potential
+sources.  The highest pririty source that has the menu item defined will
+be used. The sources in decreasing priority are:</p>
+<ul class="simple">
+<li>a project file if open</li>
+<li>the user preferences</li>
+<li>the system filetype definitions</li>
+<li>the defaults</li>
+</ul>
+<p>The detailed relationships between sources and the configurable menu item groups
+is shown in the following table.</p>
+<table border="1" class="docutils">
+<colgroup>
+<col width="13%" />
+<col width="19%" />
+<col width="23%" />
+<col width="17%" />
+<col width="28%" />
+</colgroup>
+<thead valign="bottom">
+<tr><th class="head">Group</th>
+<th class="head">Project File</th>
+<th class="head">Preferences</th>
+<th class="head">System Filetype</th>
+<th class="head">Defaults</th>
+</tr>
+</thead>
+<tbody valign="top">
+<tr><td>Filetype</td>
+<td><p class="first">Loads From: project
+file</p>
+<p class="last">Saves To: project
+file</p>
+</td>
+<td><p class="first">Loads From:
+filetype.xxx file in
+~/.config/geany/filedefs</p>
+<p class="last">Saves to: as above,
+creating if needed.</p>
+</td>
+<td><p class="first">Loads From:
+filetype.xxx in
+Geany install</p>
+<p class="last">Saves to: as user
+preferences left.</p>
+</td>
+<td>None</td>
+</tr>
+<tr><td>Non-Filetype</td>
+<td><p class="first">Loads From: project
+file</p>
+<p class="last">Saves To: project
+file</p>
+</td>
+<td><p class="first">Loads From:
+geany.conf file in
+~/.config/geany</p>
+<p class="last">Saves to: as above,
+creating if needed.</p>
+</td>
+<td><p class="first">Loads From:
+filetype.xxx in
+Geany install</p>
+<p class="last">Saves to: as user
+preferences left.</p>
+</td>
+<td><dl class="first last docutils">
+<dt>1:</dt>
+<dd>Label: _Make
+Command: make</dd>
+<dt>2:</dt>
+<dd>Label: Make Custom _Target
+Command: make</dd>
+<dt>3:</dt>
+<dd>Label: Make _Object
+Command: make %e.o</dd>
+</dl>
+</td>
+</tr>
+<tr><td>Execute</td>
+<td><p class="first">Loads From: project
+file or else
+filetype defined in
+project file</p>
+<p class="last">Saves To:
+project file</p>
+</td>
+<td><p class="first">Loads From:
+geany.conf file in
+~/.config/geany or else
+filetype.xxx file in
+~/.config/geany/filedefs</p>
+<p class="last">Saves To:
+geany.conf file in
+~/.config/geany</p>
+</td>
+<td><p class="first">Loads From:
+filetype.xxx in
+Geany install</p>
+<p class="last">Saves To: as user
+preferences left</p>
+</td>
+<td>Label: _Execute Command: ./%e</td>
+</tr>
+</tbody>
+</table>
+<p>The following notes on the table reference cells by coordinate as (group,source):</p>
+<ul class="simple">
+<li>General - for filetype.xxx substitute the appropriate extension for xxx.</li>
+<li>(Filetype, Project File) and (Filetype, Preferences) - preferences use a full
+filetype file so that users can configure all other filetype preferences
+as well.  Projects can only configure menu items per filetype.  Saving
+in the project file means that there is only one file per project not
+a whole directory.</li>
+<li>(Non-Filetype, System Filetype) - although conceptually strange, defining
+non-filetype commands in a filetype file, this provides the ability to
+define filetype dependent default menu items.</li>
+<li>(Execute, Project File) and (Execute, Preferences) - the execute configuration
+can only be set by hand editing the appropriate file.</li>
+</ul>
 </div>
+<div class="section">
+<h3><a class="toc-backref" href="#id137" id="build-menu-commands-dialog" name="build-menu-commands-dialog">Build Menu Commands Dialog</a></h3>
+<p>Most of the configuration of the build menu is done through the Build Menu
+Commands Dialog.  You edit the configuration sourced from preferences in the
+dialog opened from the Build->Build Menu Commands item and you edit the
+configuration from the project in the build tab of the project preferences
+dialog.  Both use the same form shown below.</p>
+<p>Image here</p>
+<p>The dialog is divided into three sections for Filetype menu items which
+will be selected based on the filetype of the currently open document,
+Non-filetype menu items and execute menu items and a section for the regular
+expression used for parsing command output for error and warning messages.</p>
+<p>The columns in the first three sections allow setting of the label and command
+and for Non-filetype and Execute commands the selection of which directory
+to run the command in.  If a project is open and base is checked, the command
+is run in the base directory defined for the project otherwise it is run
+in the directory of the current document, or not run at all if no current document.</p>
+<p>The dialog will always show the command selected by priority, not just the
+commands configured in this configuration source. This ensures that you always
+see what the menu is going to do if activated.</p>
+<p>If the current source of the menu item is higher priority than the
+configuration source you are editing then the command will be shown
+in the dialog but will be insensitive (greyed out).  This can't happen
+with the project source but can with the preferences source dialog.</p>
+<p>The clear buttons remove the definition from the configuration source you are editing.
+When you do this the command from the next lower priority source will be shown.
+To hide lower priority menu items without having anything show in the menu
+configure with a nothing in the label but at least one character in the command.</p>
 </div>
+</div>
 <div class="section">
-<h2><a class="toc-backref" href="#id136" id="printing-support" name="printing-support">Printing support</a></h2>
+<h2><a class="toc-backref" href="#id138" id="printing-support" name="printing-support">Printing support</a></h2>
 <p>Since Geany 0.13 there is full printing support using GTK's printing API.
 The printed page(s) will look nearly the same as on your screen in Geany.
 Additionally, there are some options to modify the printed page(s). You
@@ -2599,7 +2776,7 @@
 gtklp or similar programs can be used.</p>
 </div>
 <div class="section">
-<h2><a class="toc-backref" href="#id137" id="plugins" name="plugins">Plugins</a></h2>
+<h2><a class="toc-backref" href="#id139" id="plugins" name="plugins">Plugins</a></h2>
 <p>Plugins are loaded at startup, if the <em>Enable plugin support</em>
 general preference is set. There is also a command-line option,
 <tt class="docutils literal"><span class="pre">-p</span></tt>, which prevents plugins being loaded. Plugins are scanned in
@@ -2620,13 +2797,13 @@
 which are included in Geany.</p>
 </div>
 <div class="section">
-<h2><a class="toc-backref" href="#id138" id="keybindings" name="keybindings">Keybindings</a></h2>
+<h2><a class="toc-backref" href="#id140" id="keybindings" name="keybindings">Keybindings</a></h2>
 <p>Geany supports the default keyboard shortcuts for the Scintilla
 editing widget. For a list of these commands, see <a class="reference" href="#scintilla-keyboard-commands">Scintilla
 keyboard commands</a>. The Scintilla keyboard shortcuts will be overridden
 by any custom keybindings with the same keyboard shortcut.</p>
 <div class="section">
-<h3><a class="toc-backref" href="#id139" id="switching-documents" name="switching-documents">Switching documents</a></h3>
+<h3><a class="toc-backref" href="#id141" id="switching-documents" name="switching-documents">Switching documents</a></h3>
 <p>There are a few non-configurable bindings to switch between documents,
 listed below. These can also be overridden by custom keybindings.</p>
 <table border="1" class="docutils">
@@ -2656,7 +2833,7 @@
 </table>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id140" id="configurable-keybindings" name="configurable-keybindings">Configurable keybindings</a></h3>
+<h3><a class="toc-backref" href="#id142" id="configurable-keybindings" name="configurable-keybindings">Configurable keybindings</a></h3>
 <p>For all actions listed below you can define your own keybindings. Open
 the Preferences dialog, select the desired action and click on
 change. In the opening dialog you can press any key combination you
@@ -3274,9 +3451,9 @@
 </div>
 </div>
 <div class="section">
-<h1><a class="toc-backref" href="#id141" id="configuration-files" name="configuration-files">Configuration files</a></h1>
+<h1><a class="toc-backref" href="#id143" id="configuration-files" name="configuration-files">Configuration files</a></h1>
 <div class="section">
-<h2><a class="toc-backref" href="#id142" id="global-configuration-file" name="global-configuration-file">Global configuration file</a></h2>
+<h2><a class="toc-backref" href="#id144" id="global-configuration-file" name="global-configuration-file">Global configuration file</a></h2>
 <p>You can use a global configuration file for Geany which will be used if
 the user starts Geany for the first time and an user's configuration
 file was not yet created or in case an user deleted the configuration
@@ -3296,7 +3473,7 @@
 </div>
 </div>
 <div class="section">
-<h2><a class="toc-backref" href="#id143" id="filetype-definition-files" name="filetype-definition-files">Filetype definition files</a></h2>
+<h2><a class="toc-backref" href="#id145" id="filetype-definition-files" name="filetype-definition-files">Filetype definition files</a></h2>
 <p>All color definitions and other filetype specific settings are
 stored in the filetype definition files. Those settings are colors
 for syntax highlighting, general settings like comment characters or
@@ -3327,9 +3504,9 @@
 to change. All missing settings will be read from the corresponding
 global definition file in <tt class="docutils literal"><span class="pre">$prefix/share/geany</span></tt>.</p>
 <div class="section">
-<h3><a class="toc-backref" href="#id144" id="format" name="format">Format</a></h3>
+<h3><a class="toc-backref" href="#id146" id="format" name="format">Format</a></h3>
 <div class="section">
-<h4><a class="toc-backref" href="#id145" id="styling-section" name="styling-section">[styling] Section</a></h4>
+<h4><a class="toc-backref" href="#id147" id="styling-section" name="styling-section">[styling] Section</a></h4>
 <p>In this section the colors for syntax highlighting are defined. The
 manual format is:</p>
 <ul class="simple">
@@ -3358,7 +3535,7 @@
 Section</a>.</p>
 </div>
 <div class="section">
-<h4><a class="toc-backref" href="#id146" id="keywords-section" name="keywords-section">[keywords] Section</a></h4>
+<h4><a class="toc-backref" href="#id148" id="keywords-section" name="keywords-section">[keywords] Section</a></h4>
 <p>This section contains keys for different keyword lists specific to
 the filetype. Some filetypes do not support keywords, so adding a
 new key will not work. You can only add or remove keywords to/from
@@ -3369,7 +3546,7 @@
 </div>
 </div>
 <div class="section">
-<h4><a class="toc-backref" href="#id147" id="settings-section" name="settings-section">[settings] Section</a></h4>
+<h4><a class="toc-backref" href="#id149" id="settings-section" name="settings-section">[settings] Section</a></h4>
 <dl class="docutils">
 <dt>extension</dt>
 <dd><p class="first">This is the default file extension used when saving files, not
@@ -3430,7 +3607,7 @@
 </dl>
 </div>
 <div class="section">
-<h4><a class="toc-backref" href="#id148" id="build-settings-section" name="build-settings-section">[build_settings] Section</a></h4>
+<h4><a class="toc-backref" href="#id150" id="build-settings-section" name="build-settings-section">[build_settings] Section</a></h4>
 <dl class="docutils">
 <dt>error_regex</dt>
 <dd><p class="first">This is a GNU-style extended regular expression to parse a filename
@@ -3445,8 +3622,8 @@
 </dd>
 </dl>
 <p><strong>Build commands</strong></p>
-<p>The build commands are all configurable using the <a class="reference" href="#set-includes-and-arguments">Set Includes and
-Arguments</a> dialog.</p>
+<p>The build commands are all configurable using the <a class="reference" href="#build-menu-commands-dialog">Build Menu
+Commands Dialog</a> dialog.</p>
 <dl class="docutils">
 <dt>compiler</dt>
 <dd><p class="first">This item specifies the command to compile source code files. But
@@ -3479,13 +3656,13 @@
 </div>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id149" id="special-file-filetypes-common" name="special-file-filetypes-common">Special file filetypes.common</a></h3>
+<h3><a class="toc-backref" href="#id151" id="special-file-filetypes-common" name="special-file-filetypes-common">Special file filetypes.common</a></h3>
 <p>There is a special filetype definition file called
 filetypes.common. This file defines some general non-filetype-specific
 settings.</p>
 <p>See the <a class="reference" href="#format">Format</a> section for how to define styles.</p>
 <div class="section">
-<h4><a class="toc-backref" href="#id150" id="named-styles-section" name="named-styles-section">[named_styles] Section</a></h4>
+<h4><a class="toc-backref" href="#id152" id="named-styles-section" name="named-styles-section">[named_styles] Section</a></h4>
 <p>Named styles declared here can be used in the [styling] section of any
 filetypes.* file.</p>
 <p>For example:</p>
@@ -3510,7 +3687,7 @@
 </div>
 </div>
 <div class="section">
-<h4><a class="toc-backref" href="#id151" id="id4" name="id4">[styling] Section</a></h4>
+<h4><a class="toc-backref" href="#id153" id="id4" name="id4">[styling] Section</a></h4>
 <dl class="docutils">
 <dt>default</dt>
 <dd><p class="first">This is the default style. It is used for styling files without a
@@ -3665,7 +3842,7 @@
 </dl>
 </div>
 <div class="section">
-<h4><a class="toc-backref" href="#id152" id="id5" name="id5">[settings] Section</a></h4>
+<h4><a class="toc-backref" href="#id154" id="id5" name="id5">[settings] Section</a></h4>
 <dl class="docutils">
 <dt>whitespace_chars</dt>
 <dd><p class="first">Characters to treat as whitespace. These characters are ignored
@@ -3679,7 +3856,7 @@
 </div>
 </div>
 <div class="section">
-<h2><a class="toc-backref" href="#id153" id="filetype-extensions" name="filetype-extensions">Filetype extensions</a></h2>
+<h2><a class="toc-backref" href="#id155" id="filetype-extensions" name="filetype-extensions">Filetype extensions</a></h2>
 <p>To change the default filetype extension used when saving a new file,
 see <a class="reference" href="#filetype-definition-files">Filetype definition files</a>.</p>
 <p>You can override the list of file extensions that Geany uses for each
@@ -3705,7 +3882,7 @@
 </pre>
 </div>
 <div class="section">
-<h2><a class="toc-backref" href="#id154" id="templates" name="templates">Templates</a></h2>
+<h2><a class="toc-backref" href="#id156" id="templates" name="templates">Templates</a></h2>
 <p>Geany supports the following templates:</p>
 <ul class="simple">
 <li>ChangeLog entry</li>
@@ -3728,7 +3905,7 @@
 function description won't contain the correct function name but "unknown"
 instead.</p>
 <div class="section">
-<h3><a class="toc-backref" href="#id155" id="template-meta-data" name="template-meta-data">Template meta data</a></h3>
+<h3><a class="toc-backref" href="#id157" id="template-meta-data" name="template-meta-data">Template meta data</a></h3>
 <p>Meta data can be used with all templates, but by default user set
 meta data is only used for the ChangeLog and File header templates.</p>
 <p>In the configuration dialog you can find a tab "Templates" (see
@@ -3738,7 +3915,7 @@
 at startup.</p>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id156" id="file-templates" name="file-templates">File templates</a></h3>
+<h3><a class="toc-backref" href="#id158" id="file-templates" name="file-templates">File templates</a></h3>
 <p>File templates are templates used as the basis of a new file. To
 use them, choose the <em>New (with Template)</em> menu item from the <em>File</em>
 menu.</p>
@@ -3750,7 +3927,7 @@
 be placed anywhere, but is usually on the first line of the file,
 followed by a blank line.</p>
 <div class="section">
-<h4><a class="toc-backref" href="#id157" id="custom-file-templates" name="custom-file-templates">Custom file templates</a></h4>
+<h4><a class="toc-backref" href="#id159" id="custom-file-templates" name="custom-file-templates">Custom file templates</a></h4>
 <p>These are read from the <tt class="docutils literal"><span class="pre">~/.config/geany/templates/files</span></tt> directory
 (created the first time Geany is started). The filetype to use is
 detected from the template file's extension, if any. For example, creating
@@ -3761,7 +3938,7 @@
 template.</p>
 </div>
 <div class="section">
-<h4><a class="toc-backref" href="#id158" id="filetype-templates" name="filetype-templates">Filetype templates</a></h4>
+<h4><a class="toc-backref" href="#id160" id="filetype-templates" name="filetype-templates">Filetype templates</a></h4>
 <p>Filetype template files are read from the <tt class="docutils literal"><span class="pre">~/.config/geany/templates</span></tt>
 directory, and are named "filetype." followed by the filetype
 name, e.g. "filetype.python", "filetype.sh", etc. If you are
@@ -3773,7 +3950,7 @@
 </div>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id159" id="customizing-templates" name="customizing-templates">Customizing templates</a></h3>
+<h3><a class="toc-backref" href="#id161" id="customizing-templates" name="customizing-templates">Customizing templates</a></h3>
 <p>Each template can be customized to your needs. The templates are
 stored in the <tt class="docutils literal"><span class="pre">~/.config/geany/templates/</span></tt> directory (see the section called
 <a class="reference" href="#command-line-options">Command line options</a> for further information about the configuration
@@ -3781,7 +3958,7 @@
 Geany ;-) ) and edit the template to your needs. There are some
 wildcards which will be automatically replaced by Geany at startup.</p>
 <div class="section">
-<h4><a class="toc-backref" href="#id160" id="template-wildcards" name="template-wildcards">Template wildcards</a></h4>
+<h4><a class="toc-backref" href="#id162" id="template-wildcards" name="template-wildcards">Template wildcards</a></h4>
 <p>All wildcards must be enclosed by "{" and "}", e.g. {date}.</p>
 <table border="1" class="docutils">
 <colgroup>
@@ -3902,7 +4079,7 @@
 </div>
 </div>
 <div class="section">
-<h2><a class="toc-backref" href="#id161" id="customizing-the-toolbar" name="customizing-the-toolbar">Customizing the toolbar</a></h2>
+<h2><a class="toc-backref" href="#id163" id="customizing-the-toolbar" name="customizing-the-toolbar">Customizing the toolbar</a></h2>
 <p>You can add, remove and reorder the elements in the toolbar by editing
 the file <tt class="docutils literal"><span class="pre">ui_toolbar.xml</span></tt>.</p>
 <p>To override the system-wide configuration file, copy it from
@@ -3928,7 +4105,7 @@
 </ol>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id162" id="available-toolbar-elements" name="available-toolbar-elements">Available toolbar elements</a></h3>
+<h3><a class="toc-backref" href="#id164" id="available-toolbar-elements" name="available-toolbar-elements">Available toolbar elements</a></h3>
 <table border="1" class="docutils">
 <colgroup>
 <col width="19%" />
@@ -4042,9 +4219,9 @@
 </div>
 </div>
 <div class="section">
-<h1><a class="toc-backref" href="#id163" id="plugin-documentation" name="plugin-documentation">Plugin documentation</a></h1>
+<h1><a class="toc-backref" href="#id165" id="plugin-documentation" name="plugin-documentation">Plugin documentation</a></h1>
 <div class="section">
-<h2><a class="toc-backref" href="#id164" id="instant-save" name="instant-save">Instant Save</a></h2>
+<h2><a class="toc-backref" href="#id166" id="instant-save" name="instant-save">Instant Save</a></h2>
 <p>This plugin sets on every new file (File->New or File-> New (with template))
 a randomly chosen filename and set its filetype appropriate to the used template
 or when no template was used, to a configurable default filetype.
@@ -4054,7 +4231,7 @@
 similar.</p>
 </div>
 <div class="section">
-<h2><a class="toc-backref" href="#id165" id="backup-copy" name="backup-copy">Backup Copy</a></h2>
+<h2><a class="toc-backref" href="#id167" id="backup-copy" name="backup-copy">Backup Copy</a></h2>
 <p>This plugin creates a backup copy of the current file in Geany when it is
 saved. You can specify the directory where the backup copy is saved and
 you can configure the automatically added extension in the configure dialog
@@ -4064,7 +4241,7 @@
 </div>
 </div>
 <div class="section">
-<h1><a class="toc-backref" href="#id166" id="contributing-to-this-document" name="contributing-to-this-document">Contributing to this document</a></h1>
+<h1><a class="toc-backref" href="#id168" id="contributing-to-this-document" name="contributing-to-this-document">Contributing to this document</a></h1>
 <p>This document (<tt class="docutils literal"><span class="pre">geany.txt</span></tt>) is written in <a class="reference" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a>
 (or "reST"). The source file for it is located in Geany's <tt class="docutils literal"><span class="pre">doc</span></tt>
 subdirectory.  If you intend on making changes, you should grab the
@@ -4084,7 +4261,7 @@
 and Fedora systems.</p>
 </div>
 <div class="section">
-<h1><a class="toc-backref" href="#id167" id="scintilla-keyboard-commands" name="scintilla-keyboard-commands">Scintilla keyboard commands</a></h1>
+<h1><a class="toc-backref" href="#id169" id="scintilla-keyboard-commands" name="scintilla-keyboard-commands">Scintilla keyboard commands</a></h1>
 <p>Copyright © 1998, 2006 Neil Hodgson <neilh(at)scintilla(dot)org></p>
 <p>This appendix is distributed under the terms of the License for
 Scintilla and SciTE. A copy of this license can be found in the file
@@ -4093,7 +4270,7 @@
 Scintilla and SciTE</a>.</p>
 <p>20 June 2006</p>
 <div class="section">
-<h2><a class="toc-backref" href="#id168" id="keyboard-commands" name="keyboard-commands">Keyboard commands</a></h2>
+<h2><a class="toc-backref" href="#id170" id="keyboard-commands" name="keyboard-commands">Keyboard commands</a></h2>
 <p>Keyboard commands for Scintilla mostly follow common Windows and GTK+
 conventions. All move keys (arrows, page up/down, home and end)
 allows to extend or reduce the stream selection when holding the
@@ -4181,9 +4358,9 @@
 </div>
 </div>
 <div class="section">
-<h1><a class="toc-backref" href="#id169" id="tips-and-tricks" name="tips-and-tricks">Tips and tricks</a></h1>
+<h1><a class="toc-backref" href="#id171" id="tips-and-tricks" name="tips-and-tricks">Tips and tricks</a></h1>
 <div class="section">
-<h2><a class="toc-backref" href="#id170" id="document-notebook" name="document-notebook">Document notebook</a></h2>
+<h2><a class="toc-backref" href="#id172" id="document-notebook" name="document-notebook">Document notebook</a></h2>
 <ul class="simple">
 <li>Double-click on empty space in the notebook tab bar to open a
 new document.</li>
@@ -4194,7 +4371,7 @@
 </ul>
 </div>
 <div class="section">
-<h2><a class="toc-backref" href="#id171" id="editor" name="editor">Editor</a></h2>
+<h2><a class="toc-backref" href="#id173" id="editor" name="editor">Editor</a></h2>
 <ul class="simple">
 <li>Alt-scroll wheel moves up/down a page.</li>
 <li>Ctrl-scroll wheel zooms in/out.</li>
@@ -4204,13 +4381,13 @@
 </ul>
 </div>
 <div class="section">
-<h2><a class="toc-backref" href="#id172" id="interface" name="interface">Interface</a></h2>
+<h2><a class="toc-backref" href="#id174" id="interface" name="interface">Interface</a></h2>
 <ul class="simple">
 <li>Double-click on a symbol-list group to expand or compact it.</li>
 </ul>
 </div>
 <div class="section">
-<h2><a class="toc-backref" href="#id173" id="gtk-related" name="gtk-related">GTK-related</a></h2>
+<h2><a class="toc-backref" href="#id175" id="gtk-related" name="gtk-related">GTK-related</a></h2>
 <ul class="simple">
 <li>Scrolling the mouse wheel over a notebook tab bar will switch
 notebook pages.</li>
@@ -4225,7 +4402,7 @@
 </div>
 </div>
 <div class="section">
-<h1><a class="toc-backref" href="#id174" id="hidden-preferences" name="hidden-preferences">Hidden preferences</a></h1>
+<h1><a class="toc-backref" href="#id176" id="hidden-preferences" name="hidden-preferences">Hidden preferences</a></h1>
 <p>There are some uncommon preferences that are not shown in the Preferences
 dialog. These can be set by editing <tt class="docutils literal"><span class="pre">~/.config/geany/geany.conf</span></tt>, then
 restarting Geany. Search for the key name, then edit the value. Example:</p>
@@ -4334,7 +4511,7 @@
 </table>
 </div>
 <div class="section">
-<h1><a class="toc-backref" href="#id175" id="compile-time-options" name="compile-time-options">Compile-time options</a></h1>
+<h1><a class="toc-backref" href="#id177" id="compile-time-options" name="compile-time-options">Compile-time options</a></h1>
 <p>There are some options which can only be changed at compile time,
 and some options which are used as the default for configurable
 options. To change these options, edit the appropriate source file
@@ -4346,7 +4523,7 @@
 <p class="last">Most users should not need to change these options.</p>
 </div>
 <div class="section">
-<h2><a class="toc-backref" href="#id176" id="src-geany-h" name="src-geany-h">src/geany.h</a></h2>
+<h2><a class="toc-backref" href="#id178" id="src-geany-h" name="src-geany-h">src/geany.h</a></h2>
 <table border="1" class="docutils">
 <colgroup>
 <col width="33%" />
@@ -4403,7 +4580,7 @@
 </table>
 </div>
 <div class="section">
-<h2><a class="toc-backref" href="#id177" id="project-h" name="project-h">project.h</a></h2>
+<h2><a class="toc-backref" href="#id179" id="project-h" name="project-h">project.h</a></h2>
 <table border="1" class="docutils">
 <colgroup>
 <col width="33%" />
@@ -4428,7 +4605,7 @@
 </table>
 </div>
 <div class="section">
-<h2><a class="toc-backref" href="#id178" id="editor-h" name="editor-h">editor.h</a></h2>
+<h2><a class="toc-backref" href="#id180" id="editor-h" name="editor-h">editor.h</a></h2>
 <table border="1" class="docutils">
 <colgroup>
 <col width="33%" />
@@ -4454,7 +4631,7 @@
 </table>
 </div>
 <div class="section">
-<h2><a class="toc-backref" href="#id179" id="keyfile-c" name="keyfile-c">keyfile.c</a></h2>
+<h2><a class="toc-backref" href="#id181" id="keyfile-c" name="keyfile-c">keyfile.c</a></h2>
 <p>These are default settings that can be overridden in the <a class="reference" href="#preferences">Preferences</a> dialog.</p>
 <table border="1" class="docutils">
 <colgroup>
@@ -4535,7 +4712,7 @@
 </table>
 </div>
 <div class="section">
-<h2><a class="toc-backref" href="#id180" id="build-h" name="build-h">build.h</a></h2>
+<h2><a class="toc-backref" href="#id182" id="build-h" name="build-h">build.h</a></h2>
 <table border="1" class="docutils">
 <colgroup>
 <col width="33%" />
@@ -4566,7 +4743,7 @@
 </div>
 </div>
 <div class="section">
-<h1><a class="toc-backref" href="#id181" id="gnu-general-public-license" name="gnu-general-public-license">GNU General Public License</a></h1>
+<h1><a class="toc-backref" href="#id183" id="gnu-general-public-license" name="gnu-general-public-license">GNU General Public License</a></h1>
 <pre class="literal-block">
             GNU GENERAL PUBLIC LICENSE
                Version 2, June 1991
@@ -4911,7 +5088,7 @@
 </pre>
 </div>
 <div class="section">
-<h1><a class="toc-backref" href="#id182" id="license-for-scintilla-and-scite" name="license-for-scintilla-and-scite">License for Scintilla and SciTE</a></h1>
+<h1><a class="toc-backref" href="#id184" id="license-for-scintilla-and-scite" name="license-for-scintilla-and-scite">License for Scintilla and SciTE</a></h1>
 <p>Copyright 1998-2003 by Neil Hodgson <neilh(at)scintilla(dot)org></p>
 <p>All Rights Reserved</p>
 <p>Permission to use, copy, modify, and distribute this software and
@@ -4931,7 +5108,7 @@
 <div class="footer">
 <hr class="footer" />
 <a class="reference" href="geany.txt">View document source</a>.
-Generated on: 2009-06-03 15:37 UTC.
+Generated on: 2009-07-09 03:37 UTC.
 Generated by <a class="reference" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
 
 </div>

Modified: branches/build-system/doc/geany.txt
===================================================================
--- branches/build-system/doc/geany.txt	2009-07-09 05:59:07 UTC (rev 3940)
+++ branches/build-system/doc/geany.txt	2009-07-09 06:49:42 UTC (rev 3941)
@@ -2219,27 +2219,48 @@
 session files and open any previously closed default session files.
 
 
-Build system
-------------
+Build Menu
+----------
+After editing code with Geany, the next step is to compile, link, build, 
+interpret, run etc.  As Geany supports many languages each with a different 
+approach to such operations, and as there are also many language independant 
+software building systems, Geany does not have a built in build system, nor 
+does it limit which system you can use.  Instead the build menu provides
+a configurable and flexible means of running any external commands required.
 
-Geany has an integrated build system. Firstly this means that the
-current source file will be saved before it is processed. This is
-for convenience so that you don't need to keep saving small changes
-to the current file before building.
+Running the commands from within Geany has two benefits:
 
-Secondly the output for Compile, Build and Make actions will be captured
-in the Compiler notebook tab of the messages window. If there are
-any warnings or errors with line numbers shown in red in the Compiler
-output tab, you can click on them and Geany will switch to the relevant
-source file (or open it) and mark the line number so the problem can be
-corrected. Geany will also set indicators for warnings or errors with
-line numbers.
+* the current file is automatically saved before the command is run
+* the output is captured in the Compiler notebook tab and parsed for 
+  warnings or errors
 
+Warnings and errors that can be parsed for line numbers will be shown in 
+red in the Compiler tab and you can click on them to switch to the relevant 
+source file (or open it) and mark the line number.  Also lines with 
+warnings or errors are marked in the source, see Indicators below.
+
+This section provides a description of the default configuration of the 
+build menu and then of how to configure it and where the defaults fit in.
+
 .. tip::
     If Geany's default error message parsing does not parse errors for
-    the tool you're using, you can set a custom regex. See `Filetype
-    definition files`_ and the `[build_settings] Section`_.
+    the tool you're using, you can set a custom regex in the Build Commands 
+    Dialog, see ...
 
+Indicators
+^^^^^^^^^^
+
+Indicators are red squiggly underlines which are used to highlight
+errors which occurred while compiling the current file. So you can
+easily see where your code failed to compile. To remove the indicators,
+just click on "Remove all indicators" in the document file menu.
+
+If you do not like this feature, you can disable it in the preferences
+dialog.
+
+
+Default Build Menu Items
+^^^^^^^^^^^^^^^^^^^^^^^^
 Depending on the current file's filetype, the Build menu will contain
 the following items:
 
@@ -2249,11 +2270,11 @@
 * Make Custom Target
 * Make Object
 * Execute
-* Set Includes and Arguments
+* Set Build Menu Commands
 
 
 Compile
-^^^^^^^
+```````
 
 The Compile command has different uses for different kinds of files.
 
@@ -2267,7 +2288,7 @@
 
 
 Build
-^^^^^
+`````
 
 For compilable languages such as C and C++, the Build command will link
 the current source file's equivalent object file into an executable. If
@@ -2277,27 +2298,22 @@
 Interpreted languages do not use the Build command.
 
 
-Make all
-^^^^^^^^
+Make
+````
 
-This effectively runs "make all" in the same directory as the
+This effectively runs "make" in the same directory as the
 current file.
 
-.. note::
-    For each of the Make commands, The Make tool path must be correctly
-    set in the Tools tab of the Preferences dialog.
-
-
 Make custom target
-^^^^^^^^^^^^^^^^^^
+``````````````````
 
-This is similar to running 'Make all' but you will be prompted for
+This is similar to running 'Make' but you will be prompted for
 the make target name to be passed to the Make tool. For example,
 typing 'clean' in the dialog prompt will run "make clean".
 
 
 Make object
-^^^^^^^^^^^
+```````````
 
 Make object will run "make current_file.o" in the same directory as
 the current file, using its prefix for 'current_file'. It is useful
@@ -2305,7 +2321,7 @@
 
 
 Execute
-^^^^^^^
+```````
 
 Execute will run the corresponding executable file, shell script or
 interpreted script in a terminal window. Note that the Terminal tool
@@ -2317,22 +2333,25 @@
 prompted to press the return key. This allows you to review any text
 output from the program before the terminal window is closed.
 
+The execute command output is not parsed for errors.
 
+
 Stopping running processes
-^^^^^^^^^^^^^^^^^^^^^^^^^^
+``````````````````````````
 
-When there is a running program, the Run button in the toolbar
+When there is a running program, the Execute menu item in the menu and 
+the Run button in the toolbar
 becomes a stop button and you can stop the current action. This
 works by sending a signal to the process (and its child process(es))
 to stop the process. The used signal is SIGQUIT.
 
-Depending on the process you started it might occur that the process
-cannot be stopped. This can happen when the process creates more than
-one child process.
+Depending on the process you started it might be that the process
+cannot be stopped. For example this can happen when the process creates 
+more than one child process.
 
 
 Terminal emulators
-``````````````````
+******************
 
 Xterm is known to work properly. If you are using "Terminal"
 (the terminal program of Xfce), you should add the command line
@@ -2341,12 +2360,12 @@
 tab in the terminal field.
 
 
-Set Includes and Arguments
-^^^^^^^^^^^^^^^^^^^^^^^^^^
+Set Build Commands
+``````````````````
 
-By default the Compile and Build commands invoke the compiler and
+By default the Compile and Build commands invoke the GCC compiler and
 linker with only the basic arguments needed by all programs. Using
-Set Includes and Arguments you can add any include paths and compile
+Set Build Commands you can add any include paths and compile
 flags for the compiler, any library names and paths for the linker,
 and any arguments you want to use when running Execute.
 
@@ -2365,29 +2384,136 @@
 
 See `[build_settings] Section`_ for details.
 
+Build Menu Configuration
+^^^^^^^^^^^^^^^^^^^^^^^^
 
+The build menu has considerable flexibility and configurability, allowing
+both menu labels and the commands they execute to be configured.  If you change 
+one of the default make commands to run say 'waf' you can also change the 
+label to match.  Underlines in the labels set mnemonic characters.
 
-One step compilation
-````````````````````
+The build menu is divided into four groups of items each with different 
+behaviors:
 
-If you are using the Build command to compile and link in one step,
-you will need to set both the compiler arguments and the linker
-arguments in the linker command setting.
+* file items - are configurable and depend on the filetype of the current 
+  document, put the output in the compiler tab and parse it for errors
+* non-file items - are configurable and mostly don't depend on the filetype 
+  of the current document, put the output in the compiler tab and parse 
+  it for errors
+* execute items - are configurable and intended for executing your 
+  program or other long running programs.  The output is not parsed for errors.
+* fixed items - are not configurable because they perform Geany built in actions
+  go to next error, go to the previous error and show the build menu 
+  commands dialog
 
+The maximum numbers of items in each of the configurable groups can be 
+configured when Geany starts (see...).  Even though the maximum number of 
+items may have been increased, only those menu items that are actually configured
+are shown in the menu.
 
-Indicators
-^^^^^^^^^^
+The groups of menu items obtain their configuration from four potential 
+sources.  The highest pririty source that has the menu item defined will 
+be used. The sources in decreasing priority are:
 
-Indicators are red squiggly underlines which are used to highlight
-errors which occurred while compiling the current file. So you can
-easily see where your code failed to compile. To remove the indicators,
-just click on "Remove all indicators" in the document file menu.
+* a project file if open
+* the user preferences
+* the system filetype definitions
+* the defaults
 
-If you do not like this feature, you can disable it in the preferences
-dialog.
+The detailed relationships between sources and the configurable menu item groups 
+is shown in the following table.
 
++--------------+---------------------+--------------------------+-------------------+-------------------------------+
+| Group        | Project File        | Preferences              | System Filetype   |  Defaults                     |
++==============+=====================+==========================+===================+===============================+
+| Filetype     | Loads From: project | Loads From:              | Loads From:       | None                          |
+|              | file                | filetype.xxx file in     | filetype.xxx in   |                               |
+|              |                     | ~/.config/geany/filedefs | Geany install     |                               |
+|              | Saves To: project   |                          |                   |                               |
+|              | file                | Saves to: as above,      | Saves to: as user |                               |
+|              |                     | creating if needed.      | preferences left. |                               |
++--------------+---------------------+--------------------------+-------------------+-------------------------------+
+| Non-Filetype | Loads From: project | Loads From:              | Loads From:       | 1:                            |
+|              | file                | geany.conf file in       | filetype.xxx in   |   Label: _Make                |
+|              |                     | ~/.config/geany          | Geany install     |   Command: make               |
+|              | Saves To: project   |                          |                   |                               |
+|              | file                | Saves to: as above,      | Saves to: as user | 2:                            |
+|              |                     | creating if needed.      | preferences left. |    Label: Make Custom _Target |
+|              |                     |                          |                   |    Command: make              |
+|              |                     |                          |                   |                               |
+|              |                     |                          |                   | 3:                            |
+|              |                     |                          |                   |    Label: Make _Object        |
+|              |                     |                          |                   |    Command: make %e.o         |
++--------------+---------------------+--------------------------+-------------------+-------------------------------+
+| Execute      | Loads From: project | Loads From:              | Loads From:       | Label: _Execute Command: ./%e |
+|              | file or else        | geany.conf file in       | filetype.xxx in   |                               |
+|              | filetype defined in | ~/.config/geany or else  | Geany install     |                               |
+|              | project file        | filetype.xxx file in     |                   |                               |
+|              |                     | ~/.config/geany/filedefs | Saves To: as user |                               |
+|              | Saves To:           |                          | preferences left  |                               |
+|              | project file        | Saves To:                |                   |                               |
+|              |                     | geany.conf file in       |                   |                               |
+|              |                     | ~/.config/geany          |                   |                               |
++--------------+---------------------+--------------------------+-------------------+-------------------------------+
 
+The following notes on the table reference cells by coordinate as (group,source):
 
+* General - for filetype.xxx substitute the appropriate extension for xxx.
+
+* System Filetypes - Labels loaded from these sources are locale sensitive 
+  and can contain translations.
+
+* (Filetype, Project File) and (Filetype, Preferences) - preferences use a full
+  filetype file so that users can configure all other filetype preferences
+  as well.  Projects can only configure menu items per filetype.  Saving 
+  in the project file means that there is only one file per project not
+  a whole directory.
+
+* (Non-Filetype, System Filetype) - although conceptually strange, defining
+  non-filetype commands in a filetype file, this provides the ability to 
+  define filetype dependent default menu items.
+
+* (Execute, Project File) and (Execute, Preferences) - the execute configuration
+  can only be set by hand editing the appropriate file.
+
+Build Menu Commands Dialog
+^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Most of the configuration of the build menu is done through the Build Menu 
+Commands Dialog.  You edit the configuration sourced from preferences in the 
+dialog opened from the Build->Build Menu Commands item and you edit the 
+configuration from the project in the build tab of the project preferences
+dialog.  Both use the same form shown below.
+
+Image here
+
+The dialog is divided into three sections for Filetype menu items which 
+will be selected based on the filetype of the currently open document, 
+Non-filetype menu items and execute menu items and a section for the regular 
+expression used for parsing command output for error and warning messages.
+
+The columns in the first three sections allow setting of the label and command
+and for Non-filetype and Execute commands the selection of which directory 
+to run the command in.  If a project is open and base is checked, the command 
+is run in the base directory defined for the project otherwise it is run 
+in the directory of the current document, or not run at all if no current document.
+
+The dialog will always show the command selected by priority, not just the 
+commands configured in this configuration source. This ensures that you always
+see what the menu is going to do if activated.
+
+If the current source of the menu item is higher priority than the 
+configuration source you are editing then the command will be shown 
+in the dialog but will be insensitive (greyed out).  This can't happen 
+with the project source but can with the preferences source dialog.
+
+The clear buttons remove the definition from the configuration source you are editing.
+When you do this the command from the next lower priority source will be shown.
+To hide lower priority menu items without having anything show in the menu 
+configure with a nothing in the label but at least one character in the command.
+
+
+
 Printing support
 ----------------
 
@@ -3052,8 +3178,8 @@
 
 **Build commands**
 
-The build commands are all configurable using the `Set Includes and
-Arguments`_ dialog.
+The build commands are all configurable using the `Build Menu
+Commands Dialog`_ dialog.
 
 compiler
     This item specifies the command to compile source code files. But

Modified: branches/build-system/src/build.c
===================================================================
--- branches/build-system/src/build.c	2009-07-09 05:59:07 UTC (rev 3940)
+++ branches/build-system/src/build.c	2009-07-09 06:49:42 UTC (rev 3941)
@@ -60,7 +60,7 @@
 #include "geanymenubuttonaction.h"
 
 
-GeanyBuildInfo build_info = {GBO_COMPILE, 0, NULL, GEANY_FILETYPES_NONE, NULL, 0};
+GeanyBuildInfo build_info = {GBG_FT, 0, 0, NULL, GEANY_FILETYPES_NONE, NULL, 0};
 
 static gchar *current_dir_entered = NULL;
 
@@ -76,21 +76,16 @@
 static const gchar RUN_SCRIPT_CMD[] = "./geany_run_script.sh";
 #endif
 
-enum
-{
-	LATEX_CMD_TO_DVI,
-	LATEX_CMD_TO_PDF,
-	LATEX_CMD_VIEW_DVI,
-	LATEX_CMD_VIEW_PDF
-};
 
-static GeanyBuildType last_toolbutton_action = GBO_BUILD;
+/* pack group (<8) and command (<32) into a user_data pointer */
+#define GRP_CMD_TO_POINTER( grp, cmd ) GINT_TO_POINTER((((grp)&7)<<5)|((cmd)&0x1f))
+#define GBO_TO_POINTER( gbo ) (GRP_CMD_TO_POINTER( GBO_TO_GBG(gbo), GBO_TO_CMD(gbo) ))
+#define GPOINTER_TO_CMD( gptr ) (GPOINTER_TO_INT(gptr)&0x1f)
+#define GPOINTER_TO_GRP( gptr ) ((GPOINTER_TO_INT(gptr)&0xe0)>>5)
 
-static BuildMenuItems default_menu_items =
-	{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
-static BuildMenuItems latex_menu_items =
-	{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
+static gpointer last_toolbutton_action = GBO_TO_POINTER(GBO_BUILD);
 
+static BuildMenuItems menu_items = {NULL}; /* only matters that menu is NULL */
 
 static struct
 {
@@ -107,6 +102,8 @@
 }
 widgets;
 
+static gint build_groups_count[GBG_COUNT] = { 3, 4, 1 };
+static gint build_items_count = 8;
 
 #ifndef G_OS_WIN32
 static void build_exit_cb(GPid child_pid, gint status, gpointer user_data);
@@ -116,18 +113,13 @@
 static GPid build_spawn_cmd(GeanyDocument *doc, const gchar *cmd, const gchar *dir);
 static void set_stop_button(gboolean stop);
 static void run_exit_cb(GPid child_pid, gint status, gpointer user_data);
-static void on_build_arguments_activate(GtkMenuItem *menuitem, gpointer user_data);
-
-static void on_build_compile_activate(GtkMenuItem *menuitem, gpointer user_data);
-static void on_build_tex_activate(GtkMenuItem *menuitem, gpointer user_data);
-static void on_build_build_activate(GtkMenuItem *menuitem, gpointer user_data);
-static void on_build_make_activate(GtkMenuItem *menuitem, gpointer user_data);
-static void on_build_execute_activate(GtkMenuItem *menuitem, gpointer user_data);
-static void on_build_next_error(GtkMenuItem *menuitem, gpointer user_data);
-static void on_build_previous_error(GtkMenuItem *menuitem, gpointer user_data);
+static void on_set_build_commands_activate( GtkWidget *w, gpointer u );
+static void on_build_next_error(GtkWidget *menuitem, gpointer user_data);
+static void on_build_previous_error(GtkWidget *menuitem, gpointer user_data);
 static void kill_process(GPid *pid);
 static void show_build_result_message(gboolean failure);
 static void process_build_output_line(const gchar *line, gint color);
+static void show_build_commands_dialog(void);
 
 
 void build_finalize()
@@ -135,273 +127,142 @@
 	g_free(build_info.dir);
 	g_free(build_info.custom_target);
 
-	if (default_menu_items.menu != NULL && GTK_IS_WIDGET(default_menu_items.menu))
-		gtk_widget_destroy(default_menu_items.menu);
-	if (latex_menu_items.menu != NULL && GTK_IS_WIDGET(latex_menu_items.menu))
-		gtk_widget_destroy(latex_menu_items.menu);
+	if (menu_items.menu != NULL && GTK_IS_WIDGET(menu_items.menu))
+		gtk_widget_destroy(menu_items.menu);
+/*	if (latex_menu_items.menu != NULL && GTK_IS_WIDGET(latex_menu_items.menu))
+		gtk_widget_destroy(latex_menu_items.menu); */
 }
 
-
-static GPid build_compile_tex_file(GeanyDocument *doc, gint mode)
+/* note: copied from keybindings.c, may be able to go away */
+static void add_menu_accel(GeanyKeyGroup *group, guint kb_id,
+	GtkAccelGroup *accel_group, GtkWidget *menuitem)
 {
-	const gchar *cmd = NULL;
+	GeanyKeyBinding *kb = &group->keys[kb_id];
 
-	if (doc == NULL || doc->file_name == NULL)
-		return (GPid) 1;
-
-	if (mode == LATEX_CMD_TO_DVI)
-	{
-		cmd = doc->file_type->programs->compiler;
-		build_info.type = GBO_COMPILE;
-	}
-	else
-	{
-		cmd = doc->file_type->programs->linker;
-		build_info.type = GBO_BUILD;
-	}
-
-	return build_spawn_cmd(doc, cmd, NULL);
+	if (kb->key != 0)
+		gtk_widget_add_accelerator(menuitem, "activate", accel_group,
+			kb->key, kb->mods, GTK_ACCEL_VISIBLE);
 }
 
+/*-----------------------------------------------------
+ * 
+ * Execute commands and handle results
+ * 
+ *-----------------------------------------------------*/
 
-static GPid build_view_tex_file(GeanyDocument *doc, gint mode)
-{
-	gchar **argv, **term_argv;
-	gchar  *executable = NULL;
-	gchar  *view_file = NULL;
-	gchar  *locale_filename = NULL;
-	gchar  *cmd_string = NULL;
-	gchar  *locale_cmd_string = NULL;
-	gchar  *locale_term_cmd;
-	gchar  *script_name;
-	gchar  *working_dir;
-	gint	term_argv_len, i;
-	GError *error = NULL;
+/* the various groups of commands not in the filetype struct */
+GeanyBuildCommand *ft_def=NULL, *non_ft_proj=NULL, *non_ft_pref=NULL, *non_ft_def=NULL, *exec_proj=NULL, *exec_pref=NULL, *exec_def=NULL;
 
-	if (doc == NULL || doc->file_name == NULL)
-		return (GPid) 1;
-
-	run_info.file_type_id = GEANY_FILETYPES_LATEX;
-
-	executable = utils_remove_ext_from_filename(doc->file_name);
-	view_file = g_strconcat(executable, (mode == LATEX_CMD_VIEW_DVI) ? ".dvi" : ".pdf", NULL);
-
-	/* try convert in locale */
-	locale_filename = utils_get_locale_from_utf8(view_file);
-
-	/* replace %f and %e in the run_cmd string */
-	cmd_string = g_strdup((mode == LATEX_CMD_VIEW_DVI) ?
-										g_strdup(doc->file_type->programs->run_cmd) :
-										g_strdup(doc->file_type->programs->run_cmd2));
-	cmd_string = utils_str_replace(cmd_string, "%f", view_file);
-	cmd_string = utils_str_replace(cmd_string, "%e", executable);
-
-	/* try convert in locale */
-	locale_cmd_string = utils_get_locale_from_utf8(cmd_string);
-
-	/* get the terminal path */
-	locale_term_cmd = utils_get_locale_from_utf8(tool_prefs.term_cmd);
-	/* split the term_cmd, so arguments will work too */
-	term_argv = g_strsplit(locale_term_cmd, " ", -1);
-	term_argv_len = g_strv_length(term_argv);
-
-	/* check that terminal exists (to prevent misleading error messages) */
-	if (term_argv[0] != NULL)
+/* get the command taking priority into account */
+static GeanyBuildCommand *get_build_cmd( GeanyDocument *doc, gint cmdgrp, gint cmdindex, gint *from )
+{
+	GeanyBuildSource	 srcindex;
+	GeanyFiletype		*ft=NULL;
+	gint				 sink, *fr = &sink;
+	
+	if(cmdgrp>=GBG_COUNT)return NULL;
+	if( from!=NULL )fr=from;
+	if( doc==NULL )doc=document_get_current();
+	if( doc!=NULL )ft = doc->file_type;
+	switch( cmdgrp )
 	{
-		gchar *tmp = term_argv[0];
-		/* g_find_program_in_path checks tmp exists and is executable */
-		term_argv[0] = g_find_program_in_path(tmp);
-		g_free(tmp);
+		case GBG_FT: /* order proj ft, home ft, ft, defft */
+			if( ft!=NULL )
+			{
+				if( ft->projfilecmds!=NULL && ft->projfilecmds[cmdindex].exists ){ *fr=BCS_PROJ; return &(ft->projfilecmds[cmdindex]); }
+				if( ft->homefilecmds!=NULL && ft->homefilecmds[cmdindex].exists ){ *fr=BCS_FT; return &(ft->homefilecmds[cmdindex]); }
+				if( ft->filecmds!=NULL && ft->filecmds[cmdindex].exists ){ *fr=BCS_FT; return &(ft->filecmds[cmdindex]); }
+			}
+			if( ft_def!=NULL && ft_def[cmdindex].exists ){ *fr=BCS_DEF; return &(ft_def[cmdindex]); }
+			break;
+		case GBG_NON_FT: /* order proj, pref, def */
+			if( non_ft_proj!=NULL && non_ft_proj[cmdindex].exists ){ *fr=BCS_PROJ; return &(non_ft_proj[cmdindex]); }
+			if( non_ft_pref!=NULL && non_ft_pref[cmdindex].exists ){ *fr=BCS_PREF; return &(non_ft_pref[cmdindex]); }
+			if( ft!=NULL && ft->ftdefcmds!=NULL && ft->ftdefcmds[cmdindex].exists ){ *fr=BCS_FT; return &(ft->ftdefcmds[cmdindex]); }
+			if( non_ft_def!=NULL && non_ft_def[cmdindex].exists ){ *fr=BCS_DEF; return &(non_ft_def[cmdindex]); }
+			break;
+		case GBG_EXEC: /* order proj, proj ft, pref, home ft, ft, def */
+			if( exec_proj!=NULL && exec_proj[cmdindex].exists ){ *fr=BCS_PROJ; return &(exec_proj[cmdindex]); }
+			if( ft!=NULL && ft->projexeccmds!=NULL && ft->projexeccmds[cmdindex].exists ){ *fr=BCS_PROJ_FT; return &(ft->projexeccmds[cmdindex]); }
+			if( exec_pref!=NULL && exec_pref[cmdindex].exists ){ *fr=BCS_PREF; return &(exec_pref[cmdindex]); }
+			if( ft!=NULL && ft->homeexeccmds!=NULL && ft->homeexeccmds[cmdindex].exists ){ *fr=BCS_FT; return &(ft->homeexeccmds[cmdindex]); }
+			if( ft!=NULL && ft->execcmds!=NULL && ft->execcmds[cmdindex].exists ){ *fr=BCS_FT; return &(ft->execcmds[cmdindex]); }
+			if( exec_def!=NULL && exec_def[cmdindex].exists ){ *fr=BCS_DEF; return &(exec_def[cmdindex]); }
+			break;
+		default:
+			break;
 	}
-	if (term_argv[0] == NULL)
-	{
-		ui_set_statusbar(TRUE,
-			_("Could not find terminal \"%s\" "
-				"(check path for Terminal tool setting in Preferences)"), tool_prefs.term_cmd);
-
-		utils_free_pointers(6, executable, view_file, locale_filename, cmd_string, locale_cmd_string,
-										locale_term_cmd, NULL);
-		g_strfreev(term_argv);
-		return (GPid) 1;
-	}
-
-	/* RUN_SCRIPT_CMD should be ok in UTF8 without converting in locale because
-	 * it contains no umlauts */
-	working_dir = g_path_get_dirname(locale_filename); /** TODO do we need project support here? */
-	script_name = g_build_filename(working_dir, RUN_SCRIPT_CMD, NULL);
-	if (! build_create_shellscript(script_name, locale_cmd_string, TRUE))
-	{
-		ui_set_statusbar(TRUE, _("Failed to execute \"%s\" (start-script could not be created)"),
-													executable);
-		utils_free_pointers(7, executable, view_file, locale_filename, cmd_string, locale_cmd_string,
-										locale_term_cmd, working_dir, NULL);
-		g_strfreev(term_argv);
-		return (GPid) 1;
-	}
-	g_free(script_name);
-
-	argv = g_new0(gchar *, term_argv_len + 3);
-	for (i = 0; i < term_argv_len; i++)
-	{
-		argv[i] = g_strdup(term_argv[i]);
-	}
-#ifdef G_OS_WIN32
-		/* command line arguments only for cmd.exe */
-		if (strstr(argv[0], "cmd.exe") != NULL)
-		{
-			argv[term_argv_len   ]  = g_strdup("/Q /C");
-			argv[term_argv_len + 1] = g_strconcat("/bin/sh ", RUN_SCRIPT_CMD, NULL);
-		}
-		else
-		{
-			argv[term_argv_len    ] = g_strconcat("/bin/sh ", RUN_SCRIPT_CMD, NULL);
-			argv[term_argv_len + 1] = NULL;
-		}
-#else
-	argv[term_argv_len   ]  = g_strdup("-e");
-	argv[term_argv_len + 1] = g_strconcat("/bin/sh ", RUN_SCRIPT_CMD, NULL);
-#endif
-	argv[term_argv_len + 2] = NULL;
-
-	if (! g_spawn_async(working_dir, argv, NULL, G_SPAWN_DO_NOT_REAP_CHILD,
-						NULL, NULL, &(run_info.pid), &error))
-	{
-		geany_debug("g_spawn_async() failed: %s", error->message);
-		ui_set_statusbar(TRUE, _("Process failed (%s)"), error->message);
-
-		utils_free_pointers(7, executable, view_file, locale_filename, cmd_string,
-			locale_cmd_string, locale_term_cmd, working_dir, NULL);
-		g_strfreev(argv);
-		g_strfreev(term_argv);
-		g_error_free(error);
-		error = NULL;
-		return (GPid) 0;
-	}
-
-	if (run_info.pid > 0)
-	{
-		/*setpgid(0, getppid());*/
-		g_child_watch_add(run_info.pid, (GChildWatchFunc) run_exit_cb, NULL);
-		build_menu_update(doc);
-	}
-
-	utils_free_pointers(7, executable, view_file, locale_filename, cmd_string,
-		locale_cmd_string, locale_term_cmd, working_dir, NULL);
-	g_strfreev(argv);
-	g_strfreev(term_argv);
-
-	return run_info.pid;
+	return NULL;
 }
 
-
-/* get curfile.o in locale encoding from document::file_name */
-static gchar *get_object_filename(GeanyDocument *doc)
+/* remove the specified command, cmd<0 remove whole group */
+void remove_command( GeanyBuildSource src, GeanyBuildGroup grp, gint cmd )
 {
-	gchar *locale_filename, *short_file, *noext, *object_file;
-
-	if (doc->file_name == NULL) return NULL;
-
-	locale_filename = utils_get_locale_from_utf8(doc->file_name);
-
-	short_file = g_path_get_basename(locale_filename);
-	g_free(locale_filename);
-
-	noext = utils_remove_ext_from_filename(short_file);
-	g_free(short_file);
-
-	object_file = g_strdup_printf("%s.o", noext);
-	g_free(noext);
-
-	return object_file;
-}
-
-
-static GPid build_make_file(GeanyDocument *doc, gint build_opts)
-{
-	GString *cmdstr;
-	gchar *dir = NULL;
-	GPid pid;
-
-	if (doc == NULL || doc->file_name == NULL)
-		return (GPid) 1;
-
-	cmdstr = g_string_new(tool_prefs.make_cmd);
-	g_string_append_c(cmdstr, ' ');
-
-	if (build_opts == GBO_MAKE_OBJECT)
+	GeanyBuildCommand *bc;
+	gint i;
+	GeanyDocument *doc;
+	GeanyFiletype *ft;
+	
+	switch(grp)
 	{
-		gchar *tmp;
-
-		build_info.type = build_opts;
-		tmp = get_object_filename(doc);
-		g_string_append(cmdstr, tmp);
-		g_free(tmp);
+		case GBG_FT:
+			if((doc=document_get_current())==NULL)return;
+			if((ft=doc->file_type)==NULL)return;
+			switch(src)
+			{
+				case BCS_DEF:     bc=ft->ftdefcmds; break;
+				case BCS_FT:      bc=ft->filecmds; break;
+				case BCS_HOME_FT: bc=ft->homefilecmds; break;
+				case BCS_PREF:    bc=ft->homefilecmds; break;
+				case BCS_PROJ:    bc=ft->projfilecmds; break;
+				case BCS_PROJ_FT: bc=ft->projfilecmds; break;
+				default: return;
+			}
+			break;
+		case GBG_NON_FT:
+			switch(src)
+			{
+				case BCS_DEF:     bc=non_ft_def; break;
+				case BCS_PREF:    bc=non_ft_pref; break;
+				case BCS_PROJ:    bc=non_ft_proj; break;
+				default: return;
+			}
+			break;
+		case GBG_EXEC:
+			if((doc=document_get_current())==NULL)return;
+			if((ft=doc->file_type)==NULL)return;
+			switch(src)
+			{
+				case BCS_DEF:     bc=exec_def; break;
+				case BCS_FT:      bc=ft->execcmds; break;
+				case BCS_HOME_FT: bc=ft->homeexeccmds; break;
+				case BCS_PREF:    bc=exec_pref; break;
+				case BCS_PROJ:    bc=exec_proj; break;
+				case BCS_PROJ_FT: bc=ft->projexeccmds; break;
+				default: return;
+				
+			}
+			break;
+		default:
+			return;
 	}
-	else if (build_opts == GBO_MAKE_CUSTOM && build_info.custom_target)
-	{
-		build_info.type = GBO_MAKE_CUSTOM;
-		g_string_append(cmdstr, build_info.custom_target);
-		dir = project_get_make_dir();
-	}
-	else	/* GBO_MAKE_ALL */
-	{
-		build_info.type = GBO_MAKE_ALL;
-		g_string_append(cmdstr, "all");
-		dir = project_get_make_dir();
-	}
-
-	pid = build_spawn_cmd(doc, cmdstr->str, dir); /* if dir is NULL, idx filename is used */
-	g_free(dir);
-	g_string_free(cmdstr, TRUE);
-	return pid;
+	if(bc==NULL)return;
+	if(cmd<0)
+		for(i=0; i<build_groups_count[grp]; ++i )
+			bc[i].exists=FALSE;
+	else
+		bc[cmd].exists=FALSE;
 }
 
-
-static GPid build_compile_file(GeanyDocument *doc)
-{
-	if (doc == NULL || doc->file_name == NULL)
-		return (GPid) 1;
-
-	build_info.type = GBO_COMPILE;
-	return build_spawn_cmd(doc, doc->file_type->programs->compiler, NULL);
-}
-
-
-static GPid build_link_file(GeanyDocument *doc)
-{
-	if (doc == NULL || doc->file_name == NULL)
-		return (GPid) 1;
-
-	build_info.type = GBO_BUILD;
-	return build_spawn_cmd(doc, doc->file_type->programs->linker, NULL);
-}
-
-
-/* If linking, clear all error indicators in all documents.
- * Otherwise, just clear error indicators in document idx. */
+/* Clear all error indicators in all documents. */
 static void clear_errors(GeanyDocument *doc)
 {
-	switch (build_info.type)
-	{
-		case GBO_COMPILE:
-		case GBO_MAKE_OBJECT:
-			g_return_if_fail(doc);
-			editor_indicator_clear_errors(doc->editor);
-			break;
+	guint i;
 
-		case GBO_BUILD:
-		case GBO_MAKE_ALL:
-		case GBO_MAKE_CUSTOM:
-		{
-			guint i;
-
-			for (i = 0; i < documents_array->len; i++)
-			{
-				if (documents[i]->is_valid)
-					editor_indicator_clear_errors(documents[i]->editor);
-			}
-			break;
-		}
+	for (i = 0; i < documents_array->len; i++)
+	{
+		if (documents[i]->is_valid)
+			editor_indicator_clear_errors(documents[i]->editor);
 	}
 }
 
@@ -468,9 +329,9 @@
 	gint     stderr_fd;
 #endif
 
-	g_return_val_if_fail(doc != NULL, (GPid) 1);
+	g_return_val_if_fail(doc!=NULL || dir!=NULL, (GPid) 1);
 
-	clear_errors(doc);
+	if(doc!=NULL)clear_errors(doc);
 	setptr(current_dir_entered, NULL);
 
 	locale_filename = utils_get_locale_from_utf8(doc->file_name);
@@ -510,7 +371,7 @@
 	/* set the build info for the message window */
 	g_free(build_info.dir);
 	build_info.dir = g_strdup(working_dir);
-	build_info.file_type_id = FILETYPE_ID(doc->file_type);
+	build_info.file_type_id = (doc==NULL)?GEANY_FILETYPES_NONE : FILETYPE_ID(doc->file_type);
 	build_info.message_count = 0;
 
 #ifdef G_OS_WIN32
@@ -581,9 +442,8 @@
 	locale_filename = utils_get_locale_from_utf8(doc->file_name);
 
 	have_project = (project != NULL && NZV(project->run_cmd));
-	cmd = (have_project) ?
-		project->run_cmd :
-		ft->programs->run_cmd;
+	cmd = get_build_cmd( doc, GBG_EXEC, 0, NULL )->command;
+	/* TODO fix all this stuff */
 
 	if (strstr(cmd, "%e") != NULL)
 	{
@@ -1001,1105 +861,1007 @@
 	return TRUE;
 }
 
+typedef void callback( GtkWidget *w, gpointer u );
 
-/* note: copied from keybindings.c.
- * Perhaps the separate Tex menu could be merged with the default build menu?
- * Then this could be done with Glade and set the accels in keybindings.c. */
-static void add_menu_accel(GeanyKeyGroup *group, guint kb_id,
-	GtkAccelGroup *accel_group, GtkWidget *menuitem)
+/* run the command catenating cmd_cat if present */
+static void build_command( GeanyDocument *doc, GeanyBuildGroup grp, gint cmd, gchar *cmd_cat )
 {
-	GeanyKeyBinding *kb = &group->keys[kb_id];
+	gchar *dir;
+	gchar *full_command;
+	GeanyBuildCommand *buildcmd = get_build_cmd( doc, grp, cmd, NULL );
+	
+	if( buildcmd==NULL )return;
+	if( cmd_cat != NULL )
+	{
+		if( buildcmd->command != NULL )
+			full_command = g_strconcat( buildcmd->command, cmd_cat, NULL );
+		else
+			full_command = g_strdup(cmd_cat );
+	}
+	else
+		full_command = buildcmd->command;
+	if( grp == GBG_FT )
+	{
+		dir=NULL; /* allways run in doc dir */
+	}
+	else
+	{
+		dir = NULL;
+		if( buildcmd->run_in_base_dir )
+			dir =  project_get_make_dir();
+	}
+	build_info.grp = grp;
+	build_info.cmd = cmd;
+	build_spawn_cmd(doc, full_command, dir);
+	g_free( dir );
+	if( cmd_cat != NULL ) g_free(full_command);
+	build_menu_update( doc );
 
-	if (kb->key != 0)
-		gtk_widget_add_accelerator(menuitem, "activate", accel_group,
-			kb->key, kb->mods, GTK_ACCEL_VISIBLE);
 }
 
 
-#define GEANY_ADD_WIDGET_ACCEL(kb_id, menuitem) \
-	add_menu_accel(group, kb_id, accel_group, menuitem)
+/*----------------------------------------------------------------
+ * 
+ * Create build menu and handle callbacks (&toolbar callbacks)
+ * 
+ *----------------------------------------------------------------*/
 
-static void create_build_menu_gen(BuildMenuItems *menu_items)
+static void on_make_custom_input_response(const gchar *input)
 {
-	GtkWidget *menu, *item = NULL, *separator;
-	GtkAccelGroup *accel_group = gtk_accel_group_new();
-	GeanyKeyGroup *group = g_ptr_array_index(keybinding_groups, GEANY_KEY_GROUP_BUILD);
-
-	menu = gtk_menu_new();
-
-	/* compile the code */
-	item = ui_image_menu_item_new(GTK_STOCK_CONVERT, _("_Compile"));
-	gtk_widget_show(item);
-	gtk_container_add(GTK_CONTAINER(menu), item);
-	GEANY_ADD_WIDGET_ACCEL(GEANY_KEYS_BUILD_COMPILE, item);
-	g_signal_connect(item, "activate", G_CALLBACK(on_build_compile_activate), NULL);
-	menu_items->item_compile = item;
-
-	/* build the code */
-	item = ui_image_menu_item_new(GEANY_STOCK_BUILD, _("_Build"));
-	gtk_widget_show(item);
-	gtk_container_add(GTK_CONTAINER(menu), item);
-	GEANY_ADD_WIDGET_ACCEL(GEANY_KEYS_BUILD_LINK, item);
-	g_signal_connect(item, "activate", G_CALLBACK(on_build_build_activate), NULL);
-	menu_items->item_link = item;
-
-	item = gtk_separator_menu_item_new();
-	gtk_widget_show(item);
-	gtk_container_add(GTK_CONTAINER(menu), item);
-
-	/* build the code with make all */
-	item = gtk_image_menu_item_new_with_mnemonic(_("_Make All"));
-	gtk_widget_show(item);
-	gtk_container_add(GTK_CONTAINER(menu), item);
-	GEANY_ADD_WIDGET_ACCEL(GEANY_KEYS_BUILD_MAKE, item);
-	g_signal_connect(item, "activate", G_CALLBACK(on_build_make_activate),
-		GINT_TO_POINTER(GBO_MAKE_ALL));
-	menu_items->item_make_all = item;
-
-	/* build the code with make custom */
-	item = gtk_image_menu_item_new_with_mnemonic(_("Make Custom _Target"));
-	gtk_widget_show(item);
-	GEANY_ADD_WIDGET_ACCEL(GEANY_KEYS_BUILD_MAKEOWNTARGET, item);
-	gtk_container_add(GTK_CONTAINER(menu), item);
-	g_signal_connect(item, "activate", G_CALLBACK(on_build_make_activate),
-		GINT_TO_POINTER(GBO_MAKE_CUSTOM));
-	menu_items->item_make_custom = item;
-
-	/* build the code with make object */
-	item = gtk_image_menu_item_new_with_mnemonic(_("Make _Object"));
-	gtk_widget_show(item);
-	GEANY_ADD_WIDGET_ACCEL(GEANY_KEYS_BUILD_MAKEOBJECT, item);
-	gtk_container_add(GTK_CONTAINER(menu), item);
-	g_signal_connect(item, "activate", G_CALLBACK(on_build_make_activate),
-		GINT_TO_POINTER(GBO_MAKE_OBJECT));
-	menu_items->item_make_object = item;
-
-	item = gtk_separator_menu_item_new();
-	gtk_widget_show(item);
-	gtk_container_add(GTK_CONTAINER(menu), item);
-
-	/* next error */
-	item = gtk_image_menu_item_new_with_mnemonic(_("_Next Error"));
-	gtk_widget_show(item);
-	GEANY_ADD_WIDGET_ACCEL(GEANY_KEYS_BUILD_NEXTERROR, item);
-	gtk_container_add(GTK_CONTAINER(menu), item);
-	g_signal_connect(item, "activate", G_CALLBACK(on_build_next_error), NULL);
-	menu_items->item_next_error = item;
-
-	item = gtk_image_menu_item_new_with_mnemonic(_("_Previous Error"));
-	gtk_widget_show(item);
-	GEANY_ADD_WIDGET_ACCEL(GEANY_KEYS_BUILD_PREVIOUSERROR, item);
-	gtk_container_add(GTK_CONTAINER(menu), item);
-	g_signal_connect(item, "activate", G_CALLBACK(on_build_previous_error), NULL);
-	menu_items->item_previous_error = item;
-
-	item = gtk_separator_menu_item_new();
-	gtk_widget_show(item);
-	gtk_container_add(GTK_CONTAINER(menu), item);
-
-	/* execute the code */
-	item = gtk_image_menu_item_new_from_stock("gtk-execute", accel_group);
-	gtk_widget_show(item);
-	gtk_container_add(GTK_CONTAINER(menu), item);
-	GEANY_ADD_WIDGET_ACCEL(GEANY_KEYS_BUILD_RUN, item);
-	g_signal_connect(item, "activate", G_CALLBACK(on_build_execute_activate), NULL);
-	menu_items->item_exec = item;
-
-	separator = gtk_separator_menu_item_new();
-	gtk_widget_show(separator);
-	gtk_container_add(GTK_CONTAINER(menu), separator);
-	gtk_widget_set_sensitive(separator, FALSE);
-
-	/* arguments */
-	item = ui_image_menu_item_new(GTK_STOCK_PREFERENCES, _("_Set Includes and Arguments"));
-	gtk_widget_show(item);
-	GEANY_ADD_WIDGET_ACCEL(GEANY_KEYS_BUILD_OPTIONS, item);
-	gtk_container_add(GTK_CONTAINER(menu), item);
-	g_signal_connect(item, "activate", G_CALLBACK(on_build_arguments_activate), NULL);
-	menu_items->item_set_args = item;
-
-	menu_items->menu = menu;
-	g_object_ref((gpointer)menu_items->menu);	/* to hold it after removing */
+	GeanyDocument *doc = document_get_current();
+	setptr(build_info.custom_target, g_strdup(input));
+	build_command(doc, GBO_TO_GBG(GBO_MAKE_CUSTOM), GBO_TO_CMD(GBO_MAKE_CUSTOM), build_info.custom_target);
 }
 
-
-static void create_build_menu_tex(BuildMenuItems *menu_items)
+static void on_build_menu_item( GtkWidget *w, gpointer user_data )
 {
-	GtkWidget *menu, *item, *separator;
-	GtkAccelGroup *accel_group = gtk_accel_group_new();
-	GeanyKeyGroup *group = g_ptr_array_index(keybinding_groups, GEANY_KEY_GROUP_BUILD);
-
-	menu = gtk_menu_new();
-
-	/* DVI */
-	item = ui_image_menu_item_new(GTK_STOCK_CONVERT, _("LaTeX -> _DVI"));
-	gtk_widget_show(item);
-	gtk_container_add(GTK_CONTAINER(menu), item);
-	GEANY_ADD_WIDGET_ACCEL(GEANY_KEYS_BUILD_COMPILE, item);
-	g_signal_connect(item, "activate",
-				G_CALLBACK(on_build_tex_activate), GINT_TO_POINTER(LATEX_CMD_TO_DVI));
-	menu_items->item_compile = item;
-
-	/* PDF */
-	item = ui_image_menu_item_new(GEANY_STOCK_BUILD, _("LaTeX -> _PDF"));
-	gtk_widget_show(item);
-	gtk_container_add(GTK_CONTAINER(menu), item);
-	GEANY_ADD_WIDGET_ACCEL(GEANY_KEYS_BUILD_LINK, item);
-	g_signal_connect(item, "activate",
-				G_CALLBACK(on_build_tex_activate), GINT_TO_POINTER(LATEX_CMD_TO_PDF));
-	menu_items->item_link = item;
-
-	item = gtk_separator_menu_item_new();
-	gtk_widget_show(item);
-	gtk_container_add(GTK_CONTAINER(menu), item);
-
-	/* build the code with make all */
-	item = gtk_image_menu_item_new_with_mnemonic(_("_Make All"));
-	gtk_widget_show(item);
-	gtk_container_add(GTK_CONTAINER(menu), item);
-	GEANY_ADD_WIDGET_ACCEL(GEANY_KEYS_BUILD_MAKE, item);
-	g_signal_connect(item, "activate", G_CALLBACK(on_build_make_activate),
-		GINT_TO_POINTER(GBO_MAKE_ALL));
-	menu_items->item_make_all = item;
-
-	/* build the code with make custom */
-	item = gtk_image_menu_item_new_with_mnemonic(_("Make Custom _Target"));
-	gtk_widget_show(item);
-	GEANY_ADD_WIDGET_ACCEL(GEANY_KEYS_BUILD_MAKEOWNTARGET, item);
-	gtk_container_add(GTK_CONTAINER(menu), item);
-	g_signal_connect(item, "activate", G_CALLBACK(on_build_make_activate),
-		GINT_TO_POINTER(GBO_MAKE_CUSTOM));
-	menu_items->item_make_custom = item;
-
-	item = gtk_separator_menu_item_new();
-	gtk_widget_show(item);
-	gtk_container_add(GTK_CONTAINER(menu), item);
-
-	/* next error */
-	item = gtk_image_menu_item_new_with_mnemonic(_("_Next Error"));
-	gtk_widget_show(item);
-	GEANY_ADD_WIDGET_ACCEL(GEANY_KEYS_BUILD_NEXTERROR, item);
-	gtk_container_add(GTK_CONTAINER(menu), item);
-	g_signal_connect(item, "activate", G_CALLBACK(on_build_next_error), NULL);
-	menu_items->item_next_error = item;
-
-	item = gtk_image_menu_item_new_with_mnemonic(_("_Previous Error"));
-	gtk_widget_show(item);
-	/*GEANY_ADD_WIDGET_ACCEL(GEANY_KEYS_BUILD_, item);*/
-	gtk_container_add(GTK_CONTAINER(menu), item);
-	g_signal_connect(item, "activate", G_CALLBACK(on_build_previous_error), NULL);
-	menu_items->item_previous_error = item;
-
-	item = gtk_separator_menu_item_new();
-	gtk_widget_show(item);
-	gtk_container_add(GTK_CONTAINER(menu), item);
-
-	/* DVI view */
-#define LATEX_VIEW_DVI_LABEL _("_View DVI File") /* used later again */
-	item = ui_image_menu_item_new(GTK_STOCK_FIND, LATEX_VIEW_DVI_LABEL);
-	gtk_widget_show(item);
-	gtk_container_add(GTK_CONTAINER(menu), item);
-	GEANY_ADD_WIDGET_ACCEL(GEANY_KEYS_BUILD_RUN, item);
-	g_signal_connect(item, "activate",
-					G_CALLBACK(on_build_execute_activate), GINT_TO_POINTER(LATEX_CMD_VIEW_DVI));
-	menu_items->item_exec = item;
-
-	/* PDF view */
-	item = ui_image_menu_item_new(GTK_STOCK_FIND, _("V_iew PDF File"));
-	gtk_widget_show(item);
-	gtk_container_add(GTK_CONTAINER(menu), item);
-	GEANY_ADD_WIDGET_ACCEL(GEANY_KEYS_BUILD_RUN2, item);
-	g_signal_connect(item, "activate",
-					G_CALLBACK(on_build_execute_activate), GINT_TO_POINTER(LATEX_CMD_VIEW_PDF));
-	menu_items->item_exec2 = item;
-
-	/* separator */
-	separator = gtk_separator_menu_item_new();
-	gtk_widget_show(separator);
-	gtk_container_add(GTK_CONTAINER(menu), separator);
-	gtk_widget_set_sensitive(separator, FALSE);
-
-	/* arguments */
-	item = ui_image_menu_item_new(GTK_STOCK_PREFERENCES, _("_Set Arguments"));
-	gtk_widget_show(item);
-	GEANY_ADD_WIDGET_ACCEL(GEANY_KEYS_BUILD_OPTIONS, item);
-	gtk_container_add(GTK_CONTAINER(menu), item);
-	g_signal_connect(item, "activate",
-		G_CALLBACK(on_build_arguments_activate), filetypes[GEANY_FILETYPES_LATEX]);
-	menu_items->item_set_args = item;
-
-	gtk_window_add_accel_group(GTK_WINDOW(main_widgets.window), accel_group);
-
-	menu_items->menu = menu;
-	g_object_ref((gpointer)menu_items->menu);	/* to hold it after removing */
-}
-
-
-static void
-on_includes_arguments_tex_dialog_response  (GtkDialog *dialog,
-                                            gint response,
-                                            gpointer user_data)
-{
-	GeanyFiletype *ft = user_data;
-	g_return_if_fail(ft != NULL);
-
-	if (response == GTK_RESPONSE_ACCEPT)
+	GeanyDocument *doc = document_get_current();
+	filetype_id ft_id;
+	GeanyFiletype *ft;
+	gint grp=GPOINTER_TO_GRP(user_data);
+	gint cmd=GPOINTER_TO_CMD(user_data);
+	
+	if (doc && doc->changed)
+		document_save_file(doc, FALSE);
+	if( grp == GBG_NON_FT && cmd == GBO_TO_CMD(GBO_MAKE_CUSTOM) )
 	{
-		const gchar *newstr;
-		struct build_programs *programs = ft->programs;
+		static GtkWidget *dialog = NULL;	/* keep dialog for combo history */
 
-		newstr = gtk_entry_get_text(
-				GTK_ENTRY(ui_lookup_widget(GTK_WIDGET(dialog), "tex_entry1")));
-		if (! utils_str_equal(newstr, programs->compiler))
+		if (! dialog)
+			dialog = dialogs_show_input(_("Custom Text"),
+				_("Enter custom text here, all entered text is appended to the command."),
+				build_info.custom_target, TRUE, &on_make_custom_input_response);
+		else
 		{
-			if (programs->compiler) g_free(programs->compiler);
-			programs->compiler = g_strdup(newstr);
-			programs->modified = TRUE;
+			gtk_widget_show(dialog);
 		}
-		newstr = gtk_entry_get_text(
-				GTK_ENTRY(ui_lookup_widget(GTK_WIDGET(dialog), "tex_entry2")));
-		if (! utils_str_equal(newstr, programs->linker))
+		return;
+	}
+	else if( grp == GBG_EXEC && cmd == GBO_TO_CMD(GBO_EXEC) )
+	{
+		if (run_info.pid > (GPid) 1)
 		{
-			if (programs->linker) g_free(programs->linker);
-			programs->linker = g_strdup(newstr);
-			programs->modified = TRUE;
+			kill_process(&run_info.pid);
+			return;
 		}
-		newstr = gtk_entry_get_text(
-				GTK_ENTRY(ui_lookup_widget(GTK_WIDGET(dialog), "tex_entry3")));
-		if (! utils_str_equal(newstr, programs->run_cmd))
+		GeanyBuildCommand *bc = get_build_cmd( doc, grp, cmd, NULL );
+		if( bc!=NULL && strcmp( bc->command, "builtin" )==0 )
 		{
-			if (programs->run_cmd) g_free(programs->run_cmd);
-			programs->run_cmd = g_strdup(newstr);
-			programs->modified = TRUE;
+			if( doc==NULL )return;
+			gchar *uri = g_strconcat("file:///", g_path_skip_root(doc->file_name), NULL);
+			utils_open_browser(uri);
+			g_free(uri);
+
 		}
-		newstr = gtk_entry_get_text(
-				GTK_ENTRY(ui_lookup_widget(GTK_WIDGET(dialog), "tex_entry4")));
-		if (! utils_str_equal(newstr, programs->run_cmd2))
-		{
-			if (programs->run_cmd2) g_free(programs->run_cmd2);
-			programs->run_cmd2 = g_strdup(newstr);
-			programs->modified = TRUE;
-		}
+		else
+			build_run_cmd(doc);
 	}
-}
+	else
+		build_command( doc, grp, cmd, NULL );
+};
 
+/* group codes for menu items other than the known commands
+ * value order is important, see the following table for use */
 
-static void show_includes_arguments_tex(void)
-{
-	GtkWidget *dialog, *label, *entries[4], *vbox, *table;
-	GeanyDocument *doc = document_get_current();
-	gint response;
-	GeanyFiletype *ft = NULL;
+/* the rest in each group */
+#define MENU_FT_REST     (GBG_COUNT+GBG_FT)
+#define MENU_NON_FT_REST (GBG_COUNT+GBG_NON_FT)
+#define MENU_EXEC_REST   (GBG_COUNT+GBG_EXEC)
+/* the separator */
+#define MENU_SEPARATOR   (2*GBG_COUNT)
+/* the fixed items */
+#define MENU_NEXT_ERROR  (MENU_SEPARATOR+1)
+#define MENU_PREV_ERROR  (MENU_NEXT_ERROR+1)
+#define MENU_COMMANDS    (MENU_PREV_ERROR+1)
+#define MENU_DONE        (MENU_COMMANDS+1)
 
-	if (doc != NULL)
-		ft = doc->file_type;
-	g_return_if_fail(ft != NULL);
 
-	dialog = gtk_dialog_new_with_buttons(_("Set Arguments"), GTK_WINDOW(main_widgets.window),
-										GTK_DIALOG_DESTROY_WITH_PARENT,
-										GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-										GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL);
-	vbox = ui_dialog_vbox_new(GTK_DIALOG(dialog));
-	gtk_widget_set_name(dialog, "GeanyDialog");
+static struct build_menu_item_spec {
+	const gchar	*stock_id;
+	const gint	 key_binding;
+	const gint	 build_grp, build_cmd;
+	const gchar	*fix_label;
+	callback *cb;
+} build_menu_specs[] = { 

@@ Diff output truncated at 100000 characters. @@

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list