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)) {
74 this.updateIter(iter, type, key, (string)kvalue);
86 public void before_edit ()
89 print("before edit - stop editing\n");
91 // these do not appear to trigger save...
92 _this.keyrender.el.stop_editing(false);
93 _this.keyrender.el.editable =false;
95 _this.valrender.el.stop_editing(false);
96 _this.valrender.el.editable =false;
99 // technicall stop the popup editor..
102 public string keySortFormat (string key) {
103 // listeners first - with 0
110 var bits = key.split(" ");
113 return "2 " + bits[bits.length -1];
117 return "3 " + bits[bits.length -1];
122 return "4 " + bits[bits.length -1];
125 return "5 " + bits[bits.length -1];
130 public void finish_editing () {
134 public bool startEditingValue ( Gtk.TreePath path) {
136 // ONLY return true if editing is allowed - eg. combo..
138 print("start editing?\n");
139 if (!this.stop_editor()) {
140 print("stop editor failed\n");
146 var mod = this.model.el;
147 mod.get_iter (out iter, path);
153 2, "<b>" + miter.get_key() + "</b>",
159 mod.get_value(iter, 3 , out gval);
160 var val = (string)gval;
162 mod.get_value(iter, 1 , out gval);
163 var key = (string)gval;
166 string kname, kflag, ktype;
167 this.node.normalize_key(key, out kname, out kflag, out ktype);
170 mod.get_value(iter, 0 , out gval);
171 var type = (string)gval; // listerner or prop..
175 var use_textarea = false;
177 //------------ things that require the text editor...
179 if (type == "listener") {
182 if (key.length > 0 && key[0] == '|') { // user defined method
185 if (key.length > 0 && key[0] == '$') { // raw string
188 if (key.length > 0 && key == "* init") {
191 if (val.length > 40) { // long value...
198 print("Call show editor\n");
199 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
200 this.view.el.get_selection().select_path(path);
202 this.show_editor(file, node, type, key);
211 var pal = Palete.factory(this.file.project.xtype);
214 var has_opts = pal.typeOptions(this.node.fqn(), kname, ktype, out opts);
218 // others... - fill in options for true/false?
219 print("turn on editing %s \n" , mod.get_path(iter).to_string());
223 print("start editing try/false)???");
224 this.valrender.el.has_entry = false;
226 this.valrender.setOptions(opts);
228 this.valrender.el.has_entry = false;
229 this.valrender.el.editable = true;
230 this.allow_edit = true;
231 GLib.Timeout.add_full(GLib.Priority.DEFAULT,100 , () => {
232 this.view.el.set_cursor_on_cell(
243 // see if type is a Enum.
250 this.valrender.setOptions(opts);
252 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
254 // at this point - work out the type...
255 // if its' a combo... then show the options..
256 this.valrender.el.has_entry = true;
258 this.valrender.el.editable = true;
261 this.allow_edit = true;
267 this.view.el.set_cursor_on_cell(
277 public void load (JsRender.JsRender file, JsRender.Node? node)
279 print("load leftprops\n");
285 this.model.el.clear();
287 //this.get('/RightEditor').el.hide();
294 //var provider = this.get('/LeftTree').getPaleteProvider();
297 //typeof(string), // 0 key type
298 //typeof(string), // 1 key
299 //typeof(string), // 2 key (display)
300 //typeof(string), // 3 value
301 //typeof(string), // 4 value (display)
302 //typeof(string), // 5 both (tooltip)
307 // really need a way to sort the hashmap...
308 var m = this.model.el;
310 var miter = node.listeners.map_iterator();
313 while(miter.next()) {
315 m.append(out iter,null);
317 this.updateIter(iter, "listener", miter.get_key(), miter.get_value());
323 miter = node.props.map_iterator();
326 while(miter.next()) {
328 m.append(out iter,null);
329 this.updateIter(iter, "prop", miter.get_key(), miter.get_value());
332 print("clear selection\n");
334 this.model.el.set_sort_column_id(6,Gtk.SortType.ASCENDING); // sort by real key..
336 this.view.el.get_selection().unselect_all();
338 var pane = _this.main_window.editpane.el;
339 var try_size = (i * 25) + 60; // est. 20px per line + 40px header
343 ((try_size * 1.0f) / (pane.max_position * 1.0f)) > 0.8f ?
344 (int) (pane.max_position * 0.2f) :
345 pane.max_position-try_size);
349 public string keyFormat (string val, string type) {
351 // Glib.markup_escape_text(val);
353 if (type == "listener") {
354 return "<span font_weight=\"bold\" color=\"#660000\">" +
355 GLib.Markup.escape_text(val) +
359 if (val.length < 1) {
360 return "<span color=\"#FF0000\">--empty--</span>";
365 //# - object properties
367 // all of these... - display value is last element..
368 var ar = val.strip().split(" ");
371 var dval = GLib.Markup.escape_text(ar[ar.length-1]);
377 case '@': // signal // just bold balck?
378 if (dval[0] == '@') {
379 dval = dval.substring(1);
382 return @"<span font_weight=\"bold\">@ $dval</span>";
383 case '#': // object properties?
384 if (dval[0] == '#') {
385 dval = dval.substring(1);
387 return @"<span font_weight=\"bold\">$dval</span>";
389 if (dval[0] == '*') {
390 dval = dval.substring(1);
392 return @"<span color=\"#0000CC\" font_weight=\"bold\">$dval</span>";
394 if (dval[0] == '$') {
395 dval = dval.substring(1);
397 return @"<span style=\"italic\">$dval</span>";
398 case '|': // user defined methods
399 if (dval[0] == '|') {
400 dval = dval.substring(1);
402 return @"<span color=\"#008000\" font_weight=\"bold\">$dval</span>";
413 public void deleteSelected () {
418 var s = this.view.el.get_selection();
419 s.get_selected(out mod, out iter);
423 mod.get_value(iter, 0 , out gval);
424 var type = (string)gval;
426 mod.get_value(iter, 1 , out gval);
427 var key = (string)gval;
431 this.node.listeners.unset(key);
435 this.node.props.unset(key);
438 this.load(this.file, this.node);
442 public void startEditingKey ( Gtk.TreePath path) {
444 if (!this.stop_editor()) {
448 // others... - fill in options for true/false?
451 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
452 this.allow_edit = true;
453 this.keyrender.el.editable = true;
455 this.view.el.set_cursor_on_cell(
467 public void addProp (string in_type, string key, string value, string value_type) {
468 // info includes key, val, skel, etype..
469 //console.dump(info);
470 //type = info.type.toLowerCase();
471 //var data = this.toJS();
473 var type = in_type == "signals" ? "listener" : in_type;
475 var fkey = (value_type.length > 0 ? value_type + " " : "") + key;
477 if (type == "listener") {
478 if (this.node.listeners.has_key(key)) {
481 this.node.listeners.set(key,value);
484 if (this.node.props.has_key(fkey)) {
487 this.node.props.set(fkey,value);
492 this.load(this.file, this.node);
496 /// need to find the row which I've just added..
499 var s = this.view.el.get_selection();
502 print("trying to find new iter");
504 this.model.el.foreach((model, path, iter) => {
507 this.model.el.get_value(iter, 0 , out gval);
508 if ((string)gval != type) {
509 print("not type: %s = %s\n", (string)gval , type);
512 this.model.el.get_value(iter, 1 , out gval);
513 if ((string)gval != fkey) {
514 print("not key: %s = %s\n", (string)gval , fkey);
518 GLib.Timeout.add_full(GLib.Priority.DEFAULT,40 , () => {
520 this.startEditingValue(this.model.el.get_path(iter));
523 //s.select_iter(iter);
531 public void updateIter (Gtk.TreeIter iter, string type, string key, string kvalue) {
533 print("update Iter %s, %s\n", key,kvalue);
534 //typeof(string), // 0 key type
535 //typeof(string), // 1 key
536 //typeof(string), // 2 key (display)
537 //typeof(string), // 3 value
538 //typeof(string), // 4 value (display)
539 //typeof(string), // 5 both (tooltip)
540 //typeof(string), // 6 key (sort)
542 var dl = kvalue.strip().split("\n");
544 var dis_val = dl.length > 1 ? (dl[0].strip()+ "...") : dl[0];
546 if (type == "listener") {
550 this.model.el.set(iter,
553 2, this.keyFormat(key ,type),
556 5, "<tt>" + GLib.Markup.escape_text(key + " " +kvalue) + "</tt>",
564 this.model.el.set(iter,
567 2, this.keyFormat(key , "prop"),
570 5, "<tt>" + GLib.Markup.escape_text(key + " " + kvalue) + "</tt>",
571 6, this.keySortFormat(key)
574 public class Xcls_Box2 : Object
577 private Xcls_LeftProps _this;
583 public Xcls_Box2(Xcls_LeftProps _owner )
586 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
590 // set gobject values
591 var child_0 = new Xcls_Button3( _this );
593 this.el.add ( child_0.el );
596 // user defined functions
598 public class Xcls_Button3 : Object
600 public Gtk.Button el;
601 private Xcls_LeftProps _this;
607 public Xcls_Button3(Xcls_LeftProps _owner )
610 this.el = new Gtk.Button();
614 // set gobject values
615 this.el.hexpand = true;
616 var child_0 = new Xcls_Box4( _this );
618 this.el.add ( child_0.el );
619 var child_1 = new Xcls_AddPropertyPopup( _this );
623 this.el.button_press_event.connect( (self, ev) => {
627 var p = _this.AddPropertyPopup;
628 p.el.set_screen(Gdk.Screen.get_default());
630 p.el.popup(null, null, null, ev.button, ev.time);
635 // user defined functions
637 public class Xcls_Box4 : Object
640 private Xcls_LeftProps _this;
646 public Xcls_Box4(Xcls_LeftProps _owner )
649 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
653 // set gobject values
654 var child_0 = new Xcls_Image5( _this );
656 this.el.add ( child_0.el );
657 var child_1 = new Xcls_Label6( _this );
659 this.el.add ( child_1.el );
662 // user defined functions
664 public class Xcls_Image5 : Object
667 private Xcls_LeftProps _this;
673 public Xcls_Image5(Xcls_LeftProps _owner )
676 this.el = new Gtk.Image();
680 // set gobject values
681 this.el.stock = Gtk.Stock.ADD;
682 this.el.icon_size = Gtk.IconSize.MENU;
685 // user defined functions
688 public class Xcls_Label6 : Object
691 private Xcls_LeftProps _this;
697 public Xcls_Label6(Xcls_LeftProps _owner )
700 this.el = new Gtk.Label( "Other" );
704 // set gobject values
707 // user defined functions
711 public class Xcls_AddPropertyPopup : Object
714 private Xcls_LeftProps _this;
720 public Xcls_AddPropertyPopup(Xcls_LeftProps _owner )
723 _this.AddPropertyPopup = this;
724 this.el = new Gtk.Menu();
728 // set gobject values
729 var child_0 = new Xcls_MenuItem8( _this );
731 this.el.append ( child_0.el );
732 var child_1 = new Xcls_MenuItem9( _this );
734 this.el.append ( child_1.el );
735 var child_2 = new Xcls_MenuItem10( _this );
737 this.el.append ( child_2.el );
738 var child_3 = new Xcls_MenuItem11( _this );
740 this.el.append ( child_3.el );
741 var child_4 = new Xcls_SeparatorMenuItem12( _this );
743 this.el.add ( child_4.el );
744 var child_5 = new Xcls_MenuItem13( _this );
746 this.el.append ( child_5.el );
747 var child_6 = new Xcls_MenuItem14( _this );
749 this.el.append ( child_6.el );
750 var child_7 = new Xcls_MenuItem15( _this );
752 this.el.append ( child_7.el );
753 var child_8 = new Xcls_SeparatorMenuItem16( _this );
755 this.el.add ( child_8.el );
756 var child_9 = new Xcls_MenuItem17( _this );
758 this.el.append ( child_9.el );
759 var child_10 = new Xcls_MenuItem18( _this );
761 this.el.append ( child_10.el );
762 var child_11 = new Xcls_MenuItem19( _this );
764 this.el.append ( child_11.el );
765 var child_12 = new Xcls_SeparatorMenuItem20( _this );
767 this.el.add ( child_12.el );
768 var child_13 = new Xcls_MenuItem21( _this );
770 this.el.append ( child_13.el );
771 var child_14 = new Xcls_MenuItem22( _this );
773 this.el.append ( child_14.el );
774 var child_15 = new Xcls_MenuItem23( _this );
776 this.el.append ( child_15.el );
779 // user defined functions
781 public class Xcls_MenuItem8 : Object
783 public Gtk.MenuItem el;
784 private Xcls_LeftProps _this;
790 public Xcls_MenuItem8(Xcls_LeftProps _owner )
793 this.el = new Gtk.MenuItem();
797 // set gobject values
798 this.el.tooltip_markup = "Using _this.{ID} will map to this element";
799 this.el.label = "id: _this.{ID} (Vala)";
802 this.el.activate.connect( () => {
803 _this.addProp( "prop", "id", "", "");
807 // user defined functions
810 public class Xcls_MenuItem9 : Object
812 public Gtk.MenuItem el;
813 private Xcls_LeftProps _this;
819 public Xcls_MenuItem9(Xcls_LeftProps _owner )
822 this.el = new Gtk.MenuItem();
826 // set gobject values
827 this.el.tooltip_markup = "how to pack this element onto parent, (method, 2nd arg, 3rd arg) .. the 1st argument is filled by the element";
828 this.el.label = "pack: Pack method (Vala)";
831 this.el.activate.connect( ( ) => {
833 _this.addProp( "prop", "pack","add", "*");
837 // user defined functions
840 public class Xcls_MenuItem10 : Object
842 public Gtk.MenuItem el;
843 private Xcls_LeftProps _this;
849 public Xcls_MenuItem10(Xcls_LeftProps _owner )
852 this.el = new Gtk.MenuItem();
856 // set gobject values
857 this.el.tooltip_markup = "eg. \n\nnew Clutter.Image.from_file(.....)";
858 this.el.label = "ctor: Alterative to default contructor";
861 this.el.activate.connect( ( ) => {
863 _this.addProp( "prop", "ctor","", "*");
867 // user defined functions
870 public class Xcls_MenuItem11 : Object
872 public Gtk.MenuItem el;
873 private Xcls_LeftProps _this;
879 public Xcls_MenuItem11(Xcls_LeftProps _owner )
882 this.el = new Gtk.MenuItem();
886 // set gobject values
887 this.el.tooltip_markup = "This code is called after the ctor";
888 this.el.label = "init: initialziation code (vala)";
891 this.el.activate.connect( ( ) => {
893 _this.addProp( "prop", "init", "{\n\n}\n", "*" );
897 // user defined functions
900 public class Xcls_SeparatorMenuItem12 : Object
902 public Gtk.SeparatorMenuItem el;
903 private Xcls_LeftProps _this;
909 public Xcls_SeparatorMenuItem12(Xcls_LeftProps _owner )
912 this.el = new Gtk.SeparatorMenuItem();
916 // set gobject values
919 // user defined functions
922 public class Xcls_MenuItem13 : Object
924 public Gtk.MenuItem el;
925 private Xcls_LeftProps _this;
931 public Xcls_MenuItem13(Xcls_LeftProps _owner )
934 this.el = new Gtk.MenuItem();
938 // set gobject values
939 this.el.tooltip_markup = "Add a user defined string property";
940 this.el.label = "String";
943 this.el.activate.connect( (self) => {
945 _this.addProp( "prop", "XXXX", "","string");
950 // user defined functions
953 public class Xcls_MenuItem14 : Object
955 public Gtk.MenuItem el;
956 private Xcls_LeftProps _this;
962 public Xcls_MenuItem14(Xcls_LeftProps _owner )
965 this.el = new Gtk.MenuItem();
969 // set gobject values
970 this.el.tooltip_markup = "Add a user defined number property";
971 this.el.label = "Number";
974 this.el.activate.connect( ( ) =>{
976 _this.addProp("prop", "XXX", "0", "int");
980 // user defined functions
983 public class Xcls_MenuItem15 : Object
985 public Gtk.MenuItem el;
986 private Xcls_LeftProps _this;
992 public Xcls_MenuItem15(Xcls_LeftProps _owner )
995 this.el = new Gtk.MenuItem();
999 // set gobject values
1000 this.el.tooltip_markup = "Add a user defined boolean property";
1001 this.el.label = "Boolean";
1004 this.el.activate.connect( ( ) =>{
1006 _this.addProp( "prop", "XXX", "true", "bool");
1010 // user defined functions
1013 public class Xcls_SeparatorMenuItem16 : Object
1015 public Gtk.SeparatorMenuItem el;
1016 private Xcls_LeftProps _this;
1022 public Xcls_SeparatorMenuItem16(Xcls_LeftProps _owner )
1025 this.el = new Gtk.SeparatorMenuItem();
1029 // set gobject values
1032 // user defined functions
1035 public class Xcls_MenuItem17 : Object
1037 public Gtk.MenuItem el;
1038 private Xcls_LeftProps _this;
1044 public Xcls_MenuItem17(Xcls_LeftProps _owner )
1047 this.el = new Gtk.MenuItem();
1051 // set gobject values
1052 this.el.tooltip_markup = "Add a user function boolean property";
1053 this.el.label = "Javascript Function";
1056 this.el.activate.connect( ( ) =>{
1058 _this.addProp("prop", "XXXX", "function() { }", "| function");
1062 // user defined functions
1065 public class Xcls_MenuItem18 : Object
1067 public Gtk.MenuItem el;
1068 private Xcls_LeftProps _this;
1074 public Xcls_MenuItem18(Xcls_LeftProps _owner )
1077 this.el = new Gtk.MenuItem();
1081 // set gobject values
1082 this.el.tooltip_markup = "Add a user function boolean property";
1083 this.el.label = "Vala Method";
1086 this.el.activate.connect( ( ) =>{
1088 _this.addProp( "prop", "XXXX", "() {\n\n}\n", "| return_type");
1092 // user defined functions
1095 public class Xcls_MenuItem19 : Object
1097 public Gtk.MenuItem el;
1098 private Xcls_LeftProps _this;
1104 public Xcls_MenuItem19(Xcls_LeftProps _owner )
1107 this.el = new Gtk.MenuItem();
1111 // set gobject values
1112 this.el.tooltip_markup = "Add a vala signal";
1113 this.el.label = "Vala Signal";
1116 this.el.activate.connect( ( ) =>{
1118 _this.addProp( "prop", "XXXX", "()", "@ void");
1122 // user defined functions
1125 public class Xcls_SeparatorMenuItem20 : Object
1127 public Gtk.SeparatorMenuItem el;
1128 private Xcls_LeftProps _this;
1134 public Xcls_SeparatorMenuItem20(Xcls_LeftProps _owner )
1137 this.el = new Gtk.SeparatorMenuItem();
1141 // set gobject values
1144 // user defined functions
1147 public class Xcls_MenuItem21 : Object
1149 public Gtk.MenuItem el;
1150 private Xcls_LeftProps _this;
1156 public Xcls_MenuItem21(Xcls_LeftProps _owner )
1159 this.el = new Gtk.MenuItem();
1163 // set gobject values
1164 this.el.tooltip_markup = "Add a flexy if (for HTML templates)";
1165 this.el.label = "Flexy - If";
1168 this.el.activate.connect( ( ) =>{
1170 _this.addProp("prop", "flexy:if", "value_or_condition", "string");
1174 // user defined functions
1177 public class Xcls_MenuItem22 : Object
1179 public Gtk.MenuItem el;
1180 private Xcls_LeftProps _this;
1186 public Xcls_MenuItem22(Xcls_LeftProps _owner )
1189 this.el = new Gtk.MenuItem();
1193 // set gobject values
1194 this.el.tooltip_markup = "Add a flexy include (for HTML templates)";
1195 this.el.label = "Flexy - Include";
1198 this.el.activate.connect( ( ) =>{
1200 _this.addProp("prop", "flexy:include", "name_of_file.html", "string");
1204 // user defined functions
1207 public class Xcls_MenuItem23 : Object
1209 public Gtk.MenuItem el;
1210 private Xcls_LeftProps _this;
1216 public Xcls_MenuItem23(Xcls_LeftProps _owner )
1219 this.el = new Gtk.MenuItem();
1223 // set gobject values
1224 this.el.tooltip_markup = "Add a flexy foreach (for HTML templates)";
1225 this.el.label = "Flexy - Foreach";
1228 this.el.activate.connect( ( ) =>{
1230 _this.addProp("prop", "flexy:foreach", "array,key,value", "string");
1234 // user defined functions
1240 public class Xcls_EditProps : Object
1242 public Gtk.ScrolledWindow el;
1243 private Xcls_LeftProps _this;
1247 public bool editing;
1250 public Xcls_EditProps(Xcls_LeftProps _owner )
1253 _this.EditProps = this;
1254 this.el = new Gtk.ScrolledWindow( null, null );
1257 this.editing = false;
1259 // set gobject values
1260 this.el.shadow_type = Gtk.ShadowType.IN;
1261 var child_0 = new Xcls_view( _this );
1263 this.el.add ( child_0.el );
1269 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
1273 // user defined functions
1275 public class Xcls_view : Object
1277 public Gtk.TreeView el;
1278 private Xcls_LeftProps _this;
1282 public Xcls_PopoverProperty popover;
1285 public Xcls_view(Xcls_LeftProps _owner )
1289 this.el = new Gtk.TreeView();
1292 this.popover = null;
1294 // set gobject values
1295 this.el.tooltip_column = 5;
1296 this.el.enable_tree_lines = true;
1297 this.el.headers_visible = true;
1298 var child_0 = new Xcls_model( _this );
1300 this.el.set_model ( child_0.el );
1301 var child_1 = new Xcls_keycol( _this );
1303 this.el.append_column ( child_1.el );
1304 var child_2 = new Xcls_valcol( _this );
1306 this.el.append_column ( child_2.el );
1307 var child_3 = new Xcls_ContextMenu( _this );
1313 var selection = this.el.get_selection();
1314 selection.set_mode( Gtk.SelectionMode.SINGLE);
1317 var description = new Pango.FontDescription();
1318 description.set_size(10000);
1319 this.el.override_font(description);
1323 this.el.button_press_event.connect( ( ev) => {
1325 Gtk.TreeViewColumn col;
1329 if (!this.el.get_path_at_pos((int)ev.x, (int) ev.y, out path, out col, out cell_x, out cell_y )) {
1330 print("nothing selected on click");
1331 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
1332 this.el.get_selection().unselect_all();
1336 _this.before_edit();
1337 return false; //not on a element.
1341 // double click on name..
1342 if (ev.type == Gdk.EventType.2BUTTON_PRESS && ev.button == 1 && col.title == "Name") {
1345 if (this.popover == null) {
1346 this.popover = new Xcls_PopoverProperty();
1347 this.popover.mainwindow = _this.main_window;
1351 _this.before_edit();
1353 _this.keyrender.el.stop_editing(false);
1354 _this.keyrender.el.editable =false;
1356 _this.valrender.el.stop_editing(false);
1357 _this.valrender.el.editable =false;
1359 var mod = this.el.get_model();
1360 mod.get_iter (out iter, path);
1363 GLib.Value gvaltype, gval;
1364 mod.get_value(iter, 1 , out gval); // one is key..
1366 mod.get_value(iter,0, out gvaltype);
1368 this.popover.show(this.el, _this.node, (string)gvaltype, (string)gval);
1370 // _this.startEditingKey(path);
1379 if (ev.type == Gdk.EventType.BUTTON_PRESS && ev.button == 3) {
1381 //if (col.title == "Value") {
1382 // _this.before_edit();
1386 var p = _this.ContextMenu;
1388 p.el.set_screen(Gdk.Screen.get_default());
1390 p.el.popup(null, null, null, ev.button, ev.time);
1391 //Seed.print("click:" + res.column.title);
1393 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
1395 this.el.get_selection().select_path(path);
1398 _this.before_edit();
1403 if (col.title != "Value") {
1404 print("col title != Value");
1406 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
1407 this.el.get_selection().select_path(path);
1411 _this.before_edit();
1412 // XObject.error("column is not value?");
1413 return false; // ignore.. - key click.. ??? should we do this??
1417 // if the cell can be edited with a pulldown
1418 // then we should return true... - and let the start_editing handle it?
1425 // _this.before_edit(); <<< we really need to stop the other editor..
1426 _this.keyrender.el.stop_editing(false);
1427 _this.keyrender.el.editable =false;
1430 return _this.startEditingValue(path); // assumes selected row..
1439 // user defined functions
1441 public class Xcls_model : Object
1443 public Gtk.TreeStore el;
1444 private Xcls_LeftProps _this;
1450 public Xcls_model(Xcls_LeftProps _owner )
1454 this.el = new Gtk.TreeStore( 7, typeof(string), // 0 key type
1455 typeof(string), // 1 key
1456 typeof(string), // 2 key (display)
1457 typeof(string), // 3 value
1458 typeof(string), // 4 value (display)
1459 typeof(string), // 5 both (tooltip)
1460 typeof(string) // 6 key (for sorting)
1465 // set gobject values
1468 // user defined functions
1471 public class Xcls_keycol : Object
1473 public Gtk.TreeViewColumn el;
1474 private Xcls_LeftProps _this;
1480 public Xcls_keycol(Xcls_LeftProps _owner )
1483 _this.keycol = this;
1484 this.el = new Gtk.TreeViewColumn();
1488 // set gobject values
1489 this.el.title = "Name";
1490 this.el.resizable = true;
1491 var child_0 = new Xcls_keyrender( _this );
1493 this.el.pack_start ( child_0.el , false );
1497 this.el.add_attribute(_this.keyrender.el , "markup", 2 );
1498 this.el.add_attribute(_this.keyrender.el , "text", 1 );
1501 // user defined functions
1503 public class Xcls_keyrender : Object
1505 public Gtk.CellRendererText el;
1506 private Xcls_LeftProps _this;
1512 public Xcls_keyrender(Xcls_LeftProps _owner )
1515 _this.keyrender = this;
1516 this.el = new Gtk.CellRendererText();
1520 // set gobject values
1523 this.el.editing_started.connect( ( editable, path) => {
1526 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1531 // this.get('/LeftPanel.model').activePath = path;
1532 _this.model.el.get_value(iter,1, out gval);
1533 var val = (string)gval;
1535 ((Gtk.Entry)editable).set_text(val);
1537 this.el.edited.connect( (path, newtext) => {
1538 print("Keyrender - signal:edited\n");
1540 this.el.editable = false;
1545 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1548 _this.model.el.get_value(iter,1, out gval);
1549 var oldval = (string)gval;
1551 _this.model.el.get_value(iter,0, out gval);
1552 var ktype = (string)gval;
1554 _this.model.el.set_value(iter, 1, newtext);
1556 if (oldval == newtext) {
1561 print("ktype: %s\n",ktype);
1564 var ov = _this.node.listeners.get(oldval);
1565 _this.node.listeners.set(newtext, ov);
1566 _this.node.listeners.unset(oldval);
1568 _this.updateIter(iter, ktype, newtext, ov);
1572 var ov = _this.node.props.get(oldval);
1573 _this.node.props.set(newtext, ov);
1574 _this.node.props.unset(oldval);
1575 _this.updateIter(iter, ktype, newtext, ov);
1583 // user defined functions
1587 public class Xcls_valcol : Object
1589 public Gtk.TreeViewColumn el;
1590 private Xcls_LeftProps _this;
1596 public Xcls_valcol(Xcls_LeftProps _owner )
1599 _this.valcol = this;
1600 this.el = new Gtk.TreeViewColumn();
1604 // set gobject values
1605 this.el.title = "Value";
1606 this.el.resizable = true;
1607 var child_0 = new Xcls_valrender( _this );
1609 this.el.pack_start ( child_0.el , true );
1615 // typeof(string), // 0 key type
1616 // typeof(string), // 1 key
1617 // typeof(string), // 2 key (display)
1618 // typeof(string), // 3 value
1619 // typeof(string) // 4 value (display)
1622 this.el.add_attribute(_this.valrender.el , "text", 4 );
1623 //this.el.add_attribute(_this.valrender.el , "sensitive", 4 );
1624 //this.el.add_attribute(this.items[0].el , 'editable', 3 );
1625 // this.el.set_cell_data_func(cell, age_cell_data_func, NULL, NULL);
1627 // this.get('/LeftPanel').editableColumn= this;
1631 // user defined functions
1633 public class Xcls_valrender : Object
1635 public Gtk.CellRendererCombo el;
1636 private Xcls_LeftProps _this;
1642 public Xcls_valrender(Xcls_LeftProps _owner )
1645 _this.valrender = this;
1646 this.el = new Gtk.CellRendererCombo();
1650 // set gobject values
1651 this.el.editable = false;
1652 this.el.text_column = 0;
1653 this.el.has_entry = true;
1654 var child_0 = new Xcls_valrendermodel( _this );
1656 this.el.model = child_0.el;
1659 this.el.editing_started.connect( ( editable, path) => {
1660 //_this.editing = true;
1661 print("editing started called\n");
1662 if (!_this.allow_edit) {
1664 print("val - editing_Started\n");
1665 this.el.editable = false; // make sure it's not editor...
1670 _this.allow_edit =false;
1673 if ( this.el.has_entry ) {
1676 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1681 // this.get('/LeftPanel.model').activePath = path;
1682 _this.model.el.get_value(iter,3, out gval);
1685 var val = (string)gval;
1686 var combo = (Gtk.ComboBox)editable;
1688 var entry = (Gtk.Entry) combo.get_child();
1689 entry.set_text(val);
1693 this.el.edited.connect( (path, newtext) => {
1694 print("Valrender - signal:edited\n");
1696 this.el.editable = false;
1701 2, "<b>" + miter.get_key() + "</b>",
1702 3, miter.get_value(),
1703 4, display_value(short);
1709 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1712 _this.model.el.get_value(iter,0, out gval);
1713 var ktype = (string)gval;
1716 _this.model.el.get_value(iter,3, out gval);
1717 var oldval = (string)gval;
1719 _this.model.el.get_value(iter,1, out gval);
1720 var key = (string)gval;
1726 _this.node.listeners.set(key, newtext);
1727 _this.updateIter(iter,ktype,key,newtext);
1730 _this.node.props.set(key,newtext);
1731 _this.updateIter(iter,ktype, key,newtext);
1734 // _this.load(_this.file,_this.node);
1740 // user defined functions
1741 public void setOptions (string[] ar) {
1742 var m = _this.valrendermodel.el;
1745 for (var i =0; i < ar.length; i++) {
1747 m.set_value(iret, 0, ar[i]);
1752 public class Xcls_valrendermodel : Object
1754 public Gtk.ListStore el;
1755 private Xcls_LeftProps _this;
1761 public Xcls_valrendermodel(Xcls_LeftProps _owner )
1764 _this.valrendermodel = this;
1765 this.el = new Gtk.ListStore( 1, typeof(string) );
1769 // set gobject values
1772 // user defined functions
1777 public class Xcls_ContextMenu : Object
1780 private Xcls_LeftProps _this;
1786 public Xcls_ContextMenu(Xcls_LeftProps _owner )
1789 _this.ContextMenu = this;
1790 this.el = new Gtk.Menu();
1794 // set gobject values
1795 var child_0 = new Xcls_MenuItem33( _this );
1797 this.el.append ( child_0.el );
1798 var child_1 = new Xcls_SeparatorMenuItem34( _this );
1800 this.el.append ( child_1.el );
1801 var child_2 = new Xcls_MenuItem35( _this );
1803 this.el.append ( child_2.el );
1806 // user defined functions
1808 public class Xcls_MenuItem33 : Object
1810 public Gtk.MenuItem el;
1811 private Xcls_LeftProps _this;
1817 public Xcls_MenuItem33(Xcls_LeftProps _owner )
1820 this.el = new Gtk.MenuItem();
1824 // set gobject values
1825 this.el.label = "Edit";
1828 this.el.activate.connect( ( ) =>{
1830 var s = _this.view.el.get_selection();
1832 Gtk.TreeModel model;
1833 s.get_selected (out model, out iter);
1834 _this.startEditingKey(model.get_path(iter));
1838 // user defined functions
1841 public class Xcls_SeparatorMenuItem34 : Object
1843 public Gtk.SeparatorMenuItem el;
1844 private Xcls_LeftProps _this;
1850 public Xcls_SeparatorMenuItem34(Xcls_LeftProps _owner )
1853 this.el = new Gtk.SeparatorMenuItem();
1857 // set gobject values
1860 // user defined functions
1863 public class Xcls_MenuItem35 : Object
1865 public Gtk.MenuItem el;
1866 private Xcls_LeftProps _this;
1872 public Xcls_MenuItem35(Xcls_LeftProps _owner )
1875 this.el = new Gtk.MenuItem();
1879 // set gobject values
1880 this.el.label = "Delete";
1883 this.el.activate.connect( ( ) =>{
1884 _this.deleteSelected();
1888 // user defined functions