1 static RooProjectSettings _RooProjectSettings;
3 public class RooProjectSettings : Object
6 private RooProjectSettings _this;
8 public static RooProjectSettings singleton()
10 if (_RooProjectSettings == null) {
11 _RooProjectSettings= new RooProjectSettings();
13 return _RooProjectSettings;
15 public Xcls_ProjectSettings ProjectSettings;
16 public Xcls_label_global label_global;
17 public Xcls_label_database label_database;
18 public Xcls_path path;
19 public Xcls_base_template base_template;
20 public Xcls_rootURL rootURL;
21 public Xcls_view view;
22 public Xcls_database_DBTYPE database_DBTYPE;
23 public Xcls_database_DBNAME database_DBNAME;
24 public Xcls_database_DBUSERNAME database_DBUSERNAME;
25 public Xcls_database_DBPASSWORD database_DBPASSWORD;
26 public Xcls_database_ERROR database_ERROR;
31 public RooProjectSettings()
34 this.el = new Gtk.Popover( null );
39 var child_0 = new Xcls_ProjectSettings( _this );
43 // user defined functions
44 public class Xcls_ProjectSettings : Object
47 private RooProjectSettings _this;
51 public signal void buttonPressed (string btn);
52 public Project.Project project;
55 public Xcls_ProjectSettings(RooProjectSettings _owner )
58 _this.ProjectSettings = this;
59 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
64 this.el.homogeneous = false;
65 this.el.border_width = 5;
66 var child_0 = new Xcls_Box3( _this );
68 this.el.pack_start ( child_0.el , false,false,0 );
69 var child_1 = new Xcls_Notebook6( _this );
71 this.el.pack_end ( child_1.el , true,true,0 );
74 // user defined functions
75 public void show (Project.Project project) {
76 _this.project = project;
77 _this.path.el.label = project.firstPath();
78 // get the active project.
79 var lm = Gtk.SourceLanguageManager.get_default();
81 ((Gtk.SourceBuffer)(_this.view.el.get_buffer())) .set_language(
83 lm.get_language("html"));
86 //project.runhtml = project.runhtml || '';
87 _this.view.el.get_buffer().set_text(project.runhtml);
90 _this.rootURL.el.set_text( _this.project.rootURL );
91 _this.base_template.el.set_text(_this.project.base_template);
92 var js = _this.project;
93 _this.database_DBTYPE.el.set_text( js.get_string_member("DBTYPE") );
94 _this.database_DBNAME.el.set_text( js.get_string_member("DBNAME") );
95 _this.database_DBUSERNAME.el.set_text( js.get_string_member("DBUSERNAME") );
96 _this.database_DBPASSWORD.el.set_text( js.get_string_member("DBPASSWORD") );
101 var buf = _this.view.el.get_buffer();
104 buf.get_start_iter(out s);
105 buf.get_end_iter(out e);
106 _this.project.runhtml = buf.get_text(s,e,true);
108 _this.project.rootURL = _this.rootURL.el.get_text();
109 _this.project.base_template = _this.base_template.el.get_text();
111 var js = _this.project.json_project_data;
112 js.set_string_member("DBTYPE", _this.database_DBTYPE.el.get_text());
113 js.set_string_member("DBNAME", _this.database_DBNAME.el.get_text());
114 js.set_string_member("DBUSERNAME", _this.database_DBUSERNAME.el.get_text());
115 js.set_string_member("DBPASSWORD", _this.database_DBPASSWORD.el.get_text());
116 // _this.project.set_string_member("DBHOST", _this.DBTYPE.el.get_text());
118 // need to re-init the database
120 _this.project.initRooDatabase();
125 public class Xcls_Box3 : Object
128 private RooProjectSettings _this;
134 public Xcls_Box3(RooProjectSettings _owner )
137 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
141 // set gobject values
142 this.el.homogeneous = true;
143 this.el.expand = false;
144 this.el.vexpand = false;
145 var child_0 = new Xcls_Button4( _this );
147 this.el.add ( child_0.el );
148 var child_1 = new Xcls_Button5( _this );
150 this.el.add ( child_1.el );
153 // user defined functions
155 public class Xcls_Button4 : Object
157 public Gtk.Button el;
158 private RooProjectSettings _this;
164 public Xcls_Button4(RooProjectSettings _owner )
167 this.el = new Gtk.Button();
171 // set gobject values
172 this.el.label = "Apply";
175 this.el.button_press_event.connect( () => {
178 _this.buttonPressed("apply");
183 // user defined functions
186 public class Xcls_Button5 : Object
188 public Gtk.Button el;
189 private RooProjectSettings _this;
195 public Xcls_Button5(RooProjectSettings _owner )
198 this.el = new Gtk.Button();
202 // set gobject values
203 this.el.label = "Save";
206 this.el.button_press_event.connect( () => {
209 _this.buttonPressed("save");
214 // user defined functions
218 public class Xcls_Notebook6 : Object
220 public Gtk.Notebook el;
221 private RooProjectSettings _this;
227 public Xcls_Notebook6(RooProjectSettings _owner )
230 this.el = new Gtk.Notebook();
234 // set gobject values
235 var child_0 = new Xcls_label_global( _this );
237 var child_1 = new Xcls_label_database( _this );
239 var child_2 = new Xcls_Box9( _this );
241 this.el.append_page ( child_2.el , _this.label_global.el );
242 var child_3 = new Xcls_Box20( _this );
244 this.el.append_page ( child_3.el , _this.label_database.el );
247 // user defined functions
249 public class Xcls_label_global : Object
252 private RooProjectSettings _this;
258 public Xcls_label_global(RooProjectSettings _owner )
261 _this.label_global = this;
262 this.el = new Gtk.Label( "Global" );
266 // set gobject values
269 // user defined functions
272 public class Xcls_label_database : Object
275 private RooProjectSettings _this;
281 public Xcls_label_database(RooProjectSettings _owner )
284 _this.label_database = this;
285 this.el = new Gtk.Label( "Database" );
289 // set gobject values
292 // user defined functions
295 public class Xcls_Box9 : Object
298 private RooProjectSettings _this;
304 public Xcls_Box9(RooProjectSettings _owner )
307 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
311 // set gobject values
312 this.el.homogeneous = false;
313 var child_0 = new Xcls_path( _this );
315 this.el.pack_start ( child_0.el , false,false,0 );
316 var child_1 = new Xcls_Box11( _this );
318 this.el.pack_start ( child_1.el , false,false,0 );
319 var child_2 = new Xcls_Box14( _this );
321 this.el.pack_start ( child_2.el , false,false,0 );
322 var child_3 = new Xcls_Label17( _this );
324 this.el.pack_start ( child_3.el , false,false,0 );
325 var child_4 = new Xcls_ScrolledWindow18( _this );
327 this.el.pack_start ( child_4.el , true,true,0 );
330 // user defined functions
332 public class Xcls_path : Object
335 private RooProjectSettings _this;
341 public Xcls_path(RooProjectSettings _owner )
345 this.el = new Gtk.Label( "filename" );
349 // set gobject values
354 // user defined functions
357 public class Xcls_Box11 : Object
360 private RooProjectSettings _this;
366 public Xcls_Box11(RooProjectSettings _owner )
369 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
373 // set gobject values
374 this.el.homogeneous = false;
375 this.el.expand = false;
376 var child_0 = new Xcls_Label12( _this );
378 this.el.pack_start ( child_0.el , false,false,0 );
379 var child_1 = new Xcls_base_template( _this );
381 this.el.add ( child_1.el );
384 // user defined functions
386 public class Xcls_Label12 : Object
389 private RooProjectSettings _this;
395 public Xcls_Label12(RooProjectSettings _owner )
398 this.el = new Gtk.Label( "HTML template file" );
402 // set gobject values
406 // user defined functions
409 public class Xcls_base_template : Object
412 private RooProjectSettings _this;
418 public Xcls_base_template(RooProjectSettings _owner )
421 _this.base_template = this;
422 this.el = new Gtk.Entry();
426 // set gobject values
429 // user defined functions
433 public class Xcls_Box14 : Object
436 private RooProjectSettings _this;
442 public Xcls_Box14(RooProjectSettings _owner )
445 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
449 // set gobject values
450 this.el.homogeneous = false;
451 this.el.expand = false;
452 var child_0 = new Xcls_Label15( _this );
454 this.el.pack_start ( child_0.el , false,false,0 );
455 var child_1 = new Xcls_rootURL( _this );
457 this.el.add ( child_1.el );
460 // user defined functions
462 public class Xcls_Label15 : Object
465 private RooProjectSettings _this;
471 public Xcls_Label15(RooProjectSettings _owner )
474 this.el = new Gtk.Label( "root URL" );
478 // set gobject values
482 // user defined functions
485 public class Xcls_rootURL : Object
488 private RooProjectSettings _this;
494 public Xcls_rootURL(RooProjectSettings _owner )
497 _this.rootURL = this;
498 this.el = new Gtk.Entry();
502 // set gobject values
505 // user defined functions
509 public class Xcls_Label17 : Object
512 private RooProjectSettings _this;
518 public Xcls_Label17(RooProjectSettings _owner )
521 this.el = new Gtk.Label( "HTML To insert at end of <HEAD>" );
525 // set gobject values
528 // user defined functions
531 public class Xcls_ScrolledWindow18 : Object
533 public Gtk.ScrolledWindow el;
534 private RooProjectSettings _this;
540 public Xcls_ScrolledWindow18(RooProjectSettings _owner )
543 this.el = new Gtk.ScrolledWindow( null, null );
547 // set gobject values
548 var child_0 = new Xcls_view( _this );
550 this.el.add ( child_0.el );
553 // user defined functions
555 public class Xcls_view : Object
557 public Gtk.SourceView el;
558 private RooProjectSettings _this;
564 public Xcls_view(RooProjectSettings _owner )
568 this.el = new Gtk.SourceView();
574 var description = Pango.FontDescription.from_string("monospace");
575 description.set_size(9000);
576 this.el.override_font(description);
579 this.el.key_release_event.connect( ( event) =>{
580 if (event.keyval != 115) {
584 if ( (event.state & Gdk.ModifierType.CONTROL_MASK ) < 1 ) {
587 var buf = this.el.get_buffer();
590 buf.get_start_iter(out s);
591 buf.get_end_iter(out e);
592 _this.project.runhtml = buf.get_text(s,e,true);
595 _this.buttonPressed("save");
602 // user defined functions
607 public class Xcls_Box20 : Object
610 private RooProjectSettings _this;
616 public Xcls_Box20(RooProjectSettings _owner )
619 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
623 // set gobject values
624 this.el.homogeneous = false;
625 var child_0 = new Xcls_Label21( _this );
627 this.el.pack_start ( child_0.el , false,false,0 );
628 var child_1 = new Xcls_database_DBTYPE( _this );
630 this.el.pack_start ( child_1.el , false,false,0 );
631 var child_2 = new Xcls_Label23( _this );
633 this.el.pack_start ( child_2.el , false,false,0 );
634 var child_3 = new Xcls_database_DBNAME( _this );
636 this.el.pack_start ( child_3.el , false,false,0 );
637 var child_4 = new Xcls_Label25( _this );
639 this.el.pack_start ( child_4.el , false,false,0 );
640 var child_5 = new Xcls_database_DBUSERNAME( _this );
642 this.el.pack_start ( child_5.el , false,false,0 );
643 var child_6 = new Xcls_Label27( _this );
645 this.el.pack_start ( child_6.el , false,false,0 );
646 var child_7 = new Xcls_database_DBPASSWORD( _this );
648 this.el.pack_start ( child_7.el , false,false,0 );
649 var child_8 = new Xcls_Button29( _this );
651 this.el.pack_start ( child_8.el , false,false,0 );
652 var child_9 = new Xcls_database_ERROR( _this );
654 this.el.pack_start ( child_9.el , false,false,0 );
657 // user defined functions
659 public class Xcls_Label21 : Object
662 private RooProjectSettings _this;
668 public Xcls_Label21(RooProjectSettings _owner )
671 this.el = new Gtk.Label( "Type (eg. MySQL or PostgreSQL)" );
675 // set gobject values
679 // user defined functions
682 public class Xcls_database_DBTYPE : Object
685 private RooProjectSettings _this;
691 public Xcls_database_DBTYPE(RooProjectSettings _owner )
694 _this.database_DBTYPE = this;
695 this.el = new Gtk.Entry();
699 // set gobject values
702 this.el.key_press_event.connect( (ev) => {
704 if (ev.keyval == Gdk.Key.Tab) {
705 _this.database_DBNAME.el.grab_focus();
714 // user defined functions
717 public class Xcls_Label23 : Object
720 private RooProjectSettings _this;
726 public Xcls_Label23(RooProjectSettings _owner )
729 this.el = new Gtk.Label( "Name" );
733 // set gobject values
737 // user defined functions
740 public class Xcls_database_DBNAME : Object
743 private RooProjectSettings _this;
749 public Xcls_database_DBNAME(RooProjectSettings _owner )
752 _this.database_DBNAME = this;
753 this.el = new Gtk.Entry();
757 // set gobject values
760 this.el.key_press_event.connect( (ev) => {
762 if (ev.keyval == Gdk.Key.Tab) {
763 _this.database_DBUSERNAME.el.grab_focus();
772 // user defined functions
775 public class Xcls_Label25 : Object
778 private RooProjectSettings _this;
784 public Xcls_Label25(RooProjectSettings _owner )
787 this.el = new Gtk.Label( "Username" );
791 // set gobject values
795 // user defined functions
798 public class Xcls_database_DBUSERNAME : Object
801 private RooProjectSettings _this;
807 public Xcls_database_DBUSERNAME(RooProjectSettings _owner )
810 _this.database_DBUSERNAME = this;
811 this.el = new Gtk.Entry();
815 // set gobject values
818 this.el.key_press_event.connect( (ev) => {
820 if (ev.keyval == Gdk.Key.Tab) {
821 _this.database_DBPASSWORD.el.grab_focus();
830 // user defined functions
833 public class Xcls_Label27 : Object
836 private RooProjectSettings _this;
842 public Xcls_Label27(RooProjectSettings _owner )
845 this.el = new Gtk.Label( "Password" );
849 // set gobject values
853 // user defined functions
856 public class Xcls_database_DBPASSWORD : Object
859 private RooProjectSettings _this;
865 public Xcls_database_DBPASSWORD(RooProjectSettings _owner )
868 _this.database_DBPASSWORD = this;
869 this.el = new Gtk.Entry();
873 // set gobject values
876 // user defined functions
879 public class Xcls_Button29 : Object
881 public Gtk.Button el;
882 private RooProjectSettings _this;
888 public Xcls_Button29(RooProjectSettings _owner )
891 this.el = new Gtk.Button();
895 // set gobject values
896 this.el.label = "Check Connection";
899 this.el.clicked.connect( () => {
902 _this.database_ERROR.el.label = "";
905 // assumes localhost...
906 cnc = Gda.Connection.open_from_string (
907 _this.database_DBTYPE.el.get_text(),
908 "DB_NAME=" + _this.database_DBNAME.el.get_text(),
909 "USERNAME=" + _this.database_DBUSERNAME.el.get_text() +
910 ";PASSWORD=" + _this.database_DBPASSWORD.el.get_text(),
911 Gda.ConnectionOptions.NONE
913 //} catch (Gda.ConnectionError ce) {
914 // _this.database_ERROR.el.label = ce.message;
915 } catch(Gda.ConnectionError ue) {
916 _this.database_ERROR.el.label = ue.message;
918 } catch(Gda.ConfigError ue) {
919 _this.database_ERROR.el.label = ue.message;
922 _this.database_ERROR.el.label = "Connection Succeeded";
927 // user defined functions
930 public class Xcls_database_ERROR : Object
933 private RooProjectSettings _this;
939 public Xcls_database_ERROR(RooProjectSettings _owner )
942 _this.database_ERROR = this;
943 this.el = new Gtk.Label( " " );
947 // set gobject values
952 // user defined functions