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(" ");
139 mod.get_value(iter, 0 , out gval);
140 var type = (string)gval; // listerner or prop..
144 var use_textarea = false;
146 //------------ things that require the text editor...
148 if (type == "listener") {
151 if (key.length > 0 && key[0] == '|') { // user defined method
154 if (key.length > 0 && key[0] == '$') { // raw string
157 if (key.length > 0 && key == "* init") {
160 if (val.length > 40) { // long value...
167 print("Call show editor\n");
168 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
169 this.view.el.get_selection().select_path(path);
171 this.show_editor(file, node, type, key);
179 // others... - fill in options for true/false?
180 print("turn on editing %s \n" , mod.get_path(iter).to_string());
182 print (type_ar[0].up());
183 if (type_ar.length > 1 && (
184 type_ar[0].up() == "BOOLEAN"
186 type_ar[0].up() == "BOOL"
188 print("start editing try/false)???");
189 this.valrender.el.has_entry = false;
190 string[] opts = { "true", "false" };
191 this.valrender.setOptions(opts);
193 this.valrender.el.has_entry = false;
194 this.valrender.el.editable = true;
195 this.allow_edit = true;
196 GLib.Timeout.add_full(GLib.Priority.DEFAULT,100 , () => {
197 this.view.el.set_cursor_on_cell(
208 // see if type is a Enum.
211 var pal = Palete.Palete.factory(this.file.project.xtype);
217 this.valrender.setOptions(opts);
219 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
221 // at this point - work out the type...
222 // if its' a combo... then show the options..
223 this.valrender.el.has_entry = true;
225 this.valrender.el.editable = true;
228 this.allow_edit = true;
234 this.view.el.set_cursor_on_cell(
244 public void load (JsRender.JsRender file, JsRender.Node? node)
246 print("load leftprops\n");
252 this.model.el.clear();
254 //this.get('/RightEditor').el.hide();
261 //var provider = this.get('/LeftTree').getPaleteProvider();
264 //typeof(string), // 0 key type
265 //typeof(string), // 1 key
266 //typeof(string), // 2 key (display)
267 //typeof(string), // 3 value
268 //typeof(string), // 4 value (display)
269 //typeof(string), // 5 both (tooltip)
274 // really need a way to sort the hashmap...
275 var m = this.model.el;
277 var miter = node.listeners.map_iterator();
280 while(miter.next()) {
282 m.append(out iter,null);
284 this.updateIter(iter, "listener", miter.get_key(), miter.get_value());
290 miter = node.props.map_iterator();
293 while(miter.next()) {
295 m.append(out iter,null);
296 this.updateIter(iter, "prop", miter.get_key(), miter.get_value());
299 print("clear selection\n");
301 this.model.el.set_sort_column_id(6,Gtk.SortType.ASCENDING); // sort by real key..
303 this.view.el.get_selection().unselect_all();
305 var pane = _this.main_window.editpane.el;
306 var try_size = (i * 25) + 60; // est. 20px per line + 40px header
310 ((try_size * 1.0f) / (pane.max_position * 1.0f)) > 0.8f ?
311 (int) (pane.max_position * 0.2f) :
312 pane.max_position-try_size);
316 public string keyFormat (string val, string type) {
318 // Glib.markup_escape_text(val);
320 if (type == "listener") {
321 return "<span font_weight=\"bold\" color=\"#660000\">" +
322 GLib.Markup.escape_text(val) +
326 if (val.length < 1) {
327 return "<span color=\"#FF0000\">--empty--</span>";
332 //# - object properties
334 // all of these... - display value is last element..
335 var ar = val.strip().split(" ");
338 var dval = GLib.Markup.escape_text(ar[ar.length-1]);
344 case '@': // signal // just bold balck?
345 if (dval[0] == '@') {
346 dval = dval.substring(1);
349 return @"<span font_weight=\"bold\">@ $dval</span>";
350 case '#': // object properties?
351 if (dval[0] == '#') {
352 dval = dval.substring(1);
354 return @"<span font_weight=\"bold\">$dval</span>";
356 if (dval[0] == '*') {
357 dval = dval.substring(1);
359 return @"<span color=\"#0000CC\" font_weight=\"bold\">$dval</span>";
361 if (dval[0] == '$') {
362 dval = dval.substring(1);
364 return @"<span style=\"italic\">$dval</span>";
365 case '|': // user defined methods
366 if (dval[0] == '|') {
367 dval = dval.substring(1);
369 return @"<span color=\"#008000\" font_weight=\"bold\">$dval</span>";
380 public void deleteSelected () {
385 var s = this.view.el.get_selection();
386 s.get_selected(out mod, out iter);
390 mod.get_value(iter, 0 , out gval);
391 var type = (string)gval;
393 mod.get_value(iter, 1 , out gval);
394 var key = (string)gval;
398 this.node.listeners.remove(key);
402 this.node.props.remove(key);
405 this.load(this.file, this.node);
409 public void startEditingKey ( Gtk.TreePath path) {
411 if (!this.stop_editor()) {
415 // others... - fill in options for true/false?
418 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
419 this.allow_edit = true;
420 this.keyrender.el.editable = true;
422 this.view.el.set_cursor_on_cell(
434 public void addProp (string in_type, string key, string value, string value_type) {
435 // info includes key, val, skel, etype..
436 //console.dump(info);
437 //type = info.type.toLowerCase();
438 //var data = this.toJS();
440 var type = in_type == "signals" ? "listener" : in_type;
442 var fkey = (value_type.length > 0 ? value_type + " " : "") + key;
444 if (type == "listener") {
445 if (this.node.listeners.has_key(key)) {
448 this.node.listeners.set(key,value);
451 if (this.node.props.has_key(fkey)) {
454 this.node.props.set(fkey,value);
459 this.load(this.file, this.node);
463 /// need to find the row which I've just added..
466 var s = this.view.el.get_selection();
469 print("trying to find new iter");
471 this.model.el.foreach((model, path, iter) => {
474 this.model.el.get_value(iter, 0 , out gval);
475 if ((string)gval != type) {
476 print("not type: %s = %s\n", (string)gval , type);
479 this.model.el.get_value(iter, 1 , out gval);
480 if ((string)gval != fkey) {
481 print("not key: %s = %s\n", (string)gval , fkey);
485 GLib.Timeout.add_full(GLib.Priority.DEFAULT,40 , () => {
487 this.startEditingValue(this.model.el.get_path(iter));
490 //s.select_iter(iter);
498 public void updateIter (Gtk.TreeIter iter, string type, string key, string value) {
500 print("update Iter %s, %s\n", key,value);
501 //typeof(string), // 0 key type
502 //typeof(string), // 1 key
503 //typeof(string), // 2 key (display)
504 //typeof(string), // 3 value
505 //typeof(string), // 4 value (display)
506 //typeof(string), // 5 both (tooltip)
507 //typeof(string), // 6 key (sort)
509 var dl = value.strip().split("\n");
511 var dis_val = dl.length > 1 ? (dl[0].strip()+ "...") : dl[0];
513 if (type == "listener") {
517 this.model.el.set(iter,
520 2, this.keyFormat(key ,type),
523 5, "<tt>" + GLib.Markup.escape_text(key + " " +value) + "</tt>",
531 this.model.el.set(iter,
534 2, this.keyFormat(key , "prop"),
537 5, "<tt>" + GLib.Markup.escape_text(key + " " + value) + "</tt>",
538 6, this.keySortFormat(key)
541 public class Xcls_HBox2 : Object
544 private Xcls_LeftProps _this;
550 public Xcls_HBox2(Xcls_LeftProps _owner )
553 this.el = new Gtk.HBox( true, 0 );
557 // set gobject values
558 var child_0 = new Xcls_Button3( _this );
560 this.el.add ( child_0.el );
563 // user defined functions
565 public class Xcls_Button3 : Object
567 public Gtk.Button el;
568 private Xcls_LeftProps _this;
574 public Xcls_Button3(Xcls_LeftProps _owner )
577 this.el = new Gtk.Button();
581 // set gobject values
582 var child_0 = new Xcls_HBox4( _this );
584 this.el.add ( child_0.el );
585 var child_1 = new Xcls_AddPropertyPopup( _this );
589 this.el.button_press_event.connect( (self, ev) => {
593 var p = _this.AddPropertyPopup;
594 p.el.set_screen(Gdk.Screen.get_default());
596 p.el.popup(null, null, null, ev.button, ev.time);
601 // user defined functions
603 public class Xcls_HBox4 : Object
606 private Xcls_LeftProps _this;
612 public Xcls_HBox4(Xcls_LeftProps _owner )
615 this.el = new Gtk.HBox( true, 0 );
619 // set gobject values
620 var child_0 = new Xcls_Image5( _this );
622 this.el.add ( child_0.el );
623 var child_1 = new Xcls_Label6( _this );
625 this.el.add ( child_1.el );
628 // user defined functions
630 public class Xcls_Image5 : Object
633 private Xcls_LeftProps _this;
639 public Xcls_Image5(Xcls_LeftProps _owner )
642 this.el = new Gtk.Image();
646 // set gobject values
647 this.el.stock = Gtk.STOCK_ADD;
648 this.el.icon_size = Gtk.IconSize.MENU;
651 // user defined functions
653 public class Xcls_Label6 : Object
656 private Xcls_LeftProps _this;
662 public Xcls_Label6(Xcls_LeftProps _owner )
665 this.el = new Gtk.Label( "Other" );
669 // set gobject values
672 // user defined functions
674 public class Xcls_AddPropertyPopup : Object
677 private Xcls_LeftProps _this;
683 public Xcls_AddPropertyPopup(Xcls_LeftProps _owner )
686 _this.AddPropertyPopup = this;
687 this.el = new Gtk.Menu();
691 // set gobject values
692 var child_0 = new Xcls_MenuItem8( _this );
694 this.el.append ( child_0.el );
695 var child_1 = new Xcls_MenuItem9( _this );
697 this.el.append ( child_1.el );
698 var child_2 = new Xcls_MenuItem10( _this );
700 this.el.append ( child_2.el );
701 var child_3 = new Xcls_MenuItem11( _this );
703 this.el.append ( child_3.el );
704 var child_4 = new Xcls_SeparatorMenuItem12( _this );
706 this.el.add ( child_4.el );
707 var child_5 = new Xcls_MenuItem13( _this );
709 this.el.append ( child_5.el );
710 var child_6 = new Xcls_MenuItem14( _this );
712 this.el.append ( child_6.el );
713 var child_7 = new Xcls_MenuItem15( _this );
715 this.el.append ( child_7.el );
716 var child_8 = new Xcls_SeparatorMenuItem16( _this );
718 this.el.add ( child_8.el );
719 var child_9 = new Xcls_MenuItem17( _this );
721 this.el.append ( child_9.el );
722 var child_10 = new Xcls_MenuItem18( _this );
724 this.el.append ( child_10.el );
725 var child_11 = new Xcls_MenuItem19( _this );
727 this.el.append ( child_11.el );
728 var child_12 = new Xcls_SeparatorMenuItem20( _this );
730 this.el.add ( child_12.el );
731 var child_13 = new Xcls_MenuItem21( _this );
733 this.el.append ( child_13.el );
734 var child_14 = new Xcls_MenuItem22( _this );
736 this.el.append ( child_14.el );
737 var child_15 = new Xcls_MenuItem23( _this );
739 this.el.append ( child_15.el );
742 // user defined functions
744 public class Xcls_MenuItem8 : Object
746 public Gtk.MenuItem el;
747 private Xcls_LeftProps _this;
753 public Xcls_MenuItem8(Xcls_LeftProps _owner )
756 this.el = new Gtk.MenuItem();
760 // set gobject values
761 this.el.tooltip_markup = "Using _this.{ID} will map to this element";
762 this.el.label = "id: _this.{ID} (Vala)";
765 this.el.activate.connect( () => {
766 _this.addProp( "prop", "id", "", "");
770 // user defined functions
772 public class Xcls_MenuItem9 : Object
774 public Gtk.MenuItem el;
775 private Xcls_LeftProps _this;
781 public Xcls_MenuItem9(Xcls_LeftProps _owner )
784 this.el = new Gtk.MenuItem();
788 // set gobject values
789 this.el.tooltip_markup = "how to pack this element onto parent, (method, 2nd arg, 3rd arg) .. the 1st argument is filled by the element";
790 this.el.label = "pack: Pack method (Vala)";
793 this.el.activate.connect( ( ) => {
795 _this.addProp( "prop", "pack","add", "*");
799 // user defined functions
801 public class Xcls_MenuItem10 : Object
803 public Gtk.MenuItem el;
804 private Xcls_LeftProps _this;
810 public Xcls_MenuItem10(Xcls_LeftProps _owner )
813 this.el = new Gtk.MenuItem();
817 // set gobject values
818 this.el.tooltip_markup = "eg. \n\nnew Clutter.Image.from_file(.....)";
819 this.el.label = "ctor: Alterative to default contructor";
822 this.el.activate.connect( ( ) => {
824 _this.addProp( "prop", "ctor","", "*");
828 // user defined functions
830 public class Xcls_MenuItem11 : Object
832 public Gtk.MenuItem el;
833 private Xcls_LeftProps _this;
839 public Xcls_MenuItem11(Xcls_LeftProps _owner )
842 this.el = new Gtk.MenuItem();
846 // set gobject values
847 this.el.tooltip_markup = "This code is called after the ctor";
848 this.el.label = "init: initialziation code (vala)";
851 this.el.activate.connect( ( ) => {
853 _this.addProp( "prop", "init", "{\n\n}\n", "*" );
857 // user defined functions
859 public class Xcls_SeparatorMenuItem12 : Object
861 public Gtk.SeparatorMenuItem el;
862 private Xcls_LeftProps _this;
868 public Xcls_SeparatorMenuItem12(Xcls_LeftProps _owner )
871 this.el = new Gtk.SeparatorMenuItem();
875 // set gobject values
878 // user defined functions
880 public class Xcls_MenuItem13 : Object
882 public Gtk.MenuItem el;
883 private Xcls_LeftProps _this;
889 public Xcls_MenuItem13(Xcls_LeftProps _owner )
892 this.el = new Gtk.MenuItem();
896 // set gobject values
897 this.el.tooltip_markup = "Add a user defined string property";
898 this.el.label = "String";
901 this.el.activate.connect( (self) => {
903 _this.addProp( "prop", "XXXX", "","string");
908 // user defined functions
910 public class Xcls_MenuItem14 : Object
912 public Gtk.MenuItem el;
913 private Xcls_LeftProps _this;
919 public Xcls_MenuItem14(Xcls_LeftProps _owner )
922 this.el = new Gtk.MenuItem();
926 // set gobject values
927 this.el.tooltip_markup = "Add a user defined number property";
928 this.el.label = "Number";
931 this.el.activate.connect( ( ) =>{
933 _this.addProp("prop", "XXX", "0", "int");
937 // user defined functions
939 public class Xcls_MenuItem15 : Object
941 public Gtk.MenuItem el;
942 private Xcls_LeftProps _this;
948 public Xcls_MenuItem15(Xcls_LeftProps _owner )
951 this.el = new Gtk.MenuItem();
955 // set gobject values
956 this.el.tooltip_markup = "Add a user defined boolean property";
957 this.el.label = "Boolean";
960 this.el.activate.connect( ( ) =>{
962 _this.addProp( "prop", "XXX", "true", "bool");
966 // user defined functions
968 public class Xcls_SeparatorMenuItem16 : Object
970 public Gtk.SeparatorMenuItem el;
971 private Xcls_LeftProps _this;
977 public Xcls_SeparatorMenuItem16(Xcls_LeftProps _owner )
980 this.el = new Gtk.SeparatorMenuItem();
984 // set gobject values
987 // user defined functions
989 public class Xcls_MenuItem17 : Object
991 public Gtk.MenuItem el;
992 private Xcls_LeftProps _this;
998 public Xcls_MenuItem17(Xcls_LeftProps _owner )
1001 this.el = new Gtk.MenuItem();
1005 // set gobject values
1006 this.el.tooltip_markup = "Add a user function boolean property";
1007 this.el.label = "Javascript Function";
1010 this.el.activate.connect( ( ) =>{
1012 _this.addProp("prop", "XXXX", "function() { }", "| function");
1016 // user defined functions
1018 public class Xcls_MenuItem18 : Object
1020 public Gtk.MenuItem el;
1021 private Xcls_LeftProps _this;
1027 public Xcls_MenuItem18(Xcls_LeftProps _owner )
1030 this.el = new Gtk.MenuItem();
1034 // set gobject values
1035 this.el.tooltip_markup = "Add a user function boolean property";
1036 this.el.label = "Vala Method";
1039 this.el.activate.connect( ( ) =>{
1041 _this.addProp( "prop", "XXXX", "() {\n\n}\n", "| return_type");
1045 // user defined functions
1047 public class Xcls_MenuItem19 : Object
1049 public Gtk.MenuItem el;
1050 private Xcls_LeftProps _this;
1056 public Xcls_MenuItem19(Xcls_LeftProps _owner )
1059 this.el = new Gtk.MenuItem();
1063 // set gobject values
1064 this.el.tooltip_markup = "Add a vala signal";
1065 this.el.label = "Vala Signal";
1068 this.el.activate.connect( ( ) =>{
1070 _this.addProp( "prop", "XXXX", "()", "@ void");
1074 // user defined functions
1076 public class Xcls_SeparatorMenuItem20 : Object
1078 public Gtk.SeparatorMenuItem el;
1079 private Xcls_LeftProps _this;
1085 public Xcls_SeparatorMenuItem20(Xcls_LeftProps _owner )
1088 this.el = new Gtk.SeparatorMenuItem();
1092 // set gobject values
1095 // user defined functions
1097 public class Xcls_MenuItem21 : Object
1099 public Gtk.MenuItem el;
1100 private Xcls_LeftProps _this;
1106 public Xcls_MenuItem21(Xcls_LeftProps _owner )
1109 this.el = new Gtk.MenuItem();
1113 // set gobject values
1114 this.el.tooltip_markup = "Add a flexy if (for HTML templates)";
1115 this.el.label = "Flexy - If";
1118 this.el.activate.connect( ( ) =>{
1120 _this.addProp("prop", "flexy:if", "value_or_condition", "string");
1124 // user defined functions
1126 public class Xcls_MenuItem22 : Object
1128 public Gtk.MenuItem el;
1129 private Xcls_LeftProps _this;
1135 public Xcls_MenuItem22(Xcls_LeftProps _owner )
1138 this.el = new Gtk.MenuItem();
1142 // set gobject values
1143 this.el.tooltip_markup = "Add a flexy include (for HTML templates)";
1144 this.el.label = "Flexy - Include";
1147 this.el.activate.connect( ( ) =>{
1149 _this.addProp("prop", "flexy:include", "name_of_file.html", "string");
1153 // user defined functions
1155 public class Xcls_MenuItem23 : Object
1157 public Gtk.MenuItem el;
1158 private Xcls_LeftProps _this;
1164 public Xcls_MenuItem23(Xcls_LeftProps _owner )
1167 this.el = new Gtk.MenuItem();
1171 // set gobject values
1172 this.el.tooltip_markup = "Add a flexy foreach (for HTML templates)";
1173 this.el.label = "Flexy - Foreach";
1176 this.el.activate.connect( ( ) =>{
1178 _this.addProp("prop", "flexy:foreach", "array,key,value", "string");
1182 // user defined functions
1184 public class Xcls_EditProps : Object
1186 public Gtk.ScrolledWindow el;
1187 private Xcls_LeftProps _this;
1191 public bool editing;
1194 public Xcls_EditProps(Xcls_LeftProps _owner )
1197 _this.EditProps = this;
1198 this.el = new Gtk.ScrolledWindow( null, null );
1201 this.editing = false;
1203 // set gobject values
1204 this.el.shadow_type = Gtk.ShadowType.IN;
1205 var child_0 = new Xcls_view( _this );
1207 this.el.add ( child_0.el );
1213 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
1217 // user defined functions
1219 public class Xcls_view : Object
1221 public Gtk.TreeView el;
1222 private Xcls_LeftProps _this;
1228 public Xcls_view(Xcls_LeftProps _owner )
1232 this.el = new Gtk.TreeView();
1236 // set gobject values
1237 this.el.tooltip_column = 5;
1238 this.el.enable_tree_lines = true;
1239 this.el.headers_visible = true;
1240 var child_0 = new Xcls_model( _this );
1242 this.el.set_model ( child_0.el );
1243 var child_1 = new Xcls_keycol( _this );
1245 this.el.append_column ( child_1.el );
1246 var child_2 = new Xcls_valcol( _this );
1248 this.el.append_column ( child_2.el );
1249 var child_3 = new Xcls_ContextMenu( _this );
1255 var selection = this.el.get_selection();
1256 selection.set_mode( Gtk.SelectionMode.SINGLE);
1259 var description = new Pango.FontDescription();
1260 description.set_size(10000);
1261 this.el.modify_font(description);
1265 this.el.button_press_event.connect( ( ev) => {
1267 Gtk.TreeViewColumn col;
1271 if (!this.el.get_path_at_pos((int)ev.x, (int) ev.y, out path, out col, out cell_x, out cell_y )) {
1272 print("nothing selected on click");
1273 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
1274 this.el.get_selection().unselect_all();
1278 _this.before_edit();
1279 return false; //not on a element.
1284 if (ev.type == Gdk.EventType.2BUTTON_PRESS && ev.button == 1 && col.title == "Name") {
1288 _this.before_edit();
1290 _this.keyrender.el.stop_editing(false);
1291 _this.keyrender.el.editable =false;
1293 _this.valrender.el.stop_editing(false);
1294 _this.valrender.el.editable =false;
1296 _this.startEditingKey(path);
1305 if (ev.type == Gdk.EventType.BUTTON_PRESS && ev.button == 3) {
1307 //if (col.title == "Value") {
1308 // _this.before_edit();
1312 var p = _this.ContextMenu;
1314 p.el.set_screen(Gdk.Screen.get_default());
1316 p.el.popup(null, null, null, ev.button, ev.time);
1317 //Seed.print("click:" + res.column.title);
1319 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
1321 this.el.get_selection().select_path(path);
1324 _this.before_edit();
1329 if (col.title != "Value") {
1330 print("col title != Value");
1332 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
1333 this.el.get_selection().select_path(path);
1337 _this.before_edit();
1338 // XObject.error("column is not value?");
1339 return false; // ignore.. - key click.. ??? should we do this??
1343 // if the cell can be edited with a pulldown
1344 // then we should return true... - and let the start_editing handle it?
1351 // _this.before_edit(); <<< we really need to stop the other editor..
1352 _this.keyrender.el.stop_editing(false);
1353 _this.keyrender.el.editable =false;
1356 return _this.startEditingValue(path); // assumes selected row..
1365 // user defined functions
1367 public class Xcls_model : Object
1369 public Gtk.TreeStore el;
1370 private Xcls_LeftProps _this;
1376 public Xcls_model(Xcls_LeftProps _owner )
1380 this.el = new Gtk.TreeStore( 7, typeof(string), // 0 key type
1381 typeof(string), // 1 key
1382 typeof(string), // 2 key (display)
1383 typeof(string), // 3 value
1384 typeof(string), // 4 value (display)
1385 typeof(string), // 5 both (tooltip)
1386 typeof(string) // 6 key (for sorting)
1391 // set gobject values
1394 // user defined functions
1396 public class Xcls_keycol : Object
1398 public Gtk.TreeViewColumn el;
1399 private Xcls_LeftProps _this;
1405 public Xcls_keycol(Xcls_LeftProps _owner )
1408 _this.keycol = this;
1409 this.el = new Gtk.TreeViewColumn();
1413 // set gobject values
1414 this.el.title = "Name";
1415 this.el.resizable = true;
1416 var child_0 = new Xcls_keyrender( _this );
1418 this.el.pack_start ( child_0.el , false );
1422 this.el.add_attribute(_this.keyrender.el , "markup", 2 );
1423 this.el.add_attribute(_this.keyrender.el , "text", 1 );
1426 // user defined functions
1428 public class Xcls_keyrender : Object
1430 public Gtk.CellRendererText el;
1431 private Xcls_LeftProps _this;
1437 public Xcls_keyrender(Xcls_LeftProps _owner )
1440 _this.keyrender = this;
1441 this.el = new Gtk.CellRendererText();
1445 // set gobject values
1448 this.el.editing_started.connect( ( editable, path) => {
1451 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1456 // this.get('/LeftPanel.model').activePath = path;
1457 _this.model.el.get_value(iter,1, out gval);
1458 var val = (string)gval;
1460 ((Gtk.Entry)editable).set_text(val);
1462 this.el.edited.connect( (path, newtext) => {
1463 print("Keyrender - signal:edited\n");
1465 this.el.editable = false;
1470 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1473 _this.model.el.get_value(iter,1, out gval);
1474 var oldval = (string)gval;
1476 _this.model.el.get_value(iter,0, out gval);
1477 var ktype = (string)gval;
1479 _this.model.el.set_value(iter, 1, newtext);
1481 if (oldval == newtext) {
1486 print("ktype: %s\n",ktype);
1489 var ov = _this.node.listeners.get(oldval);
1490 _this.node.listeners.set(newtext, ov);
1491 _this.node.listeners.remove(oldval);
1493 _this.updateIter(iter, ktype, newtext, ov);
1497 var ov = _this.node.props.get(oldval);
1498 _this.node.props.set(newtext, ov);
1499 _this.node.props.remove(oldval);
1500 _this.updateIter(iter, ktype, newtext, ov);
1508 // user defined functions
1510 public class Xcls_valcol : Object
1512 public Gtk.TreeViewColumn el;
1513 private Xcls_LeftProps _this;
1519 public Xcls_valcol(Xcls_LeftProps _owner )
1522 _this.valcol = this;
1523 this.el = new Gtk.TreeViewColumn();
1527 // set gobject values
1528 this.el.title = "Value";
1529 this.el.resizable = true;
1530 var child_0 = new Xcls_valrender( _this );
1532 this.el.pack_start ( child_0.el , true );
1538 // typeof(string), // 0 key type
1539 // typeof(string), // 1 key
1540 // typeof(string), // 2 key (display)
1541 // typeof(string), // 3 value
1542 // typeof(string) // 4 value (display)
1545 this.el.add_attribute(_this.valrender.el , "text", 4 );
1546 //this.el.add_attribute(_this.valrender.el , "sensitive", 4 );
1547 //this.el.add_attribute(this.items[0].el , 'editable', 3 );
1548 // this.el.set_cell_data_func(cell, age_cell_data_func, NULL, NULL);
1550 // this.get('/LeftPanel').editableColumn= this;
1554 // user defined functions
1556 public class Xcls_valrender : Object
1558 public Gtk.CellRendererCombo el;
1559 private Xcls_LeftProps _this;
1565 public Xcls_valrender(Xcls_LeftProps _owner )
1568 _this.valrender = this;
1569 this.el = new Gtk.CellRendererCombo();
1573 // set gobject values
1574 this.el.editable = false;
1575 this.el.text_column = 0;
1576 this.el.has_entry = true;
1577 var child_0 = new Xcls_valrendermodel( _this );
1579 this.el.model = child_0.el;
1582 this.el.editing_started.connect( ( editable, path) => {
1583 //_this.editing = true;
1584 print("editing started called\n");
1585 if (!_this.allow_edit) {
1587 print("val - editing_Started\n");
1588 this.el.editable = false; // make sure it's not editor...
1593 _this.allow_edit =false;
1596 if ( this.el.has_entry ) {
1599 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1604 // this.get('/LeftPanel.model').activePath = path;
1605 _this.model.el.get_value(iter,3, out gval);
1608 var val = (string)gval;
1609 var combo = (Gtk.ComboBox)editable;
1611 var entry = (Gtk.Entry) combo.get_child();
1612 entry.set_text(val);
1616 this.el.edited.connect( (path, newtext) => {
1617 print("Valrender - signal:edited\n");
1619 this.el.editable = false;
1624 2, "<b>" + miter.get_key() + "</b>",
1625 3, miter.get_value(),
1626 4, display_value(short);
1632 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1635 _this.model.el.get_value(iter,0, out gval);
1636 var ktype = (string)gval;
1639 _this.model.el.get_value(iter,3, out gval);
1640 var oldval = (string)gval;
1642 _this.model.el.get_value(iter,1, out gval);
1643 var key = (string)gval;
1649 _this.node.listeners.set(key, newtext);
1650 _this.updateIter(iter,ktype,key,newtext);
1653 _this.node.props.set(key,newtext);
1654 _this.updateIter(iter,ktype, key,newtext);
1657 // _this.load(_this.file,_this.node);
1663 // user defined functions
1664 public void setOptions (string[] ar) {
1665 var m = _this.valrendermodel.el;
1668 for (var i =0; i < ar.length; i++) {
1670 m.set_value(iret, 0, ar[i]);
1675 public class Xcls_valrendermodel : Object
1677 public Gtk.ListStore el;
1678 private Xcls_LeftProps _this;
1684 public Xcls_valrendermodel(Xcls_LeftProps _owner )
1687 _this.valrendermodel = this;
1688 this.el = new Gtk.ListStore( 1, typeof(string) );
1692 // set gobject values
1695 // user defined functions
1697 public class Xcls_ContextMenu : Object
1700 private Xcls_LeftProps _this;
1706 public Xcls_ContextMenu(Xcls_LeftProps _owner )
1709 _this.ContextMenu = this;
1710 this.el = new Gtk.Menu();
1714 // set gobject values
1715 var child_0 = new Xcls_MenuItem33( _this );
1717 this.el.append ( child_0.el );
1718 var child_1 = new Xcls_SeparatorMenuItem34( _this );
1720 this.el.append ( child_1.el );
1721 var child_2 = new Xcls_MenuItem35( _this );
1723 this.el.append ( child_2.el );
1726 // user defined functions
1728 public class Xcls_MenuItem33 : Object
1730 public Gtk.MenuItem el;
1731 private Xcls_LeftProps _this;
1737 public Xcls_MenuItem33(Xcls_LeftProps _owner )
1740 this.el = new Gtk.MenuItem();
1744 // set gobject values
1745 this.el.label = "Edit";
1748 this.el.activate.connect( ( ) =>{
1750 var s = _this.view.el.get_selection();
1752 Gtk.TreeModel model;
1753 s.get_selected (out model, out iter);
1754 _this.startEditingKey(model.get_path(iter));
1758 // user defined functions
1760 public class Xcls_SeparatorMenuItem34 : Object
1762 public Gtk.SeparatorMenuItem el;
1763 private Xcls_LeftProps _this;
1769 public Xcls_SeparatorMenuItem34(Xcls_LeftProps _owner )
1772 this.el = new Gtk.SeparatorMenuItem();
1776 // set gobject values
1779 // user defined functions
1781 public class Xcls_MenuItem35 : Object
1783 public Gtk.MenuItem el;
1784 private Xcls_LeftProps _this;
1790 public Xcls_MenuItem35(Xcls_LeftProps _owner )
1793 this.el = new Gtk.MenuItem();
1797 // set gobject values
1798 this.el.label = "Delete";
1801 this.el.activate.connect( ( ) =>{
1802 _this.deleteSelected();
1806 // user defined functions