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