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 ) {
59 var m = _this.model.el;
62 m.foreach((mod, path, iter) => {
67 GLib.Value gvaltype, gval,kvalue;
68 mod.get_value(iter, 1 , out gval); // one is key..
70 mod.get_value(iter,0, out gvaltype);
72 mod.get_value(iter,3, out kvalue);
74 if (oldkey == ((string)gval) && type == ((string)gvaltype)) {
75 this.updateIter(iter, type, key, (string)kvalue);
87 public void before_edit ()
90 print("before edit - stop editing\n");
92 // these do not appear to trigger save...
93 _this.keyrender.el.stop_editing(false);
94 _this.keyrender.el.editable =false;
96 _this.valrender.el.stop_editing(false);
97 _this.valrender.el.editable =false;
100 // technicall stop the popup editor..
103 public string keySortFormat (string key) {
104 // listeners first - with 0
111 var bits = key.split(" ");
114 return "2 " + bits[bits.length -1];
118 return "3 " + bits[bits.length -1];
123 return "4 " + bits[bits.length -1];
126 return "5 " + bits[bits.length -1];
131 public void finish_editing () {
135 public bool startEditingValue ( Gtk.TreePath path) {
137 // ONLY return true if editing is allowed - eg. combo..
139 print("start editing?\n");
140 if (!this.stop_editor()) {
141 print("stop editor failed\n");
147 var mod = this.model.el;
148 mod.get_iter (out iter, path);
154 2, "<b>" + miter.get_key() + "</b>",
160 mod.get_value(iter, 3 , out gval);
161 var val = (string)gval;
163 mod.get_value(iter, 1 , out gval);
164 var key = (string)gval;
167 string kname, kflag, ktype;
168 this.node.normalize_key(key, out kname, out kflag, out ktype);
171 mod.get_value(iter, 0 , out gval);
172 var type = (string)gval; // listerner or prop..
176 var use_textarea = false;
178 //------------ things that require the text editor...
180 if (type == "listener") {
183 if (key.length > 0 && key[0] == '|') { // user defined method
186 if (key.length > 0 && key[0] == '$') { // raw string
189 if (key.length > 0 && key == "* init") {
192 if (val.length > 40) { // long value...
199 print("Call show editor\n");
200 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
201 this.view.el.get_selection().select_path(path);
203 this.show_editor(file, node, type, key);
212 var pal = Palete.factory(this.file.project.xtype);
215 var has_opts = pal.typeOptions(this.node.fqn(), kname, ktype, out opts);
219 // others... - fill in options for true/false?
220 print("turn on editing %s \n" , mod.get_path(iter).to_string());
224 print("start editing try/false)???");
225 this.valrender.el.has_entry = false;
227 this.valrender.setOptions(opts);
229 this.valrender.el.has_entry = false;
230 this.valrender.el.editable = true;
231 this.allow_edit = true;
232 GLib.Timeout.add_full(GLib.Priority.DEFAULT,100 , () => {
233 this.view.el.set_cursor_on_cell(
244 // see if type is a Enum.
251 this.valrender.setOptions(opts);
253 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
255 // at this point - work out the type...
256 // if its' a combo... then show the options..
257 this.valrender.el.has_entry = true;
259 this.valrender.el.editable = true;
262 this.allow_edit = true;
268 this.view.el.set_cursor_on_cell(
278 public void load (JsRender.JsRender file, JsRender.Node? node)
280 print("load leftprops\n");
286 this.model.el.clear();
288 //this.get('/RightEditor').el.hide();
295 //var provider = this.get('/LeftTree').getPaleteProvider();
298 //typeof(string), // 0 key type
299 //typeof(string), // 1 key
300 //typeof(string), // 2 key (display)
301 //typeof(string), // 3 value
302 //typeof(string), // 4 value (display)
303 //typeof(string), // 5 both (tooltip)
308 // really need a way to sort the hashmap...
309 var m = this.model.el;
311 var miter = node.listeners.map_iterator();
314 while(miter.next()) {
316 m.append(out iter,null);
318 this.updateIter(iter, "listener", miter.get_key(), miter.get_value());
324 miter = node.props.map_iterator();
327 while(miter.next()) {
329 m.append(out iter,null);
330 this.updateIter(iter, "prop", miter.get_key(), miter.get_value());
333 print("clear selection\n");
335 this.model.el.set_sort_column_id(6,Gtk.SortType.ASCENDING); // sort by real key..
337 this.view.el.get_selection().unselect_all();
339 var pane = _this.main_window.editpane.el;
340 var try_size = (i * 25) + 60; // est. 20px per line + 40px header
344 ((try_size * 1.0f) / (pane.max_position * 1.0f)) > 0.8f ?
345 (int) (pane.max_position * 0.2f) :
346 pane.max_position-try_size);
350 public string keyFormat (string val, string type) {
352 // Glib.markup_escape_text(val);
354 if (type == "listener") {
355 return "<span font_weight=\"bold\" color=\"#660000\">" +
356 GLib.Markup.escape_text(val) +
360 if (val.length < 1) {
361 return "<span color=\"#FF0000\">--empty--</span>";
366 //# - object properties
368 // all of these... - display value is last element..
369 var ar = val.strip().split(" ");
372 var dval = GLib.Markup.escape_text(ar[ar.length-1]);
378 case '@': // signal // just bold balck?
379 if (dval[0] == '@') {
380 dval = dval.substring(1);
383 return @"<span font_weight=\"bold\">@ $dval</span>";
384 case '#': // object properties?
385 if (dval[0] == '#') {
386 dval = dval.substring(1);
388 return @"<span font_weight=\"bold\">$dval</span>";
390 if (dval[0] == '*') {
391 dval = dval.substring(1);
393 return @"<span color=\"#0000CC\" font_weight=\"bold\">$dval</span>";
395 if (dval[0] == '$') {
396 dval = dval.substring(1);
398 return @"<span style=\"italic\">$dval</span>";
399 case '|': // user defined methods
400 if (dval[0] == '|') {
401 dval = dval.substring(1);
403 return @"<span color=\"#008000\" font_weight=\"bold\">$dval</span>";
414 public void deleteSelected () {
419 var s = this.view.el.get_selection();
420 s.get_selected(out mod, out iter);
424 mod.get_value(iter, 0 , out gval);
425 var type = (string)gval;
427 mod.get_value(iter, 1 , out gval);
428 var key = (string)gval;
432 this.node.listeners.unset(key);
436 this.node.props.unset(key);
439 this.load(this.file, this.node);
443 public void startEditingKey ( Gtk.TreePath path) {
445 if (!this.stop_editor()) {
449 // others... - fill in options for true/false?
452 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
453 this.allow_edit = true;
454 this.keyrender.el.editable = true;
456 this.view.el.set_cursor_on_cell(
468 public void addProp (string in_type, string key, string value, string value_type) {
469 // info includes key, val, skel, etype..
470 //console.dump(info);
471 //type = info.type.toLowerCase();
472 //var data = this.toJS();
474 var type = in_type == "signals" ? "listener" : in_type;
476 var fkey = (value_type.length > 0 ? value_type + " " : "") + key;
478 if (type == "listener") {
479 if (this.node.listeners.has_key(key)) {
482 this.node.listeners.set(key,value);
485 if (this.node.props.has_key(fkey)) {
488 this.node.props.set(fkey,value);
493 this.load(this.file, this.node);
497 /// need to find the row which I've just added..
500 var s = this.view.el.get_selection();
503 print("trying to find new iter");
505 this.model.el.foreach((model, path, iter) => {
508 this.model.el.get_value(iter, 0 , out gval);
509 if ((string)gval != type) {
510 print("not type: %s = %s\n", (string)gval , type);
513 this.model.el.get_value(iter, 1 , out gval);
514 if ((string)gval != fkey) {
515 print("not key: %s = %s\n", (string)gval , fkey);
519 GLib.Timeout.add_full(GLib.Priority.DEFAULT,40 , () => {
521 this.startEditingValue(this.model.el.get_path(iter));
524 //s.select_iter(iter);
532 public void updateIter (Gtk.TreeIter iter, string type, string key, string kvalue) {
534 print("update Iter %s, %s\n", key,value);
535 //typeof(string), // 0 key type
536 //typeof(string), // 1 key
537 //typeof(string), // 2 key (display)
538 //typeof(string), // 3 value
539 //typeof(string), // 4 value (display)
540 //typeof(string), // 5 both (tooltip)
541 //typeof(string), // 6 key (sort)
543 var dl = value.strip().split("\n");
545 var dis_val = dl.length > 1 ? (dl[0].strip()+ "...") : dl[0];
547 if (type == "listener") {
551 this.model.el.set(iter,
554 2, this.keyFormat(key ,type),
557 5, "<tt>" + GLib.Markup.escape_text(key + " " +value) + "</tt>",
565 this.model.el.set(iter,
568 2, this.keyFormat(key , "prop"),
571 5, "<tt>" + GLib.Markup.escape_text(key + " " + value) + "</tt>",
572 6, this.keySortFormat(key)
575 public class Xcls_Box2 : Object
578 private Xcls_LeftProps _this;
584 public Xcls_Box2(Xcls_LeftProps _owner )
587 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
591 // set gobject values
592 var child_0 = new Xcls_Button3( _this );
594 this.el.add ( child_0.el );
597 // user defined functions
599 public class Xcls_Button3 : Object
601 public Gtk.Button el;
602 private Xcls_LeftProps _this;
608 public Xcls_Button3(Xcls_LeftProps _owner )
611 this.el = new Gtk.Button();
615 // set gobject values
616 this.el.hexpand = true;
617 var child_0 = new Xcls_Box4( _this );
619 this.el.add ( child_0.el );
620 var child_1 = new Xcls_AddPropertyPopup( _this );
624 this.el.button_press_event.connect( (self, ev) => {
628 var p = _this.AddPropertyPopup;
629 p.el.set_screen(Gdk.Screen.get_default());
631 p.el.popup(null, null, null, ev.button, ev.time);
636 // user defined functions
638 public class Xcls_Box4 : Object
641 private Xcls_LeftProps _this;
647 public Xcls_Box4(Xcls_LeftProps _owner )
650 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
654 // set gobject values
655 var child_0 = new Xcls_Image5( _this );
657 this.el.add ( child_0.el );
658 var child_1 = new Xcls_Label6( _this );
660 this.el.add ( child_1.el );
663 // user defined functions
665 public class Xcls_Image5 : Object
668 private Xcls_LeftProps _this;
674 public Xcls_Image5(Xcls_LeftProps _owner )
677 this.el = new Gtk.Image();
681 // set gobject values
682 this.el.stock = Gtk.Stock.ADD;
683 this.el.icon_size = Gtk.IconSize.MENU;
686 // user defined functions
689 public class Xcls_Label6 : Object
692 private Xcls_LeftProps _this;
698 public Xcls_Label6(Xcls_LeftProps _owner )
701 this.el = new Gtk.Label( "Other" );
705 // set gobject values
708 // user defined functions
712 public class Xcls_AddPropertyPopup : Object
715 private Xcls_LeftProps _this;
721 public Xcls_AddPropertyPopup(Xcls_LeftProps _owner )
724 _this.AddPropertyPopup = this;
725 this.el = new Gtk.Menu();
729 // set gobject values
730 var child_0 = new Xcls_MenuItem8( _this );
732 this.el.append ( child_0.el );
733 var child_1 = new Xcls_MenuItem9( _this );
735 this.el.append ( child_1.el );
736 var child_2 = new Xcls_MenuItem10( _this );
738 this.el.append ( child_2.el );
739 var child_3 = new Xcls_MenuItem11( _this );
741 this.el.append ( child_3.el );
742 var child_4 = new Xcls_SeparatorMenuItem12( _this );
744 this.el.add ( child_4.el );
745 var child_5 = new Xcls_MenuItem13( _this );
747 this.el.append ( child_5.el );
748 var child_6 = new Xcls_MenuItem14( _this );
750 this.el.append ( child_6.el );
751 var child_7 = new Xcls_MenuItem15( _this );
753 this.el.append ( child_7.el );
754 var child_8 = new Xcls_SeparatorMenuItem16( _this );
756 this.el.add ( child_8.el );
757 var child_9 = new Xcls_MenuItem17( _this );
759 this.el.append ( child_9.el );
760 var child_10 = new Xcls_MenuItem18( _this );
762 this.el.append ( child_10.el );
763 var child_11 = new Xcls_MenuItem19( _this );
765 this.el.append ( child_11.el );
766 var child_12 = new Xcls_SeparatorMenuItem20( _this );
768 this.el.add ( child_12.el );
769 var child_13 = new Xcls_MenuItem21( _this );
771 this.el.append ( child_13.el );
772 var child_14 = new Xcls_MenuItem22( _this );
774 this.el.append ( child_14.el );
775 var child_15 = new Xcls_MenuItem23( _this );
777 this.el.append ( child_15.el );
780 // user defined functions
782 public class Xcls_MenuItem8 : Object
784 public Gtk.MenuItem el;
785 private Xcls_LeftProps _this;
791 public Xcls_MenuItem8(Xcls_LeftProps _owner )
794 this.el = new Gtk.MenuItem();
798 // set gobject values
799 this.el.tooltip_markup = "Using _this.{ID} will map to this element";
800 this.el.label = "id: _this.{ID} (Vala)";
803 this.el.activate.connect( () => {
804 _this.addProp( "prop", "id", "", "");
808 // user defined functions
811 public class Xcls_MenuItem9 : Object
813 public Gtk.MenuItem el;
814 private Xcls_LeftProps _this;
820 public Xcls_MenuItem9(Xcls_LeftProps _owner )
823 this.el = new Gtk.MenuItem();
827 // set gobject values
828 this.el.tooltip_markup = "how to pack this element onto parent, (method, 2nd arg, 3rd arg) .. the 1st argument is filled by the element";
829 this.el.label = "pack: Pack method (Vala)";
832 this.el.activate.connect( ( ) => {
834 _this.addProp( "prop", "pack","add", "*");
838 // user defined functions
841 public class Xcls_MenuItem10 : Object
843 public Gtk.MenuItem el;
844 private Xcls_LeftProps _this;
850 public Xcls_MenuItem10(Xcls_LeftProps _owner )
853 this.el = new Gtk.MenuItem();
857 // set gobject values
858 this.el.tooltip_markup = "eg. \n\nnew Clutter.Image.from_file(.....)";
859 this.el.label = "ctor: Alterative to default contructor";
862 this.el.activate.connect( ( ) => {
864 _this.addProp( "prop", "ctor","", "*");
868 // user defined functions
871 public class Xcls_MenuItem11 : Object
873 public Gtk.MenuItem el;
874 private Xcls_LeftProps _this;
880 public Xcls_MenuItem11(Xcls_LeftProps _owner )
883 this.el = new Gtk.MenuItem();
887 // set gobject values
888 this.el.tooltip_markup = "This code is called after the ctor";
889 this.el.label = "init: initialziation code (vala)";
892 this.el.activate.connect( ( ) => {
894 _this.addProp( "prop", "init", "{\n\n}\n", "*" );
898 // user defined functions
901 public class Xcls_SeparatorMenuItem12 : Object
903 public Gtk.SeparatorMenuItem el;
904 private Xcls_LeftProps _this;
910 public Xcls_SeparatorMenuItem12(Xcls_LeftProps _owner )
913 this.el = new Gtk.SeparatorMenuItem();
917 // set gobject values
920 // user defined functions
923 public class Xcls_MenuItem13 : Object
925 public Gtk.MenuItem el;
926 private Xcls_LeftProps _this;
932 public Xcls_MenuItem13(Xcls_LeftProps _owner )
935 this.el = new Gtk.MenuItem();
939 // set gobject values
940 this.el.tooltip_markup = "Add a user defined string property";
941 this.el.label = "String";
944 this.el.activate.connect( (self) => {
946 _this.addProp( "prop", "XXXX", "","string");
951 // user defined functions
954 public class Xcls_MenuItem14 : Object
956 public Gtk.MenuItem el;
957 private Xcls_LeftProps _this;
963 public Xcls_MenuItem14(Xcls_LeftProps _owner )
966 this.el = new Gtk.MenuItem();
970 // set gobject values
971 this.el.tooltip_markup = "Add a user defined number property";
972 this.el.label = "Number";
975 this.el.activate.connect( ( ) =>{
977 _this.addProp("prop", "XXX", "0", "int");
981 // user defined functions
984 public class Xcls_MenuItem15 : Object
986 public Gtk.MenuItem el;
987 private Xcls_LeftProps _this;
993 public Xcls_MenuItem15(Xcls_LeftProps _owner )
996 this.el = new Gtk.MenuItem();
1000 // set gobject values
1001 this.el.tooltip_markup = "Add a user defined boolean property";
1002 this.el.label = "Boolean";
1005 this.el.activate.connect( ( ) =>{
1007 _this.addProp( "prop", "XXX", "true", "bool");
1011 // user defined functions
1014 public class Xcls_SeparatorMenuItem16 : Object
1016 public Gtk.SeparatorMenuItem el;
1017 private Xcls_LeftProps _this;
1023 public Xcls_SeparatorMenuItem16(Xcls_LeftProps _owner )
1026 this.el = new Gtk.SeparatorMenuItem();
1030 // set gobject values
1033 // user defined functions
1036 public class Xcls_MenuItem17 : Object
1038 public Gtk.MenuItem el;
1039 private Xcls_LeftProps _this;
1045 public Xcls_MenuItem17(Xcls_LeftProps _owner )
1048 this.el = new Gtk.MenuItem();
1052 // set gobject values
1053 this.el.tooltip_markup = "Add a user function boolean property";
1054 this.el.label = "Javascript Function";
1057 this.el.activate.connect( ( ) =>{
1059 _this.addProp("prop", "XXXX", "function() { }", "| function");
1063 // user defined functions
1066 public class Xcls_MenuItem18 : Object
1068 public Gtk.MenuItem el;
1069 private Xcls_LeftProps _this;
1075 public Xcls_MenuItem18(Xcls_LeftProps _owner )
1078 this.el = new Gtk.MenuItem();
1082 // set gobject values
1083 this.el.tooltip_markup = "Add a user function boolean property";
1084 this.el.label = "Vala Method";
1087 this.el.activate.connect( ( ) =>{
1089 _this.addProp( "prop", "XXXX", "() {\n\n}\n", "| return_type");
1093 // user defined functions
1096 public class Xcls_MenuItem19 : Object
1098 public Gtk.MenuItem el;
1099 private Xcls_LeftProps _this;
1105 public Xcls_MenuItem19(Xcls_LeftProps _owner )
1108 this.el = new Gtk.MenuItem();
1112 // set gobject values
1113 this.el.tooltip_markup = "Add a vala signal";
1114 this.el.label = "Vala Signal";
1117 this.el.activate.connect( ( ) =>{
1119 _this.addProp( "prop", "XXXX", "()", "@ void");
1123 // user defined functions
1126 public class Xcls_SeparatorMenuItem20 : Object
1128 public Gtk.SeparatorMenuItem el;
1129 private Xcls_LeftProps _this;
1135 public Xcls_SeparatorMenuItem20(Xcls_LeftProps _owner )
1138 this.el = new Gtk.SeparatorMenuItem();
1142 // set gobject values
1145 // user defined functions
1148 public class Xcls_MenuItem21 : Object
1150 public Gtk.MenuItem el;
1151 private Xcls_LeftProps _this;
1157 public Xcls_MenuItem21(Xcls_LeftProps _owner )
1160 this.el = new Gtk.MenuItem();
1164 // set gobject values
1165 this.el.tooltip_markup = "Add a flexy if (for HTML templates)";
1166 this.el.label = "Flexy - If";
1169 this.el.activate.connect( ( ) =>{
1171 _this.addProp("prop", "flexy:if", "value_or_condition", "string");
1175 // user defined functions
1178 public class Xcls_MenuItem22 : Object
1180 public Gtk.MenuItem el;
1181 private Xcls_LeftProps _this;
1187 public Xcls_MenuItem22(Xcls_LeftProps _owner )
1190 this.el = new Gtk.MenuItem();
1194 // set gobject values
1195 this.el.tooltip_markup = "Add a flexy include (for HTML templates)";
1196 this.el.label = "Flexy - Include";
1199 this.el.activate.connect( ( ) =>{
1201 _this.addProp("prop", "flexy:include", "name_of_file.html", "string");
1205 // user defined functions
1208 public class Xcls_MenuItem23 : Object
1210 public Gtk.MenuItem el;
1211 private Xcls_LeftProps _this;
1217 public Xcls_MenuItem23(Xcls_LeftProps _owner )
1220 this.el = new Gtk.MenuItem();
1224 // set gobject values
1225 this.el.tooltip_markup = "Add a flexy foreach (for HTML templates)";
1226 this.el.label = "Flexy - Foreach";
1229 this.el.activate.connect( ( ) =>{
1231 _this.addProp("prop", "flexy:foreach", "array,key,value", "string");
1235 // user defined functions
1241 public class Xcls_EditProps : Object
1243 public Gtk.ScrolledWindow el;
1244 private Xcls_LeftProps _this;
1248 public bool editing;
1251 public Xcls_EditProps(Xcls_LeftProps _owner )
1254 _this.EditProps = this;
1255 this.el = new Gtk.ScrolledWindow( null, null );
1258 this.editing = false;
1260 // set gobject values
1261 this.el.shadow_type = Gtk.ShadowType.IN;
1262 var child_0 = new Xcls_view( _this );
1264 this.el.add ( child_0.el );
1270 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
1274 // user defined functions
1276 public class Xcls_view : Object
1278 public Gtk.TreeView el;
1279 private Xcls_LeftProps _this;
1283 public Xcls_PopoverProperty popover;
1286 public Xcls_view(Xcls_LeftProps _owner )
1290 this.el = new Gtk.TreeView();
1293 this.popover = null;
1295 // set gobject values
1296 this.el.tooltip_column = 5;
1297 this.el.enable_tree_lines = true;
1298 this.el.headers_visible = true;
1299 var child_0 = new Xcls_model( _this );
1301 this.el.set_model ( child_0.el );
1302 var child_1 = new Xcls_keycol( _this );
1304 this.el.append_column ( child_1.el );
1305 var child_2 = new Xcls_valcol( _this );
1307 this.el.append_column ( child_2.el );
1308 var child_3 = new Xcls_ContextMenu( _this );
1314 var selection = this.el.get_selection();
1315 selection.set_mode( Gtk.SelectionMode.SINGLE);
1318 var description = new Pango.FontDescription();
1319 description.set_size(10000);
1320 this.el.override_font(description);
1324 this.el.button_press_event.connect( ( ev) => {
1326 Gtk.TreeViewColumn col;
1330 if (!this.el.get_path_at_pos((int)ev.x, (int) ev.y, out path, out col, out cell_x, out cell_y )) {
1331 print("nothing selected on click");
1332 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
1333 this.el.get_selection().unselect_all();
1337 _this.before_edit();
1338 return false; //not on a element.
1342 // double click on name..
1343 if (ev.type == Gdk.EventType.2BUTTON_PRESS && ev.button == 1 && col.title == "Name") {
1346 if (this.popover == null) {
1347 this.popover = new Xcls_PopoverProperty();
1348 this.popover.mainwindow = _this.main_window;
1352 _this.before_edit();
1354 _this.keyrender.el.stop_editing(false);
1355 _this.keyrender.el.editable =false;
1357 _this.valrender.el.stop_editing(false);
1358 _this.valrender.el.editable =false;
1360 var mod = this.el.get_model();
1361 mod.get_iter (out iter, path);
1364 GLib.Value gvaltype, gval;
1365 mod.get_value(iter, 1 , out gval); // one is key..
1367 mod.get_value(iter,0, out gvaltype);
1369 //this.popover.show(this.el, _this.node, (string)gvaltype, (string)gval);
1371 _this.startEditingKey(path);
1380 if (ev.type == Gdk.EventType.BUTTON_PRESS && ev.button == 3) {
1382 //if (col.title == "Value") {
1383 // _this.before_edit();
1387 var p = _this.ContextMenu;
1389 p.el.set_screen(Gdk.Screen.get_default());
1391 p.el.popup(null, null, null, ev.button, ev.time);
1392 //Seed.print("click:" + res.column.title);
1394 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
1396 this.el.get_selection().select_path(path);
1399 _this.before_edit();
1404 if (col.title != "Value") {
1405 print("col title != Value");
1407 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
1408 this.el.get_selection().select_path(path);
1412 _this.before_edit();
1413 // XObject.error("column is not value?");
1414 return false; // ignore.. - key click.. ??? should we do this??
1418 // if the cell can be edited with a pulldown
1419 // then we should return true... - and let the start_editing handle it?
1426 // _this.before_edit(); <<< we really need to stop the other editor..
1427 _this.keyrender.el.stop_editing(false);
1428 _this.keyrender.el.editable =false;
1431 return _this.startEditingValue(path); // assumes selected row..
1440 // user defined functions
1442 public class Xcls_model : Object
1444 public Gtk.TreeStore el;
1445 private Xcls_LeftProps _this;
1451 public Xcls_model(Xcls_LeftProps _owner )
1455 this.el = new Gtk.TreeStore( 7, typeof(string), // 0 key type
1456 typeof(string), // 1 key
1457 typeof(string), // 2 key (display)
1458 typeof(string), // 3 value
1459 typeof(string), // 4 value (display)
1460 typeof(string), // 5 both (tooltip)
1461 typeof(string) // 6 key (for sorting)
1466 // set gobject values
1469 // user defined functions
1472 public class Xcls_keycol : Object
1474 public Gtk.TreeViewColumn el;
1475 private Xcls_LeftProps _this;
1481 public Xcls_keycol(Xcls_LeftProps _owner )
1484 _this.keycol = this;
1485 this.el = new Gtk.TreeViewColumn();
1489 // set gobject values
1490 this.el.title = "Name";
1491 this.el.resizable = true;
1492 var child_0 = new Xcls_keyrender( _this );
1494 this.el.pack_start ( child_0.el , false );
1498 this.el.add_attribute(_this.keyrender.el , "markup", 2 );
1499 this.el.add_attribute(_this.keyrender.el , "text", 1 );
1502 // user defined functions
1504 public class Xcls_keyrender : Object
1506 public Gtk.CellRendererText el;
1507 private Xcls_LeftProps _this;
1513 public Xcls_keyrender(Xcls_LeftProps _owner )
1516 _this.keyrender = this;
1517 this.el = new Gtk.CellRendererText();
1521 // set gobject values
1524 this.el.editing_started.connect( ( editable, path) => {
1527 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1532 // this.get('/LeftPanel.model').activePath = path;
1533 _this.model.el.get_value(iter,1, out gval);
1534 var val = (string)gval;
1536 ((Gtk.Entry)editable).set_text(val);
1538 this.el.edited.connect( (path, newtext) => {
1539 print("Keyrender - signal:edited\n");
1541 this.el.editable = false;
1546 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1549 _this.model.el.get_value(iter,1, out gval);
1550 var oldval = (string)gval;
1552 _this.model.el.get_value(iter,0, out gval);
1553 var ktype = (string)gval;
1555 _this.model.el.set_value(iter, 1, newtext);
1557 if (oldval == newtext) {
1562 print("ktype: %s\n",ktype);
1565 var ov = _this.node.listeners.get(oldval);
1566 _this.node.listeners.set(newtext, ov);
1567 _this.node.listeners.unset(oldval);
1569 _this.updateIter(iter, ktype, newtext, ov);
1573 var ov = _this.node.props.get(oldval);
1574 _this.node.props.set(newtext, ov);
1575 _this.node.props.unset(oldval);
1576 _this.updateIter(iter, ktype, newtext, ov);
1584 // user defined functions
1588 public class Xcls_valcol : Object
1590 public Gtk.TreeViewColumn el;
1591 private Xcls_LeftProps _this;
1597 public Xcls_valcol(Xcls_LeftProps _owner )
1600 _this.valcol = this;
1601 this.el = new Gtk.TreeViewColumn();
1605 // set gobject values
1606 this.el.title = "Value";
1607 this.el.resizable = true;
1608 var child_0 = new Xcls_valrender( _this );
1610 this.el.pack_start ( child_0.el , true );
1616 // typeof(string), // 0 key type
1617 // typeof(string), // 1 key
1618 // typeof(string), // 2 key (display)
1619 // typeof(string), // 3 value
1620 // typeof(string) // 4 value (display)
1623 this.el.add_attribute(_this.valrender.el , "text", 4 );
1624 //this.el.add_attribute(_this.valrender.el , "sensitive", 4 );
1625 //this.el.add_attribute(this.items[0].el , 'editable', 3 );
1626 // this.el.set_cell_data_func(cell, age_cell_data_func, NULL, NULL);
1628 // this.get('/LeftPanel').editableColumn= this;
1632 // user defined functions
1634 public class Xcls_valrender : Object
1636 public Gtk.CellRendererCombo el;
1637 private Xcls_LeftProps _this;
1643 public Xcls_valrender(Xcls_LeftProps _owner )
1646 _this.valrender = this;
1647 this.el = new Gtk.CellRendererCombo();
1651 // set gobject values
1652 this.el.editable = false;
1653 this.el.text_column = 0;
1654 this.el.has_entry = true;
1655 var child_0 = new Xcls_valrendermodel( _this );
1657 this.el.model = child_0.el;
1660 this.el.editing_started.connect( ( editable, path) => {
1661 //_this.editing = true;
1662 print("editing started called\n");
1663 if (!_this.allow_edit) {
1665 print("val - editing_Started\n");
1666 this.el.editable = false; // make sure it's not editor...
1671 _this.allow_edit =false;
1674 if ( this.el.has_entry ) {
1677 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1682 // this.get('/LeftPanel.model').activePath = path;
1683 _this.model.el.get_value(iter,3, out gval);
1686 var val = (string)gval;
1687 var combo = (Gtk.ComboBox)editable;
1689 var entry = (Gtk.Entry) combo.get_child();
1690 entry.set_text(val);
1694 this.el.edited.connect( (path, newtext) => {
1695 print("Valrender - signal:edited\n");
1697 this.el.editable = false;
1702 2, "<b>" + miter.get_key() + "</b>",
1703 3, miter.get_value(),
1704 4, display_value(short);
1710 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1713 _this.model.el.get_value(iter,0, out gval);
1714 var ktype = (string)gval;
1717 _this.model.el.get_value(iter,3, out gval);
1718 var oldval = (string)gval;
1720 _this.model.el.get_value(iter,1, out gval);
1721 var key = (string)gval;
1727 _this.node.listeners.set(key, newtext);
1728 _this.updateIter(iter,ktype,key,newtext);
1731 _this.node.props.set(key,newtext);
1732 _this.updateIter(iter,ktype, key,newtext);
1735 // _this.load(_this.file,_this.node);
1741 // user defined functions
1742 public void setOptions (string[] ar) {
1743 var m = _this.valrendermodel.el;
1746 for (var i =0; i < ar.length; i++) {
1748 m.set_value(iret, 0, ar[i]);
1753 public class Xcls_valrendermodel : Object
1755 public Gtk.ListStore el;
1756 private Xcls_LeftProps _this;
1762 public Xcls_valrendermodel(Xcls_LeftProps _owner )
1765 _this.valrendermodel = this;
1766 this.el = new Gtk.ListStore( 1, typeof(string) );
1770 // set gobject values
1773 // user defined functions
1778 public class Xcls_ContextMenu : Object
1781 private Xcls_LeftProps _this;
1787 public Xcls_ContextMenu(Xcls_LeftProps _owner )
1790 _this.ContextMenu = this;
1791 this.el = new Gtk.Menu();
1795 // set gobject values
1796 var child_0 = new Xcls_MenuItem33( _this );
1798 this.el.append ( child_0.el );
1799 var child_1 = new Xcls_SeparatorMenuItem34( _this );
1801 this.el.append ( child_1.el );
1802 var child_2 = new Xcls_MenuItem35( _this );
1804 this.el.append ( child_2.el );
1807 // user defined functions
1809 public class Xcls_MenuItem33 : Object
1811 public Gtk.MenuItem el;
1812 private Xcls_LeftProps _this;
1818 public Xcls_MenuItem33(Xcls_LeftProps _owner )
1821 this.el = new Gtk.MenuItem();
1825 // set gobject values
1826 this.el.label = "Edit";
1829 this.el.activate.connect( ( ) =>{
1831 var s = _this.view.el.get_selection();
1833 Gtk.TreeModel model;
1834 s.get_selected (out model, out iter);
1835 _this.startEditingKey(model.get_path(iter));
1839 // user defined functions
1842 public class Xcls_SeparatorMenuItem34 : Object
1844 public Gtk.SeparatorMenuItem el;
1845 private Xcls_LeftProps _this;
1851 public Xcls_SeparatorMenuItem34(Xcls_LeftProps _owner )
1854 this.el = new Gtk.SeparatorMenuItem();
1858 // set gobject values
1861 // user defined functions
1864 public class Xcls_MenuItem35 : Object
1866 public Gtk.MenuItem el;
1867 private Xcls_LeftProps _this;
1873 public Xcls_MenuItem35(Xcls_LeftProps _owner )
1876 this.el = new Gtk.MenuItem();
1880 // set gobject values
1881 this.el.label = "Delete";
1884 this.el.activate.connect( ( ) =>{
1885 _this.deleteSelected();
1889 // user defined functions