[gnome-latex: 168/205] Document Compilation: new options



commit fbb775a8ca80c7b58d788dc61ed2e9ce8f9f1822
Author: Sébastien Wilmet <sebastien wilmet gmail com>
Date:   Thu Jan 14 16:45:39 2010 +0100

    Document Compilation: new options
    
    There are two new options in the preferences, for the document
    compilation. We can show all the output, without filtering the lines,
    and set -interaction=nonstopmode.

 src/CMakeLists.txt        |  27 +--
 src/callbacks.c           |  66 ++++--
 src/external_commands.c   |  14 +-
 src/latex_output_filter.c |  49 +++++
 src/latex_output_filter.h |  25 +++
 src/main.h                |   2 +
 src/prefs.c               | 512 +++++++++++++++++++++++++++-------------------
 7 files changed, 453 insertions(+), 242 deletions(-)
---
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6904912..a364180 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,15 +1,18 @@
-SET(latexila_src main.c                        main.h
-                callbacks.c            callbacks.h
-                cb_latex.c             cb_latex.h
-                print.c                print.h
-                symbols.c              symbols.h
-                external_commands.c    external_commands.h
-                prefs.c                prefs.h
-                ui.c                   ui.h
-                tool_menu_action.c     tool_menu_action.h
-                file_browser.c         file_browser.h
-                templates.c            templates.h
-                utils.c                utils.h)
+SET(latexila_src
+       main.c                  main.h
+       callbacks.c             callbacks.h
+       cb_latex.c              cb_latex.h
+       print.c                 print.h
+       symbols.c               symbols.h
+       external_commands.c     external_commands.h
+       latex_output_filter.c   latex_output_filter.h
+       prefs.c                 prefs.h
+       ui.c                    ui.h
+       tool_menu_action.c      tool_menu_action.h
+       file_browser.c          file_browser.h
+       templates.c             templates.h
+       utils.c                 utils.h
+)
 
 ADD_EXECUTABLE(latexila ${latexila_src})
 TARGET_LINK_LIBRARIES(latexila ${GTK2_LIBRARIES})
diff --git a/src/callbacks.c b/src/callbacks.c
index 2c28711..ed345e9 100644
--- a/src/callbacks.c
+++ b/src/callbacks.c
@@ -612,20 +612,33 @@ cb_latex (void)
        cb_save ();
 
        gchar *title = _("Compile (latex)");
-       gchar *command[] = {
-               latexila.prefs.command_latex,
-               "-file-line-error",
-               // we take the basename because the command is run inside the directory
-               // of the document, and the output lines which contains the filename
-               // are shorter (the lines too long are splitted, so the user can not
-               // see all the line if there is a filter which operate line per line)
-               g_path_get_basename (latexila.active_doc->path),
-               NULL
-    };
 
-    compile_document (title, command);
+       if (latexila.prefs.compile_non_stop)
+       {
+               gchar *command[] = {
+                       latexila.prefs.command_latex,
+                       "-interaction=nonstopmode",
+                       // we take the basename because the command is run inside the directory
+                       // of the document, and the output lines which contains the filename
+                       // are shorter (the lines too long are splitted, so the user can not
+                       // see all the line if there is a filter which operate line per line)
+                       g_path_get_basename (latexila.active_doc->path),
+                       NULL
+               };
+               compile_document (title, command);
+               g_free (command[2]);
+       }
 
-       g_free (command[2]);
+       else
+       {
+               gchar *command[] = {
+                       latexila.prefs.command_latex,
+                       g_path_get_basename (latexila.active_doc->path),
+                       NULL
+               };
+               compile_document (title, command);
+               g_free (command[1]);
+       }
 }
 
 void
@@ -637,16 +650,29 @@ cb_pdflatex (void)
        cb_save ();
 
        gchar *title = _("Compile (pdflatex)");
-       gchar *command[] = {
-               latexila.prefs.command_pdflatex,
-               "-file-line-error",
-               g_path_get_basename (latexila.active_doc->path),
-               NULL
-    };
 
-    compile_document (title, command);
+       if (latexila.prefs.compile_non_stop)
+       {
+               gchar *command[] = {
+                       latexila.prefs.command_pdflatex,
+                       "-interaction=nonstopmode",
+                       g_path_get_basename (latexila.active_doc->path),
+                       NULL
+               };
+               compile_document (title, command);
+               g_free (command[2]);
+       }
 
-       g_free (command[2]);
+       else
+       {
+               gchar *command[] = {
+                       latexila.prefs.command_pdflatex,
+                       g_path_get_basename (latexila.active_doc->path),
+                       NULL
+               };
+               compile_document (title, command);
+               g_free (command[1]);
+       }
 }
 
 void
diff --git a/src/external_commands.c b/src/external_commands.c
index 8487155..b56baaf 100644
--- a/src/external_commands.c
+++ b/src/external_commands.c
@@ -38,6 +38,7 @@
 #include "utils.h"
 #include "external_commands.h"
 #include "file_browser.h"
+#include "latex_output_filter.h"
 
 static void add_action (const gchar *title, const gchar *command);
 static void set_action_sensitivity (gboolean sensitive);
@@ -47,7 +48,7 @@ static void start_command_with_output (gchar **command);
 static void cb_spawn_setup (gpointer data);
 static gboolean cb_watch_output_command (GIOChannel *channel,
                GIOCondition condition, gpointer user_data);
-static void output_filter_line (const gchar *line);
+//static void output_filter_line (const gchar *line);
 static void cb_child_watch (GPid pid, gint status, gpointer user_data);
 static void finish_execute (void);
 static void run_command_on_other_extension (gchar *title, gchar *message,
@@ -82,7 +83,7 @@ compile_document (gchar *title, gchar **command)
        // without that, the message in the statusbar does not appear
        flush_queue ();
 
-       show_all_output = FALSE;
+       show_all_output = latexila.prefs.compile_show_all_output;
        start_command_with_output (command);
 }
 
