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 before_edit ()
60 print("before edit - stop editing\n");
62 // these do not appear to trigger save...
63 _this.keyrender.el.stop_editing(false);
64 _this.keyrender.el.editable =false;
66 _this.valrender.el.stop_editing(false);
67 _this.valrender.el.editable =false;
70 // technicall stop the popup editor..
73 public string keySortFormat (string key) {
74 // listeners first - with 0
81 var bits = key.split(" ");
84 return "2 " + bits[bits.length -1];
88 return "3 " + bits[bits.length -1];
93 return "4 " + bits[bits.length -1];
96 return "5 " + bits[bits.length -1];
101 public void finish_editing () {
105 public bool startEditingValue ( Gtk.TreePath path) {
107 // ONLY return true if editing is allowed - eg. combo..
109 print("start editing?\n");
110 if (!this.stop_editor()) {
111 print("stop editor failed\n");
117 var mod = this.model.el;
118 mod.get_iter (out iter, path);
124 2, "<b>" + miter.get_key() + "</b>",
130 mod.get_value(iter, 3 , out gval);
131 var val = (string)gval;
133 mod.get_value(iter, 1 , out gval);
134 var key = (string)gval;
137 string kname, kflag, ktype;
138 this.node.normalize_key(key, out kname, out kflag, out ktype);
141 mod.get_value(iter, 0 , out gval);
142 var type = (string)gval; // listerner or prop..
146 var use_textarea = false;
148 //------------ things that require the text editor...
150 if (type == "listener") {
153 if (key.length > 0 && key[0] == '|') { // user defined method
156 if (key.length > 0 && key[0] == '$') { // raw string
159 if (key.length > 0 && key == "* init") {
162 if (val.length > 40) { // long value...
169 print("Call show editor\n");
170 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
171 this.view.el.get_selection().select_path(path);
173 this.show_editor(file, node, type, key);
182 var pal = Palete.factory(this.file.project.xtype);
185 var has_opts = pal.typeOptions(this.node.fqn(), kname, ktype, out opts);
189 // others... - fill in options for true/false?
190 print("turn on editing %s \n" , mod.get_path(iter).to_string());
194 print("start editing try/false)???");
195 this.valrender.el.has_entry = false;
197 this.valrender.setOptions(opts);
199 this.valrender.el.has_entry = false;
200 this.valrender.el.editable = true;
201 this.allow_edit = true;
202 GLib.Timeout.add_full(GLib.Priority.DEFAULT,100 , () => {
203 this.view.el.set_cursor_on_cell(
214 // see if type is a Enum.
221 this.valrender.setOptions(opts);
223 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
225 // at this point - work out the type...
226 // if its' a combo... then show the options..
227 this.valrender.el.has_entry = true;
229 this.valrender.el.editable = true;
232 this.allow_edit = true;
238 this.view.el.set_cursor_on_cell(
248 public void load (JsRender.JsRender file, JsRender.Node? node)
250 print("load leftprops\n");
256 this.model.el.clear();
258 //this.get('/RightEditor').el.hide();
265 //var provider = this.get('/LeftTree').getPaleteProvider();
268 //typeof(string), // 0 key type
269 //typeof(string), // 1 key
270 //typeof(string), // 2 key (display)
271 //typeof(string), // 3 value
272 //typeof(string), // 4 value (display)
273 //typeof(string), // 5 both (tooltip)
278 // really need a way to sort the hashmap...
279 var m = this.model.el;
281 var miter = node.listeners.map_iterator();
284 while(miter.next()) {
286 m.append(out iter,null);
288 this.updateIter(iter, "listener", miter.get_key(), miter.get_value());
294 miter = node.props.map_iterator();
297 while(miter.next()) {
299 m.append(out iter,null);
300 this.updateIter(iter, "prop", miter.get_key(), miter.get_value());
303 print("clear selection\n");
305 this.model.el.set_sort_column_id(6,Gtk.SortType.ASCENDING); // sort by real key..
307 this.view.el.get_selection().unselect_all();
309 var pane = _this.main_window.editpane.el;
310 var try_size = (i * 25) + 60; // est. 20px per line + 40px header
314 ((try_size * 1.0f) / (pane.max_position * 1.0f)) > 0.8f ?
315 (int) (pane.max_position * 0.2f) :
316 pane.max_position-try_size);
320 public string keyFormat (string val, string type) {
322 // Glib.markup_escape_text(val);
324 if (type == "listener") {
325 return "<span font_weight=\"bold\" color=\"#660000\">" +
326 GLib.Markup.escape_text(val) +
330 if (val.length < 1) {
331 return "<span color=\"#FF0000\">--empty--</span>";
336 //# - object properties
338 // all of these... - display value is last element..
339 var ar = val.strip().split(" ");
342 var dval = GLib.Markup.escape_text(ar[ar.length-1]);
348 case '@': // signal // just bold balck?
349 if (dval[0] == '@') {
350 dval = dval.substring(1);
353 return @"<span font_weight=\"bold\">@ $dval</span>";
354 case '#': // object properties?
355 if (dval[0] == '#') {
356 dval = dval.substring(1);
358 return @"<span font_weight=\"bold\">$dval</span>";
360 if (dval[0] == '*') {
361 dval = dval.substring(1);
363 return @"<span color=\"#0000CC\" font_weight=\"bold\">$dval</span>";
365 if (dval[0] == '$') {
366 dval = dval.substring(1);
368 return @"<span style=\"italic\">$dval</span>";
369 case '|': // user defined methods
370 if (dval[0] == '|') {
371 dval = dval.substring(1);
373 return @"<span color=\"#008000\" font_weight=\"bold\">$dval</span>";
384 public void deleteSelected () {
389 var s = this.view.el.get_selection();
390 s.get_selected(out mod, out iter);
394 mod.get_value(iter, 0 , out gval);
395 var type = (string)gval;
397 mod.get_value(iter, 1 , out gval);
398 var key = (string)gval;
402 this.node.listeners.unset(key);
406 this.node.props.unset(key);
409 this.load(this.file, this.node);
413 public void startEditingKey ( Gtk.TreePath path) {
415 if (!this.stop_editor()) {
419 // others... - fill in options for true/false?
422 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
423 this.allow_edit = true;
424 this.keyrender.el.editable = true;
426 this.view.el.set_cursor_on_cell(
438 public Gtk.TreeIter keyToIter (string ) {
442 m.foreach(((model, path, iter) => {
449 public void addProp (string in_type, string key, string value, string value_type) {
450 // info includes key, val, skel, etype..
451 //console.dump(info);
452 //type = info.type.toLowerCase();
453 //var data = this.toJS();
455 var type = in_type == "signals" ? "listener" : in_type;
457 var fkey = (value_type.length > 0 ? value_type + " " : "") + key;
459 if (type == "listener") {
460 if (this.node.listeners.has_key(key)) {
463 this.node.listeners.set(key,value);
466 if (this.node.props.has_key(fkey)) {
469 this.node.props.set(fkey,value);
474 this.load(this.file, this.node);
478 /// need to find the row which I've just added..
481 var s = this.view.el.get_selection();
484 print("trying to find new iter");
486 this.model.el.foreach((model, path, iter) => {
489 this.model.el.get_value(iter, 0 , out gval);
490 if ((string)gval != type) {
491 print("not type: %s = %s\n", (string)gval , type);
494 this.model.el.get_value(iter, 1 , out gval);
495 if ((string)gval != fkey) {
496 print("not key: %s = %s\n", (string)gval , fkey);
500 GLib.Timeout.add_full(GLib.Priority.DEFAULT,40 , () => {
502 this.startEditingValue(this.model.el.get_path(iter));
505 //s.select_iter(iter);
513 public void updateIter (Gtk.TreeIter iter, string type, string key, string value) {
515 print("update Iter %s, %s\n", key,value);
516 //typeof(string), // 0 key type
517 //typeof(string), // 1 key
518 //typeof(string), // 2 key (display)
519 //typeof(string), // 3 value
520 //typeof(string), // 4 value (display)
521 //typeof(string), // 5 both (tooltip)
522 //typeof(string), // 6 key (sort)
524 var dl = value.strip().split("\n");
526 var dis_val = dl.length > 1 ? (dl[0].strip()+ "...") : dl[0];
528 if (type == "listener") {
532 this.model.el.set(iter,
535 2, this.keyFormat(key ,type),
538 5, "<tt>" + GLib.Markup.escape_text(key + " " +value) + "</tt>",
546 this.model.el.set(iter,
549 2, this.keyFormat(key , "prop"),
552 5, "<tt>" + GLib.Markup.escape_text(key + " " + value) + "</tt>",
553 6, this.keySortFormat(key)
556 public class Xcls_Box2 : Object
559 private Xcls_LeftProps _this;
565 public Xcls_Box2(Xcls_LeftProps _owner )
568 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
572 // set gobject values
573 var child_0 = new Xcls_Button3( _this );
575 this.el.add ( child_0.el );
578 // user defined functions
580 public class Xcls_Button3 : Object
582 public Gtk.Button el;
583 private Xcls_LeftProps _this;
589 public Xcls_Button3(Xcls_LeftProps _owner )
592 this.el = new Gtk.Button();
596 // set gobject values
597 this.el.hexpand = true;
598 var child_0 = new Xcls_Box4( _this );
600 this.el.add ( child_0.el );
601 var child_1 = new Xcls_AddPropertyPopup( _this );
605 this.el.button_press_event.connect( (self, ev) => {
609 var p = _this.AddPropertyPopup;
610 p.el.set_screen(Gdk.Screen.get_default());
612 p.el.popup(null, null, null, ev.button, ev.time);
617 // user defined functions
619 public class Xcls_Box4 : Object
622 private Xcls_LeftProps _this;
628 public Xcls_Box4(Xcls_LeftProps _owner )
631 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
635 // set gobject values
636 var child_0 = new Xcls_Image5( _this );
638 this.el.add ( child_0.el );
639 var child_1 = new Xcls_Label6( _this );
641 this.el.add ( child_1.el );
644 // user defined functions
646 public class Xcls_Image5 : Object
649 private Xcls_LeftProps _this;
655 public Xcls_Image5(Xcls_LeftProps _owner )
658 this.el = new Gtk.Image();
662 // set gobject values
663 this.el.stock = Gtk.Stock.ADD;
664 this.el.icon_size = Gtk.IconSize.MENU;
667 // user defined functions
670 public class Xcls_Label6 : Object
673 private Xcls_LeftProps _this;
679 public Xcls_Label6(Xcls_LeftProps _owner )
682 this.el = new Gtk.Label( "Other" );
686 // set gobject values
689 // user defined functions
693 public class Xcls_AddPropertyPopup : Object
696 private Xcls_LeftProps _this;
702 public Xcls_AddPropertyPopup(Xcls_LeftProps _owner )
705 _this.AddPropertyPopup = this;
706 this.el = new Gtk.Menu();
710 // set gobject values
711 var child_0 = new Xcls_MenuItem8( _this );
713 this.el.append ( child_0.el );
714 var child_1 = new Xcls_MenuItem9( _this );
716 this.el.append ( child_1.el );
717 var child_2 = new Xcls_MenuItem10( _this );
719 this.el.append ( child_2.el );
720 var child_3 = new Xcls_MenuItem11( _this );
722 this.el.append ( child_3.el );
723 var child_4 = new Xcls_SeparatorMenuItem12( _this );
725 this.el.add ( child_4.el );
726 var child_5 = new Xcls_MenuItem13( _this );
728 this.el.append ( child_5.el );
729 var child_6 = new Xcls_MenuItem14( _this );
731 this.el.append ( child_6.el );
732 var child_7 = new Xcls_MenuItem15( _this );
734 this.el.append ( child_7.el );
735 var child_8 = new Xcls_SeparatorMenuItem16( _this );
737 this.el.add ( child_8.el );
738 var child_9 = new Xcls_MenuItem17( _this );
740 this.el.append ( child_9.el );
741 var child_10 = new Xcls_MenuItem18( _this );
743 this.el.append ( child_10.el );
744 var child_11 = new Xcls_MenuItem19( _this );
746 this.el.append ( child_11.el );
747 var child_12 = new Xcls_SeparatorMenuItem20( _this );
749 this.el.add ( child_12.el );
750 var child_13 = new Xcls_MenuItem21( _this );
752 this.el.append ( child_13.el );
753 var child_14 = new Xcls_MenuItem22( _this );
755 this.el.append ( child_14.el );
756 var child_15 = new Xcls_MenuItem23( _this );
758 this.el.append ( child_15.el );
761 // user defined functions
763 public class Xcls_MenuItem8 : Object
765 public Gtk.MenuItem el;
766 private Xcls_LeftProps _this;
772 public Xcls_MenuItem8(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_MenuItem9 : Object
794 public Gtk.MenuItem el;
795 private Xcls_LeftProps _this;
801 public Xcls_MenuItem9(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_MenuItem10 : Object
824 public Gtk.MenuItem el;
825 private Xcls_LeftProps _this;
831 public Xcls_MenuItem10(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";
843 this.el.activate.connect( ( ) => {
845 _this.addProp( "prop", "ctor","", "*");
849 // user defined functions
852 public class Xcls_MenuItem11 : Object
854 public Gtk.MenuItem el;
855 private Xcls_LeftProps _this;
861 public Xcls_MenuItem11(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_SeparatorMenuItem12 : Object
884 public Gtk.SeparatorMenuItem el;
885 private Xcls_LeftProps _this;
891 public Xcls_SeparatorMenuItem12(Xcls_LeftProps _owner )
894 this.el = new Gtk.SeparatorMenuItem();
898 // set gobject values
901 // user defined functions
904 public class Xcls_MenuItem13 : Object
906 public Gtk.MenuItem el;
907 private Xcls_LeftProps _this;
913 public Xcls_MenuItem13(Xcls_LeftProps _owner )
916 this.el = new Gtk.MenuItem();
920 // set gobject values
921 this.el.tooltip_markup = "Add a user defined string property";
922 this.el.label = "String";
925 this.el.activate.connect( (self) => {
927 _this.addProp( "prop", "XXXX", "","string");
932 // user defined functions
935 public class Xcls_MenuItem14 : Object
937 public Gtk.MenuItem el;
938 private Xcls_LeftProps _this;
944 public Xcls_MenuItem14(Xcls_LeftProps _owner )
947 this.el = new Gtk.MenuItem();
951 // set gobject values
952 this.el.tooltip_markup = "Add a user defined number property";
953 this.el.label = "Number";
956 this.el.activate.connect( ( ) =>{
958 _this.addProp("prop", "XXX", "0", "int");
962 // user defined functions
965 public class Xcls_MenuItem15 : Object
967 public Gtk.MenuItem el;
968 private Xcls_LeftProps _this;
974 public Xcls_MenuItem15(Xcls_LeftProps _owner )
977 this.el = new Gtk.MenuItem();
981 // set gobject values
982 this.el.tooltip_markup = "Add a user defined boolean property";
983 this.el.label = "Boolean";
986 this.el.activate.connect( ( ) =>{
988 _this.addProp( "prop", "XXX", "true", "bool");
992 // user defined functions
995 public class Xcls_SeparatorMenuItem16 : Object
997 public Gtk.SeparatorMenuItem el;
998 private Xcls_LeftProps _this;
1004 public Xcls_SeparatorMenuItem16(Xcls_LeftProps _owner )
1007 this.el = new Gtk.SeparatorMenuItem();
1011 // set gobject values
1014 // user defined functions
1017 public class Xcls_MenuItem17 : Object
1019 public Gtk.MenuItem el;
1020 private Xcls_LeftProps _this;
1026 public Xcls_MenuItem17(Xcls_LeftProps _owner )
1029 this.el = new Gtk.MenuItem();
1033 // set gobject values
1034 this.el.tooltip_markup = "Add a user function boolean property";
1035 this.el.label = "Javascript Function";
1038 this.el.activate.connect( ( ) =>{
1040 _this.addProp("prop", "XXXX", "function() { }", "| function");
1044 // user defined functions
1047 public class Xcls_MenuItem18 : Object
1049 public Gtk.MenuItem el;
1050 private Xcls_LeftProps _this;
1056 public Xcls_MenuItem18(Xcls_LeftProps _owner )
1059 this.el = new Gtk.MenuItem();
1063 // set gobject values
1064 this.el.tooltip_markup = "Add a user function boolean property";
1065 this.el.label = "Vala Method";
1068 this.el.activate.connect( ( ) =>{
1070 _this.addProp( "prop", "XXXX", "() {\n\n}\n", "| return_type");
1074 // user defined functions
1077 public class Xcls_MenuItem19 : Object
1079 public Gtk.MenuItem el;
1080 private Xcls_LeftProps _this;
1086 public Xcls_MenuItem19(Xcls_LeftProps _owner )
1089 this.el = new Gtk.MenuItem();
1093 // set gobject values
1094 this.el.tooltip_markup = "Add a vala signal";
1095 this.el.label = "Vala Signal";
1098 this.el.activate.connect( ( ) =>{
1100 _this.addProp( "prop", "XXXX", "()", "@ void");
1104 // user defined functions
1107 public class Xcls_SeparatorMenuItem20 : Object
1109 public Gtk.SeparatorMenuItem el;
1110 private Xcls_LeftProps _this;
1116 public Xcls_SeparatorMenuItem20(Xcls_LeftProps _owner )
1119 this.el = new Gtk.SeparatorMenuItem();
1123 // set gobject values
1126 // user defined functions
1129 public class Xcls_MenuItem21 : Object
1131 public Gtk.MenuItem el;
1132 private Xcls_LeftProps _this;
1138 public Xcls_MenuItem21(Xcls_LeftProps _owner )
1141 this.el = new Gtk.MenuItem();
1145 // set gobject values
1146 this.el.tooltip_markup = "Add a flexy if (for HTML templates)";
1147 this.el.label = "Flexy - If";
1150 this.el.activate.connect( ( ) =>{
1152 _this.addProp("prop", "flexy:if", "value_or_condition", "string");
1156 // user defined functions
1159 public class Xcls_MenuItem22 : Object
1161 public Gtk.MenuItem el;
1162 private Xcls_LeftProps _this;
1168 public Xcls_MenuItem22(Xcls_LeftProps _owner )
1171 this.el = new Gtk.MenuItem();
1175 // set gobject values
1176 this.el.tooltip_markup = "Add a flexy include (for HTML templates)";
1177 this.el.label = "Flexy - Include";
1180 this.el.activate.connect( ( ) =>{
1182 _this.addProp("prop", "flexy:include", "name_of_file.html", "string");
1186 // user defined functions
1189 public class Xcls_MenuItem23 : Object
1191 public Gtk.MenuItem el;
1192 private Xcls_LeftProps _this;
1198 public Xcls_MenuItem23(Xcls_LeftProps _owner )
1201 this.el = new Gtk.MenuItem();
1205 // set gobject values
1206 this.el.tooltip_markup = "Add a flexy foreach (for HTML templates)";
1207 this.el.label = "Flexy - Foreach";
1210 this.el.activate.connect( ( ) =>{
1212 _this.addProp("prop", "flexy:foreach", "array,key,value", "string");
1216 // user defined functions
1222 public class Xcls_EditProps : Object
1224 public Gtk.ScrolledWindow el;
1225 private Xcls_LeftProps _this;
1229 public bool editing;
1232 public Xcls_EditProps(Xcls_LeftProps _owner )
1235 _this.EditProps = this;
1236 this.el = new Gtk.ScrolledWindow( null, null );
1239 this.editing = false;
1241 // set gobject values
1242 this.el.shadow_type = Gtk.ShadowType.IN;
1243 var child_0 = new Xcls_view( _this );
1245 this.el.add ( child_0.el );
1251 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
1255 // user defined functions
1257 public class Xcls_view : Object
1259 public Gtk.TreeView el;
1260 private Xcls_LeftProps _this;
1264 public Xcls_PopoverProperty popover;
1267 public Xcls_view(Xcls_LeftProps _owner )
1271 this.el = new Gtk.TreeView();
1274 this.popover = null;
1276 // set gobject values
1277 this.el.tooltip_column = 5;
1278 this.el.enable_tree_lines = true;
1279 this.el.headers_visible = true;
1280 var child_0 = new Xcls_model( _this );
1282 this.el.set_model ( child_0.el );
1283 var child_1 = new Xcls_keycol( _this );
1285 this.el.append_column ( child_1.el );
1286 var child_2 = new Xcls_valcol( _this );
1288 this.el.append_column ( child_2.el );
1289 var child_3 = new Xcls_ContextMenu( _this );
1295 var selection = this.el.get_selection();
1296 selection.set_mode( Gtk.SelectionMode.SINGLE);
1299 var description = new Pango.FontDescription();
1300 description.set_size(10000);
1301 this.el.override_font(description);
1305 this.el.button_press_event.connect( ( ev) => {
1307 Gtk.TreeViewColumn col;
1311 if (!this.el.get_path_at_pos((int)ev.x, (int) ev.y, out path, out col, out cell_x, out cell_y )) {
1312 print("nothing selected on click");
1313 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
1314 this.el.get_selection().unselect_all();
1318 _this.before_edit();
1319 return false; //not on a element.
1323 // double click on name..
1324 if (ev.type == Gdk.EventType.2BUTTON_PRESS && ev.button == 1 && col.title == "Name") {
1327 if (this.popover == null) {
1328 this.popover = new Xcls_PopoverProperty();
1329 this.popover.mainwindow = _this.main_window;
1333 _this.before_edit();
1335 _this.keyrender.el.stop_editing(false);
1336 _this.keyrender.el.editable =false;
1338 _this.valrender.el.stop_editing(false);
1339 _this.valrender.el.editable =false;
1341 var mod = this.el.get_model();
1342 mod.get_iter (out iter, path);
1345 GLib.Value gvaltype, gval;
1346 mod.get_value(iter, 1 , out gval); // one is key..
1348 mod.get_value(iter,0, out gvaltype);
1350 //this.popover.show(this.el, _this.node, (string)gvaltype, (string)gval);
1352 _this.startEditingKey(path);
1361 if (ev.type == Gdk.EventType.BUTTON_PRESS && ev.button == 3) {
1363 //if (col.title == "Value") {
1364 // _this.before_edit();
1368 var p = _this.ContextMenu;
1370 p.el.set_screen(Gdk.Screen.get_default());
1372 p.el.popup(null, null, null, ev.button, ev.time);
1373 //Seed.print("click:" + res.column.title);
1375 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
1377 this.el.get_selection().select_path(path);
1380 _this.before_edit();
1385 if (col.title != "Value") {
1386 print("col title != Value");
1388 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
1389 this.el.get_selection().select_path(path);
1393 _this.before_edit();
1394 // XObject.error("column is not value?");
1395 return false; // ignore.. - key click.. ??? should we do this??
1399 // if the cell can be edited with a pulldown
1400 // then we should return true... - and let the start_editing handle it?
1407 // _this.before_edit(); <<< we really need to stop the other editor..
1408 _this.keyrender.el.stop_editing(false);
1409 _this.keyrender.el.editable =false;
1412 return _this.startEditingValue(path); // assumes selected row..
1421 // user defined functions
1423 public class Xcls_model : Object
1425 public Gtk.TreeStore el;
1426 private Xcls_LeftProps _this;
1432 public Xcls_model(Xcls_LeftProps _owner )
1436 this.el = new Gtk.TreeStore( 7, typeof(string), // 0 key type
1437 typeof(string), // 1 key
1438 typeof(string), // 2 key (display)
1439 typeof(string), // 3 value
1440 typeof(string), // 4 value (display)
1441 typeof(string), // 5 both (tooltip)
1442 typeof(string) // 6 key (for sorting)
1447 // set gobject values
1450 // user defined functions
1453 public class Xcls_keycol : Object
1455 public Gtk.TreeViewColumn el;
1456 private Xcls_LeftProps _this;
1462 public Xcls_keycol(Xcls_LeftProps _owner )
1465 _this.keycol = this;
1466 this.el = new Gtk.TreeViewColumn();
1470 // set gobject values
1471 this.el.title = "Name";
1472 this.el.resizable = true;
1473 var child_0 = new Xcls_keyrender( _this );
1475 this.el.pack_start ( child_0.el , false );
1479 this.el.add_attribute(_this.keyrender.el , "markup", 2 );
1480 this.el.add_attribute(_this.keyrender.el , "text", 1 );
1483 // user defined functions
1485 public class Xcls_keyrender : Object
1487 public Gtk.CellRendererText el;
1488 private Xcls_LeftProps _this;
1494 public Xcls_keyrender(Xcls_LeftProps _owner )
1497 _this.keyrender = this;
1498 this.el = new Gtk.CellRendererText();
1502 // set gobject values
1505 this.el.editing_started.connect( ( editable, path) => {
1508 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1513 // this.get('/LeftPanel.model').activePath = path;
1514 _this.model.el.get_value(iter,1, out gval);
1515 var val = (string)gval;
1517 ((Gtk.Entry)editable).set_text(val);
1519 this.el.edited.connect( (path, newtext) => {
1520 print("Keyrender - signal:edited\n");
1522 this.el.editable = false;
1527 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1530 _this.model.el.get_value(iter,1, out gval);
1531 var oldval = (string)gval;
1533 _this.model.el.get_value(iter,0, out gval);
1534 var ktype = (string)gval;
1536 _this.model.el.set_value(iter, 1, newtext);
1538 if (oldval == newtext) {
1543 print("ktype: %s\n",ktype);
1546 var ov = _this.node.listeners.get(oldval);
1547 _this.node.listeners.set(newtext, ov);
1548 _this.node.listeners.unset(oldval);
1550 _this.updateIter(iter, ktype, newtext, ov);
1554 var ov = _this.node.props.get(oldval);
1555 _this.node.props.set(newtext, ov);
1556 _this.node.props.unset(oldval);
1557 _this.updateIter(iter, ktype, newtext, ov);
1565 // user defined functions
1569 public class Xcls_valcol : Object
1571 public Gtk.TreeViewColumn el;
1572 private Xcls_LeftProps _this;
1578 public Xcls_valcol(Xcls_LeftProps _owner )
1581 _this.valcol = this;
1582 this.el = new Gtk.TreeViewColumn();
1586 // set gobject values
1587 this.el.title = "Value";
1588 this.el.resizable = true;
1589 var child_0 = new Xcls_valrender( _this );
1591 this.el.pack_start ( child_0.el , true );
1597 // typeof(string), // 0 key type
1598 // typeof(string), // 1 key
1599 // typeof(string), // 2 key (display)
1600 // typeof(string), // 3 value
1601 // typeof(string) // 4 value (display)
1604 this.el.add_attribute(_this.valrender.el , "text", 4 );
1605 //this.el.add_attribute(_this.valrender.el , "sensitive", 4 );
1606 //this.el.add_attribute(this.items[0].el , 'editable', 3 );
1607 // this.el.set_cell_data_func(cell, age_cell_data_func, NULL, NULL);
1609 // this.get('/LeftPanel').editableColumn= this;
1613 // user defined functions
1615 public class Xcls_valrender : Object
1617 public Gtk.CellRendererCombo el;
1618 private Xcls_LeftProps _this;
1624 public Xcls_valrender(Xcls_LeftProps _owner )
1627 _this.valrender = this;
1628 this.el = new Gtk.CellRendererCombo();
1632 // set gobject values
1633 this.el.editable = false;
1634 this.el.text_column = 0;
1635 this.el.has_entry = true;
1636 var child_0 = new Xcls_valrendermodel( _this );
1638 this.el.model = child_0.el;
1641 this.el.editing_started.connect( ( editable, path) => {
1642 //_this.editing = true;
1643 print("editing started called\n");
1644 if (!_this.allow_edit) {
1646 print("val - editing_Started\n");
1647 this.el.editable = false; // make sure it's not editor...
1652 _this.allow_edit =false;
1655 if ( this.el.has_entry ) {
1658 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1663 // this.get('/LeftPanel.model').activePath = path;
1664 _this.model.el.get_value(iter,3, out gval);
1667 var val = (string)gval;
1668 var combo = (Gtk.ComboBox)editable;
1670 var entry = (Gtk.Entry) combo.get_child();
1671 entry.set_text(val);
1675 this.el.edited.connect( (path, newtext) => {
1676 print("Valrender - signal:edited\n");
1678 this.el.editable = false;
1683 2, "<b>" + miter.get_key() + "</b>",
1684 3, miter.get_value(),
1685 4, display_value(short);
1691 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1694 _this.model.el.get_value(iter,0, out gval);
1695 var ktype = (string)gval;
1698 _this.model.el.get_value(iter,3, out gval);
1699 var oldval = (string)gval;
1701 _this.model.el.get_value(iter,1, out gval);
1702 var key = (string)gval;
1708 _this.node.listeners.set(key, newtext);
1709 _this.updateIter(iter,ktype,key,newtext);
1712 _this.node.props.set(key,newtext);
1713 _this.updateIter(iter,ktype, key,newtext);
1716 // _this.load(_this.file,_this.node);
1722 // user defined functions
1723 public void setOptions (string[] ar) {
1724 var m = _this.valrendermodel.el;
1727 for (var i =0; i < ar.length; i++) {
1729 m.set_value(iret, 0, ar[i]);
1734 public class Xcls_valrendermodel : Object
1736 public Gtk.ListStore el;
1737 private Xcls_LeftProps _this;
1743 public Xcls_valrendermodel(Xcls_LeftProps _owner )
1746 _this.valrendermodel = this;
1747 this.el = new Gtk.ListStore( 1, typeof(string) );
1751 // set gobject values
1754 // user defined functions
1759 public class Xcls_ContextMenu : Object
1762 private Xcls_LeftProps _this;
1768 public Xcls_ContextMenu(Xcls_LeftProps _owner )
1771 _this.ContextMenu = this;
1772 this.el = new Gtk.Menu();
1776 // set gobject values
1777 var child_0 = new Xcls_MenuItem33( _this );
1779 this.el.append ( child_0.el );
1780 var child_1 = new Xcls_SeparatorMenuItem34( _this );
1782 this.el.append ( child_1.el );
1783 var child_2 = new Xcls_MenuItem35( _this );
1785 this.el.append ( child_2.el );
1788 // user defined functions
1790 public class Xcls_MenuItem33 : Object
1792 public Gtk.MenuItem el;
1793 private Xcls_LeftProps _this;
1799 public Xcls_MenuItem33(Xcls_LeftProps _owner )
1802 this.el = new Gtk.MenuItem();
1806 // set gobject values
1807 this.el.label = "Edit";
1810 this.el.activate.connect( ( ) =>{
1812 var s = _this.view.el.get_selection();
1814 Gtk.TreeModel model;
1815 s.get_selected (out model, out iter);
1816 _this.startEditingKey(model.get_path(iter));
1820 // user defined functions
1823 public class Xcls_SeparatorMenuItem34 : Object
1825 public Gtk.SeparatorMenuItem el;
1826 private Xcls_LeftProps _this;
1832 public Xcls_SeparatorMenuItem34(Xcls_LeftProps _owner )
1835 this.el = new Gtk.SeparatorMenuItem();
1839 // set gobject values
1842 // user defined functions
1845 public class Xcls_MenuItem35 : Object
1847 public Gtk.MenuItem el;
1848 private Xcls_LeftProps _this;
1854 public Xcls_MenuItem35(Xcls_LeftProps _owner )
1857 this.el = new Gtk.MenuItem();
1861 // set gobject values
1862 this.el.label = "Delete";
1865 this.el.activate.connect( ( ) =>{
1866 _this.deleteSelected();
1870 // user defined functions