src/Builder4/WindowRooView.bjs
authorAlan Knowles <alan@roojs.com>
Tue, 7 Jun 2016 07:43:00 +0000 (15:43 +0800)
committerAlan Knowles <alan@roojs.com>
Tue, 7 Jun 2016 07:43:00 +0000 (15:43 +0800)
src/Builder4/WindowRooView.vala

src/Builder4/WindowRooView.bjs
src/Builder4/WindowRooView.vala

index 07ddd92..81b962c 100644 (file)
            "id" : "buffer",
            "int error_line" : "-1",
            "|   string toString" : "  () {\n    \n    Gtk.TextIter s;\n    Gtk.TextIter e;\n    this.el.get_start_iter(out s);\n    this.el.get_end_iter(out e);\n    var ret = this.el.get_text(s,e,true);\n    //print(\"TO STRING? \" + ret);\n    return ret;\n}\n ",
-           "|   bool checkSyntax" : " () {\n \n    if (this.check_running) {\n        print(\"Check is running\\n\");\n        if (this.check_queued) { \n            print(\"Check is already queued\");\n            return true;\n        }\n        this.check_queued = true;\n        print(\"Adding queued Check \");\n        GLib.Timeout.add_seconds(1, () => {\n            this.check_queued = false;\n            \n            this.checkSyntax();\n            return false;\n        });\n    \n\n        return true;\n    }\n    var str = this.toString();\n    \n    // needed???\n    if (this.error_line > 0) {\n         Gtk.TextIter start;\n         Gtk.TextIter end;     \n        this.el.get_bounds (out start, out end);\n\n        this.el.remove_source_marks (start, end, null);\n    }\n    if (str.length < 1) {\n        print(\"checkSyntax - empty string?\\n\");\n        return true;\n    }\n    \n    if (_this.file.xtype == \"PlainFile\") {\n    \n        // assume it's gtk...\n           this.check_running = true;\n /*\n         if (!_this.window.windowstate.valasource.checkPlainFileSpawn(\n\t   _this.file,\n\t    str\n\t )) {\n            this.check_running = false;\n        }\n\t*/\n        return true;\n    \n    }\n   if (_this.file == null) {\n       return true;\n   }\n    var p = Palete.factory(_this.file.xtype);   \n    \n\n     \n    this.check_running = true;\n    \n    \n    if (_this.file.language == \"js\") {\n        this.check_running = false;\n        print(\"calling validate javascript\\n\"); \n      /*  return this.highlightErrors(p.validateJavascript(\n            str, \n             _this.key, \n            _this.ptype,\n            _this.file,\n            _this.node\n        ));    \n        */\n    }\n        \n        \n    print(\"calling validate vala\\n\");    \n    // clear the buttons.\n \n    /*\n   if (! _this.window.windowstate.valasource.checkFileWithNodePropChange(\n        _this.file,\n        _this.node,\n         _this.key,        \n         _this.ptype,\n            str\n        )) {\n        this.check_running = false;\n    } \n     \n    */\n    \n    //print(\"done mark line\\n\");\n     \n    return true; // at present allow saving - even if it's invalid..\n}\n",
+           "|   bool checkSyntax" : " () {\n \n   \n    var str = this.toString();\n    \n    // needed???\n    if (this.error_line > 0) {\n         Gtk.TextIter start;\n         Gtk.TextIter end;     \n        this.el.get_bounds (out start, out end);\n\n        this.el.remove_source_marks (start, end, null);\n    }\n    \n    if (str.length < 1) {\n        print(\"checkSyntax - empty string?\\n\");\n        return true;\n    }\n    \n   if (_this.file == null) {\n       return true;\n   }\n    var p = Palete.factory(_this.file.xtype);   \n    \n\n     \n    this.check_running = true;\n    \n    \n    if (_this.file.language == \"js\") {\n        \n        print(\"calling validate javascript\\n\"); \n  \t\treturn this.highlightErrors(p.validateJavascript(\n            str, \n             _this.key, \n            _this.ptype,\n            _this.file,\n            _this.node\n        ));    \n        \n    }\n        \n        \n    print(\"calling validate vala\\n\");    \n    // clear the buttons.\n \n    /*\n   if (! _this.window.windowstate.valasource.checkFileWithNodePropChange(\n        _this.file,\n        _this.node,\n         _this.key,        \n         _this.ptype,\n            str\n        )) {\n        this.check_running = false;\n    } \n     \n    */\n    \n    //print(\"done mark line\\n\");\n     \n    return true; // at present allow saving - even if it's invalid..\n}\n",
            "* pack" : "set_buffer",
            "xtype" : "SourceBuffer",
            "$ xns" : "Gtk"
index 880316c..d363723 100644 (file)
@@ -1396,24 +1396,7 @@ public class Xcls_WindowRooView : Object
         }
         public   bool checkSyntax () {
          
-            if (this.check_running) {
-                print("Check is running\n");
-                if (this.check_queued) { 
-                    print("Check is already queued");
-                    return true;
-                }
-                this.check_queued = true;
-                print("Adding queued Check ");
-                GLib.Timeout.add_seconds(1, () => {
-                    this.check_queued = false;
-                    
-                    this.checkSyntax();
-                    return false;
-                });
-            
-        
-                return true;
-            }
+           
             var str = this.toString();
             
             // needed???
@@ -1424,26 +1407,12 @@ public class Xcls_WindowRooView : Object
         
                 this.el.remove_source_marks (start, end, null);
             }
+            
             if (str.length < 1) {
                 print("checkSyntax - empty string?\n");
                 return true;
             }
             
-            if (_this.file.xtype == "PlainFile") {
-            
-                // assume it's gtk...
-                   this.check_running = true;
-         /*
-                 if (!_this.window.windowstate.valasource.checkPlainFileSpawn(
-                  _this.file,
-                   str
-                )) {
-                    this.check_running = false;
-                }
-               */
-                return true;
-            
-            }
            if (_this.file == null) {
                return true;
            }
@@ -1455,16 +1424,16 @@ public class Xcls_WindowRooView : Object
             
             
             if (_this.file.language == "js") {
-                this.check_running = false;
+                
                 print("calling validate javascript\n"); 
-              /*  return this.highlightErrors(p.validateJavascript(
+                       return this.highlightErrors(p.validateJavascript(
                     str, 
                      _this.key, 
                     _this.ptype,
                     _this.file,
                     _this.node
                 ));    
-                */
+                
             }