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 (source == "editor") {
131 if (this.file.xtype == "Roo") {
132 this.window_rooview.sourceview.nodeSelected(sel,true); // foce scroll.
134 this.window_gladeview.sourceview.nodeSelected(sel);
138 this.left_tree.node_selected.connect((sel) => {
139 this.leftTreeNodeSelected(sel);
142 this.left_tree.changed.connect(() => {
145 if (this.left_tree.getActiveFile().xtype == "Roo" ) {
146 this.window_rooview.requestRedraw();
148 this.window_gladeview.loadFile(this.left_tree.getActiveFile());
155 public bool leftTreeBeforeChange()
157 if (this.state != State.CODE) {
158 this.left_props.finish_editing();
161 if (!this.code_editor.saveContents()) {
167 public void leftTreeNodeSelected(JsRender.Node? sel)
170 print("node_selected called %s\n", (sel == null) ? "NULL" : "a value");
173 this.left_props.el.hide();
175 this.left_props.el.show();
176 this.left_props.load(this.left_tree.getActiveFile(), sel);
177 switch (this.state) {
182 this.rightpalete.clear();
185 this.rightpalete.load(this.left_tree.getActiveFile().palete(), sel.fqn());
191 this.add_props.clear();
194 this.add_props.show(this.left_tree.getActiveFile().palete(), "props", sel.fqn());
200 this.add_props.clear();
203 this.add_props.show(this.left_tree.getActiveFile().palete(), "signals", sel.fqn());
207 this.switchState(State.PREVIEW);
220 public void propsListInit()
223 this.left_props =new Xcls_LeftProps();
224 this.left_props.ref();
225 this.left_props.main_window = this.win;
226 this.win.props.el.pack_start(this.left_props.el,true, true,0);
227 this.left_props.el.show_all();
229 this.left_props.show_editor.connect( (file, node, type, key) => {
230 this.switchState(State.CODE);
231 this.code_editor.show(
242 this.left_props.stop_editor.connect( () => {
243 if (this.state != State.CODE) {
247 var ret = this.code_editor.saveContents();
251 this.switchState(State.PREVIEW);
255 this.left_props.changed.connect(() => {
256 if (this.left_tree.getActiveFile().xtype == "Roo" ) {
257 this.window_rooview.requestRedraw();
259 this.window_gladeview.loadFile(this.left_tree.getActiveFile());
261 this.left_tree.model.updateSelected();
263 if (this.file.xtype=="Gtk") {
264 this.valasource.checkFileSpawn(this.file);
272 //------------- projects edit
274 public void projectEditInit()
276 this.projectsettings =new Xcls_ProjectSettings();
277 this.projectsettings.ref(); /// really?
279 this.vala_projectsettings =new ValaProjectSettings();
280 this.vala_projectsettings.ref();
281 this.vala_projectsettings.window = this.win;
283 ((Gtk.Container)(this.win.projecteditview.el.get_widget())).add(this.projectsettings.el);
284 //this.projectsettings.el.show_all();
286 var stage = this.win.projecteditview.el.get_stage();
287 stage.set_background_color( Clutter.Color.from_string("#000"));
289 this.projectsettings.buttonPressed.connect((btn) => {
290 if (this.left_tree.getActiveFile().xtype == "Roo" ) {
292 this.window_rooview.view.renderJS(true);
294 if (btn == "apply") {
295 this.window_rooview.view.renderJS(true);
299 // do nothing for gtk..
301 if (btn == "save" || btn == "apply") {
302 this.win.project.save();
305 this.switchState (State.PREVIEW);
310 // ----------- object adding
311 public void objectAddInit()
314 this.rightpalete = new Xcls_RightPalete();
315 this.rightpalete.ref(); /// really?
316 ((Gtk.Container)(this.win.objectview.el.get_widget())).add(this.rightpalete.el);
317 //this.projectsettings.el.show_all();
319 var stage = this.win.objectview.el.get_stage();
320 stage.set_background_color( Clutter.Color.from_string("#000"));
324 // ----------- properties adding list...
325 // listener uses the properties
326 public void propsAddInit()
329 this.add_props = new Xcls_WindowAddProp();
330 this.add_props.ref(); /// really?
331 ((Gtk.Container)(this.win.addpropsview.el.get_widget())).add(this.add_props.el);
332 //this.projectsettings.el.show_all();
334 var stage = this.win.addpropsview.el.get_stage();
335 stage.set_background_color( Clutter.Color.from_string("#000"));
338 this.add_props.select.connect( (key,type,skel, etype) => {
339 this.left_props.addProp(etype, key, skel, type);
343 public void propsAddShow()
347 public void propsAddHide()
355 // ----------- Add / Edit listener
356 // listener uses the properties
357 //public void listenerInit() { }
358 public void listenerShow()
362 public void listenerHide()
367 // -------------- codeEditor
369 public void codeEditInit()
371 this.code_editor = new Editor();
372 //this.code_editor.ref(); /// really?
373 ((Gtk.Container)(this.win.codeeditview.el.get_widget())).add(this.code_editor.el);
375 this.code_editor.window = this.win;
376 //this.projectsettings.el.show_all();
378 var stage = this.win.codeeditview.el.get_stage();
379 stage.set_background_color( Clutter.Color.from_string("#000"));
382 this.code_editor.save.connect( () => {
384 this.left_tree.model.updateSelected();
385 if (this.left_tree.getActiveFile().xtype == "Roo" ) {
386 this.window_rooview.requestRedraw();
388 this.window_gladeview.loadFile(this.left_tree.getActiveFile());
390 // we do not need to call spawn... - as it's already called by the editor?
396 // ----------- list of projects on left
397 public void projectListInit()
400 this.left_projects = new Xcls_WindowLeftProjects();
401 this.left_projects.ref();
402 this.win.leftpane.el.pack_start(this.left_projects.el,true, true,0);
403 this.left_projects.el.show_all();
404 this.left_projects.project_selected.connect((proj) => {
405 this.buttonsShowHide();
407 this.clutterfiles.loadProject(proj);
412 // ----------- file view
414 public void fileViewInit()
416 var stage = this.win.rooview.el.get_stage(); // seems odd...
417 this.clutterfiles = new Xcls_ClutterFiles();
418 this.clutterfiles.ref();
419 stage.add_child(this.clutterfiles.el);
420 this.clutterfiles.el.show();
423 this.clutterfiles.open.connect((file) => {
424 this.fileViewOpen(file);
426 this.clutterfiles.el.transitions_completed.connect(() => {
427 if (this.state == State.FILES) {
428 this.win.rooview.el.hide();
430 this.clutterfiles.el.hide();
438 public void fileDetailsInit()
440 this.file_details = new Xcls_PopoverFileDetails();
441 this.file_details.mainwindow = this.win;
442 // force it modal to the main window..
444 this.file_details.success.connect((project,file) =>
446 this.fileViewOpen(file);
451 public void fileViewOpen(JsRender.JsRender file, int line = -1)
453 this.win.project = file.project;
454 this.project = file.project;
458 if (file.xtype == "PlainFile") {
459 this.switchState (State.CODEONLY);
461 this.code_editor.show(file, null, "", "");
463 this.code_editor.scroll_to_line(line);
467 this.switchState (State.PREVIEW);
468 // this triggers loadItems..
469 this.left_tree.model.loadFile(file);
470 if (file.project.xtype == "Gtk" && line> -1 ) {
471 this.window_gladeview.scroll_to_line(line);
477 var ctr= ((Gtk.Container)(this.win.rooview.el.get_widget()));
478 var ctr_p= ((Gtk.Container)(this.win.projecteditview.el.get_widget()));
480 if (file.project.xtype == "Roo" ) {
481 ctr.foreach( (w) => { ctr.remove(w); });
482 ctr_p.foreach( (w) => { ctr_p.remove(w); });
483 ctr.add(this.window_rooview.el);
484 ctr_p.add(this.projectsettings.el);
485 if (file.xtype != "PlainFile") {
486 this.window_rooview.loadFile(file);
487 this.window_rooview.el.show_all();
489 this.projectsettings.el.show_all();
493 ctr.foreach( (w) => { ctr.remove(w); });
494 ctr_p.foreach( (w) => { ctr_p.remove(w); });
495 ctr.add(this.window_gladeview.el);
496 ctr_p.add(this.vala_projectsettings.el);
497 if (file.xtype != "PlainFile") {
498 this.window_gladeview.loadFile(file);
499 this.window_gladeview.el.show_all();
501 this.vala_projectsettings.el.show_all();
503 print("OPEN : " + file.name);
504 if (file.xtype != "PlainFile") {
505 this.win.editpane.el.set_position(this.win.editpane.el.max_position);
507 this.win.setTitle(file.project.name + " : " + file.name);
512 // our project properties is different for Roo and Gtk
513 // it would be better to change the above code to use this,
514 public void attachProjectSettings() {
516 var ctr_p= ((Gtk.Container)(this.win.projecteditview.el.get_widget()));
518 if (this.win.project.xtype == "Roo" ) {
519 ctr_p.foreach( (w) => { ctr_p.remove(w); });
520 ctr_p.add(this.projectsettings.el);
521 this.projectsettings.el.show_all();
524 ctr_p.foreach( (w) => { ctr_p.remove(w); });
525 ctr_p.add(this.vala_projectsettings.el);
526 this.vala_projectsettings.el.show_all();
530 public void fileViewOpenPlain(string fname)
533 this.switchState (State.CODEONLY);
534 this.code_editor.showPlainFile(fname);
538 // --------- webkit view
539 public void webkitViewInit()
541 this.window_rooview =new Xcls_WindowRooView();
542 this.window_rooview.main_window = this.win;
543 this.window_rooview.ref();
544 ((Gtk.Container)(this.win.rooview.el.get_widget())).add(this.window_rooview.el);
545 this.window_rooview.el.show_all();
547 var stage = this.win.rooview.el.get_stage();
548 stage.set_background_color( Clutter.Color.from_string("#000"));
553 public void gtkViewInit()
555 this.window_gladeview =new Xcls_GtkView();
556 this.window_gladeview.ref();
557 this.window_gladeview.main_window = this.win;
560 public void easingSaveAll()
562 this.win.addpropsview.el.save_easing_state();
563 this.win.codeeditview.el.save_easing_state();
564 this.win.objectview.el.save_easing_state();
565 this.win.projecteditview.el.save_easing_state();
566 this.win.rooview.el.save_easing_state();
567 this.clutterfiles.el.save_easing_state();
570 public void easingRestoreAll()
572 this.win.addpropsview.el.restore_easing_state();
573 this.win.codeeditview.el.restore_easing_state();
574 this.win.objectview.el.restore_easing_state();
575 this.win.projecteditview.el.restore_easing_state();
576 this.win.rooview.el.restore_easing_state();
577 this.clutterfiles.el.restore_easing_state();
580 public void switchState(State new_state)
583 // if the new state and the old state are the same..
585 if (new_state == this.state) {
589 // stop werid stuff happening
591 if (this.state == State.FILES
592 && new_state == State.FILEPROJECT
593 && this.left_projects.getSelectedProject() == null) {
596 // save the easing state of everything..
597 this.easingSaveAll();
599 switch (this.state) {
602 if (this.left_tree.getActiveFile() != null) {
603 if (this.left_tree.getActiveFile().xtype == "Roo" ) {
604 this.window_rooview.createThumb();
606 this.window_gladeview.createThumb();
609 // normally we are going from preview to another state.
610 // and different windows hide the preview in differnt ways..
618 this.win.addpropsview.el.set_scale(0.0f,0.0f);
622 this.code_editor.saveContents();
624 this.win.codeeditview.el.set_scale(0.0f,0.0f);
628 // going from codeonly..
630 // enable re-calc of canvas..
632 //this.code_editor.saveContents(); << not yet...
633 if (new_state != State.PROJECTCODEONLY) {
634 this.win.rooview.el.show();
635 this.win.leftpane.el.show();
636 this.win.codeeditview.el.set_scale(0.0f,0.0f);
638 this.win.codeeditview.el.set_pivot_point(0.0f,1.0f); // bottom left
639 this.win.codeeditview.el.set_scale(0.5f,0.5f);
641 while (Gtk.events_pending()) {
642 Gtk.main_iteration();
645 // hides it completely...
651 this.win.objectview.el.set_scale(0.0f,0.0f);
654 case State.FILEPROJECT:
656 case State.PROJECTCODEONLY:
657 if (this.win.project.xtype == "Gtk") {
658 this.vala_projectsettings.save();
660 if (this.state == State.FILEPROJECT) {
661 this.clutterfiles.el.set_scale(1.0f,1.0f);
664 this.win.projecteditview.el.set_scale(0.0f,0.0f);
667 case State.FILES: // goes to preview or codeonly...
671 if (new_state == State.FILEPROJECT) {
673 this.clutterfiles.el.set_easing_duration(1000);
674 this.clutterfiles.el.set_pivot_point(0.5f,1.0f);
675 this.clutterfiles.el.set_scale(0.5f,0.5f);
679 if (new_state == State.CODEONLY) {
680 this.win.rooview.el.hide();
682 this.win.rooview.el.show();
685 this.win.rooview.el.set_easing_duration(1000);
686 this.win.rooview.el.set_rotation_angle(Clutter.RotateAxis.Y_AXIS, 0.0f);
687 this.win.rooview.el.set_scale(1.0f,1.0f);
688 this.win.rooview.el.set_pivot_point(0.5f,0.5f);
689 this.win.rooview.el.set_opacity(0xff);
691 this.clutterfiles.el.set_easing_duration(1000);
692 this.clutterfiles.el.set_pivot_point(0.5f,0.5f);
693 this.clutterfiles.el.set_rotation_angle(Clutter.RotateAxis.Y_AXIS, -180.0f);
694 this.clutterfiles.el.set_opacity(0);
697 //this.clutterfiles.el.hide();
705 var oldstate =this.state;
706 this.state = new_state;
710 this.buttonsShowHide();
713 switch (this.state) {
715 case State.PREVIEW: // this is the default state when working...
716 this.win.editpane.el.show(); // holder for tree and properties..
719 this.left_projects.el.hide();
720 if (oldstate != State.FILES) {
721 // it's handled above..
722 print ("changing state to preview from NOT files..");
725 this.win.rooview.el.set_scale(1.0f,1.0f);
734 var ae = this.left_tree.getActiveElement();
736 this.state = oldstate;
737 this.buttonsShowHide();
738 this.resizeCanvasElements();
739 this.easingRestoreAll();
742 this.add_props.el.show_all();
744 Palete.factory(this.win.project.xtype),
745 this.state == State.LISTENER ? "signals" : "props",
752 // -- FIXME? this needs to be State aware?
754 this.win.rooview.el.set_pivot_point(1.0f,0.5f);
756 this.win.addpropsview.el.set_scale(1.0f,1.0f);
760 var n = this.left_tree.getActiveElement();
762 if (this.file == null) {
763 this.state =oldstate;
764 this.buttonsShowHide();
765 this.resizeCanvasElements();
766 this.easingRestoreAll();
770 if (n == null && this.file.tree != null) {
771 this.state = oldstate;
772 this.buttonsShowHide();
773 this.resizeCanvasElements();
774 this.easingRestoreAll();
778 this.rightpalete.el.show_all();
779 this.rightpalete.load(this.left_tree.getActiveFile().palete(), n == null ? "*top" : n.fqn());
783 this.win.rooview.el.set_pivot_point(1.0f,0.5f);
784 this.win.objectview.el.set_scale(1.0f,1.0f);
790 this.win.codeeditview.el.show();
791 this.code_editor.el.show_all();
792 // caller needs to call editor - show....
793 this.win.codeeditview.el.set_scale(1.0f,1.0f);
794 this.win.rooview.el.set_pivot_point(1.0f,0.5f);
799 // going to codeonly..
800 this.win.codeeditview.el.show();
802 //while (Gtk.events_pending()) {
803 // Gtk.main_iteration();
806 this.win.leftpane.el.hide();
807 this.win.codeeditview.el.show();
808 //while (Gtk.events_pending()) {
809 // Gtk.main_iteration();
813 this.code_editor.el.show_all();
815 this.win.codeeditview.el.set_scale(1.0f,1.0f);
816 this.win.rooview.el.set_pivot_point(1.0f,0.5f);
819 case State.PROJECTCODEONLY:
820 // going to project edit (when in code only)
824 if (this.win.project.xtype == "Roo") {
825 this.projectsettings.el.show_all();
826 this.projectsettings.show(this.win.project);
828 this.vala_projectsettings.el.show_all();
829 this.vala_projectsettings.show((Project.Gtk)this.win.project);
832 this.win.projecteditview.el.set_scale(1.0f,1.0f);
838 this.win.rooview.el.set_pivot_point(1.0f,1.0f); // bottom right..
840 if (this.win.project.xtype == "Roo") {
841 this.projectsettings.el.show_all();
842 this.projectsettings.show(this.win.project);
844 this.vala_projectsettings.el.show_all();
845 this.vala_projectsettings.show((Project.Gtk)this.win.project);
848 this.win.projecteditview.el.set_scale(1.0f,1.0f);
852 case State.FILEPROJECT:
853 var pr = this.left_projects.getSelectedProject();
855 this.win.project = pr;
857 this.attachProjectSettings();
858 print("FIlE PROJECT - show %s\n", pr.xtype);
860 if (pr.xtype == "Roo") {
861 this.projectsettings.el.show_all();
862 this.projectsettings.show(this.win.project);
864 this.vala_projectsettings.el.show_all();
865 this.vala_projectsettings.show((Project.Gtk)this.win.project);
868 this.win.projecteditview.el.set_scale(1.0f,1.0f);
872 case State.FILES: // can only get here from PREVIEW (or code-only) state.. in theory..
875 this.win.editpane.el.hide(); // holder for tree and properties..
877 this.left_projects.el.show();
879 // rotate the preview to hidden...
880 this.win.rooview.el.set_easing_duration(1000);
881 this.win.rooview.el.set_pivot_point(0.5f,0.5f);
882 this.win.rooview.el.set_rotation_angle(Clutter.RotateAxis.Y_AXIS, 180.0f);
883 this.win.rooview.el.set_opacity(0);
888 if (this.win.project != null) {
889 this.left_projects.selectProject(this.win.project);
893 this.clutterfiles.el.show();
895 this.clutterfiles.el.set_easing_duration(1000);
896 this.clutterfiles.el.set_pivot_point(0.5f,0.5f);
897 this.clutterfiles.el.set_rotation_angle(Clutter.RotateAxis.Y_AXIS, 0.0f);
898 this.clutterfiles.el.set_opacity(0xff);
906 this.resizeCanvasElements();
907 this.easingRestoreAll();
909 // run the animation.. - then load files...
910 GLib.Timeout.add(500, () =>{
911 this.resizeCanvasElements();
917 public int redraw_count = 0;
918 public void resizeCanvas() // called by window resize .. delays redraw
920 var rc = this.redraw_count;
921 this.redraw_count = 2;
923 GLib.Timeout.add(100, () =>{
924 return this.resizeCanvasQueue();
928 public bool resizeCanvasQueue()
930 //print("WindowState.resizeCanvasQueue %d\n", this.redraw_count);
932 if (this.redraw_count < 1) {
933 return false; // should not really happen...
939 if (this.redraw_count > 0) {
940 return true; // do it again in 1 second...
942 // got down to 0 or -1....
943 this.redraw_count = 0;
944 this.resizeCanvasElements();
948 public void resizeCanvasElements()
950 Gtk.Allocation alloc;
951 this.win.clutterembed.el.get_allocation(out alloc);
953 // print("WindowState.resizeCanvasElements\n");
954 if (!this.children_loaded || this.win.clutterembed == null) {
955 print("WindowState.resizeCanvasElements = ingnore not loaded or no clutterfiles\n");
959 var avail = alloc.width < 50.0f ? 0 : alloc.width - 50.0f;
960 var palsize = avail < 300.0f ? avail : 300.0f;
963 // -------- code edit min 600
965 var codesize = avail < 800.0f ? avail : 800.0f;
968 //print("set code size %f\n", codesize);
972 switch ( this.state) {
975 this.win.rooview.el.set_size(alloc.width-50, alloc.height);
979 this.clutterfiles.set_size(alloc.width-50, alloc.height);
984 this.win.projecteditview.el.set_size(alloc.width-50, alloc.height / 2.0f);
986 // this.win.rooview.el.save_easing_state();
987 //this.win.rooview.el.set_size(alloc.width / 2.0f, alloc.height / 2.0f);
989 this.win.rooview.el.set_scale(0.5f, 0.5f);
990 //this.win.rooview.el.restore_easing_state();
994 this.win.codeeditview.el.set_size(codesize, alloc.height);
995 var scale = avail > 0.0f ? (avail - codesize -10 ) / avail : 0.0f;
996 //this.win.rooview.el.save_easing_state();
998 this.win.rooview.el.set_scale(scale,scale);
999 // this.win.rooview.el.restore_easing_state();
1002 case State.CODEONLY:
1003 this.win.codeeditview.el.set_size(codesize, alloc.height);
1004 var scale = avail > 0.0f ? (avail - codesize -10 ) / avail : 0.0f;
1005 //this.win.rooview.el.save_easing_state();
1006 this.win.rooview.el.hide();
1007 this.win.rooview.el.set_scale(scale,scale);
1008 // this.win.rooview.el.restore_easing_state();
1011 case State.LISTENER:
1012 this.win.addpropsview.el.set_size(palsize, alloc.height);
1013 var scale = avail > 0.0f ? (avail - palsize -10 ) / avail : 0.0f;
1014 this.win.rooview.el.set_scale(scale,scale);
1018 this.win.objectview.el.set_size(palsize, alloc.height);
1019 var scale = avail > 0.0f ? (avail - palsize -10 ) / avail : 0.0f;
1020 //this.win.rooview.el.save_easing_state();
1021 this.win.rooview.el.set_scale(scale,scale);
1022 // this.win.rooview.el.restore_easing_state();
1027 // -- buttons show hide.....
1029 public void buttonsShowHide()
1031 // basically hide everything, then show the relivant..
1034 this.win.openbtn.el.hide();
1035 this.win.openbackbtn.el.hide();
1037 this.win.backbutton.el.hide();
1040 this.win.editfilebutton.el.hide();
1041 this.win.projecteditbutton.el.hide();
1044 this.win.objectshowbutton.el.hide(); // add objects
1045 this.win.addpropbutton.el.hide();
1046 this.win.addlistenerbutton.el.hide();
1050 this.win.addprojectbutton.el.hide();
1051 this.win.addfilebutton.el.hide();
1052 this.win.delprojectbutton.el.hide();
1054 this.win.search_entry.el.hide();
1055 this.win.search_results.el.hide();
1056 switch (this.state) {
1058 case State.PREVIEW: // this is the default state when working...
1061 this.win.editfilebutton.el.show();
1062 this.win.projecteditbutton.el.show();
1066 this.win.objectshowbutton.el.show(); // add objects
1067 this.win.addpropbutton.el.show();
1068 this.win.addlistenerbutton.el.show();
1069 this.win.search_entry.el.show();
1071 this.win.openbtn.el.show();
1075 case State.CODEONLY:
1076 this.win.openbtn.el.show();
1077 this.win.projecteditbutton.el.show();
1078 this.win.search_entry.el.show();
1082 this.win.search_entry.el.show();
1083 this.win.backbutton.el.show();
1084 this.win.objectshowbutton.el.show(); // add objects ?? can you do this from here?
1085 this.win.addpropbutton.el.show();
1086 this.win.addlistenerbutton.el.show();
1090 case State.LISTENER:
1093 this.win.backbutton.el.show();
1094 this.win.objectshowbutton.el.show(); // add objects
1095 this.win.addpropbutton.el.show();
1096 this.win.addlistenerbutton.el.show();
1100 case State.FILEPROJECT:
1101 case State.PROJECTCODEONLY:
1103 this.win.backbutton.el.show();
1109 if (this.left_projects.getSelectedProject() != null ) {
1110 if (this.left_tree.getActiveFile() != null) {
1112 this.win.openbackbtn.el.show();
1114 this.win.addfilebutton.el.show();
1115 this.win.search_entry.el.show();
1116 this.win.projecteditbutton.el.show();
1120 this.win.addprojectbutton.el.show();
1121 this.win.delprojectbutton.el.show();
1134 public void valaCompiled(Json.Object obj)
1136 // vala has finished compiling...
1137 print("vala compiled");
1139 var buf = this.code_editor.buffer;
1140 buf.check_running = false;
1141 var has_errors = false;
1143 if (obj.has_member("ERR-TOTAL")) {
1144 if (obj.get_int_member("ERR-TOTAL")> 0) {
1147 this.win.statusbar_errors.setNotices( obj.get_object_member("ERR") , (int) obj.get_int_member("ERR-TOTAL"));
1149 this.win.statusbar_errors.setNotices( new Json.Object() , 0);
1152 if (obj.has_member("WARN-TOTAL")) {
1154 this.win.statusbar_warnings.setNotices(obj.get_object_member("WARN"), (int) obj.get_int_member("WARN-TOTAL"));
1156 this.win.statusbar_warnings.setNotices( new Json.Object() , 0);
1159 if (obj.has_member("DEPR-TOTAL")) {
1161 this.win.statusbar_depricated.setNotices( obj.get_object_member("DEPR"), (int) obj.get_int_member("DEPR-TOTAL"));
1164 this.win.statusbar_depricated.setNotices( new Json.Object(),0);
1167 buf.highlightErrorsJson("ERR", obj);
1168 buf.highlightErrorsJson("WARN", obj);
1169 buf.highlightErrorsJson("DEPR", obj);
1171 this.win.statusbar_compilestatus_label.el.hide();
1172 this.win.statusbar_run.el.hide();
1174 this.win.statusbar_compilestatus_label.el.show();
1175 this.win.statusbar_run.el.show();
1177 if (this.file.xtype == "Gtk") {
1178 // not sure how this is working ok? - as highlighting is happening on the vala files at present..
1179 var gbuf = this.window_gladeview.sourceview;
1180 gbuf.highlightErrorsJson("ERR", obj);
1181 gbuf.highlightErrorsJson("WARN", obj);
1182 gbuf.highlightErrorsJson("DEPR", obj);
1185 this.last_compile_result = obj;