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.VBox( false , 0 );
43 this.allow_edit = false;
44 this.main_window = null;
47 var child_0 = new Xcls_HBox2( _this );
49 this.el.pack_start ( child_0.el , false,true,0 );
50 var child_1 = new Xcls_EditProps( _this );
52 this.el.pack_end ( child_1.el , true,true,0 );
55 // user defined functions
56 public void before_edit ()
59 print("before edit - stop editing\n");
61 // these do not appear to trigger save...
62 _this.keyrender.el.stop_editing(false);
63 _this.keyrender.el.editable =false;
65 _this.valrender.el.stop_editing(false);
66 _this.valrender.el.editable =false;
69 // technicall stop the popup editor..
72 public string keySortFormat (string key) {
73 // listeners first - with 0
80 var bits = key.split(" ");
83 return "2 " + bits[bits.length -1];
87 return "3 " + bits[bits.length -1];
92 return "4 " + bits[bits.length -1];
95 return "5 " + bits[bits.length -1];
100 public void finish_editing () {
104 public bool startEditingValue ( Gtk.TreePath path) {
106 // ONLY return true if editing is allowed - eg. combo..
108 print("start editing?\n");
109 if (!this.stop_editor()) {
110 print("stop editor failed\n");
116 var mod = this.model.el;
117 mod.get_iter (out iter, path);
123 2, "<b>" + miter.get_key() + "</b>",
129 mod.get_value(iter, 3 , out gval);
130 var val = (string)gval;
132 mod.get_value(iter, 1 , out gval);
133 var key = (string)gval;
134 var type_ar = key.split(" ");
138 mod.get_value(iter, 0 , out gval);
139 var type = (string)gval;
143 var use_textarea = false;
145 //------------ things that require the text editor...
147 if (type == "listener") {
150 if (key.length > 0 && key[0] == '|') { // user defined method
153 if (key.length > 0 && key[0] == '$') { // raw string
156 if (key.length > 0 && key == "* init") {
159 if (val.length > 40) { // long value...
166 print("Call show editor\n");
167 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
168 this.view.el.get_selection().select_path(path);
170 this.show_editor(file, node, type, key);
178 // others... - fill in options for true/false?
179 print("turn on editing %s \n" , mod.get_path(iter).to_string());
181 print (type_ar[0].up());
182 if (type_ar.length > 1 && (
183 type_ar[0].up() == "BOOLEAN"
185 type_ar[0].up() == "BOOL"
187 print("start editing try/false)???");
188 this.valrender.el.has_entry = false;
189 string[] opts = { "true", "false" };
190 this.valrender.setOptions(opts);
192 this.valrender.el.has_entry = false;
193 this.valrender.el.editable = true;
194 this.allow_edit = true;
195 GLib.Timeout.add_full(GLib.Priority.DEFAULT,100 , () => {
196 this.view.el.set_cursor_on_cell(
210 this.valrender.setOptions(opts);
212 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
214 // at this point - work out the type...
215 // if its' a combo... then show the options..
216 this.valrender.el.has_entry = true;
218 this.valrender.el.editable = true;
221 this.allow_edit = true;
227 this.view.el.set_cursor_on_cell(
237 public void load (JsRender.JsRender file, JsRender.Node? node)
239 print("load leftprops\n");
245 this.model.el.clear();
247 //this.get('/RightEditor').el.hide();
254 //var provider = this.get('/LeftTree').getPaleteProvider();
257 //typeof(string), // 0 key type
258 //typeof(string), // 1 key
259 //typeof(string), // 2 key (display)
260 //typeof(string), // 3 value
261 //typeof(string), // 4 value (display)
262 //typeof(string), // 5 both (tooltip)
267 // really need a way to sort the hashmap...
268 var m = this.model.el;
270 var miter = node.listeners.map_iterator();
273 while(miter.next()) {
275 m.append(out iter,null);
277 this.updateIter(iter, "listener", miter.get_key(), miter.get_value());
283 miter = node.props.map_iterator();
286 while(miter.next()) {
288 m.append(out iter,null);
289 this.updateIter(iter, "prop", miter.get_key(), miter.get_value());
292 print("clear selection\n");
294 this.model.el.set_sort_column_id(6,Gtk.SortType.ASCENDING); // sort by real key..
296 this.view.el.get_selection().unselect_all();
298 var pane = _this.main_window.editpane.el;
299 var try_size = (i * 25) + 60; // est. 20px per line + 40px header
303 ((try_size * 1.0f) / (pane.max_position * 1.0f)) > 0.8f ?
304 (int) (pane.max_position * 0.2f) :
305 pane.max_position-try_size);
309 public string keyFormat (string val, string type) {
311 // Glib.markup_escape_text(val);
313 if (type == "listener") {
314 return "<span font_weight=\"bold\" color=\"#660000\">" +
315 GLib.Markup.escape_text(val) +
319 if (val.length < 1) {
320 return "<span color=\"#FF0000\">--empty--</span>";
325 //# - object properties
327 // all of these... - display value is last element..
328 var ar = val.strip().split(" ");
331 var dval = GLib.Markup.escape_text(ar[ar.length-1]);
337 case '@': // signal // just bold balck?
338 if (dval[0] == '@') {
339 dval = dval.substring(1);
342 return @"<span font_weight=\"bold\">@ $dval</span>";
343 case '#': // object properties?
344 if (dval[0] == '#') {
345 dval = dval.substring(1);
347 return @"<span font_weight=\"bold\">$dval</span>";
349 if (dval[0] == '*') {
350 dval = dval.substring(1);
352 return @"<span color=\"#0000CC\" font_weight=\"bold\">$dval</span>";
354 if (dval[0] == '$') {
355 dval = dval.substring(1);
357 return @"<span style=\"italic\">$dval</span>";
358 case '|': // user defined methods
359 if (dval[0] == '|') {
360 dval = dval.substring(1);
362 return @"<span color=\"#008000\" font_weight=\"bold\">$dval</span>";
373 public void deleteSelected () {
378 var s = this.view.el.get_selection();
379 s.get_selected(out mod, out iter);
383 mod.get_value(iter, 0 , out gval);
384 var type = (string)gval;
386 mod.get_value(iter, 1 , out gval);
387 var key = (string)gval;
391 this.node.listeners.remove(key);
395 this.node.props.remove(key);
398 this.load(this.file, this.node);
402 public void startEditingKey ( Gtk.TreePath path) {
404 if (!this.stop_editor()) {
408 // others... - fill in options for true/false?
411 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
412 this.allow_edit = true;
413 this.keyrender.el.editable = true;
415 this.view.el.set_cursor_on_cell(
427 public void addProp (string in_type, string key, string value, string value_type) {
428 // info includes key, val, skel, etype..
429 //console.dump(info);
430 //type = info.type.toLowerCase();
431 //var data = this.toJS();
433 var type = in_type == "signals" ? "listener" : in_type;
435 var fkey = (value_type.length > 0 ? value_type + " " : "") + key;
437 if (type == "listener") {
438 if (this.node.listeners.has_key(key)) {
441 this.node.listeners.set(key,value);
444 if (this.node.props.has_key(fkey)) {
447 this.node.props.set(fkey,value);
452 this.load(this.file, this.node);
456 /// need to find the row which I've just added..
459 var s = this.view.el.get_selection();
462 print("trying to find new iter");
464 this.model.el.foreach((model, path, iter) => {
467 this.model.el.get_value(iter, 0 , out gval);
468 if ((string)gval != type) {
469 print("not type: %s = %s\n", (string)gval , type);
472 this.model.el.get_value(iter, 1 , out gval);
473 if ((string)gval != fkey) {
474 print("not key: %s = %s\n", (string)gval , fkey);
478 GLib.Timeout.add_full(GLib.Priority.DEFAULT,40 , () => {
480 this.startEditingValue(this.model.el.get_path(iter));
483 //s.select_iter(iter);
491 public void updateIter (Gtk.TreeIter iter, string type, string key, string value) {
493 print("update Iter %s, %s\n", key,value);
494 //typeof(string), // 0 key type
495 //typeof(string), // 1 key
496 //typeof(string), // 2 key (display)
497 //typeof(string), // 3 value
498 //typeof(string), // 4 value (display)
499 //typeof(string), // 5 both (tooltip)
500 //typeof(string), // 6 key (sort)
502 var dl = value.strip().split("\n");
504 var dis_val = dl.length > 1 ? (dl[0].strip()+ "...") : dl[0];
506 if (type == "listener") {
510 this.model.el.set(iter,
513 2, this.keyFormat(key ,type),
516 5, "<tt>" + GLib.Markup.escape_text(key + " " +value) + "</tt>",
524 this.model.el.set(iter,
527 2, this.keyFormat(key , "prop"),
530 5, "<tt>" + GLib.Markup.escape_text(key + " " + value) + "</tt>",
531 6, this.keySortFormat(key)
534 public class Xcls_HBox2 : Object
537 private Xcls_LeftProps _this;
543 public Xcls_HBox2(Xcls_LeftProps _owner )
546 this.el = new Gtk.HBox( true, 0 );
550 // set gobject values
551 var child_0 = new Xcls_Button3( _this );
553 this.el.add ( child_0.el );
556 // user defined functions
558 public class Xcls_Button3 : Object
560 public Gtk.Button el;
561 private Xcls_LeftProps _this;
567 public Xcls_Button3(Xcls_LeftProps _owner )
570 this.el = new Gtk.Button();
574 // set gobject values
575 var child_0 = new Xcls_HBox4( _this );
577 this.el.add ( child_0.el );
578 var child_1 = new Xcls_AddPropertyPopup( _this );
582 this.el.button_press_event.connect( (self, ev) => {
586 var p = _this.AddPropertyPopup;
587 p.el.set_screen(Gdk.Screen.get_default());
589 p.el.popup(null, null, null, ev.button, ev.time);
594 // user defined functions
596 public class Xcls_HBox4 : Object
599 private Xcls_LeftProps _this;
605 public Xcls_HBox4(Xcls_LeftProps _owner )
608 this.el = new Gtk.HBox( true, 0 );
612 // set gobject values
613 var child_0 = new Xcls_Image5( _this );
615 this.el.add ( child_0.el );
616 var child_1 = new Xcls_Label6( _this );
618 this.el.add ( child_1.el );
621 // user defined functions
623 public class Xcls_Image5 : Object
626 private Xcls_LeftProps _this;
632 public Xcls_Image5(Xcls_LeftProps _owner )
635 this.el = new Gtk.Image();
639 // set gobject values
640 this.el.stock = Gtk.STOCK_ADD;
641 this.el.icon_size = Gtk.IconSize.MENU;
644 // user defined functions
646 public class Xcls_Label6 : Object
649 private Xcls_LeftProps _this;
655 public Xcls_Label6(Xcls_LeftProps _owner )
658 this.el = new Gtk.Label( "Other" );
662 // set gobject values
665 // user defined functions
667 public class Xcls_AddPropertyPopup : Object
670 private Xcls_LeftProps _this;
676 public Xcls_AddPropertyPopup(Xcls_LeftProps _owner )
679 _this.AddPropertyPopup = this;
680 this.el = new Gtk.Menu();
684 // set gobject values
685 var child_0 = new Xcls_MenuItem8( _this );
687 this.el.append ( child_0.el );
688 var child_1 = new Xcls_MenuItem9( _this );
690 this.el.append ( child_1.el );
691 var child_2 = new Xcls_MenuItem10( _this );
693 this.el.append ( child_2.el );
694 var child_3 = new Xcls_MenuItem11( _this );
696 this.el.append ( child_3.el );
697 var child_4 = new Xcls_SeparatorMenuItem12( _this );
699 this.el.add ( child_4.el );
700 var child_5 = new Xcls_MenuItem13( _this );
702 this.el.append ( child_5.el );
703 var child_6 = new Xcls_MenuItem14( _this );
705 this.el.append ( child_6.el );
706 var child_7 = new Xcls_MenuItem15( _this );
708 this.el.append ( child_7.el );
709 var child_8 = new Xcls_SeparatorMenuItem16( _this );
711 this.el.add ( child_8.el );
712 var child_9 = new Xcls_MenuItem17( _this );
714 this.el.append ( child_9.el );
715 var child_10 = new Xcls_MenuItem18( _this );
717 this.el.append ( child_10.el );
718 var child_11 = new Xcls_MenuItem19( _this );
720 this.el.append ( child_11.el );
721 var child_12 = new Xcls_SeparatorMenuItem20( _this );
723 this.el.add ( child_12.el );
724 var child_13 = new Xcls_MenuItem21( _this );
726 this.el.append ( child_13.el );
727 var child_14 = new Xcls_MenuItem22( _this );
729 this.el.append ( child_14.el );
732 // user defined functions
734 public class Xcls_MenuItem8 : Object
736 public Gtk.MenuItem el;
737 private Xcls_LeftProps _this;
743 public Xcls_MenuItem8(Xcls_LeftProps _owner )
746 this.el = new Gtk.MenuItem();
750 // set gobject values
751 this.el.tooltip_markup = "Using _this.{ID} will map to this element";
752 this.el.label = "id: _this.{ID} (Vala)";
755 this.el.activate.connect( () => {
756 _this.addProp( "prop", "id", "", "");
760 // user defined functions
762 public class Xcls_MenuItem9 : Object
764 public Gtk.MenuItem el;
765 private Xcls_LeftProps _this;
771 public Xcls_MenuItem9(Xcls_LeftProps _owner )
774 this.el = new Gtk.MenuItem();
778 // set gobject values
779 this.el.tooltip_markup = "how to pack this element onto parent, (method, 2nd arg, 3rd arg) .. the 1st argument is filled by the element";
780 this.el.label = "pack: Pack method (Vala)";
783 this.el.activate.connect( ( ) => {
785 _this.addProp( "prop", "pack","add", "*");
789 // user defined functions
791 public class Xcls_MenuItem10 : Object
793 public Gtk.MenuItem el;
794 private Xcls_LeftProps _this;
800 public Xcls_MenuItem10(Xcls_LeftProps _owner )
803 this.el = new Gtk.MenuItem();
807 // set gobject values
808 this.el.tooltip_markup = "eg. \n\nnew Clutter.Image.from_file(.....)";
809 this.el.label = "ctor: Alterative to default contructor";
812 this.el.activate.connect( ( ) => {
814 _this.addProp( "prop", "ctor","", "*");
818 // user defined functions
820 public class Xcls_MenuItem11 : Object
822 public Gtk.MenuItem el;
823 private Xcls_LeftProps _this;
829 public Xcls_MenuItem11(Xcls_LeftProps _owner )
832 this.el = new Gtk.MenuItem();
836 // set gobject values
837 this.el.tooltip_markup = "This code is called after the ctor";
838 this.el.label = "init: initialziation code (vala)";
841 this.el.activate.connect( ( ) => {
843 _this.addProp( "prop", "init", "{\n\n}\n", "*" );
847 // user defined functions
849 public class Xcls_SeparatorMenuItem12 : Object
851 public Gtk.SeparatorMenuItem el;
852 private Xcls_LeftProps _this;
858 public Xcls_SeparatorMenuItem12(Xcls_LeftProps _owner )
861 this.el = new Gtk.SeparatorMenuItem();
865 // set gobject values
868 // user defined functions
870 public class Xcls_MenuItem13 : Object
872 public Gtk.MenuItem el;
873 private Xcls_LeftProps _this;
879 public Xcls_MenuItem13(Xcls_LeftProps _owner )
882 this.el = new Gtk.MenuItem();
886 // set gobject values
887 this.el.tooltip_markup = "Add a user defined string property";
888 this.el.label = "String";
891 this.el.activate.connect( (self) => {
893 _this.addProp( "prop", "XXXX", "","string");
898 // user defined functions
900 public class Xcls_MenuItem14 : Object
902 public Gtk.MenuItem el;
903 private Xcls_LeftProps _this;
909 public Xcls_MenuItem14(Xcls_LeftProps _owner )
912 this.el = new Gtk.MenuItem();
916 // set gobject values
917 this.el.tooltip_markup = "Add a user defined number property";
918 this.el.label = "Number";
921 this.el.activate.connect( ( ) =>{
923 _this.addProp("prop", "XXX", "0", "int");
927 // user defined functions
929 public class Xcls_MenuItem15 : Object
931 public Gtk.MenuItem el;
932 private Xcls_LeftProps _this;
938 public Xcls_MenuItem15(Xcls_LeftProps _owner )
941 this.el = new Gtk.MenuItem();
945 // set gobject values
946 this.el.tooltip_markup = "Add a user defined boolean property";
947 this.el.label = "Boolean";
950 this.el.activate.connect( ( ) =>{
952 _this.addProp( "prop", "XXX", "true", "bool");
956 // user defined functions
958 public class Xcls_SeparatorMenuItem16 : Object
960 public Gtk.SeparatorMenuItem el;
961 private Xcls_LeftProps _this;
967 public Xcls_SeparatorMenuItem16(Xcls_LeftProps _owner )
970 this.el = new Gtk.SeparatorMenuItem();
974 // set gobject values
977 // user defined functions
979 public class Xcls_MenuItem17 : Object
981 public Gtk.MenuItem el;
982 private Xcls_LeftProps _this;
988 public Xcls_MenuItem17(Xcls_LeftProps _owner )
991 this.el = new Gtk.MenuItem();
995 // set gobject values
996 this.el.tooltip_markup = "Add a user function boolean property";
997 this.el.label = "Javascript Function";
1000 this.el.activate.connect( ( ) =>{
1002 _this.addProp("prop", "XXXX", "function() { }", "| function");
1006 // user defined functions
1008 public class Xcls_MenuItem18 : Object
1010 public Gtk.MenuItem el;
1011 private Xcls_LeftProps _this;
1017 public Xcls_MenuItem18(Xcls_LeftProps _owner )
1020 this.el = new Gtk.MenuItem();
1024 // set gobject values
1025 this.el.tooltip_markup = "Add a user function boolean property";
1026 this.el.label = "Vala Method";
1029 this.el.activate.connect( ( ) =>{
1031 _this.addProp( "prop", "XXXX", "() {\n\n}\n", "| return_type");
1035 // user defined functions
1037 public class Xcls_MenuItem19 : Object
1039 public Gtk.MenuItem el;
1040 private Xcls_LeftProps _this;
1046 public Xcls_MenuItem19(Xcls_LeftProps _owner )
1049 this.el = new Gtk.MenuItem();
1053 // set gobject values
1054 this.el.tooltip_markup = "Add a vala signal";
1055 this.el.label = "Vala Signal";
1058 this.el.activate.connect( ( ) =>{
1060 _this.addProp( "prop", "XXXX", "()", "@ void");
1064 // user defined functions
1066 public class Xcls_SeparatorMenuItem20 : Object
1068 public Gtk.SeparatorMenuItem el;
1069 private Xcls_LeftProps _this;
1075 public Xcls_SeparatorMenuItem20(Xcls_LeftProps _owner )
1078 this.el = new Gtk.SeparatorMenuItem();
1082 // set gobject values
1085 // user defined functions
1087 public class Xcls_MenuItem21 : Object
1089 public Gtk.MenuItem el;
1090 private Xcls_LeftProps _this;
1096 public Xcls_MenuItem21(Xcls_LeftProps _owner )
1099 this.el = new Gtk.MenuItem();
1103 // set gobject values
1104 this.el.tooltip_markup = "Add a flexy if (for HTML templates)";
1105 this.el.label = "Flexy - If";
1108 this.el.activate.connect( ( ) =>{
1110 _this.addProp("prop", "flexy:if", "array,key,value", "string");
1114 // user defined functions
1116 public class Xcls_MenuItem22 : Object
1118 public Gtk.MenuItem el;
1119 private Xcls_LeftProps _this;
1125 public Xcls_MenuItem22(Xcls_LeftProps _owner )
1128 this.el = new Gtk.MenuItem();
1132 // set gobject values
1133 this.el.tooltip_markup = "Add a flexy foreach (for HTML templates)";
1134 this.el.label = "Flexy - Foreach";
1137 this.el.activate.connect( ( ) =>{
1139 _this.addProp("prop", "flexy:foreach", "array,key,value", "string");
1143 // user defined functions
1145 public class Xcls_EditProps : Object
1147 public Gtk.ScrolledWindow el;
1148 private Xcls_LeftProps _this;
1152 public bool editing;
1155 public Xcls_EditProps(Xcls_LeftProps _owner )
1158 _this.EditProps = this;
1159 this.el = new Gtk.ScrolledWindow( null, null );
1162 this.editing = false;
1164 // set gobject values
1165 this.el.shadow_type = Gtk.ShadowType.IN;
1166 var child_0 = new Xcls_view( _this );
1168 this.el.add ( child_0.el );
1174 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
1178 // user defined functions
1180 public class Xcls_view : Object
1182 public Gtk.TreeView el;
1183 private Xcls_LeftProps _this;
1189 public Xcls_view(Xcls_LeftProps _owner )
1193 this.el = new Gtk.TreeView();
1197 // set gobject values
1198 this.el.tooltip_column = 5;
1199 this.el.enable_tree_lines = true;
1200 this.el.headers_visible = true;
1201 var child_0 = new Xcls_model( _this );
1203 this.el.set_model ( child_0.el );
1204 var child_1 = new Xcls_keycol( _this );
1206 this.el.append_column ( child_1.el );
1207 var child_2 = new Xcls_valcol( _this );
1209 this.el.append_column ( child_2.el );
1210 var child_3 = new Xcls_ContextMenu( _this );
1216 var selection = this.el.get_selection();
1217 selection.set_mode( Gtk.SelectionMode.SINGLE);
1220 var description = new Pango.FontDescription();
1221 description.set_size(8000);
1222 this.el.modify_font(description);
1226 this.el.button_press_event.connect( ( ev) => {
1228 Gtk.TreeViewColumn col;
1232 if (!this.el.get_path_at_pos((int)ev.x, (int) ev.y, out path, out col, out cell_x, out cell_y )) {
1233 print("nothing selected on click");
1234 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
1235 this.el.get_selection().unselect_all();
1239 _this.before_edit();
1240 return false; //not on a element.
1245 if (ev.type == Gdk.EventType.2BUTTON_PRESS && ev.button == 1 && col.title == "Name") {
1249 _this.before_edit();
1251 _this.keyrender.el.stop_editing(false);
1252 _this.keyrender.el.editable =false;
1254 _this.valrender.el.stop_editing(false);
1255 _this.valrender.el.editable =false;
1257 _this.startEditingKey(path);
1266 if (ev.type == Gdk.EventType.BUTTON_PRESS && ev.button == 3) {
1268 //if (col.title == "Value") {
1269 // _this.before_edit();
1273 var p = _this.ContextMenu;
1275 p.el.set_screen(Gdk.Screen.get_default());
1277 p.el.popup(null, null, null, ev.button, ev.time);
1278 //Seed.print("click:" + res.column.title);
1280 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
1282 this.el.get_selection().select_path(path);
1285 _this.before_edit();
1290 if (col.title != "Value") {
1291 print("col title != Value");
1293 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
1294 this.el.get_selection().select_path(path);
1298 _this.before_edit();
1299 // XObject.error("column is not value?");
1300 return false; // ignore.. - key click.. ??? should we do this??
1304 // if the cell can be edited with a pulldown
1305 // then we should return true... - and let the start_editing handle it?
1312 // _this.before_edit(); <<< we really need to stop the other editor..
1313 _this.keyrender.el.stop_editing(false);
1314 _this.keyrender.el.editable =false;
1317 return _this.startEditingValue(path); // assumes selected row..
1326 // user defined functions
1328 public class Xcls_model : Object
1330 public Gtk.TreeStore el;
1331 private Xcls_LeftProps _this;
1337 public Xcls_model(Xcls_LeftProps _owner )
1341 this.el = new Gtk.TreeStore( 7, typeof(string), // 0 key type
1342 typeof(string), // 1 key
1343 typeof(string), // 2 key (display)
1344 typeof(string), // 3 value
1345 typeof(string), // 4 value (display)
1346 typeof(string), // 5 both (tooltip)
1347 typeof(string) // 6 key (for sorting)
1352 // set gobject values
1355 // user defined functions
1357 public class Xcls_keycol : Object
1359 public Gtk.TreeViewColumn el;
1360 private Xcls_LeftProps _this;
1366 public Xcls_keycol(Xcls_LeftProps _owner )
1369 _this.keycol = this;
1370 this.el = new Gtk.TreeViewColumn();
1374 // set gobject values
1375 this.el.title = "Name";
1376 this.el.resizable = true;
1377 var child_0 = new Xcls_keyrender( _this );
1379 this.el.pack_start ( child_0.el , false );
1383 this.el.add_attribute(_this.keyrender.el , "markup", 2 );
1384 this.el.add_attribute(_this.keyrender.el , "text", 1 );
1387 // user defined functions
1389 public class Xcls_keyrender : Object
1391 public Gtk.CellRendererText el;
1392 private Xcls_LeftProps _this;
1398 public Xcls_keyrender(Xcls_LeftProps _owner )
1401 _this.keyrender = this;
1402 this.el = new Gtk.CellRendererText();
1406 // set gobject values
1409 this.el.editing_started.connect( ( editable, path) => {
1412 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1417 // this.get('/LeftPanel.model').activePath = path;
1418 _this.model.el.get_value(iter,1, out gval);
1419 var val = (string)gval;
1421 ((Gtk.Entry)editable).set_text(val);
1423 this.el.edited.connect( (path, newtext) => {
1424 print("Keyrender - signal:edited\n");
1426 this.el.editable = false;
1431 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1434 _this.model.el.get_value(iter,1, out gval);
1435 var oldval = (string)gval;
1437 _this.model.el.get_value(iter,0, out gval);
1438 var ktype = (string)gval;
1440 _this.model.el.set_value(iter, 1, newtext);
1442 if (oldval == newtext) {
1447 print("ktype: %s\n",ktype);
1450 var ov = _this.node.listeners.get(oldval);
1451 _this.node.listeners.set(newtext, ov);
1452 _this.node.listeners.remove(oldval);
1454 _this.updateIter(iter, ktype, newtext, ov);
1458 var ov = _this.node.props.get(oldval);
1459 _this.node.props.set(newtext, ov);
1460 _this.node.props.remove(oldval);
1461 _this.updateIter(iter, ktype, newtext, ov);
1469 // user defined functions
1471 public class Xcls_valcol : Object
1473 public Gtk.TreeViewColumn el;
1474 private Xcls_LeftProps _this;
1480 public Xcls_valcol(Xcls_LeftProps _owner )
1483 _this.valcol = this;
1484 this.el = new Gtk.TreeViewColumn();
1488 // set gobject values
1489 this.el.title = "Value";
1490 this.el.resizable = true;
1491 var child_0 = new Xcls_valrender( _this );
1493 this.el.pack_start ( child_0.el , true );
1499 // typeof(string), // 0 key type
1500 // typeof(string), // 1 key
1501 // typeof(string), // 2 key (display)
1502 // typeof(string), // 3 value
1503 // typeof(string) // 4 value (display)
1506 this.el.add_attribute(_this.valrender.el , "text", 4 );
1507 //this.el.add_attribute(_this.valrender.el , "sensitive", 4 );
1508 //this.el.add_attribute(this.items[0].el , 'editable', 3 );
1509 // this.el.set_cell_data_func(cell, age_cell_data_func, NULL, NULL);
1511 // this.get('/LeftPanel').editableColumn= this;
1515 // user defined functions
1517 public class Xcls_valrender : Object
1519 public Gtk.CellRendererCombo el;
1520 private Xcls_LeftProps _this;
1526 public Xcls_valrender(Xcls_LeftProps _owner )
1529 _this.valrender = this;
1530 this.el = new Gtk.CellRendererCombo();
1534 // set gobject values
1535 this.el.editable = false;
1536 this.el.text_column = 0;
1537 this.el.has_entry = true;
1538 var child_0 = new Xcls_valrendermodel( _this );
1540 this.el.model = child_0.el;
1543 this.el.editing_started.connect( ( editable, path) => {
1544 //_this.editing = true;
1545 print("editing started called\n");
1546 if (!_this.allow_edit) {
1548 print("val - editing_Started\n");
1549 this.el.editable = false; // make sure it's not editor...
1554 _this.allow_edit =false;
1557 if ( this.el.has_entry ) {
1560 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1565 // this.get('/LeftPanel.model').activePath = path;
1566 _this.model.el.get_value(iter,3, out gval);
1569 var val = (string)gval;
1570 var combo = (Gtk.ComboBox)editable;
1572 var entry = (Gtk.Entry) combo.get_child();
1573 entry.set_text(val);
1577 this.el.edited.connect( (path, newtext) => {
1578 print("Valrender - signal:edited\n");
1580 this.el.editable = false;
1585 2, "<b>" + miter.get_key() + "</b>",
1586 3, miter.get_value(),
1587 4, display_value(short);
1593 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1596 _this.model.el.get_value(iter,0, out gval);
1597 var ktype = (string)gval;
1600 _this.model.el.get_value(iter,3, out gval);
1601 var oldval = (string)gval;
1603 _this.model.el.get_value(iter,1, out gval);
1604 var key = (string)gval;
1610 _this.node.listeners.set(key, newtext);
1611 _this.updateIter(iter,ktype,key,newtext);
1614 _this.node.props.set(key,newtext);
1615 _this.updateIter(iter,ktype, key,newtext);
1618 // _this.load(_this.file,_this.node);
1624 // user defined functions
1625 public void setOptions (string[] ar) {
1626 var m = _this.valrendermodel.el;
1629 for (var i =0; i < ar.length; i++) {
1631 m.set_value(iret, 0, ar[i]);
1636 public class Xcls_valrendermodel : Object
1638 public Gtk.ListStore el;
1639 private Xcls_LeftProps _this;
1645 public Xcls_valrendermodel(Xcls_LeftProps _owner )
1648 _this.valrendermodel = this;
1649 this.el = new Gtk.ListStore( 1, typeof(string) );
1653 // set gobject values
1656 // user defined functions
1658 public class Xcls_ContextMenu : Object
1661 private Xcls_LeftProps _this;
1667 public Xcls_ContextMenu(Xcls_LeftProps _owner )
1670 _this.ContextMenu = this;
1671 this.el = new Gtk.Menu();
1675 // set gobject values
1676 var child_0 = new Xcls_MenuItem32( _this );
1678 this.el.append ( child_0.el );
1679 var child_1 = new Xcls_SeparatorMenuItem33( _this );
1681 this.el.append ( child_1.el );
1682 var child_2 = new Xcls_MenuItem34( _this );
1684 this.el.append ( child_2.el );
1687 // user defined functions
1689 public class Xcls_MenuItem32 : Object
1691 public Gtk.MenuItem el;
1692 private Xcls_LeftProps _this;
1698 public Xcls_MenuItem32(Xcls_LeftProps _owner )
1701 this.el = new Gtk.MenuItem();
1705 // set gobject values
1706 this.el.label = "Edit";
1709 this.el.activate.connect( ( ) =>{
1711 var s = _this.view.el.get_selection();
1713 Gtk.TreeModel model;
1714 s.get_selected (out model, out iter);
1715 _this.startEditingKey(model.get_path(iter));
1719 // user defined functions
1721 public class Xcls_SeparatorMenuItem33 : Object
1723 public Gtk.SeparatorMenuItem el;
1724 private Xcls_LeftProps _this;
1730 public Xcls_SeparatorMenuItem33(Xcls_LeftProps _owner )
1733 this.el = new Gtk.SeparatorMenuItem();
1737 // set gobject values
1740 // user defined functions
1742 public class Xcls_MenuItem34 : Object
1744 public Gtk.MenuItem el;
1745 private Xcls_LeftProps _this;
1751 public Xcls_MenuItem34(Xcls_LeftProps _owner )
1754 this.el = new Gtk.MenuItem();
1758 // set gobject values
1759 this.el.label = "Delete";
1762 this.el.activate.connect( ( ) =>{
1763 _this.deleteSelected();
1767 // user defined functions