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 signal void show_add_props (string type);
29 public Xcls_MainWindow main_window;
30 public signal bool stop_editor ();
31 public JsRender.JsRender file;
32 public JsRender.Node node;
33 public signal void changed ();
34 public signal void show_editor (JsRender.JsRender file, JsRender.Node node, JsRender.NodeProp prop);
37 public Xcls_LeftProps()
40 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
43 this.allow_edit = false;
44 this.main_window = null;
47 this.el.homogeneous = false ;
48 var child_0 = new Xcls_Box2( _this );
50 this.el.pack_start ( child_0.el , false,true,0 );
51 var child_1 = new Xcls_EditProps( _this );
53 this.el.pack_end ( child_1.el , true,true,0 );
56 // user defined functions
57 public string keySortFormat (string key) {
58 // listeners first - with 0
65 var bits = key.split(" ");
68 return "2 " + bits[bits.length -1];
72 return "3 " + bits[bits.length -1];
77 return "4 " + bits[bits.length -1];
80 return "5 " + bits[bits.length -1];
85 public string keyFormat (string val, string type) {
87 // Glib.markup_escape_text(val);
89 if (type == "listener") {
90 return "<span font_weight=\"bold\" color=\"#660000\">" +
91 GLib.Markup.escape_text(val) +
96 return "<span color=\"#FF0000\">--empty--</span>";
101 //# - object properties
103 // all of these... - display value is last element..
104 var ar = val.strip().split(" ");
107 var dval = GLib.Markup.escape_text(ar[ar.length-1]);
113 case '@': // signal // just bold balck?
114 if (dval[0] == '@') {
115 dval = dval.substring(1);
118 return @"<span font_weight=\"bold\">@ $dval</span>";
119 case '#': // object properties?
120 if (dval[0] == '#') {
121 dval = dval.substring(1);
123 return @"<span font_weight=\"bold\">$dval</span>";
125 if (dval[0] == '*') {
126 dval = dval.substring(1);
128 return @"<span color=\"#0000CC\" font_weight=\"bold\">$dval</span>";
130 if (dval[0] == '$') {
131 dval = dval.substring(1);
133 return @"<span style=\"italic\">$dval</span>";
134 case '|': // user defined methods
135 if (dval[0] == '|') {
136 dval = dval.substring(1);
138 return @"<span color=\"#008000\" font_weight=\"bold\">$dval</span>";
149 public void updateIter (Gtk.TreeIter iter, JsRender.NodeProp prop) {
151 //print("update Iter %s, %s\n", key,kvalue);
153 var dl = prop.val.strip().split("\n");
155 var dis_val = dl.length > 1 ? (dl[0].strip()+ "...") : dl[0];
157 if (prop.ptype == JsRender.NodePropType.LISTENER) {
161 this.model.el.set(iter,
163 1, prop.to_display_name(),
165 3, "<tt>" + GLib.Markup.escape_text(prop.to_tooltip()) + "</tt>",
166 4, prop.to_sort_key(),
174 this.model.el.set(iter,
176 1, prop.to_display_name(),
178 3, "<tt>" + GLib.Markup.escape_text(prop.to_tooltip()) + "</tt>",
179 4, prop.to_sort_key(),
184 public void deleteSelected () {
191 var s = this.view.el.get_selection();
192 s.get_selected(out mod, out iter);
196 mod.get_value(iter, 0 , out gval);
197 var prop = (JsRender.NodeProp)gval;
199 this.load(this.file, this.node);
202 // stop editor after fetching property - otherwise prop is null.
207 case JsRender.NodePropType.LISTENER:
208 this.node.listeners.unset(prop.to_index_key());
212 this.node.props.unset(prop.to_index_key());
215 this.load(this.file, this.node);
219 public void startEditingKey ( Gtk.TreePath path) {
221 if (!this.stop_editor()) {
225 // others... - fill in options for true/false?
228 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
229 this.allow_edit = true;
230 this.keyrender.el.editable = true;
232 this.view.el.set_cursor_on_cell(
244 public void before_edit ()
247 GLib.debug("before edit - stop editing\n");
249 // these do not appear to trigger save...
250 _this.keyrender.el.stop_editing(false);
251 _this.keyrender.el.editable =false;
253 _this.valrender.el.stop_editing(false);
254 _this.valrender.el.editable =false;
257 // technicall stop the popup editor..
260 public void reload () {
261 this.load(this.file, this.node);
263 public void finish_editing () {
267 public void load (JsRender.JsRender file, JsRender.Node? node)
269 // not sure when to initialize this - we should do it on setting main window really.
270 if (this.view.popover == null) {
271 this.view.popover = new Xcls_PopoverProperty();
272 this.view.popover.mainwindow = _this.main_window;
278 GLib.debug("load leftprops\n");
284 this.model.el.clear();
286 //this.get('/RightEditor').el.hide();
293 //var provider = this.get('/LeftTree').getPaleteProvider();
300 // really need a way to sort the hashmap...
301 var m = this.model.el;
303 var miter = node.listeners.map_iterator();
306 while(miter.next()) {
308 m.append(out iter,null);
310 this.updateIter(iter, miter.get_value());
316 miter = node.props.map_iterator();
319 while(miter.next()) {
321 m.append(out iter,null);
322 this.updateIter(iter, miter.get_value());
325 GLib.debug("clear selection\n");
327 this.model.el.set_sort_column_id(4,Gtk.SortType.ASCENDING); // sort by real key..
329 this.view.el.get_selection().unselect_all();
335 public bool startEditingValue ( Gtk.TreePath path) {
337 // ONLY return true if editing is allowed - eg. combo..
339 GLib.debug("start editing?\n");
340 if (!this.stop_editor()) {
341 GLib.debug("stop editor failed\n");
347 var mod = this.model.el;
348 mod.get_iter (out iter, path);
351 mod.get_value(iter, 0 , out gval);
352 var prop = (JsRender.NodeProp)gval;
356 var use_textarea = false;
358 //------------ things that require the text editor...
360 if (prop.ptype == JsRender.NodePropType.LISTENER) {
363 if (prop.ptype == JsRender.NodePropType.METHOD) {
366 if (prop.ptype == JsRender.NodePropType.RAW) { // raw string
369 if ( prop.name == "init" && prop.ptype == JsRender.NodePropType.SPECIAL) {
372 if (prop.val.length > 40) { // long value...
379 GLib.debug("Call show editor\n");
380 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
381 this.view.el.get_selection().select_path(path);
383 this.show_editor(file, node, prop);
392 var pal = this.file.project.palete;
395 var has_opts = pal.typeOptions(this.node.fqn(), prop.name, prop.rtype, out opts);
399 // others... - fill in options for true/false?
400 GLib.debug("turn on editing %s \n" , mod.get_path(iter).to_string());
402 // GLib.debug (ktype.up());
404 GLib.debug("start editing try/false)???");
405 this.valrender.el.has_entry = false;
407 this.valrender.setOptions(opts);
409 this.valrender.el.has_entry = false;
410 this.valrender.el.editable = true;
411 this.allow_edit = true;
412 GLib.Timeout.add_full(GLib.Priority.DEFAULT,100 , () => {
413 this.view.el.set_cursor_on_cell(
424 // see if type is a Enum.
431 this.valrender.setOptions(opts);
433 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
435 // at this point - work out the type...
436 // if its' a combo... then show the options..
437 this.valrender.el.has_entry = true;
439 this.valrender.el.editable = true;
442 this.allow_edit = true;
448 this.view.el.set_cursor_on_cell(
458 public void addProp (JsRender.NodeProp prop) {
459 // info includes key, val, skel, etype..
460 //console.dump(info);
461 //type = info.type.toLowerCase();
462 //var data = this.toJS();
465 if (prop.ptype == JsRender.NodePropType.LISTENER) {
466 if (this.node.listeners.has_key(prop.name)) {
469 this.node.listeners.set(prop.name,prop);
471 assert(this.node != null);
472 assert(this.node.props != null);
473 if (this.node.props.has_key(prop.to_index_key())) {
476 this.node.props.set(prop.to_index_key(),prop);
481 this.load(this.file, this.node);
485 /// need to find the row which I've just added..
488 var s = this.view.el.get_selection();
491 GLib.debug("trying to find new iter");
493 this.model.el.foreach((model, path, iter) => {
495 this.model.el.get_value(iter, 0 , out gval);
497 var iprop = (JsRender.NodeProp)gval;
498 if (iprop.to_index_key() != prop.to_index_key()) {
499 return false; // continue?
503 GLib.Timeout.add_full(GLib.Priority.DEFAULT,40 , () => {
505 if (prop.name == "") { // empty string for key name.
506 _this.view.editPropertyDetails(this.model.el.get_path(iter));
511 this.startEditingValue(this.model.el.get_path(iter));
514 //s.select_iter(iter);
522 public class Xcls_Box2 : Object
525 private Xcls_LeftProps _this;
531 public Xcls_Box2(Xcls_LeftProps _owner )
534 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
538 // set gobject values
539 var child_0 = new Xcls_Label3( _this );
541 this.el.add ( child_0.el );
542 var child_1 = new Xcls_Button4( _this );
544 this.el.add ( child_1.el );
545 var child_2 = new Xcls_Button6( _this );
547 this.el.add ( child_2.el );
548 var child_3 = new Xcls_Button8( _this );
550 this.el.add ( child_3.el );
553 // user defined functions
555 public class Xcls_Label3 : Object
558 private Xcls_LeftProps _this;
564 public Xcls_Label3(Xcls_LeftProps _owner )
567 this.el = new Gtk.Label( "Add:" );
571 // set gobject values
572 this.el.margin_end = 5;
573 this.el.margin_start = 5;
576 // user defined functions
579 public class Xcls_Button4 : Object
581 public Gtk.Button el;
582 private Xcls_LeftProps _this;
588 public Xcls_Button4(Xcls_LeftProps _owner )
591 this.el = new Gtk.Button();
595 // set gobject values
596 this.el.hexpand = true;
597 this.el.always_show_image = true;
598 this.el.tooltip_text = "Add Property";
599 this.el.label = "Property";
600 var child_0 = new Xcls_Image5( _this );
602 this.el.set_image ( child_0.el );
605 this.el.clicked.connect( ( ) => {
607 _this.main_window.windowstate.showProps(
609 JsRender.NodePropType.PROP
615 // user defined functions
617 public class Xcls_Image5 : Object
620 private Xcls_LeftProps _this;
626 public Xcls_Image5(Xcls_LeftProps _owner )
629 this.el = new Gtk.Image();
633 // set gobject values
634 this.el.icon_name = "format-justify-left";
637 // user defined functions
641 public class Xcls_Button6 : Object
643 public Gtk.Button el;
644 private Xcls_LeftProps _this;
650 public Xcls_Button6(Xcls_LeftProps _owner )
653 this.el = new Gtk.Button();
657 // set gobject values
658 this.el.hexpand = true;
659 this.el.always_show_image = true;
660 this.el.tooltip_text = "Add Event Code";
661 this.el.label = "Event";
662 var child_0 = new Xcls_Image7( _this );
664 this.el.set_image ( child_0.el );
667 this.el.clicked.connect( ( ) => {
670 _this.main_window.windowstate.showProps(
672 JsRender.NodePropType.LISTENER
679 // user defined functions
681 public class Xcls_Image7 : Object
684 private Xcls_LeftProps _this;
690 public Xcls_Image7(Xcls_LeftProps _owner )
693 this.el = new Gtk.Image();
697 // set gobject values
698 this.el.icon_name = "appointment-new";
701 // user defined functions
705 public class Xcls_Button8 : Object
707 public Gtk.Button el;
708 private Xcls_LeftProps _this;
714 public Xcls_Button8(Xcls_LeftProps _owner )
717 this.el = new Gtk.Button();
721 // set gobject values
722 this.el.hexpand = true;
723 this.el.always_show_image = true;
724 this.el.label = "Other";
725 var child_0 = new Xcls_AddPropertyPopup( _this );
727 var child_1 = new Xcls_Image27( _this );
729 this.el.set_image ( child_1.el );
732 this.el.button_press_event.connect( (self, ev) => {
736 var p = _this.AddPropertyPopup;
737 p.el.set_screen(Gdk.Screen.get_default());
739 p.el.popup(null, null, null, ev.button, ev.time);
744 // user defined functions
746 public class Xcls_AddPropertyPopup : Object
749 private Xcls_LeftProps _this;
755 public Xcls_AddPropertyPopup(Xcls_LeftProps _owner )
758 _this.AddPropertyPopup = this;
759 this.el = new Gtk.Menu();
763 // set gobject values
764 var child_0 = new Xcls_MenuItem10( _this );
766 this.el.append ( child_0.el );
767 var child_1 = new Xcls_MenuItem11( _this );
769 this.el.append ( child_1.el );
770 var child_2 = new Xcls_MenuItem12( _this );
772 this.el.append ( child_2.el );
773 var child_3 = new Xcls_MenuItem13( _this );
775 this.el.append ( child_3.el );
776 var child_4 = new Xcls_MenuItem14( _this );
778 this.el.append ( child_4.el );
779 var child_5 = new Xcls_SeparatorMenuItem15( _this );
781 this.el.add ( child_5.el );
782 var child_6 = new Xcls_MenuItem16( _this );
784 this.el.append ( child_6.el );
785 var child_7 = new Xcls_MenuItem17( _this );
787 this.el.append ( child_7.el );
788 var child_8 = new Xcls_MenuItem18( _this );
790 this.el.append ( child_8.el );
791 var child_9 = new Xcls_SeparatorMenuItem19( _this );
793 this.el.add ( child_9.el );
794 var child_10 = new Xcls_MenuItem20( _this );
796 this.el.append ( child_10.el );
797 var child_11 = new Xcls_MenuItem21( _this );
799 this.el.append ( child_11.el );
800 var child_12 = new Xcls_MenuItem22( _this );
802 this.el.append ( child_12.el );
803 var child_13 = new Xcls_SeparatorMenuItem23( _this );
805 this.el.add ( child_13.el );
806 var child_14 = new Xcls_MenuItem24( _this );
808 this.el.append ( child_14.el );
809 var child_15 = new Xcls_MenuItem25( _this );
811 this.el.append ( child_15.el );
812 var child_16 = new Xcls_MenuItem26( _this );
814 this.el.append ( child_16.el );
817 // user defined functions
819 public class Xcls_MenuItem10 : Object
821 public Gtk.MenuItem el;
822 private Xcls_LeftProps _this;
828 public Xcls_MenuItem10(Xcls_LeftProps _owner )
831 this.el = new Gtk.MenuItem();
835 // set gobject values
836 this.el.tooltip_markup = "Using _this.{ID} will map to this element";
837 this.el.label = "id: _this.{ID} (Vala)";
840 this.el.activate.connect( () => {
841 // is this userdef or special??
842 _this.addProp( new JsRender.NodeProp.prop("id") );
846 // user defined functions
849 public class Xcls_MenuItem11 : Object
851 public Gtk.MenuItem el;
852 private Xcls_LeftProps _this;
858 public Xcls_MenuItem11(Xcls_LeftProps _owner )
861 this.el = new Gtk.MenuItem();
865 // set gobject values
866 this.el.tooltip_markup = "how to pack this element onto parent, (method, 2nd arg, 3rd arg) .. the 1st argument is filled by the element";
867 this.el.label = "pack: Pack method (Vala)";
870 this.el.activate.connect( ( ) => {
872 _this.addProp( new JsRender.NodeProp.special("pack", "add") );
876 // user defined functions
879 public class Xcls_MenuItem12 : Object
881 public Gtk.MenuItem el;
882 private Xcls_LeftProps _this;
888 public Xcls_MenuItem12(Xcls_LeftProps _owner )
891 this.el = new Gtk.MenuItem();
895 // set gobject values
896 this.el.tooltip_markup = "eg. \n\nnew Clutter.Image.from_file(.....)";
897 this.el.label = "ctor: Alterative to default contructor (Vala)";
900 this.el.activate.connect( ( ) => {
902 _this.addProp( new JsRender.NodeProp.special("ctor") );
906 // user defined functions
909 public class Xcls_MenuItem13 : Object
911 public Gtk.MenuItem el;
912 private Xcls_LeftProps _this;
918 public Xcls_MenuItem13(Xcls_LeftProps _owner )
921 this.el = new Gtk.MenuItem();
925 // set gobject values
926 this.el.tooltip_markup = "This code is called after the ctor";
927 this.el.label = "init: initialziation code (vala)";
930 this.el.activate.connect( ( ) => {
931 _this.addProp( new JsRender.NodeProp.special("init","{\n\n}\n" ) );
936 // user defined functions
939 public class Xcls_MenuItem14 : Object
941 public Gtk.MenuItem el;
942 private Xcls_LeftProps _this;
948 public Xcls_MenuItem14(Xcls_LeftProps _owner )
951 this.el = new Gtk.MenuItem();
955 // set gobject values
956 this.el.tooltip_markup = "set the cms-id for this element, when converted to javascript, the html value will be wrapped with Pman.Cms.content({cms-id},{original-html})\n";
957 this.el.label = "cms-id: (Roo JS/Pman library)";
960 this.el.activate.connect( () => {
962 _this.addProp( new JsRender.NodeProp.prop("cms-id","string", "" ) );
969 // user defined functions
972 public class Xcls_SeparatorMenuItem15 : Object
974 public Gtk.SeparatorMenuItem el;
975 private Xcls_LeftProps _this;
981 public Xcls_SeparatorMenuItem15(Xcls_LeftProps _owner )
984 this.el = new Gtk.SeparatorMenuItem();
988 // set gobject values
991 // user defined functions
994 public class Xcls_MenuItem16 : Object
996 public Gtk.MenuItem el;
997 private Xcls_LeftProps _this;
1003 public Xcls_MenuItem16(Xcls_LeftProps _owner )
1006 this.el = new Gtk.MenuItem();
1010 // set gobject values
1011 this.el.tooltip_markup = "Add a user defined string property";
1012 this.el.label = "String";
1015 this.el.activate.connect( (self) => {
1017 _this.view.popover.show(
1020 new JsRender.NodeProp.prop("", "string", "") ,
1028 // user defined functions
1031 public class Xcls_MenuItem17 : Object
1033 public Gtk.MenuItem el;
1034 private Xcls_LeftProps _this;
1040 public Xcls_MenuItem17(Xcls_LeftProps _owner )
1043 this.el = new Gtk.MenuItem();
1047 // set gobject values
1048 this.el.tooltip_markup = "Add a user defined number property";
1049 this.el.label = "Number";
1052 this.el.activate.connect( ( ) =>{
1053 _this.view.popover.show(
1056 new JsRender.NodeProp.prop("", "int", "0") ,
1064 // user defined functions
1067 public class Xcls_MenuItem18 : Object
1069 public Gtk.MenuItem el;
1070 private Xcls_LeftProps _this;
1076 public Xcls_MenuItem18(Xcls_LeftProps _owner )
1079 this.el = new Gtk.MenuItem();
1083 // set gobject values
1084 this.el.tooltip_markup = "Add a user defined boolean property";
1085 this.el.label = "Boolean";
1088 this.el.activate.connect( ( ) =>{
1091 _this.view.popover.show(
1094 new JsRender.NodeProp.prop("", "bool", "true") ,
1102 // user defined functions
1105 public class Xcls_SeparatorMenuItem19 : Object
1107 public Gtk.SeparatorMenuItem el;
1108 private Xcls_LeftProps _this;
1114 public Xcls_SeparatorMenuItem19(Xcls_LeftProps _owner )
1117 this.el = new Gtk.SeparatorMenuItem();
1121 // set gobject values
1124 // user defined functions
1127 public class Xcls_MenuItem20 : Object
1129 public Gtk.MenuItem el;
1130 private Xcls_LeftProps _this;
1136 public Xcls_MenuItem20(Xcls_LeftProps _owner )
1139 this.el = new Gtk.MenuItem();
1143 // set gobject values
1144 this.el.tooltip_markup = "Add a user function boolean property";
1145 this.el.label = "Javascript Function";
1148 this.el.activate.connect( ( ) =>{
1150 _this.view.popover.show(
1153 new JsRender.NodeProp.jsmethod("") ,
1162 // user defined functions
1165 public class Xcls_MenuItem21 : Object
1167 public Gtk.MenuItem el;
1168 private Xcls_LeftProps _this;
1174 public Xcls_MenuItem21(Xcls_LeftProps _owner )
1177 this.el = new Gtk.MenuItem();
1181 // set gobject values
1182 this.el.tooltip_markup = "Add a user function boolean property";
1183 this.el.label = "Vala Method";
1186 this.el.activate.connect( ( ) =>{
1188 _this.view.popover.show(
1191 new JsRender.NodeProp.valamethod("") ,
1198 // user defined functions
1201 public class Xcls_MenuItem22 : Object
1203 public Gtk.MenuItem el;
1204 private Xcls_LeftProps _this;
1210 public Xcls_MenuItem22(Xcls_LeftProps _owner )
1213 this.el = new Gtk.MenuItem();
1217 // set gobject values
1218 this.el.tooltip_markup = "Add a vala signal";
1219 this.el.label = "Vala Signal";
1222 this.el.activate.connect( ( ) =>{
1223 _this.view.popover.show(
1226 new JsRender.NodeProp.sig("" ) ,
1233 // user defined functions
1236 public class Xcls_SeparatorMenuItem23 : Object
1238 public Gtk.SeparatorMenuItem el;
1239 private Xcls_LeftProps _this;
1245 public Xcls_SeparatorMenuItem23(Xcls_LeftProps _owner )
1248 this.el = new Gtk.SeparatorMenuItem();
1252 // set gobject values
1255 // user defined functions
1258 public class Xcls_MenuItem24 : Object
1260 public Gtk.MenuItem el;
1261 private Xcls_LeftProps _this;
1267 public Xcls_MenuItem24(Xcls_LeftProps _owner )
1270 this.el = new Gtk.MenuItem();
1274 // set gobject values
1275 this.el.tooltip_markup = "Add a flexy if (for HTML templates)";
1276 this.el.label = "Flexy - If";
1279 this.el.activate.connect( ( ) =>{
1280 _this.view.popover.show(
1283 new JsRender.NodeProp.prop("flexy:if", "string", "value_or_condition") ,
1292 // user defined functions
1295 public class Xcls_MenuItem25 : Object
1297 public Gtk.MenuItem el;
1298 private Xcls_LeftProps _this;
1304 public Xcls_MenuItem25(Xcls_LeftProps _owner )
1307 this.el = new Gtk.MenuItem();
1311 // set gobject values
1312 this.el.tooltip_markup = "Add a flexy include (for HTML templates)";
1313 this.el.label = "Flexy - Include";
1316 this.el.activate.connect( ( ) =>{
1317 _this.view.popover.show(
1320 new JsRender.NodeProp.prop("flexy:include", "string", "name_of_file.html") ,
1329 // user defined functions
1332 public class Xcls_MenuItem26 : Object
1334 public Gtk.MenuItem el;
1335 private Xcls_LeftProps _this;
1341 public Xcls_MenuItem26(Xcls_LeftProps _owner )
1344 this.el = new Gtk.MenuItem();
1348 // set gobject values
1349 this.el.tooltip_markup = "Add a flexy foreach (for HTML templates)";
1350 this.el.label = "Flexy - Foreach";
1353 this.el.activate.connect( ( ) =>{
1355 _this.view.popover.show(
1358 new JsRender.NodeProp.prop("flexy:foreach", "string", "array,key,value") ,
1367 // user defined functions
1371 public class Xcls_Image27 : Object
1373 public Gtk.Image el;
1374 private Xcls_LeftProps _this;
1380 public Xcls_Image27(Xcls_LeftProps _owner )
1383 this.el = new Gtk.Image();
1387 // set gobject values
1388 this.el.stock = Gtk.Stock.ADD;
1389 this.el.icon_size = Gtk.IconSize.MENU;
1392 // user defined functions
1397 public class Xcls_EditProps : Object
1399 public Gtk.ScrolledWindow el;
1400 private Xcls_LeftProps _this;
1404 public bool editing;
1407 public Xcls_EditProps(Xcls_LeftProps _owner )
1410 _this.EditProps = this;
1411 this.el = new Gtk.ScrolledWindow( null, null );
1414 this.editing = false;
1416 // set gobject values
1417 this.el.shadow_type = Gtk.ShadowType.IN;
1418 var child_0 = new Xcls_view( _this );
1420 this.el.add ( child_0.el );
1426 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
1430 // user defined functions
1432 public class Xcls_view : Object
1434 public Gtk.TreeView el;
1435 private Xcls_LeftProps _this;
1439 public Xcls_PopoverProperty popover;
1442 public Xcls_view(Xcls_LeftProps _owner )
1446 this.el = new Gtk.TreeView();
1449 this.popover = null;
1451 // set gobject values
1452 this.el.tooltip_column = 3;
1453 this.el.enable_tree_lines = true;
1454 this.el.headers_visible = true;
1455 var child_0 = new Xcls_model( _this );
1457 this.el.set_model ( child_0.el );
1458 var child_1 = new Xcls_keycol( _this );
1460 this.el.append_column ( child_1.el );
1461 var child_2 = new Xcls_valcol( _this );
1463 this.el.append_column ( child_2.el );
1464 var child_3 = new Xcls_ContextMenu( _this );
1470 var selection = this.el.get_selection();
1471 selection.set_mode( Gtk.SelectionMode.SINGLE);
1474 var description = new Pango.FontDescription();
1475 description.set_size(10000);
1476 this.el.override_font(description);
1481 this.el.button_press_event.connect( ( ev) => {
1483 Gtk.TreeViewColumn col;
1488 // event x /y are relative to the widget..
1489 if (!this.el.get_path_at_pos((int)ev.x, (int) ev.y, out path, out col, out cell_x, out cell_y )) {
1490 GLib.debug("nothing selected on click");
1491 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
1492 this.el.get_selection().unselect_all();
1496 _this.before_edit();
1497 return false; //not on a element.
1501 // single click on name..
1502 //if (ev.type == Gdk.EventType.2BUTTON_PRESS && ev.button == 1 && col.title == "Name") {
1503 if (ev.button == 1 && col.title == "Property") {
1504 // need to shift down, as ev.y does not inclucde header apparently..
1505 // or popover might be trying to do a central?
1506 this.editPropertyDetails(path, (int) ev.y + 12);
1515 if (ev.type == Gdk.EventType.BUTTON_PRESS && ev.button == 3) {
1517 //if (col.title == "Value") {
1518 // _this.before_edit();
1522 var p = _this.ContextMenu;
1524 p.el.set_screen(Gdk.Screen.get_default());
1526 p.el.popup(null, null, null, ev.button, ev.time);
1527 //Seed.print("click:" + res.column.title);
1529 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
1531 this.el.get_selection().select_path(path);
1534 _this.before_edit();
1539 if (col.title != "Value") {
1540 GLib.debug("col title != Value");
1542 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
1543 this.el.get_selection().select_path(path);
1547 _this.before_edit();
1548 // XObject.error("column is not value?");
1549 return false; // ignore.. - key click.. ??? should we do this??
1553 // if the cell can be edited with a pulldown
1554 // then we should return true... - and let the start_editing handle it?
1561 // _this.before_edit(); <<< we really need to stop the other editor..
1562 _this.keyrender.el.stop_editing(false);
1563 _this.keyrender.el.editable =false;
1566 return _this.startEditingValue(path); // assumes selected row..
1575 // user defined functions
1576 public void editPropertyDetails (Gtk.TreePath path, int y) {
1581 _this.before_edit();
1582 _this.stop_editor();
1584 _this.keyrender.el.stop_editing(false);
1585 _this.keyrender.el.editable =false;
1587 _this.valrender.el.stop_editing(false);
1588 _this.valrender.el.editable =false;
1590 var mod = this.el.get_model();
1591 mod.get_iter (out iter, path);
1596 mod.get_value(iter,0, out gval);
1598 this.popover.show(_this.view.el, _this.node, (JsRender.NodeProp)gval, y);
1603 public class Xcls_model : Object
1605 public Gtk.TreeStore el;
1606 private Xcls_LeftProps _this;
1612 public Xcls_model(Xcls_LeftProps _owner )
1616 this.el = new Gtk.TreeStore( 5, typeof(JsRender.NodeProp), // 0 key type
1617 typeof(string), // 1 display_key
1618 typeof(string), // 2 display_value
1619 typeof(string), // 3 display_tooltip
1620 typeof(string) // 4 sortable value
1623 1, prop.to_display_name(),
1625 3, "<tt>" + GLib.Markup.escape_text(key + " " +kvalue) + "</tt>",
1633 // set gobject values
1636 // user defined functions
1639 public class Xcls_keycol : Object
1641 public Gtk.TreeViewColumn el;
1642 private Xcls_LeftProps _this;
1648 public Xcls_keycol(Xcls_LeftProps _owner )
1651 _this.keycol = this;
1652 this.el = new Gtk.TreeViewColumn();
1656 // set gobject values
1657 this.el.title = "Property";
1658 this.el.resizable = true;
1659 var child_0 = new Xcls_keyrender( _this );
1661 this.el.pack_start ( child_0.el , false );
1665 this.el.add_attribute(_this.keyrender.el , "markup", 1 ); // 1 is the key.
1666 //this.el.add_attribute(_this.keyrender.el , "text", 1 );
1669 // user defined functions
1671 public class Xcls_keyrender : Object
1673 public Gtk.CellRendererText el;
1674 private Xcls_LeftProps _this;
1680 public Xcls_keyrender(Xcls_LeftProps _owner )
1683 _this.keyrender = this;
1684 this.el = new Gtk.CellRendererText();
1688 // set gobject values
1691 // user defined functions
1695 public class Xcls_valcol : Object
1697 public Gtk.TreeViewColumn el;
1698 private Xcls_LeftProps _this;
1704 public Xcls_valcol(Xcls_LeftProps _owner )
1707 _this.valcol = this;
1708 this.el = new Gtk.TreeViewColumn();
1712 // set gobject values
1713 this.el.title = "Value";
1714 this.el.resizable = true;
1715 var child_0 = new Xcls_valrender( _this );
1717 this.el.pack_start ( child_0.el , true );
1726 this.el.add_attribute(_this.valrender.el , "text", 2 );
1731 // user defined functions
1733 public class Xcls_valrender : Object
1735 public Gtk.CellRendererCombo el;
1736 private Xcls_LeftProps _this;
1742 public Xcls_valrender(Xcls_LeftProps _owner )
1745 _this.valrender = this;
1746 this.el = new Gtk.CellRendererCombo();
1750 // set gobject values
1751 this.el.editable = false;
1752 this.el.text_column = 0;
1753 this.el.has_entry = true;
1754 var child_0 = new Xcls_valrendermodel( _this );
1756 this.el.model = child_0.el;
1759 this.el.editing_started.connect( ( editable, path) => {
1760 //_this.editing = true;
1761 GLib.debug("editing started called\n");
1762 if (!_this.allow_edit) {
1764 GLib.debug("val - editing_Started\n");
1765 this.el.editable = false; // make sure it's not editor...
1770 _this.allow_edit =false;
1773 if ( this.el.has_entry ) {
1776 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1781 // this.get('/LeftPanel.model').activePath = path;
1782 _this.model.el.get_value(iter,0, out gval);
1785 var prop = (JsRender.NodeProp)gval;
1786 var combo = (Gtk.ComboBox)editable;
1788 var entry = (Gtk.Entry) combo.get_child();
1789 entry.set_text(prop.val);
1793 this.el.edited.connect( (path, newtext) => {
1794 GLib.debug("Valrender - signal:edited\n");
1796 this.el.editable = false;
1800 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1803 _this.model.el.get_value(iter,0, out gval);
1804 var prop = (JsRender.NodeProp)gval;
1806 _this.updateIter(iter,prop);
1812 // user defined functions
1813 public void setOptions (string[] ar) {
1814 var m = _this.valrendermodel.el;
1817 for (var i =0; i < ar.length; i++) {
1819 m.set_value(iret, 0, ar[i]);
1824 public class Xcls_valrendermodel : Object
1826 public Gtk.ListStore el;
1827 private Xcls_LeftProps _this;
1833 public Xcls_valrendermodel(Xcls_LeftProps _owner )
1836 _this.valrendermodel = this;
1837 this.el = new Gtk.ListStore( 1, typeof(string) );
1841 // set gobject values
1844 // user defined functions
1849 public class Xcls_ContextMenu : Object
1852 private Xcls_LeftProps _this;
1858 public Xcls_ContextMenu(Xcls_LeftProps _owner )
1861 _this.ContextMenu = this;
1862 this.el = new Gtk.Menu();
1866 // set gobject values
1867 var child_0 = new Xcls_MenuItem37( _this );
1869 this.el.append ( child_0.el );
1872 // user defined functions
1874 public class Xcls_MenuItem37 : Object
1876 public Gtk.MenuItem el;
1877 private Xcls_LeftProps _this;
1883 public Xcls_MenuItem37(Xcls_LeftProps _owner )
1886 this.el = new Gtk.MenuItem();
1890 // set gobject values
1891 this.el.label = "Delete";
1894 this.el.activate.connect( ( ) =>{
1895 _this.deleteSelected();
1899 // user defined functions