src/Builder4/ValaCompileErrors.bjs
authorAlan Knowles <alan@roojs.com>
Mon, 18 May 2015 02:17:41 +0000 (10:17 +0800)
committerAlan Knowles <alan@roojs.com>
Mon, 18 May 2015 02:17:41 +0000 (10:17 +0800)
src/Builder4/ValaCompileErrors.vala

src/Builder4/ValaCompileErrors.bjs
src/Builder4/ValaCompileErrors.vala

index 1e4f57b..fe42ce1 100644 (file)
@@ -21,8 +21,8 @@
    "items" : [
     {
      "id" : "compile_view",
-     "* pack" : "add",
      "xtype" : "VBox",
+     "* pack" : "add",
      "gboolean homogeneous" : false,
      "$ xns" : "Gtk",
      "items" : [
       },
       {
        "id" : "hpane",
-       "* pack" : "pack_start,true,true,0",
        "xtype" : "HPaned",
+       "* pack" : "pack_start,true,true,0",
        "$ xns" : "Gtk",
        "items" : [
         {
          "* init" : "{\n this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n \n\n}\n",
-         "xtype" : "ScrolledWindow",
          "* pack" : "add",
+         "xtype" : "ScrolledWindow",
          "$ xns" : "Gtk",
          "items" : [
           {
@@ -79,8 +79,8 @@
              "items" : [
               {
                "id" : "renderer",
-               "* pack" : "pack_start,true",
                "xtype" : "CellRendererText",
+               "* pack" : "pack_start,true",
                "$ xns" : "Gtk"
               }
              ]
@@ -97,7 +97,7 @@
           {
            "gboolean show_line_marks" : true,
            "id" : "sourceview",
-           "* init" : "{\n    this.curfname = \"\";\n}\n",
+           "* init" : "{\n    this.curfname = \"\";\n       var description =   Pango.FontDescription.from_string(\"monospace\");\n    description.set_size(8000);\n    this.el.override_font(description);\n\n    var attrs = new Gtk.SourceMarkAttributes();\n    var  pink = new Gdk.RGBA();\n    pink.parse ( \"pink\");\n    attrs.set_background ( pink);\n    attrs.set_icon_name ( \"process-stop\");    \n    attrs.query_tooltip_text.connect(( mark) => {\n        //print(\"tooltip query? %s\\n\", mark.name);\n        return mark.name;\n    });\n    \n    this.el.set_mark_attributes (\"error\", attrs, 1);\n    \n}\n",
            "| void loadFile" : "(string fname, int line ) {\n  var buf = ((Gtk.SourceBuffer)(this.el.get_buffer()));\n      \n    if (this.curfname != fname) {\n        this.curfname = fname;\n\n        Gtk.TextIter start;\n        Gtk.TextIter end;     \n        buf.get_bounds (out start, out end);\n            \n        buf.remove_source_marks (start, end, null);\n             \n         \n        \n        string str;\n        FileUtils.get_contents(fname, out str);\n\t\t\t\n        buf.set_text(str, str.length);\n        var lm = Gtk.SourceLanguageManager.get_default();\n        \n       \n        buf.set_language(lm.get_language(\"vala\"));\n     \n         \n        this.el.grab_focus();\n\n\n       \n        var lines = _this.notices.get_object_member(fname);\n         \n            \n        lines.foreach_member((obj, line, node) => {\n            \n                 Gtk.TextIter iter;\n        //        print(\"get inter\\n\");\n                var eline = int.parse(line);\n                 \n                \n                buf.get_iter_at_line( out iter, eline);\n                //print(\"mark line\\n\");\n                var msg  = \"Line: %d\".printf(eline+1);\n                var ar = lines.get_array_member(line);\n                for (var i = 0 ; i < ar.get_length(); i++) {\n\t\t        msg += (msg.length > 0) ? \"\\n\" : \"\";\n\t\t        msg += ar.get_string_element(i);\n\t        }\n                \n                \n                buf.create_source_mark(msg, \"error\", iter);\n            } );\n    }\n    // jump to the line...\n    Gtk.TextIter liter;\n    buf.get_iter_at_line (out liter,  line);\n    print(\"Scroll to \\n\");\n    this.el.scroll_to_iter (liter, 0.0f, false, 0.0f, 0.5f);\n    print(\"End Scroll to \\n\");\n\n\n}\n",
            "* pack" : "add",
            "xtype" : "SourceView",
index c1e1702..3c0e33d 100644 (file)
@@ -440,6 +440,22 @@ public class Xcls_ValaCompileErrors : Object
 
             {
                 this.curfname = "";
+                   var description =   Pango.FontDescription.from_string("monospace");
+                description.set_size(8000);
+                this.el.override_font(description);
+            
+                var attrs = new Gtk.SourceMarkAttributes();
+                var  pink = new Gdk.RGBA();
+                pink.parse ( "pink");
+                attrs.set_background ( pink);
+                attrs.set_icon_name ( "process-stop");    
+                attrs.query_tooltip_text.connect(( mark) => {
+                    //print("tooltip query? %s\n", mark.name);
+                    return mark.name;
+                });
+                
+                this.el.set_mark_attributes ("error", attrs, 1);
+                
             }
         }