@@ -304,7 +305,7 @@ start_command_without_output (gchar **command, gchar *message)
 
 // Attention, before calling this function, set the variable "show_all_output"
 // to TRUE or FALSE. If it is FALSE, the output will be filtered by the function
-// output_filter_line().
+// latex_output_filter().
 static void
 start_command_with_output (gchar **command)
 {
@@ -339,6 +340,7 @@ start_command_with_output (gchar **command)
 
        // convert the channel
        g_io_channel_set_encoding (out_channel, NULL, NULL);
+       //g_io_channel_set_encoding (out_channel, "ISO-8859-1", NULL);
 
        // lock the action list and all the build actions
        set_action_sensitivity (FALSE);
@@ -390,6 +392,8 @@ cb_watch_output_command (GIOChannel *channel, GIOCondition condition,
                        if (line != NULL)
                        {
                                line_utf8 = g_locale_to_utf8 (line, -1, NULL, NULL, NULL);
+                               if (line_utf8 == NULL)
+                                       line_utf8 = g_convert (line, -1, "UTF-8", "ISO-8859-1", NULL, NULL, 
NULL);
                                g_free (line);
                        }
 
@@ -413,7 +417,7 @@ cb_watch_output_command (GIOChannel *channel, GIOCondition condition,
                                }
 
                                else
-                                       output_filter_line (line_utf8);
+                                       latex_output_filter (line_utf8);
 
                                g_free (line_utf8);
                        }
@@ -450,6 +454,7 @@ cb_watch_output_command (GIOChannel *channel, GIOCondition condition,
        return TRUE;
 }
 
+/*
 static void
 output_filter_line (const gchar *line)
 {
@@ -468,6 +473,7 @@ output_filter_line (const gchar *line)
                flush_queue ();
        }
 }
+*/
 
 static void
 cb_child_watch (GPid pid, gint status, gpointer user_data)
diff --git a/src/latex_output_filter.c b/src/latex_output_filter.c
new file mode 100644
index 0000000..3d278a3
--- /dev/null
+++ b/src/latex_output_filter.c
@@ -0,0 +1,49 @@
+/*
+ * This file is part of LaTeXila.
+ *
+ * Copyright © 2009, 2010 Sébastien Wilmet
+ *
+ * LaTeXila is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * LaTeXila is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with LaTeXila.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <locale.h>
+#include <libintl.h>
+#include <gtk/gtk.h>
+#include <gtksourceview/gtksourceview.h>
+
+#include "main.h"
+#include "print.h"
+#include "utils.h"
+
+void
+latex_output_filter (const gchar *line)
+{
+       if (line == NULL || strlen (line) == 0)
+               return;
+
+       if (g_regex_match_simple ("[^:]+:[0-9]+:.*", line, 0, 0)
+                       || g_regex_match_simple ("lines? [0-9]+", line, 0, 0)
+                       || strstr (line, "LaTeX Error")
+                       || strstr (line, "Output written on")
+                       || strstr (line, "Warning")
+                       || strstr (line, "Overfull")
+                       || strstr (line, "Underfull"))
+       {
+               print_log_add (latexila.action_log.text_view, line, FALSE);
+               flush_queue ();
+       }
+}
diff --git a/src/latex_output_filter.h b/src/latex_output_filter.h
new file mode 100644
index 0000000..797b47c
--- /dev/null
+++ b/src/latex_output_filter.h
@@ -0,0 +1,25 @@
+/*
+ * This file is part of LaTeXila.
+ *
+ * Copyright © 2009, 2010 Sébastien Wilmet
+ *
+ * LaTeXila is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * LaTeXila is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with LaTeXila.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef LATEX_OUTPUT_FILTER_H
+#define LATEX_OUTPUT_FILTER_H
+
+void latex_output_filter (const gchar *line);
+
+#endif /* LATEX_OUTPUT_FILTER_H */
diff --git a/src/main.h b/src/main.h
index 3cbd04d..75b969b 100644
--- a/src/main.h
+++ b/src/main.h
@@ -92,6 +92,8 @@ typedef struct
        gchar                                   *command_web_browser;
        gchar                                   *command_bibtex;
        gchar                                   *command_makeindex;
+       gboolean                                compile_show_all_output;
+       gboolean                                compile_non_stop;
        gchar                                   *file_chooser_dir;
        gchar                                   *file_browser_dir;
        gboolean                                file_browser_show_all_files;
diff --git a/src/prefs.c b/src/prefs.c
index ef2ae6f..6e889ce 100644
--- a/src/prefs.c
+++ b/src/prefs.c
@@ -58,6 +58,10 @@ static void cb_pref_command_dvips (GtkEditable *editable, gpointer user_data);
 static void cb_pref_web_browser (GtkEditable *editable, gpointer user_data);
 static void cb_pref_command_bibtex (GtkEditable *editable, gpointer user_data);
 static void cb_pref_command_makeindex (GtkEditable *editable, gpointer user_data);
+static void cb_pref_compile_show_all_output (GtkToggleButton *toggle_button,
+               gpointer user_data);
+static void cb_pref_compile_non_stop (GtkToggleButton *toggle_button,
+               gpointer user_data);
 static void cb_style_scheme_changed (GtkTreeSelection *selection,
                gpointer user_data);
 static void cb_delete_aux_files (GtkToggleButton *toggle_button,
@@ -89,6 +93,8 @@ static gchar  *command_dvips_                                 = COMMAND_DVIPS;
 static gchar   *command_web_browser_                   = "gnome-open";
 static gchar   *command_bibtex_                                = COMMAND_BIBTEX;
 static gchar   *command_makeindex_                             = COMMAND_MAKEINDEX;
+static gboolean        compile_show_all_output_                = FALSE;
+static gboolean compile_non_stop_                              = FALSE;
 static gboolean delete_aux_files_                              = FALSE;
 static gboolean reopen_files_on_startup_               = TRUE;
 static gboolean file_browser_show_all_files_   = FALSE;
@@ -315,6 +321,26 @@ load_preferences (preferences_t *prefs)
                error = NULL;
        }
 
+       prefs->compile_show_all_output = g_key_file_get_boolean (key_file, PROGRAM_NAME,
+                       "compile_show_all_output", &error);
+       if (error != NULL)
+       {
+               print_warning ("%s", error->message);
+               prefs->compile_show_all_output = compile_show_all_output_;
+               g_error_free (error);
+               error = NULL;
+       }
+
+       prefs->compile_non_stop = g_key_file_get_boolean (key_file, PROGRAM_NAME,
+                       "compile_non_stop", &error);
+       if (error != NULL)
+       {
+               print_warning ("%s", error->message);
+               prefs->compile_non_stop = compile_non_stop_;
+               g_error_free (error);
+               error = NULL;
+       }
+
        prefs->file_chooser_dir = g_key_file_get_string (key_file, PROGRAM_NAME,
                        "file_chooser_directory", &error);
        if (error != NULL)
@@ -357,8 +383,6 @@ load_preferences (preferences_t *prefs)
                g_strfreev (list_opened_docs);
        }
 
