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;
135 var type_ar = key.split(" ");
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 void addProp (string in_type, string key, string value, string value_type) {
439 // info includes key, val, skel, etype..
440 //console.dump(info);
441 //type = info.type.toLowerCase();
442 //var data = this.toJS();
444 var type = in_type == "signals" ? "listener" : in_type;
446 var fkey = (value_type.length > 0 ? value_type + " " : "") + key;
448 if (type == "listener") {
449 if (this.node.listeners.has_key(key)) {
452 this.node.listeners.set(key,value);
455 if (this.node.props.has_key(fkey)) {
458 this.node.props.set(fkey,value);
463 this.load(this.file, this.node);
467 /// need to find the row which I've just added..
470 var s = this.view.el.get_selection();
473 print("trying to find new iter");
475 this.model.el.foreach((model, path, iter) => {
478 this.model.el.get_value(iter, 0 , out gval);
479 if ((string)gval != type) {
480 print("not type: %s = %s\n", (string)gval , type);
483 this.model.el.get_value(iter, 1 , out gval);
484 if ((string)gval != fkey) {
485 print("not key: %s = %s\n", (string)gval , fkey);
489 GLib.Timeout.add_full(GLib.Priority.DEFAULT,40 , () => {
491 this.startEditingValue(this.model.el.get_path(iter));
494 //s.select_iter(iter);
502 public void updateIter (Gtk.TreeIter iter, string type, string key, string value) {
504 print("update Iter %s, %s\n", key,value);
505 //typeof(string), // 0 key type
506 //typeof(string), // 1 key
507 //typeof(string), // 2 key (display)
508 //typeof(string), // 3 value
509 //typeof(string), // 4 value (display)
510 //typeof(string), // 5 both (tooltip)
511 //typeof(string), // 6 key (sort)
513 var dl = value.strip().split("\n");
515 var dis_val = dl.length > 1 ? (dl[0].strip()+ "...") : dl[0];
517 if (type == "listener") {
521 this.model.el.set(iter,
524 2, this.keyFormat(key ,type),
527 5, "<tt>" + GLib.Markup.escape_text(key + " " +value) + "</tt>",
535 this.model.el.set(iter,
538 2, this.keyFormat(key , "prop"),
541 5, "<tt>" + GLib.Markup.escape_text(key + " " + value) + "</tt>",
542 6, this.keySortFormat(key)
545 public class Xcls_Box2 : Object
548 private Xcls_LeftProps _this;
554 public Xcls_Box2(Xcls_LeftProps _owner )
557 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
561 // set gobject values
562 var child_0 = new Xcls_Button3( _this );
564 this.el.add ( child_0.el );
567 // user defined functions
569 public class Xcls_Button3 : Object
571 public Gtk.Button el;
572 private Xcls_LeftProps _this;
578 public Xcls_Button3(Xcls_LeftProps _owner )
581 this.el = new Gtk.Button();
585 // set gobject values
586 var child_0 = new Xcls_Box4( _this );
588 this.el.add ( child_0.el );
589 var child_1 = new Xcls_AddPropertyPopup( _this );
593 this.el.button_press_event.connect( (self, ev) => {
597 var p = _this.AddPropertyPopup;
598 p.el.set_screen(Gdk.Screen.get_default());
600 p.el.popup(null, null, null, ev.button, ev.time);
605 // user defined functions
607 public class Xcls_Box4 : Object
610 private Xcls_LeftProps _this;
616 public Xcls_Box4(Xcls_LeftProps _owner )
619 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
623 // set gobject values
624 var child_0 = new Xcls_Image5( _this );
626 this.el.add ( child_0.el );
627 var child_1 = new Xcls_Label6( _this );
629 this.el.add ( child_1.el );
632 // user defined functions
634 public class Xcls_Image5 : Object
637 private Xcls_LeftProps _this;
643 public Xcls_Image5(Xcls_LeftProps _owner )
646 this.el = new Gtk.Image();
650 // set gobject values
651 this.el.stock = Gtk.STOCK_ADD;
652 this.el.icon_size = Gtk.IconSize.MENU;
655 // user defined functions
658 public class Xcls_Label6 : Object
661 private Xcls_LeftProps _this;
667 public Xcls_Label6(Xcls_LeftProps _owner )
670 this.el = new Gtk.Label( "Other" );
674 // set gobject values
677 // user defined functions
681 public class Xcls_AddPropertyPopup : Object
684 private Xcls_LeftProps _this;
690 public Xcls_AddPropertyPopup(Xcls_LeftProps _owner )
693 _this.AddPropertyPopup = this;
694 this.el = new Gtk.Menu();
698 // set gobject values
699 var child_0 = new Xcls_MenuItem8( _this );
701 this.el.append ( child_0.el );
702 var child_1 = new Xcls_MenuItem9( _this );
704 this.el.append ( child_1.el );
705 var child_2 = new Xcls_MenuItem10( _this );
707 this.el.append ( child_2.el );
708 var child_3 = new Xcls_MenuItem11( _this );
710 this.el.append ( child_3.el );
711 var child_4 = new Xcls_SeparatorMenuItem12( _this );
713 this.el.add ( child_4.el );
714 var child_5 = new Xcls_MenuItem13( _this );
716 this.el.append ( child_5.el );
717 var child_6 = new Xcls_MenuItem14( _this );
719 this.el.append ( child_6.el );
720 var child_7 = new Xcls_MenuItem15( _this );
722 this.el.append ( child_7.el );
723 var child_8 = new Xcls_SeparatorMenuItem16( _this );
725 this.el.add ( child_8.el );
726 var child_9 = new Xcls_MenuItem17( _this );
728 this.el.append ( child_9.el );
729 var child_10 = new Xcls_MenuItem18( _this );
731 this.el.append ( child_10.el );
732 var child_11 = new Xcls_MenuItem19( _this );
734 this.el.append ( child_11.el );
735 var child_12 = new Xcls_SeparatorMenuItem20( _this );
737 this.el.add ( child_12.el );
738 var child_13 = new Xcls_MenuItem21( _this );
740 this.el.append ( child_13.el );
741 var child_14 = new Xcls_MenuItem22( _this );
743 this.el.append ( child_14.el );
744 var child_15 = new Xcls_MenuItem23( _this );
746 this.el.append ( child_15.el );
749 // user defined functions
751 public class Xcls_MenuItem8 : Object
753 public Gtk.MenuItem el;
754 private Xcls_LeftProps _this;
760 public Xcls_MenuItem8(Xcls_LeftProps _owner )
763 this.el = new Gtk.MenuItem();
767 // set gobject values
768 this.el.tooltip_markup = "Using _this.{ID} will map to this element";
769 this.el.label = "id: _this.{ID} (Vala)";
772 this.el.activate.connect( () => {
773 _this.addProp( "prop", "id", "", "");
777 // user defined functions
780 public class Xcls_MenuItem9 : Object
782 public Gtk.MenuItem el;
783 private Xcls_LeftProps _this;
789 public Xcls_MenuItem9(Xcls_LeftProps _owner )
792 this.el = new Gtk.MenuItem();
796 // set gobject values
797 this.el.tooltip_markup = "how to pack this element onto parent, (method, 2nd arg, 3rd arg) .. the 1st argument is filled by the element";
798 this.el.label = "pack: Pack method (Vala)";
801 this.el.activate.connect( ( ) => {
803 _this.addProp( "prop", "pack","add", "*");
807 // user defined functions
810 public class Xcls_MenuItem10 : Object
812 public Gtk.MenuItem el;
813 private Xcls_LeftProps _this;
819 public Xcls_MenuItem10(Xcls_LeftProps _owner )
822 this.el = new Gtk.MenuItem();
826 // set gobject values
827 this.el.tooltip_markup = "eg. \n\nnew Clutter.Image.from_file(.....)";
828 this.el.label = "ctor: Alterative to default contructor";
831 this.el.activate.connect( ( ) => {
833 _this.addProp( "prop", "ctor","", "*");
837 // user defined functions
840 public class Xcls_MenuItem11 : Object
842 public Gtk.MenuItem el;
843 private Xcls_LeftProps _this;
849 public Xcls_MenuItem11(Xcls_LeftProps _owner )
852 this.el = new Gtk.MenuItem();
856 // set gobject values
857 this.el.tooltip_markup = "This code is called after the ctor";
858 this.el.label = "init: initialziation code (vala)";
861 this.el.activate.connect( ( ) => {
863 _this.addProp( "prop", "init", "{\n\n}\n", "*" );
867 // user defined functions
870 public class Xcls_SeparatorMenuItem12 : Object
872 public Gtk.SeparatorMenuItem el;
873 private Xcls_LeftProps _this;
879 public Xcls_SeparatorMenuItem12(Xcls_LeftProps _owner )
882 this.el = new Gtk.SeparatorMenuItem();
886 // set gobject values
889 // user defined functions
892 public class Xcls_MenuItem13 : Object
894 public Gtk.MenuItem el;
895 private Xcls_LeftProps _this;
901 public Xcls_MenuItem13(Xcls_LeftProps _owner )
904 this.el = new Gtk.MenuItem();
908 // set gobject values
909 this.el.tooltip_markup = "Add a user defined string property";
910 this.el.label = "String";
913 this.el.activate.connect( (self) => {
915 _this.addProp( "prop", "XXXX", "","string");
920 // user defined functions
923 public class Xcls_MenuItem14 : Object
925 public Gtk.MenuItem el;
926 private Xcls_LeftProps _this;
932 public Xcls_MenuItem14(Xcls_LeftProps _owner )
935 this.el = new Gtk.MenuItem();
939 // set gobject values
940 this.el.tooltip_markup = "Add a user defined number property";
941 this.el.label = "Number";
944 this.el.activate.connect( ( ) =>{
946 _this.addProp("prop", "XXX", "0", "int");
950 // user defined functions
953 public class Xcls_MenuItem15 : Object
955 public Gtk.MenuItem el;
956 private Xcls_LeftProps _this;
962 public Xcls_MenuItem15(Xcls_LeftProps _owner )
965 this.el = new Gtk.MenuItem();
969 // set gobject values
970 this.el.tooltip_markup = "Add a user defined boolean property";
971 this.el.label = "Boolean";
974 this.el.activate.connect( ( ) =>{
976 _this.addProp( "prop", "XXX", "true", "bool");
980 // user defined functions
983 public class Xcls_SeparatorMenuItem16 : Object
985 public Gtk.SeparatorMenuItem el;
986 private Xcls_LeftProps _this;
992 public Xcls_SeparatorMenuItem16(Xcls_LeftProps _owner )
995 this.el = new Gtk.SeparatorMenuItem();
999 // set gobject values
1002 // user defined functions
1005 public class Xcls_MenuItem17 : Object
1007 public Gtk.MenuItem el;
1008 private Xcls_LeftProps _this;
1014 public Xcls_MenuItem17(Xcls_LeftProps _owner )
1017 this.el = new Gtk.MenuItem();
1021 // set gobject values
1022 this.el.tooltip_markup = "Add a user function boolean property";
1023 this.el.label = "Javascript Function";
1026 this.el.activate.connect( ( ) =>{
1028 _this.addProp("prop", "XXXX", "function() { }", "| function");
1032 // user defined functions
1035 public class Xcls_MenuItem18 : Object
1037 public Gtk.MenuItem el;
1038 private Xcls_LeftProps _this;
1044 public Xcls_MenuItem18(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 = "Vala Method";
1056 this.el.activate.connect( ( ) =>{
1058 _this.addProp( "prop", "XXXX", "() {\n\n}\n", "| return_type");
1062 // user defined functions
1065 public class Xcls_MenuItem19 : Object
1067 public Gtk.MenuItem el;
1068 private Xcls_LeftProps _this;
1074 public Xcls_MenuItem19(Xcls_LeftProps _owner )
1077 this.el = new Gtk.MenuItem();
1081 // set gobject values
1082 this.el.tooltip_markup = "Add a vala signal";
1083 this.el.label = "Vala Signal";
1086 this.el.activate.connect( ( ) =>{
1088 _this.addProp( "prop", "XXXX", "()", "@ void");
1092 // user defined functions
1095 public class Xcls_SeparatorMenuItem20 : Object
1097 public Gtk.SeparatorMenuItem el;
1098 private Xcls_LeftProps _this;
1104 public Xcls_SeparatorMenuItem20(Xcls_LeftProps _owner )
1107 this.el = new Gtk.SeparatorMenuItem();
1111 // set gobject values
1114 // user defined functions
1117 public class Xcls_MenuItem21 : Object
1119 public Gtk.MenuItem el;
1120 private Xcls_LeftProps _this;
1126 public Xcls_MenuItem21(Xcls_LeftProps _owner )
1129 this.el = new Gtk.MenuItem();
1133 // set gobject values
1134 this.el.tooltip_markup = "Add a flexy if (for HTML templates)";
1135 this.el.label = "Flexy - If";
1138 this.el.activate.connect( ( ) =>{
1140 _this.addProp("prop", "flexy:if", "value_or_condition", "string");
1144 // user defined functions
1147 public class Xcls_MenuItem22 : Object
1149 public Gtk.MenuItem el;
1150 private Xcls_LeftProps _this;
1156 public Xcls_MenuItem22(Xcls_LeftProps _owner )
1159 this.el = new Gtk.MenuItem();
1163 // set gobject values
1164 this.el.tooltip_markup = "Add a flexy include (for HTML templates)";
1165 this.el.label = "Flexy - Include";
1168 this.el.activate.connect( ( ) =>{
1170 _this.addProp("prop", "flexy:include", "name_of_file.html", "string");
1174 // user defined functions
1177 public class Xcls_MenuItem23 : Object
1179 public Gtk.MenuItem el;
1180 private Xcls_LeftProps _this;
1186 public Xcls_MenuItem23(Xcls_LeftProps _owner )
1189 this.el = new Gtk.MenuItem();
1193 // set gobject values
1194 this.el.tooltip_markup = "Add a flexy foreach (for HTML templates)";
1195 this.el.label = "Flexy - Foreach";
1198 this.el.activate.connect( ( ) =>{
1200 _this.addProp("prop", "flexy:foreach", "array,key,value", "string");
1204 // user defined functions
1210 public class Xcls_EditProps : Object
1212 public Gtk.ScrolledWindow el;
1213 private Xcls_LeftProps _this;
1217 public bool editing;
1220 public Xcls_EditProps(Xcls_LeftProps _owner )
1223 _this.EditProps = this;
1224 this.el = new Gtk.ScrolledWindow( null, null );
1227 this.editing = false;
1229 // set gobject values
1230 this.el.shadow_type = Gtk.ShadowType.IN;
1231 var child_0 = new Xcls_view( _this );
1233 this.el.add ( child_0.el );
1239 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
1243 // user defined functions
1245 public class Xcls_view : Object
1247 public Gtk.TreeView el;
1248 private Xcls_LeftProps _this;
1254 public Xcls_view(Xcls_LeftProps _owner )
1258 this.el = new Gtk.TreeView();
1262 // set gobject values
1263 this.el.tooltip_column = 5;
1264 this.el.enable_tree_lines = true;
1265 this.el.headers_visible = true;
1266 var child_0 = new Xcls_model( _this );
1268 this.el.set_model ( child_0.el );
1269 var child_1 = new Xcls_keycol( _this );
1271 this.el.append_column ( child_1.el );
1272 var child_2 = new Xcls_valcol( _this );
1274 this.el.append_column ( child_2.el );
1275 var child_3 = new Xcls_ContextMenu( _this );
1281 var selection = this.el.get_selection();
1282 selection.set_mode( Gtk.SelectionMode.SINGLE);
1285 var description = new Pango.FontDescription();
1286 description.set_size(10000);
1287 this.el.override_font(description);
1291 this.el.button_press_event.connect( ( ev) => {
1293 Gtk.TreeViewColumn col;
1297 if (!this.el.get_path_at_pos((int)ev.x, (int) ev.y, out path, out col, out cell_x, out cell_y )) {
1298 print("nothing selected on click");
1299 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
1300 this.el.get_selection().unselect_all();
1304 _this.before_edit();
1305 return false; //not on a element.
1310 if (ev.type == Gdk.EventType.2BUTTON_PRESS && ev.button == 1 && col.title == "Name") {
1314 _this.before_edit();
1316 _this.keyrender.el.stop_editing(false);
1317 _this.keyrender.el.editable =false;
1319 _this.valrender.el.stop_editing(false);
1320 _this.valrender.el.editable =false;
1322 _this.startEditingKey(path);
1331 if (ev.type == Gdk.EventType.BUTTON_PRESS && ev.button == 3) {
1333 //if (col.title == "Value") {
1334 // _this.before_edit();
1338 var p = _this.ContextMenu;
1340 p.el.set_screen(Gdk.Screen.get_default());
1342 p.el.popup(null, null, null, ev.button, ev.time);
1343 //Seed.print("click:" + res.column.title);
1345 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
1347 this.el.get_selection().select_path(path);
1350 _this.before_edit();
1355 if (col.title != "Value") {
1356 print("col title != Value");
1358 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
1359 this.el.get_selection().select_path(path);
1363 _this.before_edit();
1364 // XObject.error("column is not value?");
1365 return false; // ignore.. - key click.. ??? should we do this??
1369 // if the cell can be edited with a pulldown
1370 // then we should return true... - and let the start_editing handle it?
1377 // _this.before_edit(); <<< we really need to stop the other editor..
1378 _this.keyrender.el.stop_editing(false);
1379 _this.keyrender.el.editable =false;
1382 return _this.startEditingValue(path); // assumes selected row..
1391 // user defined functions
1393 public class Xcls_model : Object
1395 public Gtk.TreeStore el;
1396 private Xcls_LeftProps _this;
1402 public Xcls_model(Xcls_LeftProps _owner )
1406 this.el = new Gtk.TreeStore( 7, typeof(string), // 0 key type
1407 typeof(string), // 1 key
1408 typeof(string), // 2 key (display)
1409 typeof(string), // 3 value
1410 typeof(string), // 4 value (display)
1411 typeof(string), // 5 both (tooltip)
1412 typeof(string) // 6 key (for sorting)
1417 // set gobject values
1420 // user defined functions
1423 public class Xcls_keycol : Object
1425 public Gtk.TreeViewColumn el;
1426 private Xcls_LeftProps _this;
1432 public Xcls_keycol(Xcls_LeftProps _owner )
1435 _this.keycol = this;
1436 this.el = new Gtk.TreeViewColumn();
1440 // set gobject values
1441 this.el.title = "Name";
1442 this.el.resizable = true;
1443 var child_0 = new Xcls_keyrender( _this );
1445 this.el.pack_start ( child_0.el , false );
1449 this.el.add_attribute(_this.keyrender.el , "markup", 2 );
1450 this.el.add_attribute(_this.keyrender.el , "text", 1 );
1453 // user defined functions
1455 public class Xcls_keyrender : Object
1457 public Gtk.CellRendererText el;
1458 private Xcls_LeftProps _this;
1464 public Xcls_keyrender(Xcls_LeftProps _owner )
1467 _this.keyrender = this;
1468 this.el = new Gtk.CellRendererText();
1472 // set gobject values
1475 this.el.editing_started.connect( ( editable, path) => {
1478 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1483 // this.get('/LeftPanel.model').activePath = path;
1484 _this.model.el.get_value(iter,1, out gval);
1485 var val = (string)gval;
1487 ((Gtk.Entry)editable).set_text(val);
1489 this.el.edited.connect( (path, newtext) => {
1490 print("Keyrender - signal:edited\n");
1492 this.el.editable = false;
1497 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1500 _this.model.el.get_value(iter,1, out gval);
1501 var oldval = (string)gval;
1503 _this.model.el.get_value(iter,0, out gval);
1504 var ktype = (string)gval;
1506 _this.model.el.set_value(iter, 1, newtext);
1508 if (oldval == newtext) {
1513 print("ktype: %s\n",ktype);
1516 var ov = _this.node.listeners.get(oldval);
1517 _this.node.listeners.set(newtext, ov);
1518 _this.node.listeners.unset(oldval);
1520 _this.updateIter(iter, ktype, newtext, ov);
1524 var ov = _this.node.props.get(oldval);
1525 _this.node.props.set(newtext, ov);
1526 _this.node.props.unset(oldval);
1527 _this.updateIter(iter, ktype, newtext, ov);
1535 // user defined functions
1539 public class Xcls_valcol : Object
1541 public Gtk.TreeViewColumn el;
1542 private Xcls_LeftProps _this;
1548 public Xcls_valcol(Xcls_LeftProps _owner )
1551 _this.valcol = this;
1552 this.el = new Gtk.TreeViewColumn();
1556 // set gobject values
1557 this.el.title = "Value";
1558 this.el.resizable = true;
1559 var child_0 = new Xcls_valrender( _this );
1561 this.el.pack_start ( child_0.el , true );
1567 // typeof(string), // 0 key type
1568 // typeof(string), // 1 key
1569 // typeof(string), // 2 key (display)
1570 // typeof(string), // 3 value
1571 // typeof(string) // 4 value (display)
1574 this.el.add_attribute(_this.valrender.el , "text", 4 );
1575 //this.el.add_attribute(_this.valrender.el , "sensitive", 4 );
1576 //this.el.add_attribute(this.items[0].el , 'editable', 3 );
1577 // this.el.set_cell_data_func(cell, age_cell_data_func, NULL, NULL);
1579 // this.get('/LeftPanel').editableColumn= this;
1583 // user defined functions
1585 public class Xcls_valrender : Object
1587 public Gtk.CellRendererCombo el;
1588 private Xcls_LeftProps _this;
1594 public Xcls_valrender(Xcls_LeftProps _owner )
1597 _this.valrender = this;
1598 this.el = new Gtk.CellRendererCombo();
1602 // set gobject values
1603 this.el.editable = false;
1604 this.el.text_column = 0;
1605 this.el.has_entry = true;
1606 var child_0 = new Xcls_valrendermodel( _this );
1608 this.el.model = child_0.el;
1611 this.el.editing_started.connect( ( editable, path) => {
1612 //_this.editing = true;
1613 print("editing started called\n");
1614 if (!_this.allow_edit) {
1616 print("val - editing_Started\n");
1617 this.el.editable = false; // make sure it's not editor...
1622 _this.allow_edit =false;
1625 if ( this.el.has_entry ) {
1628 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1633 // this.get('/LeftPanel.model').activePath = path;
1634 _this.model.el.get_value(iter,3, out gval);
1637 var val = (string)gval;
1638 var combo = (Gtk.ComboBox)editable;
1640 var entry = (Gtk.Entry) combo.get_child();
1641 entry.set_text(val);
1645 this.el.edited.connect( (path, newtext) => {
1646 print("Valrender - signal:edited\n");
1648 this.el.editable = false;
1653 2, "<b>" + miter.get_key() + "</b>",
1654 3, miter.get_value(),
1655 4, display_value(short);
1661 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1664 _this.model.el.get_value(iter,0, out gval);
1665 var ktype = (string)gval;
1668 _this.model.el.get_value(iter,3, out gval);
1669 var oldval = (string)gval;
1671 _this.model.el.get_value(iter,1, out gval);
1672 var key = (string)gval;
1678 _this.node.listeners.set(key, newtext);
1679 _this.updateIter(iter,ktype,key,newtext);
1682 _this.node.props.set(key,newtext);
1683 _this.updateIter(iter,ktype, key,newtext);
1686 // _this.load(_this.file,_this.node);
1692 // user defined functions
1693 public void setOptions (string[] ar) {
1694 var m = _this.valrendermodel.el;
1697 for (var i =0; i < ar.length; i++) {
1699 m.set_value(iret, 0, ar[i]);
1704 public class Xcls_valrendermodel : Object
1706 public Gtk.ListStore el;
1707 private Xcls_LeftProps _this;
1713 public Xcls_valrendermodel(Xcls_LeftProps _owner )
1716 _this.valrendermodel = this;
1717 this.el = new Gtk.ListStore( 1, typeof(string) );
1721 // set gobject values
1724 // user defined functions
1729 public class Xcls_ContextMenu : Object
1732 private Xcls_LeftProps _this;
1738 public Xcls_ContextMenu(Xcls_LeftProps _owner )
1741 _this.ContextMenu = this;
1742 this.el = new Gtk.Menu();
1746 // set gobject values
1747 var child_0 = new Xcls_MenuItem33( _this );
1749 this.el.append ( child_0.el );
1750 var child_1 = new Xcls_SeparatorMenuItem34( _this );
1752 this.el.append ( child_1.el );
1753 var child_2 = new Xcls_MenuItem35( _this );
1755 this.el.append ( child_2.el );
1758 // user defined functions
1760 public class Xcls_MenuItem33 : Object
1762 public Gtk.MenuItem el;
1763 private Xcls_LeftProps _this;
1769 public Xcls_MenuItem33(Xcls_LeftProps _owner )
1772 this.el = new Gtk.MenuItem();
1776 // set gobject values
1777 this.el.label = "Edit";
1780 this.el.activate.connect( ( ) =>{
1782 var s = _this.view.el.get_selection();
1784 Gtk.TreeModel model;
1785 s.get_selected (out model, out iter);
1786 _this.startEditingKey(model.get_path(iter));
1790 // user defined functions
1793 public class Xcls_SeparatorMenuItem34 : Object
1795 public Gtk.SeparatorMenuItem el;
1796 private Xcls_LeftProps _this;
1802 public Xcls_SeparatorMenuItem34(Xcls_LeftProps _owner )
1805 this.el = new Gtk.SeparatorMenuItem();
1809 // set gobject values
1812 // user defined functions
1815 public class Xcls_MenuItem35 : Object
1817 public Gtk.MenuItem el;
1818 private Xcls_LeftProps _this;
1824 public Xcls_MenuItem35(Xcls_LeftProps _owner )
1827 this.el = new Gtk.MenuItem();
1831 // set gobject values
1832 this.el.label = "Delete";
1835 this.el.activate.connect( ( ) =>{
1836 _this.deleteSelected();
1840 // user defined functions