1 static Xcls_LeftProps _LeftProps;
3 public class Xcls_LeftProps : Object
6 private Xcls_LeftProps _this;
8 public static Xcls_LeftProps singleton()
10 if (_LeftProps == null) {
11 _LeftProps= new Xcls_LeftProps();
15 public Xcls_AddPropertyPopup AddPropertyPopup;
16 public Xcls_EditProps EditProps;
17 public Xcls_view view;
18 public Xcls_model model;
19 public Xcls_keycol keycol;
20 public Xcls_keyrender keyrender;
21 public Xcls_valcol valcol;
22 public Xcls_valrender valrender;
23 public Xcls_valrendermodel valrendermodel;
24 public Xcls_ContextMenu ContextMenu;
27 public bool allow_edit;
28 public JsRender.JsRender file;
29 public signal bool stop_editor ();
30 public signal void show_editor (JsRender.JsRender file, JsRender.Node node, string type, string key);
31 public signal void changed ();
32 public signal void show_add_props (string type);
33 public Xcls_MainWindow main_window;
34 public JsRender.Node node;
37 public Xcls_LeftProps()
40 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
43 this.allow_edit = false;
44 this.main_window = null;
47 this.el.homogeneous = false ;
48 var child_0 = new Xcls_Box2( _this );
50 this.el.pack_start ( child_0.el , false,true,0 );
51 var child_1 = new Xcls_EditProps( _this );
53 this.el.pack_end ( child_1.el , true,true,0 );
56 // user defined functions
57 public void updateKey (string oldkey, string type, string key ) {
61 _this.model.el.foreach((mod, path, iter) => {
66 GLib.Value gvaltype, gval,kvalue;
67 mod.get_value(iter, 1 , out gval); // one is key..
69 mod.get_value(iter,0, out gvaltype);
71 mod.get_value(iter,3, out kvalue);
73 if (oldkey == ((string)gval) && type == ((string)gvaltype)) {
75 //print("update iter type=%s, key=%s value=%s\n", type, key,(string) kvalue);
77 this.updateIter(iter, type, key, (string)kvalue);
89 public void before_edit ()
92 GLib.debug("before edit - stop editing\n");
94 // these do not appear to trigger save...
95 _this.keyrender.el.stop_editing(false);
96 _this.keyrender.el.editable =false;
98 _this.valrender.el.stop_editing(false);
99 _this.valrender.el.editable =false;
102 // technicall stop the popup editor..
105 public string keySortFormat (string key) {
106 // listeners first - with 0
113 var bits = key.split(" ");
116 return "2 " + bits[bits.length -1];
120 return "3 " + bits[bits.length -1];
125 return "4 " + bits[bits.length -1];
128 return "5 " + bits[bits.length -1];
133 public void finish_editing () {
137 public bool startEditingValue ( Gtk.TreePath path) {
139 // ONLY return true if editing is allowed - eg. combo..
141 GLib.debug("start editing?\n");
142 if (!this.stop_editor()) {
143 GLib.debug("stop editor failed\n");
149 var mod = this.model.el;
150 mod.get_iter (out iter, path);
156 2, "<b>" + miter.get_key() + "</b>",
162 mod.get_value(iter, 3 , out gval);
163 var val = (string)gval;
165 mod.get_value(iter, 1 , out gval);
166 var key = (string)gval;
169 string kname, kflag, ktype;
170 this.node.normalize_key(key, out kname, out kflag, out ktype);
173 mod.get_value(iter, 0 , out gval);
174 var type = (string)gval; // listerner or prop..
178 var use_textarea = false;
180 //------------ things that require the text editor...
182 if (type == "listener") {
185 if (key.length > 0 && key[0] == '|') { // user defined method
188 if (key.length > 0 && key[0] == '$') { // raw string
191 if (key.length > 0 && key == "* init") {
194 if (val.length > 40) { // long value...
201 GLib.debug("Call show editor\n");
202 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
203 this.view.el.get_selection().select_path(path);
205 this.show_editor(file, node, type, key);
214 var pal = this.file.project.palete;
217 var has_opts = pal.typeOptions(this.node.fqn(), kname, ktype, out opts);
221 // others... - fill in options for true/false?
222 GLib.debug("turn on editing %s \n" , mod.get_path(iter).to_string());
224 GLib.debug (ktype.up());
226 GLib.debug("start editing try/false)???");
227 this.valrender.el.has_entry = false;
229 this.valrender.setOptions(opts);
231 this.valrender.el.has_entry = false;
232 this.valrender.el.editable = true;
233 this.allow_edit = true;
234 GLib.Timeout.add_full(GLib.Priority.DEFAULT,100 , () => {
235 this.view.el.set_cursor_on_cell(
246 // see if type is a Enum.
253 this.valrender.setOptions(opts);
255 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
257 // at this point - work out the type...
258 // if its' a combo... then show the options..
259 this.valrender.el.has_entry = true;
261 this.valrender.el.editable = true;
264 this.allow_edit = true;
270 this.view.el.set_cursor_on_cell(
280 public void load (JsRender.JsRender file, JsRender.Node? node)
282 GLib.debug("load leftprops\n");
288 this.model.el.clear();
290 //this.get('/RightEditor').el.hide();
297 //var provider = this.get('/LeftTree').getPaleteProvider();
300 //typeof(string), // 0 key type
301 //typeof(string), // 1 key
302 //typeof(string), // 2 key (display)
303 //typeof(string), // 3 value
304 //typeof(string), // 4 value (display)
305 //typeof(string), // 5 both (tooltip)
309 // really need a way to sort the hashmap...
310 var m = this.model.el;
312 var miter = node.listeners.map_iterator();
315 while(miter.next()) {
317 m.append(out iter,null);
319 this.updateIter(iter, "listener", miter.get_key(), miter.get_value());
325 miter = node.props.map_iterator();
328 while(miter.next()) {
330 m.append(out iter,null);
331 this.updateIter(iter, "prop", miter.get_key(), miter.get_value());
334 GLib.debug("clear selection\n");
336 this.model.el.set_sort_column_id(6,Gtk.SortType.ASCENDING); // sort by real key..
338 this.view.el.get_selection().unselect_all();
343 make outerpane = {current width of left pane} + width of props
344 make innerpane = {current width of left pane}
350 var outerpane = _this.main_window.leftpane.el;
351 var pane = _this.main_window.editpane.el;
355 var try_size = (i * 25) + 60; // est. 20px per line + 40px header
356 GLib.Timeout.add_seconds(1, () => {
359 ((try_size * 1.0f) / (pane.max_position * 1.0f)) > 0.8f ?
360 (int) (pane.max_position * 0.2f) :
361 pane.max_position-try_size);
362 return GLib.Source.REMOVE;
367 public string keyFormat (string val, string type) {
369 // Glib.markup_escape_text(val);
371 if (type == "listener") {
372 return "<span font_weight=\"bold\" color=\"#660000\">" +
373 GLib.Markup.escape_text(val) +
377 if (val.length < 1) {
378 return "<span color=\"#FF0000\">--empty--</span>";
383 //# - object properties
385 // all of these... - display value is last element..
386 var ar = val.strip().split(" ");
389 var dval = GLib.Markup.escape_text(ar[ar.length-1]);
395 case '@': // signal // just bold balck?
396 if (dval[0] == '@') {
397 dval = dval.substring(1);
400 return @"<span font_weight=\"bold\">@ $dval</span>";
401 case '#': // object properties?
402 if (dval[0] == '#') {
403 dval = dval.substring(1);
405 return @"<span font_weight=\"bold\">$dval</span>";
407 if (dval[0] == '*') {
408 dval = dval.substring(1);
410 return @"<span color=\"#0000CC\" font_weight=\"bold\">$dval</span>";
412 if (dval[0] == '$') {
413 dval = dval.substring(1);
415 return @"<span style=\"italic\">$dval</span>";
416 case '|': // user defined methods
417 if (dval[0] == '|') {
418 dval = dval.substring(1);
420 return @"<span color=\"#008000\" font_weight=\"bold\">$dval</span>";
431 public void deleteSelected () {
436 var s = this.view.el.get_selection();
437 s.get_selected(out mod, out iter);
441 mod.get_value(iter, 0 , out gval);
442 var type = (string)gval;
444 mod.get_value(iter, 1 , out gval);
445 var key = (string)gval;
449 this.node.listeners.unset(key);
453 this.node.props.unset(key);
456 this.load(this.file, this.node);
460 public void startEditingKey ( Gtk.TreePath path) {
462 if (!this.stop_editor()) {
466 // others... - fill in options for true/false?
469 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
470 this.allow_edit = true;
471 this.keyrender.el.editable = true;
473 this.view.el.set_cursor_on_cell(
485 public void addProp (string in_type, string key, string value, string value_type) {
486 // info includes key, val, skel, etype..
487 //console.dump(info);
488 //type = info.type.toLowerCase();
489 //var data = this.toJS();
491 var type = in_type == "signals" ? "listener" : in_type;
493 var fkey = (value_type.length > 0 ? value_type + " " : "") + key;
495 if (type == "listener") {
496 if (this.node.listeners.has_key(key)) {
499 this.node.listeners.set(key,value);
501 assert(this.node != null);
502 assert(this.node.props != null);
503 if (this.node.props.has_key(fkey)) {
506 this.node.props.set(fkey,value);
511 this.load(this.file, this.node);
515 /// need to find the row which I've just added..
518 var s = this.view.el.get_selection();
521 GLib.debug("trying to find new iter");
523 this.model.el.foreach((model, path, iter) => {
526 this.model.el.get_value(iter, 0 , out gval);
527 if ((string)gval != type) {
528 GLib.debug("not type: %s = %s\n", (string)gval , type);
531 this.model.el.get_value(iter, 1 , out gval);
532 if ((string)gval != fkey) {
533 GLib.debug("not key: %s = %s\n", (string)gval , fkey);
537 GLib.Timeout.add_full(GLib.Priority.DEFAULT,40 , () => {
539 this.startEditingValue(this.model.el.get_path(iter));
542 //s.select_iter(iter);
550 public void updateIter (Gtk.TreeIter iter, string type, string key, string kvalue) {
552 //print("update Iter %s, %s\n", key,kvalue);
553 //typeof(string), // 0 key type
554 //typeof(string), // 1 key
555 //typeof(string), // 2 key (display)
556 //typeof(string), // 3 value
557 //typeof(string), // 4 value (display)
558 //typeof(string), // 5 both (tooltip)
559 //typeof(string), // 6 key (sort)
561 var dl = kvalue.strip().split("\n");
563 var dis_val = dl.length > 1 ? (dl[0].strip()+ "...") : dl[0];
565 if (type == "listener") {
569 this.model.el.set(iter,
572 2, this.keyFormat(key ,type),
575 5, "<tt>" + GLib.Markup.escape_text(key + " " +kvalue) + "</tt>",
583 this.model.el.set(iter,
586 2, this.keyFormat(key , "prop"),
589 5, "<tt>" + GLib.Markup.escape_text(key + " " + kvalue) + "</tt>",
590 6, this.keySortFormat(key)
593 public class Xcls_Box2 : Object
596 private Xcls_LeftProps _this;
602 public Xcls_Box2(Xcls_LeftProps _owner )
605 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
609 // set gobject values
610 var child_0 = new Xcls_Label3( _this );
612 this.el.add ( child_0.el );
613 var child_1 = new Xcls_Button4( _this );
615 this.el.add ( child_1.el );
616 var child_2 = new Xcls_Button24( _this );
618 this.el.add ( child_2.el );
619 var child_3 = new Xcls_Button26( _this );
621 this.el.add ( child_3.el );
624 // user defined functions
626 public class Xcls_Label3 : Object
629 private Xcls_LeftProps _this;
635 public Xcls_Label3(Xcls_LeftProps _owner )
638 this.el = new Gtk.Label( "Add:" );
642 // set gobject values
643 this.el.margin_right = 5;
644 this.el.margin_left = 5;
647 // user defined functions
650 public class Xcls_Button4 : Object
652 public Gtk.Button el;
653 private Xcls_LeftProps _this;
659 public Xcls_Button4(Xcls_LeftProps _owner )
662 this.el = new Gtk.Button();
666 // set gobject values
667 this.el.hexpand = true;
668 this.el.label = "Other";
669 var child_0 = new Xcls_AddPropertyPopup( _this );
671 var child_1 = new Xcls_Image23( _this );
673 this.el.set_image ( child_1.el );
676 this.el.button_press_event.connect( (self, ev) => {
680 var p = _this.AddPropertyPopup;
681 p.el.set_screen(Gdk.Screen.get_default());
683 p.el.popup(null, null, null, ev.button, ev.time);
688 // user defined functions
690 public class Xcls_AddPropertyPopup : Object
693 private Xcls_LeftProps _this;
699 public Xcls_AddPropertyPopup(Xcls_LeftProps _owner )
702 _this.AddPropertyPopup = this;
703 this.el = new Gtk.Menu();
707 // set gobject values
708 var child_0 = new Xcls_MenuItem6( _this );
710 this.el.append ( child_0.el );
711 var child_1 = new Xcls_MenuItem7( _this );
713 this.el.append ( child_1.el );
714 var child_2 = new Xcls_MenuItem8( _this );
716 this.el.append ( child_2.el );
717 var child_3 = new Xcls_MenuItem9( _this );
719 this.el.append ( child_3.el );
720 var child_4 = new Xcls_MenuItem10( _this );
722 this.el.append ( child_4.el );
723 var child_5 = new Xcls_SeparatorMenuItem11( _this );
725 this.el.add ( child_5.el );
726 var child_6 = new Xcls_MenuItem12( _this );
728 this.el.append ( child_6.el );
729 var child_7 = new Xcls_MenuItem13( _this );
731 this.el.append ( child_7.el );
732 var child_8 = new Xcls_MenuItem14( _this );
734 this.el.append ( child_8.el );
735 var child_9 = new Xcls_SeparatorMenuItem15( _this );
737 this.el.add ( child_9.el );
738 var child_10 = new Xcls_MenuItem16( _this );
740 this.el.append ( child_10.el );
741 var child_11 = new Xcls_MenuItem17( _this );
743 this.el.append ( child_11.el );
744 var child_12 = new Xcls_MenuItem18( _this );
746 this.el.append ( child_12.el );
747 var child_13 = new Xcls_SeparatorMenuItem19( _this );
749 this.el.add ( child_13.el );
750 var child_14 = new Xcls_MenuItem20( _this );
752 this.el.append ( child_14.el );
753 var child_15 = new Xcls_MenuItem21( _this );
755 this.el.append ( child_15.el );
756 var child_16 = new Xcls_MenuItem22( _this );
758 this.el.append ( child_16.el );
761 // user defined functions
763 public class Xcls_MenuItem6 : Object
765 public Gtk.MenuItem el;
766 private Xcls_LeftProps _this;
772 public Xcls_MenuItem6(Xcls_LeftProps _owner )
775 this.el = new Gtk.MenuItem();
779 // set gobject values
780 this.el.tooltip_markup = "Using _this.{ID} will map to this element";
781 this.el.label = "id: _this.{ID} (Vala)";
784 this.el.activate.connect( () => {
785 _this.addProp( "prop", "id", "", "");
789 // user defined functions
792 public class Xcls_MenuItem7 : Object
794 public Gtk.MenuItem el;
795 private Xcls_LeftProps _this;
801 public Xcls_MenuItem7(Xcls_LeftProps _owner )
804 this.el = new Gtk.MenuItem();
808 // set gobject values
809 this.el.tooltip_markup = "how to pack this element onto parent, (method, 2nd arg, 3rd arg) .. the 1st argument is filled by the element";
810 this.el.label = "pack: Pack method (Vala)";
813 this.el.activate.connect( ( ) => {
815 _this.addProp( "prop", "pack","add", "*");
819 // user defined functions
822 public class Xcls_MenuItem8 : Object
824 public Gtk.MenuItem el;
825 private Xcls_LeftProps _this;
831 public Xcls_MenuItem8(Xcls_LeftProps _owner )
834 this.el = new Gtk.MenuItem();
838 // set gobject values
839 this.el.tooltip_markup = "eg. \n\nnew Clutter.Image.from_file(.....)";
840 this.el.label = "ctor: Alterative to default contructor (Vala)";
843 this.el.activate.connect( ( ) => {
845 _this.addProp( "prop", "ctor","", "*");
849 // user defined functions
852 public class Xcls_MenuItem9 : Object
854 public Gtk.MenuItem el;
855 private Xcls_LeftProps _this;
861 public Xcls_MenuItem9(Xcls_LeftProps _owner )
864 this.el = new Gtk.MenuItem();
868 // set gobject values
869 this.el.tooltip_markup = "This code is called after the ctor";
870 this.el.label = "init: initialziation code (vala)";
873 this.el.activate.connect( ( ) => {
875 _this.addProp( "prop", "init", "{\n\n}\n", "*" );
879 // user defined functions
882 public class Xcls_MenuItem10 : Object
884 public Gtk.MenuItem el;
885 private Xcls_LeftProps _this;
891 public Xcls_MenuItem10(Xcls_LeftProps _owner )
894 this.el = new Gtk.MenuItem();
898 // set gobject values
899 this.el.tooltip_markup = "set the cms-id for this element, when converted to javascript, the html value will be wrapped with Pman.Cms.content({cms-id},{original-html})\n";
900 this.el.label = "cms-id: (Roo JS/Pman library)";
903 this.el.activate.connect( () => {
904 _this.addProp( "prop", "cms-id", "", "string");
908 // user defined functions
911 public class Xcls_SeparatorMenuItem11 : Object
913 public Gtk.SeparatorMenuItem el;
914 private Xcls_LeftProps _this;
920 public Xcls_SeparatorMenuItem11(Xcls_LeftProps _owner )
923 this.el = new Gtk.SeparatorMenuItem();
927 // set gobject values
930 // user defined functions
933 public class Xcls_MenuItem12 : Object
935 public Gtk.MenuItem el;
936 private Xcls_LeftProps _this;
942 public Xcls_MenuItem12(Xcls_LeftProps _owner )
945 this.el = new Gtk.MenuItem();
949 // set gobject values
950 this.el.tooltip_markup = "Add a user defined string property";
951 this.el.label = "String";
954 this.el.activate.connect( (self) => {
956 _this.addProp( "prop", "XXXX", "","string");
961 // user defined functions
964 public class Xcls_MenuItem13 : Object
966 public Gtk.MenuItem el;
967 private Xcls_LeftProps _this;
973 public Xcls_MenuItem13(Xcls_LeftProps _owner )
976 this.el = new Gtk.MenuItem();
980 // set gobject values
981 this.el.tooltip_markup = "Add a user defined number property";
982 this.el.label = "Number";
985 this.el.activate.connect( ( ) =>{
987 _this.addProp("prop", "XXX", "0", "int");
991 // user defined functions
994 public class Xcls_MenuItem14 : Object
996 public Gtk.MenuItem el;
997 private Xcls_LeftProps _this;
1003 public Xcls_MenuItem14(Xcls_LeftProps _owner )
1006 this.el = new Gtk.MenuItem();
1010 // set gobject values
1011 this.el.tooltip_markup = "Add a user defined boolean property";
1012 this.el.label = "Boolean";
1015 this.el.activate.connect( ( ) =>{
1017 _this.addProp( "prop", "XXX", "true", "bool");
1021 // user defined functions
1024 public class Xcls_SeparatorMenuItem15 : Object
1026 public Gtk.SeparatorMenuItem el;
1027 private Xcls_LeftProps _this;
1033 public Xcls_SeparatorMenuItem15(Xcls_LeftProps _owner )
1036 this.el = new Gtk.SeparatorMenuItem();
1040 // set gobject values
1043 // user defined functions
1046 public class Xcls_MenuItem16 : Object
1048 public Gtk.MenuItem el;
1049 private Xcls_LeftProps _this;
1055 public Xcls_MenuItem16(Xcls_LeftProps _owner )
1058 this.el = new Gtk.MenuItem();
1062 // set gobject values
1063 this.el.tooltip_markup = "Add a user function boolean property";
1064 this.el.label = "Javascript Function";
1067 this.el.activate.connect( ( ) =>{
1069 _this.addProp("prop", "XXXX", "function() { }", "| function");
1073 // user defined functions
1076 public class Xcls_MenuItem17 : Object
1078 public Gtk.MenuItem el;
1079 private Xcls_LeftProps _this;
1085 public Xcls_MenuItem17(Xcls_LeftProps _owner )
1088 this.el = new Gtk.MenuItem();
1092 // set gobject values
1093 this.el.tooltip_markup = "Add a user function boolean property";
1094 this.el.label = "Vala Method";
1097 this.el.activate.connect( ( ) =>{
1099 _this.addProp( "prop", "XXXX", "() {\n\n}\n", "| return_type");
1103 // user defined functions
1106 public class Xcls_MenuItem18 : Object
1108 public Gtk.MenuItem el;
1109 private Xcls_LeftProps _this;
1115 public Xcls_MenuItem18(Xcls_LeftProps _owner )
1118 this.el = new Gtk.MenuItem();
1122 // set gobject values
1123 this.el.tooltip_markup = "Add a vala signal";
1124 this.el.label = "Vala Signal";
1127 this.el.activate.connect( ( ) =>{
1129 _this.addProp( "prop", "XXXX", "()", "@ void");
1133 // user defined functions
1136 public class Xcls_SeparatorMenuItem19 : Object
1138 public Gtk.SeparatorMenuItem el;
1139 private Xcls_LeftProps _this;
1145 public Xcls_SeparatorMenuItem19(Xcls_LeftProps _owner )
1148 this.el = new Gtk.SeparatorMenuItem();
1152 // set gobject values
1155 // user defined functions
1158 public class Xcls_MenuItem20 : Object
1160 public Gtk.MenuItem el;
1161 private Xcls_LeftProps _this;
1167 public Xcls_MenuItem20(Xcls_LeftProps _owner )
1170 this.el = new Gtk.MenuItem();
1174 // set gobject values
1175 this.el.tooltip_markup = "Add a flexy if (for HTML templates)";
1176 this.el.label = "Flexy - If";
1179 this.el.activate.connect( ( ) =>{
1181 _this.addProp("prop", "flexy:if", "value_or_condition", "string");
1185 // user defined functions
1188 public class Xcls_MenuItem21 : Object
1190 public Gtk.MenuItem el;
1191 private Xcls_LeftProps _this;
1197 public Xcls_MenuItem21(Xcls_LeftProps _owner )
1200 this.el = new Gtk.MenuItem();
1204 // set gobject values
1205 this.el.tooltip_markup = "Add a flexy include (for HTML templates)";
1206 this.el.label = "Flexy - Include";
1209 this.el.activate.connect( ( ) =>{
1211 _this.addProp("prop", "flexy:include", "name_of_file.html", "string");
1215 // user defined functions
1218 public class Xcls_MenuItem22 : Object
1220 public Gtk.MenuItem el;
1221 private Xcls_LeftProps _this;
1227 public Xcls_MenuItem22(Xcls_LeftProps _owner )
1230 this.el = new Gtk.MenuItem();
1234 // set gobject values
1235 this.el.tooltip_markup = "Add a flexy foreach (for HTML templates)";
1236 this.el.label = "Flexy - Foreach";
1239 this.el.activate.connect( ( ) =>{
1241 _this.addProp("prop", "flexy:foreach", "array,key,value", "string");
1245 // user defined functions
1249 public class Xcls_Image23 : Object
1251 public Gtk.Image el;
1252 private Xcls_LeftProps _this;
1258 public Xcls_Image23(Xcls_LeftProps _owner )
1261 this.el = new Gtk.Image();
1265 // set gobject values
1266 this.el.stock = Gtk.Stock.ADD;
1267 this.el.icon_size = Gtk.IconSize.MENU;
1270 // user defined functions
1274 public class Xcls_Button24 : Object
1276 public Gtk.Button el;
1277 private Xcls_LeftProps _this;
1283 public Xcls_Button24(Xcls_LeftProps _owner )
1286 this.el = new Gtk.Button();
1290 // set gobject values
1291 this.el.hexpand = true;
1292 this.el.always_show_image = true;
1293 this.el.tooltip_text = "Add Property";
1294 this.el.label = "Property";
1295 var child_0 = new Xcls_Image25( _this );
1297 this.el.set_image ( child_0.el );
1300 this.el.clicked.connect( ( ) => {
1302 _this.main_window.windowstate.showProps(this.el, "props");
1308 // user defined functions
1310 public class Xcls_Image25 : Object
1312 public Gtk.Image el;
1313 private Xcls_LeftProps _this;
1319 public Xcls_Image25(Xcls_LeftProps _owner )
1322 this.el = new Gtk.Image();
1326 // set gobject values
1327 this.el.icon_name = "format-justify-left";
1330 // user defined functions
1334 public class Xcls_Button26 : Object
1336 public Gtk.Button el;
1337 private Xcls_LeftProps _this;
1343 public Xcls_Button26(Xcls_LeftProps _owner )
1346 this.el = new Gtk.Button();
1350 // set gobject values
1351 this.el.hexpand = true;
1352 this.el.always_show_image = true;
1353 this.el.tooltip_text = "Add Event Code";
1354 this.el.label = "Event";
1355 var child_0 = new Xcls_Image27( _this );
1357 this.el.set_image ( child_0.el );
1360 this.el.clicked.connect( ( ) => {
1363 _this.main_window.windowstate.showProps(this.el, "signals");
1369 // user defined functions
1371 public class Xcls_Image27 : Object
1373 public Gtk.Image el;
1374 private Xcls_LeftProps _this;
1380 public Xcls_Image27(Xcls_LeftProps _owner )
1383 this.el = new Gtk.Image();
1387 // set gobject values
1388 this.el.icon_name = "appointment-new";
1391 // user defined functions
1396 public class Xcls_EditProps : Object
1398 public Gtk.ScrolledWindow el;
1399 private Xcls_LeftProps _this;
1403 public bool editing;
1406 public Xcls_EditProps(Xcls_LeftProps _owner )
1409 _this.EditProps = this;
1410 this.el = new Gtk.ScrolledWindow( null, null );
1413 this.editing = false;
1415 // set gobject values
1416 this.el.shadow_type = Gtk.ShadowType.IN;
1417 var child_0 = new Xcls_view( _this );
1419 this.el.add ( child_0.el );
1425 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
1429 // user defined functions
1431 public class Xcls_view : Object
1433 public Gtk.TreeView el;
1434 private Xcls_LeftProps _this;
1438 public Xcls_PopoverProperty popover;
1441 public Xcls_view(Xcls_LeftProps _owner )
1445 this.el = new Gtk.TreeView();
1448 this.popover = null;
1450 // set gobject values
1451 this.el.tooltip_column = 5;
1452 this.el.enable_tree_lines = true;
1453 this.el.headers_visible = true;
1454 var child_0 = new Xcls_model( _this );
1456 this.el.set_model ( child_0.el );
1457 var child_1 = new Xcls_keycol( _this );
1459 this.el.append_column ( child_1.el );
1460 var child_2 = new Xcls_valcol( _this );
1462 this.el.append_column ( child_2.el );
1463 var child_3 = new Xcls_ContextMenu( _this );
1469 var selection = this.el.get_selection();
1470 selection.set_mode( Gtk.SelectionMode.SINGLE);
1473 var description = new Pango.FontDescription();
1474 description.set_size(10000);
1475 this.el.override_font(description);
1479 this.el.button_press_event.connect( ( ev) => {
1481 Gtk.TreeViewColumn col;
1485 if (!this.el.get_path_at_pos((int)ev.x, (int) ev.y, out path, out col, out cell_x, out cell_y )) {
1486 GLib.debug("nothing selected on click");
1487 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
1488 this.el.get_selection().unselect_all();
1492 _this.before_edit();
1493 return false; //not on a element.
1497 // double click on name..
1498 if (ev.type == Gdk.EventType.2BUTTON_PRESS && ev.button == 1 && col.title == "Name") {
1501 if (this.popover == null) {
1502 this.popover = new Xcls_PopoverProperty();
1503 this.popover.mainwindow = _this.main_window;
1507 _this.before_edit();
1508 _this.stop_editor();
1510 _this.keyrender.el.stop_editing(false);
1511 _this.keyrender.el.editable =false;
1513 _this.valrender.el.stop_editing(false);
1514 _this.valrender.el.editable =false;
1516 var mod = this.el.get_model();
1517 mod.get_iter (out iter, path);
1520 GLib.Value gvaltype, gval;
1521 mod.get_value(iter, 1 , out gval); // one is key..
1523 mod.get_value(iter,0, out gvaltype);
1525 this.popover.show(this.el, _this.node, (string)gvaltype, (string)gval);
1527 // _this.startEditingKey(path);
1536 if (ev.type == Gdk.EventType.BUTTON_PRESS && ev.button == 3) {
1538 //if (col.title == "Value") {
1539 // _this.before_edit();
1543 var p = _this.ContextMenu;
1545 p.el.set_screen(Gdk.Screen.get_default());
1547 p.el.popup(null, null, null, ev.button, ev.time);
1548 //Seed.print("click:" + res.column.title);
1550 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
1552 this.el.get_selection().select_path(path);
1555 _this.before_edit();
1560 if (col.title != "Value") {
1561 GLib.debug("col title != Value");
1563 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
1564 this.el.get_selection().select_path(path);
1568 _this.before_edit();
1569 // XObject.error("column is not value?");
1570 return false; // ignore.. - key click.. ??? should we do this??
1574 // if the cell can be edited with a pulldown
1575 // then we should return true... - and let the start_editing handle it?
1582 // _this.before_edit(); <<< we really need to stop the other editor..
1583 _this.keyrender.el.stop_editing(false);
1584 _this.keyrender.el.editable =false;
1587 return _this.startEditingValue(path); // assumes selected row..
1596 // user defined functions
1598 public class Xcls_model : Object
1600 public Gtk.TreeStore el;
1601 private Xcls_LeftProps _this;
1607 public Xcls_model(Xcls_LeftProps _owner )
1611 this.el = new Gtk.TreeStore( 7, typeof(string), // 0 key type
1612 typeof(string), // 1 key
1613 typeof(string), // 2 key (display)
1614 typeof(string), // 3 value
1615 typeof(string), // 4 value (display)
1616 typeof(string), // 5 both (tooltip)
1617 typeof(string) // 6 key (for sorting)
1622 // set gobject values
1625 // user defined functions
1628 public class Xcls_keycol : Object
1630 public Gtk.TreeViewColumn el;
1631 private Xcls_LeftProps _this;
1637 public Xcls_keycol(Xcls_LeftProps _owner )
1640 _this.keycol = this;
1641 this.el = new Gtk.TreeViewColumn();
1645 // set gobject values
1646 this.el.title = "Name";
1647 this.el.resizable = true;
1648 var child_0 = new Xcls_keyrender( _this );
1650 this.el.pack_start ( child_0.el , false );
1654 this.el.add_attribute(_this.keyrender.el , "markup", 2 );
1655 this.el.add_attribute(_this.keyrender.el , "text", 1 );
1658 // user defined functions
1660 public class Xcls_keyrender : Object
1662 public Gtk.CellRendererText el;
1663 private Xcls_LeftProps _this;
1669 public Xcls_keyrender(Xcls_LeftProps _owner )
1672 _this.keyrender = this;
1673 this.el = new Gtk.CellRendererText();
1677 // set gobject values
1680 this.el.editing_started.connect( ( editable, path) => {
1683 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1688 // this.get('/LeftPanel.model').activePath = path;
1689 _this.model.el.get_value(iter,1, out gval);
1690 var val = (string)gval;
1692 ((Gtk.Entry)editable).set_text(val);
1694 this.el.edited.connect( (path, newtext) => {
1695 GLib.debug("Keyrender - signal:edited\n");
1697 this.el.editable = false;
1702 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1705 _this.model.el.get_value(iter,1, out gval);
1706 var oldval = (string)gval;
1708 _this.model.el.get_value(iter,0, out gval);
1709 var ktype = (string)gval;
1711 _this.model.el.set_value(iter, 1, newtext);
1713 if (oldval == newtext) {
1718 GLib.debug("ktype: %s\n",ktype);
1721 var ov = _this.node.listeners.get(oldval);
1722 _this.node.listeners.set(newtext, ov);
1723 _this.node.listeners.unset(oldval);
1725 _this.updateIter(iter, ktype, newtext, ov);
1729 var ov = _this.node.props.get(oldval);
1730 _this.node.props.set(newtext, ov);
1731 _this.node.props.unset(oldval);
1732 _this.updateIter(iter, ktype, newtext, ov);
1740 // user defined functions
1744 public class Xcls_valcol : Object
1746 public Gtk.TreeViewColumn el;
1747 private Xcls_LeftProps _this;
1753 public Xcls_valcol(Xcls_LeftProps _owner )
1756 _this.valcol = this;
1757 this.el = new Gtk.TreeViewColumn();
1761 // set gobject values
1762 this.el.title = "Value";
1763 this.el.resizable = true;
1764 var child_0 = new Xcls_valrender( _this );
1766 this.el.pack_start ( child_0.el , true );
1772 // typeof(string), // 0 key type
1773 // typeof(string), // 1 key
1774 // typeof(string), // 2 key (display)
1775 // typeof(string), // 3 value
1776 // typeof(string) // 4 value (display)
1779 this.el.add_attribute(_this.valrender.el , "text", 4 );
1780 //this.el.add_attribute(_this.valrender.el , "sensitive", 4 );
1781 //this.el.add_attribute(this.items[0].el , 'editable', 3 );
1782 // this.el.set_cell_data_func(cell, age_cell_data_func, NULL, NULL);
1784 // this.get('/LeftPanel').editableColumn= this;
1788 // user defined functions
1790 public class Xcls_valrender : Object
1792 public Gtk.CellRendererCombo el;
1793 private Xcls_LeftProps _this;
1799 public Xcls_valrender(Xcls_LeftProps _owner )
1802 _this.valrender = this;
1803 this.el = new Gtk.CellRendererCombo();
1807 // set gobject values
1808 this.el.editable = false;
1809 this.el.text_column = 0;
1810 this.el.has_entry = true;
1811 var child_0 = new Xcls_valrendermodel( _this );
1813 this.el.model = child_0.el;
1816 this.el.editing_started.connect( ( editable, path) => {
1817 //_this.editing = true;
1818 GLib.debug("editing started called\n");
1819 if (!_this.allow_edit) {
1821 GLib.debug("val - editing_Started\n");
1822 this.el.editable = false; // make sure it's not editor...
1827 _this.allow_edit =false;
1830 if ( this.el.has_entry ) {
1833 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1838 // this.get('/LeftPanel.model').activePath = path;
1839 _this.model.el.get_value(iter,3, out gval);
1842 var val = (string)gval;
1843 var combo = (Gtk.ComboBox)editable;
1845 var entry = (Gtk.Entry) combo.get_child();
1846 entry.set_text(val);
1850 this.el.edited.connect( (path, newtext) => {
1851 GLib.debug("Valrender - signal:edited\n");
1853 this.el.editable = false;
1858 2, "<b>" + miter.get_key() + "</b>",
1859 3, miter.get_value(),
1860 4, display_value(short);
1866 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1869 _this.model.el.get_value(iter,0, out gval);
1870 var ktype = (string)gval;
1873 _this.model.el.get_value(iter,3, out gval);
1874 var oldval = (string)gval;
1876 _this.model.el.get_value(iter,1, out gval);
1877 var key = (string)gval;
1883 _this.node.listeners.set(key, newtext);
1884 _this.updateIter(iter,ktype,key,newtext);
1887 _this.node.props.set(key,newtext);
1888 _this.updateIter(iter,ktype, key,newtext);
1891 // _this.load(_this.file,_this.node);
1897 // user defined functions
1898 public void setOptions (string[] ar) {
1899 var m = _this.valrendermodel.el;
1902 for (var i =0; i < ar.length; i++) {
1904 m.set_value(iret, 0, ar[i]);
1909 public class Xcls_valrendermodel : Object
1911 public Gtk.ListStore el;
1912 private Xcls_LeftProps _this;
1918 public Xcls_valrendermodel(Xcls_LeftProps _owner )
1921 _this.valrendermodel = this;
1922 this.el = new Gtk.ListStore( 1, typeof(string) );
1926 // set gobject values
1929 // user defined functions
1934 public class Xcls_ContextMenu : Object
1937 private Xcls_LeftProps _this;
1943 public Xcls_ContextMenu(Xcls_LeftProps _owner )
1946 _this.ContextMenu = this;
1947 this.el = new Gtk.Menu();
1951 // set gobject values
1952 var child_0 = new Xcls_MenuItem37( _this );
1954 this.el.append ( child_0.el );
1955 var child_1 = new Xcls_SeparatorMenuItem38( _this );
1957 this.el.append ( child_1.el );
1958 var child_2 = new Xcls_MenuItem39( _this );
1960 this.el.append ( child_2.el );
1963 // user defined functions
1965 public class Xcls_MenuItem37 : Object
1967 public Gtk.MenuItem el;
1968 private Xcls_LeftProps _this;
1974 public Xcls_MenuItem37(Xcls_LeftProps _owner )
1977 this.el = new Gtk.MenuItem();
1981 // set gobject values
1982 this.el.label = "Edit (double click)";
1985 this.el.activate.connect( ( ) =>{
1987 var s = _this.view.el.get_selection();
1990 s.get_selected (out mod, out iter);
1992 if (_this.view.popover == null) {
1993 _this.view.popover = new Xcls_PopoverProperty();
1994 _this.view.popover.mainwindow = _this.main_window;
1998 _this.before_edit();
1999 _this.stop_editor();
2001 _this.keyrender.el.stop_editing(false);
2002 _this.keyrender.el.editable =false;
2004 _this.valrender.el.stop_editing(false);
2005 _this.valrender.el.editable =false;
2008 GLib.Value gvaltype, gval;
2009 mod.get_value(iter, 1 , out gval); // one is key..
2011 mod.get_value(iter,0, out gvaltype);
2013 _this.view.popover.show(_this.view.el, _this.node, (string)gvaltype, (string)gval);
2017 // _this.startEditingKey(model.get_path(iter));
2021 // user defined functions
2024 public class Xcls_SeparatorMenuItem38 : Object
2026 public Gtk.SeparatorMenuItem el;
2027 private Xcls_LeftProps _this;
2033 public Xcls_SeparatorMenuItem38(Xcls_LeftProps _owner )
2036 this.el = new Gtk.SeparatorMenuItem();
2040 // set gobject values
2043 // user defined functions
2046 public class Xcls_MenuItem39 : Object
2048 public Gtk.MenuItem el;
2049 private Xcls_LeftProps _this;
2055 public Xcls_MenuItem39(Xcls_LeftProps _owner )
2058 this.el = new Gtk.MenuItem();
2062 // set gobject values
2063 this.el.label = "Delete";
2066 this.el.activate.connect( ( ) =>{
2067 _this.deleteSelected();
2071 // user defined functions