-       // look, I see light, we are close to the exit!
-       
        prefs->reopen_files_on_startup = g_key_file_get_boolean (key_file,
                        PROGRAM_NAME, "reopen_files_on_startup", &error);
        if (error != NULL)
@@ -409,6 +433,8 @@ load_preferences (preferences_t *prefs)
                error = NULL;
        }
 
+       // look, I see light, we are close to the exit!
+       
        prefs->spaces_instead_of_tabs = g_key_file_get_boolean (key_file,
                        PROGRAM_NAME, "spaces_instead_of_tabs", &error);
        if (error != NULL)
@@ -491,6 +517,10 @@ save_preferences (preferences_t *prefs)
                        prefs->command_bibtex);
        g_key_file_set_string (key_file, PROGRAM_NAME, "command_makeindex",
                        prefs->command_makeindex);
+       g_key_file_set_boolean (key_file, PROGRAM_NAME, "compile_show_all_output",
+                       prefs->compile_show_all_output);
+       g_key_file_set_boolean (key_file, PROGRAM_NAME, "compile_non_stop",
+                       prefs->compile_non_stop);
        if (prefs->file_chooser_dir != NULL)
                g_key_file_set_string (key_file, PROGRAM_NAME, "file_chooser_directory",
                                prefs->file_chooser_dir);
@@ -612,6 +642,8 @@ load_default_preferences (preferences_t *prefs)
        prefs->command_web_browser = g_strdup (command_web_browser_);
        prefs->command_bibtex = g_strdup (command_bibtex_);
        prefs->command_makeindex = g_strdup (command_makeindex_);
+       prefs->compile_show_all_output = compile_show_all_output_;
+       prefs->compile_non_stop = compile_non_stop_;
        prefs->file_chooser_dir = NULL;
        prefs->file_browser_dir = g_strdup (g_get_home_dir ());
        prefs->list_opened_docs = g_ptr_array_new ();
@@ -827,6 +859,21 @@ cb_pref_command_makeindex (GtkEditable *editable, gpointer user_data)
        latexila.prefs.command_makeindex = g_strdup (new_command);
 }
 
+static void
+cb_pref_compile_show_all_output (GtkToggleButton *toggle_button,
+               gpointer user_data)
+{
+       latexila.prefs.compile_show_all_output =
+               gtk_toggle_button_get_active (toggle_button);
+}
+
+static void
+cb_pref_compile_non_stop (GtkToggleButton *toggle_button, gpointer user_data)
+{
+       latexila.prefs.compile_non_stop =
+               gtk_toggle_button_get_active (toggle_button);
+}
+
 static void
 cb_style_scheme_changed (GtkTreeSelection *selection, gpointer user_data)
 {
@@ -993,236 +1040,289 @@ create_preferences (void)
        gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox_other, label_other);
 
        /* show line numbers */
-       GtkWidget *line_numbers = gtk_check_button_new_with_label (
-                       _("Display line numbers"));
-       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (line_numbers),
-                       latexila.prefs.show_line_numbers);
-       g_signal_connect (G_OBJECT (line_numbers), "toggled",
-                       G_CALLBACK (cb_pref_line_numbers), NULL);
-       gtk_box_pack_start (GTK_BOX (vbox_editor), line_numbers, FALSE, FALSE, 0);
+       {
+               GtkWidget *line_numbers = gtk_check_button_new_with_label (
+                               _("Display line numbers"));
+               gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (line_numbers),
+                               latexila.prefs.show_line_numbers);
+               g_signal_connect (G_OBJECT (line_numbers), "toggled",
+                               G_CALLBACK (cb_pref_line_numbers), NULL);
+               gtk_box_pack_start (GTK_BOX (vbox_editor), line_numbers, FALSE, FALSE, 0);
+       }
 
        /* tab width */
-       GtkWidget *hbox = gtk_hbox_new (FALSE, 5);
-       GtkWidget *label = gtk_label_new (_("Tab width:"));
-       GtkAdjustment *spinner_adj = (GtkAdjustment *) gtk_adjustment_new (
-                       (gdouble) latexila.prefs.tab_width, 1.0, 24.0, 1.0, 0.0, 0.0);
-       GtkWidget *tab_width = gtk_spin_button_new (spinner_adj, 1.0, 0);
-       g_signal_connect (G_OBJECT (tab_width), "value-changed",
-                       G_CALLBACK (cb_pref_tab_width), NULL);
-       gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
-       gtk_box_pack_start (GTK_BOX (hbox), tab_width, FALSE, FALSE, 0);
-       gtk_box_pack_start (GTK_BOX (vbox_editor), hbox, FALSE, FALSE, 0);
+       {
+               GtkWidget *hbox = gtk_hbox_new (FALSE, 5);
+               GtkWidget *label = gtk_label_new (_("Tab width:"));
+               GtkAdjustment *spinner_adj = (GtkAdjustment *) gtk_adjustment_new (
+                               (gdouble) latexila.prefs.tab_width, 1.0, 24.0, 1.0, 0.0, 0.0);
+               GtkWidget *tab_width = gtk_spin_button_new (spinner_adj, 1.0, 0);
+               g_signal_connect (G_OBJECT (tab_width), "value-changed",
+                               G_CALLBACK (cb_pref_tab_width), NULL);
+               gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+               gtk_box_pack_start (GTK_BOX (hbox), tab_width, FALSE, FALSE, 0);
+               gtk_box_pack_start (GTK_BOX (vbox_editor), hbox, FALSE, FALSE, 0);
+       }
        
        /* spaces instead of tabs */
