src/Builder4/ValaCompileErrors.bjs
authorAlan Knowles <alan@roojs.com>
Tue, 19 May 2015 09:24:45 +0000 (17:24 +0800)
committerAlan Knowles <alan@roojs.com>
Tue, 19 May 2015 09:24:45 +0000 (17:24 +0800)
src/Builder4/ValaCompileErrors.vala

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

index 188e7e6..503c867 100644 (file)
          ]
         }
        ]
-      },
-      {
-       "id" : "hpane",
-       "xtype" : "HPaned",
-       "* pack" : "pack_start,true,true,0",
-       "$ xns" : "Gtk",
-       "items" : [
-        {
-         "xtype" : "ScrolledWindow",
-         "* pack" : "add",
-         "$ xns" : "Gtk",
-         "items" : [
-          {
-           "gboolean show_line_marks" : true,
-           "id" : "sourceview",
-           "* 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\n    \n    // resize the view...\n    \n    \n    //if (_this.hpane.el.get_position() < 1) {\n        // left tree = 250, editor area = 500?\n         int w,h;\n        _this.window.el.get_size(out w, out h);\n        \n        var new_w = int.min(750, w-100);\n        if (new_w > (w-100)) {\n            new_w = w-100;\n        }\n        _this.el.set_size_request( int.max(100, new_w), int.max(100, h-120));\n        \n        // let it resize, then find out the new size..\n        while(Gtk.events_pending()) { \n            Gtk.main_iteration();\n        }\n        \n        _this.hpane.el.set_position( _this.hpane.el.max_position - 250);\n\n    //}\n\n    var buf = ((Gtk.SourceBuffer)(this.el.get_buffer()));\n      \n    if (this.curfname != fname) {\n        this.curfname = fname;\n        \n        \n        Regex regex = new Regex(\"\\\\.vala$\");\n\n        var bjsf = regex.replace(fname,fname.length , 0 , \".bjs\");\n        \n        var p = _this.window.project;\n        \n        var jsr = p.getByPath(bjsf);\n        \n        if (_this.file != null) {\n            // remove listeners from the file...\n        }\n        \n        _this.file = null;\n        \n        if (jsr != null) {\n            _this.file = jsr;\n            \n           // return;\n        \n        }\n        \n        \n        \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) -1 ;\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",
-           "$ xns" : "Gtk",
-           "gboolean show_line_numbers" : true,
-           "string curfname" : "",
-           "gboolean editable" : false
-          }
-         ]
-        },
-        {
-         "* init" : "{\n this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n \n\n}\n",
-         "* pack" : "add",
-         "xtype" : "ScrolledWindow",
-         "$ xns" : "Gtk",
-         "items" : [
-          {
-           "listeners" : {
-            "cursor_changed" : "() => {\n    var sel = this.el.get_selection();\n\n    if (sel.count_selected_rows() < 1) {\n\n        print(\"selected rows < 1\\n\");\n        //??this.mo \n        return  ;\n    }\n        \n        //console.log('changed');\n     \n     Gtk.TreeIter iter;\n     Gtk.TreeModel mod;\n    sel.get_selected(out mod, out iter);\n    /*\n     store.set(citer, \n            0, file + \":\" + line, \n            1, int.parse(line), \n            2, GLib.Markup.escape_text(line + \": \" + msg), \n            3, file,-1);\n    \n    });\n    */\n    \n    \n    \n    // var val = \"\";\n    GLib.Value value;\n    _this.compile_result_store.el.get_value(iter, 3, out value);\n    var fname = (string)value;\n    GLib.Value lvalue;\n    _this.compile_result_store.el.get_value(iter, 1, out lvalue);\n    var line = (int) lvalue;\n    \n    \n    \n \n    \n    \n    print (\"loadfile %s : %d\", fname,line);\n    \n    _this.sourceview.loadFile(fname, line);\n    \n    \n            \n            \n}\n             "
-           },
-           "id" : "compile_tree",
-           "* init" : "{\n var description = new Pango.FontDescription();\n    description.set_size(8000);\n    this.el.modify_font(description);\n\n}\n",
-           "* pack" : "add",
-           "xtype" : "TreeView",
-           "$ xns" : "Gtk",
-           "items" : [
-            {
-             "gint n_columns" : 4,
-             "id" : "compile_result_store",
-             "columns" : "  typeof(string), typeof(int), typeof(string), typeof(string) ",
-             "* pack" : "set_model",
-             "xtype" : "TreeStore",
-             "$ xns" : "Gtk"
-            },
-            {
-             "utf8 title" : "Compile output",
-             "* init" : "{\n  this.el.add_attribute(_this.renderer.el , \"markup\", 2 );\n \n}\n",
-             "xtype" : "TreeViewColumn",
-             "* pack" : "append_column",
-             "string id" : "column",
-             "$ xns" : "Gtk",
-             "items" : [
-              {
-               "id" : "renderer",
-               "xtype" : "CellRendererText",
-               "* pack" : "pack_start,true",
-               "$ xns" : "Gtk"
-              }
-             ]
-            }
-           ]
-          }
-         ]
-        }
-       ]
       }
      ]
     }
