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.showCompileResult);
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 // if the node change is caused by the editor (code preview)
124 if (this.left_tree.view.lastEventSource == "editor") {
127 return this.leftTreeBeforeChange();
131 this.left_tree.node_selected.connect((sel, source) => {
132 if (source == "editor") {
135 if (this.file.xtype == "Roo") {
136 this.window_rooview.sourceview.nodeSelected(sel,true); // foce scroll.
138 this.window_gladeview.sourceview.nodeSelected(sel);
142 this.left_tree.node_selected.connect((sel, source) => {
143 this.leftTreeNodeSelected(sel, source);
146 this.left_tree.changed.connect(() => {
147 print("LEFT TREE: Changed fired\n");
149 if (this.left_tree.getActiveFile().xtype == "Roo" ) {
150 this.window_rooview.requestRedraw();
152 this.window_gladeview.loadFile(this.left_tree.getActiveFile());
159 public bool leftTreeBeforeChange()
161 if (this.state != State.CODE) {
162 this.left_props.finish_editing();
165 if (!this.code_editor.saveContents()) {
171 public void leftTreeNodeSelected(JsRender.Node? sel, string source)
174 print("node_selected called %s\n", (sel == null) ? "NULL" : "a value");
177 this.left_props.el.hide();
179 this.left_props.el.show();
180 this.left_props.load(this.left_tree.getActiveFile(), sel);
181 switch (this.state) {
186 this.rightpalete.clear();
189 this.rightpalete.load(this.left_tree.getActiveFile().palete(), sel.fqn());
195 this.add_props.clear();
198 this.add_props.show(this.left_tree.getActiveFile().palete(), "props", sel.fqn());
204 this.add_props.clear();
207 this.add_props.show(this.left_tree.getActiveFile().palete(), "signals", sel.fqn());
211 this.switchState(State.PREVIEW);
224 public void propsListInit()
227 this.left_props =new Xcls_LeftProps();
228 this.left_props.ref();
229 this.left_props.main_window = this.win;
230 this.win.props.el.pack_start(this.left_props.el,true, true,0);
231 this.left_props.el.show_all();
233 this.left_props.show_editor.connect( (file, node, type, key) => {
234 this.switchState(State.CODE);
235 this.code_editor.show(
246 this.left_props.stop_editor.connect( () => {
247 if (this.state != State.CODE) {
251 var ret = this.code_editor.saveContents();
255 this.switchState(State.PREVIEW);
259 this.left_props.changed.connect(() => {
260 if (this.left_tree.getActiveFile().xtype == "Roo" ) {
261 this.window_rooview.requestRedraw();
263 this.window_gladeview.loadFile(this.left_tree.getActiveFile());
265 this.left_tree.model.updateSelected();
267 if (this.file.xtype=="Gtk") {
268 this.valasource.checkFileSpawn(this.file);
276 //------------- projects edit
278 public void projectEditInit()
280 this.projectsettings =new Xcls_ProjectSettings();
281 this.projectsettings.ref(); /// really?
283 this.vala_projectsettings =new ValaProjectSettings();
284 this.vala_projectsettings.ref();
285 this.vala_projectsettings.window = this.win;
287 ((Gtk.Container)(this.win.projecteditview.el.get_widget())).add(this.projectsettings.el);
288 //this.projectsettings.el.show_all();
290 var stage = this.win.projecteditview.el.get_stage();
291 stage.set_background_color( Clutter.Color.from_string("#000"));
293 this.projectsettings.buttonPressed.connect((btn) => {
294 if (this.left_tree.getActiveFile().xtype == "Roo" ) {
296 this.window_rooview.view.renderJS(true);
298 if (btn == "apply") {
299 this.window_rooview.view.renderJS(true);
303 // do nothing for gtk..
305 if (btn == "save" || btn == "apply") {
306 this.win.project.save();
309 this.switchState (State.PREVIEW);
314 // ----------- object adding
315 public void objectAddInit()
318 this.rightpalete = new Xcls_RightPalete();
319 this.rightpalete.ref(); /// really?
320 ((Gtk.Container)(this.win.objectview.el.get_widget())).add(this.rightpalete.el);
321 //this.projectsettings.el.show_all();
323 var stage = this.win.objectview.el.get_stage();
324 stage.set_background_color( Clutter.Color.from_string("#000"));
328 // ----------- properties adding list...
329 // listener uses the properties
330 public void propsAddInit()
333 this.add_props = new Xcls_WindowAddProp();
334 this.add_props.ref(); /// really?
335 ((Gtk.Container)(this.win.addpropsview.el.get_widget())).add(this.add_props.el);
336 //this.projectsettings.el.show_all();
338 var stage = this.win.addpropsview.el.get_stage();
339 stage.set_background_color( Clutter.Color.from_string("#000"));
342 this.add_props.select.connect( (key,type,skel, etype) => {
343 this.left_props.addProp(etype, key, skel, type);
347 public void propsAddShow()
351 public void propsAddHide()
359 // ----------- Add / Edit listener
360 // listener uses the properties
361 //public void listenerInit() { }
362 public void listenerShow()
366 public void listenerHide()
371 // -------------- codeEditor
373 public void codeEditInit()
375 this.code_editor = new Editor();
376 //this.code_editor.ref(); /// really?
377 ((Gtk.Container)(this.win.codeeditview.el.get_widget())).add(this.code_editor.el);
379 this.code_editor.window = this.win;
380 //this.projectsettings.el.show_all();
382 var stage = this.win.codeeditview.el.get_stage();
383 stage.set_background_color( Clutter.Color.from_string("#000"));
386 this.code_editor.save.connect( () => {
388 this.left_tree.model.updateSelected();
389 if (this.left_tree.getActiveFile().xtype == "Roo" ) {
390 this.window_rooview.requestRedraw();
392 this.window_gladeview.loadFile(this.left_tree.getActiveFile());
394 // we do not need to call spawn... - as it's already called by the editor?
400 // ----------- list of projects on left
401 public void projectListInit()
404 this.left_projects = new Xcls_WindowLeftProjects();
405 this.left_projects.ref();
406 this.win.leftpane.el.pack_start(this.left_projects.el,true, true,0);
407 this.left_projects.el.show_all();
408 this.left_projects.project_selected.connect((proj) => {
409 this.buttonsShowHide();
411 this.clutterfiles.loadProject(proj);
416 // ----------- file view
418 public void fileViewInit()
420 var stage = this.win.rooview.el.get_stage(); // seems odd...
421 this.clutterfiles = new Xcls_ClutterFiles();
422 this.clutterfiles.ref();
423 stage.add_child(this.clutterfiles.el);
424 this.clutterfiles.el.show();
427 this.clutterfiles.open.connect((file) => {
428 this.fileViewOpen(file);
430 this.clutterfiles.el.transitions_completed.connect(() => {
431 if (this.state == State.FILES) {
432 this.win.rooview.el.hide();
434 this.clutterfiles.el.hide();
442 public void fileDetailsInit()
444 this.file_details = new Xcls_PopoverFileDetails();
445 this.file_details.mainwindow = this.win;
446 // force it modal to the main window..
448 this.file_details.success.connect((project,file) =>
450 this.fileViewOpen(file);
455 public void fileViewOpen(JsRender.JsRender file, int line = -1)
457 this.win.project = file.project;
458 this.project = file.project;
462 if (file.xtype == "PlainFile") {
463 this.switchState (State.CODEONLY);
465 this.code_editor.show(file, null, "", "");
467 this.code_editor.scroll_to_line(line);
471 this.switchState (State.PREVIEW);
472 // this triggers loadItems..
473 this.left_tree.model.loadFile(file);
474 if (file.project.xtype == "Gtk" && line> -1 ) {
475 this.window_gladeview.scroll_to_line(line);
481 var ctr= ((Gtk.Container)(this.win.rooview.el.get_widget()));
482 var ctr_p= ((Gtk.Container)(this.win.projecteditview.el.get_widget()));
484 if (file.project.xtype == "Roo" ) {
485 ctr.foreach( (w) => { ctr.remove(w); });
486 ctr_p.foreach( (w) => { ctr_p.remove(w); });
487 ctr.add(this.window_rooview.el);
488 ctr_p.add(this.projectsettings.el);
489 if (file.xtype != "PlainFile") {
490 this.window_rooview.loadFile(file);
491 this.window_rooview.el.show_all();
493 this.projectsettings.el.show_all();
497 ctr.foreach( (w) => { ctr.remove(w); });
498 ctr_p.foreach( (w) => { ctr_p.remove(w); });
499 ctr.add(this.window_gladeview.el);
500 ctr_p.add(this.vala_projectsettings.el);
501 if (file.xtype != "PlainFile") {
502 this.window_gladeview.loadFile(file);
503 this.window_gladeview.el.show_all();
505 this.vala_projectsettings.el.show_all();
507 print("OPEN : " + file.name);
508 if (file.xtype != "PlainFile") {
509 this.win.editpane.el.set_position(this.win.editpane.el.max_position);
511 this.win.setTitle(file.project.name + " : " + file.name);
516 // our project properties is different for Roo and Gtk
517 // it would be better to change the above code to use this,
518 public void attachProjectSettings() {
520 var ctr_p= ((Gtk.Container)(this.win.projecteditview.el.get_widget()));
522 if (this.win.project.xtype == "Roo" ) {
523 ctr_p.foreach( (w) => { ctr_p.remove(w); });
524 ctr_p.add(this.projectsettings.el);
525 this.projectsettings.el.show_all();
528 ctr_p.foreach( (w) => { ctr_p.remove(w); });
529 ctr_p.add(this.vala_projectsettings.el);
530 this.vala_projectsettings.el.show_all();
534 public void fileViewOpenPlain(string fname)
537 this.switchState (State.CODEONLY);
538 this.code_editor.showPlainFile(fname);
542 // --------- webkit view
543 public void webkitViewInit()
545 this.window_rooview =new Xcls_WindowRooView();
546 this.window_rooview.main_window = this.win;
547 this.window_rooview.ref();
548 ((Gtk.Container)(this.win.rooview.el.get_widget())).add(this.window_rooview.el);
549 this.window_rooview.el.show_all();
551 var stage = this.win.rooview.el.get_stage();
552 stage.set_background_color( Clutter.Color.from_string("#000"));
557 public void gtkViewInit()
559 this.window_gladeview =new Xcls_GtkView();
560 this.window_gladeview.ref();
561 this.window_gladeview.main_window = this.win;
564 public void easingSaveAll()
566 this.win.addpropsview.el.save_easing_state();
567 this.win.codeeditview.el.save_easing_state();
568 this.win.objectview.el.save_easing_state();
569 this.win.projecteditview.el.save_easing_state();
570 this.win.rooview.el.save_easing_state();
571 this.clutterfiles.el.save_easing_state();
574 public void easingRestoreAll()
576 this.win.addpropsview.el.restore_easing_state();
577 this.win.codeeditview.el.restore_easing_state();
578 this.win.objectview.el.restore_easing_state();
579 this.win.projecteditview.el.restore_easing_state();
580 this.win.rooview.el.restore_easing_state();
581 this.clutterfiles.el.restore_easing_state();
584 public void switchState(State new_state)
587 // if the new state and the old state are the same..
589 if (new_state == this.state) {
593 // stop werid stuff happening
595 if (this.state == State.FILES
596 && new_state == State.FILEPROJECT
597 && this.left_projects.getSelectedProject() == null) {
600 // save the easing state of everything..
601 this.easingSaveAll();
603 switch (this.state) {
606 if (this.left_tree.getActiveFile() != null) {
607 if (this.left_tree.getActiveFile().xtype == "Roo" ) {
608 this.window_rooview.createThumb();
610 this.window_gladeview.createThumb();
613 // normally we are going from preview to another state.
614 // and different windows hide the preview in differnt ways..
622 this.win.addpropsview.el.set_scale(0.0f,0.0f);
626 this.code_editor.saveContents();
628 this.win.codeeditview.el.set_scale(0.0f,0.0f);
632 // going from codeonly..
634 // enable re-calc of canvas..
636 //this.code_editor.saveContents(); << not yet...
637 if (new_state != State.PROJECTCODEONLY) {
638 this.win.rooview.el.show();
639 this.win.leftpane.el.show();
640 this.win.codeeditview.el.set_scale(0.0f,0.0f);
642 this.win.codeeditview.el.set_pivot_point(0.0f,1.0f); // bottom left
643 this.win.codeeditview.el.set_scale(0.5f,0.5f);
645 while (Gtk.events_pending()) {
646 Gtk.main_iteration();
649 // hides it completely...
655 this.win.objectview.el.set_scale(0.0f,0.0f);
658 case State.FILEPROJECT:
660 case State.PROJECTCODEONLY:
661 if (this.win.project.xtype == "Gtk") {
662 this.vala_projectsettings.save();
664 if (this.state == State.FILEPROJECT) {
665 this.clutterfiles.el.set_scale(1.0f,1.0f);
668 this.win.projecteditview.el.set_scale(0.0f,0.0f);
671 case State.FILES: // goes to preview or codeonly...
675 if (new_state == State.FILEPROJECT) {
677 this.clutterfiles.el.set_easing_duration(1000);
678 this.clutterfiles.el.set_pivot_point(0.5f,1.0f);
679 this.clutterfiles.el.set_scale(0.5f,0.5f);
683 if (new_state == State.CODEONLY) {
684 this.win.rooview.el.hide();
686 this.win.rooview.el.show();
689 this.win.rooview.el.set_easing_duration(1000);
690 this.win.rooview.el.set_rotation_angle(Clutter.RotateAxis.Y_AXIS, 0.0f);
691 this.win.rooview.el.set_scale(1.0f,1.0f);
692 this.win.rooview.el.set_pivot_point(0.5f,0.5f);
693 this.win.rooview.el.set_opacity(0xff);
695 this.clutterfiles.el.set_easing_duration(1000);
696 this.clutterfiles.el.set_pivot_point(0.5f,0.5f);
697 this.clutterfiles.el.set_rotation_angle(Clutter.RotateAxis.Y_AXIS, -180.0f);
698 this.clutterfiles.el.set_opacity(0);
701 //this.clutterfiles.el.hide();
709 var oldstate =this.state;
710 this.state = new_state;
714 this.buttonsShowHide();
717 switch (this.state) {
719 case State.PREVIEW: // this is the default state when working...
720 this.win.editpane.el.show(); // holder for tree and properties..
723 this.left_projects.el.hide();
724 if (oldstate != State.FILES) {
725 // it's handled above..
726 print ("changing state to preview from NOT files..");
729 this.win.rooview.el.set_scale(1.0f,1.0f);
738 var ae = this.left_tree.getActiveElement();
740 this.state = oldstate;
741 this.buttonsShowHide();
742 this.resizeCanvasElements();
743 this.easingRestoreAll();
746 this.add_props.el.show_all();
748 Palete.factory(this.win.project.xtype),
749 this.state == State.LISTENER ? "signals" : "props",
756 // -- FIXME? this needs to be State aware?
758 this.win.rooview.el.set_pivot_point(1.0f,0.5f);
760 this.win.addpropsview.el.set_scale(1.0f,1.0f);
764 var n = this.left_tree.getActiveElement();
766 if (this.file == null) {
767 this.state =oldstate;
768 this.buttonsShowHide();
769 this.resizeCanvasElements();
770 this.easingRestoreAll();
774 if (n == null && this.file.tree != null) {
775 this.state = oldstate;
776 this.buttonsShowHide();
777 this.resizeCanvasElements();
778 this.easingRestoreAll();
782 this.rightpalete.el.show_all();
783 this.rightpalete.load(this.left_tree.getActiveFile().palete(), n == null ? "*top" : n.fqn());
787 this.win.rooview.el.set_pivot_point(1.0f,0.5f);
788 this.win.objectview.el.set_scale(1.0f,1.0f);
794 this.win.codeeditview.el.show();
795 this.code_editor.el.show_all();
796 // caller needs to call editor - show....
797 this.win.codeeditview.el.set_scale(1.0f,1.0f);
798 this.win.rooview.el.set_pivot_point(1.0f,0.5f);
803 // going to codeonly..
804 this.win.codeeditview.el.show();
806 //while (Gtk.events_pending()) {
807 // Gtk.main_iteration();
810 this.win.leftpane.el.hide();
811 this.win.codeeditview.el.show();
812 //while (Gtk.events_pending()) {
813 // Gtk.main_iteration();
817 this.code_editor.el.show_all();
819 this.win.codeeditview.el.set_scale(1.0f,1.0f);
820 this.win.rooview.el.set_pivot_point(1.0f,0.5f);
823 case State.PROJECTCODEONLY:
824 // going to project edit (when in code only)
828 if (this.win.project.xtype == "Roo") {
829 this.projectsettings.el.show_all();
830 this.projectsettings.show(this.win.project);
832 this.vala_projectsettings.el.show_all();
833 this.vala_projectsettings.show((Project.Gtk)this.win.project);
836 this.win.projecteditview.el.set_scale(1.0f,1.0f);
842 this.win.rooview.el.set_pivot_point(1.0f,1.0f); // bottom right..
844 if (this.win.project.xtype == "Roo") {
845 this.projectsettings.el.show_all();
846 this.projectsettings.show(this.win.project);
848 this.vala_projectsettings.el.show_all();
849 this.vala_projectsettings.show((Project.Gtk)this.win.project);
852 this.win.projecteditview.el.set_scale(1.0f,1.0f);
856 case State.FILEPROJECT:
857 var pr = this.left_projects.getSelectedProject();
859 this.win.project = pr;
861 this.attachProjectSettings();
862 print("FIlE PROJECT - show %s\n", pr.xtype);
864 if (pr.xtype == "Roo") {
865 this.projectsettings.el.show_all();
866 this.projectsettings.show(this.win.project);
868 this.vala_projectsettings.el.show_all();
869 this.vala_projectsettings.show((Project.Gtk)this.win.project);
872 this.win.projecteditview.el.set_scale(1.0f,1.0f);
876 case State.FILES: // can only get here from PREVIEW (or code-only) state.. in theory..
879 this.win.editpane.el.hide(); // holder for tree and properties..
881 this.left_projects.el.show();
883 // rotate the preview to hidden...
884 this.win.rooview.el.set_easing_duration(1000);
885 this.win.rooview.el.set_pivot_point(0.5f,0.5f);
886 this.win.rooview.el.set_rotation_angle(Clutter.RotateAxis.Y_AXIS, 180.0f);
887 this.win.rooview.el.set_opacity(0);
892 if (this.win.project != null) {
893 this.left_projects.selectProject(this.win.project);
897 this.clutterfiles.el.show();
899 this.clutterfiles.el.set_easing_duration(1000);
900 this.clutterfiles.el.set_pivot_point(0.5f,0.5f);
901 this.clutterfiles.el.set_rotation_angle(Clutter.RotateAxis.Y_AXIS, 0.0f);
902 this.clutterfiles.el.set_opacity(0xff);
910 this.resizeCanvasElements();
911 this.easingRestoreAll();
913 // run the animation.. - then load files...
914 GLib.Timeout.add(500, () =>{
915 this.resizeCanvasElements();
921 public int redraw_count = 0;
922 public void resizeCanvas() // called by window resize .. delays redraw
924 var rc = this.redraw_count;
925 this.redraw_count = 2;
927 GLib.Timeout.add(100, () =>{
928 return this.resizeCanvasQueue();
932 public bool resizeCanvasQueue()
934 //print("WindowState.resizeCanvasQueue %d\n", this.redraw_count);
936 if (this.redraw_count < 1) {
937 return false; // should not really happen...
943 if (this.redraw_count > 0) {
944 return true; // do it again in 1 second...
946 // got down to 0 or -1....
947 this.redraw_count = 0;
948 this.resizeCanvasElements();
952 public void resizeCanvasElements()
954 Gtk.Allocation alloc;
955 this.win.clutterembed.el.get_allocation(out alloc);
957 // print("WindowState.resizeCanvasElements\n");
958 if (!this.children_loaded || this.win.clutterembed == null) {
959 print("WindowState.resizeCanvasElements = ingnore not loaded or no clutterfiles\n");
963 var avail = alloc.width < 50.0f ? 0 : alloc.width - 50.0f;
964 var palsize = avail < 300.0f ? avail : 300.0f;
967 // -------- code edit min 600
969 var codesize = avail < 800.0f ? avail : 800.0f;
972 //print("set code size %f\n", codesize);
976 switch ( this.state) {
979 this.win.rooview.el.set_size(alloc.width-50, alloc.height);
983 this.clutterfiles.set_size(alloc.width-50, alloc.height);
988 this.win.projecteditview.el.set_size(alloc.width-50, alloc.height / 2.0f);
990 // this.win.rooview.el.save_easing_state();
991 //this.win.rooview.el.set_size(alloc.width / 2.0f, alloc.height / 2.0f);
993 this.win.rooview.el.set_scale(0.5f, 0.5f);
994 //this.win.rooview.el.restore_easing_state();
998 this.win.codeeditview.el.set_size(codesize, alloc.height);
999 var scale = avail > 0.0f ? (avail - codesize -10 ) / avail : 0.0f;
1000 //this.win.rooview.el.save_easing_state();
1002 this.win.rooview.el.set_scale(scale,scale);
1003 // this.win.rooview.el.restore_easing_state();
1006 case State.CODEONLY:
1007 this.win.codeeditview.el.set_size(codesize, alloc.height);
1008 var scale = avail > 0.0f ? (avail - codesize -10 ) / avail : 0.0f;
1009 //this.win.rooview.el.save_easing_state();
1010 this.win.rooview.el.hide();
1011 this.win.rooview.el.set_scale(scale,scale);
1012 // this.win.rooview.el.restore_easing_state();
1015 case State.LISTENER:
1016 this.win.addpropsview.el.set_size(palsize, alloc.height);
1017 var scale = avail > 0.0f ? (avail - palsize -10 ) / avail : 0.0f;
1018 this.win.rooview.el.set_scale(scale,scale);
1022 this.win.objectview.el.set_size(palsize, alloc.height);
1023 var scale = avail > 0.0f ? (avail - palsize -10 ) / avail : 0.0f;
1024 //this.win.rooview.el.save_easing_state();
1025 this.win.rooview.el.set_scale(scale,scale);
1026 // this.win.rooview.el.restore_easing_state();
1031 // -- buttons show hide.....
1033 public void buttonsShowHide()
1035 // basically hide everything, then show the relivant..
1038 this.win.openbtn.el.hide();
1039 this.win.openbackbtn.el.hide();
1041 this.win.backbutton.el.hide();
1044 this.win.editfilebutton.el.hide();
1045 this.win.projecteditbutton.el.hide();
1048 this.win.objectshowbutton.el.hide(); // add objects
1049 this.win.addpropbutton.el.hide();
1050 this.win.addlistenerbutton.el.hide();
1054 this.win.addprojectbutton.el.hide();
1055 this.win.addfilebutton.el.hide();
1056 this.win.delprojectbutton.el.hide();
1058 this.win.search_entry.el.hide();
1059 this.win.search_results.el.hide();
1060 switch (this.state) {
1062 case State.PREVIEW: // this is the default state when working...
1065 this.win.editfilebutton.el.show();
1066 this.win.projecteditbutton.el.show();
1070 this.win.objectshowbutton.el.show(); // add objects
1071 this.win.addpropbutton.el.show();
1072 this.win.addlistenerbutton.el.show();
1073 this.win.search_entry.el.show();
1075 this.win.openbtn.el.show();
1079 case State.CODEONLY:
1080 this.win.openbtn.el.show();
1081 this.win.projecteditbutton.el.show();
1082 this.win.search_entry.el.show();
1086 this.win.search_entry.el.show();
1087 this.win.backbutton.el.show();
1088 this.win.objectshowbutton.el.show(); // add objects ?? can you do this from here?
1089 this.win.addpropbutton.el.show();
1090 this.win.addlistenerbutton.el.show();
1094 case State.LISTENER:
1097 this.win.backbutton.el.show();
1098 this.win.objectshowbutton.el.show(); // add objects
1099 this.win.addpropbutton.el.show();
1100 this.win.addlistenerbutton.el.show();
1104 case State.FILEPROJECT:
1105 case State.PROJECTCODEONLY:
1107 this.win.backbutton.el.show();
1113 if (this.left_projects.getSelectedProject() != null ) {
1114 if (this.left_tree.getActiveFile() != null) {
1116 this.win.openbackbtn.el.show();
1118 this.win.addfilebutton.el.show();
1119 this.win.search_entry.el.show();
1120 this.win.projecteditbutton.el.show();
1124 this.win.addprojectbutton.el.show();
1125 this.win.delprojectbutton.el.show();
1138 public void showCompileResult(Json.Object obj)
1140 // vala has finished compiling...
1141 print("vala compiled");
1142 var generator = new Json.Generator ();
1143 var n = new Json.Node(Json.NodeType.OBJECT);
1145 generator.set_root (n);
1146 print("result :%s", generator.to_data (null));
1149 var buf = this.code_editor.buffer;
1150 buf.check_running = false;
1151 var has_errors = false;
1153 if (obj.has_member("ERR-TOTAL")) {
1154 if (obj.get_int_member("ERR-TOTAL")> 0) {
1157 this.win.statusbar_errors.setNotices( obj.get_object_member("ERR") , (int) obj.get_int_member("ERR-TOTAL"));
1159 this.win.statusbar_errors.setNotices( new Json.Object() , 0);
1162 if (obj.has_member("WARN-TOTAL")) {
1164 this.win.statusbar_warnings.setNotices(obj.get_object_member("WARN"), (int) obj.get_int_member("WARN-TOTAL"));
1166 this.win.statusbar_warnings.setNotices( new Json.Object() , 0);
1169 if (obj.has_member("DEPR-TOTAL")) {
1171 this.win.statusbar_depricated.setNotices( obj.get_object_member("DEPR"), (int) obj.get_int_member("DEPR-TOTAL"));
1174 this.win.statusbar_depricated.setNotices( new Json.Object(),0);
1176 if (this.state == State.CODE || this.state == State.PROJECTCODEONLY) {
1177 buf.highlightErrorsJson("ERR", obj);
1178 buf.highlightErrorsJson("WARN", obj);
1179 buf.highlightErrorsJson("DEPR", obj);
1182 this.win.statusbar_compilestatus_label.el.hide();
1183 this.win.statusbar_run.el.hide();
1185 this.win.statusbar_compilestatus_label.el.show();
1186 this.win.statusbar_run.el.show();
1188 if (this.file.xtype == "Gtk") {
1189 // not sure how this is working ok? - as highlighting is happening on the vala files at present..
1190 var gbuf = this.window_gladeview.sourceview;
1191 gbuf.highlightErrorsJson("ERR", obj);
1192 gbuf.highlightErrorsJson("WARN", obj);
1193 gbuf.highlightErrorsJson("DEPR", obj);
1196 this.win.statusbar_run.el.show();
1201 if (this.file.xtype == "Gtk") {
1202 // not sure how this is working ok? - as highlighting is happening on the vala files at present..
1203 var gbuf = this.window_rooview.sourceview;
1204 gbuf.highlightErrorsJson("ERR", obj);
1205 gbuf.highlightErrorsJson("WARN", obj);
1206 gbuf.highlightErrorsJson("DEPR", obj);
1210 this.last_compile_result = obj;