2 * as state management is a bit too complicated inside the builder
3 * it's better to seperate this into this class
5 * This class has references to all the Class instances that make up the window..
8 public class WindowState : Object
10 public Xcls_MainWindow win;
21 PROJECT, // project settings..
22 FILEPROJECT, // project when in file mode
23 PROJECTCODEONLY // when editing code...
26 public State state = State.NONE;
28 public bool children_loaded = false;
31 public Project.Project project;
32 public JsRender.JsRender file;
35 public Xcls_WindowLeftTree left_tree;
36 public Xcls_WindowAddProp add_props;
37 public Xcls_LeftProps left_props;
38 public Xcls_ProjectSettings projectsettings;
39 public ValaProjectSettings vala_projectsettings;
40 public Xcls_RightPalete rightpalete;
41 public Editor code_editor;
42 public Xcls_WindowRooView window_rooview;
43 public Xcls_GtkView window_gladeview;
45 public Xcls_ClutterFiles clutterfiles;
47 public Xcls_WindowLeftProjects left_projects; // can not see where this is initialized..
49 public DialogTemplateSelect template_select;
51 public Xcls_PopoverFileDetails file_details;
54 public Xcls_ValaCompileResults compile_results;
57 public Xcls_DialogPluginWebkit webkit_plugin;
60 public Palete.ValaSource valasource; // the spawner that runs the vala compiler.
61 public Json.Object last_compile_result;
64 public WindowState(Xcls_MainWindow win)
73 // on clutter space...
74 this.projectEditInit();
76 this.projectListInit();
86 this.webkitViewInit();
90 this.fileDetailsInit();
92 this.webkit_plugin = new Xcls_DialogPluginWebkit();
93 this.template_select = new DialogTemplateSelect();
94 this.children_loaded = true;
97 this.valasource = new Palete.ValaSource();
98 this.valasource.compiled.connect(this.valaCompiled);
100 this.compile_results = new Xcls_ValaCompileResults();
101 this.compile_results.window = this.win;
102 this.valasource.compile_output.connect(this.compile_results.addLine);
104 this.win.statusbar_compilestatus_label.el.hide();
105 this.win.statusbar_run.el.hide();
106 this.win.search_results.el.hide();
112 public void leftTreeInit()
115 this.left_tree = new Xcls_WindowLeftTree();
116 this.left_tree.ref();
117 this.left_tree.main_window = this.win;
119 this.win.tree.el.pack_start(this.left_tree.el,true, true,0);
120 this.left_tree.el.show_all();
122 this.left_tree.before_node_change.connect(() => {
123 return this.leftTreeBeforeChange();
127 this.left_tree.node_selected.connect((sel, source) => {
128 if (this.file.xtype == "Roo") {
129 this.window_rooview.sourceview.nodeSelected(sel);
131 this.window_gladeview.sourceview.nodeSelected(sel);
135 this.left_tree.node_selected.connect((sel) => {
136 this.leftTreeNodeSelected(sel);
139 this.left_tree.changed.connect(() => {
142 if (this.left_tree.getActiveFile().xtype == "Roo" ) {
143 this.window_rooview.requestRedraw();
145 this.window_gladeview.loadFile(this.left_tree.getActiveFile());
152 public bool leftTreeBeforeChange()
154 if (this.state != State.CODE) {
155 this.left_props.finish_editing();
158 if (!this.code_editor.saveContents()) {
164 public void leftTreeNodeSelected(JsRender.Node? sel)
167 print("node_selected called %s\n", (sel == null) ? "NULL" : "a value");
170 this.left_props.el.hide();
172 this.left_props.el.show();
173 this.left_props.load(this.left_tree.getActiveFile(), sel);
174 switch (this.state) {
179 this.rightpalete.clear();
182 this.rightpalete.load(this.left_tree.getActiveFile().palete(), sel.fqn());
188 this.add_props.clear();
191 this.add_props.show(this.left_tree.getActiveFile().palete(), "props", sel.fqn());
197 this.add_props.clear();
200 this.add_props.show(this.left_tree.getActiveFile().palete(), "signals", sel.fqn());
204 this.switchState(State.PREVIEW);
217 public void propsListInit()
220 this.left_props =new Xcls_LeftProps();
221 this.left_props.ref();
222 this.left_props.main_window = this.win;
223 this.win.props.el.pack_start(this.left_props.el,true, true,0);
224 this.left_props.el.show_all();
226 this.left_props.show_editor.connect( (file, node, type, key) => {
227 this.switchState(State.CODE);
228 this.code_editor.show(
239 this.left_props.stop_editor.connect( () => {
240 if (this.state != State.CODE) {
244 var ret = this.code_editor.saveContents();
248 this.switchState(State.PREVIEW);
252 this.left_props.changed.connect(() => {
253 if (this.left_tree.getActiveFile().xtype == "Roo" ) {
254 this.window_rooview.requestRedraw();
256 this.window_gladeview.loadFile(this.left_tree.getActiveFile());
258 this.left_tree.model.updateSelected();
260 if (this.file.xtype=="Gtk") {
261 this.valasource.checkFileSpawn(this.file);
269 //------------- projects edit
271 public void projectEditInit()
273 this.projectsettings =new Xcls_ProjectSettings();
274 this.projectsettings.ref(); /// really?
276 this.vala_projectsettings =new ValaProjectSettings();
277 this.vala_projectsettings.ref();
278 this.vala_projectsettings.window = this.win;
280 ((Gtk.Container)(this.win.projecteditview.el.get_widget())).add(this.projectsettings.el);
281 //this.projectsettings.el.show_all();
283 var stage = this.win.projecteditview.el.get_stage();
284 stage.set_background_color( Clutter.Color.from_string("#000"));
286 this.projectsettings.buttonPressed.connect((btn) => {
287 if (this.left_tree.getActiveFile().xtype == "Roo" ) {
289 this.window_rooview.view.renderJS(true);
291 if (btn == "apply") {
292 this.window_rooview.view.renderJS(true);
296 // do nothing for gtk..
298 if (btn == "save" || btn == "apply") {
299 this.win.project.save();
302 this.switchState (State.PREVIEW);
307 // ----------- object adding
308 public void objectAddInit()
311 this.rightpalete = new Xcls_RightPalete();
312 this.rightpalete.ref(); /// really?
313 ((Gtk.Container)(this.win.objectview.el.get_widget())).add(this.rightpalete.el);
314 //this.projectsettings.el.show_all();
316 var stage = this.win.objectview.el.get_stage();
317 stage.set_background_color( Clutter.Color.from_string("#000"));
321 // ----------- properties adding list...
322 // listener uses the properties
323 public void propsAddInit()
326 this.add_props = new Xcls_WindowAddProp();
327 this.add_props.ref(); /// really?
328 ((Gtk.Container)(this.win.addpropsview.el.get_widget())).add(this.add_props.el);
329 //this.projectsettings.el.show_all();
331 var stage = this.win.addpropsview.el.get_stage();
332 stage.set_background_color( Clutter.Color.from_string("#000"));
335 this.add_props.select.connect( (key,type,skel, etype) => {
336 this.left_props.addProp(etype, key, skel, type);
340 public void propsAddShow()
344 public void propsAddHide()
352 // ----------- Add / Edit listener
353 // listener uses the properties
354 //public void listenerInit() { }
355 public void listenerShow()
359 public void listenerHide()
364 // -------------- codeEditor
366 public void codeEditInit()
368 this.code_editor = new Editor();
369 //this.code_editor.ref(); /// really?
370 ((Gtk.Container)(this.win.codeeditview.el.get_widget())).add(this.code_editor.el);
372 this.code_editor.window = this.win;
373 //this.projectsettings.el.show_all();
375 var stage = this.win.codeeditview.el.get_stage();
376 stage.set_background_color( Clutter.Color.from_string("#000"));
379 this.code_editor.save.connect( () => {
381 this.left_tree.model.updateSelected();
382 if (this.left_tree.getActiveFile().xtype == "Roo" ) {
383 this.window_rooview.requestRedraw();
385 this.window_gladeview.loadFile(this.left_tree.getActiveFile());
387 // we do not need to call spawn... - as it's already called by the editor?
393 // ----------- list of projects on left
394 public void projectListInit()
397 this.left_projects = new Xcls_WindowLeftProjects();
398 this.left_projects.ref();
399 this.win.leftpane.el.pack_start(this.left_projects.el,true, true,0);
400 this.left_projects.el.show_all();
401 this.left_projects.project_selected.connect((proj) => {
402 this.buttonsShowHide();
404 this.clutterfiles.loadProject(proj);
409 // ----------- file view
411 public void fileViewInit()
413 var stage = this.win.rooview.el.get_stage(); // seems odd...
414 this.clutterfiles = new Xcls_ClutterFiles();
415 this.clutterfiles.ref();
416 stage.add_child(this.clutterfiles.el);
417 this.clutterfiles.el.show();
420 this.clutterfiles.open.connect((file) => {
421 this.fileViewOpen(file);
423 this.clutterfiles.el.transitions_completed.connect(() => {
424 if (this.state == State.FILES) {
425 this.win.rooview.el.hide();
427 this.clutterfiles.el.hide();
435 public void fileDetailsInit()
437 this.file_details = new Xcls_PopoverFileDetails();
438 this.file_details.mainwindow = this.win;
439 // force it modal to the main window..
441 this.file_details.success.connect((project,file) =>
443 this.fileViewOpen(file);
448 public void fileViewOpen(JsRender.JsRender file, int line = -1)
450 this.win.project = file.project;
451 this.project = file.project;
455 if (file.xtype == "PlainFile") {
456 this.switchState (State.CODEONLY);
458 this.code_editor.show(file, null, "", "");
460 this.code_editor.scroll_to_line(line);
464 this.switchState (State.PREVIEW);
465 // this triggers loadItems..
466 this.left_tree.model.loadFile(file);
467 if (file.project.xtype == "Gtk" && line> -1 ) {
468 this.window_gladeview.scroll_to_line(line);
474 var ctr= ((Gtk.Container)(this.win.rooview.el.get_widget()));
475 var ctr_p= ((Gtk.Container)(this.win.projecteditview.el.get_widget()));
477 if (file.project.xtype == "Roo" ) {
478 ctr.foreach( (w) => { ctr.remove(w); });
479 ctr_p.foreach( (w) => { ctr_p.remove(w); });
480 ctr.add(this.window_rooview.el);
481 ctr_p.add(this.projectsettings.el);
482 if (file.xtype != "PlainFile") {
483 this.window_rooview.loadFile(file);
484 this.window_rooview.el.show_all();
486 this.projectsettings.el.show_all();
490 ctr.foreach( (w) => { ctr.remove(w); });
491 ctr_p.foreach( (w) => { ctr_p.remove(w); });
492 ctr.add(this.window_gladeview.el);
493 ctr_p.add(this.vala_projectsettings.el);
494 if (file.xtype != "PlainFile") {
495 this.window_gladeview.loadFile(file);
496 this.window_gladeview.el.show_all();
498 this.vala_projectsettings.el.show_all();
500 print("OPEN : " + file.name);
501 if (file.xtype != "PlainFile") {
502 this.win.editpane.el.set_position(this.win.editpane.el.max_position);
504 this.win.setTitle(file.project.name + " : " + file.name);
508 // our project properties is different for Roo and Gtk
509 // it would be better to change the above code to use this,
510 public void attachProjectSettings() {
512 var ctr_p= ((Gtk.Container)(this.win.projecteditview.el.get_widget()));
514 if (this.win.project.xtype == "Roo" ) {
515 ctr_p.foreach( (w) => { ctr_p.remove(w); });
516 ctr_p.add(this.projectsettings.el);
517 this.projectsettings.el.show_all();
520 ctr_p.foreach( (w) => { ctr_p.remove(w); });
521 ctr_p.add(this.vala_projectsettings.el);
522 this.vala_projectsettings.el.show_all();
527 // --------- webkit view
528 public void webkitViewInit()
530 this.window_rooview =new Xcls_WindowRooView();
531 this.window_rooview.main_window = this.win;
532 this.window_rooview.ref();
533 ((Gtk.Container)(this.win.rooview.el.get_widget())).add(this.window_rooview.el);
534 this.window_rooview.el.show_all();
536 var stage = this.win.rooview.el.get_stage();
537 stage.set_background_color( Clutter.Color.from_string("#000"));
542 public void gtkViewInit()
544 this.window_gladeview =new Xcls_GtkView();
545 this.window_gladeview.ref();
546 this.window_gladeview.main_window = this.win;
549 public void easingSaveAll()
551 this.win.addpropsview.el.save_easing_state();
552 this.win.codeeditview.el.save_easing_state();
553 this.win.objectview.el.save_easing_state();
554 this.win.projecteditview.el.save_easing_state();
555 this.win.rooview.el.save_easing_state();
556 this.clutterfiles.el.save_easing_state();
559 public void easingRestoreAll()
561 this.win.addpropsview.el.restore_easing_state();
562 this.win.codeeditview.el.restore_easing_state();
563 this.win.objectview.el.restore_easing_state();
564 this.win.projecteditview.el.restore_easing_state();
565 this.win.rooview.el.restore_easing_state();
566 this.clutterfiles.el.restore_easing_state();
569 public void switchState(State new_state)
572 // if the new state and the old state are the same..
574 if (new_state == this.state) {
578 // stop werid stuff happening
580 if (this.state == State.FILES
581 && new_state == State.FILEPROJECT
582 && this.left_projects.getSelectedProject() == null) {
585 // save the easing state of everything..
586 this.easingSaveAll();
588 switch (this.state) {
591 if (this.left_tree.getActiveFile() != null) {
592 if (this.left_tree.getActiveFile().xtype == "Roo" ) {
593 this.window_rooview.createThumb();
595 this.window_gladeview.createThumb();
598 // normally we are going from preview to another state.
599 // and different windows hide the preview in differnt ways..
607 this.win.addpropsview.el.set_scale(0.0f,0.0f);
611 this.code_editor.saveContents();
613 this.win.codeeditview.el.set_scale(0.0f,0.0f);
617 // going from codeonly..
619 // enable re-calc of canvas..
621 //this.code_editor.saveContents(); << not yet...
622 if (new_state != State.PROJECTCODEONLY) {
623 this.win.rooview.el.show();
624 this.win.leftpane.el.show();
625 this.win.codeeditview.el.set_scale(0.0f,0.0f);
627 this.win.codeeditview.el.set_pivot_point(0.0f,1.0f); // bottom left
628 this.win.codeeditview.el.set_scale(0.5f,0.5f);
630 while (Gtk.events_pending()) {
631 Gtk.main_iteration();
634 // hides it completely...
640 this.win.objectview.el.set_scale(0.0f,0.0f);
643 case State.FILEPROJECT:
645 case State.PROJECTCODEONLY:
646 if (this.win.project.xtype == "Gtk") {
647 this.vala_projectsettings.save();
649 if (this.state == State.FILEPROJECT) {
650 this.clutterfiles.el.set_scale(1.0f,1.0f);
653 this.win.projecteditview.el.set_scale(0.0f,0.0f);
656 case State.FILES: // goes to preview or codeonly...
660 if (new_state == State.FILEPROJECT) {
662 this.clutterfiles.el.set_easing_duration(1000);
663 this.clutterfiles.el.set_pivot_point(0.5f,1.0f);
664 this.clutterfiles.el.set_scale(0.5f,0.5f);
668 if (new_state == State.CODEONLY) {
669 this.win.rooview.el.hide();
671 this.win.rooview.el.show();
674 this.win.rooview.el.set_easing_duration(1000);
675 this.win.rooview.el.set_rotation_angle(Clutter.RotateAxis.Y_AXIS, 0.0f);
676 this.win.rooview.el.set_scale(1.0f,1.0f);
677 this.win.rooview.el.set_pivot_point(0.5f,0.5f);
678 this.win.rooview.el.set_opacity(0xff);
680 this.clutterfiles.el.set_easing_duration(1000);
681 this.clutterfiles.el.set_pivot_point(0.5f,0.5f);
682 this.clutterfiles.el.set_rotation_angle(Clutter.RotateAxis.Y_AXIS, -180.0f);
683 this.clutterfiles.el.set_opacity(0);
686 //this.clutterfiles.el.hide();
694 var oldstate =this.state;
695 this.state = new_state;
699 this.buttonsShowHide();
702 switch (this.state) {
704 case State.PREVIEW: // this is the default state when working...
705 this.win.editpane.el.show(); // holder for tree and properties..
708 this.left_projects.el.hide();
709 if (oldstate != State.FILES) {
710 // it's handled above..
711 print ("changing state to preview from NOT files..");
714 this.win.rooview.el.set_scale(1.0f,1.0f);
723 var ae = this.left_tree.getActiveElement();
725 this.state = oldstate;
726 this.buttonsShowHide();
727 this.resizeCanvasElements();
728 this.easingRestoreAll();
731 this.add_props.el.show_all();
733 Palete.factory(this.win.project.xtype),
734 this.state == State.LISTENER ? "signals" : "props",
741 // -- FIXME? this needs to be State aware?
743 this.win.rooview.el.set_pivot_point(1.0f,0.5f);
745 this.win.addpropsview.el.set_scale(1.0f,1.0f);
749 var n = this.left_tree.getActiveElement();
751 if (this.file == null) {
752 this.state =oldstate;
753 this.buttonsShowHide();
754 this.resizeCanvasElements();
755 this.easingRestoreAll();
759 if (n == null && this.file.tree != null) {
760 this.state = oldstate;
761 this.buttonsShowHide();
762 this.resizeCanvasElements();
763 this.easingRestoreAll();
767 this.rightpalete.el.show_all();
768 this.rightpalete.load(this.left_tree.getActiveFile().palete(), n == null ? "*top" : n.fqn());
772 this.win.rooview.el.set_pivot_point(1.0f,0.5f);
773 this.win.objectview.el.set_scale(1.0f,1.0f);
779 this.win.codeeditview.el.show();
780 this.code_editor.el.show_all();
781 // caller needs to call editor - show....
782 this.win.codeeditview.el.set_scale(1.0f,1.0f);
783 this.win.rooview.el.set_pivot_point(1.0f,0.5f);
788 // going to codeonly..
789 this.win.codeeditview.el.show();
791 //while (Gtk.events_pending()) {
792 // Gtk.main_iteration();
795 this.win.leftpane.el.hide();
796 this.win.codeeditview.el.show();
797 //while (Gtk.events_pending()) {
798 // Gtk.main_iteration();
802 this.code_editor.el.show_all();
804 this.win.codeeditview.el.set_scale(1.0f,1.0f);
805 this.win.rooview.el.set_pivot_point(1.0f,0.5f);
808 case State.PROJECTCODEONLY:
809 // going to project edit (when in code only)
813 if (this.win.project.xtype == "Roo") {
814 this.projectsettings.el.show_all();
815 this.projectsettings.show(this.win.project);
817 this.vala_projectsettings.el.show_all();
818 this.vala_projectsettings.show((Project.Gtk)this.win.project);
821 this.win.projecteditview.el.set_scale(1.0f,1.0f);
827 this.win.rooview.el.set_pivot_point(1.0f,1.0f); // bottom right..
829 if (this.win.project.xtype == "Roo") {
830 this.projectsettings.el.show_all();
831 this.projectsettings.show(this.win.project);
833 this.vala_projectsettings.el.show_all();
834 this.vala_projectsettings.show((Project.Gtk)this.win.project);
837 this.win.projecteditview.el.set_scale(1.0f,1.0f);
841 case State.FILEPROJECT:
842 var pr = this.left_projects.getSelectedProject();
844 this.win.project = pr;
846 this.attachProjectSettings();
847 print("FIlE PROJECT - show %s\n", pr.xtype);
849 if (pr.xtype == "Roo") {
850 this.projectsettings.el.show_all();
851 this.projectsettings.show(this.win.project);
853 this.vala_projectsettings.el.show_all();
854 this.vala_projectsettings.show((Project.Gtk)this.win.project);
857 this.win.projecteditview.el.set_scale(1.0f,1.0f);
861 case State.FILES: // can only get here from PREVIEW (or code-only) state.. in theory..
864 this.win.editpane.el.hide(); // holder for tree and properties..
866 this.left_projects.el.show();
868 // rotate the preview to hidden...
869 this.win.rooview.el.set_easing_duration(1000);
870 this.win.rooview.el.set_pivot_point(0.5f,0.5f);
871 this.win.rooview.el.set_rotation_angle(Clutter.RotateAxis.Y_AXIS, 180.0f);
872 this.win.rooview.el.set_opacity(0);
877 if (this.win.project != null) {
878 this.left_projects.selectProject(this.win.project);
882 this.clutterfiles.el.show();
884 this.clutterfiles.el.set_easing_duration(1000);
885 this.clutterfiles.el.set_pivot_point(0.5f,0.5f);
886 this.clutterfiles.el.set_rotation_angle(Clutter.RotateAxis.Y_AXIS, 0.0f);
887 this.clutterfiles.el.set_opacity(0xff);
895 this.resizeCanvasElements();
896 this.easingRestoreAll();
898 // run the animation.. - then load files...
899 GLib.Timeout.add(500, () =>{
900 this.resizeCanvasElements();
906 public int redraw_count = 0;
907 public void resizeCanvas() // called by window resize .. delays redraw
909 var rc = this.redraw_count;
910 this.redraw_count = 2;
912 GLib.Timeout.add(100, () =>{
913 return this.resizeCanvasQueue();
917 public bool resizeCanvasQueue()
919 //print("WindowState.resizeCanvasQueue %d\n", this.redraw_count);
921 if (this.redraw_count < 1) {
922 return false; // should not really happen...
928 if (this.redraw_count > 0) {
929 return true; // do it again in 1 second...
931 // got down to 0 or -1....
932 this.redraw_count = 0;
933 this.resizeCanvasElements();
937 public void resizeCanvasElements()
939 Gtk.Allocation alloc;
940 this.win.clutterembed.el.get_allocation(out alloc);
942 // print("WindowState.resizeCanvasElements\n");
943 if (!this.children_loaded || this.win.clutterembed == null) {
944 print("WindowState.resizeCanvasElements = ingnore not loaded or no clutterfiles\n");
948 var avail = alloc.width < 50.0f ? 0 : alloc.width - 50.0f;
949 var palsize = avail < 300.0f ? avail : 300.0f;
952 // -------- code edit min 600
954 var codesize = avail < 800.0f ? avail : 800.0f;
957 //print("set code size %f\n", codesize);
961 switch ( this.state) {
964 this.win.rooview.el.set_size(alloc.width-50, alloc.height);
968 this.clutterfiles.set_size(alloc.width-50, alloc.height);
973 this.win.projecteditview.el.set_size(alloc.width-50, alloc.height / 2.0f);
975 // this.win.rooview.el.save_easing_state();
976 //this.win.rooview.el.set_size(alloc.width / 2.0f, alloc.height / 2.0f);
978 this.win.rooview.el.set_scale(0.5f, 0.5f);
979 //this.win.rooview.el.restore_easing_state();
983 this.win.codeeditview.el.set_size(codesize, alloc.height);
984 var scale = avail > 0.0f ? (avail - codesize -10 ) / avail : 0.0f;
985 //this.win.rooview.el.save_easing_state();
987 this.win.rooview.el.set_scale(scale,scale);
988 // this.win.rooview.el.restore_easing_state();
992 this.win.codeeditview.el.set_size(codesize, alloc.height);
993 var scale = avail > 0.0f ? (avail - codesize -10 ) / avail : 0.0f;
994 //this.win.rooview.el.save_easing_state();
995 this.win.rooview.el.hide();
996 this.win.rooview.el.set_scale(scale,scale);
997 // this.win.rooview.el.restore_easing_state();
1000 case State.LISTENER:
1001 this.win.addpropsview.el.set_size(palsize, alloc.height);
1002 var scale = avail > 0.0f ? (avail - palsize -10 ) / avail : 0.0f;
1003 this.win.rooview.el.set_scale(scale,scale);
1007 this.win.objectview.el.set_size(palsize, alloc.height);
1008 var scale = avail > 0.0f ? (avail - palsize -10 ) / avail : 0.0f;
1009 //this.win.rooview.el.save_easing_state();
1010 this.win.rooview.el.set_scale(scale,scale);
1011 // this.win.rooview.el.restore_easing_state();
1016 // -- buttons show hide.....
1018 public void buttonsShowHide()
1020 // basically hide everything, then show the relivant..
1023 this.win.openbtn.el.hide();
1024 this.win.openbackbtn.el.hide();
1026 this.win.backbutton.el.hide();
1029 this.win.editfilebutton.el.hide();
1030 this.win.projecteditbutton.el.hide();
1033 this.win.objectshowbutton.el.hide(); // add objects
1034 this.win.addpropbutton.el.hide();
1035 this.win.addlistenerbutton.el.hide();
1039 this.win.addprojectbutton.el.hide();
1040 this.win.addfilebutton.el.hide();
1041 this.win.delprojectbutton.el.hide();
1043 this.win.search_entry.el.hide();
1044 this.win.search_results.el.hide();
1045 switch (this.state) {
1047 case State.PREVIEW: // this is the default state when working...
1050 this.win.editfilebutton.el.show();
1051 this.win.projecteditbutton.el.show();
1055 this.win.objectshowbutton.el.show(); // add objects
1056 this.win.addpropbutton.el.show();
1057 this.win.addlistenerbutton.el.show();
1058 this.win.search_entry.el.show();
1060 this.win.openbtn.el.show();
1064 case State.CODEONLY:
1065 this.win.openbtn.el.show();
1066 this.win.projecteditbutton.el.show();
1067 this.win.search_entry.el.show();
1071 this.win.search_entry.el.show();
1072 this.win.backbutton.el.show();
1073 this.win.objectshowbutton.el.show(); // add objects ?? can you do this from here?
1074 this.win.addpropbutton.el.show();
1075 this.win.addlistenerbutton.el.show();
1079 case State.LISTENER:
1082 this.win.backbutton.el.show();
1083 this.win.objectshowbutton.el.show(); // add objects
1084 this.win.addpropbutton.el.show();
1085 this.win.addlistenerbutton.el.show();
1089 case State.FILEPROJECT:
1090 case State.PROJECTCODEONLY:
1092 this.win.backbutton.el.show();
1098 if (this.left_projects.getSelectedProject() != null ) {
1099 if (this.left_tree.getActiveFile() != null) {
1101 this.win.openbackbtn.el.show();
1103 this.win.addfilebutton.el.show();
1104 this.win.search_entry.el.show();
1105 this.win.projecteditbutton.el.show();
1109 this.win.addprojectbutton.el.show();
1110 this.win.delprojectbutton.el.show();
1123 public void valaCompiled(Json.Object obj)
1125 // vala has finished compiling...
1126 print("vala compiled");
1128 var buf = this.code_editor.buffer;
1129 buf.check_running = false;
1130 var has_errors = false;
1132 if (obj.has_member("ERR-TOTAL")) {
1133 if (obj.get_int_member("ERR-TOTAL")> 0) {
1136 this.win.statusbar_errors.setNotices( obj.get_object_member("ERR") , (int) obj.get_int_member("ERR-TOTAL"));
1138 this.win.statusbar_errors.setNotices( new Json.Object() , 0);
1141 if (obj.has_member("WARN-TOTAL")) {
1143 this.win.statusbar_warnings.setNotices(obj.get_object_member("WARN"), (int) obj.get_int_member("WARN-TOTAL"));
1145 this.win.statusbar_warnings.setNotices( new Json.Object() , 0);
1148 if (obj.has_member("DEPR-TOTAL")) {
1150 this.win.statusbar_depricated.setNotices( obj.get_object_member("DEPR"), (int) obj.get_int_member("DEPR-TOTAL"));
1153 this.win.statusbar_depricated.setNotices( new Json.Object(),0);
1156 buf.highlightErrorsJson("ERR", obj);
1157 buf.highlightErrorsJson("WARN", obj);
1158 buf.highlightErrorsJson("DEPR", obj);
1160 this.win.statusbar_compilestatus_label.el.hide();
1161 this.win.statusbar_run.el.hide();
1163 this.win.statusbar_compilestatus_label.el.show();
1164 this.win.statusbar_run.el.show();
1166 if (this.file.xtype == "Gtk") {
1167 // not sure how this is working ok? - as highlighting is happening on the vala files at present..
1168 var gbuf = this.window_gladeview.sourceview;
1169 gbuf.highlightErrorsJson("ERR", obj);
1170 gbuf.highlightErrorsJson("WARN", obj);
1171 gbuf.highlightErrorsJson("DEPR", obj);
1174 this.last_compile_result = obj;