Builder4/WindowRooView.bjs.LHAHMX
authorAlan Knowles <alan@roojs.com>
Tue, 16 Sep 2014 12:10:43 +0000 (20:10 +0800)
committerAlan Knowles <alan@roojs.com>
Tue, 16 Sep 2014 12:10:43 +0000 (20:10 +0800)
Builder4/WindowRooView.bjs
Builder4/WindowRooView.js.DRFHMX
Builder4/WindowRooView.js
Builder4/WindowRooView.vala.HRMHMX
Builder4/WindowRooView.vala

Builder4/WindowRooView.bjs
Builder4/WindowRooView.js
Builder4/WindowRooView.vala

index f2e4b33..876f3fe 100644 (file)
@@ -85,7 +85,7 @@
                                     "# int redraws" : 0,
                                     "| void runRefresh" : " () \n{\n    // this is run every 2 seconds from the init..\n\n  \n    \n    if (!this.refreshRequired) {\n       // print(\"no refresh required\");\n        return;\n    }\n\n    if (this.lastRedraw != null) {\n       // do not redraw if last redraw was less that 5 seconds ago.\n       if ((int64)(new DateTime.now_local()).difference(this.lastRedraw) < 5000 ) {\n            return;\n        }\n    }\n    \n    if (_this.file == null) {\n        return;\n    }\n    \n    \n     this.refreshRequired = false;\n   //  print(\"HTML RENDERING\");\n     \n     \n     //this.get('/BottomPane').el.show();\n     //this.get('/BottomPane').el.set_current_page(2);// webkit inspector\n    _this.file.webkit_page_id  = this.el.get_page_id();\n    \n    var js = _this.file.toSourcePreview();\n\n    if (js.length < 1) {\n        print(\"no data\");\n        return;\n    }\n//    var  data = js[0];\n    this.redraws++;\n  \n    var project = _this.file.project;  \n\n     //print (project.fn);\n     // set it to non-empty.\n     \n//     runhtml = runhtml.length ?  runhtml : '<script type=\"text/javascript\"></script>'; \n\n\n//   this.runhtml  = this.runhtml || '';\n \n \n    // then we need to reload the browser using\n    // load_html_string..\n\n    // then trigger a redraw once it's loaded..\n    this.pendingRedraw = true;\n\n    var runhtml = \"<script type=\\\"text/javascript\\\">\\n\" ;\n    string builderhtml;\n    \n    \n    GLib.FileUtils.get_contents(Builder4.Application.configDirectory() + \"/resources/roo.builder.js\", out builderhtml);\n\n    runhtml += builderhtml + \"\\n\";\n    runhtml += \"</script>\\n\" ;\n\n    // fix to make sure they are the same..\n    this.runhtml = project.runhtml;\n    // need to modify paths\n\n    string inhtml;\n    var base_template = _this.file.project.base_template;\n    \n    if (base_template.length > 0 && !FileUtils.test(\n        Builder4.Application.configDirectory() + \"/resources/\" +  base_template, FileTest.EXISTS)  \n        ) {\n           print(\"invalid base_template name - using default:  %s\\n\", base_template);\n           base_template = \"\";\n    \n    }\n    \n    GLib.FileUtils.get_contents(\n        Builder4.Application.configDirectory() + \"/resources/\" + \n            (base_template.length > 0 ? base_template :  \"roo.builder.html\")\n            , out inhtml);\n    \n    \n    this.renderedData = js;\n\n\n    string js_src = js + \"\\n\" +\n\t\"Roo.onReady(function() {\\n\" +\n\t\"if (\" + _this.file.name +\".show) \" +  _this.file.name +\".show({});\\n\" +\n\t\"Roo.XComponent.build();\\n\" +\n\t\"});\\n\";\n\t\n    print(\"render js: \" + js);\n    //if (!this.ready) {\n  //      console.log('not loaded yet');\n    //}\n    this.lastRedraw = new DateTime.now_local();\n\n        var html = inhtml.replace(\"</head>\", runhtml + this.runhtml + \n        \n                \"<script type=\\\"text/javascript\\\">\\n\" +\n                js_src + \"\\n\" + \n                \"</script>\" + \n                        \n        \"</head>\");\n        print(\"LOAD HTML \" + html);\n        \n         var rootURL = _this.file.project.rootURL;\n   \n        \n        \n        this.el.load_html( html , \n            //fixme - should be a config option!\n            (rootURL.length > 0 ? rootURL : \"http://localhost/app.Builder/\")\n        );\n        \n    // force the inspector...        \n          this.initInspector();\n        \n        // - no need for this, the builder javascript will call it when build is complete\n        //GLib.Timeout.add_seconds(1, () => {\n        //    this.el.run_javascript(\"Builder.saveHTML()\",null);\n        //    return false;\n        //});\n//     print( \"before render\" +    this.lastRedraw);\n//    print( \"after render\" +    (new Date()));\n    \n}\n",
                                     "$ xns" : "WebKit",