-       GtkWidget *spaces_instead_of_tabs = gtk_check_button_new_with_label (
-                       _("Insert spaces instead of tabs"));
-       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (spaces_instead_of_tabs),
-                       latexila.prefs.spaces_instead_of_tabs);
-       g_signal_connect (G_OBJECT (spaces_instead_of_tabs), "toggled",
-                       G_CALLBACK (cb_pref_spaces_instead_of_tabs), NULL);
-       gtk_box_pack_start (GTK_BOX (vbox_editor), spaces_instead_of_tabs, FALSE,
-                       FALSE, 0);
+       {
+               GtkWidget *spaces_instead_of_tabs = gtk_check_button_new_with_label (
+                               _("Insert spaces instead of tabs"));
+               gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (spaces_instead_of_tabs),
+                               latexila.prefs.spaces_instead_of_tabs);
+               g_signal_connect (G_OBJECT (spaces_instead_of_tabs), "toggled",
+                               G_CALLBACK (cb_pref_spaces_instead_of_tabs), NULL);
+               gtk_box_pack_start (GTK_BOX (vbox_editor), spaces_instead_of_tabs, FALSE,
+                               FALSE, 0);
+       }
 
        /* highlight current line */
-       GtkWidget *highlight_current_line = gtk_check_button_new_with_label (
-                       _("Highlight current line"));
-       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (highlight_current_line),
-                       latexila.prefs.highlight_current_line);
-       g_signal_connect (G_OBJECT (highlight_current_line), "toggled",
-                       G_CALLBACK (cb_pref_highlight_current_line), NULL);
-       gtk_box_pack_start (GTK_BOX (vbox_editor), highlight_current_line, FALSE,
-                       FALSE, 0);
+       {
+               GtkWidget *highlight_current_line = gtk_check_button_new_with_label (
+                               _("Highlight current line"));
+               gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (highlight_current_line),
+                               latexila.prefs.highlight_current_line);
+               g_signal_connect (G_OBJECT (highlight_current_line), "toggled",
+                               G_CALLBACK (cb_pref_highlight_current_line), NULL);
+               gtk_box_pack_start (GTK_BOX (vbox_editor), highlight_current_line, FALSE,
+                               FALSE, 0);
+       }
 
        /* highlight matching brackets */
-       GtkWidget *highlight_matching_brackets = gtk_check_button_new_with_label (
-                       _("Highlight matching brackets"));
-       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (highlight_matching_brackets),
-                       latexila.prefs.highlight_matching_brackets);
-       g_signal_connect (G_OBJECT (highlight_matching_brackets), "toggled",
-                       G_CALLBACK (cb_pref_highlight_matching_brackets), NULL);
-       gtk_box_pack_start (GTK_BOX (vbox_editor), highlight_matching_brackets, FALSE,
-                       FALSE, 0);
+       {
+               GtkWidget *highlight_matching_brackets = gtk_check_button_new_with_label (
+                               _("Highlight matching brackets"));
+               gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (highlight_matching_brackets),
+                               latexila.prefs.highlight_matching_brackets);
+               g_signal_connect (G_OBJECT (highlight_matching_brackets), "toggled",
+                               G_CALLBACK (cb_pref_highlight_matching_brackets), NULL);
+               gtk_box_pack_start (GTK_BOX (vbox_editor), highlight_matching_brackets, FALSE,
+                               FALSE, 0);
+       }
 
        /* font */
-       hbox = gtk_hbox_new (FALSE, 5);
-       label = gtk_label_new (_("Font:"));
-       GtkWidget *font_button = gtk_font_button_new_with_font (
-                       latexila.prefs.font_str);
-       g_signal_connect (G_OBJECT (font_button), "font-set",
-                       G_CALLBACK (cb_pref_font_set), NULL);
-       gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
-       gtk_box_pack_start (GTK_BOX (hbox), font_button, FALSE, FALSE, 0);
-       gtk_box_pack_start (GTK_BOX (vbox_font_and_colors), hbox, FALSE, FALSE, 0);
+       {
+               GtkWidget *hbox = gtk_hbox_new (FALSE, 5);
+               GtkWidget *label = gtk_label_new (_("Font:"));
+               GtkWidget *font_button = gtk_font_button_new_with_font (
+                               latexila.prefs.font_str);
+               g_signal_connect (G_OBJECT (font_button), "font-set",
+                               G_CALLBACK (cb_pref_font_set), NULL);
+               gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+               gtk_box_pack_start (GTK_BOX (hbox), font_button, FALSE, FALSE, 0);
+               gtk_box_pack_start (GTK_BOX (vbox_font_and_colors), hbox, FALSE, FALSE, 0);
+       }
 
        /* style schemes */
