Sample/Editor.bjs
[app.Builder.js] / Sample / Editor.bjs
1 {
2     "id": "file-gtk-13",
3     "name": "Editor",
4     "parent": "",
5     "title": false,
6     "path": "/home/alan/gitlive/app.Builder.js/Sample/Editor.bjs",
7     "items": [
8         {
9             "listeners": {
10                 "delete_event": "function (self, event) {\n    _this.el.hide();\n    return true;\n}",
11                 "destroy_event": "function (self, event) {\n    return true;\n}"
12             },
13             "height_request": 300,
14             "id": "EditorWindow",
15             "title": "Application Builder - Editor",
16             "width_request": 500,
17             "xtype": "Window",
18             "|init": "function() {\n    XObject.prototype.init.call(this);\n   // this.show_all();\n}\n",
19             "|xns": "Gtk",
20             "items": [
21                 {
22                     "pack": "add",
23                     "xtype": "VBox",
24                     "|xns": "Gtk",
25                     "items": [
26                         {
27                             "pack": "pack_start,false,true",
28                             "xtype": "Toolbar",
29                             "|xns": "Gtk",
30                             "items": [
31                                 {
32                                     "label": "Save",
33                                     "xtype": "Button",
34                                     "|xns": "Gtk"
35                                 }
36                             ]
37                         },
38                         {
39                             "id": "RightEditor",
40                             "pack": "add",
41                             "xtype": "ScrolledWindow",
42                             "|xns": "Gtk",
43                             "items": [
44                                 {
45                                     "id": "view",
46                                     "indent_width": 4,
47                                     "pack": "add",
48                                     "xtype": "View",
49                                     "|auto_indent": true,
50                                     "|init": "function() {\n    XObject.prototype.init.call(this);\n     var description = Pango.Font.description_from_string(\"monospace\")\n    description.set_size(8000);\n    this.el.modify_font(description);\n\n}\n",
51                                     "|insert_spaces_instead_of_tabs": true,
52                                     "|load": "function(str) {\n\n// show the help page for the active node..\n   //this.get('/Help').show();\n\n\n  // this.get('/BottomPane').el.set_current_page(0);\n    this.el.get_buffer().set_text(str, str.length);\n    var lm = GtkSource.LanguageManager.get_default();\n    \n    this.el.get_buffer().set_language(lm.get_language('js'));\n    var buf = this.el.get_buffer();\n    var cursor = buf.get_mark(\"insert\");\n    var iter= new Gtk.TextIter;\n    buf.get_iter_at_mark(iter, cursor);\n    iter.set_line(1);\n    iter.set_line_offset(4);\n    buf.move_mark(cursor, iter);\n    \n    \n    cursor = buf.get_mark(\"selection_bound\");\n    iter= new Gtk.TextIter;\n    buf.get_iter_at_mark(iter, cursor);\n    iter.set_line(1);\n    iter.set_line_offset(4);\n    buf.move_mark(cursor, iter);\n     \n    this.el.grab_focus();\n}",
53                                     "|show_line_numbers": true,
54                                     "|xns": "GtkSource",
55                                     "items": [
56                                         {
57                                             "listeners": {
58                                                 "changed": "function (self) {\n    var s = new Gtk.TextIter();\n    var e = new Gtk.TextIter();\n    this.el.get_start_iter(s);\n    this.el.get_end_iter(e);\n    var str = this.el.get_text(s,e,true);\n    try {\n        Seed.check_syntax('var e = ' + str);\n    } catch (e) {\n        this.get('/RightEditor.view').el.modify_base(Gtk.StateType.NORMAL, new Gdk.Color({\n            red: 0xFFFF, green: 0xCCCC , blue : 0xCCCC\n           }));\n        //print(\"SYNTAX ERROR IN EDITOR\");   \n        //print(e);\n        //console.dump(e);\n        return;\n    }\n    this.get('/RightEditor.view').el.modify_base(Gtk.StateType.NORMAL, new Gdk.Color({\n            red: 0xFFFF, green: 0xFFFF , blue : 0xFFFF\n           }));\n    \n     this.get('/LeftPanel.model').changed(  str , false);\n}"
59                                             },
60                                             "pack": "set_buffer",
61                                             "xtype": "Buffer",
62                                             "|xns": "GtkSource"
63                                         }
64                                     ]
65                                 }
66                             ]
67                         }
68                     ]
69                 }
70             ]
71         }
72     ],
73     "permname": ""
74 }