1 static Xcls_LeftProps _LeftProps;
3 public class Xcls_LeftProps : Object
6 private Xcls_LeftProps _this;
8 public static Xcls_LeftProps singleton()
10 if (_LeftProps == null) {
11 _LeftProps= new Xcls_LeftProps();
15 public Xcls_AddPropertyPopup AddPropertyPopup;
16 public Xcls_EditProps EditProps;
17 public Xcls_view view;
18 public Xcls_model model;
19 public Xcls_keycol keycol;
20 public Xcls_keyrender keyrender;
21 public Xcls_valcol valcol;
22 public Xcls_valrender valrender;
23 public Xcls_valrendermodel valrendermodel;
24 public Xcls_ContextMenu ContextMenu;
27 public bool allow_edit;
28 public JsRender.JsRender file;
29 public signal bool stop_editor ();
30 public signal void show_editor (JsRender.JsRender file, JsRender.Node node, string type, string key);
31 public signal void changed ();
32 public signal void show_add_props (string type);
33 public Xcls_MainWindow main_window;
34 public JsRender.Node node;
37 public Xcls_LeftProps()
40 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
43 this.allow_edit = false;
44 this.main_window = null;
47 this.el.homogeneous = false ;
48 var child_0 = new Xcls_Box2( _this );
50 this.el.pack_start ( child_0.el , false,true,0 );
51 var child_1 = new Xcls_EditProps( _this );
53 this.el.pack_end ( child_1.el , true,true,0 );
56 // user defined functions
57 public void before_edit ()
60 print("before edit - stop editing\n");
62 // these do not appear to trigger save...
63 _this.keyrender.el.stop_editing(false);
64 _this.keyrender.el.editable =false;
66 _this.valrender.el.stop_editing(false);
67 _this.valrender.el.editable =false;
70 // technicall stop the popup editor..
73 public string keySortFormat (string key) {
74 // listeners first - with 0
81 var bits = key.split(" ");
84 return "2 " + bits[bits.length -1];
88 return "3 " + bits[bits.length -1];
93 return "4 " + bits[bits.length -1];
96 return "5 " + bits[bits.length -1];
101 public void finish_editing () {
105 public bool startEditingValue ( Gtk.TreePath path) {
107 // ONLY return true if editing is allowed - eg. combo..
109 print("start editing?\n");
110 if (!this.stop_editor()) {
111 print("stop editor failed\n");
117 var mod = this.model.el;
118 mod.get_iter (out iter, path);
124 2, "<b>" + miter.get_key() + "</b>",
130 mod.get_value(iter, 3 , out gval);
131 var val = (string)gval;
133 mod.get_value(iter, 1 , out gval);
134 var key = (string)gval;
137 string kname, kflag, ktype;
138 this.node.normalize_key(key, out kname, out kflag, out ktype);
141 mod.get_value(iter, 0 , out gval);
142 var type = (string)gval; // listerner or prop..
146 var use_textarea = false;
148 //------------ things that require the text editor...
150 if (type == "listener") {
153 if (key.length > 0 && key[0] == '|') { // user defined method
156 if (key.length > 0 && key[0] == '$') { // raw string
159 if (key.length > 0 && key == "* init") {
162 if (val.length > 40) { // long value...
169 print("Call show editor\n");
170 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
171 this.view.el.get_selection().select_path(path);
173 this.show_editor(file, node, type, key);
182 var pal = Palete.factory(this.file.project.xtype);
185 var has_opts = pal.typeOptions(this.node.fqn(), kname, ktype, out opts);
189 // others... - fill in options for true/false?
190 print("turn on editing %s \n" , mod.get_path(iter).to_string());
194 print("start editing try/false)???");
195 this.valrender.el.has_entry = false;
197 this.valrender.setOptions(opts);
199 this.valrender.el.has_entry = false;
200 this.valrender.el.editable = true;
201 this.allow_edit = true;
202 GLib.Timeout.add_full(GLib.Priority.DEFAULT,100 , () => {
203 this.view.el.set_cursor_on_cell(
214 // see if type is a Enum.
221 this.valrender.setOptions(opts);
223 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
225 // at this point - work out the type...
226 // if its' a combo... then show the options..
227 this.valrender.el.has_entry = true;
229 this.valrender.el.editable = true;
232 this.allow_edit = true;
238 this.view.el.set_cursor_on_cell(
248 public void load (JsRender.JsRender file, JsRender.Node? node)
250 print("load leftprops\n");
256 this.model.el.clear();
258 //this.get('/RightEditor').el.hide();
265 //var provider = this.get('/LeftTree').getPaleteProvider();
268 //typeof(string), // 0 key type
269 //typeof(string), // 1 key
270 //typeof(string), // 2 key (display)
271 //typeof(string), // 3 value
272 //typeof(string), // 4 value (display)
273 //typeof(string), // 5 both (tooltip)
278 // really need a way to sort the hashmap...
279 var m = this.model.el;
281 var miter = node.listeners.map_iterator();
284 while(miter.next()) {
286 m.append(out iter,null);
288 this.updateIter(iter, "listener", miter.get_key(), miter.get_value());
294 miter = node.props.map_iterator();
297 while(miter.next()) {
299 m.append(out iter,null);
300 this.updateIter(iter, "prop", miter.get_key(), miter.get_value());
303 print("clear selection\n");
305 this.model.el.set_sort_column_id(6,Gtk.SortType.ASCENDING); // sort by real key..
307 this.view.el.get_selection().unselect_all();
309 var pane = _this.main_window.editpane.el;
310 var try_size = (i * 25) + 60; // est. 20px per line + 40px header
314 ((try_size * 1.0f) / (pane.max_position * 1.0f)) > 0.8f ?
315 (int) (pane.max_position * 0.2f) :
316 pane.max_position-try_size);
320 public string keyFormat (string val, string type) {
322 // Glib.markup_escape_text(val);
324 if (type == "listener") {
325 return "<span font_weight=\"bold\" color=\"#660000\">" +
326 GLib.Markup.escape_text(val) +
330 if (val.length < 1) {
331 return "<span color=\"#FF0000\">--empty--</span>";
336 //# - object properties
338 // all of these... - display value is last element..
339 var ar = val.strip().split(" ");
342 var dval = GLib.Markup.escape_text(ar[ar.length-1]);
348 case '@': // signal // just bold balck?
349 if (dval[0] == '@') {
350 dval = dval.substring(1);
353 return @"<span font_weight=\"bold\">@ $dval</span>";
354 case '#': // object properties?
355 if (dval[0] == '#') {
356 dval = dval.substring(1);
358 return @"<span font_weight=\"bold\">$dval</span>";
360 if (dval[0] == '*') {
361 dval = dval.substring(1);
363 return @"<span color=\"#0000CC\" font_weight=\"bold\">$dval</span>";
365 if (dval[0] == '$') {
366 dval = dval.substring(1);
368 return @"<span style=\"italic\">$dval</span>";
369 case '|': // user defined methods
370 if (dval[0] == '|') {
371 dval = dval.substring(1);
373 return @"<span color=\"#008000\" font_weight=\"bold\">$dval</span>";
384 public void deleteSelected () {
389 var s = this.view.el.get_selection();
390 s.get_selected(out mod, out iter);
394 mod.get_value(iter, 0 , out gval);
395 var type = (string)gval;
397 mod.get_value(iter, 1 , out gval);
398 var key = (string)gval;
402 this.node.listeners.unset(key);
406 this.node.props.unset(key);
409 this.load(this.file, this.node);
413 public void startEditingKey ( Gtk.TreePath path) {
415 if (!this.stop_editor()) {
419 // others... - fill in options for true/false?
422 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
423 this.allow_edit = true;
424 this.keyrender.el.editable = true;
426 this.view.el.set_cursor_on_cell(
438 public 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 this.el.hexpand = true;
587 var child_0 = new Xcls_Box4( _this );
589 this.el.add ( child_0.el );
590 var child_1 = new Xcls_AddPropertyPopup( _this );
594 this.el.button_press_event.connect( (self, ev) => {
598 var p = _this.AddPropertyPopup;
599 p.el.set_screen(Gdk.Screen.get_default());
601 p.el.popup(null, null, null, ev.button, ev.time);
606 // user defined functions
608 public class Xcls_Box4 : Object
611 private Xcls_LeftProps _this;
617 public Xcls_Box4(Xcls_LeftProps _owner )
620 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
624 // set gobject values
625 var child_0 = new Xcls_Image5( _this );
627 this.el.add ( child_0.el );
628 var child_1 = new Xcls_Label6( _this );
630 this.el.add ( child_1.el );
633 // user defined functions
635 public class Xcls_Image5 : Object
638 private Xcls_LeftProps _this;
644 public Xcls_Image5(Xcls_LeftProps _owner )
647 this.el = new Gtk.Image();
651 // set gobject values
652 this.el.stock = Gtk.Stock.ADD;
653 this.el.icon_size = Gtk.IconSize.MENU;
656 // user defined functions
659 public class Xcls_Label6 : Object
662 private Xcls_LeftProps _this;
668 public Xcls_Label6(Xcls_LeftProps _owner )
671 this.el = new Gtk.Label( "Other" );
675 // set gobject values
678 // user defined functions
682 public class Xcls_AddPropertyPopup : Object
685 private Xcls_LeftProps _this;
691 public Xcls_AddPropertyPopup(Xcls_LeftProps _owner )
694 _this.AddPropertyPopup = this;
695 this.el = new Gtk.Menu();
699 // set gobject values
700 var child_0 = new Xcls_MenuItem8( _this );
702 this.el.append ( child_0.el );
703 var child_1 = new Xcls_MenuItem9( _this );
705 this.el.append ( child_1.el );
706 var child_2 = new Xcls_MenuItem10( _this );
708 this.el.append ( child_2.el );
709 var child_3 = new Xcls_MenuItem11( _this );
711 this.el.append ( child_3.el );
712 var child_4 = new Xcls_SeparatorMenuItem12( _this );
714 this.el.add ( child_4.el );
715 var child_5 = new Xcls_MenuItem13( _this );
717 this.el.append ( child_5.el );
718 var child_6 = new Xcls_MenuItem14( _this );
720 this.el.append ( child_6.el );
721 var child_7 = new Xcls_MenuItem15( _this );
723 this.el.append ( child_7.el );
724 var child_8 = new Xcls_SeparatorMenuItem16( _this );
726 this.el.add ( child_8.el );
727 var child_9 = new Xcls_MenuItem17( _this );
729 this.el.append ( child_9.el );
730 var child_10 = new Xcls_MenuItem18( _this );
732 this.el.append ( child_10.el );
733 var child_11 = new Xcls_MenuItem19( _this );
735 this.el.append ( child_11.el );
736 var child_12 = new Xcls_SeparatorMenuItem20( _this );
738 this.el.add ( child_12.el );
739 var child_13 = new Xcls_MenuItem21( _this );
741 this.el.append ( child_13.el );
742 var child_14 = new Xcls_MenuItem22( _this );
744 this.el.append ( child_14.el );
745 var child_15 = new Xcls_MenuItem23( _this );
747 this.el.append ( child_15.el );
750 // user defined functions
752 public class Xcls_MenuItem8 : Object
754 public Gtk.MenuItem el;
755 private Xcls_LeftProps _this;
761 public Xcls_MenuItem8(Xcls_LeftProps _owner )
764 this.el = new Gtk.MenuItem();
768 // set gobject values
769 this.el.tooltip_markup = "Using _this.{ID} will map to this element";
770 this.el.label = "id: _this.{ID} (Vala)";
773 this.el.activate.connect( () => {
774 _this.addProp( "prop", "id", "", "");
778 // user defined functions
781 public class Xcls_MenuItem9 : Object
783 public Gtk.MenuItem el;
784 private Xcls_LeftProps _this;
790 public Xcls_MenuItem9(Xcls_LeftProps _owner )
793 this.el = new Gtk.MenuItem();
797 // set gobject values
798 this.el.tooltip_markup = "how to pack this element onto parent, (method, 2nd arg, 3rd arg) .. the 1st argument is filled by the element";
799 this.el.label = "pack: Pack method (Vala)";
802 this.el.activate.connect( ( ) => {
804 _this.addProp( "prop", "pack","add", "*");
808 // user defined functions
811 public class Xcls_MenuItem10 : Object
813 public Gtk.MenuItem el;
814 private Xcls_LeftProps _this;
820 public Xcls_MenuItem10(Xcls_LeftProps _owner )
823 this.el = new Gtk.MenuItem();
827 // set gobject values
828 this.el.tooltip_markup = "eg. \n\nnew Clutter.Image.from_file(.....)";
829 this.el.label = "ctor: Alterative to default contructor";
832 this.el.activate.connect( ( ) => {
834 _this.addProp( "prop", "ctor","", "*");
838 // user defined functions
841 public class Xcls_MenuItem11 : Object
843 public Gtk.MenuItem el;
844 private Xcls_LeftProps _this;
850 public Xcls_MenuItem11(Xcls_LeftProps _owner )
853 this.el = new Gtk.MenuItem();
857 // set gobject values
858 this.el.tooltip_markup = "This code is called after the ctor";
859 this.el.label = "init: initialziation code (vala)";
862 this.el.activate.connect( ( ) => {
864 _this.addProp( "prop", "init", "{\n\n}\n", "*" );
868 // user defined functions
871 public class Xcls_SeparatorMenuItem12 : Object
873 public Gtk.SeparatorMenuItem el;
874 private Xcls_LeftProps _this;
880 public Xcls_SeparatorMenuItem12(Xcls_LeftProps _owner )
883 this.el = new Gtk.SeparatorMenuItem();
887 // set gobject values
890 // user defined functions
893 public class Xcls_MenuItem13 : Object
895 public Gtk.MenuItem el;
896 private Xcls_LeftProps _this;
902 public Xcls_MenuItem13(Xcls_LeftProps _owner )
905 this.el = new Gtk.MenuItem();
909 // set gobject values
910 this.el.tooltip_markup = "Add a user defined string property";
911 this.el.label = "String";
914 this.el.activate.connect( (self) => {
916 _this.addProp( "prop", "XXXX", "","string");
921 // user defined functions
924 public class Xcls_MenuItem14 : Object
926 public Gtk.MenuItem el;
927 private Xcls_LeftProps _this;
933 public Xcls_MenuItem14(Xcls_LeftProps _owner )
936 this.el = new Gtk.MenuItem();
940 // set gobject values
941 this.el.tooltip_markup = "Add a user defined number property";
942 this.el.label = "Number";
945 this.el.activate.connect( ( ) =>{
947 _this.addProp("prop", "XXX", "0", "int");
951 // user defined functions
954 public class Xcls_MenuItem15 : Object
956 public Gtk.MenuItem el;
957 private Xcls_LeftProps _this;
963 public Xcls_MenuItem15(Xcls_LeftProps _owner )
966 this.el = new Gtk.MenuItem();
970 // set gobject values
971 this.el.tooltip_markup = "Add a user defined boolean property";
972 this.el.label = "Boolean";
975 this.el.activate.connect( ( ) =>{
977 _this.addProp( "prop", "XXX", "true", "bool");
981 // user defined functions
984 public class Xcls_SeparatorMenuItem16 : Object
986 public Gtk.SeparatorMenuItem el;
987 private Xcls_LeftProps _this;
993 public Xcls_SeparatorMenuItem16(Xcls_LeftProps _owner )
996 this.el = new Gtk.SeparatorMenuItem();
1000 // set gobject values
1003 // user defined functions
1006 public class Xcls_MenuItem17 : Object
1008 public Gtk.MenuItem el;
1009 private Xcls_LeftProps _this;
1015 public Xcls_MenuItem17(Xcls_LeftProps _owner )
1018 this.el = new Gtk.MenuItem();
1022 // set gobject values
1023 this.el.tooltip_markup = "Add a user function boolean property";
1024 this.el.label = "Javascript Function";
1027 this.el.activate.connect( ( ) =>{
1029 _this.addProp("prop", "XXXX", "function() { }", "| function");
1033 // user defined functions
1036 public class Xcls_MenuItem18 : Object
1038 public Gtk.MenuItem el;
1039 private Xcls_LeftProps _this;
1045 public Xcls_MenuItem18(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 = "Vala Method";
1057 this.el.activate.connect( ( ) =>{
1059 _this.addProp( "prop", "XXXX", "() {\n\n}\n", "| return_type");
1063 // user defined functions
1066 public class Xcls_MenuItem19 : Object
1068 public Gtk.MenuItem el;
1069 private Xcls_LeftProps _this;
1075 public Xcls_MenuItem19(Xcls_LeftProps _owner )
1078 this.el = new Gtk.MenuItem();
1082 // set gobject values
1083 this.el.tooltip_markup = "Add a vala signal";
1084 this.el.label = "Vala Signal";
1087 this.el.activate.connect( ( ) =>{
1089 _this.addProp( "prop", "XXXX", "()", "@ void");
1093 // user defined functions
1096 public class Xcls_SeparatorMenuItem20 : Object
1098 public Gtk.SeparatorMenuItem el;
1099 private Xcls_LeftProps _this;
1105 public Xcls_SeparatorMenuItem20(Xcls_LeftProps _owner )
1108 this.el = new Gtk.SeparatorMenuItem();
1112 // set gobject values
1115 // user defined functions
1118 public class Xcls_MenuItem21 : Object
1120 public Gtk.MenuItem el;
1121 private Xcls_LeftProps _this;
1127 public Xcls_MenuItem21(Xcls_LeftProps _owner )
1130 this.el = new Gtk.MenuItem();
1134 // set gobject values
1135 this.el.tooltip_markup = "Add a flexy if (for HTML templates)";
1136 this.el.label = "Flexy - If";
1139 this.el.activate.connect( ( ) =>{
1141 _this.addProp("prop", "flexy:if", "value_or_condition", "string");
1145 // user defined functions
1148 public class Xcls_MenuItem22 : Object
1150 public Gtk.MenuItem el;
1151 private Xcls_LeftProps _this;
1157 public Xcls_MenuItem22(Xcls_LeftProps _owner )
1160 this.el = new Gtk.MenuItem();
1164 // set gobject values
1165 this.el.tooltip_markup = "Add a flexy include (for HTML templates)";
1166 this.el.label = "Flexy - Include";
1169 this.el.activate.connect( ( ) =>{
1171 _this.addProp("prop", "flexy:include", "name_of_file.html", "string");
1175 // user defined functions
1178 public class Xcls_MenuItem23 : Object
1180 public Gtk.MenuItem el;
1181 private Xcls_LeftProps _this;
1187 public Xcls_MenuItem23(Xcls_LeftProps _owner )
1190 this.el = new Gtk.MenuItem();
1194 // set gobject values
1195 this.el.tooltip_markup = "Add a flexy foreach (for HTML templates)";
1196 this.el.label = "Flexy - Foreach";
1199 this.el.activate.connect( ( ) =>{
1201 _this.addProp("prop", "flexy:foreach", "array,key,value", "string");
1205 // user defined functions
1211 public class Xcls_EditProps : Object
1213 public Gtk.ScrolledWindow el;
1214 private Xcls_LeftProps _this;
1218 public bool editing;
1221 public Xcls_EditProps(Xcls_LeftProps _owner )
1224 _this.EditProps = this;
1225 this.el = new Gtk.ScrolledWindow( null, null );
1228 this.editing = false;
1230 // set gobject values
1231 this.el.shadow_type = Gtk.ShadowType.IN;
1232 var child_0 = new Xcls_view( _this );
1234 this.el.add ( child_0.el );
1240 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
1244 // user defined functions
1246 public class Xcls_view : Object
1248 public Gtk.TreeView el;
1249 private Xcls_LeftProps _this;
1255 public Xcls_view(Xcls_LeftProps _owner )
1259 this.el = new Gtk.TreeView();
1263 // set gobject values
1264 this.el.tooltip_column = 5;
1265 this.el.enable_tree_lines = true;
1266 this.el.headers_visible = true;
1267 var child_0 = new Xcls_model( _this );
1269 this.el.set_model ( child_0.el );
1270 var child_1 = new Xcls_keycol( _this );
1272 this.el.append_column ( child_1.el );
1273 var child_2 = new Xcls_valcol( _this );
1275 this.el.append_column ( child_2.el );
1276 var child_3 = new Xcls_ContextMenu( _this );
1282 var selection = this.el.get_selection();
1283 selection.set_mode( Gtk.SelectionMode.SINGLE);
1286 var description = new Pango.FontDescription();
1287 description.set_size(10000);
1288 this.el.override_font(description);
1292 this.el.button_press_event.connect( ( ev) => {
1294 Gtk.TreeViewColumn col;
1298 if (!this.el.get_path_at_pos((int)ev.x, (int) ev.y, out path, out col, out cell_x, out cell_y )) {
1299 print("nothing selected on click");
1300 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
1301 this.el.get_selection().unselect_all();
1305 _this.before_edit();
1306 return false; //not on a element.
1311 if (ev.type == Gdk.EventType.2BUTTON_PRESS && ev.button == 1 && col.title == "Name") {
1315 _this.before_edit();
1317 _this.keyrender.el.stop_editing(false);
1318 _this.keyrender.el.editable =false;
1320 _this.valrender.el.stop_editing(false);
1321 _this.valrender.el.editable =false;
1323 _this.startEditingKey(path);
1332 if (ev.type == Gdk.EventType.BUTTON_PRESS && ev.button == 3) {
1334 //if (col.title == "Value") {
1335 // _this.before_edit();
1339 var p = _this.ContextMenu;
1341 p.el.set_screen(Gdk.Screen.get_default());
1343 p.el.popup(null, null, null, ev.button, ev.time);
1344 //Seed.print("click:" + res.column.title);
1346 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
1348 this.el.get_selection().select_path(path);
1351 _this.before_edit();
1356 if (col.title != "Value") {
1357 print("col title != Value");
1359 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
1360 this.el.get_selection().select_path(path);
1364 _this.before_edit();
1365 // XObject.error("column is not value?");
1366 return false; // ignore.. - key click.. ??? should we do this??
1370 // if the cell can be edited with a pulldown
1371 // then we should return true... - and let the start_editing handle it?
1378 // _this.before_edit(); <<< we really need to stop the other editor..
1379 _this.keyrender.el.stop_editing(false);
1380 _this.keyrender.el.editable =false;
1383 return _this.startEditingValue(path); // assumes selected row..
1392 // user defined functions
1394 public class Xcls_model : Object
1396 public Gtk.TreeStore el;
1397 private Xcls_LeftProps _this;
1403 public Xcls_model(Xcls_LeftProps _owner )
1407 this.el = new Gtk.TreeStore( 7, typeof(string), // 0 key type
1408 typeof(string), // 1 key
1409 typeof(string), // 2 key (display)
1410 typeof(string), // 3 value
1411 typeof(string), // 4 value (display)
1412 typeof(string), // 5 both (tooltip)
1413 typeof(string) // 6 key (for sorting)
1418 // set gobject values
1421 // user defined functions
1424 public class Xcls_keycol : Object
1426 public Gtk.TreeViewColumn el;
1427 private Xcls_LeftProps _this;
1433 public Xcls_keycol(Xcls_LeftProps _owner )
1436 _this.keycol = this;
1437 this.el = new Gtk.TreeViewColumn();
1441 // set gobject values
1442 this.el.title = "Name";
1443 this.el.resizable = true;
1444 var child_0 = new Xcls_keyrender( _this );
1446 this.el.pack_start ( child_0.el , false );
1450 this.el.add_attribute(_this.keyrender.el , "markup", 2 );
1451 this.el.add_attribute(_this.keyrender.el , "text", 1 );
1454 // user defined functions
1456 public class Xcls_keyrender : Object
1458 public Gtk.CellRendererText el;
1459 private Xcls_LeftProps _this;
1465 public Xcls_keyrender(Xcls_LeftProps _owner )
1468 _this.keyrender = this;
1469 this.el = new Gtk.CellRendererText();
1473 // set gobject values
1476 this.el.editing_started.connect( ( editable, path) => {
1479 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1484 // this.get('/LeftPanel.model').activePath = path;
1485 _this.model.el.get_value(iter,1, out gval);
1486 var val = (string)gval;
1488 ((Gtk.Entry)editable).set_text(val);
1490 this.el.edited.connect( (path, newtext) => {
1491 print("Keyrender - signal:edited\n");
1493 this.el.editable = false;
1498 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1501 _this.model.el.get_value(iter,1, out gval);
1502 var oldval = (string)gval;
1504 _this.model.el.get_value(iter,0, out gval);
1505 var ktype = (string)gval;
1507 _this.model.el.set_value(iter, 1, newtext);
1509 if (oldval == newtext) {
1514 print("ktype: %s\n",ktype);
1517 var ov = _this.node.listeners.get(oldval);
1518 _this.node.listeners.set(newtext, ov);
1519 _this.node.listeners.unset(oldval);
1521 _this.updateIter(iter, ktype, newtext, ov);
1525 var ov = _this.node.props.get(oldval);
1526 _this.node.props.set(newtext, ov);
1527 _this.node.props.unset(oldval);
1528 _this.updateIter(iter, ktype, newtext, ov);
1536 // user defined functions
1540 public class Xcls_valcol : Object
1542 public Gtk.TreeViewColumn el;
1543 private Xcls_LeftProps _this;
1549 public Xcls_valcol(Xcls_LeftProps _owner )
1552 _this.valcol = this;
1553 this.el = new Gtk.TreeViewColumn();
1557 // set gobject values
1558 this.el.title = "Value";
1559 this.el.resizable = true;
1560 var child_0 = new Xcls_valrender( _this );
1562 this.el.pack_start ( child_0.el , true );
1568 // typeof(string), // 0 key type
1569 // typeof(string), // 1 key
1570 // typeof(string), // 2 key (display)
1571 // typeof(string), // 3 value
1572 // typeof(string) // 4 value (display)
1575 this.el.add_attribute(_this.valrender.el , "text", 4 );
1576 //this.el.add_attribute(_this.valrender.el , "sensitive", 4 );
1577 //this.el.add_attribute(this.items[0].el , 'editable', 3 );
1578 // this.el.set_cell_data_func(cell, age_cell_data_func, NULL, NULL);
1580 // this.get('/LeftPanel').editableColumn= this;
1584 // user defined functions
1586 public class Xcls_valrender : Object
1588 public Gtk.CellRendererCombo el;
1589 private Xcls_LeftProps _this;
1595 public Xcls_valrender(Xcls_LeftProps _owner )
1598 _this.valrender = this;
1599 this.el = new Gtk.CellRendererCombo();
1603 // set gobject values
1604 this.el.editable = false;
1605 this.el.text_column = 0;
1606 this.el.has_entry = true;
1607 var child_0 = new Xcls_valrendermodel( _this );
1609 this.el.model = child_0.el;
1612 this.el.editing_started.connect( ( editable, path) => {
1613 //_this.editing = true;
1614 print("editing started called\n");
1615 if (!_this.allow_edit) {
1617 print("val - editing_Started\n");
1618 this.el.editable = false; // make sure it's not editor...
1623 _this.allow_edit =false;
1626 if ( this.el.has_entry ) {
1629 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1634 // this.get('/LeftPanel.model').activePath = path;
1635 _this.model.el.get_value(iter,3, out gval);
1638 var val = (string)gval;
1639 var combo = (Gtk.ComboBox)editable;
1641 var entry = (Gtk.Entry) combo.get_child();
1642 entry.set_text(val);
1646 this.el.edited.connect( (path, newtext) => {
1647 print("Valrender - signal:edited\n");
1649 this.el.editable = false;
1654 2, "<b>" + miter.get_key() + "</b>",
1655 3, miter.get_value(),
1656 4, display_value(short);
1662 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1665 _this.model.el.get_value(iter,0, out gval);
1666 var ktype = (string)gval;
1669 _this.model.el.get_value(iter,3, out gval);
1670 var oldval = (string)gval;
1672 _this.model.el.get_value(iter,1, out gval);
1673 var key = (string)gval;
1679 _this.node.listeners.set(key, newtext);
1680 _this.updateIter(iter,ktype,key,newtext);
1683 _this.node.props.set(key,newtext);
1684 _this.updateIter(iter,ktype, key,newtext);
1687 // _this.load(_this.file,_this.node);
1693 // user defined functions
1694 public void setOptions (string[] ar) {
1695 var m = _this.valrendermodel.el;
1698 for (var i =0; i < ar.length; i++) {
1700 m.set_value(iret, 0, ar[i]);
1705 public class Xcls_valrendermodel : Object
1707 public Gtk.ListStore el;
1708 private Xcls_LeftProps _this;
1714 public Xcls_valrendermodel(Xcls_LeftProps _owner )
1717 _this.valrendermodel = this;
1718 this.el = new Gtk.ListStore( 1, typeof(string) );
1722 // set gobject values
1725 // user defined functions
1730 public class Xcls_ContextMenu : Object
1733 private Xcls_LeftProps _this;
1739 public Xcls_ContextMenu(Xcls_LeftProps _owner )
1742 _this.ContextMenu = this;
1743 this.el = new Gtk.Menu();
1747 // set gobject values
1748 var child_0 = new Xcls_MenuItem33( _this );
1750 this.el.append ( child_0.el );
1751 var child_1 = new Xcls_SeparatorMenuItem34( _this );
1753 this.el.append ( child_1.el );
1754 var child_2 = new Xcls_MenuItem35( _this );
1756 this.el.append ( child_2.el );
1759 // user defined functions
1761 public class Xcls_MenuItem33 : Object
1763 public Gtk.MenuItem el;
1764 private Xcls_LeftProps _this;
1770 public Xcls_MenuItem33(Xcls_LeftProps _owner )
1773 this.el = new Gtk.MenuItem();
1777 // set gobject values
1778 this.el.label = "Edit";
1781 this.el.activate.connect( ( ) =>{
1783 var s = _this.view.el.get_selection();
1785 Gtk.TreeModel model;
1786 s.get_selected (out model, out iter);
1787 _this.startEditingKey(model.get_path(iter));
1791 // user defined functions
1794 public class Xcls_SeparatorMenuItem34 : Object
1796 public Gtk.SeparatorMenuItem el;
1797 private Xcls_LeftProps _this;
1803 public Xcls_SeparatorMenuItem34(Xcls_LeftProps _owner )
1806 this.el = new Gtk.SeparatorMenuItem();
1810 // set gobject values
1813 // user defined functions
1816 public class Xcls_MenuItem35 : Object
1818 public Gtk.MenuItem el;
1819 private Xcls_LeftProps _this;
1825 public Xcls_MenuItem35(Xcls_LeftProps _owner )
1828 this.el = new Gtk.MenuItem();
1832 // set gobject values
1833 this.el.label = "Delete";
1836 this.el.activate.connect( ( ) =>{
1837 _this.deleteSelected();
1841 // user defined functions