[latexila] Latexmk pp: don't expand all messages in build view



commit 20cb1fb3b5c3058237d5425ab43d62fdd7d11734
Author: SÃbastien Wilmet <swilmet src gnome org>
Date:   Sun Jul 31 18:10:21 2011 +0200

    Latexmk pp: don't expand all messages in build view
    
    When the execution of the build tool is finished, we see an overview of
    what Latexmk have executed. Only the last latex command is expanded,
    because it's generally the most interesting stuff.

 src/build_view.vala      |   22 ++++++++++++++++------
 src/post_processors.vala |    7 +++++++
 2 files changed, 23 insertions(+), 6 deletions(-)
---
diff --git a/src/build_view.vala b/src/build_view.vala
index 8e2698c..2eb7d47 100644
--- a/src/build_view.vala
+++ b/src/build_view.vala
@@ -46,6 +46,9 @@ public struct BuildMsg
 
     // if -1, takes the same value as start_line
     public int end_line;
+
+    // if the message have children, show them?
+    public bool expand;
 }
 
 public class BuildView : HBox
@@ -261,7 +264,7 @@ public class BuildView : HBox
             BuildInfo.WEIGHT,       bold ? 800 : 400,
             -1);
 
-        _view.expand_all ();
+        _view.expand_to_path (_store.get_path (iter));
 
         return iter;
     }
@@ -271,24 +274,31 @@ public class BuildView : HBox
         _store.set (partition_id, BuildInfo.ICON, get_icon_from_state (state), -1);
     }
 
-    public void append_messages (TreeIter partition_id, Node<BuildMsg?> messages)
+    public void append_messages (TreeIter parent, Node<BuildMsg?> messages,
+        bool parent_is_partition = true)
     {
         unowned Node<BuildMsg?> cur_node = messages.first_child ();
         while (cur_node != null)
         {
-            TreeIter iter = append_single_message (partition_id, cur_node.data);
+            TreeIter child = append_single_message (parent, cur_node.data);
 
             // the node contains children
             if (cur_node.children != null)
             {
-                _store.set (iter, BuildInfo.ICON, "completion_choice", -1);
-                append_messages (iter, cur_node);
+                _store.set (child, BuildInfo.ICON, "completion_choice", -1);
+                append_messages (child, cur_node, false);
+
+                if (cur_node.data.expand)
+                    _view.expand_to_path (_store.get_path (child));
             }
 
             cur_node = cur_node.next_sibling ();
         }
 
-        _view.expand_all ();
+        // All partitions are expanded, but we must do that when the partition have
+        // children.
+        if (parent_is_partition)
+            _view.expand_row (_store.get_path (parent), false);
     }
 
     public TreeIter append_single_message (TreeIter partition_id, BuildMsg message)
diff --git a/src/post_processors.vala b/src/post_processors.vala
index 76ef613..9c4358d 100644
--- a/src/post_processors.vala
+++ b/src/post_processors.vala
@@ -249,6 +249,10 @@ private class LatexmkPostProcessor : PostProcessor
             title_msg.lines_set = false;
             title_msg.text = match_info.fetch_named ("title");
 
+            // Do not expand the row, so the user have first a global view of what have
+            // been executed.
+            title_msg.expand = false;
+
             cmd_messages.data = title_msg;
 
             /* command line */
@@ -307,6 +311,9 @@ private class LatexmkPostProcessor : PostProcessor
                 // take the title
                 latex_messages.data = last_latex_node.data;
 
+                // expand only the last latex command
+                latex_messages.data.expand = true;
+
                 // take the command line
                 latex_messages.insert (0, last_latex_node.first_child ().unlink ());
 



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