tools
[app.Builder.js] / Sample / RooProjectProperties.js
index fd757ad..24d90b3 100644 (file)
@@ -13,13 +13,50 @@ RooProjectProperties=new XObject({
     xtype: Gtk.Dialog,
     modal : true,
     show : function() {
+        // get the active project.
+        var file = this.get('/Window.LeftTree').getActiveFile();
+        if (!file) {
+            this.get('/StandardErrorDialog').show("No file is currently active");
+            return;
+        }
+        var project = this.get('/Window.LeftTree').getActiveFile().project;
+        //print (project.fn);
+        project.runhtml = project.runhtml || '';
+        this.get('view').el.get_buffer().set_text(project.runhtml, project.runhtml.length);
+        
         this.el.show_all();
     },
     default_width : 500,
     listeners : {
-        "delete_event":function (self, event) {
+        delete_event : function (self, event) {
             this.el.hide()
             return true;
+        },
+        response : function (self, response_id) {
+           print(response_id);
+           if (!response_id) {
+              this.el.hide();
+            
+              return;
+           }
+           var buf =    this.get('view').el.get_buffer()
+           var s = new Gtk.TextIter();
+            var e = new Gtk.TextIter();
+            buf.get_start_iter(s);
+            buf.get_end_iter(e);
+            var str = buf.get_text(s,e,true);
+            // ideally we should syntax check it.. but it's html!?
+            
+           var project = this.get('/Window.LeftTree').getActiveFile().project;
+           
+           
+           project.runhtml = str;
+           
+           imports.Builder.Provider.ProjectManager.ProjectManager.saveConfig();
+        //   print (str);
+           //    this.get('view').el.get_buffer().get_text(project.runjs, project.runjs.length);
+           // ok pressed..
+           this.el.hide();
         }
     },
     items : [
@@ -31,51 +68,32 @@ RooProjectProperties=new XObject({
                     },
             items : [
                 {
-                    xtype: Gtk.Table,
-                    pack : "pack_start,true,true,3",
-                    init : function() {
-                        this.el = new Gtk.Table.c_new(1,2, false);
-                        XObject.prototype.init.call(this);
-                    
-                    },
+                    xtype: Gtk.Label,
+                    pack : "pack_start,false,false,0",
+                    label : "HTML To insert at end of <HEAD>"
+                },
+                {
+                    xtype: Gtk.ScrolledWindow,
+                    pack : "pack_end,true,true,0",
                     items : [
                         {
-                            xtype: Gtk.Label,
-                            pack : "attach,0,1,0,1,0,0,0,0",
-                            label : "baseURL"
-                        },
-                        {
-                            xtype: Gtk.Entry,
-                            pack : "attach,1,2,0,1",
-                            listeners : {
-                                
-                            }
-                        },
-                        {
-                            xtype: Gtk.Label,
-                            pack : "attach,0,1,1,2,0,0,1,0",
-                            label : "login:"
-                        },
-                        {
-                            xtype: Gtk.Entry,
-                            pack : "attach,1,2,1,2",
-                            listeners : {
-                                
-                            }
-                        },
-                        {
-                            xtype: Gtk.Label,
-                            pack : "attach,0,1,2,3,0,0,1,0",
-                            label : "password"
-                        },
-                        {
-                            xtype: Gtk.Entry,
-                            pack : "attach,1,2,2,3",
-                            visibility : false
+                            xtype: GtkSource.View,
+                            pack : "add",
+                            id : "view"
                         }
                     ]
                 }
             ]
+        },
+        {
+            xtype: Gtk.Button,
+            pack : "add_action_widget,1",
+            label : "OK"
+        },
+        {
+            xtype: Gtk.Button,
+            pack : "add_action_widget,0",
+            label : "Cancel"
         }
     ]
 });