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