-                                    "| void initInspector" : "() {\n    \n    if (this.inspector == this.el.get_inspector()) {\n        this.inspector.show();\n        this.inspector.open_window();        \n        print(\"init inspecter called, and inspector is the same as existing\\n\");\n        return;\n    }\n    print(\"new inspector?\\n\");\n\n    this.inspector = this.el.get_inspector();\n    this.inspector.ref();\n    \n    // got a new inspector...\n        \n    this.inspector.open_window.connect(() => {\n         this.inspector = this.el.get_inspector();\n        print(\"inspector attach\\n\");\n        var wv = this.inspector.get_web_view();\n        if (wv != null) {\n            print(\"got inspector web view\\n\");\n            _this.inspectorcontainer.el.add(wv);\n            wv.show();\n        } else {\n            //this.inspector.close();\n            while(Gtk.events_pending ()) {\n                Gtk.main_iteration ();\n            }\n            //this.inspector = null;\n            print(\"no web view yet\\n\");\n\n            \n             var settings =  this.el.get_settings();\n            settings.enable_developer_extras = false;\n            while(Gtk.events_pending ()) {\n                Gtk.main_iteration ();\n            }\n            settings =  this.el.get_settings();\n            settings.enable_developer_extras = true;\n            \n            \n            this.inspector = null;  \n            this.initInspector();\n            return true;\n        }\n        return true;\n       \n    });\n    this.inspector.closed.connect(() => {\n         print(\"inspector closed?!?\");\n         \n         //this.inspector = null;\n         for (var i = 0 ; i < 1000; i++) {\n            print(\"inspector closed ?!?!?\\n\");\n         }\n         var settings =  this.el.get_settings();\n         settings.enable_developer_extras = false;\n          while(Gtk.events_pending ()) {\n                Gtk.main_iteration ();\n            }\n          settings =  this.el.get_settings();\n         settings.enable_developer_extras = true;\n           this.inspector.show();  \n         //this.initInspector();\n       \n    }); \n    \n    this.inspector.show();\n}\n",
+                                    "| void initInspector" : "() {\n    \n    if (this.inspector == this.el.get_inspector()) {\n        this.inspector.show();\n        this.inspector.open_window();        \n        print(\"init inspecter called, and inspector is the same as existing\\n\");\n        return;\n    }\n    print(\"new inspector?\\n\");\n\n    this.inspector = this.el.get_inspector();\n    this.inspector.ref();\n    \n    // got a new inspector...\n        \n    this.inspector.open_window.connect(() => {\n         this.inspector = this.el.get_inspector();\n        print(\"inspector attach\\n\");\n        var wv = this.inspector.get_web_view();\n        if (wv != null) {\n            print(\"got inspector web view\\n\");\n            _this.inspectorcontainer.el.add(wv);\n            wv.show();\n        } else {\n            //this.inspector.close();\n            \n            //this.inspector = null;\n           for (var i = 0 ; i < 1000; i++) {\n                 print(\"no web view yet?!?!?\\n\");\n           }  \n \n        }\n        return true;\n       \n    });\n    this.inspector.closed.connect(() => {\n         print(\"inspector closed?!?\");\n         \n         //this.inspector = null;\n         for (var i = 0 ; i < 1000; i++) {\n            print(\"inspector closed ?!?!?\\n\");\n         }\n           \n         //this.initInspector();\n       \n    }); \n    \n    this.inspector.show();\n}\n",
                                     "# GLib.DateTime lastRedraw" : "null",
                                     "# string runhtml" : "\"\"",
                                     "# bool pendingRedraw" : false,
