Builder4/MainWindow.bjs
authorAlan Knowles <alan@roojs.com>
Tue, 28 Oct 2014 09:29:25 +0000 (17:29 +0800)
committerAlan Knowles <alan@roojs.com>
Tue, 28 Oct 2014 09:29:25 +0000 (17:29 +0800)
Builder4/MainWindow.vala

Builder4/MainWindow.bjs
Builder4/MainWindow.vala

index cc24a32..58f50a9 100644 (file)
@@ -13,7 +13,7 @@
                 "show" : "  ( ) => {\n    // hide the file editing..\n   \n    //this.hideViewEditing();\n}"
             },
             "|             void hideAddListener" : "() {\n      _this.backbutton.el.hide();\n     _this.projectbutton.el.show(); \n          _this.projecteditbutton.el.show();\n         _this.editfilebutton.el.show();   \n     _this.addpropsview.el.save_easing_state();\n    var el = _this.rooview.el;\n    el.save_easing_state();\n\n    \n    el.set_scale(1.0f,1.0f);\n    _this.addpropsview.el.set_scale(0.0f,0.0f);\n    _this.state = \"edit\";\n\n \n    //_this.clutterfiles.loadProject(_this.project);\n\n    el.restore_easing_state();\n     _this.addpropsview.el.restore_easing_state();  \n  }",