-       GtkWidget *frame = gtk_frame_new (_("Color scheme"));
-       gtk_box_pack_start (GTK_BOX (vbox_font_and_colors), frame, FALSE, FALSE, 0);
-
-       GtkListStore *style_schemes_list_store = gtk_list_store_new (
-                       N_COLUMNS_STYLE_SCHEMES, G_TYPE_STRING, G_TYPE_STRING);
-
-       GtkWidget *style_schemes_tree_view = gtk_tree_view_new_with_model (
-                       GTK_TREE_MODEL (style_schemes_list_store));
-       gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (style_schemes_tree_view),
-                       FALSE);
-       GtkCellRenderer *renderer = gtk_cell_renderer_text_new ();
-       GtkTreeViewColumn *column = gtk_tree_view_column_new_with_attributes (
-                       "Name and description", renderer,
-                       "text", COLUMN_STYLE_SCHEME_DESC,
-                       NULL);
-       gtk_tree_view_append_column (GTK_TREE_VIEW (style_schemes_tree_view),
-                       column);
-
-       GtkTreeSelection *select = gtk_tree_view_get_selection (
-                       GTK_TREE_VIEW (style_schemes_tree_view));
-       gtk_tree_selection_set_mode (select, GTK_SELECTION_SINGLE);
-       g_signal_connect (G_OBJECT (select), "changed",
-                       G_CALLBACK (cb_style_scheme_changed), NULL);
-
-       fill_style_schemes_list_store (style_schemes_list_store, select);
-
-    gtk_container_add (GTK_CONTAINER (frame), style_schemes_tree_view);
+       {
+               GtkWidget *frame = gtk_frame_new (_("Color scheme"));
+               gtk_box_pack_start (GTK_BOX (vbox_font_and_colors), frame, FALSE, FALSE, 0);
+
+               GtkListStore *style_schemes_list_store = gtk_list_store_new (
+                               N_COLUMNS_STYLE_SCHEMES, G_TYPE_STRING, G_TYPE_STRING);
+
+               GtkWidget *style_schemes_tree_view = gtk_tree_view_new_with_model (
+                               GTK_TREE_MODEL (style_schemes_list_store));
+               gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (style_schemes_tree_view),
+                               FALSE);
+               GtkCellRenderer *renderer = gtk_cell_renderer_text_new ();
+               GtkTreeViewColumn *column = gtk_tree_view_column_new_with_attributes (
+                               "Name and description", renderer,
+                               "text", COLUMN_STYLE_SCHEME_DESC,
+                               NULL);
+               gtk_tree_view_append_column (GTK_TREE_VIEW (style_schemes_tree_view),
+                               column);
+
+               GtkTreeSelection *select = gtk_tree_view_get_selection (
+                               GTK_TREE_VIEW (style_schemes_tree_view));
+               gtk_tree_selection_set_mode (select, GTK_SELECTION_SINGLE);
+               g_signal_connect (G_OBJECT (select), "changed",
+                               G_CALLBACK (cb_style_scheme_changed), NULL);
+
+               fill_style_schemes_list_store (style_schemes_list_store, select);
+
+               gtk_container_add (GTK_CONTAINER (frame), style_schemes_tree_view);
+       }
 
        /* command view entry */
-       hbox = gtk_hbox_new (FALSE, 5);
-       label = gtk_label_new (_("Program for viewing documents:"));
-       GtkWidget *command_view_entry = gtk_entry_new ();
-       gtk_entry_set_text (GTK_ENTRY (command_view_entry),
-                       latexila.prefs.command_view);
-       g_signal_connect (G_OBJECT (command_view_entry), "changed",
-                       G_CALLBACK (cb_pref_command_view), NULL);
-       gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
-       gtk_box_pack_start (GTK_BOX (hbox), command_view_entry, FALSE, FALSE, 0);
-       gtk_box_pack_start (GTK_BOX (vbox_latex), hbox, FALSE, FALSE, 0);
+       {
+               GtkWidget *hbox = gtk_hbox_new (FALSE, 5);
+               GtkWidget *label = gtk_label_new (_("Program for viewing documents:"));
+               GtkWidget *command_view_entry = gtk_entry_new ();
+               gtk_entry_set_text (GTK_ENTRY (command_view_entry),
+                               latexila.prefs.command_view);
+               g_signal_connect (G_OBJECT (command_view_entry), "changed",
+                               G_CALLBACK (cb_pref_command_view), NULL);
+               gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+               gtk_box_pack_start (GTK_BOX (hbox), command_view_entry, FALSE, FALSE, 0);
+               gtk_box_pack_start (GTK_BOX (vbox_latex), hbox, FALSE, FALSE, 0);
+       }
 
        /* commands (latex, pdflatex, dvipdf, dvips, ...) */
