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.VBox( false , 0 );
43 this.allow_edit = false;
44 this.main_window = null;
47 var child_0 = new Xcls_HBox2( _this );
49 this.el.pack_start ( child_0.el , false,true,0 );
50 var child_1 = new Xcls_EditProps( _this );
52 this.el.pack_end ( child_1.el , true,true,0 );
55 // user defined functions
56 public void before_edit ()
59 print("before edit - stop editing\n");
61 // these do not appear to trigger save...
62 _this.keyrender.el.stop_editing(false);
63 _this.keyrender.el.editable =false;
65 _this.valrender.el.stop_editing(false);
66 _this.valrender.el.editable =false;
69 // technicall stop the popup editor..
72 public string keySortFormat (string key) {
73 // listeners first - with 0
80 var bits = key.split(" ");
83 return "2 " + bits[bits.length -1];
87 return "3 " + bits[bits.length -1];
92 return "4 " + bits[bits.length -1];
95 return "5 " + bits[bits.length -1];
100 public void finish_editing () {
104 public bool startEditingValue ( Gtk.TreePath path) {
106 // ONLY return true if editing is allowed - eg. combo..
108 print("start editing?\n");
109 if (!this.stop_editor()) {
110 print("stop editor failed\n");
116 var mod = this.model.el;
117 mod.get_iter (out iter, path);
123 2, "<b>" + miter.get_key() + "</b>",
129 mod.get_value(iter, 3 , out gval);
130 var val = (string)gval;
132 mod.get_value(iter, 1 , out gval);
133 var key = (string)gval;
134 var type_ar = key.split(" ");
138 mod.get_value(iter, 0 , out gval);
139 var type = (string)gval;
143 var use_textarea = false;
145 //------------ things that require the text editor...
147 if (type == "listener") {
150 if (key.length > 0 && key[0] == '|') { // user defined method
153 if (key.length > 0 && key[0] == '$') { // raw string
156 if (key.length > 0 && key == "* init") {
159 if (val.length > 40) { // long value...
166 print("Call show editor\n");
167 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
168 this.view.el.get_selection().select_path(path);
170 this.show_editor(file, node, type, key);
178 // others... - fill in options for true/false?
179 print("turn on editing %s \n" , mod.get_path(iter).to_string());
181 print (type_ar[0].up());
182 if (type_ar.length > 1 && (
183 type_ar[0].up() == "BOOLEAN"
185 type_ar[0].up() == "BOOL"
187 print("start editing try/false)???");
188 this.valrender.el.has_entry = false;
189 string[] opts = { "true", "false" };
190 this.valrender.setOptions(opts);
192 this.valrender.el.has_entry = false;
193 this.valrender.el.editable = true;
194 this.allow_edit = true;
195 GLib.Timeout.add_full(GLib.Priority.DEFAULT,100 , () => {
196 this.view.el.set_cursor_on_cell(
207 // see if type is a Enum.
213 this.valrender.setOptions(opts);
215 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
217 // at this point - work out the type...
218 // if its' a combo... then show the options..
219 this.valrender.el.has_entry = true;
221 this.valrender.el.editable = true;
224 this.allow_edit = true;
230 this.view.el.set_cursor_on_cell(
240 public void load (JsRender.JsRender file, JsRender.Node? node)
242 print("load leftprops\n");
248 this.model.el.clear();
250 //this.get('/RightEditor').el.hide();
257 //var provider = this.get('/LeftTree').getPaleteProvider();
260 //typeof(string), // 0 key type
261 //typeof(string), // 1 key
262 //typeof(string), // 2 key (display)
263 //typeof(string), // 3 value
264 //typeof(string), // 4 value (display)
265 //typeof(string), // 5 both (tooltip)
270 // really need a way to sort the hashmap...
271 var m = this.model.el;
273 var miter = node.listeners.map_iterator();
276 while(miter.next()) {
278 m.append(out iter,null);
280 this.updateIter(iter, "listener", miter.get_key(), miter.get_value());
286 miter = node.props.map_iterator();
289 while(miter.next()) {
291 m.append(out iter,null);
292 this.updateIter(iter, "prop", miter.get_key(), miter.get_value());
295 print("clear selection\n");
297 this.model.el.set_sort_column_id(6,Gtk.SortType.ASCENDING); // sort by real key..
299 this.view.el.get_selection().unselect_all();
301 var pane = _this.main_window.editpane.el;
302 var try_size = (i * 25) + 60; // est. 20px per line + 40px header
306 ((try_size * 1.0f) / (pane.max_position * 1.0f)) > 0.8f ?
307 (int) (pane.max_position * 0.2f) :
308 pane.max_position-try_size);
312 public string keyFormat (string val, string type) {
314 // Glib.markup_escape_text(val);
316 if (type == "listener") {
317 return "<span font_weight=\"bold\" color=\"#660000\">" +
318 GLib.Markup.escape_text(val) +
322 if (val.length < 1) {
323 return "<span color=\"#FF0000\">--empty--</span>";
328 //# - object properties
330 // all of these... - display value is last element..
331 var ar = val.strip().split(" ");
334 var dval = GLib.Markup.escape_text(ar[ar.length-1]);
340 case '@': // signal // just bold balck?
341 if (dval[0] == '@') {
342 dval = dval.substring(1);
345 return @"<span font_weight=\"bold\">@ $dval</span>";
346 case '#': // object properties?
347 if (dval[0] == '#') {
348 dval = dval.substring(1);
350 return @"<span font_weight=\"bold\">$dval</span>";
352 if (dval[0] == '*') {
353 dval = dval.substring(1);
355 return @"<span color=\"#0000CC\" font_weight=\"bold\">$dval</span>";
357 if (dval[0] == '$') {
358 dval = dval.substring(1);
360 return @"<span style=\"italic\">$dval</span>";
361 case '|': // user defined methods
362 if (dval[0] == '|') {
363 dval = dval.substring(1);
365 return @"<span color=\"#008000\" font_weight=\"bold\">$dval</span>";
376 public void deleteSelected () {
381 var s = this.view.el.get_selection();
382 s.get_selected(out mod, out iter);
386 mod.get_value(iter, 0 , out gval);
387 var type = (string)gval;
389 mod.get_value(iter, 1 , out gval);
390 var key = (string)gval;
394 this.node.listeners.remove(key);
398 this.node.props.remove(key);
401 this.load(this.file, this.node);
405 public void startEditingKey ( Gtk.TreePath path) {
407 if (!this.stop_editor()) {
411 // others... - fill in options for true/false?
414 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
415 this.allow_edit = true;
416 this.keyrender.el.editable = true;
418 this.view.el.set_cursor_on_cell(
430 public void addProp (string in_type, string key, string value, string value_type) {
431 // info includes key, val, skel, etype..
432 //console.dump(info);
433 //type = info.type.toLowerCase();
434 //var data = this.toJS();
436 var type = in_type == "signals" ? "listener" : in_type;
438 var fkey = (value_type.length > 0 ? value_type + " " : "") + key;
440 if (type == "listener") {
441 if (this.node.listeners.has_key(key)) {
444 this.node.listeners.set(key,value);
447 if (this.node.props.has_key(fkey)) {
450 this.node.props.set(fkey,value);
455 this.load(this.file, this.node);
459 /// need to find the row which I've just added..
462 var s = this.view.el.get_selection();
465 print("trying to find new iter");
467 this.model.el.foreach((model, path, iter) => {
470 this.model.el.get_value(iter, 0 , out gval);
471 if ((string)gval != type) {
472 print("not type: %s = %s\n", (string)gval , type);
475 this.model.el.get_value(iter, 1 , out gval);
476 if ((string)gval != fkey) {
477 print("not key: %s = %s\n", (string)gval , fkey);
481 GLib.Timeout.add_full(GLib.Priority.DEFAULT,40 , () => {
483 this.startEditingValue(this.model.el.get_path(iter));
486 //s.select_iter(iter);
494 public void updateIter (Gtk.TreeIter iter, string type, string key, string value) {
496 print("update Iter %s, %s\n", key,value);
497 //typeof(string), // 0 key type
498 //typeof(string), // 1 key
499 //typeof(string), // 2 key (display)
500 //typeof(string), // 3 value
501 //typeof(string), // 4 value (display)
502 //typeof(string), // 5 both (tooltip)
503 //typeof(string), // 6 key (sort)
505 var dl = value.strip().split("\n");
507 var dis_val = dl.length > 1 ? (dl[0].strip()+ "...") : dl[0];
509 if (type == "listener") {
513 this.model.el.set(iter,
516 2, this.keyFormat(key ,type),
519 5, "<tt>" + GLib.Markup.escape_text(key + " " +value) + "</tt>",
527 this.model.el.set(iter,
530 2, this.keyFormat(key , "prop"),
533 5, "<tt>" + GLib.Markup.escape_text(key + " " + value) + "</tt>",
534 6, this.keySortFormat(key)
537 public class Xcls_HBox2 : Object
540 private Xcls_LeftProps _this;
546 public Xcls_HBox2(Xcls_LeftProps _owner )
549 this.el = new Gtk.HBox( true, 0 );
553 // set gobject values
554 var child_0 = new Xcls_Button3( _this );
556 this.el.add ( child_0.el );
559 // user defined functions
561 public class Xcls_Button3 : Object
563 public Gtk.Button el;
564 private Xcls_LeftProps _this;
570 public Xcls_Button3(Xcls_LeftProps _owner )
573 this.el = new Gtk.Button();
577 // set gobject values
578 var child_0 = new Xcls_HBox4( _this );
580 this.el.add ( child_0.el );
581 var child_1 = new Xcls_AddPropertyPopup( _this );
585 this.el.button_press_event.connect( (self, ev) => {
589 var p = _this.AddPropertyPopup;
590 p.el.set_screen(Gdk.Screen.get_default());
592 p.el.popup(null, null, null, ev.button, ev.time);
597 // user defined functions
599 public class Xcls_HBox4 : Object
602 private Xcls_LeftProps _this;
608 public Xcls_HBox4(Xcls_LeftProps _owner )
611 this.el = new Gtk.HBox( true, 0 );
615 // set gobject values
616 var child_0 = new Xcls_Image5( _this );
618 this.el.add ( child_0.el );
619 var child_1 = new Xcls_Label6( _this );
621 this.el.add ( child_1.el );
624 // user defined functions
626 public class Xcls_Image5 : Object
629 private Xcls_LeftProps _this;
635 public Xcls_Image5(Xcls_LeftProps _owner )
638 this.el = new Gtk.Image();
642 // set gobject values
643 this.el.stock = Gtk.STOCK_ADD;
644 this.el.icon_size = Gtk.IconSize.MENU;
647 // user defined functions
649 public class Xcls_Label6 : Object
652 private Xcls_LeftProps _this;
658 public Xcls_Label6(Xcls_LeftProps _owner )
661 this.el = new Gtk.Label( "Other" );
665 // set gobject values
668 // user defined functions
670 public class Xcls_AddPropertyPopup : Object
673 private Xcls_LeftProps _this;
679 public Xcls_AddPropertyPopup(Xcls_LeftProps _owner )
682 _this.AddPropertyPopup = this;
683 this.el = new Gtk.Menu();
687 // set gobject values
688 var child_0 = new Xcls_MenuItem8( _this );
690 this.el.append ( child_0.el );
691 var child_1 = new Xcls_MenuItem9( _this );
693 this.el.append ( child_1.el );
694 var child_2 = new Xcls_MenuItem10( _this );
696 this.el.append ( child_2.el );
697 var child_3 = new Xcls_MenuItem11( _this );
699 this.el.append ( child_3.el );
700 var child_4 = new Xcls_SeparatorMenuItem12( _this );
702 this.el.add ( child_4.el );
703 var child_5 = new Xcls_MenuItem13( _this );
705 this.el.append ( child_5.el );
706 var child_6 = new Xcls_MenuItem14( _this );
708 this.el.append ( child_6.el );
709 var child_7 = new Xcls_MenuItem15( _this );
711 this.el.append ( child_7.el );
712 var child_8 = new Xcls_SeparatorMenuItem16( _this );
714 this.el.add ( child_8.el );
715 var child_9 = new Xcls_MenuItem17( _this );
717 this.el.append ( child_9.el );
718 var child_10 = new Xcls_MenuItem18( _this );
720 this.el.append ( child_10.el );
721 var child_11 = new Xcls_MenuItem19( _this );
723 this.el.append ( child_11.el );
724 var child_12 = new Xcls_SeparatorMenuItem20( _this );
726 this.el.add ( child_12.el );
727 var child_13 = new Xcls_MenuItem21( _this );
729 this.el.append ( child_13.el );
730 var child_14 = new Xcls_MenuItem22( _this );
732 this.el.append ( child_14.el );
733 var child_15 = new Xcls_MenuItem23( _this );
735 this.el.append ( child_15.el );
738 // user defined functions
740 public class Xcls_MenuItem8 : Object
742 public Gtk.MenuItem el;
743 private Xcls_LeftProps _this;
749 public Xcls_MenuItem8(Xcls_LeftProps _owner )
752 this.el = new Gtk.MenuItem();
756 // set gobject values
757 this.el.tooltip_markup = "Using _this.{ID} will map to this element";
758 this.el.label = "id: _this.{ID} (Vala)";
761 this.el.activate.connect( () => {
762 _this.addProp( "prop", "id", "", "");
766 // user defined functions
768 public class Xcls_MenuItem9 : Object
770 public Gtk.MenuItem el;
771 private Xcls_LeftProps _this;
777 public Xcls_MenuItem9(Xcls_LeftProps _owner )
780 this.el = new Gtk.MenuItem();
784 // set gobject values
785 this.el.tooltip_markup = "how to pack this element onto parent, (method, 2nd arg, 3rd arg) .. the 1st argument is filled by the element";
786 this.el.label = "pack: Pack method (Vala)";
789 this.el.activate.connect( ( ) => {
791 _this.addProp( "prop", "pack","add", "*");
795 // user defined functions
797 public class Xcls_MenuItem10 : Object
799 public Gtk.MenuItem el;
800 private Xcls_LeftProps _this;
806 public Xcls_MenuItem10(Xcls_LeftProps _owner )
809 this.el = new Gtk.MenuItem();
813 // set gobject values
814 this.el.tooltip_markup = "eg. \n\nnew Clutter.Image.from_file(.....)";
815 this.el.label = "ctor: Alterative to default contructor";
818 this.el.activate.connect( ( ) => {
820 _this.addProp( "prop", "ctor","", "*");
824 // user defined functions
826 public class Xcls_MenuItem11 : Object
828 public Gtk.MenuItem el;
829 private Xcls_LeftProps _this;
835 public Xcls_MenuItem11(Xcls_LeftProps _owner )
838 this.el = new Gtk.MenuItem();
842 // set gobject values
843 this.el.tooltip_markup = "This code is called after the ctor";
844 this.el.label = "init: initialziation code (vala)";
847 this.el.activate.connect( ( ) => {
849 _this.addProp( "prop", "init", "{\n\n}\n", "*" );
853 // user defined functions
855 public class Xcls_SeparatorMenuItem12 : Object
857 public Gtk.SeparatorMenuItem el;
858 private Xcls_LeftProps _this;
864 public Xcls_SeparatorMenuItem12(Xcls_LeftProps _owner )
867 this.el = new Gtk.SeparatorMenuItem();
871 // set gobject values
874 // user defined functions
876 public class Xcls_MenuItem13 : Object
878 public Gtk.MenuItem el;
879 private Xcls_LeftProps _this;
885 public Xcls_MenuItem13(Xcls_LeftProps _owner )
888 this.el = new Gtk.MenuItem();
892 // set gobject values
893 this.el.tooltip_markup = "Add a user defined string property";
894 this.el.label = "String";
897 this.el.activate.connect( (self) => {
899 _this.addProp( "prop", "XXXX", "","string");
904 // user defined functions
906 public class Xcls_MenuItem14 : Object
908 public Gtk.MenuItem el;
909 private Xcls_LeftProps _this;
915 public Xcls_MenuItem14(Xcls_LeftProps _owner )
918 this.el = new Gtk.MenuItem();
922 // set gobject values
923 this.el.tooltip_markup = "Add a user defined number property";
924 this.el.label = "Number";
927 this.el.activate.connect( ( ) =>{
929 _this.addProp("prop", "XXX", "0", "int");
933 // user defined functions
935 public class Xcls_MenuItem15 : Object
937 public Gtk.MenuItem el;
938 private Xcls_LeftProps _this;
944 public Xcls_MenuItem15(Xcls_LeftProps _owner )
947 this.el = new Gtk.MenuItem();
951 // set gobject values
952 this.el.tooltip_markup = "Add a user defined boolean property";
953 this.el.label = "Boolean";
956 this.el.activate.connect( ( ) =>{
958 _this.addProp( "prop", "XXX", "true", "bool");
962 // user defined functions
964 public class Xcls_SeparatorMenuItem16 : Object
966 public Gtk.SeparatorMenuItem el;
967 private Xcls_LeftProps _this;
973 public Xcls_SeparatorMenuItem16(Xcls_LeftProps _owner )
976 this.el = new Gtk.SeparatorMenuItem();
980 // set gobject values
983 // user defined functions
985 public class Xcls_MenuItem17 : Object
987 public Gtk.MenuItem el;
988 private Xcls_LeftProps _this;
994 public Xcls_MenuItem17(Xcls_LeftProps _owner )
997 this.el = new Gtk.MenuItem();
1001 // set gobject values
1002 this.el.tooltip_markup = "Add a user function boolean property";
1003 this.el.label = "Javascript Function";
1006 this.el.activate.connect( ( ) =>{
1008 _this.addProp("prop", "XXXX", "function() { }", "| function");
1012 // user defined functions
1014 public class Xcls_MenuItem18 : Object
1016 public Gtk.MenuItem el;
1017 private Xcls_LeftProps _this;
1023 public Xcls_MenuItem18(Xcls_LeftProps _owner )
1026 this.el = new Gtk.MenuItem();
1030 // set gobject values
1031 this.el.tooltip_markup = "Add a user function boolean property";
1032 this.el.label = "Vala Method";
1035 this.el.activate.connect( ( ) =>{
1037 _this.addProp( "prop", "XXXX", "() {\n\n}\n", "| return_type");
1041 // user defined functions
1043 public class Xcls_MenuItem19 : Object
1045 public Gtk.MenuItem el;
1046 private Xcls_LeftProps _this;
1052 public Xcls_MenuItem19(Xcls_LeftProps _owner )
1055 this.el = new Gtk.MenuItem();
1059 // set gobject values
1060 this.el.tooltip_markup = "Add a vala signal";
1061 this.el.label = "Vala Signal";
1064 this.el.activate.connect( ( ) =>{
1066 _this.addProp( "prop", "XXXX", "()", "@ void");
1070 // user defined functions
1072 public class Xcls_SeparatorMenuItem20 : Object
1074 public Gtk.SeparatorMenuItem el;
1075 private Xcls_LeftProps _this;
1081 public Xcls_SeparatorMenuItem20(Xcls_LeftProps _owner )
1084 this.el = new Gtk.SeparatorMenuItem();
1088 // set gobject values
1091 // user defined functions
1093 public class Xcls_MenuItem21 : Object
1095 public Gtk.MenuItem el;
1096 private Xcls_LeftProps _this;
1102 public Xcls_MenuItem21(Xcls_LeftProps _owner )
1105 this.el = new Gtk.MenuItem();
1109 // set gobject values
1110 this.el.tooltip_markup = "Add a flexy if (for HTML templates)";
1111 this.el.label = "Flexy - If";
1114 this.el.activate.connect( ( ) =>{
1116 _this.addProp("prop", "flexy:if", "value_or_condition", "string");
1120 // user defined functions
1122 public class Xcls_MenuItem22 : Object
1124 public Gtk.MenuItem el;
1125 private Xcls_LeftProps _this;
1131 public Xcls_MenuItem22(Xcls_LeftProps _owner )
1134 this.el = new Gtk.MenuItem();
1138 // set gobject values
1139 this.el.tooltip_markup = "Add a flexy include (for HTML templates)";
1140 this.el.label = "Flexy - Include";
1143 this.el.activate.connect( ( ) =>{
1145 _this.addProp("prop", "flexy:include", "name_of_file.html", "string");
1149 // user defined functions
1151 public class Xcls_MenuItem23 : Object
1153 public Gtk.MenuItem el;
1154 private Xcls_LeftProps _this;
1160 public Xcls_MenuItem23(Xcls_LeftProps _owner )
1163 this.el = new Gtk.MenuItem();
1167 // set gobject values
1168 this.el.tooltip_markup = "Add a flexy foreach (for HTML templates)";
1169 this.el.label = "Flexy - Foreach";
1172 this.el.activate.connect( ( ) =>{
1174 _this.addProp("prop", "flexy:foreach", "array,key,value", "string");
1178 // user defined functions
1180 public class Xcls_EditProps : Object
1182 public Gtk.ScrolledWindow el;
1183 private Xcls_LeftProps _this;
1187 public bool editing;
1190 public Xcls_EditProps(Xcls_LeftProps _owner )
1193 _this.EditProps = this;
1194 this.el = new Gtk.ScrolledWindow( null, null );
1197 this.editing = false;
1199 // set gobject values
1200 this.el.shadow_type = Gtk.ShadowType.IN;
1201 var child_0 = new Xcls_view( _this );
1203 this.el.add ( child_0.el );
1209 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
1213 // user defined functions
1215 public class Xcls_view : Object
1217 public Gtk.TreeView el;
1218 private Xcls_LeftProps _this;
1224 public Xcls_view(Xcls_LeftProps _owner )
1228 this.el = new Gtk.TreeView();
1232 // set gobject values
1233 this.el.tooltip_column = 5;
1234 this.el.enable_tree_lines = true;
1235 this.el.headers_visible = true;
1236 var child_0 = new Xcls_model( _this );
1238 this.el.set_model ( child_0.el );
1239 var child_1 = new Xcls_keycol( _this );
1241 this.el.append_column ( child_1.el );
1242 var child_2 = new Xcls_valcol( _this );
1244 this.el.append_column ( child_2.el );
1245 var child_3 = new Xcls_ContextMenu( _this );
1251 var selection = this.el.get_selection();
1252 selection.set_mode( Gtk.SelectionMode.SINGLE);
1255 var description = new Pango.FontDescription();
1256 description.set_size(10000);
1257 this.el.modify_font(description);
1261 this.el.button_press_event.connect( ( ev) => {
1263 Gtk.TreeViewColumn col;
1267 if (!this.el.get_path_at_pos((int)ev.x, (int) ev.y, out path, out col, out cell_x, out cell_y )) {
1268 print("nothing selected on click");
1269 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
1270 this.el.get_selection().unselect_all();
1274 _this.before_edit();
1275 return false; //not on a element.
1280 if (ev.type == Gdk.EventType.2BUTTON_PRESS && ev.button == 1 && col.title == "Name") {
1284 _this.before_edit();
1286 _this.keyrender.el.stop_editing(false);
1287 _this.keyrender.el.editable =false;
1289 _this.valrender.el.stop_editing(false);
1290 _this.valrender.el.editable =false;
1292 _this.startEditingKey(path);
1301 if (ev.type == Gdk.EventType.BUTTON_PRESS && ev.button == 3) {
1303 //if (col.title == "Value") {
1304 // _this.before_edit();
1308 var p = _this.ContextMenu;
1310 p.el.set_screen(Gdk.Screen.get_default());
1312 p.el.popup(null, null, null, ev.button, ev.time);
1313 //Seed.print("click:" + res.column.title);
1315 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
1317 this.el.get_selection().select_path(path);
1320 _this.before_edit();
1325 if (col.title != "Value") {
1326 print("col title != Value");
1328 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
1329 this.el.get_selection().select_path(path);
1333 _this.before_edit();
1334 // XObject.error("column is not value?");
1335 return false; // ignore.. - key click.. ??? should we do this??
1339 // if the cell can be edited with a pulldown
1340 // then we should return true... - and let the start_editing handle it?
1347 // _this.before_edit(); <<< we really need to stop the other editor..
1348 _this.keyrender.el.stop_editing(false);
1349 _this.keyrender.el.editable =false;
1352 return _this.startEditingValue(path); // assumes selected row..
1361 // user defined functions
1363 public class Xcls_model : Object
1365 public Gtk.TreeStore el;
1366 private Xcls_LeftProps _this;
1372 public Xcls_model(Xcls_LeftProps _owner )
1376 this.el = new Gtk.TreeStore( 7, typeof(string), // 0 key type
1377 typeof(string), // 1 key
1378 typeof(string), // 2 key (display)
1379 typeof(string), // 3 value
1380 typeof(string), // 4 value (display)
1381 typeof(string), // 5 both (tooltip)
1382 typeof(string) // 6 key (for sorting)
1387 // set gobject values
1390 // user defined functions
1392 public class Xcls_keycol : Object
1394 public Gtk.TreeViewColumn el;
1395 private Xcls_LeftProps _this;
1401 public Xcls_keycol(Xcls_LeftProps _owner )
1404 _this.keycol = this;
1405 this.el = new Gtk.TreeViewColumn();
1409 // set gobject values
1410 this.el.title = "Name";
1411 this.el.resizable = true;
1412 var child_0 = new Xcls_keyrender( _this );
1414 this.el.pack_start ( child_0.el , false );
1418 this.el.add_attribute(_this.keyrender.el , "markup", 2 );
1419 this.el.add_attribute(_this.keyrender.el , "text", 1 );
1422 // user defined functions
1424 public class Xcls_keyrender : Object
1426 public Gtk.CellRendererText el;
1427 private Xcls_LeftProps _this;
1433 public Xcls_keyrender(Xcls_LeftProps _owner )
1436 _this.keyrender = this;
1437 this.el = new Gtk.CellRendererText();
1441 // set gobject values
1444 this.el.editing_started.connect( ( editable, path) => {
1447 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1452 // this.get('/LeftPanel.model').activePath = path;
1453 _this.model.el.get_value(iter,1, out gval);
1454 var val = (string)gval;
1456 ((Gtk.Entry)editable).set_text(val);
1458 this.el.edited.connect( (path, newtext) => {
1459 print("Keyrender - signal:edited\n");
1461 this.el.editable = false;
1466 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1469 _this.model.el.get_value(iter,1, out gval);
1470 var oldval = (string)gval;
1472 _this.model.el.get_value(iter,0, out gval);
1473 var ktype = (string)gval;
1475 _this.model.el.set_value(iter, 1, newtext);
1477 if (oldval == newtext) {
1482 print("ktype: %s\n",ktype);
1485 var ov = _this.node.listeners.get(oldval);
1486 _this.node.listeners.set(newtext, ov);
1487 _this.node.listeners.remove(oldval);
1489 _this.updateIter(iter, ktype, newtext, ov);
1493 var ov = _this.node.props.get(oldval);
1494 _this.node.props.set(newtext, ov);
1495 _this.node.props.remove(oldval);
1496 _this.updateIter(iter, ktype, newtext, ov);
1504 // user defined functions
1506 public class Xcls_valcol : Object
1508 public Gtk.TreeViewColumn el;
1509 private Xcls_LeftProps _this;
1515 public Xcls_valcol(Xcls_LeftProps _owner )
1518 _this.valcol = this;
1519 this.el = new Gtk.TreeViewColumn();
1523 // set gobject values
1524 this.el.title = "Value";
1525 this.el.resizable = true;
1526 var child_0 = new Xcls_valrender( _this );
1528 this.el.pack_start ( child_0.el , true );
1534 // typeof(string), // 0 key type
1535 // typeof(string), // 1 key
1536 // typeof(string), // 2 key (display)
1537 // typeof(string), // 3 value
1538 // typeof(string) // 4 value (display)
1541 this.el.add_attribute(_this.valrender.el , "text", 4 );
1542 //this.el.add_attribute(_this.valrender.el , "sensitive", 4 );
1543 //this.el.add_attribute(this.items[0].el , 'editable', 3 );
1544 // this.el.set_cell_data_func(cell, age_cell_data_func, NULL, NULL);
1546 // this.get('/LeftPanel').editableColumn= this;
1550 // user defined functions
1552 public class Xcls_valrender : Object
1554 public Gtk.CellRendererCombo el;
1555 private Xcls_LeftProps _this;
1561 public Xcls_valrender(Xcls_LeftProps _owner )
1564 _this.valrender = this;
1565 this.el = new Gtk.CellRendererCombo();
1569 // set gobject values
1570 this.el.editable = false;
1571 this.el.text_column = 0;
1572 this.el.has_entry = true;
1573 var child_0 = new Xcls_valrendermodel( _this );
1575 this.el.model = child_0.el;
1578 this.el.editing_started.connect( ( editable, path) => {
1579 //_this.editing = true;
1580 print("editing started called\n");
1581 if (!_this.allow_edit) {
1583 print("val - editing_Started\n");
1584 this.el.editable = false; // make sure it's not editor...
1589 _this.allow_edit =false;
1592 if ( this.el.has_entry ) {
1595 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1600 // this.get('/LeftPanel.model').activePath = path;
1601 _this.model.el.get_value(iter,3, out gval);
1604 var val = (string)gval;
1605 var combo = (Gtk.ComboBox)editable;
1607 var entry = (Gtk.Entry) combo.get_child();
1608 entry.set_text(val);
1612 this.el.edited.connect( (path, newtext) => {
1613 print("Valrender - signal:edited\n");
1615 this.el.editable = false;
1620 2, "<b>" + miter.get_key() + "</b>",
1621 3, miter.get_value(),
1622 4, display_value(short);
1628 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1631 _this.model.el.get_value(iter,0, out gval);
1632 var ktype = (string)gval;
1635 _this.model.el.get_value(iter,3, out gval);
1636 var oldval = (string)gval;
1638 _this.model.el.get_value(iter,1, out gval);
1639 var key = (string)gval;
1645 _this.node.listeners.set(key, newtext);
1646 _this.updateIter(iter,ktype,key,newtext);
1649 _this.node.props.set(key,newtext);
1650 _this.updateIter(iter,ktype, key,newtext);
1653 // _this.load(_this.file,_this.node);
1659 // user defined functions
1660 public void setOptions (string[] ar) {
1661 var m = _this.valrendermodel.el;
1664 for (var i =0; i < ar.length; i++) {
1666 m.set_value(iret, 0, ar[i]);
1671 public class Xcls_valrendermodel : Object
1673 public Gtk.ListStore el;
1674 private Xcls_LeftProps _this;
1680 public Xcls_valrendermodel(Xcls_LeftProps _owner )
1683 _this.valrendermodel = this;
1684 this.el = new Gtk.ListStore( 1, typeof(string) );
1688 // set gobject values
1691 // user defined functions
1693 public class Xcls_ContextMenu : Object
1696 private Xcls_LeftProps _this;
1702 public Xcls_ContextMenu(Xcls_LeftProps _owner )
1705 _this.ContextMenu = this;
1706 this.el = new Gtk.Menu();
1710 // set gobject values
1711 var child_0 = new Xcls_MenuItem33( _this );
1713 this.el.append ( child_0.el );
1714 var child_1 = new Xcls_SeparatorMenuItem34( _this );
1716 this.el.append ( child_1.el );
1717 var child_2 = new Xcls_MenuItem35( _this );
1719 this.el.append ( child_2.el );
1722 // user defined functions
1724 public class Xcls_MenuItem33 : Object
1726 public Gtk.MenuItem el;
1727 private Xcls_LeftProps _this;
1733 public Xcls_MenuItem33(Xcls_LeftProps _owner )
1736 this.el = new Gtk.MenuItem();
1740 // set gobject values
1741 this.el.label = "Edit";
1744 this.el.activate.connect( ( ) =>{
1746 var s = _this.view.el.get_selection();
1748 Gtk.TreeModel model;
1749 s.get_selected (out model, out iter);
1750 _this.startEditingKey(model.get_path(iter));
1754 // user defined functions
1756 public class Xcls_SeparatorMenuItem34 : Object
1758 public Gtk.SeparatorMenuItem el;
1759 private Xcls_LeftProps _this;
1765 public Xcls_SeparatorMenuItem34(Xcls_LeftProps _owner )
1768 this.el = new Gtk.SeparatorMenuItem();
1772 // set gobject values
1775 // user defined functions
1777 public class Xcls_MenuItem35 : Object
1779 public Gtk.MenuItem el;
1780 private Xcls_LeftProps _this;
1786 public Xcls_MenuItem35(Xcls_LeftProps _owner )
1789 this.el = new Gtk.MenuItem();
1793 // set gobject values
1794 this.el.label = "Delete";
1797 this.el.activate.connect( ( ) =>{
1798 _this.deleteSelected();
1802 // user defined functions