Fix #7996 - handle namespaces in glade, adw overlay for window selection and open
[roobuilder] / src / Builder4 / WindowState.vala
1 /**
2  * as state management is a bit too complicated inside the builder
3  * it's better to seperate this into this class
4  * 
5  * This class has references to all the Class instances that make up the window..
6  * 
7  */
8 public class WindowState : Object 
9 {
10         public Xcls_MainWindow win;
11  
12         public enum State {
13                 NONE,
14                 PREVIEW,
15                 CODE,
16                 CODEONLY  
17         }
18  
19         public State state = State.NONE;
20         public bool children_loaded = false;
21  
22         public Project.Project? project = null;
23         public JsRender.JsRender? file = null;
24           
25         public Xcls_WindowLeftTree  left_tree;
26         public Xcls_PopoverAddProp   add_props;
27         public Xcls_LeftProps       left_props;
28         public Xcls_RooProjectSettings roo_projectsettings_pop;
29         public ValaProjectSettingsPopover  vala_projectsettings_pop; 
30         public Xcls_PopoverAddObject     rightpalete;
31         //public Xcls_PopoverEditor               code_editor_popover;
32         public Editor                                    code_editor_tab; 
33         public Xcls_WindowRooView   window_rooview;
34         public Xcls_GtkView         window_gladeview;
35         public DialogFiles popover_files;
36         
37         //public Xcls_ClutterFiles     clutterfiles;
38         //public Xcls_WindowLeftProjects left_projects; // can not see where this is initialized.. 
39          
40         public DialogTemplateSelect template_select; 
41         
42         public Xcls_PopoverFileDetails file_details;
43         public Xcls_ValaCompileResults compile_results;
44         
45
46         // used by window list..
47         public string file_name {
48                 owned get { return this.file.relpath; }
49                 private set {}
50         }
51         
52         
53         //public Palete.ValaSource valasource; // the spawner that runs the vala compiler.
54         public Json.Object last_compile_result;
55         
56         // ctor 
57         public WindowState(Xcls_MainWindow win)
58         {
59                 this.win = win;
60         }
61         
62         public void init()
63         {
64         
65                 // initialize
66
67                 // left elements..
68                 this.leftTreeInit();
69                 this.propsListInit();
70
71                 // on clutter space...
72                 this.projectEditInit();
73                 this.codeEditInit();
74                 //this.codePopoverEditInit();
75                 //this.projectListInit();
76                 //this.fileViewInit();
77
78                 // adding stuff
79                 this.objectAddInit();
80                 this.propsAddInit();
81
82
83                 // previews...
84                 this.gtkViewInit();
85                 this.webkitViewInit();
86
87                 // dialogs
88
89                 this.fileDetailsInit();
90
91
92                 this.template_select = new DialogTemplateSelect();
93                 this.children_loaded = true;
94                 
95                 
96                  
97                 //BuilderApplication.valasource.compiled.connect(this.showCompileResult); 
98                 
99                 
100                 this.compile_results = new  Xcls_ValaCompileResults(); // the poup dialogs with results in.
101                 this.compile_results.window = this.win;
102                 //BuilderApplication.valasource.compile_output.connect(this.compile_results.addLine);
103                 
104                 this.win.statusbar_compilestatus_label.el.hide();
105                 this.win.statusbar_run.el.hide();
106   
107                 this.popover_files = new DialogFiles();
108                  this.popover_files.win = this.win;
109             this.popover_files.el.application = this.win.el.application;
110             this.popover_files.el.set_transient_for( this.win.el );
111  
112
113         }
114
115  
116         // left tree
117
118         public void leftTreeInit()
119         {
120          
121                 this.left_tree = new Xcls_WindowLeftTree();
122                 this.left_tree.ref();
123                 this.left_tree.main_window = this.win;
124         
125                 this.win.leftpane.el.remove(this.win.editpane.el);
126         //this.win.tree.el.remove(this.left_tree.el);
127         this.win.leftpane.el.append(this.left_tree.el);
128             
129         
130                 //this.win.tree.el.pack_start(this.left_tree.el,true, true,0);
131                 this.left_tree.el.show();
132                    
133                 this.left_tree.before_node_change.connect(() => {
134                         // if the node change is caused by the editor (code preview)
135                         if (this.left_tree.view.lastEventSource == "editor") {
136                                 return true;
137                         }
138                         return this.leftTreeBeforeChange();
139
140                 });
141                 // node selected -- only by clicking?
142                 this.left_tree.node_selected.connect((sel) => {
143                         //if (source == "editor") {
144                         //      return;
145                         //}
146                         if (this.file.xtype == "Roo") { 
147                                 this.window_rooview.sourceview.nodeSelected(sel,true); // foce scroll.
148                         } else {
149                                 this.window_gladeview.sourceview.nodeSelected(sel, true);
150                         }
151                 });
152                 
153                 this.left_tree.node_selected.connect((sel) => {
154                         this.leftTreeNodeSelected(sel);
155                 });
156          
157                 this.left_tree.changed.connect(() => {
158                         GLib.debug("LEFT TREE: Changed fired\n");
159                         this.file.save();
160                         if (this.left_tree.getActiveFile().xtype == "Roo" ) {
161                                    this.window_rooview.requestRedraw();
162                         } else {
163                                   this.window_gladeview.loadFile(this.left_tree.getActiveFile());
164                         }
165                          
166                 });
167                  
168         }
169         
170         public void updateErrorMarksAll() 
171         {
172                 this.updateErrorMarks("ERR");
173                 this.updateErrorMarks("WARN");
174                 this.updateErrorMarks("DEPR");
175         
176         }
177         void updateErrorMarks(string cat) 
178         {
179                 this.code_editor_tab.updateErrorMarks();
180                 switch(this.file.xtype) {
181                         case  "Roo":
182                                 this.window_rooview.updateErrorMarks();// foce scroll.
183                                 return;
184                         case "Gtk":
185                                 this.window_gladeview.updateErrorMarks();
186                                 return;
187                          default:
188                                 return;
189                 }
190         }
191         
192         
193
194         public bool leftTreeBeforeChange()
195         {
196                 // in theory code editor has to hide before tree change occurs.
197                 //if (this.state != State.CODE) {
198                         //this.left_props.finish_editing();
199                         
200                         if (this.state == State.CODE) {
201                                 this.code_editor_tab.saveContents();
202                                 this.switchState(State.PREVIEW);
203                         }
204                         
205                         return true;
206                 //}
207
208                 //if (!this.code_editor.saveContents()) {
209                 //      return false;
210                 //}
211                 //return false;
212         }
213         
214         int tree_width = 300;
215         int props_width = 300;
216         
217         public void leftTreeNodeSelected(JsRender.Node? sel)
218         {
219                 
220                 // do we really want to flip paletes if differnt nodes are selected
221                 // showing palete should be deliberate thing..
222                  
223          
224                 print("node_selected called %s\n", (sel == null) ? "NULL" : "a value");
225
226                 this.add_props.hide(); // always hide add node/add listener if we change node.
227                 this.rightpalete.hide();
228                 
229                 this.left_props.load(this.left_tree.getActiveFile(), sel);
230                 
231                 var outerpane = this.win.mainpane.el;
232                 var innerpane = this.win.editpane.el;
233                 
234                  if (this.win.editpane.el.parent != null && sel != null) {
235                         // select another node... no change to show hide/resize
236                         return;
237                 }
238                                  
239                 if (sel == null) {
240                     // remove win.editpane from leftpane
241                     // remove lefttree from from win.tree 
242                     // add win.tree to leftpane
243                     if (this.win.editpane.el.parent != null) {
244                         this.props_width =  outerpane.get_position() - innerpane.get_position();
245                         this.tree_width = innerpane.get_position();
246                         GLib.debug("HIDE: prop_w = %d, tree_w = %d", this.props_width, this.tree_width);
247                         
248                         this.win.leftpane.el.remove(this.win.editpane.el);
249                         this.win.tree.el.remove(this.left_tree.el);
250                         this.win.leftpane.el.append(this.left_tree.el);
251                 }
252                     
253                 
254                         //GLib.debug("Hide Properties");
255                         outerpane.show(); // make sure it's visiable..
256                         this.left_props.el.hide();
257                         GLib.debug("set position: %d", this.tree_width);
258                         outerpane.set_position(this.tree_width);
259                         //outerpane.set_position(int.max(250,innerpane.get_position()));
260                         //this.left_props.el.width_request =  this.left_props.el.get_allocated_width();
261                         return;
262                 }
263                 
264                 // at this point we are showing the outer only,
265                 
266                 
267                 
268                 
269                 this.tree_width = outerpane.get_position();
270                 
271                 GLib.debug("SHOW: prop_w = %d, tree_w = %d", this.props_width, this.tree_width);
272                       
273                 // remove this.ldeftree from this.win.leftpane
274                 this.win.leftpane.el.remove(this.left_tree.el);
275                 this.win.tree.el.append(this.left_tree.el);
276                 this.win.leftpane.el.append(this.win.editpane.el);
277                 
278                 
279                 
280                 
281                 GLib.debug("left props is %s",  this.left_props.el.visible ? "shown" : "hidden");
282                 // at start (hidden) - outer  = 400 inner = 399
283                 // expanded out -> outer = 686, inner = 399 
284                 //this.win.props.el.pack_start(this.left_props.el,true, true,0);
285                 this.left_props.el.show();              //if (!this.left_props.el.visible) {
286                  
287                         GLib.debug("outerpos : %d, innerpos : %d", outerpane.get_position(), innerpane.get_position());
288                         outerpane.set_position(this.tree_width + this.props_width);
289                         innerpane.set_position(this.tree_width);
290                         /* var cw = outerpane.el.get_position();
291                         var rw = int.min(this.left_props.el.width_request, 150);
292                         print("outerpos : %d, innerpos : %d", cw + rw, cw);
293                         
294                         innerpane.set_position(cw); */
295                         this.left_props.el.show();
296                 
297                 //}
298                 
299                  
300                 
301                 
302                 
303
304                 
305                 
306                 // if either of these are active.. then we should update them??
307                 
308                 
309                 
310    /**
311    
312    make outerpane = {current width of left pane} + width of props
313    make innerpane = {current width of left pane}
314    
315    
316    
317    
318    
319    var outerpane = _this.main_window.leftpane.el;
320    var pane = _this.main_window.editpane.el;
321    
322   
323    
324     var try_size = (i * 25) + 60; // est. 20px per line + 40px header
325     GLib.Timeout.add_seconds(1, () => { 
326                 // max 80%...
327                 pane.set_position( 
328                      ((try_size * 1.0f) /  (pane.max_position * 1.0f))  > 0.8f  ? 
329                     (int) (pane.max_position * 0.2f) :
330                     pane.max_position-try_size);
331             return GLib.Source.REMOVE;
332         });
333         */
334                 
335                 
336                 /*
337                 switch (this.state) {
338                  
339                         case State.CODE:
340                                  this.switchState(State.PREVIEW);
341                          
342                                 break;
343                            
344                                                         
345                 }
346                 */
347  
348                  
349
350         }
351
352
353
354
355         public void propsListInit()
356         {
357         
358                 this.left_props =new Xcls_LeftProps();
359                 this.left_props.ref();
360                 this.left_props.main_window = this.win;
361                 this.win.props.el.append(this.left_props.el);
362                 this.left_props.el.show();
363         
364                 this.left_props.show_editor.connect( (file, node, prop) => {
365                         this.switchState(State.CODE);
366                         
367                         
368                         this.code_editor_tab.show(
369                                 file,
370                                 node,
371                                 prop
372                         );
373                         ///this.markBuf();
374                         
375                         
376                 });
377
378                 // not sure if this is needed - as closing the popvoer should save it.
379                 this.left_props.stop_editor.connect( () => {
380                         var ret =  this.code_editor_tab.saveContents();
381                         if (!ret) {
382                                 return false;
383                         }
384                         this.switchState(State.PREVIEW);
385                          
386                         return ret;
387                 });
388         
389                 this.left_props.changed.connect(() => {
390                         if (this.left_tree.getActiveFile().xtype == "Roo" ) {
391                                    this.window_rooview.requestRedraw();
392                         } else {
393                                   this.window_gladeview.loadFile(this.left_tree.getActiveFile());
394                         }
395                         //this.left_tree.model.updateSelected();
396                         this.file.save();
397                          
398                 });
399          
400
401         }
402
403         //-------------  projects edit
404
405         public void projectEditInit()
406         {
407                 this.roo_projectsettings_pop  =new Xcls_RooProjectSettings();
408                 this.roo_projectsettings_pop.el.application = this.win.el.application;
409
410         
411                 this.vala_projectsettings_pop  =new  ValaProjectSettingsPopover();
412
413                 this.vala_projectsettings_pop.window = this.win;
414                 this.vala_projectsettings_pop.el.application = this.win.el.application;
415                 
416                 //this.vala_projectsettings_pop.el.set_parent(this.win.el); // = this.win;
417         
418                 //((Gtk.Container)(this.win.projecteditview.el.get_widget())).add(this.projectsettings.el);
419  
420  
421                 this.roo_projectsettings_pop.buttonPressed.connect((btn) => {
422                         if (btn == "save" || btn == "apply") {
423                                 this.roo_projectsettings_pop.save();
424                                 this.roo_projectsettings_pop.project.save();
425                  
426                         }
427                 
428                         // in theory active file can only be rooo...
429                         var ep = this.roo_projectsettings_pop.project;
430                         foreach(var ww in BuilderApplication.windows) {
431                                 if (ww.windowstate.file != null && 
432                                         ww.windowstate.project.path == ep.path && 
433                                         ww.windowstate.file.xtype == "Roo") {
434                                          
435                                     ww.windowstate.window_rooview.view.renderJS(true);
436                                                  
437                                 }
438                         }
439                         
440                          
441                         
442                         if (btn == "save") {
443                                 this.roo_projectsettings_pop.el.hide();
444                         }
445                         //this.switchState (State.PREVIEW); 
446                          
447                  });
448
449         }
450         
451         public void projectPopoverShow(Gtk.Window pwin, Project.Project? pr, Project.Callback? doneObj) 
452         { 
453                 if (pr == null) {
454                     pr = this.project;
455             }
456           
457             
458         if (pr.xtype == "") {
459             return;
460         }
461         if (pr.xtype  == "Roo" ) {
462                         this.roo_projectsettings_pop.show(pwin,(Project.Roo)pr);
463                         return;
464                 }
465
466                 // gtk..
467                 
468                 this.vala_projectsettings_pop.show(pwin,(Project.Gtk)pr,  doneObj);
469         
470         }
471         
472         
473         // ----------- object adding
474         public void objectAddInit()
475         {
476
477                 this.rightpalete  = new Xcls_PopoverAddObject();
478                 this.rightpalete.mainwindow = this.win;
479                 this.rightpalete.ref();  /// really?
480                 /*((Gtk.Container)(this.win.objectview.el.get_widget())).add(this.rightpalete.el);
481  
482
483                 var stage = this.win.objectview.el.get_stage();
484                 stage.set_background_color(  Clutter.Color.from_string("#000"));
485                  */
486         }
487         
488         // -----------  properties adding list...
489         // listener uses the properties 
490         public void propsAddInit()
491         {
492         // Add properties
493                 this.add_props  = new Xcls_PopoverAddProp();
494                 this.add_props.mainwindow = this.win;
495                 this.add_props.ref();  /// really?
496                 // don't need to add it..
497                 //((Gtk.Container)(this.win.addpropsview.el.get_widget())).add(this.add_props.el);
498  
499
500                 //var  stage = this.win.addpropsview.el.get_stage();
501                 //stage.set_background_color(  Clutter.Color.from_string("#000"));
502
503
504          
505
506         }
507         public void propsAddShow()
508         {
509
510         }
511         public void propsAddHide()
512         {
513         
514         }
515
516  
517         // ----------- Add / Edit listener
518         // listener uses the properties 
519         //public void listenerInit()     { }
520         public void listenerShow()
521         {
522
523         }
524         public void listenerHide()
525         {
526         
527         }
528
529         // -------------- codeEditor
530
531         public void codeEditInit()
532         {
533                 this.code_editor_tab  = new  Editor();
534                 //this.code_editor.ref();  /// really?
535                 this.win.codeeditviewbox.el.append(this.code_editor_tab.el);
536                 
537                 this.win.codeeditviewbox.el.hide();
538                 this.code_editor_tab.window = this.win;
539  
540                 // editor.save...
541
542                 this.code_editor_tab.save.connect( () => {
543                         this.file.save();
544                         //this.left_tree.model.updateSelected();
545                         if (this.left_tree.getActiveFile().xtype == "Roo" ) {
546                                    this.window_rooview.requestRedraw();
547                         } else {
548                                   this.window_gladeview.loadFile(this.left_tree.getActiveFile());
549                         }
550                          
551                         
552                          // we do not need to call spawn... - as it's already called by the editor?
553                          
554                 });
555                 
556         }
557          
558         
559         // ----------- file view
560         public void showPopoverFiles(Gtk.Widget btn, Project.Project? project, bool new_window)
561         {
562                 this.popover_files.show(  project, new_window);
563         
564         }
565         
566         
567  
568         public void fileDetailsInit()
569         {
570                 this.file_details = new Xcls_PopoverFileDetails();
571                 this.file_details.mainwindow = this.win;
572                 this.file_details.el.application = this.win.el.application;
573 //              this.file_details.el.set_parent(this.win.el);
574                 // force it modal to the main window..
575                 
576                 this.file_details.success.connect((project,file) =>
577                 {
578                         this.popover_files.el.hide();
579                         this.fileViewOpen(file, this.file_details.new_window,  -1);
580                         // if it's comming from the file dialog -> hide it...
581                         
582                 });
583
584         }
585         
586         
587         public void gotoLine(int line)
588         {
589         
590                 if (line < 0) {
591                         return;
592                 }
593                 if (file.xtype == "PlainFile") {
594                     this.switchState (State.CODEONLY); 
595                          
596                         this.code_editor_tab.scroll_to_line(line);
597                         return;
598                 }               
599         
600         
601                 this.switchState (State.PREVIEW); 
602                  
603                 if ( line> -1 ) {
604                         // fixme - show the editing tab.
605                         // node and prop?
606                         var node = file.lineToNode(line);
607                         if (node != null) {
608                                 this.left_tree.model.selectNode(node);
609                                 var prop = node.lineToProp(line);
610                                 
611                                 if (prop == null) {
612                                         GLib.debug("could not find prop at line %d", line);
613                                         return;
614                                 }
615                                  this.left_props.view.editProp(prop);
616                                 
617                                 
618                                 
619                                 return;
620                         } 
621                         
622                         if (this.project.xtype == "Gtk") {
623                                 this.window_gladeview.scroll_to_line(line);
624                         } else {
625                                 this.window_rooview.scroll_to_line(line);                       
626                         }
627                         
628                         return;
629                 } 
630                 var node = file.lineToNode(line);
631                 if (node != null) {
632                         this.left_tree.model.selectNode(node);
633                         //var prop = node.lineToProp(line);
634                         return;
635                 } 
636         
637                 this.window_rooview.scroll_to_line(line);
638                 
639         
640         
641         }
642         
643         public void fileViewOpen(JsRender.JsRender file, bool new_window, int line = -1)
644         {
645                 var existing = BuilderApplication.getWindow(file);
646                 
647                 if (existing != null) {
648                         existing.el.present();
649                         existing.windowstate.gotoLine(line);
650                         return;
651                 }
652                 
653                 if (new_window) {
654         
655                         this.popover_files.el.hide();
656                         BuilderApplication.newWindow(file, line);
657                         return;
658                 }
659                 
660                 
661                 this.win.project = file.project;
662                 this.project = file.project;
663                 this.file = file;
664
665                 
666                 file.getLanguageServer().document_open(file);
667                 BuilderApplication.showSpinner("spinner", "document open sent");        
668                         
669                 if (file.xtype == "PlainFile") {
670                         this.win.codeeditviewbox.el.show();
671                         this.switchState (State.CODEONLY); 
672                         try {
673                                 file.loadItems();
674                         } catch (Error e) {}
675                         this.code_editor_tab.show(file, null, null);
676                          
677                 } else {
678                 
679                         this.switchState (State.PREVIEW); 
680                         // this triggers loadItems..
681                         this.left_tree.model.loadFile(file);
682                          
683
684                 }
685  
686
687                 this.gotoLine(line);
688         
689                 var ctr= this.win.rooviewbox.el;
690  
691         
692                 if (file.project.xtype == "Roo" ) { 
693                     // removes all the childe elemnts from rooviewbox
694                         while( ctr.get_last_child() != null) {
695                                 ctr.remove(ctr.get_last_child());
696                         }
697                         
698                         ctr.append(this.window_rooview.el);
699  
700                         if (file.xtype != "PlainFile") {       
701  
702                                 this.window_rooview.loadFile(file);
703                                 this.window_rooview.el.show();
704                         }
705  
706                         
707
708                 } else {
709                         while( ctr.get_last_child() != null) {
710                                 ctr.remove(ctr.get_last_child());
711                         }
712
713                         ctr.append(this.window_gladeview.el);
714  
715                         if (file.xtype != "PlainFile") {    
716                                 
717                                 this.window_gladeview.loadFile(file);
718                                 this.window_gladeview.el.show();
719                         }
720  
721                 }
722                 print("OPEN : " + file.name);
723                 if (file.xtype != "PlainFile") { 
724                         // hide the file editor.
725                    this.win.codeeditviewbox.el.hide();
726                         //this.win.editpane.el.set_position(this.win.editpane.el.max_position);
727                 }
728                 this.win.setTitle();
729                 
730                 BuilderApplication.updateCompileResults();       
731
732         }
733  
734  
735          /*
736         public void fileViewOpenPlain(string fname)
737         {
738                 
739                 this.switchState (State.CODEONLY); 
740                 this.code_editor.showPlainFile(fname);
741         }
742  */
743          
744         // ---------  webkit view
745         public void webkitViewInit()
746         {
747                 this.window_rooview  =new Xcls_WindowRooView();
748                 this.window_rooview.main_window = this.win;
749                 this.window_rooview.ref();
750                 this.win.rooviewbox.el.append(this.window_rooview.el);
751                 
752                 this.window_rooview.el.show();
753                 this.win.rooviewbox.el.hide();
754         
755         }
756
757         // ------ Gtk  - view
758
759         public void gtkViewInit()
760         {
761
762                 
763                 
764                 this.window_gladeview  =new Xcls_GtkView( );
765                 this.window_gladeview.ref();
766                 this.window_gladeview.main_window = this.win;
767  
768         }
769         
770
771         
772         
773         public void showProps(Gtk.Widget btn, JsRender.NodePropType sig_or_listen)
774         {
775                 var ae =  this.left_tree.getActiveElement();
776                 if (ae == null) {
777                                 return;
778                 }
779                 this.rightpalete.hide(); 
780                 if (this.add_props.el.parent == null) {
781                         this.add_props.el.set_parent(btn);
782                 }
783                 this.add_props.el.set_position(Gtk.PositionType.RIGHT);
784          
785                 this.add_props.show(
786                         this.win.project.palete, //Palete.factory(this.win.project.xtype), 
787                          sig_or_listen, //this.state == State.LISTENER ? "signals" : "props",
788                         ae,
789                         btn
790                         
791                 );
792         }
793         
794         public void showAddObject(Gtk.Widget btn, JsRender.Node? on_node)
795         {
796          
797                  
798                 this.add_props.hide();
799                  
800                 this.add_props.el.set_position(Gtk.PositionType.RIGHT);
801                 
802                 //this.rightpalete.el.set_parent(btn);
803  
804                 this.rightpalete.show(
805                         this.left_tree.getActiveFile().palete(), 
806                         on_node == null ? "*top" : on_node.fqn(),
807                         btn
808                 );
809         }
810          
811                   
812         
813         public void switchState(State new_state)
814         {
815                 
816                 // if the new state and the old state are the same..
817                 
818                 if (new_state == this.state) {
819                         return;
820                 }
821                 
822                 // anything to do beforehand?
823                 
824                 switch (this.state) {
825                          
826                  
827                         
828                         case State.PREVIEW:
829                                 // stop editing the editor tab.
830                                 // always save before calling switch state to preview?
831                                 
832                                 this.code_editor_tab.reset();
833                                  
834                                 if (this.left_tree.getActiveFile() != null) {
835                                          if (this.left_tree.getActiveFile().xtype == "Roo" ) {
836                                                  this.window_rooview.createThumb();
837                                          } else {
838                                                   this.window_gladeview.createThumb();
839                                           }
840                                 }
841                                 // normally we are going from preview to another state.
842                                 // and different windows hide the preview in differnt ways..
843                                 break;
844                                 
845                         case State.CODEONLY:
846                         case State.CODE:
847                         case State.NONE:
848                                 break;
849                                 
850          }
851                          
852                 this.state = new_state;
853                  
854                 
855                 switch (this.state) {
856
857                         case State.PREVIEW:  // this is the default state when working...
858                                 this.win.leftpane.el.show();
859                                 this.win.editpane.el.show(); // holder for tree and properties..
860                             this.win.rooviewbox.el.show();
861                                 this.win.codeeditviewbox.el.hide();
862                                 break;
863
864                         case State.CODE:
865                                 this.win.leftpane.el.show();
866                                 this.win.editpane.el.show();
867                                 this.win.rooviewbox.el.hide();
868                                 this.win.codeeditviewbox.el.show();
869                                 this.code_editor_tab.el.show();
870                                 break;
871
872                         case State.CODEONLY:
873                                 this.win.leftpane.el.hide();
874                                 this.win.codeeditviewbox.el.show();
875                                 this.win.rooviewbox.el.hide();
876                                 this.code_editor_tab.el.show();
877                                 break;
878
879                         case State.NONE:
880                                 break;
881
882                 }
883
884         }
885   
886  
887 }
888
889