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;
29 public Xcls_LeftProps()
32 this.el = new Gtk.Box();
35 var child_0 = new Xcls_Box2( _this );
37 this.el.pack_start ( child_0.el , false,true,0 );
38 var child_1 = new Xcls_EditProps( _this );
40 this.el.pack_end ( child_1.el , true,true,0 );
43 // user defined functions
44 public void updateKey (string oldkey, string type, string key ) {
48 _this.model.el.foreach((mod, path, iter) => {
53 GLib.Value gvaltype, gval,kvalue;
54 mod.get_value(iter, 1 , out gval); // one is key..
56 mod.get_value(iter,0, out gvaltype);
58 mod.get_value(iter,3, out kvalue);
60 if (oldkey == ((string)gval) && type == ((string)gvaltype)) {
62 //print("update iter type=%s, key=%s value=%s\n", type, key,(string) kvalue);
64 this.updateIter(iter, type, key, (string)kvalue);
76 public void before_edit ()
79 GLib.debug("before edit - stop editing\n");
81 // these do not appear to trigger save...
82 _this.keyrender.el.stop_editing(false);
83 _this.keyrender.el.editable =false;
85 _this.valrender.el.stop_editing(false);
86 _this.valrender.el.editable =false;
89 // technicall stop the popup editor..
92 public string keySortFormat (string key) {
93 // listeners first - with 0
100 var bits = key.split(" ");
103 return "2 " + bits[bits.length -1];
107 return "3 " + bits[bits.length -1];
112 return "4 " + bits[bits.length -1];
115 return "5 " + bits[bits.length -1];
120 public void finish_editing () {
124 public bool startEditingValue ( Gtk.TreePath path) {
126 // ONLY return true if editing is allowed - eg. combo..
128 GLib.debug("start editing?\n");
129 if (!this.stop_editor()) {
130 GLib.debug("stop editor failed\n");
136 var mod = this.model.el;
137 mod.get_iter (out iter, path);
143 2, "<b>" + miter.get_key() + "</b>",
149 mod.get_value(iter, 3 , out gval);
150 var val = (string)gval;
152 mod.get_value(iter, 1 , out gval);
153 var key = (string)gval;
156 string kname, kflag, ktype;
157 this.node.normalize_key(key, out kname, out kflag, out ktype);
160 mod.get_value(iter, 0 , out gval);
161 var type = (string)gval; // listerner or prop..
165 var use_textarea = false;
167 //------------ things that require the text editor...
169 if (type == "listener") {
172 if (key.length > 0 && key[0] == '|') { // user defined method
175 if (key.length > 0 && key[0] == '$') { // raw string
178 if (key.length > 0 && key == "* init") {
181 if (val.length > 40) { // long value...
188 GLib.debug("Call show editor\n");
189 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
190 this.view.el.get_selection().select_path(path);
192 this.show_editor(file, node, type, key);
201 var pal = this.file.project.palete;
204 var has_opts = pal.typeOptions(this.node.fqn(), kname, ktype, out opts);
208 // others... - fill in options for true/false?
209 GLib.debug("turn on editing %s \n" , mod.get_path(iter).to_string());
211 GLib.debug (ktype.up());
213 GLib.debug("start editing try/false)???");
214 this.valrender.el.has_entry = false;
216 this.valrender.setOptions(opts);
218 this.valrender.el.has_entry = false;
219 this.valrender.el.editable = true;
220 this.allow_edit = true;
221 GLib.Timeout.add_full(GLib.Priority.DEFAULT,100 , () => {
222 this.view.el.set_cursor_on_cell(
233 // see if type is a Enum.
240 this.valrender.setOptions(opts);
242 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
244 // at this point - work out the type...
245 // if its' a combo... then show the options..
246 this.valrender.el.has_entry = true;
248 this.valrender.el.editable = true;
251 this.allow_edit = true;
257 this.view.el.set_cursor_on_cell(
267 public void load (JsRender.JsRender file, JsRender.Node? node)
269 GLib.debug("load leftprops\n");
275 this.model.el.clear();
277 //this.get('/RightEditor').el.hide();
284 //var provider = this.get('/LeftTree').getPaleteProvider();
287 //typeof(string), // 0 key type
288 //typeof(string), // 1 key
289 //typeof(string), // 2 key (display)
290 //typeof(string), // 3 value
291 //typeof(string), // 4 value (display)
292 //typeof(string), // 5 both (tooltip)
296 // really need a way to sort the hashmap...
297 var m = this.model.el;
299 var miter = node.listeners.map_iterator();
302 while(miter.next()) {
304 m.append(out iter,null);
306 this.updateIter(iter, "listener", miter.get_key(), miter.get_value());
312 miter = node.props.map_iterator();
315 while(miter.next()) {
317 m.append(out iter,null);
318 this.updateIter(iter, "prop", miter.get_key(), miter.get_value());
321 GLib.debug("clear selection\n");
323 this.model.el.set_sort_column_id(6,Gtk.SortType.ASCENDING); // sort by real key..
325 this.view.el.get_selection().unselect_all();
327 var pane = _this.main_window.editpane.el;
328 var try_size = (i * 25) + 60; // est. 20px per line + 40px header
329 GLib.Timeout.add_seconds(1, () => {
332 ((try_size * 1.0f) / (pane.max_position * 1.0f)) > 0.8f ?
333 (int) (pane.max_position * 0.2f) :
334 pane.max_position-try_size);
335 return GLib.Source.REMOVE;
339 public string keyFormat (string val, string type) {
341 // Glib.markup_escape_text(val);
343 if (type == "listener") {
344 return "<span font_weight=\"bold\" color=\"#660000\">" +
345 GLib.Markup.escape_text(val) +
349 if (val.length < 1) {
350 return "<span color=\"#FF0000\">--empty--</span>";
355 //# - object properties
357 // all of these... - display value is last element..
358 var ar = val.strip().split(" ");
361 var dval = GLib.Markup.escape_text(ar[ar.length-1]);
367 case '@': // signal // just bold balck?
368 if (dval[0] == '@') {
369 dval = dval.substring(1);
372 return @"<span font_weight=\"bold\">@ $dval</span>";
373 case '#': // object properties?
374 if (dval[0] == '#') {
375 dval = dval.substring(1);
377 return @"<span font_weight=\"bold\">$dval</span>";
379 if (dval[0] == '*') {
380 dval = dval.substring(1);
382 return @"<span color=\"#0000CC\" font_weight=\"bold\">$dval</span>";
384 if (dval[0] == '$') {
385 dval = dval.substring(1);
387 return @"<span style=\"italic\">$dval</span>";
388 case '|': // user defined methods
389 if (dval[0] == '|') {
390 dval = dval.substring(1);
392 return @"<span color=\"#008000\" font_weight=\"bold\">$dval</span>";
403 public void deleteSelected () {
408 var s = this.view.el.get_selection();
409 s.get_selected(out mod, out iter);
413 mod.get_value(iter, 0 , out gval);
414 var type = (string)gval;
416 mod.get_value(iter, 1 , out gval);
417 var key = (string)gval;
421 this.node.listeners.unset(key);
425 this.node.props.unset(key);
428 this.load(this.file, this.node);
432 public void startEditingKey ( Gtk.TreePath path) {
434 if (!this.stop_editor()) {
438 // others... - fill in options for true/false?
441 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
442 this.allow_edit = true;
443 this.keyrender.el.editable = true;
445 this.view.el.set_cursor_on_cell(
457 public void addProp (string in_type, string key, string value, string value_type) {
458 // info includes key, val, skel, etype..
459 //console.dump(info);
460 //type = info.type.toLowerCase();
461 //var data = this.toJS();
463 var type = in_type == "signals" ? "listener" : in_type;
465 var fkey = (value_type.length > 0 ? value_type + " " : "") + key;
467 if (type == "listener") {
468 if (this.node.listeners.has_key(key)) {
471 this.node.listeners.set(key,value);
473 assert(this.node != null);
474 assert(this.node.props != null);
475 if (this.node.props.has_key(fkey)) {
478 this.node.props.set(fkey,value);
483 this.load(this.file, this.node);
487 /// need to find the row which I've just added..
490 var s = this.view.el.get_selection();
493 GLib.debug("trying to find new iter");
495 this.model.el.foreach((model, path, iter) => {
498 this.model.el.get_value(iter, 0 , out gval);
499 if ((string)gval != type) {
500 GLib.debug("not type: %s = %s\n", (string)gval , type);
503 this.model.el.get_value(iter, 1 , out gval);
504 if ((string)gval != fkey) {
505 GLib.debug("not key: %s = %s\n", (string)gval , fkey);
509 GLib.Timeout.add_full(GLib.Priority.DEFAULT,40 , () => {
511 this.startEditingValue(this.model.el.get_path(iter));
514 //s.select_iter(iter);
522 public void updateIter (Gtk.TreeIter iter, string type, string key, string kvalue) {
524 //print("update Iter %s, %s\n", key,kvalue);
525 //typeof(string), // 0 key type
526 //typeof(string), // 1 key
527 //typeof(string), // 2 key (display)
528 //typeof(string), // 3 value
529 //typeof(string), // 4 value (display)
530 //typeof(string), // 5 both (tooltip)
531 //typeof(string), // 6 key (sort)
533 var dl = kvalue.strip().split("\n");
535 var dis_val = dl.length > 1 ? (dl[0].strip()+ "...") : dl[0];
537 if (type == "listener") {
541 this.model.el.set(iter,
544 2, this.keyFormat(key ,type),
547 5, "<tt>" + GLib.Markup.escape_text(key + " " +kvalue) + "</tt>",
555 this.model.el.set(iter,
558 2, this.keyFormat(key , "prop"),
561 5, "<tt>" + GLib.Markup.escape_text(key + " " + kvalue) + "</tt>",
562 6, this.keySortFormat(key)
565 public class Xcls_Box2 : Object
568 private Xcls_LeftProps _this;
574 public Xcls_Box2(Xcls_LeftProps _owner )
577 this.el = new Gtk.Box();
580 var child_0 = new Xcls_Button3( _this );
582 this.el.add ( child_0.el );
585 // user defined functions
587 public class Xcls_Button3 : Object
589 public Gtk.Button el;
590 private Xcls_LeftProps _this;
596 public Xcls_Button3(Xcls_LeftProps _owner )
599 this.el = new Gtk.Button();
602 var child_0 = new Xcls_Box4( _this );
604 this.el.add ( child_0.el );
605 var child_1 = new Xcls_AddPropertyPopup( _this );
609 this.el.button_press_event.connect( (self, ev) => {
613 var p = _this.AddPropertyPopup;
614 p.el.set_screen(Gdk.Screen.get_default());
616 p.el.popup(null, null, null, ev.button, ev.time);
621 // user defined functions
623 public class Xcls_Box4 : Object
626 private Xcls_LeftProps _this;
632 public Xcls_Box4(Xcls_LeftProps _owner )
635 this.el = new Gtk.Box();
638 var child_0 = new Xcls_Image5( _this );
640 this.el.add ( child_0.el );
641 var child_1 = new Xcls_Label6( _this );
643 this.el.add ( child_1.el );
646 // user defined functions
648 public class Xcls_Image5 : Object
651 private Xcls_LeftProps _this;
657 public Xcls_Image5(Xcls_LeftProps _owner )
660 this.el = new Gtk.Image();
665 // user defined functions
668 public class Xcls_Label6 : Object
671 private Xcls_LeftProps _this;
677 public Xcls_Label6(Xcls_LeftProps _owner )
680 this.el = new Gtk.Label();
685 // user defined functions
689 public class Xcls_AddPropertyPopup : Object
692 private Xcls_LeftProps _this;
698 public Xcls_AddPropertyPopup(Xcls_LeftProps _owner )
701 _this.AddPropertyPopup = this;
702 this.el = new Gtk.Menu();
705 var child_0 = new Xcls_MenuItem8( _this );
707 this.el.append ( child_0.el );
708 var child_1 = new Xcls_MenuItem9( _this );
710 this.el.append ( child_1.el );
711 var child_2 = new Xcls_MenuItem10( _this );
713 this.el.append ( child_2.el );
714 var child_3 = new Xcls_MenuItem11( _this );
716 this.el.append ( child_3.el );
717 var child_4 = new Xcls_MenuItem12( _this );
719 this.el.append ( child_4.el );
720 var child_5 = new Xcls_SeparatorMenuItem13( _this );
722 this.el.add ( child_5.el );
723 var child_6 = new Xcls_MenuItem14( _this );
725 this.el.append ( child_6.el );
726 var child_7 = new Xcls_MenuItem15( _this );
728 this.el.append ( child_7.el );
729 var child_8 = new Xcls_MenuItem16( _this );
731 this.el.append ( child_8.el );
732 var child_9 = new Xcls_SeparatorMenuItem17( _this );
734 this.el.add ( child_9.el );
735 var child_10 = new Xcls_MenuItem18( _this );
737 this.el.append ( child_10.el );
738 var child_11 = new Xcls_MenuItem19( _this );
740 this.el.append ( child_11.el );
741 var child_12 = new Xcls_MenuItem20( _this );
743 this.el.append ( child_12.el );
744 var child_13 = new Xcls_SeparatorMenuItem21( _this );
746 this.el.add ( child_13.el );
747 var child_14 = new Xcls_MenuItem22( _this );
749 this.el.append ( child_14.el );
750 var child_15 = new Xcls_MenuItem23( _this );
752 this.el.append ( child_15.el );
753 var child_16 = new Xcls_MenuItem24( _this );
755 this.el.append ( child_16.el );
758 // user defined functions
760 public class Xcls_MenuItem8 : Object
762 public Gtk.MenuItem el;
763 private Xcls_LeftProps _this;
769 public Xcls_MenuItem8(Xcls_LeftProps _owner )
772 this.el = new Gtk.MenuItem();
777 this.el.activate.connect( () => {
778 _this.addProp( "prop", "id", "", "");
782 // user defined functions
785 public class Xcls_MenuItem9 : Object
787 public Gtk.MenuItem el;
788 private Xcls_LeftProps _this;
794 public Xcls_MenuItem9(Xcls_LeftProps _owner )
797 this.el = new Gtk.MenuItem();
802 this.el.activate.connect( ( ) => {
804 _this.addProp( "prop", "pack","add", "*");
808 // user defined functions
811 public class Xcls_MenuItem10 : Object
813 public Gtk.MenuItem el;
814 private Xcls_LeftProps _this;
820 public Xcls_MenuItem10(Xcls_LeftProps _owner )
823 this.el = new Gtk.MenuItem();
828 this.el.activate.connect( ( ) => {
830 _this.addProp( "prop", "ctor","", "*");
834 // user defined functions
837 public class Xcls_MenuItem11 : Object
839 public Gtk.MenuItem el;
840 private Xcls_LeftProps _this;
846 public Xcls_MenuItem11(Xcls_LeftProps _owner )
849 this.el = new Gtk.MenuItem();
854 this.el.activate.connect( ( ) => {
856 _this.addProp( "prop", "init", "{\n\n}\n", "*" );
860 // user defined functions
863 public class Xcls_MenuItem12 : Object
865 public Gtk.MenuItem el;
866 private Xcls_LeftProps _this;
872 public Xcls_MenuItem12(Xcls_LeftProps _owner )
875 this.el = new Gtk.MenuItem();
880 this.el.activate.connect( () => {
881 _this.addProp( "prop", "cms-id", "", "string");
885 // user defined functions
888 public class Xcls_SeparatorMenuItem13 : Object
890 public Gtk.SeparatorMenuItem el;
891 private Xcls_LeftProps _this;
897 public Xcls_SeparatorMenuItem13(Xcls_LeftProps _owner )
900 this.el = new Gtk.SeparatorMenuItem();
905 // user defined functions
908 public class Xcls_MenuItem14 : Object
910 public Gtk.MenuItem el;
911 private Xcls_LeftProps _this;
917 public Xcls_MenuItem14(Xcls_LeftProps _owner )
920 this.el = new Gtk.MenuItem();
925 this.el.activate.connect( (self) => {
927 _this.addProp( "prop", "XXXX", "","string");
932 // user defined functions
935 public class Xcls_MenuItem15 : Object
937 public Gtk.MenuItem el;
938 private Xcls_LeftProps _this;
944 public Xcls_MenuItem15(Xcls_LeftProps _owner )
947 this.el = new Gtk.MenuItem();
952 this.el.activate.connect( ( ) =>{
954 _this.addProp("prop", "XXX", "0", "int");
958 // user defined functions
961 public class Xcls_MenuItem16 : Object
963 public Gtk.MenuItem el;
964 private Xcls_LeftProps _this;
970 public Xcls_MenuItem16(Xcls_LeftProps _owner )
973 this.el = new Gtk.MenuItem();
978 this.el.activate.connect( ( ) =>{
980 _this.addProp( "prop", "XXX", "true", "bool");
984 // user defined functions
987 public class Xcls_SeparatorMenuItem17 : Object
989 public Gtk.SeparatorMenuItem el;
990 private Xcls_LeftProps _this;
996 public Xcls_SeparatorMenuItem17(Xcls_LeftProps _owner )
999 this.el = new Gtk.SeparatorMenuItem();
1004 // user defined functions
1007 public class Xcls_MenuItem18 : Object
1009 public Gtk.MenuItem el;
1010 private Xcls_LeftProps _this;
1016 public Xcls_MenuItem18(Xcls_LeftProps _owner )
1019 this.el = new Gtk.MenuItem();
1024 this.el.activate.connect( ( ) =>{
1026 _this.addProp("prop", "XXXX", "function() { }", "| function");
1030 // user defined functions
1033 public class Xcls_MenuItem19 : Object
1035 public Gtk.MenuItem el;
1036 private Xcls_LeftProps _this;
1042 public Xcls_MenuItem19(Xcls_LeftProps _owner )
1045 this.el = new Gtk.MenuItem();
1050 this.el.activate.connect( ( ) =>{
1052 _this.addProp( "prop", "XXXX", "() {\n\n}\n", "| return_type");
1056 // user defined functions
1059 public class Xcls_MenuItem20 : Object
1061 public Gtk.MenuItem el;
1062 private Xcls_LeftProps _this;
1068 public Xcls_MenuItem20(Xcls_LeftProps _owner )
1071 this.el = new Gtk.MenuItem();
1076 this.el.activate.connect( ( ) =>{
1078 _this.addProp( "prop", "XXXX", "()", "@ void");
1082 // user defined functions
1085 public class Xcls_SeparatorMenuItem21 : Object
1087 public Gtk.SeparatorMenuItem el;
1088 private Xcls_LeftProps _this;
1094 public Xcls_SeparatorMenuItem21(Xcls_LeftProps _owner )
1097 this.el = new Gtk.SeparatorMenuItem();
1102 // user defined functions
1105 public class Xcls_MenuItem22 : Object
1107 public Gtk.MenuItem el;
1108 private Xcls_LeftProps _this;
1114 public Xcls_MenuItem22(Xcls_LeftProps _owner )
1117 this.el = new Gtk.MenuItem();
1122 this.el.activate.connect( ( ) =>{
1124 _this.addProp("prop", "flexy:if", "value_or_condition", "string");
1128 // user defined functions
1131 public class Xcls_MenuItem23 : Object
1133 public Gtk.MenuItem el;
1134 private Xcls_LeftProps _this;
1140 public Xcls_MenuItem23(Xcls_LeftProps _owner )
1143 this.el = new Gtk.MenuItem();
1148 this.el.activate.connect( ( ) =>{
1150 _this.addProp("prop", "flexy:include", "name_of_file.html", "string");
1154 // user defined functions
1157 public class Xcls_MenuItem24 : Object
1159 public Gtk.MenuItem el;
1160 private Xcls_LeftProps _this;
1166 public Xcls_MenuItem24(Xcls_LeftProps _owner )
1169 this.el = new Gtk.MenuItem();
1174 this.el.activate.connect( ( ) =>{
1176 _this.addProp("prop", "flexy:foreach", "array,key,value", "string");
1180 // user defined functions
1186 public class Xcls_EditProps : Object
1188 public Gtk.ScrolledWindow el;
1189 private Xcls_LeftProps _this;
1195 public Xcls_EditProps(Xcls_LeftProps _owner )
1198 _this.EditProps = this;
1199 this.el = new Gtk.ScrolledWindow();
1202 var child_0 = new Xcls_view( _this );
1204 this.el.add ( child_0.el );
1210 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
1214 // user defined functions
1216 public class Xcls_view : Object
1218 public Gtk.TreeView el;
1219 private Xcls_LeftProps _this;
1225 public Xcls_view(Xcls_LeftProps _owner )
1229 this.el = new Gtk.TreeView();
1232 var child_0 = new Xcls_model( _this );
1234 this.el.set_model ( child_0.el );
1235 var child_1 = new Xcls_keycol( _this );
1237 this.el.append_column ( child_1.el );
1238 var child_2 = new Xcls_valcol( _this );
1240 this.el.append_column ( child_2.el );
1241 var child_3 = new Xcls_ContextMenu( _this );
1247 var selection = this.el.get_selection();
1248 selection.set_mode( Gtk.SelectionMode.SINGLE);
1251 var description = new Pango.FontDescription();
1252 description.set_size(10000);
1253 this.el.override_font(description);
1257 this.el.button_press_event.connect( ( ev) => {
1259 Gtk.TreeViewColumn col;
1263 if (!this.el.get_path_at_pos((int)ev.x, (int) ev.y, out path, out col, out cell_x, out cell_y )) {
1264 GLib.debug("nothing selected on click");
1265 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
1266 this.el.get_selection().unselect_all();
1270 _this.before_edit();
1271 return false; //not on a element.
1275 // double click on name..
1276 if (ev.type == Gdk.EventType.2BUTTON_PRESS && ev.button == 1 && col.title == "Name") {
1279 if (this.popover == null) {
1280 this.popover = new Xcls_PopoverProperty();
1281 this.popover.mainwindow = _this.main_window;
1285 _this.before_edit();
1286 _this.stop_editor();
1288 _this.keyrender.el.stop_editing(false);
1289 _this.keyrender.el.editable =false;
1291 _this.valrender.el.stop_editing(false);
1292 _this.valrender.el.editable =false;
1294 var mod = this.el.get_model();
1295 mod.get_iter (out iter, path);
1298 GLib.Value gvaltype, gval;
1299 mod.get_value(iter, 1 , out gval); // one is key..
1301 mod.get_value(iter,0, out gvaltype);
1303 this.popover.show(this.el, _this.node, (string)gvaltype, (string)gval);
1305 // _this.startEditingKey(path);
1314 if (ev.type == Gdk.EventType.BUTTON_PRESS && ev.button == 3) {
1316 //if (col.title == "Value") {
1317 // _this.before_edit();
1321 var p = _this.ContextMenu;
1323 p.el.set_screen(Gdk.Screen.get_default());
1325 p.el.popup(null, null, null, ev.button, ev.time);
1326 //Seed.print("click:" + res.column.title);
1328 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
1330 this.el.get_selection().select_path(path);
1333 _this.before_edit();
1338 if (col.title != "Value") {
1339 GLib.debug("col title != Value");
1341 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
1342 this.el.get_selection().select_path(path);
1346 _this.before_edit();
1347 // XObject.error("column is not value?");
1348 return false; // ignore.. - key click.. ??? should we do this??
1352 // if the cell can be edited with a pulldown
1353 // then we should return true... - and let the start_editing handle it?
1360 // _this.before_edit(); <<< we really need to stop the other editor..
1361 _this.keyrender.el.stop_editing(false);
1362 _this.keyrender.el.editable =false;
1365 return _this.startEditingValue(path); // assumes selected row..
1374 // user defined functions
1376 public class Xcls_model : Object
1378 public Gtk.TreeStore el;
1379 private Xcls_LeftProps _this;
1385 public Xcls_model(Xcls_LeftProps _owner )
1389 this.el = new Gtk.TreeStore();
1394 // user defined functions
1397 public class Xcls_keycol : Object
1399 public Gtk.TreeViewColumn el;
1400 private Xcls_LeftProps _this;
1406 public Xcls_keycol(Xcls_LeftProps _owner )
1409 _this.keycol = this;
1410 this.el = new Gtk.TreeViewColumn();
1413 var child_0 = new Xcls_keyrender( _this );
1415 this.el.pack_start ( child_0.el , false );
1419 this.el.add_attribute(_this.keyrender.el , "markup", 2 );
1420 this.el.add_attribute(_this.keyrender.el , "text", 1 );
1423 // user defined functions
1425 public class Xcls_keyrender : Object
1427 public Gtk.CellRendererText el;
1428 private Xcls_LeftProps _this;
1434 public Xcls_keyrender(Xcls_LeftProps _owner )
1437 _this.keyrender = this;
1438 this.el = new Gtk.CellRendererText();
1443 this.el.xediting_started.connect( ( editable, path) => {
1446 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1451 // this.get('/LeftPanel.model').activePath = path;
1452 _this.model.el.get_value(iter,1, out gval);
1453 var val = (string)gval;
1455 ((Gtk.Entry)editable).set_text(val);
1457 this.el.xedited.connect( (path, newtext) => {
1458 GLib.debug("Keyrender - signal:edited\n");
1460 this.el.editable = false;
1465 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1468 _this.model.el.get_value(iter,1, out gval);
1469 var oldval = (string)gval;
1471 _this.model.el.get_value(iter,0, out gval);
1472 var ktype = (string)gval;
1474 _this.model.el.set_value(iter, 1, newtext);
1476 if (oldval == newtext) {
1481 GLib.debug("ktype: %s\n",ktype);
1484 var ov = _this.node.listeners.get(oldval);
1485 _this.node.listeners.set(newtext, ov);
1486 _this.node.listeners.unset(oldval);
1488 _this.updateIter(iter, ktype, newtext, ov);
1492 var ov = _this.node.props.get(oldval);
1493 _this.node.props.set(newtext, ov);
1494 _this.node.props.unset(oldval);
1495 _this.updateIter(iter, ktype, newtext, ov);
1503 // user defined functions
1507 public class Xcls_valcol : Object
1509 public Gtk.TreeViewColumn el;
1510 private Xcls_LeftProps _this;
1516 public Xcls_valcol(Xcls_LeftProps _owner )
1519 _this.valcol = this;
1520 this.el = new Gtk.TreeViewColumn();
1523 var child_0 = new Xcls_valrender( _this );
1525 this.el.pack_start ( child_0.el , true );
1531 // typeof(string), // 0 key type
1532 // typeof(string), // 1 key
1533 // typeof(string), // 2 key (display)
1534 // typeof(string), // 3 value
1535 // typeof(string) // 4 value (display)
1538 this.el.add_attribute(_this.valrender.el , "text", 4 );
1539 //this.el.add_attribute(_this.valrender.el , "sensitive", 4 );
1540 //this.el.add_attribute(this.items[0].el , 'editable', 3 );
1541 // this.el.set_cell_data_func(cell, age_cell_data_func, NULL, NULL);
1543 // this.get('/LeftPanel').editableColumn= this;
1547 // user defined functions
1549 public class Xcls_valrender : Object
1551 public Gtk.CellRendererCombo el;
1552 private Xcls_LeftProps _this;
1558 public Xcls_valrender(Xcls_LeftProps _owner )
1561 _this.valrender = this;
1562 this.el = new Gtk.CellRendererCombo();
1565 var child_0 = new Xcls_valrendermodel( _this );
1567 this.el.model = child_0.el;
1570 this.el.editing_started.connect( ( editable, path) => {
1571 //_this.editing = true;
1572 GLib.debug("editing started called\n");
1573 if (!_this.allow_edit) {
1575 GLib.debug("val - editing_Started\n");
1576 this.el.editable = false; // make sure it's not editor...
1581 _this.allow_edit =false;
1584 if ( this.el.has_entry ) {
1587 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1592 // this.get('/LeftPanel.model').activePath = path;
1593 _this.model.el.get_value(iter,3, out gval);
1596 var val = (string)gval;
1597 var combo = (Gtk.ComboBox)editable;
1599 var entry = (Gtk.Entry) combo.get_child();
1600 entry.set_text(val);
1604 this.el.edited.connect( (path, newtext) => {
1605 GLib.debug("Valrender - signal:edited\n");
1607 this.el.editable = false;
1612 2, "<b>" + miter.get_key() + "</b>",
1613 3, miter.get_value(),
1614 4, display_value(short);
1620 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1623 _this.model.el.get_value(iter,0, out gval);
1624 var ktype = (string)gval;
1627 _this.model.el.get_value(iter,3, out gval);
1628 var oldval = (string)gval;
1630 _this.model.el.get_value(iter,1, out gval);
1631 var key = (string)gval;
1637 _this.node.listeners.set(key, newtext);
1638 _this.updateIter(iter,ktype,key,newtext);
1641 _this.node.props.set(key,newtext);
1642 _this.updateIter(iter,ktype, key,newtext);
1645 // _this.load(_this.file,_this.node);
1651 // user defined functions
1652 public void setOptions (string[] ar) {
1653 var m = _this.valrendermodel.el;
1656 for (var i =0; i < ar.length; i++) {
1658 m.set_value(iret, 0, ar[i]);
1663 public class Xcls_valrendermodel : Object
1665 public Gtk.ListStore el;
1666 private Xcls_LeftProps _this;
1672 public Xcls_valrendermodel(Xcls_LeftProps _owner )
1675 _this.valrendermodel = this;
1676 this.el = new Gtk.ListStore();
1681 // user defined functions
1686 public class Xcls_ContextMenu : Object
1689 private Xcls_LeftProps _this;
1695 public Xcls_ContextMenu(Xcls_LeftProps _owner )
1698 _this.ContextMenu = this;
1699 this.el = new Gtk.Menu();
1702 var child_0 = new Xcls_MenuItem34( _this );
1704 this.el.append ( child_0.el );
1705 var child_1 = new Xcls_SeparatorMenuItem35( _this );
1707 this.el.append ( child_1.el );
1708 var child_2 = new Xcls_MenuItem36( _this );
1710 this.el.append ( child_2.el );
1713 // user defined functions
1715 public class Xcls_MenuItem34 : Object
1717 public Gtk.MenuItem el;
1718 private Xcls_LeftProps _this;
1724 public Xcls_MenuItem34(Xcls_LeftProps _owner )
1727 this.el = new Gtk.MenuItem();
1732 this.el.activate.connect( ( ) =>{
1734 var s = _this.view.el.get_selection();
1737 s.get_selected (out mod, out iter);
1739 if (_this.view.popover == null) {
1740 _this.view.popover = new Xcls_PopoverProperty();
1741 _this.view.popover.mainwindow = _this.main_window;
1745 _this.before_edit();
1746 _this.stop_editor();
1748 _this.keyrender.el.stop_editing(false);
1749 _this.keyrender.el.editable =false;
1751 _this.valrender.el.stop_editing(false);
1752 _this.valrender.el.editable =false;
1755 GLib.Value gvaltype, gval;
1756 mod.get_value(iter, 1 , out gval); // one is key..
1758 mod.get_value(iter,0, out gvaltype);
1760 _this.view.popover.show(_this.view.el, _this.node, (string)gvaltype, (string)gval);
1764 // _this.startEditingKey(model.get_path(iter));
1768 // user defined functions
1771 public class Xcls_SeparatorMenuItem35 : Object
1773 public Gtk.SeparatorMenuItem el;
1774 private Xcls_LeftProps _this;
1780 public Xcls_SeparatorMenuItem35(Xcls_LeftProps _owner )
1783 this.el = new Gtk.SeparatorMenuItem();
1788 // user defined functions
1791 public class Xcls_MenuItem36 : Object
1793 public Gtk.MenuItem el;
1794 private Xcls_LeftProps _this;
1800 public Xcls_MenuItem36(Xcls_LeftProps _owner )
1803 this.el = new Gtk.MenuItem();
1808 this.el.activate.connect( ( ) =>{
1809 _this.deleteSelected();
1813 // user defined functions