Builder/Window.js
[app.Builder.js] / Builder / Window.js
1 //<Script type="text/javascript">
2
3 Gtk = imports.gi.Gtk;
4 Vte = imports.gi.Vte;
5 // core libs
6 XObject = imports.XObject.XObject;
7 console = imports.console;
8
9 // components.
10 TopMenu         = imports.Builder.TopMenu.TopMenu;
11 LeftTopPanel    = imports.Builder.LeftTopPanel.LeftTopPanel;
12 LeftProps       = imports.Builder.LeftProps.LeftProps;
13 LeftPanel       = imports.Builder.LeftPanel.LeftPanel;
14 MidPropTree     = imports.Builder.MidPropTree.MidPropTree;
15 RightBrowser    = imports.Builder.RightBrowser.RightBrowser;
16 RightGtkView    = imports.Builder.RightGtkView.RightGtkView;
17 RightEditor     = imports.Builder.RightEditor.RightEditor;
18 RightPalete     = imports.Builder.RightPalete.RightPalete;
19 // concept:
20 /**
21  * 
22  * left - tree + props
23  * right - top = preview - webkit?
24  * right - bottom = soruceview
25  * 
26  * Palete... as toolbar??? - changes depending on what you pick?
27  * 
28  * Not sure how to do Gtk version.. - our preview might be fun... = probably have to do a gtkhbox.. or something..
29  * 
30  */
31  
32  
33   
34 //print('window loaded');
35
36 Window = new XObject({
37     
38     id: 'Builder.Window',
39     
40     xtype : function() {
41         return new Gtk.Window({type: Gtk.WindowType.TOPLEVEL});
42     },
43     
44     //type: Gtk.WindowType.TOPLEVEL,
45     title : "Application Builder",
46     border_width : 0,
47     
48     init : function()
49     {
50         XObject.prototype.init.call(this); 
51         
52         this.el.show_all();
53         MidPropTree.hideWin();
54         RightPalete.hide();
55         
56         this.el.set_default_size(900, 600);
57         
58     },
59     
60     listeners : {
61         'delete-event' : function (widget, event) {
62             return false;
63         },
64         destroy  : function (widget) {
65             Gtk.main_quit();
66         },
67          
68     },
69     
70         
71     items : [
72         {
73             xtype : Gtk.VBox,
74             id: 'w-vbox',
75             items : [
76                 TopMenu,
77                 {
78                     id : 'left',
79                     xtype : Gtk.HPaned,
80                     position : 400,
81                     items : [
82                         {
83                             xtype : Gtk.HBox,
84                             items : [
85                                 {
86                                     id : 'leftvpaned',
87                                     xtype : Gtk.VPaned,
88                                     position : 300,
89                                     items : [
90                                         LeftTopPanel,
91                                         {
92                                             xtype: Gtk.VBox,
93                                             items : [
94                                                 {
95                             
96                                                     xtype : Gtk.HBox,
97                                                     pack : [ 'pack_start', false, true, 0 ],
98                                                     items : [  
99                                                         LeftProps 
100                                                     ]
101                                                 },
102                                                 LeftPanel
103                                                 
104                                             ]
105                                         }
106                                         
107                                     ]
108                                 },
109                                 MidPropTree
110                                 
111                             ]
112                         },
113                                 
114                         {
115                             xtype : Gtk.HBox,
116                             items : [
117                                 {
118                                     xtype : Gtk.VPaned,
119                                     position :  300,
120                                     items : [
121                                         {
122                                             xtype : Gtk.VBox,
123                                             items : [
124                                             
125                                                 {
126                                                     id : 'view-notebook',
127                                                     xtype : Gtk.Notebook,
128                                                     show_tabs : false,
129                                                     tab_border : 0,
130                                                     pack : ['pack_start', true,true],
131                                                     init : function()
132                                                     {
133                                                         XObject.prototype.init.call(this); 
134                                                         this.el.set_current_page(0);
135                                                     },
136                                                     items : [
137                                                        RightBrowser,
138                                                        RightGtkView,
139                                                     ]
140                                                 } 
141                                             
142                                             
143                                                 
144                                             ]
145                                         },
146                                         
147                                         
148                                         {
149                                             xtype: Gtk.Notebook,
150                                             "pack":"add",
151                                             "id" : "BottomPane",
152                                             "init":function() {
153                                                 XObject.prototype.init.call(this);
154                                                 this.el.set_tab_label(this.items[0].el, new Gtk.Label({ label : "Code Editor" }));
155                                                 this.el.set_tab_label(this.items[1].el, new Gtk.Label({ label : "Console" }));
156                                             },
157                                             items : [
158                                                 RightEditor,
159                                                 {
160                                                     xtype: Gtk.ScrolledWindow,
161                                                     "pack":"add",
162                                                     "items" : [
163                                                         {
164                                                             xtype: Vte.Terminal,
165                                                             "pack":"add",
166                                                             "id":"Terminal",
167                                                             "feed":function(str) {
168                                                                 this.el.feed(str,str.length);
169                                                             },
170                                                     
171                                                         }
172                                                     ]
173                                                 }
174                                             ]
175                                         }
176                                          
177                                          
178                                     ]
179                                 },
180                                 RightPalete
181                                  
182                                 
183                             ]
184                         }
185                     ]
186                 }
187                 
188             ]
189        }
190                 
191     ]
192 }); 
193  
194     
195  
196  
197