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 // PROJECTCODEONLY // when editing code... ??
22 //PROJECT, // project settings..
23 //FILEPROJECT, // project when in file mode
27 public State state = State.NONE;
29 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_RooProjectSettings roo_projectsettings_pop;
39 public Xcls_ValaProjectSettingsPopover vala_projectsettings_pop;
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();
130 // node selected -- only by clicking?
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.roo_projectsettings_pop =new Xcls_RooProjectSettings();
281 this.roo_projectsettings_pop.ref(); /// really?
283 this.vala_projectsettings_pop =new Xcls_ValaProjectSettingsPopover();
284 this.vala_projectsettings_pop.ref();
285 this.vala_projectsettings_pop.window = this.win;
287 //((Gtk.Container)(this.win.projecteditview.el.get_widget())).add(this.projectsettings.el);
290 this.roo_projectsettings_pop.buttonPressed.connect((btn) => {
291 // in theory active file can only be rooo...
292 if (this.left_tree.getActiveFile().xtype == "Roo" ) {
294 this.window_rooview.view.renderJS(true);
295 this.roo_projectsettings_pop.el.hide();
297 if (btn == "apply") {
298 this.window_rooview.view.renderJS(true);
302 // do nothing for gtk..
304 if (btn == "save" || btn == "apply") {
305 this.win.project.save();
308 //this.switchState (State.PREVIEW);
313 public void projectPopoverShow(Gtk.Widget btn)
315 if (this.left_tree.getActiveFile().xtype == "Roo" ) {
316 this.roo_projectsettings_pop.show(btn,this.project);
320 this.vala_projectsettings_pop.show(btn,(Project.Gtk)this.project);
325 // ----------- object adding
326 public void objectAddInit()
329 this.rightpalete = new Xcls_RightPalete();
330 this.rightpalete.ref(); /// really?
331 ((Gtk.Container)(this.win.objectview.el.get_widget())).add(this.rightpalete.el);
334 var stage = this.win.objectview.el.get_stage();
335 stage.set_background_color( Clutter.Color.from_string("#000"));
339 // ----------- properties adding list...
340 // listener uses the properties
341 public void propsAddInit()
344 this.add_props = new Xcls_WindowAddProp();
345 this.add_props.ref(); /// really?
346 ((Gtk.Container)(this.win.addpropsview.el.get_widget())).add(this.add_props.el);
349 var stage = this.win.addpropsview.el.get_stage();
350 stage.set_background_color( Clutter.Color.from_string("#000"));
353 this.add_props.select.connect( (key,type,skel, etype) => {
354 this.left_props.addProp(etype, key, skel, type);
358 public void propsAddShow()
362 public void propsAddHide()
370 // ----------- Add / Edit listener
371 // listener uses the properties
372 //public void listenerInit() { }
373 public void listenerShow()
377 public void listenerHide()
382 // -------------- codeEditor
384 public void codeEditInit()
386 this.code_editor = new Editor();
387 //this.code_editor.ref(); /// really?
388 ((Gtk.Container)(this.win.codeeditview.el.get_widget())).add(this.code_editor.el);
390 this.code_editor.window = this.win;
393 var stage = this.win.codeeditview.el.get_stage();
394 stage.set_background_color( Clutter.Color.from_string("#000"));
397 this.code_editor.save.connect( () => {
399 this.left_tree.model.updateSelected();
400 if (this.left_tree.getActiveFile().xtype == "Roo" ) {
401 this.window_rooview.requestRedraw();
403 this.window_gladeview.loadFile(this.left_tree.getActiveFile());
405 // we do not need to call spawn... - as it's already called by the editor?
411 // ----------- list of projects on left
412 public void projectListInit()
415 this.left_projects = new Xcls_WindowLeftProjects();
416 this.left_projects.ref();
417 this.win.leftpane.el.pack_start(this.left_projects.el,true, true,0);
418 this.left_projects.el.show_all();
419 this.left_projects.project_selected.connect((proj) => {
420 this.buttonsShowHide();
422 this.clutterfiles.loadProject(proj);
427 // ----------- file view
429 public void fileViewInit()
431 var stage = this.win.rooview.el.get_stage(); // seems odd...
432 this.clutterfiles = new Xcls_ClutterFiles();
433 this.clutterfiles.ref();
434 stage.add_child(this.clutterfiles.el);
435 this.clutterfiles.el.show();
438 this.clutterfiles.open.connect((file) => {
439 this.fileViewOpen(file);
441 this.clutterfiles.el.transitions_completed.connect(() => {
442 if (this.state == State.FILES) {
443 this.win.rooview.el.hide();
445 this.clutterfiles.el.hide();
453 public void fileDetailsInit()
455 this.file_details = new Xcls_PopoverFileDetails();
456 this.file_details.mainwindow = this.win;
457 // force it modal to the main window..
459 this.file_details.success.connect((project,file) =>
461 this.fileViewOpen(file);
466 public void fileViewOpen(JsRender.JsRender file, int line = -1)
468 this.win.project = file.project;
469 this.project = file.project;
473 if (file.xtype == "PlainFile") {
474 this.switchState (State.CODEONLY);
476 this.code_editor.show(file, null, "", "");
478 this.code_editor.scroll_to_line(line);
482 this.switchState (State.PREVIEW);
483 // this triggers loadItems..
484 this.left_tree.model.loadFile(file);
485 if (file.project.xtype == "Gtk" && line> -1 ) {
486 this.window_gladeview.scroll_to_line(line);
492 var ctr= ((Gtk.Container)(this.win.rooview.el.get_widget()));
495 if (file.project.xtype == "Roo" ) {
496 ctr.foreach( (w) => { ctr.remove(w); });
498 ctr.add(this.window_rooview.el);
500 if (file.xtype != "PlainFile") {
501 this.window_rooview.loadFile(file);
502 this.window_rooview.el.show_all();
508 ctr.foreach( (w) => { ctr.remove(w); });
510 ctr.add(this.window_gladeview.el);
512 if (file.xtype != "PlainFile") {
513 this.window_gladeview.loadFile(file);
514 this.window_gladeview.el.show_all();
518 print("OPEN : " + file.name);
519 if (file.xtype != "PlainFile") {
520 this.win.editpane.el.set_position(this.win.editpane.el.max_position);
522 this.win.setTitle(file.project.name + " : " + file.name);
529 public void fileViewOpenPlain(string fname)
532 this.switchState (State.CODEONLY);
533 this.code_editor.showPlainFile(fname);
537 // --------- webkit view
538 public void webkitViewInit()
540 this.window_rooview =new Xcls_WindowRooView();
541 this.window_rooview.main_window = this.win;
542 this.window_rooview.ref();
543 ((Gtk.Container)(this.win.rooview.el.get_widget())).add(this.window_rooview.el);
544 this.window_rooview.el.show_all();
546 var stage = this.win.rooview.el.get_stage();
547 stage.set_background_color( Clutter.Color.from_string("#000"));
552 public void gtkViewInit()
554 this.window_gladeview =new Xcls_GtkView();
555 this.window_gladeview.ref();
556 this.window_gladeview.main_window = this.win;
559 public void easingSaveAll()
561 this.win.addpropsview.el.save_easing_state();
562 this.win.codeeditview.el.save_easing_state();
563 this.win.objectview.el.save_easing_state();
564 this.win.rooview.el.save_easing_state();
565 this.clutterfiles.el.save_easing_state();
568 public void easingRestoreAll()
570 this.win.addpropsview.el.restore_easing_state();
571 this.win.codeeditview.el.restore_easing_state();
572 this.win.objectview.el.restore_easing_state();
573 this.win.rooview.el.restore_easing_state();
574 this.clutterfiles.el.restore_easing_state();
577 public void switchState(State new_state)
580 // if the new state and the old state are the same..
582 if (new_state == this.state) {
586 // stop werid stuff happening
588 if (this.state == State.FILES
589 //&& new_state == State.FILEPROJECT
590 && this.left_projects.getSelectedProject() == null) {
593 // save the easing state of everything..
594 this.easingSaveAll();
596 switch (this.state) {
599 if (this.left_tree.getActiveFile() != null) {
600 if (this.left_tree.getActiveFile().xtype == "Roo" ) {
601 this.window_rooview.createThumb();
603 this.window_gladeview.createThumb();
606 // normally we are going from preview to another state.
607 // and different windows hide the preview in differnt ways..
615 this.win.addpropsview.el.set_scale(0.0f,0.0f);
619 this.code_editor.saveContents();
621 this.win.codeeditview.el.set_scale(0.0f,0.0f);
625 // going from codeonly..
627 // enable re-calc of canvas..
629 //this.code_editor.saveContents(); << not yet...
631 this.win.rooview.el.show();
632 this.win.leftpane.el.show();
633 this.win.codeeditview.el.set_scale(0.0f,0.0f);
635 /*this.win.codeeditview.el.set_easing_duration(1000);
636 this.win.codeeditview.el.set_rotation_angle(Clutter.RotateAxis.Y_AXIS, 0.0f);
637 //this.win.codeeditview.el.set_scale(1.0f,1.0f);
638 this.win.codeeditview.el.set_pivot_point(0.5f,0.5f);
639 this.win.codeeditview.el.set_opacity(0xff);
642 while (Gtk.events_pending()) {
643 Gtk.main_iteration();
646 // hides it completely...
652 this.win.objectview.el.set_scale(0.0f,0.0f);
655 /*case State.FILEPROJECT:
656 //case State.PROJECT:
657 //case State.PROJECTCODEONLY:
658 if (this.win.project.xtype == "Gtk") {
659 this.vala_projectsettings.save();
661 if (this.state == State.FILEPROJECT) {
662 this.clutterfiles.el.set_scale(1.0f,1.0f);
665 this.win.projecteditview.el.set_scale(0.0f,0.0f);
668 case State.FILES: // goes to preview or codeonly...
672 /*if (new_state == State.FILEPROJECT) {
674 this.clutterfiles.el.set_easing_duration(1000);
675 this.clutterfiles.el.set_pivot_point(0.5f,1.0f);
676 this.clutterfiles.el.set_scale(0.5f,0.5f);
681 if (new_state == State.CODEONLY) {
682 this.win.rooview.el.hide();
684 this.win.rooview.el.show();
687 this.win.rooview.el.set_easing_duration(1000);
688 this.win.rooview.el.set_rotation_angle(Clutter.RotateAxis.Y_AXIS, 0.0f);
689 this.win.rooview.el.set_scale(1.0f,1.0f);
690 this.win.rooview.el.set_pivot_point(0.5f,0.5f);
691 this.win.rooview.el.set_opacity(0xff);
693 this.clutterfiles.el.set_easing_duration(1000);
694 this.clutterfiles.el.set_pivot_point(0.5f,0.5f);
695 this.clutterfiles.el.set_rotation_angle(Clutter.RotateAxis.Y_AXIS, -180.0f);
696 this.clutterfiles.el.set_opacity(0);
699 //this.clutterfiles.el.hide();
707 var oldstate =this.state;
708 this.state = new_state;
712 this.buttonsShowHide();
715 switch (this.state) {
717 case State.PREVIEW: // this is the default state when working...
718 this.win.editpane.el.show(); // holder for tree and properties..
721 this.left_projects.el.hide();
722 if (oldstate != State.FILES) {
723 // it's handled above..
724 print ("changing state to preview from NOT files..");
727 this.win.rooview.el.set_scale(1.0f,1.0f);
736 var ae = this.left_tree.getActiveElement();
738 this.state = oldstate;
739 this.buttonsShowHide();
740 this.resizeCanvasElements();
741 this.easingRestoreAll();
744 this.add_props.el.show_all();
746 this.win.project.palete, //Palete.factory(this.win.project.xtype),
747 this.state == State.LISTENER ? "signals" : "props",
754 // -- FIXME? this needs to be State aware?
756 this.win.rooview.el.set_pivot_point(1.0f,0.5f);
758 this.win.addpropsview.el.set_scale(1.0f,1.0f);
762 var n = this.left_tree.getActiveElement();
764 if (this.file == null) {
765 this.state =oldstate;
766 this.buttonsShowHide();
767 this.resizeCanvasElements();
768 this.easingRestoreAll();
772 if (n == null && this.file.tree != null) {
773 this.state = oldstate;
774 this.buttonsShowHide();
775 this.resizeCanvasElements();
776 this.easingRestoreAll();
780 this.rightpalete.el.show_all();
781 this.rightpalete.load(this.left_tree.getActiveFile().palete(), n == null ? "*top" : n.fqn());
785 this.win.rooview.el.set_pivot_point(1.0f,0.5f);
786 this.win.objectview.el.set_scale(1.0f,1.0f);
792 this.win.codeeditview.el.show();
793 this.code_editor.el.show_all();
794 // caller needs to call editor - show....
795 this.win.codeeditview.el.set_scale(1.0f,1.0f);
796 this.win.rooview.el.set_pivot_point(1.0f,0.5f);
801 // going to codeonly..
802 this.win.codeeditview.el.show();
804 //while (Gtk.events_pending()) {
805 // Gtk.main_iteration();
808 this.win.leftpane.el.hide();
809 this.win.codeeditview.el.show();
810 //while (Gtk.events_pending()) {
811 // Gtk.main_iteration();
815 this.code_editor.el.show_all();
817 this.win.codeeditview.el.set_scale(1.0f,1.0f);
818 this.win.rooview.el.set_pivot_point(1.0f,0.5f);
821 /*case State.PROJECTCODEONLY:
822 // going to project edit (when in code only)
826 if (this.win.project.xtype == "Roo") {
827 this.projectsettings.el.show_all();
828 this.projectsettings.show(this.win.project);
830 this.vala_projectsettings.el.show_all();
831 this.vala_projectsettings.show((Project.Gtk)this.win.project);
834 this.win.projecteditview.el.set_scale(1.0f,1.0f);
840 this.win.rooview.el.set_pivot_point(1.0f,1.0f); // bottom right..
842 if (this.win.project.xtype == "Roo") {
843 this.projectsettings.el.show_all();
844 this.projectsettings.show(this.win.project);
846 this.vala_projectsettings.el.show_all();
847 this.vala_projectsettings.show((Project.Gtk)this.win.project);
850 this.win.projecteditview.el.set_scale(1.0f,1.0f);
854 case State.FILEPROJECT:
855 var pr = this.left_projects.getSelectedProject();
857 this.win.project = pr;
859 this.attachProjectSettings();
860 print("FIlE PROJECT - show %s\n", pr.xtype);
862 if (pr.xtype == "Roo") {
863 this.projectsettings.el.show_all();
864 this.projectsettings.show(this.win.project);
866 this.vala_projectsettings.el.show_all();
867 this.vala_projectsettings.show((Project.Gtk)this.win.project);
870 this.win.projecteditview.el.set_scale(1.0f,1.0f);
874 case State.FILES: // can only get here from PREVIEW (or code-only) state.. in theory..
877 this.win.editpane.el.hide(); // holder for tree and properties..
879 this.left_projects.el.show();
881 // rotate the preview to hidden...
882 this.win.rooview.el.set_easing_duration(1000);
883 this.win.rooview.el.set_pivot_point(0.5f,0.5f);
884 this.win.rooview.el.set_rotation_angle(Clutter.RotateAxis.Y_AXIS, 180.0f);
885 this.win.rooview.el.set_opacity(0);
890 if (this.win.project != null) {
891 this.left_projects.selectProject(this.win.project);
895 this.clutterfiles.el.show();
897 this.clutterfiles.el.set_easing_duration(1000);
898 this.clutterfiles.el.set_pivot_point(0.5f,0.5f);
899 this.clutterfiles.el.set_rotation_angle(Clutter.RotateAxis.Y_AXIS, 0.0f);
900 this.clutterfiles.el.set_opacity(0xff);
908 this.resizeCanvasElements();
909 this.easingRestoreAll();
911 // run the animation.. - then load files...
912 GLib.Timeout.add(500, () =>{
913 this.resizeCanvasElements();
919 public int redraw_count = 0;
920 public void resizeCanvas() // called by window resize .. delays redraw
922 var rc = this.redraw_count;
923 this.redraw_count = 2;
925 GLib.Timeout.add(100, () =>{
926 return this.resizeCanvasQueue();
930 public bool resizeCanvasQueue()
932 //print("WindowState.resizeCanvasQueue %d\n", this.redraw_count);
934 if (this.redraw_count < 1) {
935 return false; // should not really happen...
941 if (this.redraw_count > 0) {
942 return true; // do it again in 1 second...
944 // got down to 0 or -1....
945 this.redraw_count = 0;
946 this.resizeCanvasElements();
950 public void resizeCanvasElements()
952 Gtk.Allocation alloc;
953 this.win.clutterembed.el.get_allocation(out alloc);
955 // print("WindowState.resizeCanvasElements\n");
956 if (!this.children_loaded || this.win.clutterembed == null) {
957 print("WindowState.resizeCanvasElements = ingnore not loaded or no clutterfiles\n");
961 var avail = alloc.width < 50.0f ? 0 : alloc.width - 50.0f;
962 var palsize = avail < 300.0f ? avail : 300.0f;
965 // -------- code edit min 600
967 var codesize = avail < 800.0f ? avail : 800.0f;
970 //print("set code size %f\n", codesize);
974 switch ( this.state) {
977 this.win.rooview.el.set_size(alloc.width-50, alloc.height);
981 this.clutterfiles.set_size(alloc.width-50, alloc.height);
984 /*case State.PROJECT:
986 this.win.projecteditview.el.set_size(alloc.width-50, alloc.height / 2.0f);
988 // this.win.rooview.el.save_easing_state();
989 //this.win.rooview.el.set_size(alloc.width / 2.0f, alloc.height / 2.0f);
991 this.win.rooview.el.set_scale(0.5f, 0.5f);
992 //this.win.rooview.el.restore_easing_state();
996 this.win.codeeditview.el.set_size(codesize, alloc.height);
997 var scale = avail > 0.0f ? (avail - codesize -10 ) / avail : 0.0f;
998 //this.win.rooview.el.save_easing_state();
1000 this.win.rooview.el.set_scale(scale,scale);
1001 // this.win.rooview.el.restore_easing_state();
1004 case State.CODEONLY:
1005 this.win.codeeditview.el.set_size(codesize, alloc.height);
1006 var scale = avail > 0.0f ? (avail - codesize -10 ) / avail : 0.0f;
1007 //this.win.rooview.el.save_easing_state();
1008 this.win.rooview.el.hide();
1009 this.win.rooview.el.set_scale(scale,scale);
1010 // this.win.rooview.el.restore_easing_state();
1013 case State.LISTENER:
1014 this.win.addpropsview.el.set_size(palsize, alloc.height);
1015 var scale = avail > 0.0f ? (avail - palsize -10 ) / avail : 0.0f;
1016 this.win.rooview.el.set_scale(scale,scale);
1020 this.win.objectview.el.set_size(palsize, alloc.height);
1021 var scale = avail > 0.0f ? (avail - palsize -10 ) / avail : 0.0f;
1022 //this.win.rooview.el.save_easing_state();
1023 this.win.rooview.el.set_scale(scale,scale);
1024 // this.win.rooview.el.restore_easing_state();
1029 // -- buttons show hide.....
1031 public void buttonsShowHide()
1033 // basically hide everything, then show the relivant..
1036 this.win.openbtn.el.hide();
1037 this.win.openbackbtn.el.hide();
1039 this.win.backbutton.el.hide();
1042 this.win.editfilebutton.el.hide();
1043 this.win.projecteditbutton.el.hide();
1046 this.win.objectshowbutton.el.hide(); // add objects
1047 this.win.addpropbutton.el.hide();
1048 this.win.addlistenerbutton.el.hide();
1052 this.win.addprojectbutton.el.hide();
1053 this.win.addfilebutton.el.hide();
1054 this.win.delprojectbutton.el.hide();
1056 this.win.search_entry.el.hide();
1057 this.win.search_results.el.hide();
1058 switch (this.state) {
1060 case State.PREVIEW: // this is the default state when working...
1063 this.win.editfilebutton.el.show();
1064 this.win.projecteditbutton.el.show();
1068 this.win.objectshowbutton.el.show(); // add objects
1069 this.win.addpropbutton.el.show();
1070 this.win.addlistenerbutton.el.show();
1071 this.win.search_entry.el.show();
1073 this.win.openbtn.el.show();
1077 case State.CODEONLY:
1078 this.win.openbtn.el.show();
1079 this.win.projecteditbutton.el.show();
1080 this.win.search_entry.el.show();
1084 this.win.search_entry.el.show();
1085 this.win.backbutton.el.show();
1086 this.win.objectshowbutton.el.show(); // add objects ?? can you do this from here?
1087 this.win.addpropbutton.el.show();
1088 this.win.addlistenerbutton.el.show();
1092 case State.LISTENER:
1095 this.win.backbutton.el.show();
1096 this.win.objectshowbutton.el.show(); // add objects
1097 this.win.addpropbutton.el.show();
1098 this.win.addlistenerbutton.el.show();
1102 case State.FILEPROJECT:
1103 case State.PROJECTCODEONLY:
1105 this.win.backbutton.el.show();
1111 if (this.left_projects.getSelectedProject() != null ) {
1112 if (this.left_tree.getActiveFile() != null) {
1114 this.win.openbackbtn.el.show();
1116 this.win.addfilebutton.el.show();
1117 this.win.search_entry.el.show();
1118 this.win.projecteditbutton.el.show();
1122 this.win.addprojectbutton.el.show();
1123 this.win.delprojectbutton.el.show();
1136 public void showCompileResult(Json.Object obj)
1138 // vala has finished compiling...
1139 print("vala compiled");
1140 var generator = new Json.Generator ();
1141 var n = new Json.Node(Json.NodeType.OBJECT);
1143 generator.set_root (n);
1144 print("result :%s", generator.to_data (null));
1147 var buf = this.code_editor.buffer;
1148 buf.check_running = false;
1149 var has_errors = false;
1151 if (obj.has_member("ERR-TOTAL")) {
1152 if (obj.get_int_member("ERR-TOTAL")> 0) {
1155 this.win.statusbar_errors.setNotices( obj.get_object_member("ERR") , (int) obj.get_int_member("ERR-TOTAL"));
1157 this.win.statusbar_errors.setNotices( new Json.Object() , 0);
1160 if (obj.has_member("WARN-TOTAL")) {
1162 this.win.statusbar_warnings.setNotices(obj.get_object_member("WARN"), (int) obj.get_int_member("WARN-TOTAL"));
1164 this.win.statusbar_warnings.setNotices( new Json.Object() , 0);
1167 if (obj.has_member("DEPR-TOTAL")) {
1169 this.win.statusbar_depricated.setNotices( obj.get_object_member("DEPR"), (int) obj.get_int_member("DEPR-TOTAL"));
1172 this.win.statusbar_depricated.setNotices( new Json.Object(),0);
1174 //if (this.state == State.CODE || this.state == State.PROJECTCODEONLY) {
1175 if (this.state == State.CODE) {
1176 buf.highlightErrorsJson("ERR", obj);
1177 buf.highlightErrorsJson("WARN", obj);
1178 buf.highlightErrorsJson("DEPR", obj);
1181 this.win.statusbar_compilestatus_label.el.hide();
1182 this.win.statusbar_run.el.hide();
1184 this.win.statusbar_compilestatus_label.el.show();
1185 this.win.statusbar_run.el.show();
1187 if (this.file.xtype == "Gtk") {
1188 // not sure how this is working ok? - as highlighting is happening on the vala files at present..
1189 var gbuf = this.window_gladeview.sourceview;
1190 gbuf.highlightErrorsJson("ERR", obj);
1191 gbuf.highlightErrorsJson("WARN", obj);
1192 gbuf.highlightErrorsJson("DEPR", obj);
1195 this.win.statusbar_run.el.show();
1200 if (this.file.xtype == "Gtk") {
1201 // not sure how this is working ok? - as highlighting is happening on the vala files at present..
1202 var gbuf = this.window_rooview.sourceview;
1203 gbuf.highlightErrorsJson("ERR", obj);
1204 gbuf.highlightErrorsJson("WARN", obj);
1205 gbuf.highlightErrorsJson("DEPR", obj);
1209 this.last_compile_result = obj;