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(" ");
136 string kname, kflag, ktype;
137 this.node.normalize_key(key, out kname, out kflag, out ktype);
140 mod.get_value(iter, 0 , out gval);
141 var type = (string)gval; // listerner or prop..
145 var use_textarea = false;
147 //------------ things that require the text editor...
149 if (type == "listener") {
152 if (key.length > 0 && key[0] == '|') { // user defined method
155 if (key.length > 0 && key[0] == '$') { // raw string
158 if (key.length > 0 && key == "* init") {
161 if (val.length > 40) { // long value...
168 print("Call show editor\n");
169 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
170 this.view.el.get_selection().select_path(path);
172 this.show_editor(file, node, type, key);
181 var pal = Palete.factory(this.file.project.xtype);
184 var has_opts = pal.typeOptions(this.node.fqn(), kname, ktype, out opts);
188 // others... - fill in options for true/false?
189 print("turn on editing %s \n" , mod.get_path(iter).to_string());
193 print("start editing try/false)???");
194 this.valrender.el.has_entry = false;
196 this.valrender.setOptions(opts);
198 this.valrender.el.has_entry = false;
199 this.valrender.el.editable = true;
200 this.allow_edit = true;
201 GLib.Timeout.add_full(GLib.Priority.DEFAULT,100 , () => {
202 this.view.el.set_cursor_on_cell(
213 // see if type is a Enum.
220 this.valrender.setOptions(opts);
222 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
224 // at this point - work out the type...
225 // if its' a combo... then show the options..
226 this.valrender.el.has_entry = true;
228 this.valrender.el.editable = true;
231 this.allow_edit = true;
237 this.view.el.set_cursor_on_cell(
247 public void load (JsRender.JsRender file, JsRender.Node? node)
249 print("load leftprops\n");
255 this.model.el.clear();
257 //this.get('/RightEditor').el.hide();
264 //var provider = this.get('/LeftTree').getPaleteProvider();
267 //typeof(string), // 0 key type
268 //typeof(string), // 1 key
269 //typeof(string), // 2 key (display)
270 //typeof(string), // 3 value
271 //typeof(string), // 4 value (display)
272 //typeof(string), // 5 both (tooltip)
277 // really need a way to sort the hashmap...
278 var m = this.model.el;
280 var miter = node.listeners.map_iterator();
283 while(miter.next()) {
285 m.append(out iter,null);
287 this.updateIter(iter, "listener", miter.get_key(), miter.get_value());
293 miter = node.props.map_iterator();
296 while(miter.next()) {
298 m.append(out iter,null);
299 this.updateIter(iter, "prop", miter.get_key(), miter.get_value());
302 print("clear selection\n");
304 this.model.el.set_sort_column_id(6,Gtk.SortType.ASCENDING); // sort by real key..
306 this.view.el.get_selection().unselect_all();
308 var pane = _this.main_window.editpane.el;
309 var try_size = (i * 25) + 60; // est. 20px per line + 40px header
313 ((try_size * 1.0f) / (pane.max_position * 1.0f)) > 0.8f ?
314 (int) (pane.max_position * 0.2f) :
315 pane.max_position-try_size);
319 public string keyFormat (string val, string type) {
321 // Glib.markup_escape_text(val);
323 if (type == "listener") {
324 return "<span font_weight=\"bold\" color=\"#660000\">" +
325 GLib.Markup.escape_text(val) +
329 if (val.length < 1) {
330 return "<span color=\"#FF0000\">--empty--</span>";
335 //# - object properties
337 // all of these... - display value is last element..
338 var ar = val.strip().split(" ");
341 var dval = GLib.Markup.escape_text(ar[ar.length-1]);
347 case '@': // signal // just bold balck?
348 if (dval[0] == '@') {
349 dval = dval.substring(1);
352 return @"<span font_weight=\"bold\">@ $dval</span>";
353 case '#': // object properties?
354 if (dval[0] == '#') {
355 dval = dval.substring(1);
357 return @"<span font_weight=\"bold\">$dval</span>";
359 if (dval[0] == '*') {
360 dval = dval.substring(1);
362 return @"<span color=\"#0000CC\" font_weight=\"bold\">$dval</span>";
364 if (dval[0] == '$') {
365 dval = dval.substring(1);
367 return @"<span style=\"italic\">$dval</span>";
368 case '|': // user defined methods
369 if (dval[0] == '|') {
370 dval = dval.substring(1);
372 return @"<span color=\"#008000\" font_weight=\"bold\">$dval</span>";
383 public void deleteSelected () {
388 var s = this.view.el.get_selection();
389 s.get_selected(out mod, out iter);
393 mod.get_value(iter, 0 , out gval);
394 var type = (string)gval;
396 mod.get_value(iter, 1 , out gval);
397 var key = (string)gval;
401 this.node.listeners.remove(key);
405 this.node.props.remove(key);
408 this.load(this.file, this.node);
412 public void startEditingKey ( Gtk.TreePath path) {
414 if (!this.stop_editor()) {
418 // others... - fill in options for true/false?
421 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
422 this.allow_edit = true;
423 this.keyrender.el.editable = true;
425 this.view.el.set_cursor_on_cell(
437 public void addProp (string in_type, string key, string value, string value_type) {
438 // info includes key, val, skel, etype..
439 //console.dump(info);
440 //type = info.type.toLowerCase();
441 //var data = this.toJS();
443 var type = in_type == "signals" ? "listener" : in_type;
445 var fkey = (value_type.length > 0 ? value_type + " " : "") + key;
447 if (type == "listener") {
448 if (this.node.listeners.has_key(key)) {
451 this.node.listeners.set(key,value);
454 if (this.node.props.has_key(fkey)) {
457 this.node.props.set(fkey,value);
462 this.load(this.file, this.node);
466 /// need to find the row which I've just added..
469 var s = this.view.el.get_selection();
472 print("trying to find new iter");
474 this.model.el.foreach((model, path, iter) => {
477 this.model.el.get_value(iter, 0 , out gval);
478 if ((string)gval != type) {
479 print("not type: %s = %s\n", (string)gval , type);
482 this.model.el.get_value(iter, 1 , out gval);
483 if ((string)gval != fkey) {
484 print("not key: %s = %s\n", (string)gval , fkey);
488 GLib.Timeout.add_full(GLib.Priority.DEFAULT,40 , () => {
490 this.startEditingValue(this.model.el.get_path(iter));
493 //s.select_iter(iter);
501 public void updateIter (Gtk.TreeIter iter, string type, string key, string value) {
503 print("update Iter %s, %s\n", key,value);
504 //typeof(string), // 0 key type
505 //typeof(string), // 1 key
506 //typeof(string), // 2 key (display)
507 //typeof(string), // 3 value
508 //typeof(string), // 4 value (display)
509 //typeof(string), // 5 both (tooltip)
510 //typeof(string), // 6 key (sort)
512 var dl = value.strip().split("\n");
514 var dis_val = dl.length > 1 ? (dl[0].strip()+ "...") : dl[0];
516 if (type == "listener") {
520 this.model.el.set(iter,
523 2, this.keyFormat(key ,type),
526 5, "<tt>" + GLib.Markup.escape_text(key + " " +value) + "</tt>",
534 this.model.el.set(iter,
537 2, this.keyFormat(key , "prop"),
540 5, "<tt>" + GLib.Markup.escape_text(key + " " + value) + "</tt>",
541 6, this.keySortFormat(key)
544 public class Xcls_HBox2 : Object
547 private Xcls_LeftProps _this;
553 public Xcls_HBox2(Xcls_LeftProps _owner )
556 this.el = new Gtk.HBox( true, 0 );
560 // set gobject values
561 var child_0 = new Xcls_Button3( _this );
563 this.el.add ( child_0.el );
566 // user defined functions
568 public class Xcls_Button3 : Object
570 public Gtk.Button el;
571 private Xcls_LeftProps _this;
577 public Xcls_Button3(Xcls_LeftProps _owner )
580 this.el = new Gtk.Button();
584 // set gobject values
585 var child_0 = new Xcls_Box4( _this );
587 this.el.add ( child_0.el );
588 var child_1 = new Xcls_AddPropertyPopup( _this );
592 this.el.button_press_event.connect( (self, ev) => {
596 var p = _this.AddPropertyPopup;
597 p.el.set_screen(Gdk.Screen.get_default());
599 p.el.popup(null, null, null, ev.button, ev.time);
604 // user defined functions
606 public class Xcls_Box4 : Object
609 private Xcls_LeftProps _this;
615 public Xcls_Box4(Xcls_LeftProps _owner )
618 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
622 // set gobject values
623 var child_0 = new Xcls_Image5( _this );
625 this.el.add ( child_0.el );
626 var child_1 = new Xcls_Label6( _this );
628 this.el.add ( child_1.el );
631 // user defined functions
633 public class Xcls_Image5 : Object
636 private Xcls_LeftProps _this;
642 public Xcls_Image5(Xcls_LeftProps _owner )
645 this.el = new Gtk.Image();
649 // set gobject values
650 this.el.stock = Gtk.STOCK_ADD;
651 this.el.icon_size = Gtk.IconSize.MENU;
654 // user defined functions
656 public class Xcls_Label6 : Object
659 private Xcls_LeftProps _this;
665 public Xcls_Label6(Xcls_LeftProps _owner )
668 this.el = new Gtk.Label( "Other" );
672 // set gobject values
675 // user defined functions
677 public class Xcls_AddPropertyPopup : Object
680 private Xcls_LeftProps _this;
686 public Xcls_AddPropertyPopup(Xcls_LeftProps _owner )
689 _this.AddPropertyPopup = this;
690 this.el = new Gtk.Menu();
694 // set gobject values
695 var child_0 = new Xcls_MenuItem8( _this );
697 this.el.append ( child_0.el );
698 var child_1 = new Xcls_MenuItem9( _this );
700 this.el.append ( child_1.el );
701 var child_2 = new Xcls_MenuItem10( _this );
703 this.el.append ( child_2.el );
704 var child_3 = new Xcls_MenuItem11( _this );
706 this.el.append ( child_3.el );
707 var child_4 = new Xcls_SeparatorMenuItem12( _this );
709 this.el.add ( child_4.el );
710 var child_5 = new Xcls_MenuItem13( _this );
712 this.el.append ( child_5.el );
713 var child_6 = new Xcls_MenuItem14( _this );
715 this.el.append ( child_6.el );
716 var child_7 = new Xcls_MenuItem15( _this );
718 this.el.append ( child_7.el );
719 var child_8 = new Xcls_SeparatorMenuItem16( _this );
721 this.el.add ( child_8.el );
722 var child_9 = new Xcls_MenuItem17( _this );
724 this.el.append ( child_9.el );
725 var child_10 = new Xcls_MenuItem18( _this );
727 this.el.append ( child_10.el );
728 var child_11 = new Xcls_MenuItem19( _this );
730 this.el.append ( child_11.el );
731 var child_12 = new Xcls_SeparatorMenuItem20( _this );
733 this.el.add ( child_12.el );
734 var child_13 = new Xcls_MenuItem21( _this );
736 this.el.append ( child_13.el );
737 var child_14 = new Xcls_MenuItem22( _this );
739 this.el.append ( child_14.el );
740 var child_15 = new Xcls_MenuItem23( _this );
742 this.el.append ( child_15.el );
745 // user defined functions
747 public class Xcls_MenuItem8 : Object
749 public Gtk.MenuItem el;
750 private Xcls_LeftProps _this;
756 public Xcls_MenuItem8(Xcls_LeftProps _owner )
759 this.el = new Gtk.MenuItem();
763 // set gobject values
764 this.el.tooltip_markup = "Using _this.{ID} will map to this element";
765 this.el.label = "id: _this.{ID} (Vala)";
768 this.el.activate.connect( () => {
769 _this.addProp( "prop", "id", "", "");
773 // user defined functions
775 public class Xcls_MenuItem9 : Object
777 public Gtk.MenuItem el;
778 private Xcls_LeftProps _this;
784 public Xcls_MenuItem9(Xcls_LeftProps _owner )
787 this.el = new Gtk.MenuItem();
791 // set gobject values
792 this.el.tooltip_markup = "how to pack this element onto parent, (method, 2nd arg, 3rd arg) .. the 1st argument is filled by the element";
793 this.el.label = "pack: Pack method (Vala)";
796 this.el.activate.connect( ( ) => {
798 _this.addProp( "prop", "pack","add", "*");
802 // user defined functions
804 public class Xcls_MenuItem10 : Object
806 public Gtk.MenuItem el;
807 private Xcls_LeftProps _this;
813 public Xcls_MenuItem10(Xcls_LeftProps _owner )
816 this.el = new Gtk.MenuItem();
820 // set gobject values
821 this.el.tooltip_markup = "eg. \n\nnew Clutter.Image.from_file(.....)";
822 this.el.label = "ctor: Alterative to default contructor";
825 this.el.activate.connect( ( ) => {
827 _this.addProp( "prop", "ctor","", "*");
831 // user defined functions
833 public class Xcls_MenuItem11 : Object
835 public Gtk.MenuItem el;
836 private Xcls_LeftProps _this;
842 public Xcls_MenuItem11(Xcls_LeftProps _owner )
845 this.el = new Gtk.MenuItem();
849 // set gobject values
850 this.el.tooltip_markup = "This code is called after the ctor";
851 this.el.label = "init: initialziation code (vala)";
854 this.el.activate.connect( ( ) => {
856 _this.addProp( "prop", "init", "{\n\n}\n", "*" );
860 // user defined functions
862 public class Xcls_SeparatorMenuItem12 : Object
864 public Gtk.SeparatorMenuItem el;
865 private Xcls_LeftProps _this;
871 public Xcls_SeparatorMenuItem12(Xcls_LeftProps _owner )
874 this.el = new Gtk.SeparatorMenuItem();
878 // set gobject values
881 // user defined functions
883 public class Xcls_MenuItem13 : Object
885 public Gtk.MenuItem el;
886 private Xcls_LeftProps _this;
892 public Xcls_MenuItem13(Xcls_LeftProps _owner )
895 this.el = new Gtk.MenuItem();
899 // set gobject values
900 this.el.tooltip_markup = "Add a user defined string property";
901 this.el.label = "String";
904 this.el.activate.connect( (self) => {
906 _this.addProp( "prop", "XXXX", "","string");
911 // user defined functions
913 public class Xcls_MenuItem14 : Object
915 public Gtk.MenuItem el;
916 private Xcls_LeftProps _this;
922 public Xcls_MenuItem14(Xcls_LeftProps _owner )
925 this.el = new Gtk.MenuItem();
929 // set gobject values
930 this.el.tooltip_markup = "Add a user defined number property";
931 this.el.label = "Number";
934 this.el.activate.connect( ( ) =>{
936 _this.addProp("prop", "XXX", "0", "int");
940 // user defined functions
942 public class Xcls_MenuItem15 : Object
944 public Gtk.MenuItem el;
945 private Xcls_LeftProps _this;
951 public Xcls_MenuItem15(Xcls_LeftProps _owner )
954 this.el = new Gtk.MenuItem();
958 // set gobject values
959 this.el.tooltip_markup = "Add a user defined boolean property";
960 this.el.label = "Boolean";
963 this.el.activate.connect( ( ) =>{
965 _this.addProp( "prop", "XXX", "true", "bool");
969 // user defined functions
971 public class Xcls_SeparatorMenuItem16 : Object
973 public Gtk.SeparatorMenuItem el;
974 private Xcls_LeftProps _this;
980 public Xcls_SeparatorMenuItem16(Xcls_LeftProps _owner )
983 this.el = new Gtk.SeparatorMenuItem();
987 // set gobject values
990 // user defined functions
992 public class Xcls_MenuItem17 : Object
994 public Gtk.MenuItem el;
995 private Xcls_LeftProps _this;
1001 public Xcls_MenuItem17(Xcls_LeftProps _owner )
1004 this.el = new Gtk.MenuItem();
1008 // set gobject values
1009 this.el.tooltip_markup = "Add a user function boolean property";
1010 this.el.label = "Javascript Function";
1013 this.el.activate.connect( ( ) =>{
1015 _this.addProp("prop", "XXXX", "function() { }", "| function");
1019 // user defined functions
1021 public class Xcls_MenuItem18 : Object
1023 public Gtk.MenuItem el;
1024 private Xcls_LeftProps _this;
1030 public Xcls_MenuItem18(Xcls_LeftProps _owner )
1033 this.el = new Gtk.MenuItem();
1037 // set gobject values
1038 this.el.tooltip_markup = "Add a user function boolean property";
1039 this.el.label = "Vala Method";
1042 this.el.activate.connect( ( ) =>{
1044 _this.addProp( "prop", "XXXX", "() {\n\n}\n", "| return_type");
1048 // user defined functions
1050 public class Xcls_MenuItem19 : Object
1052 public Gtk.MenuItem el;
1053 private Xcls_LeftProps _this;
1059 public Xcls_MenuItem19(Xcls_LeftProps _owner )
1062 this.el = new Gtk.MenuItem();
1066 // set gobject values
1067 this.el.tooltip_markup = "Add a vala signal";
1068 this.el.label = "Vala Signal";
1071 this.el.activate.connect( ( ) =>{
1073 _this.addProp( "prop", "XXXX", "()", "@ void");
1077 // user defined functions
1079 public class Xcls_SeparatorMenuItem20 : Object
1081 public Gtk.SeparatorMenuItem el;
1082 private Xcls_LeftProps _this;
1088 public Xcls_SeparatorMenuItem20(Xcls_LeftProps _owner )
1091 this.el = new Gtk.SeparatorMenuItem();
1095 // set gobject values
1098 // user defined functions
1100 public class Xcls_MenuItem21 : Object
1102 public Gtk.MenuItem el;
1103 private Xcls_LeftProps _this;
1109 public Xcls_MenuItem21(Xcls_LeftProps _owner )
1112 this.el = new Gtk.MenuItem();
1116 // set gobject values
1117 this.el.tooltip_markup = "Add a flexy if (for HTML templates)";
1118 this.el.label = "Flexy - If";
1121 this.el.activate.connect( ( ) =>{
1123 _this.addProp("prop", "flexy:if", "value_or_condition", "string");
1127 // user defined functions
1129 public class Xcls_MenuItem22 : Object
1131 public Gtk.MenuItem el;
1132 private Xcls_LeftProps _this;
1138 public Xcls_MenuItem22(Xcls_LeftProps _owner )
1141 this.el = new Gtk.MenuItem();
1145 // set gobject values
1146 this.el.tooltip_markup = "Add a flexy include (for HTML templates)";
1147 this.el.label = "Flexy - Include";
1150 this.el.activate.connect( ( ) =>{
1152 _this.addProp("prop", "flexy:include", "name_of_file.html", "string");
1156 // user defined functions
1158 public class Xcls_MenuItem23 : Object
1160 public Gtk.MenuItem el;
1161 private Xcls_LeftProps _this;
1167 public Xcls_MenuItem23(Xcls_LeftProps _owner )
1170 this.el = new Gtk.MenuItem();
1174 // set gobject values
1175 this.el.tooltip_markup = "Add a flexy foreach (for HTML templates)";
1176 this.el.label = "Flexy - Foreach";
1179 this.el.activate.connect( ( ) =>{
1181 _this.addProp("prop", "flexy:foreach", "array,key,value", "string");
1185 // user defined functions
1187 public class Xcls_EditProps : Object
1189 public Gtk.ScrolledWindow el;
1190 private Xcls_LeftProps _this;
1194 public bool editing;
1197 public Xcls_EditProps(Xcls_LeftProps _owner )
1200 _this.EditProps = this;
1201 this.el = new Gtk.ScrolledWindow( null, null );
1204 this.editing = false;
1206 // set gobject values
1207 this.el.shadow_type = Gtk.ShadowType.IN;
1208 var child_0 = new Xcls_view( _this );
1210 this.el.add ( child_0.el );
1216 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
1220 // user defined functions
1222 public class Xcls_view : Object
1224 public Gtk.TreeView el;
1225 private Xcls_LeftProps _this;
1231 public Xcls_view(Xcls_LeftProps _owner )
1235 this.el = new Gtk.TreeView();
1239 // set gobject values
1240 this.el.tooltip_column = 5;
1241 this.el.enable_tree_lines = true;
1242 this.el.headers_visible = true;
1243 var child_0 = new Xcls_model( _this );
1245 this.el.set_model ( child_0.el );
1246 var child_1 = new Xcls_keycol( _this );
1248 this.el.append_column ( child_1.el );
1249 var child_2 = new Xcls_valcol( _this );
1251 this.el.append_column ( child_2.el );
1252 var child_3 = new Xcls_ContextMenu( _this );
1258 var selection = this.el.get_selection();
1259 selection.set_mode( Gtk.SelectionMode.SINGLE);
1262 var description = new Pango.FontDescription();
1263 description.set_size(10000);
1264 this.el.modify_font(description);
1268 this.el.button_press_event.connect( ( ev) => {
1270 Gtk.TreeViewColumn col;
1274 if (!this.el.get_path_at_pos((int)ev.x, (int) ev.y, out path, out col, out cell_x, out cell_y )) {
1275 print("nothing selected on click");
1276 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
1277 this.el.get_selection().unselect_all();
1281 _this.before_edit();
1282 return false; //not on a element.
1287 if (ev.type == Gdk.EventType.2BUTTON_PRESS && ev.button == 1 && col.title == "Name") {
1291 _this.before_edit();
1293 _this.keyrender.el.stop_editing(false);
1294 _this.keyrender.el.editable =false;
1296 _this.valrender.el.stop_editing(false);
1297 _this.valrender.el.editable =false;
1299 _this.startEditingKey(path);
1308 if (ev.type == Gdk.EventType.BUTTON_PRESS && ev.button == 3) {
1310 //if (col.title == "Value") {
1311 // _this.before_edit();
1315 var p = _this.ContextMenu;
1317 p.el.set_screen(Gdk.Screen.get_default());
1319 p.el.popup(null, null, null, ev.button, ev.time);
1320 //Seed.print("click:" + res.column.title);
1322 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
1324 this.el.get_selection().select_path(path);
1327 _this.before_edit();
1332 if (col.title != "Value") {
1333 print("col title != Value");
1335 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
1336 this.el.get_selection().select_path(path);
1340 _this.before_edit();
1341 // XObject.error("column is not value?");
1342 return false; // ignore.. - key click.. ??? should we do this??
1346 // if the cell can be edited with a pulldown
1347 // then we should return true... - and let the start_editing handle it?
1354 // _this.before_edit(); <<< we really need to stop the other editor..
1355 _this.keyrender.el.stop_editing(false);
1356 _this.keyrender.el.editable =false;
1359 return _this.startEditingValue(path); // assumes selected row..
1368 // user defined functions
1370 public class Xcls_model : Object
1372 public Gtk.TreeStore el;
1373 private Xcls_LeftProps _this;
1379 public Xcls_model(Xcls_LeftProps _owner )
1383 this.el = new Gtk.TreeStore( 7, typeof(string), // 0 key type
1384 typeof(string), // 1 key
1385 typeof(string), // 2 key (display)
1386 typeof(string), // 3 value
1387 typeof(string), // 4 value (display)
1388 typeof(string), // 5 both (tooltip)
1389 typeof(string) // 6 key (for sorting)
1394 // set gobject values
1397 // user defined functions
1399 public class Xcls_keycol : Object
1401 public Gtk.TreeViewColumn el;
1402 private Xcls_LeftProps _this;
1408 public Xcls_keycol(Xcls_LeftProps _owner )
1411 _this.keycol = this;
1412 this.el = new Gtk.TreeViewColumn();
1416 // set gobject values
1417 this.el.title = "Name";
1418 this.el.resizable = true;
1419 var child_0 = new Xcls_keyrender( _this );
1421 this.el.pack_start ( child_0.el , false );
1425 this.el.add_attribute(_this.keyrender.el , "markup", 2 );
1426 this.el.add_attribute(_this.keyrender.el , "text", 1 );
1429 // user defined functions
1431 public class Xcls_keyrender : Object
1433 public Gtk.CellRendererText el;
1434 private Xcls_LeftProps _this;
1440 public Xcls_keyrender(Xcls_LeftProps _owner )
1443 _this.keyrender = this;
1444 this.el = new Gtk.CellRendererText();
1448 // set gobject values
1451 this.el.editing_started.connect( ( editable, path) => {
1454 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1459 // this.get('/LeftPanel.model').activePath = path;
1460 _this.model.el.get_value(iter,1, out gval);
1461 var val = (string)gval;
1463 ((Gtk.Entry)editable).set_text(val);
1465 this.el.edited.connect( (path, newtext) => {
1466 print("Keyrender - signal:edited\n");
1468 this.el.editable = false;
1473 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1476 _this.model.el.get_value(iter,1, out gval);
1477 var oldval = (string)gval;
1479 _this.model.el.get_value(iter,0, out gval);
1480 var ktype = (string)gval;
1482 _this.model.el.set_value(iter, 1, newtext);
1484 if (oldval == newtext) {
1489 print("ktype: %s\n",ktype);
1492 var ov = _this.node.listeners.get(oldval);
1493 _this.node.listeners.set(newtext, ov);
1494 _this.node.listeners.remove(oldval);
1496 _this.updateIter(iter, ktype, newtext, ov);
1500 var ov = _this.node.props.get(oldval);
1501 _this.node.props.set(newtext, ov);
1502 _this.node.props.remove(oldval);
1503 _this.updateIter(iter, ktype, newtext, ov);
1511 // user defined functions
1513 public class Xcls_valcol : Object
1515 public Gtk.TreeViewColumn el;
1516 private Xcls_LeftProps _this;
1522 public Xcls_valcol(Xcls_LeftProps _owner )
1525 _this.valcol = this;
1526 this.el = new Gtk.TreeViewColumn();
1530 // set gobject values
1531 this.el.title = "Value";
1532 this.el.resizable = true;
1533 var child_0 = new Xcls_valrender( _this );
1535 this.el.pack_start ( child_0.el , true );
1541 // typeof(string), // 0 key type
1542 // typeof(string), // 1 key
1543 // typeof(string), // 2 key (display)
1544 // typeof(string), // 3 value
1545 // typeof(string) // 4 value (display)
1548 this.el.add_attribute(_this.valrender.el , "text", 4 );
1549 //this.el.add_attribute(_this.valrender.el , "sensitive", 4 );
1550 //this.el.add_attribute(this.items[0].el , 'editable', 3 );
1551 // this.el.set_cell_data_func(cell, age_cell_data_func, NULL, NULL);
1553 // this.get('/LeftPanel').editableColumn= this;
1557 // user defined functions
1559 public class Xcls_valrender : Object
1561 public Gtk.CellRendererCombo el;
1562 private Xcls_LeftProps _this;
1568 public Xcls_valrender(Xcls_LeftProps _owner )
1571 _this.valrender = this;
1572 this.el = new Gtk.CellRendererCombo();
1576 // set gobject values
1577 this.el.editable = false;
1578 this.el.text_column = 0;
1579 this.el.has_entry = true;
1580 var child_0 = new Xcls_valrendermodel( _this );
1582 this.el.model = child_0.el;
1585 this.el.editing_started.connect( ( editable, path) => {
1586 //_this.editing = true;
1587 print("editing started called\n");
1588 if (!_this.allow_edit) {
1590 print("val - editing_Started\n");
1591 this.el.editable = false; // make sure it's not editor...
1596 _this.allow_edit =false;
1599 if ( this.el.has_entry ) {
1602 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1607 // this.get('/LeftPanel.model').activePath = path;
1608 _this.model.el.get_value(iter,3, out gval);
1611 var val = (string)gval;
1612 var combo = (Gtk.ComboBox)editable;
1614 var entry = (Gtk.Entry) combo.get_child();
1615 entry.set_text(val);
1619 this.el.edited.connect( (path, newtext) => {
1620 print("Valrender - signal:edited\n");
1622 this.el.editable = false;
1627 2, "<b>" + miter.get_key() + "</b>",
1628 3, miter.get_value(),
1629 4, display_value(short);
1635 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1638 _this.model.el.get_value(iter,0, out gval);
1639 var ktype = (string)gval;
1642 _this.model.el.get_value(iter,3, out gval);
1643 var oldval = (string)gval;
1645 _this.model.el.get_value(iter,1, out gval);
1646 var key = (string)gval;
1652 _this.node.listeners.set(key, newtext);
1653 _this.updateIter(iter,ktype,key,newtext);
1656 _this.node.props.set(key,newtext);
1657 _this.updateIter(iter,ktype, key,newtext);
1660 // _this.load(_this.file,_this.node);
1666 // user defined functions
1667 public void setOptions (string[] ar) {
1668 var m = _this.valrendermodel.el;
1671 for (var i =0; i < ar.length; i++) {
1673 m.set_value(iret, 0, ar[i]);
1678 public class Xcls_valrendermodel : Object
1680 public Gtk.ListStore el;
1681 private Xcls_LeftProps _this;
1687 public Xcls_valrendermodel(Xcls_LeftProps _owner )
1690 _this.valrendermodel = this;
1691 this.el = new Gtk.ListStore( 1, typeof(string) );
1695 // set gobject values
1698 // user defined functions
1700 public class Xcls_ContextMenu : Object
1703 private Xcls_LeftProps _this;
1709 public Xcls_ContextMenu(Xcls_LeftProps _owner )
1712 _this.ContextMenu = this;
1713 this.el = new Gtk.Menu();
1717 // set gobject values
1718 var child_0 = new Xcls_MenuItem33( _this );
1720 this.el.append ( child_0.el );
1721 var child_1 = new Xcls_SeparatorMenuItem34( _this );
1723 this.el.append ( child_1.el );
1724 var child_2 = new Xcls_MenuItem35( _this );
1726 this.el.append ( child_2.el );
1729 // user defined functions
1731 public class Xcls_MenuItem33 : Object
1733 public Gtk.MenuItem el;
1734 private Xcls_LeftProps _this;
1740 public Xcls_MenuItem33(Xcls_LeftProps _owner )
1743 this.el = new Gtk.MenuItem();
1747 // set gobject values
1748 this.el.label = "Edit";
1751 this.el.activate.connect( ( ) =>{
1753 var s = _this.view.el.get_selection();
1755 Gtk.TreeModel model;
1756 s.get_selected (out model, out iter);
1757 _this.startEditingKey(model.get_path(iter));
1761 // user defined functions
1763 public class Xcls_SeparatorMenuItem34 : Object
1765 public Gtk.SeparatorMenuItem el;
1766 private Xcls_LeftProps _this;
1772 public Xcls_SeparatorMenuItem34(Xcls_LeftProps _owner )
1775 this.el = new Gtk.SeparatorMenuItem();
1779 // set gobject values
1782 // user defined functions
1784 public class Xcls_MenuItem35 : Object
1786 public Gtk.MenuItem el;
1787 private Xcls_LeftProps _this;
1793 public Xcls_MenuItem35(Xcls_LeftProps _owner )
1796 this.el = new Gtk.MenuItem();
1800 // set gobject values
1801 this.el.label = "Delete";
1804 this.el.activate.connect( ( ) =>{
1805 _this.deleteSelected();
1809 // user defined functions