-            "|        void initChildren" : " () {\n    // this needs putting in a better place..\n    \n    print(\"init children\");\n    this.left_tree = new Xcls_WindowLeftTree();\n    this.left_tree.ref();\n    this.left_tree.main_window = _this;\n    this.tree.el.pack_start(this.left_tree.el,true, true,0);\n    this.left_tree.el.show_all();\n   \n    this.left_tree.before_node_change.connect(() => {\n        if (this.state != \"codeedit\") {\n            this.left_props.finish_editing();\n            return true;\n        }\n        if (!this.code_editor.saveContents()) {\n            return false;\n        }\n        return false;\n    \n    });\n    \n    this.left_tree.node_selected.connect((sel) => {\n        \n        print(\"node_selected called %s\\n\", (sel == null) ? \"NULL\" : \"a value\");\n        \n        if (sel == null) {\n            this.left_props.el.hide();\n        } \n        this.left_props.el.show();\n        this.left_props.load(this.left_tree.getActiveFile(), sel);\n        switch (this.state) {\n            case \"object\": \n                  \n                 if (sel == null) {\n                    this.rightpalete.clear();\n                    break;\n                }\n                this.rightpalete.load(_this.left_tree.getActiveFile().palete(), sel.fqn());\n                break;\n                 \n                \n           case \"addprop\":\n                if (sel == null) {\n                    this.add_props.clear();\n                    break;\n                }\n                this.add_props.show(_this.left_tree.getActiveFile().palete(), \"props\", sel.fqn());\n                break;\n                \n           case \"addlistener\":\n                if (sel == null) {\n                    this.add_props.clear();\n                    break;\n                }\n                this.add_props.show(_this.left_tree.getActiveFile().palete(), \"signals\", sel.fqn());\n                break;\n\n           case \"codeedit\":\n               \n                this.hideCodeEdit();\n                break;\n               \n                                \n        }\n        return  ;\n          \n    });\n    \n     this.left_tree.changed.connect(() => {\n       this.window_rooview.requestRedraw();\n       this.left_tree.model.file.save();\n    });\n     \n    \n\n    // left properties\n\n    this.left_props =new Xcls_LeftProps();\n    this.left_props.ref();\n    this.left_props.main_window = _this;\n    this.props.el.pack_start(this.left_props.el,true, true,0);\n    this.left_props.el.show_all();\n    \n    this.left_props.show_editor.connect( (file, node, type,  key) => {\n        this.showCodeEdit(file, node, type,  key);\n    });\n    this.left_props.stop_editor.connect( () => {\n        if (this.state != \"codeedit\") {\n            return true;\n        }\n    \n        var ret =  this.code_editor.saveContents();\n        if (!ret) {\n            return false;\n        }\n        this.hideCodeEdit();\n        return ret;\n    });\n     this.left_props.changed.connect(() => {\n          if (this.left_tree.getActiveFile().xtype == \"Roo\" ) {\n               this.window_rooview.requestRedraw();\n               \n           } else {\n              this.window_gladeview.loadFile(this.left_tree.getActiveFile());\n          }\n          this.left_tree.model.updateSelected();\n          this.left_tree.model.file.save();\n    });\n    \n\n\n\n    // left projects..\n     this.left_projects = new Xcls_WindowLeftProjects();\n     this.left_projects.ref();\n     this.leftpane.el.pack_start(this.left_projects.el,true, true,0);\n     this.left_projects.el.show_all();\n     this.left_projects.project_selected.connect((proj) => {\n        proj.scanDirs();\n        _this.clutterfiles.loadProject(proj);\n    \n     });\n    \n   \n    // project edit..\n    this.projectsettings  =new Xcls_ProjectSettings();\n    this.projectsettings.ref();  /// really?\n    \n    this.vala_projectsettings  =new ValaProjectSettings();\n    this.vala_projectsettings.ref();\n\n    \n    ((Gtk.Container)(this.projecteditview.el.get_widget())).add(this.projectsettings.el);\n    //this.projectsettings.el.show_all();\n\n    var stage = _this.projecteditview.el.get_stage();\n    stage.set_background_color(  Clutter.Color.from_string(\"#000\"));\n    \n     this.projectsettings.buttonPressed.connect((btn) => {\n         if (this.left_tree.getActiveFile().xtype == \"Roo\" ) {\n         \n            if (btn == \"save\") {\n                 _this.window_rooview.view.renderJS(true);\n            }\n            if (btn == \"apply\") {\n                _this.window_rooview.view.renderJS(true);\n                return;\n            }\n        } else {\n            // do nothing for gtk..\n        }\n        if (btn == \"save\" || btn == \"apply\") {\n            _this.project.save();\n \n        }\n        \n        this.hideProjectEdit();\n         \n     });\n    \n    \n    // objects (palate..)\n    this.rightpalete  = new Xcls_RightPalete();\n    this.rightpalete.ref();  /// really?\n    ((Gtk.Container)(this.objectview.el.get_widget())).add(this.rightpalete.el);\n    //this.projectsettings.el.show_all();\n\n    stage = _this.objectview.el.get_stage();\n    stage.set_background_color(  Clutter.Color.from_string(\"#000\"));\n    \n    /*this.projectsettings.buttonPressed.connect((btn) => {\n        if (btn == \"save\") {\n             _this.window_rooview.view.renderJS(true);\n        }\n        if (btn == \"apply\") {\n            _this.window_rooview.view.renderJS(true);\n            return;\n        }\n        this.hideProjectEdit();\n         \n     });\n    */\n    \n    \n      \n    // Add properties\n    this.add_props  = new Xcls_WindowAddProp();\n    this.add_props.ref();  /// really?\n    ((Gtk.Container)(this.addpropsview.el.get_widget())).add(this.add_props.el);\n    //this.projectsettings.el.show_all();\n\n    stage = _this.addpropsview.el.get_stage();\n    stage.set_background_color(  Clutter.Color.from_string(\"#000\"));\n    \n    \n    _this.add_props.select.connect( (key,type,skel, etype) => {\n        this.left_props.addProp(etype, key, skel, type);\n    });\n    \n    // editor\n    \n    \n    this.code_editor  = new  Editor();\n    this.code_editor.ref();  /// really?\n    ((Gtk.Container)(this.codeeditview.el.get_widget())).add(this.code_editor.el);\n    //this.projectsettings.el.show_all();\n\n    stage = _this.codeeditview.el.get_stage();\n    stage.set_background_color(  Clutter.Color.from_string(\"#000\"));\n    // editor.save...\n\n    _this.code_editor.save.connect( () => {\n        this.left_tree.model.file.save();\n         this.left_tree.model.updateSelected();\n    });\n    \n     \n    \n    \n    //  roo view\n    \n     this.window_rooview  =new Xcls_WindowRooView();\n    this.window_rooview.ref();\n    ((Gtk.Container)(this.rooview.el.get_widget())).add(this.window_rooview.el);\n    this.window_rooview.el.show_all();\n\n    stage = _this.rooview.el.get_stage();\n    stage.set_background_color(  Clutter.Color.from_string(\"#000\"));\n    \n      \n    //  glade view\n    \n    this.window_gladeview  =new Xcls_GtkView();\n    this.window_gladeview.ref();\n\n    //((Gtk.Container)(this.rooview.el.get_widget())).add(this.window_gladeview.el);\n    ///this.window_gladeview.el.hide();\n\n   \n    \n    // clutter files\n    \n    \n    this.clutterfiles = new Xcls_ClutterFiles();\n    this.clutterfiles.ref();\n    stage.add_child(this.clutterfiles.el);\n    this.clutterfiles.el.show_all();\n\n\n    this.clutterfiles.open.connect((file) => { \n        _this.project = file.project;\n        _this.showViewEditing();\n        this.left_tree.model.loadFile(file);\n        var ctr= ((Gtk.Container)(this.rooview.el.get_widget()));\n        var ctr_p= ((Gtk.Container)(this.projecteditview.el.get_widget()));\n        if (file.xtype == \"Roo\" ) { \n            ctr.foreach( (w) => { ctr.remove(w); });\n            ctr_p.foreach( (w) => { ctr_p.remove(w); });\n            ctr.add(this.window_rooview.el);\n            ctr_p.add(this.projectsettings.el);            \n            this.window_rooview.loadFile(file);\n            this.window_rooview.el.show_all();\n            \n            \n        } else {\n            ctr.foreach( (w) => { ctr.remove(w); });\n            ctr_p.foreach( (w) => { ctr_p.remove(w); });            \n            ctr.add(this.window_gladeview.el);\n            ctr_p.add(this.vala_projectsettings.el);\n            this.window_gladeview.loadFile(file);\n            this.window_gladeview.el.show_all();\n        }\n        print(\"OPEN : \" + file.name);\n        _this.editpane.el.set_position(_this.editpane.el.max_position);\n         \n\n    });\n\n    // new file dialog\n    this.new_file_dialog = new Xcls_DialogNewComponent();\n    // force it modal to the main window..\n    this.new_file_dialog.el.set_transient_for(this.el);\n    this.new_file_dialog.el.set_modal(true);\n    \n    this.new_file_dialog.success.connect((project,file) =>\n    {\n        _this.project = project;\n        _this.showViewEditing();\n        this.left_tree.model.loadFile(file);\n        var ctr= ((Gtk.Container)(this.rooview.el.get_widget()));\n        if (file.xtype == \"Roo\" ) { \n            ctr.foreach( (w) => { ctr.remove(w); });\n            ctr.add(this.window_rooview.el);\n            this.window_rooview.loadFile(file);\n            \n            this.window_rooview.el.show_all();\n        } else {\n            ctr.foreach( (w) => { ctr.remove(w); });\n            ctr.add(this.window_gladeview.el);\n            this.window_gladeview.loadFile(file);\n            this.window_gladeview.el.show_all();\n        }\n    \n    });\n    \n     \n\n    //w.el.show_all();\n    var tl = new Clutter.Timeline(6000);\n    tl.set_repeat_count(-1);\n    tl.start();\n    tl.ref();\n\n    this.children_loaded = true;\n\n\n\n\n}\n",
+            "|        void initChildren" : " () {\n    // this needs putting in a better place..\n    \n    print(\"init children\");\n    this.left_tree = new Xcls_WindowLeftTree();\n    this.left_tree.ref();\n    this.left_tree.main_window = _this;\n    this.tree.el.pack_start(this.left_tree.el,true, true,0);\n    this.left_tree.el.show_all();\n   \n    this.left_tree.before_node_change.connect(() => {\n        if (this.state != \"codeedit\") {\n            this.left_props.finish_editing();\n            return true;\n        }\n        if (!this.code_editor.saveContents()) {\n            return false;\n        }\n        return false;\n    \n    });\n    \n    this.left_tree.node_selected.connect((sel) => {\n        \n        print(\"node_selected called %s\\n\", (sel == null) ? \"NULL\" : \"a value\");\n        \n        if (sel == null) {\n            this.left_props.el.hide();\n        } \n        this.left_props.el.show();\n        this.left_props.load(this.left_tree.getActiveFile(), sel);\n        switch (this.state) {\n            case \"object\": \n                  \n                 if (sel == null) {\n                    this.rightpalete.clear();\n                    break;\n                }\n                this.rightpalete.load(_this.left_tree.getActiveFile().palete(), sel.fqn());\n                break;\n                 \n                \n           case \"addprop\":\n                if (sel == null) {\n                    this.add_props.clear();\n                    break;\n                }\n                this.add_props.show(_this.left_tree.getActiveFile().palete(), \"props\", sel.fqn());\n                break;\n                \n           case \"addlistener\":\n                if (sel == null) {\n                    this.add_props.clear();\n                    break;\n                }\n                this.add_props.show(_this.left_tree.getActiveFile().palete(), \"signals\", sel.fqn());\n                break;\n\n           case \"codeedit\":\n               \n                this.hideCodeEdit();\n                break;\n               \n                                \n        }\n        return  ;\n          \n    });\n    \n     this.left_tree.changed.connect(() => {\n       this.window_rooview.requestRedraw();\n       this.left_tree.model.file.save();\n    });\n     \n    \n\n    // left properties\n\n    this.left_props =new Xcls_LeftProps();\n    this.left_props.ref();\n    this.left_props.main_window = _this;\n    this.props.el.pack_start(this.left_props.el,true, true,0);\n    this.left_props.el.show_all();\n    \n    this.left_props.show_editor.connect( (file, node, type,  key) => {\n        this.showCodeEdit(file, node, type,  key);\n    });\n    this.left_props.stop_editor.connect( () => {\n        if (this.state != \"codeedit\") {\n            return true;\n        }\n    \n        var ret =  this.code_editor.saveContents();\n        if (!ret) {\n            return false;\n        }\n        this.hideCodeEdit();\n        return ret;\n    });\n     this.left_props.changed.connect(() => {\n          if (this.left_tree.getActiveFile().xtype == \"Roo\" ) {\n               this.window_rooview.requestRedraw();\n               \n           } else {\n              this.window_gladeview.loadFile(this.left_tree.getActiveFile());\n          }\n          this.left_tree.model.updateSelected();\n          this.left_tree.model.file.save();\n    });\n    \n\n\n\n    // left projects..\n     this.left_projects = new Xcls_WindowLeftProjects();\n     this.left_projects.ref();\n     this.leftpane.el.pack_start(this.left_projects.el,true, true,0);\n     this.left_projects.el.show_all();\n     this.left_projects.project_selected.connect((proj) => {\n        proj.scanDirs();\n        _this.clutterfiles.loadProject(proj);\n    \n     });\n    \n   \n    // project edit..\n    this.projectsettings  =new Xcls_ProjectSettings();\n    this.projectsettings.ref();  /// really?\n    \n    this.vala_projectsettings  =new ValaProjectSettings();\n    this.vala_projectsettings.ref();\n\n    \n    ((Gtk.Container)(this.projecteditview.el.get_widget())).add(this.projectsettings.el);\n    //this.projectsettings.el.show_all();\n\n    var stage = _this.projecteditview.el.get_stage();\n    stage.set_background_color(  Clutter.Color.from_string(\"#000\"));\n    \n     this.projectsettings.buttonPressed.connect((btn) => {\n         if (this.left_tree.getActiveFile().xtype == \"Roo\" ) {\n         \n            if (btn == \"save\") {\n                 _this.window_rooview.view.renderJS(true);\n            }\n            if (btn == \"apply\") {\n                _this.window_rooview.view.renderJS(true);\n                return;\n            }\n        } else {\n            // do nothing for gtk..\n        }\n        if (btn == \"save\" || btn == \"apply\") {\n            _this.project.save();\n \n        }\n        \n        this.hideProjectEdit();\n         \n     });\n    \n    \n    // objects (palate..)\n    this.rightpalete  = new Xcls_RightPalete();\n    this.rightpalete.ref();  /// really?\n    ((Gtk.Container)(this.objectview.el.get_widget())).add(this.rightpalete.el);\n    //this.projectsettings.el.show_all();\n\n    stage = _this.objectview.el.get_stage();\n    stage.set_background_color(  Clutter.Color.from_string(\"#000\"));\n    \n    /*this.projectsettings.buttonPressed.connect((btn) => {\n        if (btn == \"save\") {\n             _this.window_rooview.view.renderJS(true);\n        }\n        if (btn == \"apply\") {\n            _this.window_rooview.view.renderJS(true);\n            return;\n        }\n        this.hideProjectEdit();\n         \n     });\n    */\n    \n    \n      \n    // Add properties\n    this.add_props  = new Xcls_WindowAddProp();\n    this.add_props.ref();  /// really?\n    ((Gtk.Container)(this.addpropsview.el.get_widget())).add(this.add_props.el);\n    //this.projectsettings.el.show_all();\n\n    stage = _this.addpropsview.el.get_stage();\n    stage.set_background_color(  Clutter.Color.from_string(\"#000\"));\n    \n    \n    _this.add_props.select.connect( (key,type,skel, etype) => {\n        this.left_props.addProp(etype, key, skel, type);\n    });\n    \n    // editor\n    \n    \n    this.code_editor  = new  Editor();\n    this.code_editor.ref();  /// really?\n    ((Gtk.Container)(this.codeeditview.el.get_widget())).add(this.code_editor.el);\n    //this.projectsettings.el.show_all();\n\n    stage = _this.codeeditview.el.get_stage();\n    stage.set_background_color(  Clutter.Color.from_string(\"#000\"));\n    // editor.save...\n\n    _this.code_editor.save.connect( () => {\n        this.left_tree.model.file.save();\n         this.left_tree.model.updateSelected();\n    });\n    \n     \n    \n    \n    //  roo view\n    \n     this.window_rooview  =new Xcls_WindowRooView();\n    this.window_rooview.ref();\n    ((Gtk.Container)(this.rooview.el.get_widget())).add(this.window_rooview.el);\n    this.window_rooview.el.show_all();\n\n    stage = _this.rooview.el.get_stage();\n    stage.set_background_color(  Clutter.Color.from_string(\"#000\"));\n    \n      \n    //  glade view\n    \n    this.window_gladeview  =new Xcls_GtkView();\n    this.window_gladeview.ref();\n\n    //((Gtk.Container)(this.rooview.el.get_widget())).add(this.window_gladeview.el);\n    ///this.window_gladeview.el.hide();\n\n   \n    \n    // clutter files\n    \n    \n    this.clutterfiles = new Xcls_ClutterFiles();\n    this.clutterfiles.ref();\n    stage.add_child(this.clutterfiles.el);\n    this.clutterfiles.el.show_all();\n\n\n    this.clutterfiles.open.connect((file) => { \n        _this.project = file.project;\n        _this.showViewEditing();\n        this.left_tree.model.loadFile(file);\n        var ctr= ((Gtk.Container)(this.rooview.el.get_widget()));\n        var ctr_p= ((Gtk.Container)(this.projecteditview.el.get_widget()));\n        if (file.xtype == \"Roo\" ) { \n            ctr.foreach( (w) => { ctr.remove(w); });\n            ctr_p.foreach( (w) => { ctr_p.remove(w); });\n            ctr.add(this.window_rooview.el);\n            ctr_p.add(this.projectsettings.el);            \n            this.window_rooview.loadFile(file);\n            this.window_rooview.el.show_all();\n            this.projectsettings.el.show_all();            \n            \n        } else {\n            ctr.foreach( (w) => { ctr.remove(w); });\n            ctr_p.foreach( (w) => { ctr_p.remove(w); });            \n            ctr.add(this.window_gladeview.el);\n            ctr_p.add(this.vala_projectsettings.el);\n            this.window_gladeview.loadFile(file);\n            this.window_gladeview.el.show_all();\n            this.vala_projectsettings.el.show_all();\n        }\n        print(\"OPEN : \" + file.name);\n        _this.editpane.el.set_position(_this.editpane.el.max_position);\n         \n\n    });\n\n    // new file dialog\n    this.new_file_dialog = new Xcls_DialogNewComponent();\n    // force it modal to the main window..\n    this.new_file_dialog.el.set_transient_for(this.el);\n    this.new_file_dialog.el.set_modal(true);\n    \n    this.new_file_dialog.success.connect((project,file) =>\n    {\n        _this.project = project;\n        _this.showViewEditing();\n        this.left_tree.model.loadFile(file);\n        var ctr= ((Gtk.Container)(this.rooview.el.get_widget()));\n        var ctr_p= ((Gtk.Container)(this.projecteditview.el.get_widget()));\n        if (file.xtype == \"Roo\" ) { \n            ctr.foreach( (w) => { ctr.remove(w); });\n            ctr_p.foreach( (w) => { ctr_p.remove(w); });\n            ctr.add(this.window_rooview.el);\n            ctr_p.add(this.projectsettings.el);            \n            this.window_rooview.loadFile(file);\n            this.window_rooview.el.show_all();\n            this.projectsettings.el.show_all();  \n            \n            \n        } else {\n            ctr.foreach( (w) => { ctr.remove(w); });\n            ctr_p.foreach( (w) => { ctr_p.remove(w); });            \n            ctr.add(this.window_gladeview.el);\n            ctr_p.add(this.vala_projectsettings.el);\n            this.window_gladeview.loadFile(file);\n            this.window_gladeview.el.show_all();\n            this.vala_projectsettings.el.show_all();\n        }\n    \n    });\n    \n     \n\n    //w.el.show_all();\n    var tl = new Clutter.Timeline(6000);\n    tl.set_repeat_count(-1);\n    tl.start();\n    tl.ref();\n\n    this.children_loaded = true;\n\n\n\n\n}\n",
             "# int no_windows" : 1,
             "# Project.Project project" : "null",
             "# bool children_loaded" : false,
