From 4b5244a0d45a73705398b19c01081aac73074671 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Thu, 30 Apr 2015 15:39:56 +0800 Subject: [PATCH] sync --- .gitignore | 1 + src/Builder4/Editor.bjs | 2 +- src/Builder4/Editor.vala | 5 +++-- src/Builder4/WindowLeftTree.bjs | 2 +- src/Builder4/WindowLeftTree.vala | 2 +- src/Palete/Palete.vala | 2 +- src/Palete/ValaSource.vala | 2 +- 7 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index a18934fe0..fde6c1701 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ src/c/*.o src/Makefile src/*.c src/*.o +src/builder4 src/builder src/*.stamp src/*.stamp-t diff --git a/src/Builder4/Editor.bjs b/src/Builder4/Editor.bjs index 6f0575813..a3357e9c9 100644 --- a/src/Builder4/Editor.bjs +++ b/src/Builder4/Editor.bjs @@ -83,7 +83,7 @@ "int error_line" : "-1", "| bool highlightErrors" : "( Gee.HashMap validate_res) {\n this.error_line = validate_res.size;\n\n if (this.error_line < 1) {\n return true;\n }\n var tlines = this.el.get_line_count ();\n Gtk.TextIter iter;\n var valiter = validate_res.map_iterator();\n while (valiter.next()) {\n \n // print(\"get inter\\n\");\n var eline = valiter.get_key();\n if (eline > tlines) {\n continue;\n }\n this.el.get_iter_at_line( out iter, eline);\n //print(\"mark line\\n\");\n this.el.create_source_mark(valiter.get_value(), \"error\", iter);\n } \n return false;\n }", "| 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 \n \n var p = Palete.factory(_this.file.xtype); \n \n var str = this.toString();\n \n string res = \"\";\n \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 this.check_running = true;\n \n \n if (_this.file.language == \"js\") {\n this.check_running = false;\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 print(\"calling validate code\\n\"); \n p.validateVala.begin(\n str, \n _this.key, \n _this.ptype,\n _this.file,\n _this.node,\n (obj, res) => {\n this.check_running = false;\n var validate_res = p.validateCode.end(res);\n this.highlightErrors(validate_res);\n\n }\n \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 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 \n \n var p = Palete.factory(_this.file.xtype); \n \n var str = this.toString();\n \n string res = \"\";\n \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 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 print(\"calling validate vala\\n\"); \n p.validateVala.begin(\n str, \n _this.key, \n _this.ptype,\n _this.file,\n _this.node,\n (obj, res) => {\n this.check_running = false;\n var validate_res = p.validateVala.end(res);\n this.highlightErrors(validate_res);\n\n }\n \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" : "Buffer", "bool check_running" : false, diff --git a/src/Builder4/Editor.vala b/src/Builder4/Editor.vala index 618841af6..5eb55eec0 100644 --- a/src/Builder4/Editor.vala +++ b/src/Builder4/Editor.vala @@ -444,6 +444,7 @@ public class Editor : Object if (_this.file.language == "js") { this.check_running = false; + print("calling validate javascript\n"); return this.highlightErrors(p.validateJavascript( str, _this.key, @@ -454,7 +455,7 @@ public class Editor : Object } - print("calling validate code\n"); + print("calling validate vala\n"); p.validateVala.begin( str, _this.key, @@ -463,7 +464,7 @@ public class Editor : Object _this.node, (obj, res) => { this.check_running = false; - var validate_res = p.validateCode.end(res); + var validate_res = p.validateVala.end(res); this.highlightErrors(validate_res); } diff --git a/src/Builder4/WindowLeftTree.bjs b/src/Builder4/WindowLeftTree.bjs index 1c9c8f4c4..c65dc4671 100644 --- a/src/Builder4/WindowLeftTree.bjs +++ b/src/Builder4/WindowLeftTree.bjs @@ -25,7 +25,7 @@ { "listeners" : { "button_press_event" : " ( ev) => {\n //console.log(\"button press?\");\n if (! _this.before_node_change(null) ) {\n return true;\n }\n\n \n if (ev.type != Gdk.EventType.BUTTON_PRESS || ev.button != 3) {\n //print(\"click\" + ev.type);\n return false;\n }\n Gtk.TreePath res;\n if (!_this.view.el.get_path_at_pos((int)ev.x,(int)ev.y, out res, null, null, null) ) {\n return true;\n }\n \n this.el.get_selection().select_path(res);\n \n //if (!this.get('/LeftTreeMenu').el) { \n // this.get('/LeftTreeMenu').init(); \n // }\n \n _this.LeftTreeMenu.el.set_screen(Gdk.Screen.get_default());\n _this.LeftTreeMenu.el.show_all();\n _this.LeftTreeMenu.el.popup(null, null, null, 3, ev.time);\n // print(\"click:\" + res.path.to_string());\n return true;\n}", - "cursor_changed" : " ( ) => {\n\n\n if (this.blockChanges) { // probably not needed.. \n return ;\n }\n if (!_this.before_node_change(null) ) {\n\t this.blockChanges = true;\n\t this.el.get_selection().unselect_all();\n\t this.blockChanges = false;\n\t return;\n }\n if (_this.model.file == null) {\n return;\n } \n \n //var render = this.get('/LeftTree').getRenderer(); \n print(\"LEFT TREE -> view -> selection changed called\\n\");\n \n \n // -- it appears that the selection is not updated.\n \n GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {\n \n\n if (this.el.get_selection().count_selected_rows() < 1) {\n\n print(\"selected rows < 1\\n\");\n //??this.model.load( false);\n _this.node_selected(null);\n \n return false ;\n }\n \n //console.log('changed');\n var s = this.el.get_selection();\n Gtk.TreeIter iter;\n Gtk.TreeModel mod;\n s.get_selected(out mod, out iter);\n \n \n // var val = \"\";\n GLib.Value value;\n _this.model.el.get_value(iter, 2, out value);\n _this.model.activePath = mod.get_path(iter).to_string();\n \n var node = (JsRender.Node)value.dup_object();\n _this.node_selected(node);\n while (Gtk.events_pending()) {\n Gtk.main_iteration();\n }\n var cp = mod.get_path(iter);\n Gtk.TreePath sp, ep;\n this.el.get_visible_range(out sp, out ep);\n // if sp is before cp then retuns 1.\n \n if (cp.compare(sp) >= 0 && ep.compare(cp) >=1) {\n return false;\n }\n \n \n \n this.el.scroll_to_cell(new Gtk.TreePath.from_string(_this.model.activePath), null, true, 0.1f,0.0f);\n \n return false;\n }); \n //_this.after_node_change(node);\n\n// _this.model.file.changed(node, \"tree\");\n \n //Seed.print( value.get_string());\n return ;\n \n}", + "cursor_changed" : " ( ) => {\n\n\n if (this.blockChanges) { // probably not needed.. \n return ;\n }\n if (!_this.before_node_change(null) ) {\n\t this.blockChanges = true;\n\t this.el.get_selection().unselect_all();\n\t this.blockChanges = false;\n\t return;\n }\n if (_this.model.file == null) {\n return;\n } \n \n //var render = this.get('/LeftTree').getRenderer(); \n print(\"LEFT TREE -> view -> selection changed called\\n\");\n \n \n // -- it appears that the selection is not updated.\n \n GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {\n \n\n if (this.el.get_selection().count_selected_rows() < 1) {\n\n print(\"selected rows < 1\\n\");\n //??this.model.load( false);\n _this.node_selected(null);\n \n return false ;\n }\n \n //console.log('changed');\n var s = this.el.get_selection();\n Gtk.TreeIter iter;\n Gtk.TreeModel mod;\n s.get_selected(out mod, out iter);\n \n \n // var val = \"\";\n GLib.Value value;\n _this.model.el.get_value(iter, 2, out value);\n _this.model.activePath = mod.get_path(iter).to_string();\n \n var node = (JsRender.Node)value.dup_object();\n _this.node_selected(node);\n while (Gtk.events_pending()) {\n Gtk.main_iteration();\n }\n var cp = mod.get_path(iter);\n Gtk.TreePath sp, ep;\n this.el.get_visible_range(out sp, out ep);\n // if sp is before cp then retuns 1.\n // if cp is before ep then retuns 1.\n if (cp.compare(sp) >= 0 && ep.compare(cp) >=1) {\n return false;\n }\n \n \n \n this.el.scroll_to_cell(new Gtk.TreePath.from_string(_this.model.activePath), null, true, 0.1f,0.0f);\n \n return false;\n }); \n //_this.after_node_change(node);\n\n// _this.model.file.changed(node, \"tree\");\n \n //Seed.print( value.get_string());\n return ;\n \n}", "drag_begin" : "( ctx) => {\n\t//print('SOURCE: drag-begin');\n \n \n //this.targetData = \"\";\n \n // find what is selected in our tree...\n \n var s = _this.view.el.get_selection();\n if (s.count_selected_rows() < 1) {\n return;\n }\n Gtk.TreeIter iter;\n Gtk.TreeModel mod;\n s.get_selected(out mod, out iter);\n\n \n\n // set some properties of the tree for use by the dropped element.\n GLib.Value value;\n _this.model.el.get_value(iter, 2, out value);\n var tp = mod.get_path(iter).to_string();\n var data = (JsRender.Node)(value.dup_object());\n var xname = data.fqn();\n print (\"XNAME IS \" + xname+ \"\\n\");\n this.dragData = tp;\n this.dropList = _this.model.file.palete().getDropList(xname);\n \n print (\"DROP LIST IS \" + string.joinv(\", \", this.dropList) + \"\\n\");\n \n\n // make the drag icon a picture of the node that was selected\n \n \n // by default returns the path..\n var path = _this.model.el.get_path(iter);\n\n \n var pix = this.el.create_row_drag_icon ( path);\n \n Gtk.drag_set_icon_surface (ctx, pix) ;\n \n return;\n}", "drag_end" : " (drag_context) => {\n\t//Seed.print('LEFT-TREE: drag-end');\n this.dragData = \"\";\n this.dropList = null;\n// this.targetData = \"\";\n this.highlightDropPath(\"\",0);\n// return true;\n}", "drag_motion" : " ( ctx, x, y, time) => {\n print(\"got drag motion\\n\");\n var src = Gtk.drag_get_source_widget(ctx);\n this.drag_x = x;\n this.drag_y = y; \n\n if (src != this.el) {\n \n \n \n // the point of this is to detect where an item could be dropped..\n print(\"requesting drag data\\n\");\n this.drag_in_motion = true;\n \n // request data that will be recieved by the recieve... \n Gtk.drag_get_data\n (\n this.el, // will receive 'drag-data-received' signal \n ctx, // represents the current state of the DnD \n Gdk.Atom.intern(\"STRING\",true), // the target type we want \n time // time stamp \n );\n return true;\n } \n\n\n print(\"action: %d\\n\", ctx.get_actions());\n //print(\"GETTING POS\");\n var targetData = \"\";\n\n Gtk.TreePath path;\n Gtk.TreeViewDropPosition pos;\n var isOver = _this.view.el.get_dest_row_at_pos(this.drag_x,this.drag_y, out path, out pos);\n\n // if there are not items in the tree.. the we have to set isOver to true for anything..\n var isEmpty = false;\n if (_this.model.el.iter_n_children(null) < 1) {\n print(\"got NO children?\\n\");\n isOver = true; //??? \n isEmpty = true;\n pos = Gtk.TreeViewDropPosition.INTO_OR_AFTER;\n }\n\n\n // ------------- a drag from self..\n\n\n //var action = Gdk.DragAction.COPY;\n // unless we are copying!!! ctl button..\n \n var action = (ctx.get_actions() & Gdk.DragAction.MOVE) > 0 ?\n Gdk.DragAction.COPY : Gdk.DragAction.MOVE ;\n // Gdk.DragAction.MOVE : Gdk.DragAction.COPY ;\n\n\n if (_this.model.el.iter_n_children(null) < 1) {\n // no children.. -- asume it's ok..\n \n targetData = \"|%d|\".printf((int)Gtk.TreeViewDropPosition.INTO_OR_AFTER);\n \n this.highlightDropPath(\"\", (Gtk.TreeViewDropPosition)0); \n Gdk.drag_status(ctx, action ,time);\n return true;\n \n // continue through to allow drop...\n\n } \n \n \n\n \n \n //print(\"ISOVER? \" + isOver);\n if (!isOver) {\n \n Gdk.drag_status(ctx, 0 ,time);\n this.highlightDropPath(\"\", (Gtk.TreeViewDropPosition)0); \n return false;\n\n }\n \n // drag node is parent of child..\n //console.log(\"SRC TREEPATH: \" + src.treepath);\n //console.log(\"TARGET TREEPATH: \" + data.path.to_string());\n \n // nned to check a few here..\n //Gtk.TreeViewDropPosition.INTO_OR_AFTER\n //Gtk.TreeViewDropPosition.INTO_OR_BEFORE\n //Gtk.TreeViewDropPosition.AFTER\n //Gtk.TreeViewDropPosition.BEFORE\n \n // locally dragged items to not really use the \n var selection_text = this.dragData;\n \n \n \n if (selection_text == null || selection_text.length < 1) {\n //print(\"Error - drag selection text returned NULL\");\n Gdk.drag_status(ctx, 0 ,time);\n this.highlightDropPath(\"\", (Gtk.TreeViewDropPosition)0);\n return false;\n }\n \n \n // see if we are dragging into ourself?\n var target_path = path.to_string(); \n print (\"Drag %s onto %s--%d\\n \", selection_text, target_path, pos);\n \n // pos : 3 = ontop - 0 = after, 1 = before\n //print(\"target_path=\"+target_path);\n\n // \n if (selection_text == target_path) {\n print(\"self drag ?? == we should perhaps allow copy onto self..\\n\");\n \n Gdk.drag_status(ctx, 0 ,time);\n this.highlightDropPath(\"\", (Gtk.TreeViewDropPosition)0);\n return false;\n// -- fixme -- this is not really correct..\n\n }\n \n // check that \n //print(\"DUMPING DATA\");\n //console.dump(data);\n // path, pos\n \n //print(data.path.to_string() +' => '+ data.pos);\n \n // dropList is a list of xtypes that this node could be dropped on.\n // it is set up when we start to drag..\n \n \n targetData = _this.model.findDropNodeByPath( path.to_string(), this.dropList, pos);\n \n print(\"targetDAta: \" + targetData +\"\\n\");\n \n if (targetData.length < 1) {\n //print(\"Can not find drop node path\");\n \n Gdk.drag_status(ctx, 0, time);\n this.highlightDropPath(\"\", (Gtk.TreeViewDropPosition)0);\n return false;\n }\n \n var td_ar = targetData.split(\"|\");\n \n \n\n Gdk.drag_status(ctx, action ,time);\n this.highlightDropPath(td_ar[0], (Gtk.TreeViewDropPosition)int.parse(td_ar[1]));\n return true;\n \n \n}", diff --git a/src/Builder4/WindowLeftTree.vala b/src/Builder4/WindowLeftTree.vala index da7d9c086..be697e181 100644 --- a/src/Builder4/WindowLeftTree.vala +++ b/src/Builder4/WindowLeftTree.vala @@ -229,7 +229,7 @@ public class Xcls_WindowLeftTree : Object Gtk.TreePath sp, ep; this.el.get_visible_range(out sp, out ep); // if sp is before cp then retuns 1. - + // if cp is before ep then retuns 1. if (cp.compare(sp) >= 0 && ep.compare(cp) >=1) { return false; } diff --git a/src/Palete/Palete.vala b/src/Palete/Palete.vala index d04795a4a..129da0852 100644 --- a/src/Palete/Palete.vala +++ b/src/Palete/Palete.vala @@ -342,7 +342,7 @@ namespace Palete } var vs = new ValaSource(file); //var cd = new JSCore.ClassDefinitionEmpty(); - var ret = yield vs.checkFileWithNodePropChange( + ret = yield vs.checkFileWithNodePropChange( node, property, ptype, diff --git a/src/Palete/ValaSource.vala b/src/Palete/ValaSource.vala index c097da153..b1716986e 100644 --- a/src/Palete/ValaSource.vala +++ b/src/Palete/ValaSource.vala @@ -132,7 +132,7 @@ namespace Palete { hash.set(prop, newval); var tmpstring = JsRender.NodeToVala.mungeFile(this.file); hash.set(prop, old); - print("%s\n", tmpstring); + //print("%s\n", tmpstring); var bits = tmpstring.split("/*--VALACHECK-START--*/"); var offset =0; if (bits.length > 0) { -- 2.39.2