index a5c6224..52fac19 100644 (file)
@@ -16,11 +16,6 @@ public class Xcls_ValaCompileErrors : Object
     public Xcls_save_btn save_btn;
     public Xcls_compile_tree compile_tree;
     public Xcls_compile_result_store compile_result_store;
-    public Xcls_renderer renderer;
-    public Xcls_hpane hpane;
-    public Xcls_sourceview sourceview;
-    public Xcls_compile_tree compile_tree;
-    public Xcls_compile_result_store compile_result_store;
     public Xcls_renderer renderer;
 
         // my vars (def)
@@ -153,9 +148,6 @@ public class Xcls_ValaCompileErrors : Object
             var child_1 = new Xcls_ScrolledWindow7( _this );
             child_1.ref();
             this.el.add (  child_1.el  );
-            var child_2 = new Xcls_hpane( _this );
-            child_2.ref();
-            this.el.pack_start (  child_2.el , true,true,0 );
         }
 
         // user defined functions
@@ -487,418 +479,5 @@ public class Xcls_ValaCompileErrors : Object
 
 
 
-    public class Xcls_hpane : Object
-    {
-        public Gtk.HPaned el;
-        private Xcls_ValaCompileErrors  _this;
-
-
-            // my vars (def)
-
-        // ctor
-        public Xcls_hpane(Xcls_ValaCompileErrors _owner )
-        {
-            _this = _owner;
-            _this.hpane = this;
-            this.el = new Gtk.HPaned();
-
-            // my vars (dec)
-
-            // set gobject values
-            var child_0 = new Xcls_ScrolledWindow13( _this );
-            child_0.ref();
-            this.el.add (  child_0.el  );
-            var child_1 = new Xcls_ScrolledWindow15( _this );
-            child_1.ref();
-            this.el.add (  child_1.el  );
-        }
-
-        // user defined functions
-    }
-    public class Xcls_ScrolledWindow13 : Object
-    {
-        public Gtk.ScrolledWindow el;
-        private Xcls_ValaCompileErrors  _this;
-
-
-            // my vars (def)
-
-        // ctor
-        public Xcls_ScrolledWindow13(Xcls_ValaCompileErrors _owner )
-        {
-            _this = _owner;
-            this.el = new Gtk.ScrolledWindow( null, null );
-
-            // my vars (dec)
-
-            // set gobject values
-            var child_0 = new Xcls_sourceview( _this );
-            child_0.ref();
-            this.el.add (  child_0.el  );
-        }
-
-        // user defined functions
-    }
-    public class Xcls_sourceview : Object
-    {
-        public Gtk.SourceView el;
-        private Xcls_ValaCompileErrors  _this;
-
-
-            // my vars (def)
-        public string curfname;
-
-        // ctor
-        public Xcls_sourceview(Xcls_ValaCompileErrors _owner )
-        {
-            _this = _owner;
-            _this.sourceview = this;
-            this.el = new Gtk.SourceView();
-
-            // my vars (dec)
-
-            // set gobject values
-            this.el.editable = false;
-            this.el.show_line_marks = true;
-            this.el.show_line_numbers = true;
-
-            // init method
-
-            {
-                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);
-                
-            }
-        }
-
-        // user defined functions
-        public void loadFile (string fname, int line ) {
-        
-            
-            // resize the view...
-            
-            
-            //if (_this.hpane.el.get_position() < 1) {
-                // left tree = 250, editor area = 500?
-                 int w,h;
-                _this.window.el.get_size(out w, out h);
-                
-                var new_w = int.min(750, w-100);
-                if (new_w > (w-100)) {
-                    new_w = w-100;
-                }
-                _this.el.set_size_request( int.max(100, new_w), int.max(100, h-120));
-                
-                // let it resize, then find out the new size..
-                while(Gtk.events_pending()) { 
-                    Gtk.main_iteration();
-                }
-                
-                _this.hpane.el.set_position( _this.hpane.el.max_position - 250);
-        
-            //}
-        
-            var buf = ((Gtk.SourceBuffer)(this.el.get_buffer()));
-              
-            if (this.curfname != fname) {
-                this.curfname = fname;
-                
-                
-                Regex regex = new Regex("\\.vala$");
-        
-                var bjsf = regex.replace(fname,fname.length , 0 , ".bjs");
-                
-                var p = _this.window.project;
-                
-                var jsr = p.getByPath(bjsf);
-                
-                if (_this.file != null) {
-                    // remove listeners from the file...
-                }
-                
-                _this.file = null;
-                
-                if (jsr != null) {
-                    _this.file = jsr;
-                    
-                   // return;
-                
-                }
-                
-                
-                
-        
-                Gtk.TextIter start;
-                Gtk.TextIter end;     
-                buf.get_bounds (out start, out end);
-                    
-                buf.remove_source_marks (start, end, null);
-                     
-                 
-                
-                string str;
-                FileUtils.get_contents(fname, out str);
-                               
-                buf.set_text(str, str.length);
-                var lm = Gtk.SourceLanguageManager.get_default();
-                
-               
-                buf.set_language(lm.get_language("vala"));
-             
-                 
-                this.el.grab_focus();
-        
-        
-               
-                var lines = _this.notices.get_object_member(fname);
-                 
-                    
-                lines.foreach_member((obj, line, node) => {
-                    
-                         Gtk.TextIter iter;
-                //        print("get inter\n");
-                        var eline = int.parse(line) -1 ;
-                         
-                        
-                        buf.get_iter_at_line( out iter, eline);
-                        //print("mark line\n");
-                        var msg  = "Line: %d".printf(eline+1);
-                        var ar = lines.get_array_member(line);
-                        for (var i = 0 ; i < ar.get_length(); i++) {
-                               msg += (msg.length > 0) ? "\n" : "";
-                               msg += ar.get_string_element(i);
-                       }
-                        
-                        
-                        buf.create_source_mark(msg, "error", iter);
-                    } );
-            }
-            // jump to the line...
-            Gtk.TextIter liter;
-            buf.get_iter_at_line (out liter,  line);
-            print("Scroll to \n");
-            this.el.scroll_to_iter (liter, 0.0f, false, 0.0f, 0.5f);
-            print("End Scroll to \n");
-        
-        
-        }
-    }
-
-
-    public class Xcls_ScrolledWindow15 : Object
-    {
-        public Gtk.ScrolledWindow el;
-        private Xcls_ValaCompileErrors  _this;
-
-
-            // my vars (def)
-
-        // ctor
-        public Xcls_ScrolledWindow15(Xcls_ValaCompileErrors _owner )
-        {
-            _this = _owner;
-            this.el = new Gtk.ScrolledWindow( null, null );
-
-            // my vars (dec)
-
-            // set gobject values
-            var child_0 = new Xcls_compile_tree( _this );
-            child_0.ref();
-            this.el.add (  child_0.el  );
-
-            // init method
-
-            {
-             this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
-             
-            
-            }
-        }
-
-        // user defined functions
-    }
-    public class Xcls_compile_tree : Object
-    {
-        public Gtk.TreeView el;
-        private Xcls_ValaCompileErrors  _this;
-
-
-            // my vars (def)
-
-        // ctor
-        public Xcls_compile_tree(Xcls_ValaCompileErrors _owner )
-        {
-            _this = _owner;
-            _this.compile_tree = this;
-            this.el = new Gtk.TreeView();
-
-            // my vars (dec)
-
-            // set gobject values
-            var child_0 = new Xcls_compile_result_store( _this );
-            child_0.ref();
-            this.el.set_model (  child_0.el  );
-            var child_1 = new Xcls_column( _this );
-            child_1.ref();
-            this.el.append_column (  child_1.el  );
-
-            // init method
-
-            {
-             var description = new Pango.FontDescription();
-                description.set_size(8000);
-                this.el.modify_font(description);
-            
-            }
-
-            //listeners
-            this.el.cursor_changed.connect( () => {
-                var sel = this.el.get_selection();
-            
-                if (sel.count_selected_rows() < 1) {
-            
-                    print("selected rows < 1\n");
-                    //??this.mo 
-                    return  ;
-                }
-                    
-                    //console.log('changed');
-                 
-                 Gtk.TreeIter iter;
-                 Gtk.TreeModel mod;
-                sel.get_selected(out mod, out iter);
-                /*
-                 store.set(citer, 
-                        0, file + ":" + line, 
-                        1, int.parse(line), 
-                        2, GLib.Markup.escape_text(line + ": " + msg), 
-                        3, file,-1);
-                
-                });
-                */
-                
-                
-                
-                // var val = "";
-                GLib.Value value;
-                _this.compile_result_store.el.get_value(iter, 3, out value);
-                var fname = (string)value;
-                GLib.Value lvalue;
-                _this.compile_result_store.el.get_value(iter, 1, out lvalue);
-                var line = (int) lvalue;
-                
-                
-                
-             
-                
-                
-                print ("loadfile %s : %d", fname,line);
-                
-                _this.sourceview.loadFile(fname, line);
-                
-                
-                        
-                        
-            });
-        }
-
-        // user defined functions
-    }
-    public class Xcls_compile_result_store : Object
-    {
-        public Gtk.TreeStore el;
-        private Xcls_ValaCompileErrors  _this;
-
-
-            // my vars (def)
-
-        // ctor
-        public Xcls_compile_result_store(Xcls_ValaCompileErrors _owner )
-        {
-            _this = _owner;
-            _this.compile_result_store = this;
-            this.el = new Gtk.TreeStore( 4,   typeof(string), typeof(int), typeof(string), typeof(string)  );
-
-            // my vars (dec)
-
-            // set gobject values
-        }
-
-        // user defined functions
-    }
-
-    public class Xcls_column : Object
-    {
-        public Gtk.TreeViewColumn el;
-        private Xcls_ValaCompileErrors  _this;
-
-
-            // my vars (def)
-
-        // ctor
-        public Xcls_column(Xcls_ValaCompileErrors _owner )
-        {
-            _this = _owner;
-            this.el = new Gtk.TreeViewColumn();
-
-            // my vars (dec)
-
-            // set gobject values
-            this.el.title = "Compile output";
-            var child_0 = new Xcls_renderer( _this );
-            child_0.ref();
-            this.el.pack_start (  child_0.el , true );
-
-            // init method
-
-            {
-              this.el.add_attribute(_this.renderer.el , "markup", 2 );
-             
-            }
-        }
-
-        // user defined functions
-    }
-    public class Xcls_renderer : Object
-    {
-        public Gtk.CellRendererText el;
-        private Xcls_ValaCompileErrors  _this;
-
-
-            // my vars (def)
-
-        // ctor
-        public Xcls_renderer(Xcls_ValaCompileErrors _owner )
-        {
-            _this = _owner;
-            _this.renderer = this;
-            this.el = new Gtk.CellRendererText();
-
-            // my vars (dec)
-
-            // set gobject values
-        }
-
-        // user defined functions
-    }
-
-
-
-
-
 
 }