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);
180 // others... - fill in options for true/false?
181 print("turn on editing %s \n" , mod.get_path(iter).to_string());
184 if (ktype.length > 0 && (
185 ktype.up() == "BOOLEAN"
189 print("start editing try/false)???");
190 this.valrender.el.has_entry = false;
191 string[] opts = { "true", "false" };
192 this.valrender.setOptions(opts);
194 this.valrender.el.has_entry = false;
195 this.valrender.el.editable = true;
196 this.allow_edit = true;
197 GLib.Timeout.add_full(GLib.Priority.DEFAULT,100 , () => {
198 this.view.el.set_cursor_on_cell(
209 // see if type is a Enum.
212 var pal = Palete.Palete.factory(this.file.project.xtype);
218 this.valrender.setOptions(opts);
220 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
222 // at this point - work out the type...
223 // if its' a combo... then show the options..
224 this.valrender.el.has_entry = true;
226 this.valrender.el.editable = true;
229 this.allow_edit = true;
235 this.view.el.set_cursor_on_cell(
245 public void load (JsRender.JsRender file, JsRender.Node? node)
247 print("load leftprops\n");
253 this.model.el.clear();
255 //this.get('/RightEditor').el.hide();
262 //var provider = this.get('/LeftTree').getPaleteProvider();
265 //typeof(string), // 0 key type
266 //typeof(string), // 1 key
267 //typeof(string), // 2 key (display)
268 //typeof(string), // 3 value
269 //typeof(string), // 4 value (display)
270 //typeof(string), // 5 both (tooltip)
275 // really need a way to sort the hashmap...
276 var m = this.model.el;
278 var miter = node.listeners.map_iterator();
281 while(miter.next()) {
283 m.append(out iter,null);
285 this.updateIter(iter, "listener", miter.get_key(), miter.get_value());
291 miter = node.props.map_iterator();
294 while(miter.next()) {
296 m.append(out iter,null);
297 this.updateIter(iter, "prop", miter.get_key(), miter.get_value());
300 print("clear selection\n");
302 this.model.el.set_sort_column_id(6,Gtk.SortType.ASCENDING); // sort by real key..
304 this.view.el.get_selection().unselect_all();
306 var pane = _this.main_window.editpane.el;
307 var try_size = (i * 25) + 60; // est. 20px per line + 40px header
311 ((try_size * 1.0f) / (pane.max_position * 1.0f)) > 0.8f ?
312 (int) (pane.max_position * 0.2f) :
313 pane.max_position-try_size);
317 public string keyFormat (string val, string type) {
319 // Glib.markup_escape_text(val);
321 if (type == "listener") {
322 return "<span font_weight=\"bold\" color=\"#660000\">" +
323 GLib.Markup.escape_text(val) +
327 if (val.length < 1) {
328 return "<span color=\"#FF0000\">--empty--</span>";
333 //# - object properties
335 // all of these... - display value is last element..
336 var ar = val.strip().split(" ");
339 var dval = GLib.Markup.escape_text(ar[ar.length-1]);
345 case '@': // signal // just bold balck?
346 if (dval[0] == '@') {
347 dval = dval.substring(1);
350 return @"<span font_weight=\"bold\">@ $dval</span>";
351 case '#': // object properties?
352 if (dval[0] == '#') {
353 dval = dval.substring(1);
355 return @"<span font_weight=\"bold\">$dval</span>";
357 if (dval[0] == '*') {
358 dval = dval.substring(1);
360 return @"<span color=\"#0000CC\" font_weight=\"bold\">$dval</span>";
362 if (dval[0] == '$') {
363 dval = dval.substring(1);
365 return @"<span style=\"italic\">$dval</span>";
366 case '|': // user defined methods
367 if (dval[0] == '|') {
368 dval = dval.substring(1);
370 return @"<span color=\"#008000\" font_weight=\"bold\">$dval</span>";
381 public void deleteSelected () {
386 var s = this.view.el.get_selection();
387 s.get_selected(out mod, out iter);
391 mod.get_value(iter, 0 , out gval);
392 var type = (string)gval;
394 mod.get_value(iter, 1 , out gval);
395 var key = (string)gval;
399 this.node.listeners.remove(key);
403 this.node.props.remove(key);
406 this.load(this.file, this.node);
410 public void startEditingKey ( Gtk.TreePath path) {
412 if (!this.stop_editor()) {
416 // others... - fill in options for true/false?
419 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
420 this.allow_edit = true;
421 this.keyrender.el.editable = true;
423 this.view.el.set_cursor_on_cell(
435 public void addProp (string in_type, string key, string value, string value_type) {
436 // info includes key, val, skel, etype..
437 //console.dump(info);
438 //type = info.type.toLowerCase();
439 //var data = this.toJS();
441 var type = in_type == "signals" ? "listener" : in_type;
443 var fkey = (value_type.length > 0 ? value_type + " " : "") + key;
445 if (type == "listener") {
446 if (this.node.listeners.has_key(key)) {
449 this.node.listeners.set(key,value);
452 if (this.node.props.has_key(fkey)) {
455 this.node.props.set(fkey,value);
460 this.load(this.file, this.node);
464 /// need to find the row which I've just added..
467 var s = this.view.el.get_selection();
470 print("trying to find new iter");
472 this.model.el.foreach((model, path, iter) => {
475 this.model.el.get_value(iter, 0 , out gval);
476 if ((string)gval != type) {
477 print("not type: %s = %s\n", (string)gval , type);
480 this.model.el.get_value(iter, 1 , out gval);
481 if ((string)gval != fkey) {
482 print("not key: %s = %s\n", (string)gval , fkey);
486 GLib.Timeout.add_full(GLib.Priority.DEFAULT,40 , () => {
488 this.startEditingValue(this.model.el.get_path(iter));
491 //s.select_iter(iter);
499 public void updateIter (Gtk.TreeIter iter, string type, string key, string value) {
501 print("update Iter %s, %s\n", key,value);
502 //typeof(string), // 0 key type
503 //typeof(string), // 1 key
504 //typeof(string), // 2 key (display)
505 //typeof(string), // 3 value
506 //typeof(string), // 4 value (display)
507 //typeof(string), // 5 both (tooltip)
508 //typeof(string), // 6 key (sort)
510 var dl = value.strip().split("\n");
512 var dis_val = dl.length > 1 ? (dl[0].strip()+ "...") : dl[0];
514 if (type == "listener") {
518 this.model.el.set(iter,
521 2, this.keyFormat(key ,type),
524 5, "<tt>" + GLib.Markup.escape_text(key + " " +value) + "</tt>",
532 this.model.el.set(iter,
535 2, this.keyFormat(key , "prop"),
538 5, "<tt>" + GLib.Markup.escape_text(key + " " + value) + "</tt>",
539 6, this.keySortFormat(key)
542 public class Xcls_HBox2 : Object
545 private Xcls_LeftProps _this;
551 public Xcls_HBox2(Xcls_LeftProps _owner )
554 this.el = new Gtk.HBox( true, 0 );
558 // set gobject values
559 var child_0 = new Xcls_Button3( _this );
561 this.el.add ( child_0.el );
564 // user defined functions
566 public class Xcls_Button3 : Object
568 public Gtk.Button el;
569 private Xcls_LeftProps _this;
575 public Xcls_Button3(Xcls_LeftProps _owner )
578 this.el = new Gtk.Button();
582 // set gobject values
583 var child_0 = new Xcls_HBox4( _this );
585 this.el.add ( child_0.el );
586 var child_1 = new Xcls_AddPropertyPopup( _this );
590 this.el.button_press_event.connect( (self, ev) => {
594 var p = _this.AddPropertyPopup;
595 p.el.set_screen(Gdk.Screen.get_default());
597 p.el.popup(null, null, null, ev.button, ev.time);
602 // user defined functions
604 public class Xcls_HBox4 : Object
607 private Xcls_LeftProps _this;
613 public Xcls_HBox4(Xcls_LeftProps _owner )
616 this.el = new Gtk.HBox( true, 0 );
620 // set gobject values
621 var child_0 = new Xcls_Image5( _this );
623 this.el.add ( child_0.el );
624 var child_1 = new Xcls_Label6( _this );
626 this.el.add ( child_1.el );
629 // user defined functions
631 public class Xcls_Image5 : Object
634 private Xcls_LeftProps _this;
640 public Xcls_Image5(Xcls_LeftProps _owner )
643 this.el = new Gtk.Image();
647 // set gobject values
648 this.el.stock = Gtk.STOCK_ADD;
649 this.el.icon_size = Gtk.IconSize.MENU;
652 // user defined functions
654 public class Xcls_Label6 : Object
657 private Xcls_LeftProps _this;
663 public Xcls_Label6(Xcls_LeftProps _owner )
666 this.el = new Gtk.Label( "Other" );
670 // set gobject values
673 // user defined functions
675 public class Xcls_AddPropertyPopup : Object
678 private Xcls_LeftProps _this;
684 public Xcls_AddPropertyPopup(Xcls_LeftProps _owner )
687 _this.AddPropertyPopup = this;
688 this.el = new Gtk.Menu();
692 // set gobject values
693 var child_0 = new Xcls_MenuItem8( _this );
695 this.el.append ( child_0.el );
696 var child_1 = new Xcls_MenuItem9( _this );
698 this.el.append ( child_1.el );
699 var child_2 = new Xcls_MenuItem10( _this );
701 this.el.append ( child_2.el );
702 var child_3 = new Xcls_MenuItem11( _this );
704 this.el.append ( child_3.el );
705 var child_4 = new Xcls_SeparatorMenuItem12( _this );
707 this.el.add ( child_4.el );
708 var child_5 = new Xcls_MenuItem13( _this );
710 this.el.append ( child_5.el );
711 var child_6 = new Xcls_MenuItem14( _this );
713 this.el.append ( child_6.el );
714 var child_7 = new Xcls_MenuItem15( _this );
716 this.el.append ( child_7.el );
717 var child_8 = new Xcls_SeparatorMenuItem16( _this );
719 this.el.add ( child_8.el );
720 var child_9 = new Xcls_MenuItem17( _this );
722 this.el.append ( child_9.el );
723 var child_10 = new Xcls_MenuItem18( _this );
725 this.el.append ( child_10.el );
726 var child_11 = new Xcls_MenuItem19( _this );
728 this.el.append ( child_11.el );
729 var child_12 = new Xcls_SeparatorMenuItem20( _this );
731 this.el.add ( child_12.el );
732 var child_13 = new Xcls_MenuItem21( _this );
734 this.el.append ( child_13.el );
735 var child_14 = new Xcls_MenuItem22( _this );
737 this.el.append ( child_14.el );
738 var child_15 = new Xcls_MenuItem23( _this );
740 this.el.append ( child_15.el );
743 // user defined functions
745 public class Xcls_MenuItem8 : Object
747 public Gtk.MenuItem el;
748 private Xcls_LeftProps _this;
754 public Xcls_MenuItem8(Xcls_LeftProps _owner )
757 this.el = new Gtk.MenuItem();
761 // set gobject values
762 this.el.tooltip_markup = "Using _this.{ID} will map to this element";
763 this.el.label = "id: _this.{ID} (Vala)";
766 this.el.activate.connect( () => {
767 _this.addProp( "prop", "id", "", "");
771 // user defined functions
773 public class Xcls_MenuItem9 : Object
775 public Gtk.MenuItem el;
776 private Xcls_LeftProps _this;
782 public Xcls_MenuItem9(Xcls_LeftProps _owner )
785 this.el = new Gtk.MenuItem();
789 // set gobject values
790 this.el.tooltip_markup = "how to pack this element onto parent, (method, 2nd arg, 3rd arg) .. the 1st argument is filled by the element";
791 this.el.label = "pack: Pack method (Vala)";
794 this.el.activate.connect( ( ) => {
796 _this.addProp( "prop", "pack","add", "*");
800 // user defined functions
802 public class Xcls_MenuItem10 : Object
804 public Gtk.MenuItem el;
805 private Xcls_LeftProps _this;
811 public Xcls_MenuItem10(Xcls_LeftProps _owner )
814 this.el = new Gtk.MenuItem();
818 // set gobject values
819 this.el.tooltip_markup = "eg. \n\nnew Clutter.Image.from_file(.....)";
820 this.el.label = "ctor: Alterative to default contructor";
823 this.el.activate.connect( ( ) => {
825 _this.addProp( "prop", "ctor","", "*");
829 // user defined functions
831 public class Xcls_MenuItem11 : Object
833 public Gtk.MenuItem el;
834 private Xcls_LeftProps _this;
840 public Xcls_MenuItem11(Xcls_LeftProps _owner )
843 this.el = new Gtk.MenuItem();
847 // set gobject values
848 this.el.tooltip_markup = "This code is called after the ctor";
849 this.el.label = "init: initialziation code (vala)";
852 this.el.activate.connect( ( ) => {
854 _this.addProp( "prop", "init", "{\n\n}\n", "*" );
858 // user defined functions
860 public class Xcls_SeparatorMenuItem12 : Object
862 public Gtk.SeparatorMenuItem el;
863 private Xcls_LeftProps _this;
869 public Xcls_SeparatorMenuItem12(Xcls_LeftProps _owner )
872 this.el = new Gtk.SeparatorMenuItem();
876 // set gobject values
879 // user defined functions
881 public class Xcls_MenuItem13 : Object
883 public Gtk.MenuItem el;
884 private Xcls_LeftProps _this;
890 public Xcls_MenuItem13(Xcls_LeftProps _owner )
893 this.el = new Gtk.MenuItem();
897 // set gobject values
898 this.el.tooltip_markup = "Add a user defined string property";
899 this.el.label = "String";
902 this.el.activate.connect( (self) => {
904 _this.addProp( "prop", "XXXX", "","string");
909 // user defined functions
911 public class Xcls_MenuItem14 : Object
913 public Gtk.MenuItem el;
914 private Xcls_LeftProps _this;
920 public Xcls_MenuItem14(Xcls_LeftProps _owner )
923 this.el = new Gtk.MenuItem();
927 // set gobject values
928 this.el.tooltip_markup = "Add a user defined number property";
929 this.el.label = "Number";
932 this.el.activate.connect( ( ) =>{
934 _this.addProp("prop", "XXX", "0", "int");
938 // user defined functions
940 public class Xcls_MenuItem15 : Object
942 public Gtk.MenuItem el;
943 private Xcls_LeftProps _this;
949 public Xcls_MenuItem15(Xcls_LeftProps _owner )
952 this.el = new Gtk.MenuItem();
956 // set gobject values
957 this.el.tooltip_markup = "Add a user defined boolean property";
958 this.el.label = "Boolean";
961 this.el.activate.connect( ( ) =>{
963 _this.addProp( "prop", "XXX", "true", "bool");
967 // user defined functions
969 public class Xcls_SeparatorMenuItem16 : Object
971 public Gtk.SeparatorMenuItem el;
972 private Xcls_LeftProps _this;
978 public Xcls_SeparatorMenuItem16(Xcls_LeftProps _owner )
981 this.el = new Gtk.SeparatorMenuItem();
985 // set gobject values
988 // user defined functions
990 public class Xcls_MenuItem17 : Object
992 public Gtk.MenuItem el;
993 private Xcls_LeftProps _this;
999 public Xcls_MenuItem17(Xcls_LeftProps _owner )
1002 this.el = new Gtk.MenuItem();
1006 // set gobject values
1007 this.el.tooltip_markup = "Add a user function boolean property";
1008 this.el.label = "Javascript Function";
1011 this.el.activate.connect( ( ) =>{
1013 _this.addProp("prop", "XXXX", "function() { }", "| function");
1017 // user defined functions
1019 public class Xcls_MenuItem18 : Object
1021 public Gtk.MenuItem el;
1022 private Xcls_LeftProps _this;
1028 public Xcls_MenuItem18(Xcls_LeftProps _owner )
1031 this.el = new Gtk.MenuItem();
1035 // set gobject values
1036 this.el.tooltip_markup = "Add a user function boolean property";
1037 this.el.label = "Vala Method";
1040 this.el.activate.connect( ( ) =>{
1042 _this.addProp( "prop", "XXXX", "() {\n\n}\n", "| return_type");
1046 // user defined functions
1048 public class Xcls_MenuItem19 : Object
1050 public Gtk.MenuItem el;
1051 private Xcls_LeftProps _this;
1057 public Xcls_MenuItem19(Xcls_LeftProps _owner )
1060 this.el = new Gtk.MenuItem();
1064 // set gobject values
1065 this.el.tooltip_markup = "Add a vala signal";
1066 this.el.label = "Vala Signal";
1069 this.el.activate.connect( ( ) =>{
1071 _this.addProp( "prop", "XXXX", "()", "@ void");
1075 // user defined functions
1077 public class Xcls_SeparatorMenuItem20 : Object
1079 public Gtk.SeparatorMenuItem el;
1080 private Xcls_LeftProps _this;
1086 public Xcls_SeparatorMenuItem20(Xcls_LeftProps _owner )
1089 this.el = new Gtk.SeparatorMenuItem();
1093 // set gobject values
1096 // user defined functions
1098 public class Xcls_MenuItem21 : Object
1100 public Gtk.MenuItem el;
1101 private Xcls_LeftProps _this;
1107 public Xcls_MenuItem21(Xcls_LeftProps _owner )
1110 this.el = new Gtk.MenuItem();
1114 // set gobject values
1115 this.el.tooltip_markup = "Add a flexy if (for HTML templates)";
1116 this.el.label = "Flexy - If";
1119 this.el.activate.connect( ( ) =>{
1121 _this.addProp("prop", "flexy:if", "value_or_condition", "string");
1125 // user defined functions
1127 public class Xcls_MenuItem22 : Object
1129 public Gtk.MenuItem el;
1130 private Xcls_LeftProps _this;
1136 public Xcls_MenuItem22(Xcls_LeftProps _owner )
1139 this.el = new Gtk.MenuItem();
1143 // set gobject values
1144 this.el.tooltip_markup = "Add a flexy include (for HTML templates)";
1145 this.el.label = "Flexy - Include";
1148 this.el.activate.connect( ( ) =>{
1150 _this.addProp("prop", "flexy:include", "name_of_file.html", "string");
1154 // user defined functions
1156 public class Xcls_MenuItem23 : Object
1158 public Gtk.MenuItem el;
1159 private Xcls_LeftProps _this;
1165 public Xcls_MenuItem23(Xcls_LeftProps _owner )
1168 this.el = new Gtk.MenuItem();
1172 // set gobject values
1173 this.el.tooltip_markup = "Add a flexy foreach (for HTML templates)";
1174 this.el.label = "Flexy - Foreach";
1177 this.el.activate.connect( ( ) =>{
1179 _this.addProp("prop", "flexy:foreach", "array,key,value", "string");
1183 // user defined functions
1185 public class Xcls_EditProps : Object
1187 public Gtk.ScrolledWindow el;
1188 private Xcls_LeftProps _this;
1192 public bool editing;
1195 public Xcls_EditProps(Xcls_LeftProps _owner )
1198 _this.EditProps = this;
1199 this.el = new Gtk.ScrolledWindow( null, null );
1202 this.editing = false;
1204 // set gobject values
1205 this.el.shadow_type = Gtk.ShadowType.IN;
1206 var child_0 = new Xcls_view( _this );
1208 this.el.add ( child_0.el );
1214 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
1218 // user defined functions
1220 public class Xcls_view : Object
1222 public Gtk.TreeView el;
1223 private Xcls_LeftProps _this;
1229 public Xcls_view(Xcls_LeftProps _owner )
1233 this.el = new Gtk.TreeView();
1237 // set gobject values
1238 this.el.tooltip_column = 5;
1239 this.el.enable_tree_lines = true;
1240 this.el.headers_visible = true;
1241 var child_0 = new Xcls_model( _this );
1243 this.el.set_model ( child_0.el );
1244 var child_1 = new Xcls_keycol( _this );
1246 this.el.append_column ( child_1.el );
1247 var child_2 = new Xcls_valcol( _this );
1249 this.el.append_column ( child_2.el );
1250 var child_3 = new Xcls_ContextMenu( _this );
1256 var selection = this.el.get_selection();
1257 selection.set_mode( Gtk.SelectionMode.SINGLE);
1260 var description = new Pango.FontDescription();
1261 description.set_size(10000);
1262 this.el.modify_font(description);
1266 this.el.button_press_event.connect( ( ev) => {
1268 Gtk.TreeViewColumn col;
1272 if (!this.el.get_path_at_pos((int)ev.x, (int) ev.y, out path, out col, out cell_x, out cell_y )) {
1273 print("nothing selected on click");
1274 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
1275 this.el.get_selection().unselect_all();
1279 _this.before_edit();
1280 return false; //not on a element.
1285 if (ev.type == Gdk.EventType.2BUTTON_PRESS && ev.button == 1 && col.title == "Name") {
1289 _this.before_edit();
1291 _this.keyrender.el.stop_editing(false);
1292 _this.keyrender.el.editable =false;
1294 _this.valrender.el.stop_editing(false);
1295 _this.valrender.el.editable =false;
1297 _this.startEditingKey(path);
1306 if (ev.type == Gdk.EventType.BUTTON_PRESS && ev.button == 3) {
1308 //if (col.title == "Value") {
1309 // _this.before_edit();
1313 var p = _this.ContextMenu;
1315 p.el.set_screen(Gdk.Screen.get_default());
1317 p.el.popup(null, null, null, ev.button, ev.time);
1318 //Seed.print("click:" + res.column.title);
1320 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
1322 this.el.get_selection().select_path(path);
1325 _this.before_edit();
1330 if (col.title != "Value") {
1331 print("col title != Value");
1333 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
1334 this.el.get_selection().select_path(path);
1338 _this.before_edit();
1339 // XObject.error("column is not value?");
1340 return false; // ignore.. - key click.. ??? should we do this??
1344 // if the cell can be edited with a pulldown
1345 // then we should return true... - and let the start_editing handle it?
1352 // _this.before_edit(); <<< we really need to stop the other editor..
1353 _this.keyrender.el.stop_editing(false);
1354 _this.keyrender.el.editable =false;
1357 return _this.startEditingValue(path); // assumes selected row..
1366 // user defined functions
1368 public class Xcls_model : Object
1370 public Gtk.TreeStore el;
1371 private Xcls_LeftProps _this;
1377 public Xcls_model(Xcls_LeftProps _owner )
1381 this.el = new Gtk.TreeStore( 7, typeof(string), // 0 key type
1382 typeof(string), // 1 key
1383 typeof(string), // 2 key (display)
1384 typeof(string), // 3 value
1385 typeof(string), // 4 value (display)
1386 typeof(string), // 5 both (tooltip)
1387 typeof(string) // 6 key (for sorting)
1392 // set gobject values
1395 // user defined functions
1397 public class Xcls_keycol : Object
1399 public Gtk.TreeViewColumn el;
1400 private Xcls_LeftProps _this;
1406 public Xcls_keycol(Xcls_LeftProps _owner )
1409 _this.keycol = this;
1410 this.el = new Gtk.TreeViewColumn();
1414 // set gobject values
1415 this.el.title = "Name";
1416 this.el.resizable = true;
1417 var child_0 = new Xcls_keyrender( _this );
1419 this.el.pack_start ( child_0.el , false );
1423 this.el.add_attribute(_this.keyrender.el , "markup", 2 );
1424 this.el.add_attribute(_this.keyrender.el , "text", 1 );
1427 // user defined functions
1429 public class Xcls_keyrender : Object
1431 public Gtk.CellRendererText el;
1432 private Xcls_LeftProps _this;
1438 public Xcls_keyrender(Xcls_LeftProps _owner )
1441 _this.keyrender = this;
1442 this.el = new Gtk.CellRendererText();
1446 // set gobject values
1449 this.el.editing_started.connect( ( editable, path) => {
1452 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1457 // this.get('/LeftPanel.model').activePath = path;
1458 _this.model.el.get_value(iter,1, out gval);
1459 var val = (string)gval;
1461 ((Gtk.Entry)editable).set_text(val);
1463 this.el.edited.connect( (path, newtext) => {
1464 print("Keyrender - signal:edited\n");
1466 this.el.editable = false;
1471 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1474 _this.model.el.get_value(iter,1, out gval);
1475 var oldval = (string)gval;
1477 _this.model.el.get_value(iter,0, out gval);
1478 var ktype = (string)gval;
1480 _this.model.el.set_value(iter, 1, newtext);
1482 if (oldval == newtext) {
1487 print("ktype: %s\n",ktype);
1490 var ov = _this.node.listeners.get(oldval);
1491 _this.node.listeners.set(newtext, ov);
1492 _this.node.listeners.remove(oldval);
1494 _this.updateIter(iter, ktype, newtext, ov);
1498 var ov = _this.node.props.get(oldval);
1499 _this.node.props.set(newtext, ov);
1500 _this.node.props.remove(oldval);
1501 _this.updateIter(iter, ktype, newtext, ov);
1509 // user defined functions
1511 public class Xcls_valcol : Object
1513 public Gtk.TreeViewColumn el;
1514 private Xcls_LeftProps _this;
1520 public Xcls_valcol(Xcls_LeftProps _owner )
1523 _this.valcol = this;
1524 this.el = new Gtk.TreeViewColumn();
1528 // set gobject values
1529 this.el.title = "Value";
1530 this.el.resizable = true;
1531 var child_0 = new Xcls_valrender( _this );
1533 this.el.pack_start ( child_0.el , true );
1539 // typeof(string), // 0 key type
1540 // typeof(string), // 1 key
1541 // typeof(string), // 2 key (display)
1542 // typeof(string), // 3 value
1543 // typeof(string) // 4 value (display)
1546 this.el.add_attribute(_this.valrender.el , "text", 4 );
1547 //this.el.add_attribute(_this.valrender.el , "sensitive", 4 );
1548 //this.el.add_attribute(this.items[0].el , 'editable', 3 );
1549 // this.el.set_cell_data_func(cell, age_cell_data_func, NULL, NULL);
1551 // this.get('/LeftPanel').editableColumn= this;
1555 // user defined functions
1557 public class Xcls_valrender : Object
1559 public Gtk.CellRendererCombo el;
1560 private Xcls_LeftProps _this;
1566 public Xcls_valrender(Xcls_LeftProps _owner )
1569 _this.valrender = this;
1570 this.el = new Gtk.CellRendererCombo();
1574 // set gobject values
1575 this.el.editable = false;
1576 this.el.text_column = 0;
1577 this.el.has_entry = true;
1578 var child_0 = new Xcls_valrendermodel( _this );
1580 this.el.model = child_0.el;
1583 this.el.editing_started.connect( ( editable, path) => {
1584 //_this.editing = true;
1585 print("editing started called\n");
1586 if (!_this.allow_edit) {
1588 print("val - editing_Started\n");
1589 this.el.editable = false; // make sure it's not editor...
1594 _this.allow_edit =false;
1597 if ( this.el.has_entry ) {
1600 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1605 // this.get('/LeftPanel.model').activePath = path;
1606 _this.model.el.get_value(iter,3, out gval);
1609 var val = (string)gval;
1610 var combo = (Gtk.ComboBox)editable;
1612 var entry = (Gtk.Entry) combo.get_child();
1613 entry.set_text(val);
1617 this.el.edited.connect( (path, newtext) => {
1618 print("Valrender - signal:edited\n");
1620 this.el.editable = false;
1625 2, "<b>" + miter.get_key() + "</b>",
1626 3, miter.get_value(),
1627 4, display_value(short);
1633 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1636 _this.model.el.get_value(iter,0, out gval);
1637 var ktype = (string)gval;
1640 _this.model.el.get_value(iter,3, out gval);
1641 var oldval = (string)gval;
1643 _this.model.el.get_value(iter,1, out gval);
1644 var key = (string)gval;
1650 _this.node.listeners.set(key, newtext);
1651 _this.updateIter(iter,ktype,key,newtext);
1654 _this.node.props.set(key,newtext);
1655 _this.updateIter(iter,ktype, key,newtext);
1658 // _this.load(_this.file,_this.node);
1664 // user defined functions
1665 public void setOptions (string[] ar) {
1666 var m = _this.valrendermodel.el;
1669 for (var i =0; i < ar.length; i++) {
1671 m.set_value(iret, 0, ar[i]);
1676 public class Xcls_valrendermodel : Object
1678 public Gtk.ListStore el;
1679 private Xcls_LeftProps _this;
1685 public Xcls_valrendermodel(Xcls_LeftProps _owner )
1688 _this.valrendermodel = this;
1689 this.el = new Gtk.ListStore( 1, typeof(string) );
1693 // set gobject values
1696 // user defined functions
1698 public class Xcls_ContextMenu : Object
1701 private Xcls_LeftProps _this;
1707 public Xcls_ContextMenu(Xcls_LeftProps _owner )
1710 _this.ContextMenu = this;
1711 this.el = new Gtk.Menu();
1715 // set gobject values
1716 var child_0 = new Xcls_MenuItem33( _this );
1718 this.el.append ( child_0.el );
1719 var child_1 = new Xcls_SeparatorMenuItem34( _this );
1721 this.el.append ( child_1.el );
1722 var child_2 = new Xcls_MenuItem35( _this );
1724 this.el.append ( child_2.el );
1727 // user defined functions
1729 public class Xcls_MenuItem33 : Object
1731 public Gtk.MenuItem el;
1732 private Xcls_LeftProps _this;
1738 public Xcls_MenuItem33(Xcls_LeftProps _owner )
1741 this.el = new Gtk.MenuItem();
1745 // set gobject values
1746 this.el.label = "Edit";
1749 this.el.activate.connect( ( ) =>{
1751 var s = _this.view.el.get_selection();
1753 Gtk.TreeModel model;
1754 s.get_selected (out model, out iter);
1755 _this.startEditingKey(model.get_path(iter));
1759 // user defined functions
1761 public class Xcls_SeparatorMenuItem34 : Object
1763 public Gtk.SeparatorMenuItem el;
1764 private Xcls_LeftProps _this;
1770 public Xcls_SeparatorMenuItem34(Xcls_LeftProps _owner )
1773 this.el = new Gtk.SeparatorMenuItem();
1777 // set gobject values
1780 // user defined functions
1782 public class Xcls_MenuItem35 : Object
1784 public Gtk.MenuItem el;
1785 private Xcls_LeftProps _this;
1791 public Xcls_MenuItem35(Xcls_LeftProps _owner )
1794 this.el = new Gtk.MenuItem();
1798 // set gobject values
1799 this.el.label = "Delete";
1802 this.el.activate.connect( ( ) =>{
1803 _this.deleteSelected();
1807 // user defined functions