Builder/Provider/File/Gtk.js
authorAlan Knowles <alan@akbkhome.com>
Tue, 23 Aug 2011 05:09:41 +0000 (13:09 +0800)
committerAlan Knowles <alan@akbkhome.com>
Tue, 23 Aug 2011 05:09:41 +0000 (13:09 +0800)
Builder/About.js
Builder/Provider/rooprops.json
Builder3/About.js
Builder3/DialogConfirm.js
Builder3/Editor.js
Builder3/RooProjectProperties.js
Builder3/StandardErrorDialog.js
JSDOC [new symlink]
JsParser.js [new file with mode: 0644]
gtkrun.js
install1.2.sh

index ee29392..4fc46b1 100644 (file)
@@ -8,6 +8,7 @@ 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;
 About=new XObject({
index c6c27ec..c88f3ec 100644 (file)
      "desc": "When used with {@link #url}, calls {@link #setUrl} with this value",
      "memberOf": ""
     },
+    {
+     "name": "content",
+     "type": "String",
+     "desc": "Raw content to fill content panel with (uses setContent on construction.)",
+     "memberOf": ""
+    },
     {
      "name": "listeners",
      "type": "Object",
      "desc": "When used with {@link #url}, calls {@link #setUrl} with this value",
      "memberOf": "Roo.ContentPanel"
     },
+    {
+     "name": "content",
+     "type": "String",
+     "desc": "Raw content to fill content panel with (uses setContent on construction.)",
+     "memberOf": "Roo.ContentPanel"
+    },
     {
      "name": "listeners",
      "type": "Object",
      "type": "function",
      "desc": "Fires when loading fails."
     },
+    {
+     "name": "preparedata",
+     "sig": "function (_self, data, row, record)\n{\n\n}",
+     "type": "function",
+     "desc": "Fires on every row to render, to allow you to change the data."
+    },
     {
      "name": "selectionchange",
      "sig": "function (_self, selections)\n{\n\n}",
     {
      "name": "resizeTabs",
      "type": "Boolean",
-     "desc": "True to enable automatic tab resizing. This will resize the tabs so they are all the same size and fit within\nthe space available, similar to FireFox 1.5 tabs (defaults to false)",
+     "desc": "True to enable automatic tab resizing. This will resize the tabs so they are all the same size and fit within\n                     the space available, similar to FireFox 1.5 tabs (defaults to false)",
      "memberOf": ""
     },
     {
      "desc": "To show the splitter",
      "memberOf": ""
     },
+    {
+     "name": "toolbar",
+     "type": "Boolean",
+     "desc": "xtype configuration for a toolbar - shows on right of tabbar",
+     "memberOf": ""
+    },
     {
      "name": "listeners",
      "type": "Object",
      "name": "removeMask",
      "type": "Boolean",
      "desc": "True to create a single-use mask that is automatically destroyed after loading (useful for page loads),\nFalse to persist the mask element reference for multiple uses (e.g., for paged data widgets).  Defaults to false.",
-     "memberOf": "Roo"
+     "memberOf": ""
     },
     {
      "name": "msg",
      "desc": "When used with {@link #url}, calls {@link #setUrl} with this value",
      "memberOf": "Roo.ContentPanel"
     },
+    {
+     "name": "content",
+     "type": "String",
+     "desc": "Raw content to fill content panel with (uses setContent on construction.)",
+     "memberOf": "Roo.ContentPanel"
+    },
     {
      "name": "listeners",
      "type": "Object",
      "name": "items",
      "type": "Roo.data.Store",
      "desc": "array of button configs or elements to add",
-     "memberOf": "Roo"
+     "memberOf": "Roo.Toolbar"
     }
    ],
    "events": []
      "name": "mode",
      "type": "String",
      "desc": "The shadow display mode.  Supports the following options:<br />\nsides: Shadow displays on both sides and bottom only<br />\nframe: Shadow displays equally on all four sides<br />\ndrop: Traditional bottom-right drop shadow (default)",
-     "memberOf": "Roo"
+     "memberOf": ""
     },
     {
      "name": "offset",
     {
      "name": "resizeTabs",
      "type": "Boolean",
-     "desc": "True to enable automatic tab resizing. This will resize the tabs so they are all the same size and fit within\nthe space available, similar to FireFox 1.5 tabs (defaults to false)",
+     "desc": "True to enable automatic tab resizing. This will resize the tabs so they are all the same size and fit within\n                     the space available, similar to FireFox 1.5 tabs (defaults to false)",
      "memberOf": "Roo.LayoutRegion"
     },
     {
      "desc": "To show the splitter",
      "memberOf": "Roo.LayoutRegion"
     },
+    {
+     "name": "toolbar",
+     "type": "Boolean",
+     "desc": "xtype configuration for a toolbar - shows on right of tabbar",
+     "memberOf": "Roo.LayoutRegion"
+    },
     {
      "name": "listeners",
      "type": "Object",
      "name": "items",
      "type": "Roo.data.Store",
      "desc": "array of button configs or elements to add",
-     "memberOf": "Roo"
+     "memberOf": ""
     },
     {
      "name": "container",
      "desc": "When used with {@link #url}, calls {@link #setUrl} with this value",
      "memberOf": "Roo.ContentPanel"
     },
+    {
+     "name": "content",
+     "type": "String",
+     "desc": "Raw content to fill content panel with (uses setContent on construction.)",
+     "memberOf": "Roo.ContentPanel"
+    },
     {
      "name": "listeners",
      "type": "Object",
      "type": "function",
      "desc": "Fires when a template node is double clicked."
     },
+    {
+     "name": "preparedata",
+     "sig": "function (_self, data, row, record)\n{\n\n}",
+     "type": "function",
+     "desc": "Fires on every row to render, to allow you to change the data."
+    },
     {
      "name": "selectionchange",
      "sig": "function (_self, selections)\n{\n\n}",
      "desc": "String to display while loading.",
      "memberOf": ""
     },
+    {
+     "name": "region",
+     "type": "String",
+     "desc": "Region to render component to (defaults to center)",
+     "memberOf": ""
+    },
     {
      "name": "items",
      "type": "Array",
      "desc": "A config object in the format: {field: \"fieldName\", direction: \"ASC|DESC\"}",
      "memberOf": "Roo.data.Store"
     },
+    {
+     "name": "multiSort",
+     "type": "Boolean",
+     "desc": "enable multi column sorting (sort is based on the order of columns, remote only at present)",
+     "memberOf": "Roo.data.Store"
+    },
     {
      "name": "remoteSort",
      "type": "boolean",
      "desc": "A config object in the format: {field: \"fieldName\", direction: \"ASC|DESC\"}",
      "memberOf": "Roo.data.Store"
     },
+    {
+     "name": "multiSort",
+     "type": "Boolean",
+     "desc": "enable multi column sorting (sort is based on the order of columns, remote only at present)",
+     "memberOf": "Roo.data.Store"
+    },
     {
      "name": "remoteSort",
      "type": "boolean",
      "desc": "A config object in the format: {field: \"fieldName\", direction: \"ASC|DESC\"}",
      "memberOf": ""
     },
+    {
+     "name": "multiSort",
+     "type": "Boolean",
+     "desc": "enable multi column sorting (sort is based on the order of columns, remote only at present)",
+     "memberOf": ""
+    },
     {
      "name": "remoteSort",
      "type": "boolean",
      "type": "String",
      "desc": "The default value for the create link prompt (defaults to http:/ /)",
      "memberOf": ""
+    },
+    {
+     "name": "resizable",
+     "type": "String",
+     "desc": "'s' or 'se' or 'e' - wrapps the element in a\n                       Roo.resizable.",
+     "memberOf": ""
+    },
+    {
+     "name": "height",
+     "type": "Number",
+     "desc": "(in pixels)",
+     "memberOf": ""
+    },
+    {
+     "name": "width",
+     "type": "Number",
+     "desc": "(in pixels)",
+     "memberOf": ""
     }
    ],
    "events": [
index 9a6e093..7becbf4 100644 (file)
@@ -7,6 +7,11 @@ GObject = imports.gi.GObject;
 GtkSource = imports.gi.GtkSource;
 WebKit = imports.gi.WebKit;
 Vte = imports.gi.Vte;
+<<<<<<< HEAD
+//GtkClutter = imports.gi.GtkClutter;
+//Gdl = imports.gi.Gdl;
+=======
+>>>>>>> 3b915ee311c6c2f49cc4f64e158b8f1c6fc7de4b
 console = imports.console;
 XObject = imports.XObject.XObject;
 About=new XObject({
index 70703ac..908bf69 100644 (file)
@@ -7,6 +7,8 @@ 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;
 DialogConfirm=new XObject({
index d9bd20b..9c4f0e1 100644 (file)
@@ -7,6 +7,10 @@ GObject = imports.gi.GObject;
 GtkSource = imports.gi.GtkSource;
 WebKit = imports.gi.WebKit;
 Vte = imports.gi.Vte;
+<<<<<<< HEAD
+//GtkClutter = imports.gi.GtkClutter;
+=======
+>>>>>>> 3b915ee311c6c2f49cc4f64e158b8f1c6fc7de4b
  console = imports.console;
 XObject = imports.XObject.XObject;
 Editor=new XObject({
index 6db9a8d..e3ad358 100644 (file)
@@ -7,6 +7,10 @@ GObject = imports.gi.GObject;
 GtkSource = imports.gi.GtkSource;
 WebKit = imports.gi.WebKit;
 Vte = imports.gi.Vte;
+<<<<<<< HEAD
+//GtkClutter = imports.gi.GtkClutter;
+=======
+>>>>>>> 3b915ee311c6c2f49cc4f64e158b8f1c6fc7de4b
 //Gdl = imports.gi.Gdl;
 console = imports.console;
 XObject = imports.XObject.XObject;
index a12c6d5..704bffe 100644 (file)
@@ -7,6 +7,8 @@ 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;
 StandardErrorDialog=new XObject({
diff --git a/JSDOC b/JSDOC
new file mode 120000 (symlink)
index 0000000..64bd7b5
--- /dev/null
+++ b/JSDOC
@@ -0,0 +1 @@
+../gnome.introspection-doc-generator/JSDOC
\ No newline at end of file
diff --git a/JsParser.js b/JsParser.js
new file mode 100644 (file)
index 0000000..b0dcb8b
--- /dev/null
@@ -0,0 +1,566 @@
+//<script type="text/javscript">
+
+XObject = imports.XObject.XObject;
+console     = imports.console.console;
+Collapse = imports.JSDOC.Collapse.Collapse;
+/**
+ * 
+ * this takes our collased file, and turns it into the config array..
+ * 
+ * @see rconv.js (our tester file)
+ * 
+ * STATUS:
+ *
+ *  - Pman.Tab.* appears to work.
+ * .. next up ..Dialog...
+ *
+ *
+ *
+ * Current issues:
+ *  - xtype is combined on generated files. (not xns + xtype)
+ *  - listeners are prefixed with '|' ... 
+ *
+ * 
+ */
+
+RooFile  =  XObject.define(
+    function (ar)
+    {
+        RooFile.superclass.constructor.call(this, ar);
+       // console.log("STARTING OUTPUT");
+        
+         
+
+    },
+    Collapse, 
+    {
+        
+        cfg : { },
+
+        parse: function()
+        {
+            // standard pman dialog
+            if (this.tokens[0].data == 'Pman.on') {
+                this.parsePmanLayout();
+                return;
+            }
+         
+            
+            // Standard Pman Dialog - 
+            if (this.tokens[2].props && typeof(this.tokens[2].props.create) != 'undefined') {
+                this.parsePmanDialog();
+                return;
+            }
+            
+            
+            // Seed Gtk XObject application. 
+            if (this.tokens.length > 2 && this.tokens[2].data.match(/^imports\./)) {
+                this.parseXObject();
+                return;
+            }
+            
+            Seed.print("Unknown format");
+            Seed.print(JSON.stringify(this.tokens,null,4));
+            Seed.quit();
+            
+            
+            
+            
+            
+            
+            
+            
+            // perfect for dialogs... - is this our 'generic, non-pman code?'
+            
+            
+            var pos = this.lookFor( 'function');
+            
+            // XXXXX = function(
+            var cfg = {};
+            
+            if (pos > -1 && (this.tokens[pos-1].data == '=') && (this.tokens[pos-2].type == 'NAME')) {
+                
+                this.cfg = {
+                    '*class' : this.tokens[pos-2].data,
+                    '*extends' : '',
+                    '//constructor' :  this.tokens[pos-2].prefix,
+                    '|constructor' : 'function ' + this.tokens[pos+1].toRaw() + 
+                            this.tokens[pos+2].toRaw()
+                    
+                };
+                this.cursor = pos+2;
+                
+            }
+            
+            if (pos < 0) {
+                // no function - we have a static one...
+                pos = this.lookFor( '=');
+                if (pos > 1 && 
+                    (this.tokens[pos-1].type == 'NAME') &&
+                    (this.tokens[pos+1].data == '{')
+                ) {
+                    this.cfg = {
+                        '*class' : this.tokens[pos-1].data,
+                        '//*class' :  this.tokens[pos-1].prefix
+                        
+                        
+                    };
+                    XObject.extend(this.cfg, this.parseProps(this.tokens[pos+1].props));
+                    return;
+                    
+                }
+                
+                
+                
+            }
+            
+            
+              // Roo.apply (l
+            var pos = this.lookFor( 'Roo.apply');
+            //console.dump(this.tokens);
+            
+            
+            if (
+                (pos > -1) &&
+                (this.tokens[pos+1].items[0][0].data  == this.cfg['*class'] + '.prototype')
+            ) {
+                // XXXXXx.prototype = {
+                
+                
+                    
+                XObject.extend(this.cfg, this.parseProps(this.tokens[pos+1].items[1][0].props));
+                return;
+                
+            }
+            
+            
+            var pos = this.lookFor('new');
+            
+            if (pos > -1 && 
+                (this.tokens[pos-2].type == 'NAME') &&
+                (this.tokens[pos-1].data == '=') && 
+                (this.tokens[pos+1].type == 'NAME') &&
+                (this.tokens[pos+2].data == '(') 
+            ) {
+                
+                this.cfg = {
+                    '//*class' : this.tokens[pos-2].prefix,
+                    '*class' : this.tokens[pos-2].data,
+                    '*extends' : this.tokens[pos+1].data
+                };
+                    
+                XObject.extend(this.cfg, this.parseProps(this.tokens[pos+2].items[0][0].props));
+                
+                return;
+                
+            }
+            
+            ///Builder.Provider.ProjectManager = new Roo.Observable({
+                
+            
+            
+            var pos = this.lookFor( 'Roo.extend');
+            if (pos > -1) {
+                
+                this.cfg['*extends'] = this.tokens[pos+1].items[1][0].data;
+                XObject.extend(this.cfg, this.parseProps(this.tokens[pos+1].items[2][0].props));
+                
+                // no more..
+                return;
+            }
+            
+             
+                
+            var pos = this.lookFor( 'Roo.extend');
+            if (pos > -1) {
+                
+                this.cfg['*extends'] = this.tokens[pos+1].items[1][0].data;
+                XObject.extend(this.cfg, this.parseProps(this.tokens[pos+1].items[2][0].props));
+                
+                // no more..
+                return;
+            }
+            
+            
+            
+            //console.dump(cfg);
+            //Seed.quit();
+            
+            
+            
+            // other type of layout
+          //  console.dump(this.tokens);
+            
+            // this type of file..
+            // xxxx.xxx = function
+            // -> into |constructor..
+            // -> extend + prototype
+             
+            
+            
+                
+        },
+        
+        
+        parsePmanLayout : function()
+        {
+                // then it's a layout style..
+            
+            //Seed.quit();
+            
+            
+            //console.dump(this.tokens);
+            //              the list of statements inside of function..?
+            
+            
+            var stmts =  this.tokens[1].items[1][2].items;
+            
+            // look for register..
+            var topp = false;
+            stmts.map( function(s, i) {
+                if (s[0].data == 'Pman.register') {
+                    topp = brace = s[1].items[0][0].props;
+                }
+            });
+            if (!topp) {
+                console.dump(this.tokens);
+                throw "could not find top props...";
+                
+            }
+            
+            this.cfg = this.parseProps(topp);
+            this.cfg.name = this.tokens[3].data;
+            
+            
+            //                  (            {          add    { this.panel (  {
+            var cfg = this.tokens[7].items[0][0].props.add.val[2].items[2][3].items[0][0].props;
+            this.cfg.items = [ this.parseProps(cfg) ];
+            //console.dump(this.cfg); 
+        },
+        
+        
+        parsePmanDialog : function() {
+            
+            //console.dump(this.tokens);
+            this.cfg.name = this.tokens[0].data;
+            
+            
+            
+            var cfg = this.tokens[2].props.create.val[2].items[1][3].items[0][0].props;
+            //console.dump(this.tokens);
+            //print(JSON.stringify(cfg,null,4)); Seed.quit();
+            
+           // print("Trying standard dialog");Seed.quit();;
+            
+            this.cfg.items = [ this.parseProps(cfg) ];
+            return;
+            
+        },
+        
+        // Seed xobject file.
+        parseXObject : function() {
+            
+            this.parseImports();
+              
+            var pos = this.lookFor('XObject');
+            if (pos < 0)  {
+                throw "Can not find XObject";
+            }
+            this.cfg.name = this.tokens[pos-3].data;
+            
+            var cfg = this.tokens[pos+1].items[0][0].props;
+            this.cfg.items = [ this.parseProps(cfg) ];
+            
+            //print(JSON.stringify(this.tokens[pos]));
+            
+            //print(JSON.stringify(this.tokens,null,4)); Seed.quit();
+            //Seed.quit();
+            
+        },
+        
+        
+        
+        /**
+         *  parse Imports lines.
+         *
+         */
+        
+        parseImports : function()
+        {
+           // console.dump(this.tokens);
+            this.cfg.giImports = [];
+            this.cfg.imports= [];
+            while (true) {
+                var pos = this.lookFor('=');
+                if (pos < 0)  {
+                    break;
+                }
+                this.cursor = pos;
+                var k = this.look(-1, true);
+                var v = this.look(1, true);
+               // Seed.print(k.data + " => " + v.data);
+               
+                /// finish!!! - not an import ...
+               
+                if (!v.data.match(/^imports/)) {
+                    return; ///
+                    
+                    this.cursor++;
+                    continue;
+                }
+                if (v.data.match(/^imports\.gi/)) {
+                    // gi import..
+                    this.cfg.giImports.push(v.data.replace(/imports\.gi\./, ''));
+                    
+                    this.cursor++;
+                    continue;
+                }
+                  
+                // two types of import left
+                // imports.xnew
+                if (v.data.match(/^imports\./)) {
+                    this.cfg.imports[k.data] = v.data.replace(/imports\./, '') + '.js';
+                    this.cursor++;
+                    continue;
+                }
+                // imports[.....]
+                this.cursor++;
+                if (this.lookFor('[') > this.lookFor('=')) {
+                    continue;
+                }
+                var bpos = this.lookFor('[');
+               // console.dump(this.tokens[bpos]);
+                
+                this.cfg.imports[k.data] = this.tokens[bpos].items[0][0].toJS();
+                
+                this.cursor++;
+                
+            }
+        //    console.dump(this.giImports);
+          //  console.dump(this.imports);
+            //Seed.quit();
+            
+        },
+        
+        ///------------------- GENERIC PARSING ------------------
+        
+        
+        
+        
+        
+        
+        parseProps:  function(o)
+        {
+            //print(JSON.stringify(o,null,4));
+            
+            var ret = { };
+            var fakeItems =  [];
+            for(var k in o) {
+                
+                //print( "parsing prop: " + k);
+                if (o[k].key.data == '}') {
+                    // typo trailing comma in object def.
+                    continue;
+                }
+                
+                var kv = k;
+                if (o[k].key.type == 'STRN') {
+                    kv = o[k].key.toJS();
+                }
+                if (!o[k].val.length) {
+                    console.dump(o[k]);
+                }
+                
+                //console.dump(o[k]);
+                if (o[k].val[0].data == "function") {
+                    // add comments..
+                  //   console.dump(o[k].key.prefix); 
+                    var pr = typeof(o[k].key.prefix) == 'undefined' ? '' : o[k].key.prefix ;
+                    pr = this.clean_prefix( pr) ;
+                    if (pr.length) {
+                        ret['//' +kv ] =  pr;
+                    }
+                    //print("running expand");
+                    ret['|' +kv ] =  this.clean_body( this.expand(o[k].val));
+                    continue;
+                }
+                
+                
+                if (o[k].val[0].data == "[") {
+                    
+                    if (o[k].val[0].items[0][0].data == '{') {
+                        // array of objects..
+                        
+                        // this works for items..
+                        
+                        // used elsewhere for buttons: -> in which case we have a fake xtype
+                        
+                        
+                        
+                        // if K is not ITEMS - we need to add '*prop' -> and add it to the items array..
+                        var add = this.parseArray(o[k].val[0].items);
+                        if (kv == 'items') {
+                            ret[kv] = add;
+                            continue;
+                        }
+                        var fake_array = {
+                            xtype : 'Array.' + kv,
+                            '*prop' : kv,
+                            items : add
+                        }
+                        fakeItems.push(fake_array);
+                        continue;
+                    } 
+                    // raw array 
+                    
+                    
+                    ret['|' +kv ] =  this.clean_body(this.expand(o[k].val)); // remove ','...
+                    continue;
+                }
+                if (o[k].val[0].data == "(") {
+                    ret['|' +kv ] =  this.expand(o[k].val);
+                    continue;
+                }
+                // value is an object..
+                
+                if (o[k].val[0].data == "{") {
+                    
+                    // things that can be property of object type:
+                    // listeners, set, 
+                    var add = this.parseProps(o[k].val[0].props);
+                    
+                    
+                    
+                    if (kv == 'set' || kv =='listeners') {
+                        ret[kv ] = add;
+                        continue;
+                    }
+                    if ((typeof(add.xtype) != 'undefined') ||  ['sortInfo', 'center', 'east', 'west', 'north', 'south'].indexOf(kv) > -1) {
+                        add['*prop'] =  kv;
+                        fakeItems.push(add);
+                        continue;
+                    }
+                    
+                    
+                    ret[ '|' + kv ] =  this.expand(o[k].val);
+                    
+                    
+                    // this hsould be added to 'items', with a *prop element..
+                    continue;
+                }
+                //console.dump(o[k].val);
+                
+                if (o[k].val[1].data == ',' || o[k].val[1].data == '}') {
+                    // single item piece of data...
+                    var t1= o[k].val[0];
+                    switch(o[k].val[0].type) {
+                        case 'STRN':
+                        case 'NUMB':
+                        case 'KEYW':
+                            ret[  kv ]  = t1.toJS();
+                            continue;
+                        case 'NAME':
+                            ret[ '|' + kv ] =  t1.data;
+                            continue;
+                        
+                    }
+                }
+               
+                ret[ '|' + kv ] =  this.expand(o[k].val);
+                
+            }
+            if (!ret.items && fakeItems.length) {
+                ret.items = [];
+            }
+            fakeItems.forEach(  function(e) {
+                ret.items.push(e);
+            });
+            // merge fakeItems;
+            //console.dump(ret);
+            
+            return ret;
+        },
+        parseArray: function(ar) {
+          // console.dump(ar);
+           // Seed.quit();
+            var ret = [];
+            ar.map(function (e) {
+                // has no props...
+                if (typeof(e[0].props) == 'undefined') {
+                    return;
+                }
+               
+                
+                ret.push( this.parseProps(e[0].props));
+                     
+            },this);
+             
+            return ret;
+          
+        },
+        
+        /**
+         * convert a function call token array back into a string
+         */
+        expand: function(ar)
+        {
+            var ret = '';
+            //print(JSON.stringify(ar,null,4));
+            
+            for(var i =0 ; i < ar.length -1; i++) {
+                ret += ar[i].toRaw();
+            }
+            
+            return ret;
+            
+            
+        },
+        
+        /***
+         * change the indentation on a function 
+         *
+         */
+        clean_body : function(str)
+        {
+            var lns = str.split("\n");
+            var mindent = -1;
+            lns.map( function(l, i) {
+                if (!i || !l.length || l.match(/^\s+$/)) {
+                    return;
+                }
+                
+                var spc = l.match(/\s+/);
+                if (!spc || !spc[0].length) {
+                    return;
+                }
+                mindent = mindent < 0 ? spc[0].length : Math.min(spc[0].length, mindent);
+                
+            });
+            //console.log(mindent + ":" + lns[0]);
+            var ar = [];
+            if (mindent < 0) {
+                return str;
+            }
+            lns.map( function(l,i) {
+                if (!i) {
+                    ar.push(l.replace(/^\s+/, ''));
+                    return;
+                }
+                ar.push(l.substring(mindent));
+            });
+            return ar.join("\n");
+        },
+        clean_prefix: function(str) {
+            
+            
+            
+            if (!str.length) {
+                return '';
+            }
+            var ret = str.replace(/^\s+/gm, "\n").replace(/\n+/gm, "\n");
+            return ret == "\n" ? '' : ret;
+            
+        }    
+             
+    
+});
\ No newline at end of file
index 5095531..fc8a962 100644 (file)
--- a/gtkrun.js
+++ b/gtkrun.js
@@ -48,9 +48,15 @@ Vte         = imports.gi.Vte;
 
 //GtkClutter  = imports.gi.GtkClutter;
 
+<<<<<<< HEAD
+//if (GtkClutter) {    
+//    GtkClutter.init(Seed.argv);
+//}
+=======
 if (typeof(GtkClutter) != 'undefined') {    
     GtkClutter.init(Seed.argv);
 }
+>>>>>>> 3b915ee311c6c2f49cc4f64e158b8f1c6fc7de4b
 
 File    = imports.File.File;
 
index 54bef1f..e70a069 100644 (file)
@@ -1,10 +1,18 @@
 #!/bin/sh
+<<<<<<< HEAD
+#git clone git://github.com/roojs/gir-1.2-gtk-2.0.git gir-1.2
+=======
 #git clone git://github.com/roojs/gir-1.2-gtk-3.0.git gir-1.2
+>>>>>>> 3b915ee311c6c2f49cc4f64e158b8f1c6fc7de4b
 
 #// compile GIR's
 mkdir -p ~/.Builder/girepository-1.2 || false
  
+<<<<<<< HEAD
+=======
  
+>>>>>>> 3b915ee311c6c2f49cc4f64e158b8f1c6fc7de4b
 ls gir-1.2 | sed s/.gir// | awk \
     '{ print "g-ir-compiler  gir-1.2/" $1 ".gir --includedir=gir-1.2 -o  ~/.Builder/girepository-1.2/" $1 ".typelib" }' \
     | sh -x