-       hbox = gtk_hbox_new (FALSE, 5);
-       GtkWidget *label1 = gtk_label_new (_("latex command:"));
-       GtkWidget *command_latex = gtk_entry_new ();
-       gtk_entry_set_text (GTK_ENTRY (command_latex), latexila.prefs.command_latex);
-       g_signal_connect (G_OBJECT (command_latex), "changed",
-                       G_CALLBACK (cb_pref_command_latex), NULL);
-       gtk_box_pack_start (GTK_BOX (hbox), label1, FALSE, FALSE, 0);
-       gtk_box_pack_start (GTK_BOX (hbox), command_latex, FALSE, FALSE, 0);
-       gtk_box_pack_start (GTK_BOX (vbox_latex), hbox, FALSE, FALSE, 0);
-
-       hbox = gtk_hbox_new (FALSE, 5);
-       GtkWidget *label2 = gtk_label_new (_("pdflatex command:"));
-       GtkWidget *command_pdflatex = gtk_entry_new ();
-       gtk_entry_set_text (GTK_ENTRY (command_pdflatex), latexila.prefs.command_pdflatex);
-       g_signal_connect (G_OBJECT (command_pdflatex), "changed",
-                       G_CALLBACK (cb_pref_command_pdflatex), NULL);
-       gtk_box_pack_start (GTK_BOX (hbox), label2, FALSE, FALSE, 0);
-       gtk_box_pack_start (GTK_BOX (hbox), command_pdflatex, FALSE, FALSE, 0);
-       gtk_box_pack_start (GTK_BOX (vbox_latex), hbox, FALSE, FALSE, 0);
-
-       hbox = gtk_hbox_new (FALSE, 5);
-       GtkWidget *label3 = gtk_label_new (_("DVI to PDF command:"));
-       GtkWidget *command_dvipdf = gtk_entry_new ();
-       gtk_entry_set_text (GTK_ENTRY (command_dvipdf), latexila.prefs.command_dvipdf);
-       g_signal_connect (G_OBJECT (command_dvipdf), "changed",
-                       G_CALLBACK (cb_pref_command_dvipdf), NULL);
-       gtk_box_pack_start (GTK_BOX (hbox), label3, FALSE, FALSE, 0);
-       gtk_box_pack_start (GTK_BOX (hbox), command_dvipdf, FALSE, FALSE, 0);
-       gtk_box_pack_start (GTK_BOX (vbox_latex), hbox, FALSE, FALSE, 0);
-
-       hbox = gtk_hbox_new (FALSE, 5);
-       GtkWidget *label4 = gtk_label_new (_("DVI to PS command:"));
-       GtkWidget *command_dvips = gtk_entry_new ();
-       gtk_entry_set_text (GTK_ENTRY (command_dvips), latexila.prefs.command_dvips);
-       g_signal_connect (G_OBJECT (command_dvips), "changed",
-                       G_CALLBACK (cb_pref_command_dvips), NULL);
-       gtk_box_pack_start (GTK_BOX (hbox), label4, FALSE, FALSE, 0);
-       gtk_box_pack_start (GTK_BOX (hbox), command_dvips, FALSE, FALSE, 0);
-       gtk_box_pack_start (GTK_BOX (vbox_latex), hbox, FALSE, FALSE, 0);
-
-       hbox = gtk_hbox_new (FALSE, 5);
-       GtkWidget *label5 = gtk_label_new (_("BibTeX command:"));
-       GtkWidget *command_bibtex = gtk_entry_new ();
-       gtk_entry_set_text (GTK_ENTRY (command_bibtex), latexila.prefs.command_bibtex);
-       g_signal_connect (G_OBJECT (command_bibtex), "changed",
-                       G_CALLBACK (cb_pref_command_bibtex), NULL);
-       gtk_box_pack_start (GTK_BOX (hbox), label5, FALSE, FALSE, 0);
-       gtk_box_pack_start (GTK_BOX (hbox), command_bibtex, FALSE, FALSE, 0);
-       gtk_box_pack_start (GTK_BOX (vbox_latex), hbox, FALSE, FALSE, 0);
-
-       hbox = gtk_hbox_new (FALSE, 5);
-       GtkWidget *label6 = gtk_label_new (_("MakeIndex command:"));
-       GtkWidget *command_makeindex = gtk_entry_new ();
-       gtk_entry_set_text (GTK_ENTRY (command_makeindex), latexila.prefs.command_makeindex);
-       g_signal_connect (G_OBJECT (command_makeindex), "changed",
-                       G_CALLBACK (cb_pref_command_makeindex), NULL);
-       gtk_box_pack_start (GTK_BOX (hbox), label6, FALSE, FALSE, 0);
-       gtk_box_pack_start (GTK_BOX (hbox), command_makeindex, FALSE, FALSE, 0);
-       gtk_box_pack_start (GTK_BOX (vbox_latex), hbox, FALSE, FALSE, 0);
-
-       // set the same width for the labels
-       // the longer label is label6
-       GtkRequisition size;
-       gtk_widget_size_request (label6, &size);
-       gtk_widget_set_size_request (label1, size.width, 0);
-       gtk_widget_set_size_request (label2, size.width, 0);
-       gtk_widget_set_size_request (label3, size.width, 0);
-       gtk_widget_set_size_request (label4, size.width, 0);
-       gtk_widget_set_size_request (label5, size.width, 0);
-
-       // flush left
-       gtk_misc_set_alignment (GTK_MISC (label1), 0.0, 0.5);
-       gtk_misc_set_alignment (GTK_MISC (label2), 0.0, 0.5);
-       gtk_misc_set_alignment (GTK_MISC (label4), 0.0, 0.5);
-       gtk_misc_set_alignment (GTK_MISC (label5), 0.0, 0.5);
-       gtk_misc_set_alignment (GTK_MISC (label6), 0.0, 0.5);
+       {
+               GtkWidget *hbox = gtk_hbox_new (FALSE, 5);
+               GtkWidget *label1 = gtk_label_new (_("latex command:"));
+               GtkWidget *command_latex = gtk_entry_new ();
+               gtk_entry_set_text (GTK_ENTRY (command_latex), latexila.prefs.command_latex);
+               g_signal_connect (G_OBJECT (command_latex), "changed",
+                               G_CALLBACK (cb_pref_command_latex), NULL);
+               gtk_box_pack_start (GTK_BOX (hbox), label1, FALSE, FALSE, 0);
+               gtk_box_pack_start (GTK_BOX (hbox), command_latex, FALSE, FALSE, 0);
+               gtk_box_pack_start (GTK_BOX (vbox_latex), hbox, FALSE, FALSE, 0);
+
+               hbox = gtk_hbox_new (FALSE, 5);
+               GtkWidget *label2 = gtk_label_new (_("pdflatex command:"));
+               GtkWidget *command_pdflatex = gtk_entry_new ();
+               gtk_entry_set_text (GTK_ENTRY (command_pdflatex), latexila.prefs.command_pdflatex);
+               g_signal_connect (G_OBJECT (command_pdflatex), "changed",
+                               G_CALLBACK (cb_pref_command_pdflatex), NULL);
+               gtk_box_pack_start (GTK_BOX (hbox), label2, FALSE, FALSE, 0);
+               gtk_box_pack_start (GTK_BOX (hbox), command_pdflatex, FALSE, FALSE, 0);
+               gtk_box_pack_start (GTK_BOX (vbox_latex), hbox, FALSE, FALSE, 0);
+
+               hbox = gtk_hbox_new (FALSE, 5);
+               GtkWidget *label3 = gtk_label_new (_("DVI to PDF command:"));
+               GtkWidget *command_dvipdf = gtk_entry_new ();
+               gtk_entry_set_text (GTK_ENTRY (command_dvipdf), latexila.prefs.command_dvipdf);
+               g_signal_connect (G_OBJECT (command_dvipdf), "changed",
+                               G_CALLBACK (cb_pref_command_dvipdf), NULL);
+               gtk_box_pack_start (GTK_BOX (hbox), label3, FALSE, FALSE, 0);
+               gtk_box_pack_start (GTK_BOX (hbox), command_dvipdf, FALSE, FALSE, 0);
+               gtk_box_pack_start (GTK_BOX (vbox_latex), hbox, FALSE, FALSE, 0);
+
+               hbox = gtk_hbox_new (FALSE, 5);
+               GtkWidget *label4 = gtk_label_new (_("DVI to PS command:"));
+               GtkWidget *command_dvips = gtk_entry_new ();
+               gtk_entry_set_text (GTK_ENTRY (command_dvips), latexila.prefs.command_dvips);
+               g_signal_connect (G_OBJECT (command_dvips), "changed",
+                               G_CALLBACK (cb_pref_command_dvips), NULL);
+               gtk_box_pack_start (GTK_BOX (hbox), label4, FALSE, FALSE, 0);
+               gtk_box_pack_start (GTK_BOX (hbox), command_dvips, FALSE, FALSE, 0);
+               gtk_box_pack_start (GTK_BOX (vbox_latex), hbox, FALSE, FALSE, 0);
+
+               hbox = gtk_hbox_new (FALSE, 5);
+               GtkWidget *label5 = gtk_label_new (_("BibTeX command:"));
+               GtkWidget *command_bibtex = gtk_entry_new ();
+               gtk_entry_set_text (GTK_ENTRY (command_bibtex), latexila.prefs.command_bibtex);
+               g_signal_connect (G_OBJECT (command_bibtex), "changed",
+                               G_CALLBACK (cb_pref_command_bibtex), NULL);
+               gtk_box_pack_start (GTK_BOX (hbox), label5, FALSE, FALSE, 0);
+               gtk_box_pack_start (GTK_BOX (hbox), command_bibtex, FALSE, FALSE, 0);
+               gtk_box_pack_start (GTK_BOX (vbox_latex), hbox, FALSE, FALSE, 0);
+
+               hbox = gtk_hbox_new (FALSE, 5);
+               GtkWidget *label6 = gtk_label_new (_("MakeIndex command:"));
+               GtkWidget *command_makeindex = gtk_entry_new ();
+               gtk_entry_set_text (GTK_ENTRY (command_makeindex), latexila.prefs.command_makeindex);
+               g_signal_connect (G_OBJECT (command_makeindex), "changed",
+                               G_CALLBACK (cb_pref_command_makeindex), NULL);
+               gtk_box_pack_start (GTK_BOX (hbox), label6, FALSE, FALSE, 0);
+               gtk_box_pack_start (GTK_BOX (hbox), command_makeindex, FALSE, FALSE, 0);
+               gtk_box_pack_start (GTK_BOX (vbox_latex), hbox, FALSE, FALSE, 0);
+
+               // set the same width for the labels
+               // the longer label is label6
+               GtkRequisition size;
+               gtk_widget_size_request (label6, &size);
+               gtk_widget_set_size_request (label1, size.width, 0);
+               gtk_widget_set_size_request (label2, size.width, 0);
+               gtk_widget_set_size_request (label3, size.width, 0);
+               gtk_widget_set_size_request (label4, size.width, 0);
+               gtk_widget_set_size_request (label5, size.width, 0);
+
+               // flush left
+               gtk_misc_set_alignment (GTK_MISC (label1), 0.0, 0.5);
+               gtk_misc_set_alignment (GTK_MISC (label2), 0.0, 0.5);
+               gtk_misc_set_alignment (GTK_MISC (label4), 0.0, 0.5);
+               gtk_misc_set_alignment (GTK_MISC (label5), 0.0, 0.5);
+               gtk_misc_set_alignment (GTK_MISC (label6), 0.0, 0.5);
+       }
+
+       /* document compilation options */
+       {
+               GtkWidget *frame = gtk_frame_new (_("Document Compilation"));
+               gtk_box_pack_start (GTK_BOX (vbox_latex), frame, FALSE, FALSE, 0);
+
+               GtkWidget *vbox_compilation = gtk_vbox_new (FALSE, 3);
+               gtk_container_add (GTK_CONTAINER (frame), vbox_compilation);
+
+               // show all output
+               GtkWidget *show_all_output = gtk_check_button_new_with_label (_("Show all output"));
+               gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (show_all_output),
+                               latexila.prefs.compile_show_all_output);
+               g_signal_connect (G_OBJECT (show_all_output), "toggled",
+                               G_CALLBACK (cb_pref_compile_show_all_output), NULL);
+               gtk_box_pack_start (GTK_BOX (vbox_compilation), show_all_output, FALSE, FALSE, 0);
+
+               // non stop mode interaction
+               GtkWidget *non_stop = gtk_check_button_new_with_label ("-interaction=nonstopmode");
+               gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (non_stop),
+                               latexila.prefs.compile_non_stop);
+               g_signal_connect (G_OBJECT (non_stop), "toggled",
+                               G_CALLBACK (cb_pref_compile_non_stop), NULL);
+               gtk_box_pack_start (GTK_BOX (vbox_compilation), non_stop, FALSE, FALSE, 0);
+       }
+
 
        /* web browser */
