1 static Xcls_RooProjectSettings _RooProjectSettings;
3 public class Xcls_RooProjectSettings : Object
6 private Xcls_RooProjectSettings _this;
8 public static Xcls_RooProjectSettings singleton()
10 if (_RooProjectSettings == null) {
11 _RooProjectSettings= new Xcls_RooProjectSettings();
13 return _RooProjectSettings;
15 public Xcls_label_global label_global;
16 public Xcls_label_database label_database;
17 public Xcls_path path;
18 public Xcls_base_template base_template;
19 public Xcls_base_template_cellrenderer base_template_cellrenderer;
20 public Xcls_base_template_model base_template_model;
21 public Xcls_rootURL rootURL;
22 public Xcls_view view;
23 public Xcls_database_DBTYPE database_DBTYPE;
24 public Xcls_database_DBNAME database_DBNAME;
25 public Xcls_database_DBUSERNAME database_DBUSERNAME;
26 public Xcls_database_DBPASSWORD database_DBPASSWORD;
27 public Xcls_database_ERROR database_ERROR;
30 public signal void buttonPressed (string btn);
31 public Project.Project project;
34 public Xcls_RooProjectSettings()
37 this.el = new Gtk.Popover( null );
42 this.el.border_width = 0;
44 this.el.position = Gtk.PositionType.RIGHT;
45 var child_0 = new Xcls_Box2( _this );
47 this.el.add ( child_0.el );
50 // user defined functions
51 public void show (Gtk.Widget btn, Project.Project project) {
52 _this.project = project;
53 _this.path.el.label = project.firstPath();
54 // get the active project.
55 var lm = Gtk.SourceLanguageManager.get_default();
57 ((Gtk.SourceBuffer)(_this.view.el.get_buffer())) .set_language(
59 lm.get_language("html"));
62 //project.runhtml = project.runhtml || '';
63 _this.view.el.get_buffer().set_text(project.runhtml);
66 _this.rootURL.el.set_text( _this.project.rootURL );
67 _this.base_template.el.set_text(_this.project.base_template);
68 var js = _this.project;
69 _this.database_DBTYPE.el.set_text( js.get_string_member("DBTYPE") );
70 _this.database_DBNAME.el.set_text( js.get_string_member("DBNAME") );
71 _this.database_DBUSERNAME.el.set_text( js.get_string_member("DBUSERNAME") );
72 _this.database_DBPASSWORD.el.set_text( js.get_string_member("DBPASSWORD") );
74 //console.log('show all');
75 this.el.set_modal(true);
76 this.el.set_relative_to(btn);
78 this.el.set_position(Gtk.PositionType.RIGHT);
81 print("SHOWALL - POPIP\n");
83 this.el.set_size_request(800,500);
84 this.view.el.grab_focus();
90 var buf = _this.view.el.get_buffer();
93 buf.get_start_iter(out s);
94 buf.get_end_iter(out e);
95 _this.project.runhtml = buf.get_text(s,e,true);
97 _this.project.rootURL = _this.rootURL.el.get_text();
98 _this.project.base_template = _this.base_template.el.get_text();
100 var js = _this.project.json_project_data;
101 js.set_string_member("DBTYPE", _this.database_DBTYPE.el.get_text());
102 js.set_string_member("DBNAME", _this.database_DBNAME.el.get_text());
103 js.set_string_member("DBUSERNAME", _this.database_DBUSERNAME.el.get_text());
104 js.set_string_member("DBPASSWORD", _this.database_DBPASSWORD.el.get_text());
105 // _this.project.set_string_member("DBHOST", _this.DBTYPE.el.get_text());
107 // need to re-init the database
109 _this.project.initRooDatabase();
113 public class Xcls_Box2 : Object
116 private Xcls_RooProjectSettings _this;
122 public Xcls_Box2(Xcls_RooProjectSettings _owner )
125 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
129 // set gobject values
130 this.el.homogeneous = false;
131 this.el.border_width = 5;
132 var child_0 = new Xcls_Notebook3( _this );
134 this.el.pack_start ( child_0.el , true,true,0 );
135 var child_1 = new Xcls_Box30( _this );
137 this.el.pack_end ( child_1.el , false,false,0 );
140 // user defined functions
142 public class Xcls_Notebook3 : Object
144 public Gtk.Notebook el;
145 private Xcls_RooProjectSettings _this;
151 public Xcls_Notebook3(Xcls_RooProjectSettings _owner )
154 this.el = new Gtk.Notebook();
158 // set gobject values
159 var child_0 = new Xcls_label_global( _this );
161 var child_1 = new Xcls_label_database( _this );
163 var child_2 = new Xcls_Box6( _this );
165 this.el.append_page ( child_2.el , _this.label_global.el );
166 var child_3 = new Xcls_Box19( _this );
168 this.el.append_page ( child_3.el , _this.label_database.el );
171 // user defined functions
173 public class Xcls_label_global : Object
176 private Xcls_RooProjectSettings _this;
182 public Xcls_label_global(Xcls_RooProjectSettings _owner )
185 _this.label_global = this;
186 this.el = new Gtk.Label( "Global" );
190 // set gobject values
193 // user defined functions
196 public class Xcls_label_database : Object
199 private Xcls_RooProjectSettings _this;
205 public Xcls_label_database(Xcls_RooProjectSettings _owner )
208 _this.label_database = this;
209 this.el = new Gtk.Label( "Database" );
213 // set gobject values
216 // user defined functions
219 public class Xcls_Box6 : Object
222 private Xcls_RooProjectSettings _this;
228 public Xcls_Box6(Xcls_RooProjectSettings _owner )
231 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
235 // set gobject values
236 this.el.homogeneous = false;
237 var child_0 = new Xcls_path( _this );
239 this.el.pack_start ( child_0.el , false,false,0 );
240 var child_1 = new Xcls_Box8( _this );
242 this.el.pack_start ( child_1.el , false,false,0 );
243 var child_2 = new Xcls_Box13( _this );
245 this.el.pack_start ( child_2.el , false,false,0 );
246 var child_3 = new Xcls_Label16( _this );
248 this.el.pack_start ( child_3.el , false,false,0 );
249 var child_4 = new Xcls_ScrolledWindow17( _this );
251 this.el.pack_start ( child_4.el , true,true,0 );
254 // user defined functions
256 public class Xcls_path : Object
259 private Xcls_RooProjectSettings _this;
265 public Xcls_path(Xcls_RooProjectSettings _owner )
269 this.el = new Gtk.Label( "filename" );
273 // set gobject values
278 // user defined functions
281 public class Xcls_Box8 : Object
284 private Xcls_RooProjectSettings _this;
290 public Xcls_Box8(Xcls_RooProjectSettings _owner )
293 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
297 // set gobject values
298 this.el.homogeneous = false;
299 this.el.expand = false;
300 var child_0 = new Xcls_Label9( _this );
302 this.el.pack_start ( child_0.el , false,false,0 );
303 var child_1 = new Xcls_base_template( _this );
305 this.el.attach ( child_1.el , 1,0,1,1 );
308 // user defined functions
310 public class Xcls_Label9 : Object
313 private Xcls_RooProjectSettings _this;
319 public Xcls_Label9(Xcls_RooProjectSettings _owner )
322 this.el = new Gtk.Label( "HTML template file" );
326 // set gobject values
330 // user defined functions
333 public class Xcls_base_template : Object
335 public Gtk.ComboBox el;
336 private Xcls_RooProjectSettings _this;
342 public Xcls_base_template(Xcls_RooProjectSettings _owner )
345 _this.base_template = this;
346 this.el = new Gtk.ComboBox();
350 // set gobject values
351 var child_0 = new Xcls_base_template_cellrenderer( _this );
353 this.el.pack_start ( child_0.el , true );
354 var child_1 = new Xcls_base_template_model( _this );
356 this.el.set_model ( child_1.el );
360 this.el.add_attribute(_this.base_template_cellrenderer.el , "markup", 1 );
363 this.el.changed.connect( () => {
366 if (this.el.get_active_iter(out iter)) {
368 _this.base_template_model.el.get_value (iter, 0, out vfname);
373 // directory is only available for non-bjs
380 // user defined functions
382 public class Xcls_base_template_cellrenderer : Object
384 public Gtk.CellRendererText el;
385 private Xcls_RooProjectSettings _this;
391 public Xcls_base_template_cellrenderer(Xcls_RooProjectSettings _owner )
394 _this.base_template_cellrenderer = this;
395 this.el = new Gtk.CellRendererText();
399 // set gobject values
402 // user defined functions
405 public class Xcls_base_template_model : Object
407 public Gtk.ListStore el;
408 private Xcls_RooProjectSettings _this;
414 public Xcls_base_template_model(Xcls_RooProjectSettings _owner )
417 _this.base_template_model = this;
418 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
422 // set gobject values
425 // user defined functions
426 public void loadData (string cur) {
431 /// el.append(out iter);
434 // el.set_value(iter, 0, "");
435 // el.set_value(iter, 1, "aaa - Just add Element - aaa");
440 el.set_value(iter, 0, "bjs");
441 el.set_value(iter, 1, "User Interface File (bjs)");
442 _this.filetype.el.set_active_iter(iter);
446 el.set_value(iter, 0, "vala");
447 el.set_value(iter, 1, "Vala");
449 _this.filetype.el.set_active_iter(iter);
456 el.set_value(iter, 0, "js");
457 el.set_value(iter, 1, "Javascript");
460 _this.filetype.el.set_active_iter(iter);
465 el.set_value(iter, 0, "css");
466 el.set_value(iter, 1, "CSS");
469 _this.filetype.el.set_active_iter(iter);
477 public class Xcls_Box13 : Object
480 private Xcls_RooProjectSettings _this;
486 public Xcls_Box13(Xcls_RooProjectSettings _owner )
489 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
493 // set gobject values
494 this.el.homogeneous = false;
495 this.el.expand = false;
496 var child_0 = new Xcls_Label14( _this );
498 this.el.pack_start ( child_0.el , false,false,0 );
499 var child_1 = new Xcls_rootURL( _this );
501 this.el.add ( child_1.el );
504 // user defined functions
506 public class Xcls_Label14 : Object
509 private Xcls_RooProjectSettings _this;
515 public Xcls_Label14(Xcls_RooProjectSettings _owner )
518 this.el = new Gtk.Label( "root URL" );
522 // set gobject values
526 // user defined functions
529 public class Xcls_rootURL : Object
532 private Xcls_RooProjectSettings _this;
538 public Xcls_rootURL(Xcls_RooProjectSettings _owner )
541 _this.rootURL = this;
542 this.el = new Gtk.Entry();
546 // set gobject values
549 // user defined functions
553 public class Xcls_Label16 : Object
556 private Xcls_RooProjectSettings _this;
562 public Xcls_Label16(Xcls_RooProjectSettings _owner )
565 this.el = new Gtk.Label( "HTML To insert at end of <HEAD>" );
569 // set gobject values
572 // user defined functions
575 public class Xcls_ScrolledWindow17 : Object
577 public Gtk.ScrolledWindow el;
578 private Xcls_RooProjectSettings _this;
584 public Xcls_ScrolledWindow17(Xcls_RooProjectSettings _owner )
587 this.el = new Gtk.ScrolledWindow( null, null );
591 // set gobject values
592 var child_0 = new Xcls_view( _this );
594 this.el.add ( child_0.el );
597 // user defined functions
599 public class Xcls_view : Object
601 public Gtk.SourceView el;
602 private Xcls_RooProjectSettings _this;
608 public Xcls_view(Xcls_RooProjectSettings _owner )
612 this.el = new Gtk.SourceView();
618 var description = Pango.FontDescription.from_string("monospace");
619 description.set_size(9000);
620 this.el.override_font(description);
623 this.el.key_release_event.connect( ( event) =>{
624 if (event.keyval != 115) {
628 if ( (event.state & Gdk.ModifierType.CONTROL_MASK ) < 1 ) {
631 var buf = this.el.get_buffer();
634 buf.get_start_iter(out s);
635 buf.get_end_iter(out e);
636 _this.project.runhtml = buf.get_text(s,e,true);
639 _this.buttonPressed("save");
646 // user defined functions
651 public class Xcls_Box19 : Object
654 private Xcls_RooProjectSettings _this;
660 public Xcls_Box19(Xcls_RooProjectSettings _owner )
663 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
667 // set gobject values
668 this.el.homogeneous = false;
669 var child_0 = new Xcls_Label20( _this );
671 this.el.pack_start ( child_0.el , false,false,0 );
672 var child_1 = new Xcls_database_DBTYPE( _this );
674 this.el.pack_start ( child_1.el , false,false,0 );
675 var child_2 = new Xcls_Label22( _this );
677 this.el.pack_start ( child_2.el , false,false,0 );
678 var child_3 = new Xcls_database_DBNAME( _this );
680 this.el.pack_start ( child_3.el , false,false,0 );
681 var child_4 = new Xcls_Label24( _this );
683 this.el.pack_start ( child_4.el , false,false,0 );
684 var child_5 = new Xcls_database_DBUSERNAME( _this );
686 this.el.pack_start ( child_5.el , false,false,0 );
687 var child_6 = new Xcls_Label26( _this );
689 this.el.pack_start ( child_6.el , false,false,0 );
690 var child_7 = new Xcls_database_DBPASSWORD( _this );
692 this.el.pack_start ( child_7.el , false,false,0 );
693 var child_8 = new Xcls_Button28( _this );
695 this.el.pack_start ( child_8.el , false,false,0 );
696 var child_9 = new Xcls_database_ERROR( _this );
698 this.el.pack_start ( child_9.el , false,false,0 );
701 // user defined functions
703 public class Xcls_Label20 : Object
706 private Xcls_RooProjectSettings _this;
712 public Xcls_Label20(Xcls_RooProjectSettings _owner )
715 this.el = new Gtk.Label( "Type (eg. MySQL or PostgreSQL)" );
719 // set gobject values
723 // user defined functions
726 public class Xcls_database_DBTYPE : Object
729 private Xcls_RooProjectSettings _this;
735 public Xcls_database_DBTYPE(Xcls_RooProjectSettings _owner )
738 _this.database_DBTYPE = this;
739 this.el = new Gtk.Entry();
743 // set gobject values
746 this.el.key_press_event.connect( (ev) => {
748 if (ev.keyval == Gdk.Key.Tab) {
749 _this.database_DBNAME.el.grab_focus();
758 // user defined functions
761 public class Xcls_Label22 : Object
764 private Xcls_RooProjectSettings _this;
770 public Xcls_Label22(Xcls_RooProjectSettings _owner )
773 this.el = new Gtk.Label( "Name" );
777 // set gobject values
781 // user defined functions
784 public class Xcls_database_DBNAME : Object
787 private Xcls_RooProjectSettings _this;
793 public Xcls_database_DBNAME(Xcls_RooProjectSettings _owner )
796 _this.database_DBNAME = this;
797 this.el = new Gtk.Entry();
801 // set gobject values
804 this.el.key_press_event.connect( (ev) => {
806 if (ev.keyval == Gdk.Key.Tab) {
807 _this.database_DBUSERNAME.el.grab_focus();
816 // user defined functions
819 public class Xcls_Label24 : Object
822 private Xcls_RooProjectSettings _this;
828 public Xcls_Label24(Xcls_RooProjectSettings _owner )
831 this.el = new Gtk.Label( "Username" );
835 // set gobject values
839 // user defined functions
842 public class Xcls_database_DBUSERNAME : Object
845 private Xcls_RooProjectSettings _this;
851 public Xcls_database_DBUSERNAME(Xcls_RooProjectSettings _owner )
854 _this.database_DBUSERNAME = this;
855 this.el = new Gtk.Entry();
859 // set gobject values
862 this.el.key_press_event.connect( (ev) => {
864 if (ev.keyval == Gdk.Key.Tab) {
865 _this.database_DBPASSWORD.el.grab_focus();
874 // user defined functions
877 public class Xcls_Label26 : Object
880 private Xcls_RooProjectSettings _this;
886 public Xcls_Label26(Xcls_RooProjectSettings _owner )
889 this.el = new Gtk.Label( "Password" );
893 // set gobject values
897 // user defined functions
900 public class Xcls_database_DBPASSWORD : Object
903 private Xcls_RooProjectSettings _this;
909 public Xcls_database_DBPASSWORD(Xcls_RooProjectSettings _owner )
912 _this.database_DBPASSWORD = this;
913 this.el = new Gtk.Entry();
917 // set gobject values
920 // user defined functions
923 public class Xcls_Button28 : Object
925 public Gtk.Button el;
926 private Xcls_RooProjectSettings _this;
932 public Xcls_Button28(Xcls_RooProjectSettings _owner )
935 this.el = new Gtk.Button();
939 // set gobject values
940 this.el.label = "Check Connection";
943 this.el.clicked.connect( () => {
946 _this.database_ERROR.el.label = "";
949 // assumes localhost...
950 cnc = Gda.Connection.open_from_string (
951 _this.database_DBTYPE.el.get_text(),
952 "DB_NAME=" + _this.database_DBNAME.el.get_text(),
953 "USERNAME=" + _this.database_DBUSERNAME.el.get_text() +
954 ";PASSWORD=" + _this.database_DBPASSWORD.el.get_text(),
955 Gda.ConnectionOptions.NONE
957 //} catch (Gda.ConnectionError ce) {
958 // _this.database_ERROR.el.label = ce.message;
959 } catch(Gda.ConnectionError ue) {
960 _this.database_ERROR.el.label = ue.message;
962 } catch(Gda.ConfigError ue) {
963 _this.database_ERROR.el.label = ue.message;
966 _this.database_ERROR.el.label = "Connection Succeeded";
971 // user defined functions
974 public class Xcls_database_ERROR : Object
977 private Xcls_RooProjectSettings _this;
983 public Xcls_database_ERROR(Xcls_RooProjectSettings _owner )
986 _this.database_ERROR = this;
987 this.el = new Gtk.Label( " " );
991 // set gobject values
996 // user defined functions
1001 public class Xcls_Box30 : Object
1004 private Xcls_RooProjectSettings _this;
1010 public Xcls_Box30(Xcls_RooProjectSettings _owner )
1013 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
1017 // set gobject values
1018 this.el.homogeneous = true;
1019 this.el.expand = false;
1020 this.el.vexpand = false;
1021 var child_0 = new Xcls_Button31( _this );
1023 this.el.add ( child_0.el );
1024 var child_1 = new Xcls_Button32( _this );
1026 this.el.add ( child_1.el );
1029 // user defined functions
1031 public class Xcls_Button31 : Object
1033 public Gtk.Button el;
1034 private Xcls_RooProjectSettings _this;
1040 public Xcls_Button31(Xcls_RooProjectSettings _owner )
1043 this.el = new Gtk.Button();
1047 // set gobject values
1048 this.el.label = "Apply";
1051 this.el.button_press_event.connect( () => {
1054 _this.buttonPressed("apply");
1059 // user defined functions
1062 public class Xcls_Button32 : Object
1064 public Gtk.Button el;
1065 private Xcls_RooProjectSettings _this;
1071 public Xcls_Button32(Xcls_RooProjectSettings _owner )
1074 this.el = new Gtk.Button();
1078 // set gobject values
1079 this.el.label = "Save";
1082 this.el.button_press_event.connect( () => {
1085 _this.buttonPressed("save");
1090 // user defined functions