change to BuilderApplication
authorAlan Knowles <alan@akbkhome.com>
Sun, 8 Feb 2015 11:17:32 +0000 (19:17 +0800)
committerAlan Knowles <alan@akbkhome.com>
Sun, 8 Feb 2015 11:17:32 +0000 (19:17 +0800)
src/Application.vala
src/Builder4/WindowLeftTree.bjs
src/Builder4/WindowLeftTree.vala
src/Builder4/WindowRightPalete.bjs
src/Builder4/WindowRightPalete.vala
src/Builder4/WindowRooView.bjs
src/Builder4/WindowRooView.vala
src/Palete/Gir.vala
src/Palete/Gtk.vala
src/Palete/Roo.vala

index cce3342..d8a520a 100644 (file)
@@ -1,8 +1,5 @@
 
-
-namespace Builder4
-{
-
        public class AppSettings : Object
        {
 
@@ -19,7 +16,7 @@ namespace Builder4
                public static AppSettings factory()
                {
                         
-                       var setting_file = Application.configDirectory() + "/builder.settings";
+                       var setting_file = BuilderApplication.configDirectory() + "/builder.settings";
                        
                        if (!FileUtils.test(setting_file, FileTest.EXISTS)) {
                                 return new AppSettings();
@@ -41,9 +38,9 @@ namespace Builder4
        }
        
        
-       public static Application application = null;
+       public static BuilderApplication application = null;
        
-       public class Application : Gtk.Application
+       public class BuilderApplication : Gtk.Application
        {
                enum Target {
                    INT32,
@@ -62,7 +59,7 @@ namespace Builder4
                public AppSettings settings = null;
 
        
-               public Application ()
+               public BuilderApplication ()
                {
                        Object(
                               application_id: "org.roojs.app-builder",
@@ -79,10 +76,10 @@ namespace Builder4
 
 
                
-               public static Application  singleton()
+               public static BuilderApplication  singleton()
                {
                        if (application==null) {
-                               application = new Application();
+                               application = new BuilderApplication();
  
                        
                        }
@@ -173,7 +170,4 @@ namespace Builder4
        
        
 
-
-               
-       
-}
\ No newline at end of file
index 77fb761..2a026a7 100644 (file)
@@ -2,14 +2,14 @@
     "name" : "WindowLeftTree",
     "parent" : "",
     "title" : "",
-    "path" : "/home/alan/gitlive/app.Builder.js/Builder4/WindowLeftTree.bjs",
+    "path" : "/home/alan/gitlive/app.Builder.js/src/Builder4/WindowLeftTree.bjs",
     "permname" : "",
     "modOrder" : "",
     "items" : [
         {
             "|           JsRender.Node? getActiveElement" : " () { // return path to actie node.\n\n     var path = this.getActivePath();\n     if (path.length < 1) {\n        return null;\n     }\n     return _this.model.pathToNode(path);\n     \n}\n",
-            "id" : "WindowLeftTree",
             "@ bool before_node_change" : "(JsRender.Node? node)",
+            "id" : "WindowLeftTree",
             "$ shadow_type" : "Gtk.ShadowType.IN",
             "* init" : " this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n \n",
             "|           JsRender.JsRender getActiveFile" : "() {\n    return this.model.file;\n}\n",
@@ -24,8 +24,8 @@
                 {
                     "listeners" : {
                         "button_press_event" : "  ( ev) => {\n    //console.log(\"button press?\");\n    if (! _this.before_node_change(null) ) {\n       return true;\n    }\n\n    \n    if (ev.type != Gdk.EventType.BUTTON_PRESS  || ev.button != 3) {\n        //print(\"click\" + ev.type);\n        return false;\n    }\n    Gtk.TreePath res;\n    if (!_this.view.el.get_path_at_pos((int)ev.x,(int)ev.y, out res, null, null, null) ) {\n        return true;\n    }\n     \n    this.el.get_selection().select_path(res);\n     \n      //if (!this.get('/LeftTreeMenu').el)  { \n      //      this.get('/LeftTreeMenu').init(); \n      //  }\n        \n     _this.LeftTreeMenu.el.set_screen(Gdk.Screen.get_default());\n     _this.LeftTreeMenu.el.show_all();\n      _this.LeftTreeMenu.el.popup(null, null, null,  3, ev.time);\n     //   print(\"click:\" + res.path.to_string());\n      return true;\n}",
-                        "drag_begin" : "( ctx)  => {\n\t//print('SOURCE: drag-begin');\n        \n        \n        //this.targetData = \"\";\n        \n        // find what is selected in our tree...\n        \n        var s = _this.view.el.get_selection();\n        if (s.count_selected_rows() < 1) {\n            return;\n        }\n        Gtk.TreeIter iter;\n        Gtk.TreeModel mod;\n        s.get_selected(out mod, out iter);\n\n        \n\n        // set some properties of the tree for use by the dropped element.\n        GLib.Value value;\n        _this.model.el.get_value(iter, 2, out value);\n        var tp = mod.get_path(iter).to_string();\n        var data = (JsRender.Node)(value.dup_object());\n        var xname = data.fqn();\n        print (\"XNAME  IS \" + xname+ \"\\n\");\n        this.dragData = tp;\n        this.dropList = _this.model.file.palete().getDropList(xname);\n        \n        print (\"DROP LIST IS \" + string.joinv(\", \", this.dropList) + \"\\n\");\n        \n\n        // make the drag icon a picture of the node that was selected\n    \n        \n    // by default returns the path..\n       var path = _this.model.el.get_path(iter);\n\n         \n        var pix = this.el.create_row_drag_icon ( path);\n        \n        Gtk.drag_set_icon_surface (ctx, pix) ;\n        \n        return;\n}",
                         "cursor_changed" : " ( ) => {\n\n\n     if (this.blockChanges) { // probably not needed.. \n       return  ;\n     }\n      if (!_this.before_node_change(null) ) {\n\t     this.blockChanges = true;\n\t     this.el.get_selection().unselect_all();\n\t     this.blockChanges = false;\n\t     return;\n     }\n     if (_this.model.file == null) {\n         return;\n     } \n     \n     //var render = this.get('/LeftTree').getRenderer();                \n    print(\"LEFT TREE -> view -> selection changed called\\n\");\n    \n    \n    // -- it appears that the selection is not updated.\n    \n    GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {\n         \n\n            if (this.el.get_selection().count_selected_rows() < 1) {\n\n                print(\"selected rows < 1\\n\");\n                //??this.model.load( false);\n                _this.node_selected(null);\n                \n                return false ;\n            }\n                \n                //console.log('changed');\n            var s = this.el.get_selection();\n             Gtk.TreeIter iter;\n             Gtk.TreeModel mod;\n            s.get_selected(out mod, out iter);\n            \n            \n            // var val = \"\";\n            GLib.Value value;\n            _this.model.el.get_value(iter, 2, out value);\n            _this.model.activePath = mod.get_path(iter).to_string();\n            \n            var node = (JsRender.Node)value.dup_object();\n            _this.node_selected(node);\n            return false;\n      });  \n    //_this.after_node_change(node);\n\n//        _this.model.file.changed(node, \"tree\");\n   \n    //Seed.print( value.get_string());\n    return  ;\n                \n}",
+                        "drag_begin" : "( ctx)  => {\n\t//print('SOURCE: drag-begin');\n        \n        \n        //this.targetData = \"\";\n        \n        // find what is selected in our tree...\n        \n        var s = _this.view.el.get_selection();\n        if (s.count_selected_rows() < 1) {\n            return;\n        }\n        Gtk.TreeIter iter;\n        Gtk.TreeModel mod;\n        s.get_selected(out mod, out iter);\n\n        \n\n        // set some properties of the tree for use by the dropped element.\n        GLib.Value value;\n        _this.model.el.get_value(iter, 2, out value);\n        var tp = mod.get_path(iter).to_string();\n        var data = (JsRender.Node)(value.dup_object());\n        var xname = data.fqn();\n        print (\"XNAME  IS \" + xname+ \"\\n\");\n        this.dragData = tp;\n        this.dropList = _this.model.file.palete().getDropList(xname);\n        \n        print (\"DROP LIST IS \" + string.joinv(\", \", this.dropList) + \"\\n\");\n        \n\n        // make the drag icon a picture of the node that was selected\n    \n        \n    // by default returns the path..\n       var path = _this.model.el.get_path(iter);\n\n         \n        var pix = this.el.create_row_drag_icon ( path);\n        \n        Gtk.drag_set_icon_surface (ctx, pix) ;\n        \n        return;\n}",
                         "drag_end" : "  (drag_context) => {\n\t//Seed.print('LEFT-TREE: drag-end');\n        this.dragData = \"\";\n        this.dropList = null;\n//        this.targetData = \"\";\n        this.highlightDropPath(\"\",0);\n//        return true;\n}",
                         "drag_motion" : " ( ctx, x, y, time)  => {\n   print(\"got drag motion\\n\");\n    var src = Gtk.drag_get_source_widget(ctx);\n   this.drag_x = x;\n   this.drag_y = y;     \n\n   if (src != this.el) {\n   \n \n \n    // the point of this is to detect where an item could be dropped..\n        print(\"requesting drag data\\n\");\n       this.drag_in_motion = true;\n       \n            // request data that will be recieved by the recieve...              \n        Gtk.drag_get_data\n        (\n                this.el,         // will receive 'drag-data-received' signal \n                ctx,        // represents the current state of the DnD \n                Gdk.Atom.intern(\"STRING\",true),    // the target type we want \n                time            // time stamp \n        );\n        return true;\n  }    \n\n\n  print(\"action: %d\\n\", ctx.get_actions());\n //print(\"GETTING POS\");\n    var  targetData = \"\";\n\n    Gtk.TreePath path;\n    Gtk.TreeViewDropPosition pos;\n    var isOver = _this.view.el.get_dest_row_at_pos(this.drag_x,this.drag_y, out path, out pos);\n\n    // if there are not items in the tree.. the we have to set isOver to true for anything..\n    var isEmpty = false;\n    if (_this.model.el.iter_n_children(null) < 1) {\n        print(\"got NO children?\\n\");\n        isOver = true; //??? \n        isEmpty = true;\n        pos = Gtk.TreeViewDropPosition.INTO_OR_AFTER;\n    }\n\n\n    // ------------- a drag from self..\n\n\n    //var action = Gdk.DragAction.COPY;\n        // unless we are copying!!! ctl button..\n    \n    var action = (ctx.get_actions() & Gdk.DragAction.MOVE) > 0 ?\n                 Gdk.DragAction.COPY  : Gdk.DragAction.MOVE ;\n                // Gdk.DragAction.MOVE : Gdk.DragAction.COPY ;\n\n\n    if (_this.model.el.iter_n_children(null) < 1) {\n        // no children.. -- asume it's ok..\n        \n        targetData = \"|%d|\".printf((int)Gtk.TreeViewDropPosition.INTO_OR_AFTER);\n           \n        this.highlightDropPath(\"\", (Gtk.TreeViewDropPosition)0);        \n        Gdk.drag_status(ctx, action ,time);\n        return true;\n        \n        // continue through to allow drop...\n\n    } \n        \n        \n\n    \n    \n    //print(\"ISOVER? \" + isOver);\n    if (!isOver) {\n  \n        Gdk.drag_status(ctx, 0 ,time);\n         this.highlightDropPath(\"\", (Gtk.TreeViewDropPosition)0);                    \n         return false;\n\n    }\n            \n    // drag node is parent of child..\n    //console.log(\"SRC TREEPATH: \" + src.treepath);\n    //console.log(\"TARGET TREEPATH: \" + data.path.to_string());\n    \n    // nned to check a  few here..\n    //Gtk.TreeViewDropPosition.INTO_OR_AFTER\n    //Gtk.TreeViewDropPosition.INTO_OR_BEFORE\n    //Gtk.TreeViewDropPosition.AFTER\n    //Gtk.TreeViewDropPosition.BEFORE\n    \n    // locally dragged items to not really use the \n    var selection_text = this.dragData;\n    \n            \n            \n    if (selection_text == null || selection_text.length < 1) {\n                //print(\"Error  - drag selection text returned NULL\");\n             Gdk.drag_status(ctx, 0 ,time);\n            this.highlightDropPath(\"\", (Gtk.TreeViewDropPosition)0);\n             return false;\n     }\n                       \n            \n            // see if we are dragging into ourself?\n    var target_path = path.to_string();            \n    print (\"Drag  %s onto %s--%d\\n \", selection_text, target_path, pos);\n    \n    // pos : 3 = ontop - 0 = after, 1 = before\n    //print(\"target_path=\"+target_path);\n\n    // \n    if (selection_text  == target_path) {\n        print(\"self drag ?? == we should perhaps allow copy onto self..\\n\");\n                \n         Gdk.drag_status(ctx, 0 ,time);\n          this.highlightDropPath(\"\", (Gtk.TreeViewDropPosition)0);\n          return false;\n//                 -- fixme -- this is not really correct..\n\n    }\n            \n    // check that \n    //print(\"DUMPING DATA\");\n    //console.dump(data);\n    // path, pos\n    \n    //print(data.path.to_string() +' => '+  data.pos);\n    \n    // dropList is a list of xtypes that this node could be dropped on.\n    // it is set up when we start to drag..\n    \n    \n    targetData = _this.model.findDropNodeByPath( path.to_string(), this.dropList, pos);\n        \n    print(\"targetDAta: \" + targetData +\"\\n\");\n    \n    if (targetData.length < 1) {\n        //print(\"Can not find drop node path\");\n       \n        Gdk.drag_status(ctx, 0, time);\n        this.highlightDropPath(\"\", (Gtk.TreeViewDropPosition)0);\n        return false;\n    }\n    \n    var td_ar = targetData.split(\"|\");\n      \n    \n\n    Gdk.drag_status(ctx, action ,time);\n    this.highlightDropPath(td_ar[0], (Gtk.TreeViewDropPosition)int.parse(td_ar[1]));\n    return true;\n       \n       \n}",
                         "drag_data_get" : "( drag_context, data, info, time) => {\n            \n            \n                 //print(\"drag-data-get\");\n                 var s = this.el.get_selection();\n                 if (s.count_selected_rows() < 1) {\n                        data.set_text(\"\",0);     \n                         print(\"return empty string - no selection..\");\n                        return;\n                    }\n                 \n                 Gtk.TreeIter iter;\n                 Gtk.TreeModel mod;\n                 \n                 s.get_selected(out mod, out iter);\n                 \n                \n                \n                 GLib.Value value;\n                 _this.model.el.get_value(iter, 2, out value);\n                 var ndata = (JsRender.Node)(value.dup_object());\n                 var xname = ndata.fqn();\n                \n                \n                var tp = mod.get_path(iter).to_string();\n                // by default returns the path..\n                \n               if ( info != Gdk.Atom.intern(\"STRING\",true) ) {\n                    tp = ndata.toJsonString();\n               }   \n               \n               //data.set_text(tp,tp.length);   \n                \n                data.set (data.get_target (), 8, (uchar[]) tp.to_utf8 ());\n            \n                \n               //  print(\"return \" + tp);\n            }",
                         "drag_drop" : " (  ctx, x, y, time)  => {\n      //Seed.print(\"TARGET: drag-drop\");\n   \n   \n    var src = Gtk.drag_get_source_widget(ctx);\n     \n   if (src != this.el) {\n   \n    \n       \n       this.drag_in_motion = false;   \n            // request data that will be recieved by the recieve...              \n        Gtk.drag_get_data\n        (\n                this.el,         // will receive 'drag-data-received' signal \n                ctx,        // represents the current state of the DnD \n                Gdk.Atom.intern(\"application/json\",true),    // the target type we want \n                time            // time stamp \n        );\n\n         \n        // No target offered by source => error\n   \n\n         return  false;\n     }\n     \n     // handle drop around self..\n     \n                  \n            \n    //print(\"GETTING POS\");\n    var  targetData = \"\";\n    \n    Gtk.TreePath path;\n    Gtk.TreeViewDropPosition pos;\n    var isOver = _this.view.el.get_dest_row_at_pos(this.drag_x,this.drag_y, out path, out pos);\n    \n    // if there are not items in the tree.. the we have to set isOver to true for anything..\n    var isEmpty = false;\n    if (_this.model.el.iter_n_children(null) < 1) {\n        print(\"got NO children?\\n\");\n        isOver = true; //??? \n        isEmpty = true;\n        pos = Gtk.TreeViewDropPosition.INTO_OR_AFTER;\n    }\n    \n     \n     \n    //var action = Gdk.DragAction.COPY;\n        // unless we are copying!!! ctl button..\n    \n    var action = (ctx.get_actions() & Gdk.DragAction.MOVE) > 0 ?\n                 Gdk.DragAction.COPY  : Gdk.DragAction.MOVE ;\n                // Gdk.DragAction.MOVE : Gdk.DragAction.COPY ;\n\n      \n    if (_this.model.el.iter_n_children(null) < 1) {\n        // no children.. -- asume it's ok..\n        \n        targetData = \"|%d|\".printf((int)Gtk.TreeViewDropPosition.INTO_OR_AFTER);\n         \n        // continue through to allow drop...\n\n    } else {\n                \n                \n    \n                \n                \n                //print(\"ISOVER? \" + isOver);\n        if (!isOver) {\n            \n            Gtk.drag_finish (ctx, false, false, time);        // drop failed..\n            return true; // not over apoint!?! - no action on drop or motion..\n        }\n                \n        // drag node is parent of child..\n        //console.log(\"SRC TREEPATH: \" + src.treepath);\n        //console.log(\"TARGET TREEPATH: \" + data.path.to_string());\n        \n        // nned to check a  few here..\n        //Gtk.TreeViewDropPosition.INTO_OR_AFTER\n        //Gtk.TreeViewDropPosition.INTO_OR_BEFORE\n        //Gtk.TreeViewDropPosition.AFTER\n        //Gtk.TreeViewDropPosition.BEFORE\n        \n        // locally dragged items to not really use the \n        var selection_text = this.dragData;\n        \n        \n        \n        if (selection_text == null || selection_text.length < 1) {\n            //print(\"Error  - drag selection text returned NULL\");\n          \n             Gtk.drag_finish (ctx, false, false, time);        // drop failed..\n             return true; /// -- fixme -- this is not really correct..\n        }                \n                \n                // see if we are dragging into ourself?\n                print (\"got selection text of  \" + selection_text);\n        \n        var target_path = path.to_string();\n        //print(\"target_path=\"+target_path);\n\n        // \n        if (selection_text  == target_path) {\n            print(\"self drag ?? == we should perhaps allow copy onto self..\\n\");\n            \n             Gtk.drag_finish (ctx, false, false, time);        // drop failed..\n\n             return true; /// -- fixme -- this is not really correct..\n\n        }\n                \n        // check that \n        //print(\"DUMPING DATA\");\n        //console.dump(data);\n        // path, pos\n        \n        //print(data.path.to_string() +' => '+  data.pos);\n        \n        // dropList is a list of xtypes that this node could be dropped on.\n        // it is set up when we start to drag..\n        \n        \n        targetData = _this.model.findDropNodeByPath( path.to_string(), this.dropList, pos);\n            \n        print(\"targetDAta: \" + targetData +\"\\n\");\n        \n        if (targetData.length < 1) {\n            //print(\"Can not find drop node path\");\n             \n            Gtk.drag_finish (ctx, false, false, time);        // drop failed..\n            return true;\n        }\n        \n        var td_ar = targetData.split(\"|\");\n                  \n                \n                \n                // continue on to allow drop..\n  }\n        // at this point, drag is not in motion... -- as checked above... - so it's a real drop event..\n\n\n     var delete_selection_data = false;\n        \n    if (action == Gdk.DragAction.ASK)  {\n        /* Ask the user to move or copy, then set the ctx action. */\n    }\n\n    if (action == Gdk.DragAction.MOVE) {\n        delete_selection_data = true;\n    }\n      \n                // drag around.. - reorder..\n    _this.model.moveNode(targetData, action);\n        \n       \n        \n        \n        \n        // we can send stuff to souce here...\n\n\n// do we always say failure, so we handle the reall drop?\n    Gtk.drag_finish (ctx, false, false,time); //delete_selection_data, time);\n\n    return true;\n \n \n \n \n \n \n}"
                     },
                     "# string dragData" : "",
-                    "# int drag_x" : "",
                     "# string[] dropList" : "",
+                    "# int drag_x" : "",
                     "id" : "view",
                     "gboolean headers_visible" : true,
                     "# int drag_y" : "",
-                    "* init" : "{\n    var description = new Pango.FontDescription();\n    description.set_size(8000);\n    this.el.modify_font(description);\n\n    var selection = this.el.get_selection();\n    selection.set_mode( Gtk.SelectionMode.SINGLE);\n\n\n    // is this really needed??\n    /*\n    this.selection.signal['changed'].connect(function() {\n\t    _this.get('/LeftTree.view').listeners.cursor_changed.apply(\n\t        _this.get('/LeftTree.view'), [ _this.get('/LeftTree.view'), '']\n\t    );\n    });\n    */\n    Gtk.drag_source_set (\n\t    this.el,            /* widget will be drag-able */\n\t    Gdk.ModifierType.BUTTON1_MASK,       /* modifier that will start a drag */\n\t    Builder4.Application.targetList,            /* lists of target to support */\n\t    Gdk.DragAction.COPY   | Gdk.DragAction.MOVE    |  Gdk.DragAction.LINK           /* what to do with data after dropped */\n    );\n\n    // ?? needed??\n    //Gtk.drag_source_add_text_targets(this.el); \n\n    Gtk.drag_dest_set\n    (\n        this.el,              /* widget that will accept a drop */\n        Gtk.DestDefaults.MOTION  | Gtk.DestDefaults.HIGHLIGHT,\n        Builder4.Application.targetList,            /* lists of target to support */\n        Gdk.DragAction.COPY   | Gdk.DragAction.MOVE   | Gdk.DragAction.LINK     /* what to do with data after dropped */\n    );\n\n    //Gtk.drag_dest_set_target_list(this.el, Builder.Application.targetList);\n    //Gtk.drag_dest_add_text_targets(this.el);\n}\n",
+                    "* init" : "{\n    var description = new Pango.FontDescription();\n    description.set_size(8000);\n    this.el.modify_font(description);\n\n    var selection = this.el.get_selection();\n    selection.set_mode( Gtk.SelectionMode.SINGLE);\n\n\n    // is this really needed??\n    /*\n    this.selection.signal['changed'].connect(function() {\n\t    _this.get('/LeftTree.view').listeners.cursor_changed.apply(\n\t        _this.get('/LeftTree.view'), [ _this.get('/LeftTree.view'), '']\n\t    );\n    });\n    */\n    Gtk.drag_source_set (\n\t    this.el,            /* widget will be drag-able */\n\t    Gdk.ModifierType.BUTTON1_MASK,       /* modifier that will start a drag */\n\t    BuilderApplication.targetList,            /* lists of target to support */\n\t    Gdk.DragAction.COPY   | Gdk.DragAction.MOVE    |  Gdk.DragAction.LINK           /* what to do with data after dropped */\n    );\n\n    // ?? needed??\n    //Gtk.drag_source_add_text_targets(this.el); \n\n    Gtk.drag_dest_set\n    (\n        this.el,              /* widget that will accept a drop */\n        Gtk.DestDefaults.MOTION  | Gtk.DestDefaults.HIGHLIGHT,\n        BuilderApplication.targetList,            /* lists of target to support */\n        Gdk.DragAction.COPY   | Gdk.DragAction.MOVE   | Gdk.DragAction.LINK     /* what to do with data after dropped */\n    );\n\n    //Gtk.drag_dest_set_target_list(this.el, Builder.Application.targetList);\n    //Gtk.drag_dest_add_text_targets(this.el);\n}\n",
                     "tooltip_column" : 1,
                     "* pack" : "add",
                     "xtype" : "TreeView",
@@ -52,8 +52,8 @@
                     "items" : [
                         {
                             "|           string findDropNode" : " (string treepath_str, string[] targets) {\n\n    // this is used by the dragdrop code in the roo version AFAIR..\n\n    //var path = treepath_str.replace(/^builder-/, '');\n    // treemap is depreciated... - should really check if model has any entries..\n\n    if (this.el.iter_n_children(null) < 1) {\n        //print(\"NO KEYS\");\n        return \"|%d\".printf((int)Gtk.TreeViewDropPosition.INTO_OR_AFTER);\n    }\n    //print(\"FIND treepath: \" + path);\n    //console.dump(this.treemap);\n    \n    //if (!treepath_str.match(/^builder-/)) {\n    //    return []; // nothing!\n    //}\n    if (targets.length > 0 && targets[0] == \"*\") {\n        return  treepath_str;\n    }\n    return this.findDropNodeByPath(treepath_str,targets, -1);\n}\n",
-                            "currentTree" : false,
                             "id" : "model",
+                            "currentTree" : false,
                             "# DialogTemplateSelect template_select" : "null",
                             "* init" : "print(\"model initialized\");\n\n",
                             "|           void loadFile" : "(JsRender.JsRender f) {\n    //console.dump(f);\n    this.el.clear();\n    this.file = f;\n    \n    \n//    if (!f) {\n//        console.log('missing file');\n//        return;\n//    }\n    \n    // load the file if not loaded..\n    if (f.tree == null) {\n        f.loadItems( );\n    }\n    // if it's still null?\n    if (f.tree == null) {\n        return;\n    }\n    \n    /// this.get('/Window').setTitle(f.project.getName() + ' - ' + f.name);\n    \n    //if (f.items.length && typeof(f.items[0]) == 'string') {\n    \n        //this.get('/RightEditor').el.show();\n        //this.get('/RightEditor.view').load( f.items[0]);\n    //    return;\n    //}\n    //print(\"LOAD\");\n    //print(JSON.stringify(f.items, null,4));\n    //console.dump(f.items);\n    var o = new Gee.ArrayList<JsRender.Node>();\n    o.add(f.tree);\n    this.load(o,null);\n    \n    _this.view.el.expand_all();\n\n    if (f.tree.items.size < 1) {\n        // single item..\n        \n        //this.get('/Window.leftvpaned').el.set_position(80);\n        // select first...\n        _this.view.el.set_cursor( \n            new  Gtk.TreePath.from_string(\"0\"), null, false);\n        \n        \n    } else {\n          //this.get('/Window.leftvpaned').el.set_position(200);\n    }\n    \n    return;\n    /*    \n    \n    //print(\"hide right editior\");\n    //this.get('/RightEditor').el.hide();\n    //this.get('/Editor').el.hide();\n    //print(\"set current tree\");\n    //this.currentTree = this.toJS(false, false)[0];\n    //console.dump(this.currentTree);\n    //this.currentTree = this.currentTree || { items: [] };\n    //_this.renderView();\n    //console.dump(this.map);\n    //var RightPalete     = imports.Builder.RightPalete.RightPalete;\n    \n    \n    var pm = this.get('/RightPalete.model');\n    // set up provider..\n    \n    this.get('/RightPalete').provider = this.get('/LeftTree').getPaleteProvider();\n    \n    if (!this.get('/RightPalete').provider) {\n        print (\"********* PALETE PROVIDER MISSING?!!\");\n    }\n    this.get('/LeftTree').renderView();\n    \n    pm.load( this.get('/LeftTree').getPaleteProvider().gatherList(this.listAllTypes()));\n    \n    \n            \n    this.get('/Window.view-notebook').el.set_current_page(\n        this.get('/LeftTree.model').file.getType()== 'Roo' ? 0 : -1);\n        */\n            \n}\n",
@@ -83,8 +83,8 @@
                             "items" : [
                                 {
                                     "id" : "renderer",
-                                    "xtype" : "CellRendererText",
                                     "* pack" : "pack_start,true",
+                                    "xtype" : "CellRendererText",
                                     "$ xns" : "Gtk"
                                 }
                             ]
@@ -93,8 +93,8 @@
                 },
                 {
                     "id" : "LeftTreeMenu",
-                    "xtype" : "Menu",
                     "* pack" : false,
+                    "xtype" : "Menu",
                     "$ xns" : "Gtk",
                     "items" : [
                         {
                                 "activate" : "  ( ) => {\n    \n    print(\"ACTIVATE?\");\n    \n  \n     _this.model.deleteSelected();\n}"
                             },
                             "label" : "Delete Element",
-                            "xtype" : "MenuItem",
                             "* pack" : "add",
+                            "xtype" : "MenuItem",
                             "$ xns" : "Gtk"
                         },
                         {
                                 "activate" : "  () => {\n\n     DialogSaveTemplate.singleton().show(\n            (Gtk.Window) _this.el.get_toplevel (), \n            _this.model.file.palete(), \n            _this.getActiveElement()\n    );\n     \n    \n}"
                             },
                             "label" : "Save as Template",
-                            "xtype" : "MenuItem",
                             "* pack" : "add",
+                            "xtype" : "MenuItem",
                             "$ xns" : "Gtk"
                         },
                         {
                                 "activate" : "  () => {\n    var node = _this.getActiveElement();\n     var name = DialogSaveModule.singleton().show(\n            (Gtk.Window) _this.el.get_toplevel (), \n            _this.model.file.project, \n            node\n     );\n     if (name.length < 1) {\n            return;\n  \n     }\n     node.props.set(\"* xinclude\", name);\n     node.items.clear();\n\n\n    var s = _this.view.el.get_selection();\n    \n    print(\"GET  SELECTED?\");\n    Gtk.TreeIter iter;\n    Gtk.TreeModel mod;\n\n    \n    if (!s.get_selected(out mod, out iter)) {\n        return; // nothing seleted..\n    }\n    Gtk.TreeIter citer;\n    var n_cn = mod.iter_n_children(iter) -1;\n    for (var i = n_cn; i > -1; i--) {\n        mod.iter_nth_child(out citer, iter, i);\n        \n\n        print(\"removing node from Tree\\n\");    \n    \n        _this.model.el.remove(ref citer);\n    }\n    _this.changed();\n    _this.node_selected(node);\n     \n    \n}"
                             },
                             "label" : "Save as Module",
-                            "xtype" : "MenuItem",
                             "* pack" : "add",
+                            "xtype" : "MenuItem",
                             "$ xns" : "Gtk"
                         }
                     ]
index 8018e8e..b56a57c 100644 (file)
@@ -76,8 +76,8 @@ public class Xcls_WindowLeftTree : Object
 
             // my vars (def)
         public string dragData;
-        public int drag_x;
         public string[] dropList;
+        public int drag_x;
         public int drag_y;
         public bool drag_in_motion;
         public bool blockChanges;
@@ -125,7 +125,7 @@ public class Xcls_WindowLeftTree : Object
                 Gtk.drag_source_set (
                    this.el,            /* widget will be drag-able */
                    Gdk.ModifierType.BUTTON1_MASK,       /* modifier that will start a drag */
-                   Builder4.Application.targetList,            /* lists of target to support */
+                   BuilderApplication.targetList,            /* lists of target to support */
                    Gdk.DragAction.COPY   | Gdk.DragAction.MOVE    |  Gdk.DragAction.LINK           /* what to do with data after dropped */
                 );
             
@@ -136,7 +136,7 @@ public class Xcls_WindowLeftTree : Object
                 (
                     this.el,              /* widget that will accept a drop */
                     Gtk.DestDefaults.MOTION  | Gtk.DestDefaults.HIGHLIGHT,
-                    Builder4.Application.targetList,            /* lists of target to support */
+                    BuilderApplication.targetList,            /* lists of target to support */
                     Gdk.DragAction.COPY   | Gdk.DragAction.MOVE   | Gdk.DragAction.LINK     /* what to do with data after dropped */
                 );
             
@@ -172,50 +172,6 @@ public class Xcls_WindowLeftTree : Object
                  //   print("click:" + res.path.to_string());
                   return true;
             });
-            this.el.drag_begin.connect( ( ctx)  => {
-               //print('SOURCE: drag-begin');
-                    
-                    
-                    //this.targetData = "";
-                    
-                    // find what is selected in our tree...
-                    
-                    var s = _this.view.el.get_selection();
-                    if (s.count_selected_rows() < 1) {
-                        return;
-                    }
-                    Gtk.TreeIter iter;
-                    Gtk.TreeModel mod;
-                    s.get_selected(out mod, out iter);
-            
-                    
-            
-                    // set some properties of the tree for use by the dropped element.
-                    GLib.Value value;
-                    _this.model.el.get_value(iter, 2, out value);
-                    var tp = mod.get_path(iter).to_string();
-                    var data = (JsRender.Node)(value.dup_object());
-                    var xname = data.fqn();
-                    print ("XNAME  IS " + xname+ "\n");
-                    this.dragData = tp;
-                    this.dropList = _this.model.file.palete().getDropList(xname);
-                    
-                    print ("DROP LIST IS " + string.joinv(", ", this.dropList) + "\n");
-                    
-            
-                    // make the drag icon a picture of the node that was selected
-                
-                    
-                // by default returns the path..
-                   var path = _this.model.el.get_path(iter);
-            
-                     
-                    var pix = this.el.create_row_drag_icon ( path);
-                    
-                    Gtk.drag_set_icon_surface (ctx, pix) ;
-                    
-                    return;
-            });
             this.el.cursor_changed.connect( ( ) => {
             
             
@@ -274,6 +230,50 @@ public class Xcls_WindowLeftTree : Object
                 return  ;
                             
             });
+            this.el.drag_begin.connect( ( ctx)  => {
+               //print('SOURCE: drag-begin');
+                    
+                    
+                    //this.targetData = "";
+                    
+                    // find what is selected in our tree...
+                    
+                    var s = _this.view.el.get_selection();
+                    if (s.count_selected_rows() < 1) {
+                        return;
+                    }
+                    Gtk.TreeIter iter;
+                    Gtk.TreeModel mod;
+                    s.get_selected(out mod, out iter);
+            
+                    
+            
+                    // set some properties of the tree for use by the dropped element.
+                    GLib.Value value;
+                    _this.model.el.get_value(iter, 2, out value);
+                    var tp = mod.get_path(iter).to_string();
+                    var data = (JsRender.Node)(value.dup_object());
+                    var xname = data.fqn();
+                    print ("XNAME  IS " + xname+ "\n");
+                    this.dragData = tp;
+                    this.dropList = _this.model.file.palete().getDropList(xname);
+                    
+                    print ("DROP LIST IS " + string.joinv(", ", this.dropList) + "\n");
+                    
+            
+                    // make the drag icon a picture of the node that was selected
+                
+                    
+                // by default returns the path..
+                   var path = _this.model.el.get_path(iter);
+            
+                     
+                    var pix = this.el.create_row_drag_icon ( path);
+                    
+                    Gtk.drag_set_icon_surface (ctx, pix) ;
+                    
+                    return;
+            });
             this.el.drag_end.connect( (drag_context) => {
                //Seed.print('LEFT-TREE: drag-end');
                     this.dragData = "";
index dadd559..69ed9db 100644 (file)
@@ -2,7 +2,7 @@
     "name" : "WindowRightPalete",
     "parent" : "",
     "title" : "",
-    "path" : "/home/alan/gitlive/app.Builder.js/Builder4/WindowRightPalete.bjs",
+    "path" : "/home/alan/gitlive/app.Builder.js/src/Builder4/WindowRightPalete.bjs",
     "permname" : "",
     "modOrder" : "",
     "items" : [
@@ -19,8 +19,8 @@
             "items" : [
                 {
                     "id" : "viewbox",
-                    "* pack" : "add",
                     "xtype" : "VBox",
+                    "* pack" : "add",
                     "$ xns" : "Gtk",
                     "items" : [
                         {
@@ -38,7 +38,7 @@
                                         "drag_data_get" : "(drag_context, selection_data, info, time) => {\n \t//Seed.print('Palete: drag-data-get: ' + target_type);\n    if (this.dragData.length < 1 ) {\n        return; \n    }\n    \n    print(\"setting drag data to %s\\n\", this.dragData);\n   // selection_data.set_text(this.dragData ,this.dragData.length);\n   selection_data.set (selection_data.get_target (), 8, (uchar[]) this.dragData.to_utf8 ());\n\n        //this.el.dragData = \"TEST from source widget\";\n        \n        \n}"
                                     },
                                     "# string dragData" : "",
-                                    "* init" : " {\n    this.el.set_size_request(150,-1);\n                          //  set_reorderable: [1]\n                                  \n    var description = new Pango.FontDescription();\n    description.set_size(8000);\n    this.el.modify_font(description);\n    \n    var selection = this.el.get_selection();\n    selection.set_mode( Gtk.SelectionMode.SINGLE);\n   // this.selection.signal['changed'].connect(function() {\n    //    _view.listeners['cursor-changed'].apply(_view, [ _view, '']);\n    //});\n    // see: http://live.gnome.org/GnomeLove/DragNDropTutorial\n     \n    Gtk.drag_source_set (\n            this.el,            /* widget will be drag-able */\n            Gdk.ModifierType.BUTTON1_MASK,       /* modifier that will start a drag */\n            Builder4.Application.targetList,            /* lists of target to support */\n            Gdk.DragAction.COPY         /* what to do with data after dropped */\n    );\n    //Gtk.drag_source_set_target_list(this.el, LeftTree.targetList);\n   \n   // Gtk.drag_source_set_target_list(this.el, Application.targetList);\n   // Gtk.drag_source_add_text_targets(this.el); \n \n}\n",
+                                    "* init" : " {\n    this.el.set_size_request(150,-1);\n                          //  set_reorderable: [1]\n                                  \n    var description = new Pango.FontDescription();\n    description.set_size(8000);\n    this.el.modify_font(description);\n    \n    var selection = this.el.get_selection();\n    selection.set_mode( Gtk.SelectionMode.SINGLE);\n   // this.selection.signal['changed'].connect(function() {\n    //    _view.listeners['cursor-changed'].apply(_view, [ _view, '']);\n    //});\n    // see: http://live.gnome.org/GnomeLove/DragNDropTutorial\n     \n    Gtk.drag_source_set (\n            this.el,            /* widget will be drag-able */\n            Gdk.ModifierType.BUTTON1_MASK,       /* modifier that will start a drag */\n            BuilderApplication.targetList,            /* lists of target to support */\n            Gdk.DragAction.COPY         /* what to do with data after dropped */\n    );\n    //Gtk.drag_source_set_target_list(this.el, LeftTree.targetList);\n   \n   // Gtk.drag_source_set_target_list(this.el, Application.targetList);\n   // Gtk.drag_source_add_text_targets(this.el); \n \n}\n",
                                     "xtype" : "TreeView",
                                     "* pack" : "add",
                                     "$ enable_tree_lines" : true,
                                         },
                                         {
                                             "* init" : " this.el.add_attribute(_this.txtrender.el , \"markup\", 0 );\n \n",
-                                            "* pack" : "append_column",
                                             "xtype" : "TreeViewColumn",
+                                            "* pack" : "append_column",
                                             "$ xns" : "Gtk",
                                             "items" : [
                                                 {
                                                     "id" : "txtrender",
-                                                    "xtype" : "CellRendererText",
                                                     "* pack" : "pack_start,true",
+                                                    "xtype" : "CellRendererText",
                                                     "$ xns" : "Gtk"
                                                 }
                                             ]
index 6868f74..b23f017 100644 (file)
@@ -159,7 +159,7 @@ public class Xcls_RightPalete : Object
                 Gtk.drag_source_set (
                         this.el,            /* widget will be drag-able */
                         Gdk.ModifierType.BUTTON1_MASK,       /* modifier that will start a drag */
-                        Builder4.Application.targetList,            /* lists of target to support */
+                        BuilderApplication.targetList,            /* lists of target to support */
                         Gdk.DragAction.COPY         /* what to do with data after dropped */
                 );
                 //Gtk.drag_source_set_target_list(this.el, LeftTree.targetList);
index 5324a6f..4ad2162 100644 (file)
@@ -2,14 +2,14 @@
     "name" : "WindowRooView",
     "parent" : "",
     "title" : "",
-    "path" : "/home/alan/gitlive/app.Builder.js/Builder4/WindowRooView.bjs",
+    "path" : "/home/alan/gitlive/app.Builder.js/src/Builder4/WindowRooView.bjs",
     "permname" : "",
     "modOrder" : "",
     "items" : [
         {
             "id" : "WindowRooView",
-            "| void createThumb" : "() {\n    \n    \n    if (this.file == null) {\n        return;\n    }\n    var filename = this.file.getIconFileName(false);\n    \n    var  win = this.el.get_parent_window();\n    var width = win.get_width();\n    var height = win.get_height();\n\n    Gdk.Pixbuf screenshot = Gdk.pixbuf_get_from_window(win, 0, 0, width, this.el.position);\n\n    screenshot.save(filename,\"png\");\n    return;\n    \n    \n    \n    \n    \n    \n    \n    var p = new WebKit.PrintOperation(_this.view.el);\n     \n    var ps = new Gtk.PrintSettings();\n    ps.set_printer(\"Print to File\");\n    ps.set(\"output-file-format\", \"pdf\");\n    ps.set(\"output-uri\", \"file://\" + filename + \".pdf\");\n\n    // find the printer...\n    \n    /*\n    var ar = Gtk.PaperSize.get_paper_sizes(false);\n    var psetup = new Gtk.PageSetup();\n    for(var i = 0; i < ar.length(); i++) {\n        if (ar.nth_data(i).get_name() ==\"iso_a4\") {\n            psetup.set_paper_size(ar.nth_data(i));\n        }\n    }\n    psetup.set_orientation(Gtk.PageOrientation.LANDSCAPE);\n    \n     \n    p.set_page_setup(psetup);\n    */\n    p.set_print_settings(ps);\n    \n    p.finished.connect(() => {\n        print(\"creating thumbnail for \" + filename + \".pdf\\n\"); \n        var s = new Cairo.PdfSurface(filename + \".pdf\", 400,400);\n    \n        s.write_to_png (filename);\n        \n       // var f = GLib.File.new_for_path (filename + \".pdf\");\n       // f.delete();\n    });\n    \n    \n    p.print();\n    \n    // should we hold until it's printed...\n    \n      \n\n    \n    \n\n\n    \n     \n}\n",
             "| void loadFile" : "(JsRender.JsRender file)\n{\n    this.file = file;\n    this.view.renderJS(true);\n}",
+            "| void createThumb" : "() {\n    \n    \n    if (this.file == null) {\n        return;\n    }\n    var filename = this.file.getIconFileName(false);\n    \n    var  win = this.el.get_parent_window();\n    var width = win.get_width();\n    var height = win.get_height();\n\n    Gdk.Pixbuf screenshot = Gdk.pixbuf_get_from_window(win, 0, 0, width, this.el.position);\n\n    screenshot.save(filename,\"png\");\n    return;\n    \n    \n    \n    \n    \n    \n    \n    var p = new WebKit.PrintOperation(_this.view.el);\n     \n    var ps = new Gtk.PrintSettings();\n    ps.set_printer(\"Print to File\");\n    ps.set(\"output-file-format\", \"pdf\");\n    ps.set(\"output-uri\", \"file://\" + filename + \".pdf\");\n\n    // find the printer...\n    \n    /*\n    var ar = Gtk.PaperSize.get_paper_sizes(false);\n    var psetup = new Gtk.PageSetup();\n    for(var i = 0; i < ar.length(); i++) {\n        if (ar.nth_data(i).get_name() ==\"iso_a4\") {\n            psetup.set_paper_size(ar.nth_data(i));\n        }\n    }\n    psetup.set_orientation(Gtk.PageOrientation.LANDSCAPE);\n    \n     \n    p.set_page_setup(psetup);\n    */\n    p.set_print_settings(ps);\n    \n    p.finished.connect(() => {\n        print(\"creating thumbnail for \" + filename + \".pdf\\n\"); \n        var s = new Cairo.PdfSurface(filename + \".pdf\", 400,400);\n    \n        s.write_to_png (filename);\n        \n       // var f = GLib.File.new_for_path (filename + \".pdf\");\n       // f.delete();\n    });\n    \n    \n    p.print();\n    \n    // should we hold until it's printed...\n    \n      \n\n    \n    \n\n\n    \n     \n}\n",
             "* pack" : "add",
             "xtype" : "VPaned",
             "# JsRender.JsRender file" : "",
             "items" : [
                 {
                     "id" : "viewbox",
-                    "* pack" : "pack1,true,true",
                     "xtype" : "VBox",
+                    "* pack" : "pack1,true,true",
                     "$ xns" : "Gtk",
                     "$ homogeneous" : false,
                     "items" : [
                         {
                             "$ vexpand" : false,
-                            "$ height_request" : 20,
                             "* pack" : "pack_start,false,true,0",
+                            "$ height_request" : 20,
                             "xtype" : "HBox",
                             "$ xns" : "Gtk",
                             "$ homogeneous" : true,
@@ -36,8 +36,8 @@
                                         "clicked" : "( ) => {\n    _this.view.renderJS(  true);\n}"
                                     },
                                     "label" : "Redraw",
-                                    "xtype" : "Button",
                                     "* pack" : "pack_start,false,false,0",
+                                    "xtype" : "Button",
                                     "$ xns" : "Gtk"
                                 },
                                 {
                                         "clicked" : " () => {\n  _this.view.redraws = 99;\n    _this.view.el.web_context.clear_cache();  \n  _this.view.renderJS(true);\n\n}"
                                     },
                                     "label" : "Full Redraw",
-                                    "xtype" : "Button",
                                     "* pack" : "pack_start,false,false,0",
+                                    "xtype" : "Button",
                                     "$ xns" : "Gtk"
                                 }
                             ]
                         },
                         {
                             "id" : "viewcontainer",
-                            "* init" : "  this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n \n",
                             "$ shadow_type" : "Gtk.ShadowType.IN",
+                            "* init" : "  this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n \n",
                             "* pack" : "pack_end,true,true,0",
                             "xtype" : "ScrolledWindow",
                             "$ xns" : "Gtk",
@@ -85,7 +85,7 @@
                                     "xtype" : "WebView",
                                     "# WebKit.WebInspector inspector" : "",
                                     "# 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",
+                                    "| 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(BuilderApplication.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        BuilderApplication.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        BuilderApplication.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            \n            //this.inspector = null;\n           \n \n        }\n        return true;\n       \n    });\n    this.inspector.closed.connect(() => {\n         print(\"inspector closed?!?\");\n         // if this happens destroy the webkit..\n         // recreate it..\n         this.el.stop_loading();\n         \n         if (_this.viewbox.el.get_parent() == null) {\n            return;\n         }\n         \n         \n        _this.viewbox.el.remove(_this.viewcontainer.el);\n        _this.el.remove(_this.inspectorcontainer.el);        \n         \n         // destory seems to cause problems.\n         //this.el.destroy();\n        //_this.viewcontainer.el.destroy();\n         //_this.inspectorcontainer.el.destroy();\n\n         this.el = null;         \n         var nv =new Xcls_viewcontainer(_this);\n         nv.ref();\n         _this.viewbox.el.pack_end(nv.el,true,true,0);\n         \n          var  inv =new Xcls_inspectorcontainer(_this);\n          inv.ref();\n          _this.el.pack2(inv.el,true,true);\n         \n         inv.el.show_all();\n         nv.el.show_all();\n         //while(Gtk.events_pending ()) Gtk.main_iteration ();\n         //_this.view.renderJS(true); \n         _this.view.refreshRequired  = true;\n       \n    }); \n    \n    this.inspector.show();\n}\n",
                                     "# GLib.DateTime lastRedraw" : "null",
@@ -99,8 +99,8 @@
                 },
                 {
                     "id" : "inspectorcontainer",
-                    "* init" : "  this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n \n",
                     "$ shadow_type" : "Gtk.ShadowType.IN",
+                    "* init" : "  this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n \n",
                     "xtype" : "ScrolledWindow",
                     "* pack" : "pack2,true,true",
                     "$ xns" : "Gtk"
index b1ecb77..75a3984 100644 (file)
@@ -39,6 +39,11 @@ public class Xcls_WindowRooView : Object
     }
 
     // user defined functions 
+    public void loadFile (JsRender.JsRender file)
+    {
+        this.file = file;
+        this.view.renderJS(true);
+    }
     public void createThumb () {
         
         
@@ -109,11 +114,6 @@ public class Xcls_WindowRooView : Object
     
         
          
-    }
-    public void loadFile (JsRender.JsRender file)
-    {
-        this.file = file;
-        this.view.renderJS(true);
     }
     public void requestRedraw () {
         this.view.renderJS(false);
@@ -490,7 +490,7 @@ public class Xcls_WindowRooView : Object
             string builderhtml;
             
             
-            GLib.FileUtils.get_contents(Builder4.Application.configDirectory() + "/resources/roo.builder.js", out builderhtml);
+            GLib.FileUtils.get_contents(BuilderApplication.configDirectory() + "/resources/roo.builder.js", out builderhtml);
         
             runhtml += builderhtml + "\n";
             runhtml += "</script>\n" ;
@@ -503,7 +503,7 @@ public class Xcls_WindowRooView : Object
             var base_template = _this.file.project.base_template;
             
             if (base_template.length > 0 && !FileUtils.test(
-                Builder4.Application.configDirectory() + "/resources/" +  base_template, FileTest.EXISTS)  
+                BuilderApplication.configDirectory() + "/resources/" +  base_template, FileTest.EXISTS)  
                 ) {
                    print("invalid base_template name - using default:  %s\n", base_template);
                    base_template = "";
@@ -511,7 +511,7 @@ public class Xcls_WindowRooView : Object
             }
             
             GLib.FileUtils.get_contents(
-                Builder4.Application.configDirectory() + "/resources/" + 
+                BuilderApplication.configDirectory() + "/resources/" + 
                     (base_template.length > 0 ? base_template :  "roo.builder.html")
                     , out inhtml);
             
index e20a60a..505b30f 100644 (file)
@@ -860,7 +860,7 @@ namespace Palete {
                        }
                
                        var pa = new Json.Parser();
-                       pa.load_from_file(Builder4.Application.configDirectory() + "/resources/Gir.overides");
+                       pa.load_from_file(BuilderApplication.configDirectory() + "/resources/Gir.overides");
                        var node = pa.get_root();
                    
                        if (node.get_node_type () != Json.NodeType.OBJECT) {
index 5d3e8ee..a1c8915 100644 (file)
@@ -41,7 +41,7 @@ namespace Palete {
              
                public override void  load () {
 
-                       this.loadUsageFile(Builder4.Application.configDirectory() + "/resources/GtkUsage.txt");
+                       this.loadUsageFile(BuilderApplication.configDirectory() + "/resources/GtkUsage.txt");
         
                     
                }
index e7845da..1fbdb44 100644 (file)
@@ -56,12 +56,12 @@ namespace Palete {
                if (this.classes != null) {
                        return;
                }
-               this.loadUsageFile(Builder4.Application.configDirectory() + "/resources/RooUsage.txt");
+               this.loadUsageFile(BuilderApplication.configDirectory() + "/resources/RooUsage.txt");
                this.classes = new Gee.HashMap<string,GirObject>();
 
             
                var pa = new Json.Parser();
-               pa.load_from_file(Builder4.Application.configDirectory() + "/resources/roodata.json");
+               pa.load_from_file(BuilderApplication.configDirectory() + "/resources/roodata.json");
                var node = pa.get_root();
 
                var clist =  node.get_object().get_object_member("data");