-       hbox = gtk_hbox_new (FALSE, 5);
-       label = gtk_label_new (_("Web browser:"));
-       GtkWidget *web_browser_entry = gtk_entry_new ();
-       gtk_entry_set_text (GTK_ENTRY (web_browser_entry),
-                       latexila.prefs.command_web_browser);
-       g_signal_connect (G_OBJECT (web_browser_entry), "changed",
-                       G_CALLBACK (cb_pref_web_browser), NULL);
-       gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
-       gtk_box_pack_start (GTK_BOX (hbox), web_browser_entry, FALSE, FALSE, 0);
-       gtk_box_pack_start (GTK_BOX (vbox_other), hbox, FALSE, FALSE, 0);
+       {
+               GtkWidget *hbox = gtk_hbox_new (FALSE, 5);
+               GtkWidget *label = gtk_label_new (_("Web browser:"));
+               GtkWidget *web_browser_entry = gtk_entry_new ();
+               gtk_entry_set_text (GTK_ENTRY (web_browser_entry),
+                               latexila.prefs.command_web_browser);
+               g_signal_connect (G_OBJECT (web_browser_entry), "changed",
+                               G_CALLBACK (cb_pref_web_browser), NULL);
+               gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+               gtk_box_pack_start (GTK_BOX (hbox), web_browser_entry, FALSE, FALSE, 0);
+               gtk_box_pack_start (GTK_BOX (vbox_other), hbox, FALSE, FALSE, 0);
+       }
 
        /* reopen files on startup */
