{ "build_module" : "builder", "gen_extended" : false, "items" : [ { "# Gtk.Widget lastObj" : "null", "# GtkSource.SearchContext searchcontext" : "", "# JsRender.JsRender file" : "null", "# Xcls_MainWindow main_window" : "", "$ xns" : "Gtk", "* init" : [ "{", "", "\tthis.css = new Gtk.CssProvider();", "\t ", "\tthis.css.load_from_string(", "\t\t\"#gtkview-view-layout { background-color: #ccc; }\"", "\t);", "\t ", "\tGtk.StyleContext.add_provider_for_display(", "\t\tthis.el.get_display(),", "\t\tthis.css,", "\t\tGtk.STYLE_PROVIDER_PRIORITY_APPLICATION", "\t);", "\t\t", " ", "}", "" ], "Gtk.CssProvider css" : "", "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL", "bool hexpand" : true, "bool vexpand" : true, "id" : "GtkView", "int last_error_counter" : 0, "int last_search_end" : 0, "items" : [ { "$ xns" : "Gtk", "Gtk.Overflow overflow" : "Gtk.Overflow.VISIBLE", "id" : "notebook", "items" : [ { "$ xns" : "Gtk", "* pack" : false, "id" : "label_preview", "utf8 label" : "Preview", "xtype" : "Label" }, { "$ xns" : "Gtk", "* pack" : false, "id" : "label_code", "utf8 label" : "Preview Generated Code", "xtype" : "Label" }, { "$ xns" : "Gtk", "* pack" : "append_page,_this.label_preview.el", "items" : [ { "$ xns" : "Gtk", "* pack" : "set_child", "id" : "view_layout", "items" : [ { "$ xns" : "Gtk", "* pack" : "put,10,10", "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL", "id" : "container", "xtype" : "Box" } ], "string name" : "gtkview-view-layout", "xtype" : "Fixed" } ], "xtype" : "ScrolledWindow" }, { "$ xns" : "Gtk", "* pack" : "append_page,_this.label_code.el", "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL", "int spacing" : 0, "items" : [ { "$ xns" : "Gtk", "bool vexpand" : true, "id" : "sourceviewscroll", "items" : [ { "# JsRender.Node? node_selected" : "", "# string prop_selected" : "\"\"", "$ xns" : "GtkSource", "* init" : [ "\t{", "", "", "\tthis.css = new Gtk.CssProvider();", "\t ", "\tthis.css.load_from_string(\"#gtkview-view { font: 10px monospace ;}\");", "\t ", "\tGtk.StyleContext.add_provider_for_display(", "\t\tthis.el.get_display(),", "\t\tthis.css,", "\t\tGtk.STYLE_PROVIDER_PRIORITY_APPLICATION", "\t);", "\t\t", "\t\t ", "\tthis.loading = true;", "", "", "", "\tvar attrs = new GtkSource.MarkAttributes();", "\t attrs.set_icon_name ( \"process-stop\"); ", "\tattrs.query_tooltip_text.connect(( mark) => {", "\t\t//print(\"tooltip query? %s\\n\", mark.name);", "\t\treturn mark.name;", "\t});", "", "\tthis.el.set_mark_attributes (\"ERR\", attrs, 1);", "", "\t var wattrs = new GtkSource.MarkAttributes();", "\t wattrs.set_icon_name ( \"process-stop\"); ", "\twattrs.query_tooltip_text.connect(( mark) => {", "\t\t//print(\"tooltip query? %s\\n\", mark.name);", "\t\treturn mark.name;", "\t});", "", "\tthis.el.set_mark_attributes (\"WARN\", wattrs, 1);", "", "", "", "\t var dattrs = new GtkSource.MarkAttributes();", "\tdattrs.set_icon_name ( \"process-stop\"); ", "\tdattrs.query_tooltip_text.connect(( mark) => {", "\t\t//print(\"tooltip query? %s\\n\", mark.name);", "\t\treturn mark.name;", "\t});", "", "\tthis.el.set_mark_attributes (\"DEPR\", dattrs, 1);", "", "", "\tvar gattrs = new GtkSource.MarkAttributes();", "\tvar grey = Gdk.RGBA();", "\tgrey.parse ( \"#ccc\");", "\tgattrs.set_background ( grey);", "", "", "\tthis.el.set_mark_attributes (\"grey\", gattrs, 1);", "", "", "", "", "", "", "\t}", "" ], "* pack" : "set_child", "Gtk.CssProvider css" : "", "bool loading" : false, "bool zallow_node_scroll" : true, "gboolean editable" : false, "gboolean show_line_marks" : true, "gboolean show_line_numbers" : true, "id" : "sourceview", "items" : [ { "$ xns" : "GtkSource", "* init" : [ "", "var buf = this.el;", "buf.create_tag (\"bold\", \"weight\", Pango.Weight.BOLD);", "buf.create_tag (\"type\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#204a87\");", "buf.create_tag (\"keyword\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#a40000\");", "buf.create_tag (\"text\", \"weight\", Pango.Weight.NORMAL, \"foreground\", \"#729fcf\");", "buf.create_tag (\"number\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#ad7fa8\");", "buf.create_tag (\"method\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#729fcf\");", "buf.create_tag (\"property\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#BC1F51\");", "buf.create_tag (\"variable\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#A518B5\");", "", "", "buf.create_tag (\"ERR\", \"weight\", Pango.Weight.BOLD, \"background\", \"pink\");", "buf.create_tag (\"WARN\", \"weight\", Pango.Weight.BOLD, \"background\", \"#ABF4EB\");", "buf.create_tag (\"DEPR\", \"weight\", Pango.Weight.BOLD, \"background\", \"#EEA9FF\");", "", "", "" ], "* pack" : "set_buffer", "bool dirty" : false, "bool in_cursor_change" : false, "id" : "buffer", "int error_line" : "-1", "int last_line" : "-1", "listeners" : { "cursor_moved" : [ "( ) => {", "GLib.debug(\"cursor moved called\");", "", "", " \tif (this.in_cursor_change ) {", " GLib.debug(\"cursor changed : %d [ignoring nested call)\", this.el.cursor_position);", " return;", " }", " ", " GLib.debug(\"cursor changed : %d\", this.el.cursor_position);", " Gtk.TextIter cpos;", " this.el.get_iter_at_offset(out cpos, this.el.cursor_position);", " ", " var ln = cpos.get_line();", " if (this.last_line == ln ){", " \treturn;", "\t}", "\tthis.last_line = ln;", " var node = _this.file.lineToNode(ln);", "", " if (node == null) {", " print(\"can not find node\\n\");", " return;", " }", " this.in_cursor_change = true;", " var ltree = _this.main_window.windowstate.left_tree;", " ltree.model.selectNode(node);", " this.in_cursor_change = false;", "}", "" ] }, "xtype" : "Buffer" }, { "$ xns" : "Gtk", "listeners" : { "key_pressed" : [ "(keyval, keycode, state) => {", "", "\t", "\t ", "\t if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {", "\t GLib.debug(\"SAVE: ctrl-g pressed\");", "\t\t_this.forwardSearch(true);", "\t return true;", "\t}", " if (keyval == Gdk.Key.f && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {", "\t GLib.debug(\"SAVE: ctrl-f pressed\");", "\t\t_this.search_entry.el.grab_focus();", "\t return true;", "\t}", "\t ", "\treturn false;", "}\t ", "\t" ] }, "xtype" : "EventControllerKey" } ], "listeners" : { "query_tooltip" : [ "(x, y, keyboard_tooltip, tooltip) => {", "\t", "\t//GLib.debug(\"query tooltip\");", "\tGtk.TextIter iter;", "\tint trailing;", "\t", "\tvar yoff = (int) _this.sourceviewscroll.el.vadjustment.value;", "\t", "\tthis.el.get_iter_at_position (out iter, out trailing, x, y + yoff);", "\t ", "\tvar l = iter.get_line();", "\t// GLib.debug(\"query tooltip line %d\", (int) l);", "\tvar marks = _this.buffer.el.get_source_marks_at_line(l, \"ERR\");", "\tif (marks.is_empty()) {", "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"WARN\");", "\t}", "\tif (marks.is_empty()) {", "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"DEPR\");", "\t}", "\t", "\t// GLib.debug(\"query tooltip line marks %d\", (int) marks.length());", "\tvar str = \"\";", "\tmarks.@foreach((m) => { ", "\t\t//GLib.debug(\"got mark %s\", m.name);", "\t\tstr += (str.length > 0 ? \"\\n\" : \"\") + m.name;", "\t});", "\t", "\t// true if there is a mark..", "\ttooltip.set_text( str);", "\treturn str.length > 0 ? true : false;", "", "}", "" ] }, "string name" : "gtkview-view", "uint tab_width" : 4, "xtype" : "View", "| string toString" : [ "() {", " Gtk.TextIter s;", " Gtk.TextIter e;", " this.el.get_buffer().get_start_iter(out s);", " this.el.get_buffer().get_end_iter(out e);", " var ret = this.el.get_buffer().get_text(s,e,true);", " //print(\"TO STRING? \" + ret);", " return ret;", "}", "" ], "| void loadFile" : [ "( ) {", " this.loading = true;", " var buf = this.el.get_buffer();", " buf.set_text(\"\",0);", " var sbuf = (GtkSource.Buffer) buf;", "\tvar cpos = buf.cursor_position;", " ", " \tprint(\"BEFORE LOAD cursor = %d\\n\", cpos);", " var vadj_pos = this.el.get_vadjustment().get_value();", "", " if (_this.file == null || _this.file.xtype != \"Gtk\") {", " print(\"xtype != Gtk\");", " this.loading = false;", " return;", " }", " /*", " var valafn = \"\";", " try { ", " var regex = new Regex(\"\\\\.bjs$\");", " ", " ", " valafn = regex.replace(_this.file.path,_this.file.path.length , 0 , \".vala\");", " } catch (GLib.RegexError e) {", " this.loading = false;", " return;", " } ", " ", "", " if (!FileUtils.test(valafn,FileTest.IS_REGULAR) ) {", " print(\"File path has no errors\\n\");", " this.loading = false;", " return ;", " }", " ", " string str;", " try {", " ", " GLib.FileUtils.get_contents (valafn, out str);", " } catch (Error e) {", " this.loading = false;", " return ;", " }", " */", " var str = _this.file.toSource();", "", "// print(\"setting str %d\\n\", str.length);", " buf.set_text(str, str.length);", " var lm = GtkSource.LanguageManager.get_default();", " ", " //?? is javascript going to work as js?", " ", " ((GtkSource.Buffer)(buf)) .set_language(lm.get_language(_this.file.language));", " ", " ", " _this.main_window.windowstate.updateErrorMarksAll(); ", " // restore the cursor position?", " // after reloading the contents.", " GLib.Timeout.add(500, () => {", "\t\t_this.buffer.in_cursor_change = true;", " print(\"RESORTING cursor to = %d\\n\", cpos);", "\t\tGtk.TextIter cpos_iter;", "\t\tbuf.get_iter_at_offset(out cpos_iter, cpos);", "\t\tbuf.place_cursor(cpos_iter); ", "\t\t", "\t\tthis.el.get_vadjustment().set_value(vadj_pos);;", "\t\t_this.buffer.in_cursor_change = false;", " ", "\t\t", "\t\t", "\t\t//_this.buffer.checkSyntax();", "\t\treturn false;", "\t});", " ", " ", " this.loading = false; ", "}", "" ], "| void nodeSelected" : [ "(JsRender.Node? sel, bool scroll) {", " ", " ", " if (this.loading) {", " \treturn;", "\t}", " // this is connected in widnowstate", " print(\"Roo-view - node selected\\n\");", " var buf = this.el.get_buffer();", " ", " var sbuf = (GtkSource.Buffer) buf;", "", " ", " ", " ", " ", " // clear all the marks..", " Gtk.TextIter start;", " Gtk.TextIter end; ", " ", " sbuf.get_bounds (out start, out end);", " sbuf.remove_source_marks (start, end, \"grey\");", " ", " this.node_selected = sel;", " if (sel == null) {", " // no highlighting..", " return;", " }", " Gtk.TextIter iter; ", " sbuf.get_iter_at_line(out iter, sel.line_start);", " ", " ", " Gtk.TextIter cur_iter;", " sbuf.get_iter_at_offset(out cur_iter, sbuf.cursor_position);", " ", " ", " if (!_this.buffer.in_cursor_change) {", "", " \tthis.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);", "\t} ", " ", " ", " ", " for (var i = 0; i < buf.get_line_count();i++) {", " if (i < sel.line_start || i > sel.line_end) {", " ", " sbuf.get_iter_at_line(out iter, i);", " sbuf.create_source_mark(null, \"grey\", iter);", " ", " }", " ", " }", " ", "", "}", "" ] } ], "xtype" : "ScrolledWindow" }, { "$ xns" : "Gtk", "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL", "bool homogeneous" : false, "bool vexpand" : false, "int spacing" : 0, "items" : [ { "$ xns" : "Gtk", "* init" : [ " ", "this.css = new Gtk.CssProvider();", "", "this.css.load_from_string(\"", "\t#gtkview-search-entry { font: 10px monospace ;}\"", ");", "", "Gtk.StyleContext.add_provider_for_display(", "\tthis.el.get_display(),", "\tthis.css,", "\tGtk.STYLE_PROVIDER_PRIORITY_APPLICATION", ");", "\t\t", "", "" ], "Gtk.CssProvider css" : "", "bool hexpand" : true, "id" : "search_entry", "items" : [ { "$ xns" : "Gtk", "listeners" : { "key_pressed" : [ "(keyval, keycode, state) => {", "", "\tif (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {", "\t GLib.debug(\"SAVE: ctrl-g pressed\");", "\t\t_this.forwardSearch(true);", "\t return true;", "\t}", " ", " ", " \tif (keyval == Gdk.Key.Return && _this.search_entry.el.text.length > 0) {", "\t\t_this.forwardSearch(true);", "\t\t", "\t\t", "\t return true;", "", "\t} ", " // print(event.key.keyval)", " ", " return false;", "}", "" ] }, "xtype" : "EventControllerKey" } ], "listeners" : { "search_changed" : [ " () => {", " \t ", "\t_this.search(_this.search_entry.el.text);", "\t _this.search_results.updateResults();", "", "\tGLib.Timeout.add_seconds(1,() => {", "\t\t _this.search_results.updateResults();", "\t\t return false;", "\t });", "\t ", " ", " ", "}" ] }, "string name" : "gtkview-search-entry", "string placeholder_text" : "Press enter to search", "uint search_delay" : 3, "xtype" : "SearchEntry", "| void forwardSearch" : [ "(bool change_focus) {", "", "", "\t_this.forwardSearch(change_focus);", "", "/*", "", "\tswitch(_this.windowstate.state) {", "\t\tcase WindowState.State.CODEONLY:", "\t\t//case WindowState.State.CODE:", "\t\t\t// search the code being edited..", "\t\t\t_this.windowstate.code_editor_tab.forwardSearch(change_focus);", "\t\t\t ", "\t\t\tbreak;", "\t\tcase WindowState.State.PREVIEW:", "\t\t\tif (_this.windowstate.file.xtype == \"Gtk\") {", "\t\t\t\t_this.windowstate.window_gladeview.forwardSearch(change_focus);", "\t\t\t} else { ", "\t\t\t\t _this.windowstate.window_rooview.forwardSearch(change_focus);", "\t\t\t}", "\t\t", "\t\t\tbreak;", "\t}", "\t*/", "\t", "}", "" ] }, { "$ xns" : "Gtk", "id" : "search_results", "int margin_end" : 4, "int margin_start" : 4, "string label" : "No Results", "xtype" : "Label", "| void updateResults" : [ "() {", "\tthis.el.visible = true;", "\t", "\tvar res = _this.searchcontext.get_occurrences_count();", "\tif (res < 0) {", "\t\t_this.search_results.el.label = \"??? Matches\";\t\t", "\t\treturn;", "\t}", "", "\t_this.nextBtn.el.sensitive = false;", "\t_this.backBtn.el.sensitive = false;\t", "", "\tif (res > 0) {", "\t\t_this.search_results.el.label = \"%d Matches\".printf(res);", "\t\t_this.nextBtn.el.sensitive = true;", "\t\t_this.backBtn.el.sensitive = true;", "\t\treturn;", "\t} ", "\t_this.search_results.el.label = \"No Matches\";", "\t", "}" ] }, { "$ xns" : "Gtk", "bool always_show_image" : true, "bool sensitive" : false, "id" : "nextBtn", "listeners" : { "clicked" : [ "( ) => {", "_this.forwardSearch(true);", "\t ", "", "}", "" ] }, "string icon_name" : "go-down", "xtype" : "Button" }, { "$ xns" : "Gtk", "bool always_show_image" : true, "bool sensitive" : false, "id" : "backBtn", "listeners" : { "clicked" : [ "( ) => {", "", "_this.backSearch(true);", "\t", "}", "" ] }, "string icon_name" : "go-up", "xtype" : "Button" }, { "$ xns" : "Gtk", "bool always_show_arrow" : true, "bool always_show_image" : true, "items" : [ { "$ xns" : "Gtk", "* ctor" : "new Gtk.PopoverMenu.from_model(null)", "* prop" : "popover", "id" : "search_settings", "items" : [ { "$ xns" : "Gtk", "* pack" : "set_child", "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL", "int spacing" : 0, "items" : [ { "$ xns" : "Gtk", "id" : "case_sensitive", "string label" : "Case Sensitive", "xtype" : "CheckButton" }, { "$ xns" : "Gtk", "id" : "regex", "string label" : "Regex", "xtype" : "CheckButton" }, { "$ xns" : "Gtk", "id" : "multiline", "string label" : "Multi-line (add \\n)", "xtype" : "CheckButton" } ], "xtype" : "Box" } ], "xtype" : "PopoverMenu" } ], "string icon_name" : "emblem-system", "xtype" : "MenuButton" } ], "xtype" : "Box" } ], "xtype" : "Box" } ], "xtype" : "Notebook" } ], "xtype" : "Box", "| int search" : [ "(string in_txt) {", "\tthis.notebook.el.page = 1;", "\t", " ", " ", "\tvar s = new GtkSource.SearchSettings();", "\ts.case_sensitive = _this.case_sensitive.el.active;", "\ts.regex_enabled = _this.regex.el.active;\t", "\ts.wrap_around = false;", "\t", "\tthis.searchcontext = new GtkSource.SearchContext(this.buffer.el,s);", "\tthis.searchcontext.set_highlight(true);", "\tvar txt = in_txt;", "\t", "\tif (_this.multiline.el.active) {", "\t\ttxt = in_txt.replace(\"\\\\n\", \"\\n\");", "\t}", "\t", "\ts.set_search_text(txt);", "\tGtk.TextIter beg, st,en;", "\tbool has_wrapped_around;", "\tthis.buffer.el.get_start_iter(out beg);", "\tthis.searchcontext.forward(beg, out st, out en, out has_wrapped_around);", "\tthis.last_search_end = 0;", "\t", "\treturn this.searchcontext.get_occurrences_count();", "", " ", " ", "", "}", "" ], "| void backSearch" : [ "(bool change_focus) {", "", "\tif (this.searchcontext == null) {", "\t\treturn;", "\t} ", "\t", "\tGtk.TextIter beg, st,en;", "\tbool has_wrapped_around;", "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end -1 );", "\t", "\tif (!this.searchcontext.backward(beg, out st, out en, out has_wrapped_around)) {", "\t", "\t\tthis.last_search_end = 0;", "\t\treturn;", "\t}", "\tthis.last_search_end = en.get_offset();", "\tif (change_focus) {", "\t\tthis.sourceview.el.grab_focus();", "\t}", "\tthis.buffer.el.place_cursor(st);", "\tthis.sourceview.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);", "\tvar ln = st.get_line();", "\tthis.highlightNodeAtLine(ln);", "\t ", "}", "" ], "| void createThumb" : [ "() {", " ", " ", " if (this.file == null) {", " return;", " }", " // only screenshot the gtk preview..", " if (this.notebook.el.page > 0 ) {", " return;", " }", " ", " ", " \tthis.file.widgetToIcon(this.container.el); ", "", " ", " return;", " ", " ", " ", " ", " ", " // should we hold until it's printed...", " ", "", " ", " ", "}", "" ], "| void forwardSearch" : [ "(bool change_focus) {", "", "\tif (this.searchcontext == null) {", "\t\treturn;", "\t}", "\tthis.notebook.el.page = 1;", "\tGtk.TextIter beg, st,en;", "\tbool has_wrapped_around;", "\tvar buf = this.sourceview.el.get_buffer();", "\tbuf.get_iter_at_offset(out beg, this.last_search_end);", "\tif (!this.searchcontext.forward(beg, out st, out en, out has_wrapped_around)) {", "\t\tthis.last_search_end = 0;", "\t\treturn;", "\t}", "\tthis.last_search_end = en.get_offset();", "\tif (change_focus) {", "\t\tthis.sourceview.el.grab_focus();", "\t}", "\tbuf.place_cursor(st);", "\t", " ", "\t ", "\tthis.sourceview.el.scroll_to_iter(st, 0.0f, true, 0.0f, 0.5f);", "\t", "\t", "\tvar ln = st.get_line();", "\t", "\tthis.highlightNodeAtLine(ln);", "}\t", " " ], "| void highlightNodeAtLine" : [ "(int ln) {", "", "\t// this is done from clicking on the editor..", "\t ", "\t// highlight node...", "\t", "\t\t", " var node = _this.file.lineToNode(ln+1);", " ", " if (node == null) {", " //print(\"can not find node\\n\");", " return;", " }", " var prop = node.lineToProp(ln+1);", " print(\"prop : %s\", prop == null ? \"???\" : prop.name);", " ", " ", " // ---------- this selects the tree's node...", " ", " var ltree = _this.main_window.windowstate.left_tree;", " ltree.model.selectNode(node);", " //var tp = ltree.model.treePathFromNode(node);", " ", " //print(\"got tree path %s\\n\", tp);", " //if (tp == \"\") {", "\t//\treturn;", "\t//}", " //_this.sourceview.allow_node_scroll = false; /// block node scrolling..", "\t ", " ", " //print(\"changing cursor on tree..\\n\");", " ", "", " ", " // let's try allowing editing on the methods.", " // a little klunky at present..", "\t_this.sourceview.prop_selected = \"\";", "\t/*", " if (prop != null) {", "\t\t//see if we can find it..", "\t\tvar kv = prop.split(\":\");", "\t\tif (kv[0] == \"p\") {", "\t\t", " \t\t//var k = prop.get_key(kv[1]);", " \t\t// fixme -- need to determine if it's an editable property...", " \t\t_this.sourceview.prop_selected = prop;", " \t\t", "\t\t} else if (kv[0] == \"l\") {", "\t\t\t _this.sourceview.prop_selected = prop;", "\t\t\t", "\t\t}", " }", " */", " //ltree.view.setCursor(tp, \"editor\");", " // ltree.view.el.set_cursor(new Gtk.TreePath.from_string(tp), null, false); ", " _this.sourceview.nodeSelected(node,false);", " ", " // scrolling is disabled... as node selection calls scroll 10ms after it changes.", " // GLib.Timeout.add_full(GLib.Priority.DEFAULT,100 , () => {", "\t // this.allow_node_scroll = true;", "\t // return false;", " // });", " // }", "\t\t", "\t\t", "\t\t", "\t\t", "\t\t", "\t\t", "\t\t", "\t\t", "\t\t", "\t\t ", "", "}", " " ], "| void loadFile" : [ "(JsRender.JsRender file) ", "{", " this.file = null;", " ", " if (file.tree == null) {", " return;", " }", " this.last_error_counter = -1;", " this.notebook.el.page = 0;// gtk preview ", " ", " ", " ", " this.file = file; ", " this.sourceview.loadFile();", " ", " this.searchcontext = null;", " this.last_error_counter = -1;", "\t\tthis.updateErrorMarks();", " if (this.lastObj != null) {", " this.container.el.remove(this.lastObj);", " }", " ", " // hide the compile view at present..", " ", " ", " var w = this.el.get_width();", " var h = this.el.get_height();", " ", " print(\"ALLOC SET SIZES %d, %d\\n\", w,h); ", " ", " // set the container size min to 500/500 or 20 px less than max..", " w = int.max (w-20, 500);", " h = int.max (h-20, 500); ", " ", " print(\"SET SIZES %d, %d\\n\", w,h); ", " _this.container.el.set_size_request(w,h);", " ", " _this.view_layout.el.set_size_request(w,h); ", " // should be baded on calc.. -- see update_scrolled.", " ", " var fc = this.container.el.get_first_child();", " if (fc != null) {", " \t\tthis.container.el.remove(fc);", " \t\t}", " ", " \t\tvar xmlstr = JsRender.NodeToGlade.mungeFile( file);", " \t\tvar builder = new Gtk.Builder.from_string (xmlstr, xmlstr.length);", " \t\tvar obj = (Gtk.Widget) builder.get_object(\"w\"+ file.tree.oid.to_string());", " \t\t this.container.el.append(obj);", "\t obj.show();", " this.createThumb();", " ", " \t ", " ", " ", "}", " " ], "| void scroll_to_line" : [ "(int line) {", " // code preview...", " ", " GLib.Timeout.add(100, () => {", " ", " ", "\t this.notebook.el.set_current_page(1);", "\t ", "\t\t var buf = this.sourceview.el.get_buffer();", "\t ", "\t\tvar sbuf = (GtkSource.Buffer) buf;", "", "", "\t\tGtk.TextIter iter; ", "\t\tsbuf.get_iter_at_line(out iter, line);", "\t\tthis.sourceview.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);", "\t\treturn false;", "\t}); ", "", " ", "}", "" ], "| void updateErrorMarks" : [ "() {", "\t", " ", "", "\tvar buf = _this.buffer.el;", "\tGtk.TextIter start;", "\tGtk.TextIter end; ", "\tbuf.get_bounds (out start, out end);", "", "", " ", "\tGLib.debug(\"highlight errors\");\t\t ", "", "\t // we should highlight other types of errors..", "", " ", "", "\t ", "\tif (_this.file == null) {", "\t\tGLib.debug(\"file is null?\");", "\t\treturn;", "", "\t}", "\tvar ar = this.file.getErrors();", "\tif (ar.size < 1) {", "\t\tbuf.remove_tag_by_name (\"ERR\", start, end);", "\t\tbuf.remove_tag_by_name (\"WARN\", start, end);", "\t\tbuf.remove_tag_by_name (\"DEPR\", start, end);", "\t\tbuf.remove_source_marks (start, end, \"ERR\");", "\t\tbuf.remove_source_marks (start, end, \"WARN\");", "\t\tbuf.remove_source_marks (start, end, \"DEPR\");", "\t\tthis.last_error_counter = file.error_counter ;", "\t\tGLib.debug(\"higjlight has no errors\");", "\t\treturn;", "\t}", " \tif (this.last_error_counter == file.error_counter) {", "\t\treturn;", "\t}", "\t", "", " ", "\t ", "", "\tvar tlines = buf.get_line_count () +1;", "\t", " ", "\t ", "\tbuf.remove_source_marks (start, end, \"ERR\");", "\tbuf.remove_source_marks (start, end, \"WARN\");", "\tbuf.remove_source_marks (start, end, \"DEPR\");", "\tbuf.remove_tag_by_name (\"ERR\", start, end);", "\tbuf.remove_tag_by_name (\"WARN\", start, end);", "\tbuf.remove_tag_by_name (\"DEPR\", start, end);", "\tforeach(var diag in ar) { ", "\t", "\t\t", "\t Gtk.TextIter iter;", "// print(\"get inter\\n\");", "\t var eline = (int)diag.range.start.line ;", "\t var eline_to = (int)diag.range.end.line;", "\t if (eline > tlines || eline < 0) {", "\t return;", "\t }", "\t ", "\t ", "\t buf.get_iter_at_line( out iter, eline);", "\t ", "\t \t buf.get_iter_at_line_offset( out start, ", " \t \teline, (int)diag.range.start.character); ", " \t buf.get_iter_at_line_offset( out end, ", " \t \teline_to, (int)diag.range.end.character); ", " \t \t", "\t buf.apply_tag_by_name(diag.category, start, end);", "\t ", "\t ", "\t\tvar msg = \"Line: %d %s : %s\".printf(eline+1, diag.category, diag.message);", "\t buf.create_source_mark( msg, diag.category, iter);", "\t GLib.debug(\"set line %d to %s\", eline, msg);", "\t //this.marks.set(eline, msg);", "\t}", "\tthis.last_error_counter = file.error_counter ;", "", "", "", " ", "", "}" ] } ], "name" : "GtkView" }