index 8d6ae76..fb5b977 100644 (file)
@@ -396,7 +396,7 @@ public class Xcls_MainWindow : Object
                 ctr_p.add(this.projectsettings.el);            
                 this.window_rooview.loadFile(file);
                 this.window_rooview.el.show_all();
-                
+                this.projectsettings.el.show_all();            
                 
             } else {
                 ctr.foreach( (w) => { ctr.remove(w); });
@@ -405,6 +405,7 @@ public class Xcls_MainWindow : Object
                 ctr_p.add(this.vala_projectsettings.el);
                 this.window_gladeview.loadFile(file);
                 this.window_gladeview.el.show_all();
+                this.vala_projectsettings.el.show_all();
             }
             print("OPEN : " + file.name);
             _this.editpane.el.set_position(_this.editpane.el.max_position);
@@ -424,17 +425,25 @@ public class Xcls_MainWindow : Object
             _this.showViewEditing();
             this.left_tree.model.loadFile(file);
             var ctr= ((Gtk.Container)(this.rooview.el.get_widget()));
+            var ctr_p= ((Gtk.Container)(this.projecteditview.el.get_widget()));
             if (file.xtype == "Roo" ) { 
                 ctr.foreach( (w) => { ctr.remove(w); });
+                ctr_p.foreach( (w) => { ctr_p.remove(w); });
                 ctr.add(this.window_rooview.el);
+                ctr_p.add(this.projectsettings.el);            
                 this.window_rooview.loadFile(file);
-                
                 this.window_rooview.el.show_all();
+                this.projectsettings.el.show_all();  
+                
+                
             } else {
                 ctr.foreach( (w) => { ctr.remove(w); });
+                ctr_p.foreach( (w) => { ctr_p.remove(w); });            
                 ctr.add(this.window_gladeview.el);
+                ctr_p.add(this.vala_projectsettings.el);
                 this.window_gladeview.loadFile(file);
                 this.window_gladeview.el.show_all();
+                this.vala_projectsettings.el.show_all();
             }
         
         });