-       GtkWidget *reopen = gtk_check_button_new_with_label (
-                       _("Reopen files on startup"));
-       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (reopen),
-                       latexila.prefs.reopen_files_on_startup);
-       g_signal_connect (G_OBJECT (reopen), "toggled",
-                       G_CALLBACK (cb_reopen_files_on_startup), NULL);
-       gtk_box_pack_start (GTK_BOX (vbox_other), reopen, FALSE, FALSE, 0);
+       {
+               GtkWidget *reopen = gtk_check_button_new_with_label (
+                               _("Reopen files on startup"));
+               gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (reopen),
+                               latexila.prefs.reopen_files_on_startup);
+               g_signal_connect (G_OBJECT (reopen), "toggled",
+                               G_CALLBACK (cb_reopen_files_on_startup), NULL);
+               gtk_box_pack_start (GTK_BOX (vbox_other), reopen, FALSE, FALSE, 0);
+       }
 
        /* file browser: show all files */
-       GtkWidget *fb_show_all_files = gtk_check_button_new_with_label (
-                       _("File browser: show all files"));
-       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (fb_show_all_files),
-                       latexila.prefs.file_browser_show_all_files);
-       g_signal_connect (G_OBJECT (fb_show_all_files), "toggled",
-                       G_CALLBACK (cb_file_browser_show_all_files), NULL);
-       gtk_box_pack_start (GTK_BOX (vbox_other), fb_show_all_files, FALSE, FALSE, 0);
+       {
+               GtkWidget *fb_show_all_files = gtk_check_button_new_with_label (
+                               _("File browser: show all files"));
+               gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (fb_show_all_files),
+                               latexila.prefs.file_browser_show_all_files);
+               g_signal_connect (G_OBJECT (fb_show_all_files), "toggled",
+                               G_CALLBACK (cb_file_browser_show_all_files), NULL);
+               gtk_box_pack_start (GTK_BOX (vbox_other), fb_show_all_files, FALSE, FALSE, 0);
+       }
 
        /* delete auxiliaries files on exit */
-       GtkWidget *delete_aux_files = gtk_check_button_new_with_label (
-                       _("Clean-up build files after close (*.aux, *.log, *.out, *.toc, etc)"));
-       gtk_widget_set_tooltip_text (delete_aux_files,
-                       ".aux .bit .blg .lof .log .lot .glo .glx .gxg .gxs .idx .ilg .ind .out .url .svn 
.toc");
-       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (delete_aux_files),
-                       latexila.prefs.delete_aux_files);
-       g_signal_connect (G_OBJECT (delete_aux_files), "toggled",
-                       G_CALLBACK (cb_delete_aux_files), NULL);
-       gtk_box_pack_start (GTK_BOX (vbox_other), delete_aux_files, FALSE, FALSE, 0);
+       {
+               GtkWidget *delete_aux_files = gtk_check_button_new_with_label (
+                               _("Clean-up build files after close (*.aux, *.log, *.out, *.toc, etc)"));
+               gtk_widget_set_tooltip_text (delete_aux_files,
+                               ".aux .bit .blg .lof .log .lot .glo .glx .gxg .gxs .idx .ilg .ind .out .url 
.svn .toc");
+               gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (delete_aux_files),
+                               latexila.prefs.delete_aux_files);
+               g_signal_connect (G_OBJECT (delete_aux_files), "toggled",
+                               G_CALLBACK (cb_delete_aux_files), NULL);
+               gtk_box_pack_start (GTK_BOX (vbox_other), delete_aux_files, FALSE, FALSE, 0);
+       }
 
        /* toolbars horizontal */
-       GtkWidget *toolbars_horiz = gtk_check_button_new_with_label (
-                       _("Show the edit toolbar on the same line as the main toolbar (restart needed)"));
-       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toolbars_horiz),
-                       latexila.prefs.toolbars_horizontal);
-       g_signal_connect (G_OBJECT (toolbars_horiz), "toggled",
-                       G_CALLBACK (cb_toolbars_horizontal), NULL);
-       gtk_box_pack_start (GTK_BOX (vbox_other), toolbars_horiz, FALSE, FALSE, 0);
-
+       {
+               GtkWidget *toolbars_horiz = gtk_check_button_new_with_label (
+                               _("Show the edit toolbar on the same line as the main toolbar (restart 
needed)"));
+               gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toolbars_horiz),
+                               latexila.prefs.toolbars_horizontal);
+               g_signal_connect (G_OBJECT (toolbars_horiz), "toggled",
+                               G_CALLBACK (cb_toolbars_horizontal), NULL);
+               gtk_box_pack_start (GTK_BOX (vbox_other), toolbars_horiz, FALSE, FALSE, 0);
+       }
 
        gtk_widget_show_all (content_area);
 }



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