Fix #8003 - undo code
[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 Editor                                   code_editor_tab; 
32         public Xcls_WindowRooView               window_rooview;
33         public Xcls_GtkView                             window_gladeview;
34         public DialogFiles                              popover_files;
35         
36         //public Xcls_ClutterFiles     clutterfiles;
37         //public Xcls_WindowLeftProjects left_projects; // can not see where this is initialized.. 
38          
39         public DialogTemplateSelect template_select; 
40         
41         public Xcls_PopoverFileDetails file_details;
42         public Xcls_ValaCompileResults compile_results;
43         
44
45         // used by window list..
46         public string file_name {
47                 owned get { return this.file.relpath; }
48                 private set {}
49         }
50         
51         
52         //public Palete.ValaSource valasource; // the spawner that runs the vala compiler.
53         public Json.Object last_compile_result;
54         
55         // ctor 
56         public WindowState(Xcls_MainWindow win)
57         {
58                 this.win = win;
59         }
60         
61         public void init()
62         {
63         
64                 // initialize
65
66                 // left elements..
67                 this.leftTreeInit();
68                 this.propsListInit();
69
70                 // on clutter space...
71                 this.projectEditInit();
72                 this.codeEditInit();
73                 //this.codePopoverEditInit();
74                 //this.projectListInit();
75                 //this.fileViewInit();
76
77                 // adding stuff
78                 this.objectAddInit();
79                 this.propsAddInit();
80
81
82                 // previews...
83                 this.gtkViewInit();
84                 this.webkitViewInit();
85
86                 // dialogs
87
88                 this.fileDetailsInit();
89
90
91                 this.template_select = new DialogTemplateSelect();
92                 this.children_loaded = true;
93                 
94                 
95                  
96                 //BuilderApplication.valasource.compiled.connect(this.showCompileResult); 
97                 
98                 
99                 this.compile_results = new  Xcls_ValaCompileResults(); // the poup dialogs with results in.
100                 this.compile_results.window = this.win;
101                 //BuilderApplication.valasource.compile_output.connect(this.compile_results.addLine);
102                 
103                 this.win.statusbar_compilestatus_label.el.hide();
104                 this.win.statusbar_run.el.hide();
105   
106                 this.popover_files = new DialogFiles();
107                  this.popover_files.win = this.win;
108             this.popover_files.el.application = this.win.el.application;
109             this.popover_files.el.set_transient_for( this.win.el );
110  
111
112         }
113
114  
115         // left tree
116
117         public void leftTreeInit()
118         {
119          
120                 this.left_tree = new Xcls_WindowLeftTree();
121                 this.left_tree.ref();
122                 this.left_tree.main_window = this.win;
123         
124                 this.win.leftpane.el.remove(this.win.editpane.el);
125         //this.win.tree.el.remove(this.left_tree.el);
126         this.win.leftpane.el.append(this.left_tree.el);
127             
128         
129                 //this.win.tree.el.pack_start(this.left_tree.el,true, true,0);
130                 this.left_tree.el.show();
131                    
132                 this.left_tree.before_node_change.connect(() => {
133                         // if the node change is caused by the editor (code preview)
134                         if (this.left_tree.view.lastEventSource == "editor") {
135                                 return true;
136                         }
137                         return this.leftTreeBeforeChange();
138
139                 });
140                 // node selected -- only by clicking?
141                 this.left_tree.node_selected.connect((sel) => {
142                         //if (source == "editor") {
143                         //      return;
144                         //}
145                         if (this.file.xtype == "Roo") { 
146                                 this.window_rooview.sourceview.nodeSelected(sel,true); // foce scroll.
147                         } else {
148                                 this.window_gladeview.sourceview.nodeSelected(sel, true);
149                         }
150                 });
151                 
152                 this.left_tree.node_selected.connect((sel) => {
153                         this.leftTreeNodeSelected(sel);
154                 });
155          
156                 this.left_tree.changed.connect(() => {
157                         GLib.debug("LEFT TREE: Changed fired\n");
158                         this.file.save();
159                         if (this.left_tree.getActiveFile().xtype == "Roo" ) {
160                                    this.window_rooview.requestRedraw();
161                         } else {
162                                   this.window_gladeview.loadFile(this.left_tree.getActiveFile());
163                         }
164                          
165                 });
166                  
167         }
168         
169         public void updateErrorMarksAll() 
170         {
171                 this.updateErrorMarks("ERR");
172                 this.updateErrorMarks("WARN");
173                 this.updateErrorMarks("DEPR");
174         
175         }
176         void updateErrorMarks(string cat) 
177         {
178                 this.code_editor_tab.updateErrorMarks();
179                 switch(this.file.xtype) {
180                         case  "Roo":
181                                 this.window_rooview.updateErrorMarks();// foce scroll.
182                                 return;
183                         case "Gtk":
184                                 this.window_gladeview.updateErrorMarks();
185                                 return;
186                          default:
187                                 return;
188                 }
189         }
190         
191         
192
193         public bool leftTreeBeforeChange()
194         {
195                 // in theory code editor has to hide before tree change occurs.
196                 //if (this.state != State.CODE) {
197                         //this.left_props.finish_editing();
198                         
199                         if (this.state == State.CODE) {
200                                 this.code_editor_tab.saveContents();
201                                 this.switchState(State.PREVIEW);
202                         }
203                         
204                         return true;
205                 //}
206
207                 //if (!this.code_editor.saveContents()) {
208                 //      return false;
209                 //}
210                 //return false;
211         }
212         
213         int tree_width = 300;
214         int props_width = 300;
215         
216         public void leftTreeNodeSelected(JsRender.Node? sel)
217         {
218                 
219                 // do we really want to flip paletes if differnt nodes are selected
220                 // showing palete should be deliberate thing..
221                  
222          
223                 print("node_selected called %s\n", (sel == null) ? "NULL" : "a value");
224
225                 this.add_props.hide(); // always hide add node/add listener if we change node.
226                 this.rightpalete.hide();
227                 
228                 this.left_props.load(this.left_tree.getActiveFile(), sel);
229                 
230                 var outerpane = this.win.mainpane.el;
231                 var innerpane = this.win.editpane.el;
232                 
233                  if (this.win.editpane.el.parent != null && sel != null) {
234                         // select another node... no change to show hide/resize
235                         return;
236                 }
237                                  
238                 if (sel == null) {
239                     // remove win.editpane from leftpane
240                     // remove lefttree from from win.tree 
241                     // add win.tree to leftpane
242                     if (this.win.editpane.el.parent != null) {
243                         this.props_width =  outerpane.get_position() - innerpane.get_position();
244                         this.tree_width = innerpane.get_position();
245                         GLib.debug("HIDE: prop_w = %d, tree_w = %d", this.props_width, this.tree_width);
246                         
247                         this.win.leftpane.el.remove(this.win.editpane.el);
248                         this.win.tree.el.remove(this.left_tree.el);
249                         this.win.leftpane.el.append(this.left_tree.el);
250                 }
251                     
252                 
253                         //GLib.debug("Hide Properties");
254                         outerpane.show(); // make sure it's visiable..
255                         this.left_props.el.hide();
256                         GLib.debug("set position: %d", this.tree_width);
257                         outerpane.set_position(this.tree_width);
258                         //outerpane.set_position(int.max(250,innerpane.get_position()));
259                         //this.left_props.el.width_request =  this.left_props.el.get_allocated_width();
260                         return;
261                 }
262                 
263                 // at this point we are showing the outer only,
264                 
265                 
266                 
267                 
268                 this.tree_width = outerpane.get_position();
269                 
270                 GLib.debug("SHOW: prop_w = %d, tree_w = %d", this.props_width, this.tree_width);
271                       
272                 // remove this.ldeftree from this.win.leftpane
273                 this.win.leftpane.el.remove(this.left_tree.el);
274                 this.win.tree.el.append(this.left_tree.el);
275                 this.win.leftpane.el.append(this.win.editpane.el);
276                 
277                 
278                 
279                 
280                 GLib.debug("left props is %s",  this.left_props.el.visible ? "shown" : "hidden");
281                 // at start (hidden) - outer  = 400 inner = 399
282                 // expanded out -> outer = 686, inner = 399 
283                 //this.win.props.el.pack_start(this.left_props.el,true, true,0);
284                 this.left_props.el.show();              //if (!this.left_props.el.visible) {
285                  
286                         GLib.debug("outerpos : %d, innerpos : %d", outerpane.get_position(), innerpane.get_position());
287                         outerpane.set_position(this.tree_width + this.props_width);
288                         innerpane.set_position(this.tree_width);
289                         /* var cw = outerpane.el.get_position();
290                         var rw = int.min(this.left_props.el.width_request, 150);
291                         print("outerpos : %d, innerpos : %d", cw + rw, cw);
292                         
293                         innerpane.set_position(cw); */
294                         this.left_props.el.show();
295                 
296                 //}
297                 
298                  
299                 
300                 
301                 
302
303                 
304                 
305                 // if either of these are active.. then we should update them??
306                 
307                 
308                 
309    /**
310    
311    make outerpane = {current width of left pane} + width of props
312    make innerpane = {current width of left pane}
313    
314    
315    
316    
317    
318    var outerpane = _this.main_window.leftpane.el;
319    var pane = _this.main_window.editpane.el;
320    
321   
322    
323     var try_size = (i * 25) + 60; // est. 20px per line + 40px header
324     GLib.Timeout.add_seconds(1, () => { 
325                 // max 80%...
326                 pane.set_position( 
327                      ((try_size * 1.0f) /  (pane.max_position * 1.0f))  > 0.8f  ? 
328                     (int) (pane.max_position * 0.2f) :
329                     pane.max_position-try_size);
330             return GLib.Source.REMOVE;
331         });
332         */
333                 
334                 
335                 /*
336                 switch (this.state) {
337                  
338                         case State.CODE:
339                                  this.switchState(State.PREVIEW);
340                          
341                                 break;
342                            
343                                                         
344                 }
345                 */
346  
347                  
348
349         }
350
351
352
353
354         public void propsListInit()
355         {
356         
357                 this.left_props =new Xcls_LeftProps();
358                 this.left_props.ref();
359                 this.left_props.main_window = this.win;
360                 this.win.props.el.append(this.left_props.el);
361                 this.left_props.el.show();
362         
363                 this.left_props.show_editor.connect( (file, node, prop) => {
364                         this.switchState(State.CODE);
365                         
366                         
367                         this.code_editor_tab.show(
368                                 file,
369                                 node,
370                                 prop
371                         );
372                         ///this.markBuf();
373                         
374                         
375                 });
376
377                 // not sure if this is needed - as closing the popvoer should save it.
378                 this.left_props.stop_editor.connect( () => {
379                         var ret =  this.code_editor_tab.saveContents();
380                         if (!ret) {
381                                 return false;
382                         }
383                         this.switchState(State.PREVIEW);
384                          
385                         return ret;
386                 });
387         
388                 this.left_props.changed.connect(() => {
389                         if (this.left_tree.getActiveFile().xtype == "Roo" ) {
390                                    this.window_rooview.requestRedraw();
391                         } else {
392                                   this.window_gladeview.loadFile(this.left_tree.getActiveFile());
393                         }
394                         //this.left_tree.model.updateSelected();
395                         this.file.save();
396
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