src/Builder4/WindowState.vala
[app.Builder.js] / 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         OBJECT,
16         PROP,
17         LISTENER,
18         CODE,
19         FILES,
20         PROJECT // project settings..
21     }
22
23     public State state = State.NONE;
24
25     public bool children_loaded = false;
26
27     
28     public Xcls_WindowLeftTree  left_tree;
29     public Xcls_WindowAddProp   add_props;
30     public Xcls_LeftProps       left_props;
31     public Xcls_ProjectSettings projectsettings;
32     public ValaProjectSettings  vala_projectsettings;
33     public Xcls_RightPalete     rightpalete;
34     public Editor               code_editor;    
35     public Xcls_WindowRooView   window_rooview;
36     public Xcls_GtkView         window_gladeview;
37     public Xcls_DialogNewComponent new_file_dialog;
38     public Xcls_ClutterFiles     clutterfiles;
39
40     public Xcls_WindowLeftProjects left_projects; // can not see where this is initialized.. 
41     
42     // dialogs??
43     public Xcls_DialogPluginWebkit webkit_plugin;
44     
45     // ctor 
46     public WindowState(Xcls_MainWindow win)
47     {
48         this.win = win;
49         // initialize
50
51         // left elements..
52         this.leftTreeInit();
53         this.propsListInit();
54
55         // on clutter space...
56         this.projectEditInit();
57         this.codeEditInit();
58         this.projectListInit();
59         this.fileViewInit();
60         
61         // adding stuff
62         this.objectAddInit();
63         this.propsAddInit();
64      
65         
66         // previews...
67         this.gtkViewInit();
68         this.webkitViewInit();
69
70         // dialogs
71
72         this.fileNewInit();
73         
74         this.webkit_plugin = new Xcls_DialogPluginWebkit();
75
76         this.children_loaded = true;
77     }
78
79
80     // left tree
81
82     public void leftTreeInit()
83     {
84      
85         this.left_tree = new Xcls_WindowLeftTree();
86         this.left_tree.ref();
87         this.left_tree.main_window = this.win;
88     
89         this.win.tree.el.pack_start(this.left_tree.el,true, true,0);
90         this.left_tree.el.show_all();
91            
92         this.left_tree.before_node_change.connect(() => {
93             return this.leftTreeBeforeChange();
94
95         });
96
97         this.left_tree.node_selected.connect((sel) => {
98             this.leftTreeNodeSelected(sel);
99         });
100      
101         this.left_tree.changed.connect(() => {
102             this.window_rooview.requestRedraw();
103             this.left_tree.model.file.save();
104         });
105          
106     }
107
108     public bool leftTreeBeforeChange()
109     {
110         if (this.state != State.CODE) {
111             this.left_props.finish_editing();
112             return true;
113         }
114         if (!this.code_editor.saveContents()) {
115             return false;
116         }
117         return false;
118     }
119     
120     public void leftTreeNodeSelected(JsRender.Node? sel)
121     {
122
123         print("node_selected called %s\n", (sel == null) ? "NULL" : "a value");
124
125         if (sel == null) {
126             this.left_props.el.hide();
127         } 
128         this.left_props.el.show();
129         this.left_props.load(this.left_tree.getActiveFile(), sel);
130         switch (this.state) {
131             
132             case State.OBJECT: 
133                   
134                  if (sel == null) {
135                     this.rightpalete.clear();
136                     break;
137                 }
138                 this.rightpalete.load(this.left_tree.getActiveFile().palete(), sel.fqn());
139                 break;
140                  
141         
142            case State.PROP:
143                 if (sel == null) {
144                     this.add_props.clear();
145                     break;
146                 }
147                 this.add_props.show(this.left_tree.getActiveFile().palete(), "props", sel.fqn());
148                 break;
149
150             case State.LISTENER:
151                
152                 if (sel == null) {
153                     this.add_props.clear();
154                     break;
155                 }
156                 this.add_props.show(this.left_tree.getActiveFile().palete(), "signals", sel.fqn());
157                 break;
158                 
159             case State.CODE:
160                  this.switchState(State.PREVIEW);
161              
162                 break;
163                
164                             
165         }
166          
167
168     }
169
170
171
172
173     public void propsListInit()
174     {
175     
176         this.left_props =new Xcls_LeftProps();
177         this.left_props.ref();
178         this.left_props.main_window = this.win;
179         this.win.props.el.pack_start(this.left_props.el,true, true,0);
180         this.left_props.el.show_all();
181     
182         this.left_props.show_editor.connect( (file, node, type,  key) => {
183             this.switchState(State.CODE);
184             this.code_editor.show(
185                 file,
186                 node,
187                 type,
188                 key
189             );
190             
191             
192         });
193
194    
195         this.left_props.stop_editor.connect( () => {
196             if (this.state != State.CODE) {
197                 return true;
198             }
199     
200             var ret =  this.code_editor.saveContents();
201             if (!ret) {
202                 return false;
203             }
204             this.switchState(State.PREVIEW);
205             return ret;
206         });
207     
208         this.left_props.changed.connect(() => {
209               if (this.left_tree.getActiveFile().xtype == "Roo" ) {
210                    this.window_rooview.requestRedraw();
211                    
212                } else {
213                   this.window_gladeview.loadFile(this.left_tree.getActiveFile());
214               }
215               this.left_tree.model.updateSelected();
216               this.left_tree.model.file.save();
217         });
218     
219
220
221     }
222
223     //-------------  projects edit
224
225     public void projectEditInit()
226     {
227         this.projectsettings  =new Xcls_ProjectSettings();
228         this.projectsettings.ref();  /// really?
229     
230         this.vala_projectsettings  =new ValaProjectSettings();
231         this.vala_projectsettings.ref();
232         this.vala_projectsettings.window = this.win;
233     
234         ((Gtk.Container)(this.win.projecteditview.el.get_widget())).add(this.projectsettings.el);
235         //this.projectsettings.el.show_all();
236
237         var stage = this.win.projecteditview.el.get_stage();
238         stage.set_background_color(  Clutter.Color.from_string("#000"));
239     
240         this.projectsettings.buttonPressed.connect((btn) => {
241              if (this.left_tree.getActiveFile().xtype == "Roo" ) {
242                 if (btn == "save") {
243                     this.window_rooview.view.renderJS(true);
244                 }
245                 if (btn == "apply") {
246                     this.window_rooview.view.renderJS(true);
247                     return;
248                 }
249             } else {
250                 // do nothing for gtk..
251             }
252             if (btn == "save" || btn == "apply") {
253                 this.win.project.save();
254          
255             }
256             this.switchState (State.PREVIEW); 
257              
258          });
259
260     }
261     // ----------- object adding
262     public void objectAddInit()
263     {
264
265         this.rightpalete  = new Xcls_RightPalete();
266         this.rightpalete.ref();  /// really?
267         ((Gtk.Container)(this.win.objectview.el.get_widget())).add(this.rightpalete.el);
268         //this.projectsettings.el.show_all();
269
270         var stage = this.win.objectview.el.get_stage();
271         stage.set_background_color(  Clutter.Color.from_string("#000"));
272            
273     }
274     
275     // -----------  properties adding list...
276     // listener uses the properties 
277     public void propsAddInit()
278     {
279     // Add properties
280         this.add_props  = new Xcls_WindowAddProp();
281         this.add_props.ref();  /// really?
282         ((Gtk.Container)(this.win.addpropsview.el.get_widget())).add(this.add_props.el);
283         //this.projectsettings.el.show_all();
284
285         var  stage = this.win.addpropsview.el.get_stage();
286         stage.set_background_color(  Clutter.Color.from_string("#000"));
287
288
289         this.add_props.select.connect( (key,type,skel, etype) => {
290             this.left_props.addProp(etype, key, skel, type);
291         });
292
293     }
294     public void propsAddShow()
295     {
296
297     }
298     public void propsAddHide()
299     {
300     
301     }
302
303
304
305     
306     // ----------- Add / Edit listener
307     // listener uses the properties 
308     //public void listenerInit()     { }
309     public void listenerShow()
310     {
311
312     }
313     public void listenerHide()
314     {
315     
316     }
317
318     // -------------- codeEditor
319
320     public void codeEditInit()
321     {
322         this.code_editor  = new  Editor();
323         this.code_editor.ref();  /// really?
324         ((Gtk.Container)(this.win.codeeditview.el.get_widget())).add(this.code_editor.el);
325         //this.projectsettings.el.show_all();
326
327         var stage = this.win.codeeditview.el.get_stage();
328         stage.set_background_color(  Clutter.Color.from_string("#000"));
329         // editor.save...
330
331         this.code_editor.save.connect( () => {
332              this.left_tree.model.file.save();
333              this.left_tree.model.updateSelected();
334         });
335         
336     }
337
338     // ----------- list of projects on left
339     public void  projectListInit() 
340     {
341
342         this.left_projects = new Xcls_WindowLeftProjects();
343          this.left_projects.ref();
344          this.win.leftpane.el.pack_start(this.left_projects.el,true, true,0);
345          this.left_projects.el.show_all();
346          this.left_projects.project_selected.connect((proj) => {
347             proj.scanDirs();
348             this.clutterfiles.loadProject(proj);
349         
350          });
351
352     }
353     // ----------- file view
354
355     public void fileViewInit()
356     {
357         var stage = this.win.rooview.el.get_stage(); // seems odd... 
358         this.clutterfiles = new Xcls_ClutterFiles();
359         this.clutterfiles.ref();
360         stage.add_child(this.clutterfiles.el);
361         this.clutterfiles.el.show_all();
362
363
364         this.clutterfiles.open.connect((file) => { 
365             this.fileViewOpen(file);
366         });
367         this.clutterfiles.el.transitions_completed.connect(() => {
368             if (this.state == State.FILES) {
369                 this.win.rooview.el.hide();
370             } else {
371                 this.clutterfiles.el.hide();
372             }
373             
374             
375         });
376
377     }
378     public void fileNewInit()
379     {
380         this.new_file_dialog = new Xcls_DialogNewComponent();
381         // force it modal to the main window..
382         this.new_file_dialog.el.set_transient_for(this.win.el);
383         this.new_file_dialog.el.set_modal(true);
384     
385         this.new_file_dialog.success.connect((project,file) =>
386         {
387             this.fileViewOpen(file);
388         });
389
390     }
391
392     
393     public void fileViewOpen(JsRender.JsRender file)
394     {
395         this.win.project = file.project;
396         this.switchState (State.PREVIEW); 
397         
398         this.left_tree.model.loadFile(file);
399     
400         var ctr= ((Gtk.Container)(this.win.rooview.el.get_widget()));
401         var ctr_p= ((Gtk.Container)(this.win.projecteditview.el.get_widget()));
402     
403         if (file.xtype == "Roo" ) { 
404             ctr.foreach( (w) => { ctr.remove(w); });
405             ctr_p.foreach( (w) => { ctr_p.remove(w); });
406             ctr.add(this.window_rooview.el);
407             ctr_p.add(this.projectsettings.el);            
408             this.window_rooview.loadFile(file);
409             this.window_rooview.el.show_all();
410             this.projectsettings.el.show_all();            
411
412         } else {
413             ctr.foreach( (w) => { ctr.remove(w); });
414             ctr_p.foreach( (w) => { ctr_p.remove(w); });            
415             ctr.add(this.window_gladeview.el);
416             ctr_p.add(this.vala_projectsettings.el);
417             this.window_gladeview.loadFile(file);
418             this.window_gladeview.el.show_all();
419             this.vala_projectsettings.el.show_all();
420         }
421         print("OPEN : " + file.name);
422         this.win.editpane.el.set_position(this.win.editpane.el.max_position);
423         this.win.setTitle(file.project.name + " : " +file.name);
424              
425
426         }
427
428     
429     // ---------  webkit view
430     public void webkitViewInit()
431     {
432         this.window_rooview  =new Xcls_WindowRooView();
433         this.window_rooview.ref();
434         ((Gtk.Container)(this.win.rooview.el.get_widget())).add(this.window_rooview.el);
435         this.window_rooview.el.show_all();
436
437         var stage = this.win.rooview.el.get_stage();
438         stage.set_background_color(  Clutter.Color.from_string("#000"));
439     }
440
441     // ------ Gtk  - view
442
443     public void gtkViewInit()
444     {
445         this.window_gladeview  =new Xcls_GtkView();
446         this.window_gladeview.ref();
447     }
448     
449     public void easingSaveAll()
450     {
451         this.win.addpropsview.el.save_easing_state();
452         this.win.codeeditview.el.save_easing_state();
453         this.win.objectview.el.save_easing_state();
454         this.win.projecteditview.el.save_easing_state();
455         this.win.rooview.el.save_easing_state();
456         this.clutterfiles.el.save_easing_state();
457          
458     }
459     public void easingRestoreAll()
460     {
461         this.win.addpropsview.el.restore_easing_state();
462         this.win.codeeditview.el.restore_easing_state();
463         this.win.objectview.el.restore_easing_state();
464         this.win.projecteditview.el.restore_easing_state();
465         this.win.rooview.el.restore_easing_state();
466         this.clutterfiles.el.restore_easing_state();
467         
468     }
469     public void switchState(State new_state)
470     {
471         
472         // save the easing state of everything..
473         this.easingSaveAll();
474         
475         switch (this.state) {
476
477             case State.PREVIEW:
478                 if (this.left_tree.getActiveFile() != null) {
479                      if (this.left_tree.getActiveFile().xtype == "Roo" ) {
480                          this.window_rooview.createThumb();
481                      } else {
482                           this.window_gladeview.createThumb();
483                       }
484                 }
485                 // normally we are going from preview to another state.
486                 // and different windows hide the preview in differnt ways..
487                 
488                 break;
489             
490            case State.LISTENER:
491            case State.PROP:
492                 
493                 this.win.addpropsview.el.set_scale(0.0f,0.0f);
494                  break;
495                 
496             case State.CODE:
497
498
499                 this.code_editor.saveContents();
500               
501                 this.win.codeeditview.el.set_scale(0.0f,0.0f);
502                  break;
503
504
505              case State.OBJECT:
506                
507                 this.win.objectview.el.set_scale(0.0f,0.0f);
508                  break;
509
510            case State.PROJECT:
511                 if (this.win.project.xtype == "Gtk") {
512                     this.vala_projectsettings.save();
513                 } 
514                 
515                 this.win.projecteditview.el.set_scale(0.0f,0.0f);
516                  break;
517
518           case State.FILES:
519                 // hide files...
520                 
521                 this.win.rooview.el.show_all();
522                 this.win.rooview.el.set_easing_duration(1000);
523                 this.win.rooview.el.set_rotation_angle(Clutter.RotateAxis.Y_AXIS, 0.0f);
524                 this.win.rooview.el.set_scale(1.0f,1.0f);
525                 this.win.rooview.el.set_pivot_point(0.5f,0.5f);
526                 this.win.rooview.el.set_opacity(0xff);
527                
528                 
529                
530                  this.clutterfiles.el.set_easing_duration(1000);
531                 this.clutterfiles.el.set_pivot_point(0.5f,0.5f);
532                 this.clutterfiles.el.set_rotation_angle(Clutter.RotateAxis.Y_AXIS, -180.0f);
533                 this.clutterfiles.el.set_opacity(0);
534  
535                 //this.clutterfiles.el.hide();
536                  
537
538                 break;
539
540                 
541         }
542        
543         var oldstate  =this.state;
544         this.state = new_state;
545         
546         
547                 
548         this.buttonsShowHide();
549         
550         
551         switch (this.state) {
552             
553             case State.PREVIEW:  // this is the default state when working...
554                  this.win.editpane.el.show(); // holder for tree and properties..
555                  
556              
557                  this.left_projects.el.hide(); 
558                  if (oldstate != State.FILES) {
559                     // it's handled above..
560                     print ("changing state to preview from NOT files..");
561                      
562  
563                     this.win.rooview.el.set_scale(1.0f,1.0f);
564                  }
565                
566                 break;
567
568
569             case State.LISTENER:
570                 // same as prop?
571             case State.PROP:
572                 var ae =      this.left_tree.getActiveElement();
573                 if (ae == null) {
574                     this.state = oldstate;
575                     this.buttonsShowHide();
576                     this.resizeCanvasElements();
577                     this.easingRestoreAll();
578                     return;
579                 }
580                 this.add_props.el.show_all();
581                 this.add_props.show(
582                     Palete.factory(this.win.project.xtype), 
583                     this.state == State.LISTENER ? "signals" : "props",
584                     ae.fqn()
585                 );
586  
587                     
588  
589                 
590                 // -- FIXME? this needs to be State aware?
591          
592                 this.win.rooview.el.set_pivot_point(1.0f,0.5f);
593                   
594                 this.win.addpropsview.el.set_scale(1.0f,1.0f);
595                  break;
596            
597             case State.OBJECT:
598                  var n = this.left_tree.getActiveElement();
599
600                 if (this.left_tree.model.file == null) {
601                     this.state =oldstate;
602                     this.buttonsShowHide();
603                     this.resizeCanvasElements();
604                     this.easingRestoreAll();
605                     return;
606                 }
607                 
608                 if (n == null && this.left_tree.model.file.tree != null) {
609                     this.state = oldstate;
610                     this.buttonsShowHide();
611                     this.resizeCanvasElements();
612                     this.easingRestoreAll();
613                     return;
614                 }
615
616                 this.rightpalete.el.show_all();
617                 this.rightpalete.load(this.left_tree.getActiveFile().palete(), n == null ? "*top" : n.fqn());
618
619                 
620               
621             
622                 this.win.objectview.el.set_scale(1.0f,1.0f);
623                  
624                 break;
625                
626                
627             case State.CODE:
628
629                 this.code_editor.el.show_all();
630                 
631                 // caller needs to call editor - show....
632                   
633  
634                  this.win.codeeditview.el.set_scale(1.0f,1.0f);
635                  break;
636
637
638
639            case State.PROJECT:
640
641                if (this.win.project.xtype == "Roo") {
642                     this.projectsettings.el.show_all();
643                     this.projectsettings.show(this.win.project);
644                 } else {
645                     this.vala_projectsettings.el.show_all();
646                     this.vala_projectsettings.show((Project.Gtk)this.win.project);
647                 }
648
649                 this.win.rooview.el.set_pivot_point(1.0f,1.0f); // bottom right..
650                 
651                 this.win.projecteditview.el.set_scale(1.0f,1.0f);
652                 
653                
654                 break;
655                 
656            case State.FILES:  // can only get here from PREVIEW state.. in theory..
657                 
658    
659                 this.win.editpane.el.hide(); // holder for tree and properties..
660              
661                 this.left_projects.el.show(); 
662             
663                  this.win.rooview.el.set_easing_duration(1000);
664                 this.win.rooview.el.set_pivot_point(0.5f,0.5f);
665                 this.win.rooview.el.set_rotation_angle(Clutter.RotateAxis.Y_AXIS, 180.0f);
666                 this.win.rooview.el.set_opacity(0);
667                 //el.set_scale(0.0f,0.0f);
668
669  
670                 if (this.win.project != null) {
671                     this.left_projects.selectProject(this.win.project);
672                 }
673              
674                 
675                 this.clutterfiles.el.show_all();
676                  
677                 this.clutterfiles.el.set_easing_duration(1000);
678                 this.clutterfiles.el.set_pivot_point(0.5f,0.5f);
679                 this.clutterfiles.el.set_rotation_angle(Clutter.RotateAxis.Y_AXIS, 0.0f);
680                 this.clutterfiles.el.set_opacity(0xff);
681                 
682                 
683                 
684                 break;
685
686
687         }
688         this.resizeCanvasElements();
689         this.easingRestoreAll();
690         
691             
692     }
693     
694     public int redraw_count = 0;
695     public void resizeCanvas() // called by window resize .. delays redraw
696     {
697         var rc = this.redraw_count;        
698         this.redraw_count = 2;
699         if (rc == 0) {
700             GLib.Timeout.add(100,  ()  =>{
701                  return this.resizeCanvasQueue();
702             });
703         }
704     }
705     public bool  resizeCanvasQueue()
706     {
707         //print("WindowState.resizeCanvasQueue %d\n", this.redraw_count);        
708
709         if (this.redraw_count < 1) {
710             return false; // should not really happen...
711         }
712
713
714         this.redraw_count--;
715
716         if (this.redraw_count > 0) {
717             return true; // do it again in 1 second...
718         }
719         // got down to 0 or -1....
720         this.redraw_count = 0;
721         this.resizeCanvasElements();
722         return false;
723
724     }
725     public void resizeCanvasElements()
726     {
727         Gtk.Allocation alloc;
728         this.win.clutterembed.el.get_allocation(out alloc);
729
730            // print("WindowState.resizeCanvasElements\n");
731             if (!this.children_loaded || this.win.clutterembed == null) {
732                 print("WindowState.resizeCanvasElements = ingnore not loaded or no clutterfiles\n");
733             return; 
734         }
735             
736         var avail = alloc.width < 50.0f ? 0 :  alloc.width - 50.0f;
737         var palsize = avail < 300.0f ? avail : 300.0f;
738            
739  
740         // -------- code edit min 600
741         
742         var codesize = avail < 800.0f ? avail : 800.0f;
743         
744         
745         //print("set code size %f\n", codesize);
746
747             
748         
749         switch ( this.state) {
750             case State.PREVIEW:
751                 this.win.rooview.el.set_size(alloc.width-50, alloc.height);
752                 break;
753     
754             case State.FILES: 
755                 this.clutterfiles.set_size(alloc.width-50, alloc.height);
756                 break;
757
758             case State.PROJECT:
759              
760                 this.win.projecteditview.el.set_size(alloc.width-50, alloc.height / 2.0f);
761                 
762                // this.win.rooview.el.save_easing_state();
763                 //this.win.rooview.el.set_size(alloc.width / 2.0f, alloc.height / 2.0f);
764                 this.win.rooview.el.set_scale(0.5f, 0.5f);
765                 //this.win.rooview.el.restore_easing_state();
766                 break;
767
768             case State.CODE: 
769                 this.win.codeeditview.el.set_size(codesize, alloc.height);
770                 var scale = avail > 0.0f ? (avail - codesize -10 ) / avail : 0.0f;
771                     //this.win.rooview.el.save_easing_state();
772                  
773                 this.win.rooview.el.set_scale(scale,scale);
774                // this.win.rooview.el.restore_easing_state();
775                 break;
776                 
777             case State.PROP:
778             case State.LISTENER:
779                  this.win.addpropsview.el.set_size(palsize, alloc.height);
780                 var scale = avail > 0.0f ? (avail - palsize -10 ) / avail : 0.0f;
781                 this.win.rooview.el.set_scale(scale,scale);
782                 break;
783                 
784             case State.OBJECT:  
785                 this.win.objectview.el.set_size(palsize, alloc.height);    
786                 var scale = avail > 0.0f ? (avail - palsize -10 ) / avail : 0.0f;
787                 //this.win.rooview.el.save_easing_state();
788                 this.win.rooview.el.set_scale(scale,scale);
789                // this.win.rooview.el.restore_easing_state();
790                 break;
791         }
792     }
793
794     // -- buttons show hide.....
795
796     public void buttonsShowHide()
797     {
798         // basically hide everything, then show the relivant..
799
800          this.win.backbutton.el.hide();
801     
802         this.win.projectbutton.el.hide(); // show file nav...
803         this.win.editfilebutton.el.hide();
804         this.win.projecteditbutton.el.hide();
805          
806         
807         this.win.objectshowbutton.el.hide(); // add objects
808         this.win.addpropbutton.el.hide();  
809         this.win.addlistenerbutton.el.hide(); 
810
811     
812     
813         this.win.addprojectbutton.el.hide();
814         this.win.addfilebutton.el.hide();
815         this.win.delprojectbutton.el.hide();
816         this.win.new_window.el.hide();
817         this.win.reload_resources.el.hide();
818         
819         switch (this.state) {
820             
821             case State.PREVIEW:  // this is the default state when working...
822                
823                 this.win.projectbutton.el.show(); // show file nav...
824                 this.win.editfilebutton.el.show();
825                 this.win.projecteditbutton.el.show();
826                  
827                 
828                 this.win.objectshowbutton.el.show(); // add objects
829                 this.win.addpropbutton.el.show();  
830                 this.win.addlistenerbutton.el.show(); 
831                 break;
832             
833            
834             case State.CODE: 
835             case State.PROP:
836             case State.LISTENER:
837             case State.OBJECT:
838                 
839                 this.win.backbutton.el.show();
840                 this.win.objectshowbutton.el.show(); // add objects
841                 this.win.addpropbutton.el.show();  
842                 this.win.addlistenerbutton.el.show(); 
843                 break;
844             
845             case State.PROJECT: 
846                 // anything else?
847                 this.win.backbutton.el.show();
848                 break;
849             
850     
851             case State.FILES:
852                 this.win.backbutton.el.show();
853                      
854                 this.win.addprojectbutton.el.show();
855                 this.win.addfilebutton.el.show();
856                 this.win.delprojectbutton.el.show();
857                 this.win.new_window.el.show();
858                 this.win.reload_resources.el.show();
859                 break;
860         }
861
862     }
863
864     
865 }
866
867