Test.GtkWriter.vala.c
[app.Builder.js] / Builder4 / Editor.bjs
1 {
2     "id": "file-gtk-7",
3     "name": "Editor",
4     "parent": "",
5     "title": false,
6     "path": "/home/alan/gitlive/app.Builder.js/Builder4/Editor.bjs",
7     "items": [
8         {
9             "listeners": {
10                 "configure_event": " (object) => {\n    _this.pos = true;\n    this.el.get_position(out _this.pos_root_x, out _this.pos_root_y);\n\n\n    return false;\n}\n \n",
11                 "show": "  () => {\n    if (this.pos) {\n        _this.el.move(this.pos_root_x,this.pos_root_y);\n    }\n}\n "
12             },
13             ".bool:dirty": "false",
14             ".bool:pos": "false",
15             ".int:pos_root_x": "",
16             ".int:pos_root_y": "",
17             ".string:activeEditor": "\"\"",
18             ".string:active_path": "\"\"",
19             "height_request": 300,
20             "id": "Editor",
21             "title": "Application Builder -  Code  Editor",
22             "width_request": 500,
23             "xtype": "Window",
24             "|bool:save": "  ()  {\n\n    if (!Editor.RightEditor.save()) {\n        // no hiding with errors.\n        return true;\n    }\n    _this.active_path = \"\";\n    _this.el.hide();\n    return true;\n\n} ",
25             "|init": "function() {\n    XObject.prototype.init.call(this);\n   // this.show_all();\n}\n",
26             "|show_all": " (event) => {\n    if (!Editor.RightEditor.save()) {\n        // no hiding with errors.\n        return true;\n    }\n    _this.el.hide();\n    _this.active_path = \"\";\n    return true;\n}\n ",
27             "|void:show_all": "  () {\n    this.el.show_all();\n\n}\n ",
28             "|xns": "Gtk",
29             "items": [
30                 {
31                     "|homogeneous": "true",
32                     "pack": "add",
33                     "xtype": "VBox",
34                     "|xns": "Gtk",
35                     "items": [
36                         {
37                             "pack": "pack_start,false,true",
38                             "xtype": "Toolbar",
39                             "|xns": "Gtk",
40                             "items": [
41                                 {
42                                     "listeners": {
43                                         "clicked": " () => { \n    Editor.RightEditor.save();\n}\n \n"
44                                     },
45                                     "id": "save_button",
46                                     "label": "Save",
47                                     "xtype": "ToolButton",
48                                     "|xns": "Gtk"
49                                 }
50                             ]
51                         },
52                         {
53                             "id": "RightEditor",
54                             "pack": "add",
55                             "xtype": "ScrolledWindow",
56                             "|bool:save": "  () {\n     print(\"editor.rightbutton.save\");\n     if (_this.active_path.length  < 1 ) {\n          print(\"skip - no active path\");\n        return true;\n     }\n     \n     var str = Editor.buffer.toString();\n     \n     if (!Editor.buffer.checkSyntax()) {\n         print(\"check syntax failed\");\n         //this.get('/StandardErrorDialog').show(\"Fix errors in code and save..\"); \n         return false;\n     }\n     \n     // LeftPanel.model.changed(  str , false);\n     _this.dirty = false;\n     _this.save_button.el.sensitive = false;\n     print(\"set save button grey\");\n     return true;\n}\n ",
57                             "|xns": "Gtk",
58                             "items": [
59                                 {
60                                     "listeners": {
61                                         "key_release_event": " (event) => {\n    \n    if (event.keyval == 115 && (event.state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {\n        print(\"SAVE: ctrl-S  pressed\");\n        this.save();\n        return false;\n    }\n   // print(event.key.keyval)\n    \n    return false;\n\n} \n\n"
62                                     },
63                                     "id": "view",
64                                     "indent_width": 4,
65                                     "pack": "add",
66                                     "xtype": "View",
67                                     "|auto_indent": "true",
68                                     "|init": " \n    var description =   Pango.FontDescription.from_string(\"monospace\");\n    description.set_size(8000);\n    this.el.override_font(description);\n\n ",
69                                     "|insert_spaces_instead_of_tabs": "true",
70                                     "|show_line_numbers": "true",
71                                     "|void:load": " (string 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 = Gtk.SourceLanguageManager.get_default();\n    \n    ((Gtk.SourceBuffer)(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    Gtk.TextIter iter;\n    buf.get_iter_at_mark(out 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(out iter, cursor);\n    iter.set_line(1);\n    iter.set_line_offset(4);\n    buf.move_mark(cursor, iter);\n    Editor.dirty = false;\n    this.el.grab_focus();\n    _this.save_button.el.sensitive = false;\n}",
72                                     "|void:save": " () {\n\n    Editor.RightEditor.save();\n}\n ",
73                                     "|xns": "GtkSource",
74                                     "items": [
75                                         {
76                                             "listeners": {
77                                                 "changed": " () => {\n    // check syntax??\n        if(this.checkSyntax()) {\n        Editor.save_button.el.sensitive = true;\n    }\n   // print(\"EDITOR CHANGED\");\n    Editor.dirty = true;\n\n    // this.get('/LeftPanel.model').changed(  str , false);\n    return ;\n}\n\n \n"
78                                             },
79                                             "id": "buffer",
80                                             "pack": "set_buffer",
81                                             "xtype": "Buffer",
82                                             "|bool:checkSyntax": " () {\n /*\n    var str = this.toString();\n    var res = \"\";\n    /*\n    try {\n      //  print('var res = ' + str);\n        Seed.check_syntax('var res = ' + str);\n        \n       \n    } catch (e) {\n        \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        // print(str);\n        //console.dump(e);\n        return false;\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    return true;\n}\n",
83                                             "|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 ",
84                                             "|xns": "GtkSource"
85                                         }
86                                     ]
87                                 }
88                             ]
89                         }
90                     ]
91                 }
92             ]
93         }
94     ],
95     "permname": "",
96     "modOrder": ""
97 }