From c8835ec1d01a404ac4ae4ddcdc0f8b4d5ddfa335 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Wed, 27 May 2015 16:42:46 +0800 Subject: [PATCH] src/Builder4/Editor.bjs src/Builder4/Editor.vala --- src/Builder4/Editor.bjs | 5 ++--- src/Builder4/Editor.vala | 6 ++---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/Builder4/Editor.bjs b/src/Builder4/Editor.bjs index f46b9f38c..d2eb86a03 100644 --- a/src/Builder4/Editor.bjs +++ b/src/Builder4/Editor.bjs @@ -14,11 +14,10 @@ "# int pos_root_x" : "", "# int pos_root_y" : "", "# string ptype" : "\"\"", - "# string fname" : "\"\"", "# string key" : "\"\"", "* pack" : "add", "xtype" : "Box", - "| void show" : "(JsRender.JsRender file, JsRender.Node? node, string ptype, string key)\n{\n this.file = file; \n this.ptype = \"\";\n this.key = \"\";\n this.node = null;\n\n \n if (file.xtype != \"PlainFile\") {\n \n this.ptype = ptype;\n this.key = key;\n this.node = node;\n string val = \"\";\n // find the text for the node..\n if (ptype == \"listener\") {\n val = node.listeners.get(key);\n \n } else {\n val = node.props.get(key);\n }\n this.view.load(val);\n\n \n } else {\n this.view.load( file.toSource() );\n\n }\n this.key_edit.el.text = key; \n \n}", + "| void show" : "(JsRender.JsRender file, JsRender.Node? node, string ptype, string key)\n{\n this.file = file; \n this.ptype = \"\";\n this.key = \"\";\n this.node = null;\n\n \n if (file.xtype != \"PlainFile\") {\n \n this.ptype = ptype;\n this.key = key;\n this.node = node;\n string val = \"\";\n // find the text for the node..\n if (ptype == \"listener\") {\n val = node.listeners.get(key);\n \n } else {\n val = node.props.get(key);\n }\n this.view.load(val);\n\n \n } else {\n this.view.load( file.toSource() );\n\n }\n this.key_edit.el.text = key; \n \n}", "# JsRender.JsRender file" : "null", "# bool pos" : false, "string id" : "Editor", @@ -92,7 +91,7 @@ "xtype" : "SourceBuffer", "bool check_running" : false, "$ xns" : "Gtk", - "| bool highlightErrorsJson" : "(string type, Json.Object obj) {\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, type);\n \n \n // we should highlight other types of errors..\n \n if (!obj.has_member(type)) {\n print(\"Return has no errors\\n\");\n return true;\n }\n \n if (_this.window.windowstate.state != WindowState.State.CODEONLY && \n _this.window.windowstate.state != WindowState.State.CODE\n ) {\n return true;\n } \n \n \n var err = obj.get_object_member(type);\n var valafn = _this.fname;\n if (_this.file.xtype != \"PlainFile\") {\n\n\n \n \n valafn = \"\";\n try { \n var regex = new Regex(\"\\\\.bjs$\");\n \n \n valafn = regex.replace(_this.file.path,_this.file.path.length , 0 , \".vala\");\n } catch (GLib.RegexError e) {\n return true;\n } \n\n\n\n }\n if (!err.has_member(valafn)) {\n print(\"File path has no errors\\n\");\n return true;\n }\n\n var lines = err.get_object_member(valafn);\n \n var offset = 1;\n if (obj.has_member(\"line_offset\")) {\n offset = (int)obj.get_int_member(\"line_offset\") + 1;\n }\n \n\n \n \n var tlines = this.el.get_line_count () +1;\n \n lines.foreach_member((obj, line, node) => {\n \n Gtk.TextIter iter;\n // print(\"get inter\\n\");\n var eline = int.parse(line) - offset;\n print(\"GOT ERROR on line %s -- converted to %d\\n\", line,eline);\n \n \n if (eline > tlines || eline < 0) {\n return;\n }\n this.el.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 this.el.create_source_mark(msg, type, iter);\n } );\n return false;\n \n\n\n\n\n}\n" + "| bool highlightErrorsJson" : "(string type, Json.Object obj) {\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, type);\n \n \n // we should highlight other types of errors..\n \n if (!obj.has_member(type)) {\n print(\"Return has no errors\\n\");\n return true;\n }\n \n if (_this.window.windowstate.state != WindowState.State.CODEONLY && \n _this.window.windowstate.state != WindowState.State.CODE\n ) {\n return true;\n } \n \n \n var err = obj.get_object_member(type);\n var valafn = _this.file.path;\n if (_this.file.xtype != \"PlainFile\") {\n\n\n \n \n valafn = \"\";\n try { \n var regex = new Regex(\"\\\\.bjs$\");\n \n \n valafn = regex.replace(_this.file.path,_this.file.path.length , 0 , \".vala\");\n } catch (GLib.RegexError e) {\n return true;\n } \n\n\n\n }\n if (!err.has_member(valafn)) {\n print(\"File path has no errors\\n\");\n return true;\n }\n\n var lines = err.get_object_member(valafn);\n \n var offset = 1;\n if (obj.has_member(\"line_offset\")) {\n offset = (int)obj.get_int_member(\"line_offset\") + 1;\n }\n \n\n \n \n var tlines = this.el.get_line_count () +1;\n \n lines.foreach_member((obj, line, node) => {\n \n Gtk.TextIter iter;\n // print(\"get inter\\n\");\n var eline = int.parse(line) - offset;\n print(\"GOT ERROR on line %s -- converted to %d\\n\", line,eline);\n \n \n if (eline > tlines || eline < 0) {\n return;\n }\n this.el.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 this.el.create_source_mark(msg, type, iter);\n } );\n return false;\n \n\n\n\n\n}\n" } ] } diff --git a/src/Builder4/Editor.vala b/src/Builder4/Editor.vala index de7bb5fb2..45fbe5bfa 100644 --- a/src/Builder4/Editor.vala +++ b/src/Builder4/Editor.vala @@ -24,7 +24,6 @@ public class Editor : Object public int pos_root_x; public int pos_root_y; public string ptype; - public string fname; public string key; public JsRender.JsRender file; public bool pos; @@ -42,7 +41,6 @@ public class Editor : Object this.window = null; this.activeEditor = ""; this.ptype = ""; - this.fname = ""; this.key = ""; this.file = null; this.pos = false; @@ -129,7 +127,7 @@ public class Editor : Object } this.key_edit.el.text = key; - + } public class Xcls_Box2 : Object { @@ -546,7 +544,7 @@ public class Editor : Object var err = obj.get_object_member(type); - var valafn = _this.fname; + var valafn = _this.file.path; if (_this.file.xtype != "PlainFile") { -- 2.39.2