index 0d019a9..daccc1a 100644 (file)
@@ -315,25 +315,12 @@ WindowRooView=new XObject({
                                         wv.show();
                                     } else {
                                         //this.inspector.close();
-                                        while(Gtk.events_pending ()) {
-                                            Gtk.main_iteration ();
-                                        }
-                                        //this.inspector = null;
-                                        print("no web view yet\n");
-                            
-                                        
-                                         var settings =  this.el.get_settings();
-                                        settings.enable_developer_extras = false;
-                                        while(Gtk.events_pending ()) {
-                                            Gtk.main_iteration ();
-                                        }
-                                        settings =  this.el.get_settings();
-                                        settings.enable_developer_extras = true;
                                         
-                                        
-                                        this.inspector = null;  
-                                        this.initInspector();
-                                        return true;
+                                        //this.inspector = null;
+                                       for (var i = 0 ; i < 1000; i++) {
+                                             print("no web view yet?!?!?\n");
+                                       }  
+                             
                                     }
                                     return true;
                                    
@@ -345,14 +332,7 @@ WindowRooView=new XObject({
                                      for (var i = 0 ; i < 1000; i++) {
                                         print("inspector closed ?!?!?\n");
                                      }
-                                     var settings =  this.el.get_settings();
-                                     settings.enable_developer_extras = false;
-                                      while(Gtk.events_pending ()) {
-                                            Gtk.main_iteration ();
-                                        }
-                                      settings =  this.el.get_settings();
-                                     settings.enable_developer_extras = true;
-                                       this.inspector.show();  
+                                       
                                      //this.initInspector();
                                    
                                 }); 
index c83d8c5..127e88c 100644 (file)
@@ -575,25 +575,12 @@ public class Xcls_WindowRooView : Object
                     wv.show();
                 } else {
                     //this.inspector.close();
-                    while(Gtk.events_pending ()) {
-                        Gtk.main_iteration ();
-                    }
-                    //this.inspector = null;
-                    print("no web view yet\n");
-        
-                    
-                     var settings =  this.el.get_settings();
-                    settings.enable_developer_extras = false;
-                    while(Gtk.events_pending ()) {
-                        Gtk.main_iteration ();
-                    }
-                    settings =  this.el.get_settings();
-                    settings.enable_developer_extras = true;
                     
-                    
-                    this.inspector = null;  
-                    this.initInspector();
-                    return true;
+                    //this.inspector = null;
+                   for (var i = 0 ; i < 1000; i++) {
+                         print("no web view yet?!?!?\n");
+                   }  
+         
                 }
                 return true;
                
@@ -605,14 +592,7 @@ public class Xcls_WindowRooView : Object
                  for (var i = 0 ; i < 1000; i++) {
                     print("inspector closed ?!?!?\n");
                  }
-                 var settings =  this.el.get_settings();
-                 settings.enable_developer_extras = false;
-                  while(Gtk.events_pending ()) {
-                        Gtk.main_iteration ();
-                    }
-                  settings =  this.el.get_settings();
-                 settings.enable_developer_extras = true;
-                   this.inspector.show();  
+                   
                  //this.initInspector();
                
             });