+++ /dev/null
-//<script type="text/javascript">
-
-
-/**
- * usage:
- *
- * this.data = new BuildLists();
- *
- *
- *
- *
- *
- */
-// see if we can build the insertion tree for gtk - using introspection
-
-// it should build the tree of feasible insertions, then we will have to manually prune it..
-
-// it needs to know
-// a) what the inherited types are
-// b) what methods are available for each type, that include a reference to another type..
-
-// let's start with types..
-GIRepository = imports.gi.GIRepository;
-GLib = imports.gi.GLib;
-
-// we add this in, as it appears to get lost sometimes if we set it using the ENV. variable in builder.sh
-GIRepository.IRepository.prepend_search_path(GLib.get_home_dir() + '/.Builder/girepository-1.1');
-
-
-imports.searchPath.push('../gnome.introspection-doc-generator');
-
-XObject = imports.XObject.XObject;
-File = imports.File.File;
-
-// Introspecion specific..
-NameSpace = imports.Introspect.NameSpace.NameSpace;
-
-
-
-function BuildLists () {
-
-
- var ns_list = [ 'Gtk' ] ; //NameSpace.namespaces();
-
- ns_list = ns_list.sort();
- // let's try and load them, so we find out early what will fail.
- print("loading library to make sure it works.");
-
- var classes = {};
-
- ns_list.forEach(function(ns_name) {
- var core = imports.gi[ns_name];
- var ns = NameSpace.ns(ns_name); // fetch all the elements in namespace...
- ns['objects'].forEach( function(n) {
- var odata = NameSpace.factory('Class', ns_name, n);
- classes[odata.alias] = odata;
-
- });
- ns['interfaces'].forEach( function(n) {
- var odata =NameSpace.factory('Interface', ns_name, n);
- classes[odata.alias] = odata;
- });
- });
-
-
- print("Looping throught namespaces");
- var ns_idx = [];
- var implementations = {};
- var methods = {};
- var allmethods = [];
- var allchildren = [];
-
-
- for (cls in classes) {
- var odata = classes[cls];
- //methods[cls] = {}
-
- implementations[odata.alias] = odata.titleType == 'Class' ? odata.childClasses : odata.implementedBy;
- //print(JSON.stringify(odata.methods,null,4));
- odata.methods.forEach(function(m) {
-
- m.params.forEach(function(p) {
-
- if (!p.type || typeof(classes[p.type]) == 'undefined') {
- return;
- }
- // now add it..
-
- if (!p.type || typeof(classes[p.type]) == 'undefined') {
- return;
- }
- if (allchildren.indexOf(p.type) < 0) {
- allchildren.push(p.type);
- }
-
- if (typeof(methods[cls]) == 'undefined') {
- methods[cls] = {}
- }
-
- if (typeof(methods[cls][p.type]) == 'undefined') {
- methods[cls][p.type] = [];
- }
- var fullname = m.memberOf + '.' + m.name;
- if (allmethods.indexOf(fullname) < 0) {
- allmethods.push(fullname);
- }
-
- if (methods[cls][p.type].indexOf(fullname) > -1) {
- return;
- }
- methods[cls][p.type].push(fullname);
-
-
-
- });
-
- });
- //for(method in odata.methods) {
- // print(method.name);
- //}
-
-
- }
- this.methods = methods;
- this.allmethods = allmethods;
- this.allchildren = allchildren;
-
- this.implementations = implementations;
-
- //print(JSON.stringify(methods,null,4));
- //print(JSON.stringify(implementations,null,4));
-
-}
-
-
-
-
-
-
-
-
-// we now have a list of classes / methods that can be used..
-// we now need a ui to flag stuff as "don't bother with"
-
-
+++ /dev/null
-{
- "id": "file-gtk-17",
- "name": "Window",
- "parent": "",
- "title": false,
- "path": "/home/alan/gitlive/app.Builder.js/DependTree/Window.bjs",
- "items": [
- {
- "listeners": {
- "show": "function (self) {\n print(\"SHOW\");\n var BuildLists = imports['BuildLists.js'].BuildLists;\n this.data = new BuildLists();\n print(JSON.stringify(this.data.allmethods, null,4));\n \n var ls = this.get('method-list-store');\n this.data.allmethods.forEach(function(v) {\n ls.append( [ v , true, true ]);\n });\n \n var ls = this.get('children-list-store');\n this.data.allchildren.forEach(function(v) {\n ls.append( [ v , true, true ]);\n });\n var ls = this.get('class-list-store');\n var i =0;\n for (var c in this.data.methods) {\n i++;\n ls.append( [ c , true , true]);\n };\n print(JSON.stringify(this.data.methods['Gtk.AccelGroup']));\n \n \n \n}"
- },
- "default_height": 500,
- "default_width": 600,
- "id": "window",
- "xtype": "Window",
- "|init": "function() {\n XObject.prototype.init.call(this);\n this.el.show_all();\n}\n",
- "|xns": "Gtk",
- "items": [
- {
- "xtype": "VBox",
- "|xns": "Gtk",
- "listeners": {},
- "items": [
- {
- "pack": "pack_start,false,false",
- "xtype": "HBox",
- "|xns": "Gtk",
- "items": [
- {
- "label": "Reset",
- "xtype": "Button",
- "|xns": "Gtk"
- }
- ]
- },
- {
- "xtype": "HBox",
- "|xns": "Gtk",
- "listeners": {},
- "items": [
- {
- "xtype": "ScrolledWindow",
- "|xns": "Gtk",
- "listeners": {},
- "items": [
- {
- "listeners": {
- "cursor_changed": "function (self) {\n\n var sel = this.el.get_selection();\n\n \n var iter = new Gtk.TreeIter();\n sel.get_selected(this.model.el, iter);\n \n var tp = this.model.el.get_path(iter).to_string();\n print(tp);\n // \n var cls = this.model.getValue(tp, 0);\n print(cls);\n var data = this.get('/window').data;\n \n\n // hide all the rows in the methods list.\n var tp = false; \n var cstore = this.get('/window.children-list-store');\n var meths = [];\n while (false !== (tp = cstore.nextPath(tp))) {\n var mname = cstore.getValue(tp, 0);\n var show = typeof(data.methods[cls][mname]) == 'undefined' ? false :true;\n if (show) {\n meths.push.apply(meths, data.methods[cls][mname]);\n }\n cstore.setValue(tp, 2, show); // hide.. \n\n \n } \n print(JSON.stringify(meths));\n\n tp = false; \n var mstore = this.get('/window.method-list-store');\n while (false !== (tp = mstore.nextPath(tp))) {\n var mname = mstore.getValue(tp, 0);\n var show = meths.indexOf(mname) > -1 ? true :false;\n \n mstore.setValue(tp, 2, show); // hide.. \n }\n \n \n \n}"
- },
- "xtype": "TreeView",
- "|xns": "Gtk",
- "items": [
- {
- "xtype": "TreeModelFilter",
- "|init": "function() {\n this.items[0].pack = false;\n this.items[0].init();\n this.list = this.items[0];\n this.el = new Gtk.TreeModelFilter.c_new(this.items[0].el, null);\n this.el.set_visible_column(2);\n XObject.prototype.init.call(this);\n this.parent.model = this;\n \n}\n",
- "|xns": "Gtk",
- "items": [
- {
- "id": "class-list-store",
- "pack": false,
- "xtype": "ListStore",
- "|init": " function() \n {\n XObject.prototype.init.call(this);\n this.el.set_column_types ( 6, [\n GObject.TYPE_STRING, \n GObject.TYPE_BOOLEAN, \n GObject.TYPE_BOOLEAN, \n GObject.TYPE_STRING, \n GObject.TYPE_STRING, \n GObject.TYPE_STRING \n ] );\n \n }",
- "|xns": "Gtk"
- }
- ]
- },
- {
- "title": "Class",
- "xtype": "TreeViewColumn",
- "|xns": "Gtk",
- "expand": true,
- "listeners": {},
- "items": [
- {
- "xtype": "CellRendererText",
- "|xns": "Gtk",
- "listeners": {}
- }
- ]
- },
- {
- "title": "Active",
- "xtype": "TreeViewColumn",
- "|xns": "Gtk",
- "items": [
- {
- "listeners": {
- "toggled": "function (self, path) {\n print(\"TOGGLE\");\n // this.list\n\n\n \n var old = this.list.getValue(path, 1);\n // print(JSON.stringify(old));\n this.list.setValue(path, 1, old ? false : true)\n \n \n \n \n}"
- },
- "activatable": true,
- "xtype": "CellRendererToggle",
- "|xns": "Gtk"
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "xtype": "ScrolledWindow",
- "|xns": "Gtk",
- "listeners": {},
- "items": [
- {
- "xtype": "TreeView",
- "|xns": "Gtk",
- "listeners": {},
- "items": [
- {
- "xtype": "TreeModelFilter",
- "|init": "function() {\n this.items[0].pack = false;\n this.items[0].init();\n this.list = this.items[0];\n this.el = new Gtk.TreeModelFilter.c_new(this.items[0].el, null);\n this.el.set_visible_column(2);\n XObject.prototype.init.call(this);\n \n}\n",
- "|xns": "Gtk",
- "items": [
- {
- "id": "method-list-store",
- "xtype": "ListStore",
- "|init": " function() \n {\n XObject.prototype.init.call(this);\n this.el.set_column_types ( 6, [\n GObject.TYPE_STRING, \n GObject.TYPE_BOOLEAN, \n GObject.TYPE_BOOLEAN, \n GObject.TYPE_STRING, \n GObject.TYPE_STRING, \n GObject.TYPE_STRING \n ] );\n \n }",
- "|xns": "Gtk",
- "listeners": {}
- }
- ]
- },
- {
- "title": "Methods",
- "xtype": "TreeViewColumn",
- "|xns": "Gtk",
- "expand": true,
- "listeners": {},
- "items": [
- {
- "xtype": "CellRendererText",
- "|xns": "Gtk",
- "listeners": {}
- }
- ]
- },
- {
- "title": "Active",
- "xtype": "TreeViewColumn",
- "|xns": "Gtk",
- "listeners": {},
- "items": [
- {
- "listeners": {
- "toggled": "function (self, path) {\n print(\"TOGGLE\");\n // this.list\n\n\n \n var old = this.list.getValue(path, 1);\n // print(JSON.stringify(old));\n this.list.setValue(path, 1, old ? false : true)\n \n \n \n \n}"
- },
- "activatable": true,
- "xtype": "CellRendererToggle",
- "|xns": "Gtk"
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "xtype": "ScrolledWindow",
- "|xns": "Gtk",
- "listeners": {},
- "items": [
- {
- "xtype": "TreeView",
- "|xns": "Gtk",
- "listeners": {},
- "items": [
- {
- "xtype": "TreeModelFilter",
- "|init": "function() {\n this.items[0].pack = false;\n this.items[0].init();\n this.list = this.items[0];\n this.el = new Gtk.TreeModelFilter.c_new(this.items[0].el, null);\n this.el.set_visible_column(2);\n XObject.prototype.init.call(this);\n \n}\n",
- "|xns": "Gtk",
- "items": [
- {
- "id": "children-list-store",
- "pack": false,
- "xtype": "ListStore",
- "|init": " function() \n {\n XObject.prototype.init.call(this);\n this.el.set_column_types ( 6, [\n GObject.TYPE_STRING, \n GObject.TYPE_BOOLEAN, \n GObject.TYPE_BOOLEAN, \n GObject.TYPE_STRING, \n GObject.TYPE_STRING, \n GObject.TYPE_STRING \n ] );\n \n }",
- "|xns": "Gtk"
- }
- ]
- },
- {
- "title": "Child classes",
- "xtype": "TreeViewColumn",
- "|xns": "Gtk",
- "expand": true,
- "listeners": {},
- "items": [
- {
- "xtype": "CellRendererText",
- "|xns": "Gtk",
- "listeners": {}
- }
- ]
- },
- {
- "title": "Active",
- "xtype": "TreeViewColumn",
- "|xns": "Gtk",
- "listeners": {},
- "items": [
- {
- "listeners": {
- "toggled": "function (self, path) {\n print(\"TOGGLE\");\n // this.list\n\n\n \n var old = this.list.getValue(path, 1);\n // print(JSON.stringify(old));\n this.list.setValue(path, 1, old ? false : true)\n \n \n \n \n}"
- },
- "activatable": true,
- "xtype": "CellRendererToggle",
- "|xns": "Gtk"
- }
- ]
- }
- ]
- }
- ]
- }
- ]
- }
- ]
- }
- ]
- }
- ],
- "permname": "",
- "modOrder": ""
-}
\ No newline at end of file
+++ /dev/null
-Gtk = imports.gi.Gtk;
-Gdk = imports.gi.Gdk;
-Pango = imports.gi.Pango;
-GLib = imports.gi.GLib;
-Gio = imports.gi.Gio;
-GObject = imports.gi.GObject;
-GtkSource = imports.gi.GtkSource;
-WebKit = imports.gi.WebKit;
-Vte = imports.gi.Vte;
-GtkClutter = imports.gi.GtkClutter;
-Gdl = imports.gi.Gdl;
-console = imports.console;
-XObject = imports.XObject.XObject;
-Window=new XObject({
- xtype: Gtk.Window,
- listeners : {
- show : function (self) {
- print("SHOW");
- var BuildLists = imports['BuildLists.js'].BuildLists;
- this.data = new BuildLists();
- print(JSON.stringify(this.data.allmethods, null,4));
-
- var ls = this.get('method-list-store');
- this.data.allmethods.forEach(function(v) {
- ls.append( [ v , true, true ]);
- });
-
- var ls = this.get('children-list-store');
- this.data.allchildren.forEach(function(v) {
- ls.append( [ v , true, true ]);
- });
- var ls = this.get('class-list-store');
- var i =0;
- for (var c in this.data.methods) {
- i++;
- ls.append( [ c , true , true]);
- };
- print(JSON.stringify(this.data.methods['Gtk.AccelGroup']));
-
-
-
- }
- },
- default_height : 500,
- default_width : 600,
- id : "window",
- init : function() {
- XObject.prototype.init.call(this);
- this.el.show_all();
- },
- items : [
- {
- xtype: Gtk.VBox,
- items : [
- {
- xtype: Gtk.HBox,
- pack : "pack_start,false,false",
- items : [
- {
- xtype: Gtk.Button,
- label : "Reset"
- }
- ]
- },
- {
- xtype: Gtk.HBox,
- items : [
- {
- xtype: Gtk.ScrolledWindow,
- items : [
- {
- xtype: Gtk.TreeView,
- listeners : {
- cursor_changed : function (self) {
-
- var sel = this.el.get_selection();
-
-
- var iter = new Gtk.TreeIter();
- sel.get_selected(this.model.el, iter);
-
- var tp = this.model.el.get_path(iter).to_string();
- print(tp);
- //
- var cls = this.model.getValue(tp, 0);
- print(cls);
- var data = this.get('/window').data;
-
-
- // hide all the rows in the methods list.
- var tp = false;
- var cstore = this.get('/window.children-list-store');
- var meths = [];
- while (false !== (tp = cstore.nextPath(tp))) {
- var mname = cstore.getValue(tp, 0);
- var show = typeof(data.methods[cls][mname]) == 'undefined' ? false :true;
- if (show) {
- meths.push.apply(meths, data.methods[cls][mname]);
- }
- cstore.setValue(tp, 2, show); // hide..
-
-
- }
- print(JSON.stringify(meths));
-
- tp = false;
- var mstore = this.get('/window.method-list-store');
- while (false !== (tp = mstore.nextPath(tp))) {
- var mname = mstore.getValue(tp, 0);
- var show = meths.indexOf(mname) > -1 ? true :false;
-
- mstore.setValue(tp, 2, show); // hide..
- }
-
-
-
- }
- },
- items : [
- {
- xtype: Gtk.TreeModelFilter,
- init : function() {
- this.items[0].pack = false;
- this.items[0].init();
- this.list = this.items[0];
- this.el = new Gtk.TreeModelFilter.c_new(this.items[0].el, null);
- this.el.set_visible_column(2);
- XObject.prototype.init.call(this);
- this.parent.model = this;
-
- },
- items : [
- {
- xtype: Gtk.ListStore,
- id : "class-list-store",
- pack : false,
- init : function()
- {
- XObject.prototype.init.call(this);
- this.el.set_column_types ( 6, [
- GObject.TYPE_STRING,
- GObject.TYPE_BOOLEAN,
- GObject.TYPE_BOOLEAN,
- GObject.TYPE_STRING,
- GObject.TYPE_STRING,
- GObject.TYPE_STRING
- ] );
-
- }
- }
- ]
- },
- {
- xtype: Gtk.TreeViewColumn,
- title : "Class",
- expand : true,
- items : [
- {
- xtype: Gtk.CellRendererText
- }
- ]
- },
- {
- xtype: Gtk.TreeViewColumn,
- title : "Active",
- items : [
- {
- xtype: Gtk.CellRendererToggle,
- listeners : {
- toggled : function (self, path) {
- print("TOGGLE");
- // this.list
-
-
-
- var old = this.list.getValue(path, 1);
- // print(JSON.stringify(old));
- this.list.setValue(path, 1, old ? false : true)
-
-
-
-
- }
- },
- activatable : true
- }
- ]
- }
- ]
- }
- ]
- },
- {
- xtype: Gtk.ScrolledWindow,
- items : [
- {
- xtype: Gtk.TreeView,
- items : [
- {
- xtype: Gtk.TreeModelFilter,
- init : function() {
- this.items[0].pack = false;
- this.items[0].init();
- this.list = this.items[0];
- this.el = new Gtk.TreeModelFilter.c_new(this.items[0].el, null);
- this.el.set_visible_column(2);
- XObject.prototype.init.call(this);
-
- },
- items : [
- {
- xtype: Gtk.ListStore,
- id : "method-list-store",
- init : function()
- {
- XObject.prototype.init.call(this);
- this.el.set_column_types ( 6, [
- GObject.TYPE_STRING,
- GObject.TYPE_BOOLEAN,
- GObject.TYPE_BOOLEAN,
- GObject.TYPE_STRING,
- GObject.TYPE_STRING,
- GObject.TYPE_STRING
- ] );
-
- }
- }
- ]
- },
- {
- xtype: Gtk.TreeViewColumn,
- title : "Methods",
- expand : true,
- items : [
- {
- xtype: Gtk.CellRendererText
- }
- ]
- },
- {
- xtype: Gtk.TreeViewColumn,
- title : "Active",
- items : [
- {
- xtype: Gtk.CellRendererToggle,
- listeners : {
- toggled : function (self, path) {
- print("TOGGLE");
- // this.list
-
-
-
- var old = this.list.getValue(path, 1);
- // print(JSON.stringify(old));
- this.list.setValue(path, 1, old ? false : true)
-
-
-
-
- }
- },
- activatable : true
- }
- ]
- }
- ]
- }
- ]
- },
- {
- xtype: Gtk.ScrolledWindow,
- items : [
- {
- xtype: Gtk.TreeView,
- items : [
- {
- xtype: Gtk.TreeModelFilter,
- init : function() {
- this.items[0].pack = false;
- this.items[0].init();
- this.list = this.items[0];
- this.el = new Gtk.TreeModelFilter.c_new(this.items[0].el, null);
- this.el.set_visible_column(2);
- XObject.prototype.init.call(this);
-
- },
- items : [
- {
- xtype: Gtk.ListStore,
- id : "children-list-store",
- pack : false,
- init : function()
- {
- XObject.prototype.init.call(this);
- this.el.set_column_types ( 6, [
- GObject.TYPE_STRING,
- GObject.TYPE_BOOLEAN,
- GObject.TYPE_BOOLEAN,
- GObject.TYPE_STRING,
- GObject.TYPE_STRING,
- GObject.TYPE_STRING
- ] );
-
- }
- }
- ]
- },
- {
- xtype: Gtk.TreeViewColumn,
- title : "Child classes",
- expand : true,
- items : [
- {
- xtype: Gtk.CellRendererText
- }
- ]
- },
- {
- xtype: Gtk.TreeViewColumn,
- title : "Active",
- items : [
- {
- xtype: Gtk.CellRendererToggle,
- listeners : {
- toggled : function (self, path) {
- print("TOGGLE");
- // this.list
-
-
-
- var old = this.list.getValue(path, 1);
- // print(JSON.stringify(old));
- this.list.setValue(path, 1, old ? false : true)
-
-
-
-
- }
- },
- activatable : true
- }
- ]
- }
- ]
- }
- ]
- }
- ]
- }
- ]
- }
- ]
-});
-Window.init();
-XObject.cache['/Window'] = Window;