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, JsRender.NodeProp prop);
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.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 void finish_editing () {
89 public bool startEditingValue ( Gtk.TreePath path) {
91 // ONLY return true if editing is allowed - eg. combo..
93 GLib.debug("start editing?\n");
94 if (!this.stop_editor()) {
95 GLib.debug("stop editor failed\n");
101 var mod = this.model.el;
102 mod.get_iter (out iter, path);
105 mod.get_value(iter, 0 , out gval);
106 var prop = (JsRender.NodeProp)gval;
110 var use_textarea = false;
112 //------------ things that require the text editor...
114 if (prop.ptype == JsRender.NodePropType.LISTENER) {
117 if (prop.ptype == JsRender.NodePropType.METHOD) {
120 if (prop.ptype == JsRender.NodePropType.RAW) { // raw string
123 if ( prop.name == "init" && prop.ptype == JsRender.NodePropType.SPECIAL) {
126 if (prop.val.length > 40) { // long value...
133 GLib.debug("Call show editor\n");
134 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
135 this.view.el.get_selection().select_path(path);
137 this.show_editor(file, node, prop);
146 var pal = this.file.project.palete;
149 var has_opts = pal.typeOptions(this.node.fqn(), prop.name, prop.rtype, out opts);
153 // others... - fill in options for true/false?
154 GLib.debug("turn on editing %s \n" , mod.get_path(iter).to_string());
156 // GLib.debug (ktype.up());
158 GLib.debug("start editing try/false)???");
159 this.valrender.el.has_entry = false;
161 this.valrender.setOptions(opts);
163 this.valrender.el.has_entry = false;
164 this.valrender.el.editable = true;
165 this.allow_edit = true;
166 GLib.Timeout.add_full(GLib.Priority.DEFAULT,100 , () => {
167 this.view.el.set_cursor_on_cell(
178 // see if type is a Enum.
185 this.valrender.setOptions(opts);
187 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
189 // at this point - work out the type...
190 // if its' a combo... then show the options..
191 this.valrender.el.has_entry = true;
193 this.valrender.el.editable = true;
196 this.allow_edit = true;
202 this.view.el.set_cursor_on_cell(
212 public void load (JsRender.JsRender file, JsRender.Node? node)
214 // not sure when to initialize this - we should do it on setting main window really.
215 if (this.view.popover == null) {
216 this.view.popover = new Xcls_PopoverProperty();
217 this.view.popover.mainwindow = _this.main_window;
223 GLib.debug("load leftprops\n");
229 this.model.el.clear();
231 //this.get('/RightEditor').el.hide();
238 //var provider = this.get('/LeftTree').getPaleteProvider();
245 // really need a way to sort the hashmap...
246 var m = this.model.el;
248 var miter = node.listeners.map_iterator();
251 while(miter.next()) {
253 m.append(out iter,null);
255 this.updateIter(iter, miter.get_value());
261 miter = node.props.map_iterator();
264 while(miter.next()) {
266 m.append(out iter,null);
267 this.updateIter(iter, miter.get_value());
270 GLib.debug("clear selection\n");
272 this.model.el.set_sort_column_id(4,Gtk.SortType.ASCENDING); // sort by real key..
274 this.view.el.get_selection().unselect_all();
280 public string keyFormat (string val, string type) {
282 // Glib.markup_escape_text(val);
284 if (type == "listener") {
285 return "<span font_weight=\"bold\" color=\"#660000\">" +
286 GLib.Markup.escape_text(val) +
290 if (val.length < 1) {
291 return "<span color=\"#FF0000\">--empty--</span>";
296 //# - object properties
298 // all of these... - display value is last element..
299 var ar = val.strip().split(" ");
302 var dval = GLib.Markup.escape_text(ar[ar.length-1]);
308 case '@': // signal // just bold balck?
309 if (dval[0] == '@') {
310 dval = dval.substring(1);
313 return @"<span font_weight=\"bold\">@ $dval</span>";
314 case '#': // object properties?
315 if (dval[0] == '#') {
316 dval = dval.substring(1);
318 return @"<span font_weight=\"bold\">$dval</span>";
320 if (dval[0] == '*') {
321 dval = dval.substring(1);
323 return @"<span color=\"#0000CC\" font_weight=\"bold\">$dval</span>";
325 if (dval[0] == '$') {
326 dval = dval.substring(1);
328 return @"<span style=\"italic\">$dval</span>";
329 case '|': // user defined methods
330 if (dval[0] == '|') {
331 dval = dval.substring(1);
333 return @"<span color=\"#008000\" font_weight=\"bold\">$dval</span>";
344 public void deleteSelected () {
351 var s = this.view.el.get_selection();
352 s.get_selected(out mod, out iter);
356 mod.get_value(iter, 0 , out gval);
357 var prop = (JsRender.NodeProp)gval;
360 case JsRender.NodePropType.LISTENER:
361 this.node.listeners.unset(prop.to_index_key());
365 this.node.props.unset(prop.to_index_key());
368 this.load(this.file, this.node);
372 public void startEditingKey ( Gtk.TreePath path) {
374 if (!this.stop_editor()) {
378 // others... - fill in options for true/false?
381 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
382 this.allow_edit = true;
383 this.keyrender.el.editable = true;
385 this.view.el.set_cursor_on_cell(
397 public void before_edit ()
400 GLib.debug("before edit - stop editing\n");
402 // these do not appear to trigger save...
403 _this.keyrender.el.stop_editing(false);
404 _this.keyrender.el.editable =false;
406 _this.valrender.el.stop_editing(false);
407 _this.valrender.el.editable =false;
410 // technicall stop the popup editor..
413 public void reload () {
414 this.load(this.file, this.node);
416 public void addProp (JsRender.NodeProp prop) {
417 // info includes key, val, skel, etype..
418 //console.dump(info);
419 //type = info.type.toLowerCase();
420 //var data = this.toJS();
425 if (prop.ptype == JsRender.NodePropType.LISTENER) {
426 if (this.node.listeners.has_key(prop.name)) {
429 this.node.listeners.set(prop.name,prop);
431 assert(this.node != null);
432 assert(this.node.props != null);
433 if (this.node.props.has_key(prop.to_index_key())) {
436 this.node.props.set(prop.to_index_key(),prop);
441 this.load(this.file, this.node);
445 /// need to find the row which I've just added..
448 var s = this.view.el.get_selection();
451 GLib.debug("trying to find new iter");
453 this.model.el.foreach((model, path, iter) => {
455 this.model.el.get_value(iter, 0 , out gval);
457 var iprop = (JsRender.NodeProp)gval;
458 if (iprop.to_index_key() != prop.to_index_key()) {
459 return false; // continue?
463 GLib.Timeout.add_full(GLib.Priority.DEFAULT,40 , () => {
465 if (prop.name == "") { // empty string for key name.
466 _this.view.editPropertyDetails(this.model.el.get_path(iter));
471 this.startEditingValue(this.model.el.get_path(iter));
474 //s.select_iter(iter);
482 public void updateIter (Gtk.TreeIter iter, JsRender.NodeProp prop) {
484 //print("update Iter %s, %s\n", key,kvalue);
486 var dl = prop.val.strip().split("\n");
488 var dis_val = dl.length > 1 ? (dl[0].strip()+ "...") : dl[0];
490 if (prop.ptype == JsRender.NodePropType.LISTENER) {
494 this.model.el.set(iter,
496 1, prop.to_display_name(),
498 3, "<tt>" + GLib.Markup.escape_text(prop.to_tooltip()) + "</tt>",
499 4, prop.to_sort_key(),
507 this.model.el.set(iter,
509 1, prop.to_display_name(),
511 3, "<tt>" + GLib.Markup.escape_text(prop.to_tooltip()) + "</tt>",
512 4, prop.to_sort_key(),
517 public class Xcls_Box2 : Object
520 private Xcls_LeftProps _this;
526 public Xcls_Box2(Xcls_LeftProps _owner )
529 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
533 // set gobject values
534 var child_0 = new Xcls_Label3( _this );
536 this.el.add ( child_0.el );
537 var child_1 = new Xcls_Button4( _this );
539 this.el.add ( child_1.el );
540 var child_2 = new Xcls_Button6( _this );
542 this.el.add ( child_2.el );
543 var child_3 = new Xcls_Button8( _this );
545 this.el.add ( child_3.el );
548 // user defined functions
550 public class Xcls_Label3 : Object
553 private Xcls_LeftProps _this;
559 public Xcls_Label3(Xcls_LeftProps _owner )
562 this.el = new Gtk.Label( "Add:" );
566 // set gobject values
567 this.el.margin_end = 5;
568 this.el.margin_start = 5;
571 // user defined functions
574 public class Xcls_Button4 : Object
576 public Gtk.Button el;
577 private Xcls_LeftProps _this;
583 public Xcls_Button4(Xcls_LeftProps _owner )
586 this.el = new Gtk.Button();
590 // set gobject values
591 this.el.hexpand = true;
592 this.el.always_show_image = true;
593 this.el.tooltip_text = "Add Property";
594 this.el.label = "Property";
595 var child_0 = new Xcls_Image5( _this );
597 this.el.set_image ( child_0.el );
600 this.el.clicked.connect( ( ) => {
602 _this.main_window.windowstate.showProps(
604 JsRender.NodePropType.PROP
610 // user defined functions
612 public class Xcls_Image5 : Object
615 private Xcls_LeftProps _this;
621 public Xcls_Image5(Xcls_LeftProps _owner )
624 this.el = new Gtk.Image();
628 // set gobject values
629 this.el.icon_name = "format-justify-left";
632 // user defined functions
636 public class Xcls_Button6 : Object
638 public Gtk.Button el;
639 private Xcls_LeftProps _this;
645 public Xcls_Button6(Xcls_LeftProps _owner )
648 this.el = new Gtk.Button();
652 // set gobject values
653 this.el.hexpand = true;
654 this.el.always_show_image = true;
655 this.el.tooltip_text = "Add Event Code";
656 this.el.label = "Event";
657 var child_0 = new Xcls_Image7( _this );
659 this.el.set_image ( child_0.el );
662 this.el.clicked.connect( ( ) => {
665 _this.main_window.windowstate.showProps(
667 JsRender.NodePropType.LISTENER
674 // user defined functions
676 public class Xcls_Image7 : Object
679 private Xcls_LeftProps _this;
685 public Xcls_Image7(Xcls_LeftProps _owner )
688 this.el = new Gtk.Image();
692 // set gobject values
693 this.el.icon_name = "appointment-new";
696 // user defined functions
700 public class Xcls_Button8 : Object
702 public Gtk.Button el;
703 private Xcls_LeftProps _this;
709 public Xcls_Button8(Xcls_LeftProps _owner )
712 this.el = new Gtk.Button();
716 // set gobject values
717 this.el.hexpand = true;
718 this.el.always_show_image = true;
719 this.el.label = "Other";
720 var child_0 = new Xcls_AddPropertyPopup( _this );
722 var child_1 = new Xcls_Image27( _this );
724 this.el.set_image ( child_1.el );
727 this.el.button_press_event.connect( (self, ev) => {
731 var p = _this.AddPropertyPopup;
732 p.el.set_screen(Gdk.Screen.get_default());
734 p.el.popup(null, null, null, ev.button, ev.time);
739 // user defined functions
741 public class Xcls_AddPropertyPopup : Object
744 private Xcls_LeftProps _this;
750 public Xcls_AddPropertyPopup(Xcls_LeftProps _owner )
753 _this.AddPropertyPopup = this;
754 this.el = new Gtk.Menu();
758 // set gobject values
759 var child_0 = new Xcls_MenuItem10( _this );
761 this.el.append ( child_0.el );
762 var child_1 = new Xcls_MenuItem11( _this );
764 this.el.append ( child_1.el );
765 var child_2 = new Xcls_MenuItem12( _this );
767 this.el.append ( child_2.el );
768 var child_3 = new Xcls_MenuItem13( _this );
770 this.el.append ( child_3.el );
771 var child_4 = new Xcls_MenuItem14( _this );
773 this.el.append ( child_4.el );
774 var child_5 = new Xcls_SeparatorMenuItem15( _this );
776 this.el.add ( child_5.el );
777 var child_6 = new Xcls_MenuItem16( _this );
779 this.el.append ( child_6.el );
780 var child_7 = new Xcls_MenuItem17( _this );
782 this.el.append ( child_7.el );
783 var child_8 = new Xcls_MenuItem18( _this );
785 this.el.append ( child_8.el );
786 var child_9 = new Xcls_SeparatorMenuItem19( _this );
788 this.el.add ( child_9.el );
789 var child_10 = new Xcls_MenuItem20( _this );
791 this.el.append ( child_10.el );
792 var child_11 = new Xcls_MenuItem21( _this );
794 this.el.append ( child_11.el );
795 var child_12 = new Xcls_MenuItem22( _this );
797 this.el.append ( child_12.el );
798 var child_13 = new Xcls_SeparatorMenuItem23( _this );
800 this.el.add ( child_13.el );
801 var child_14 = new Xcls_MenuItem24( _this );
803 this.el.append ( child_14.el );
804 var child_15 = new Xcls_MenuItem25( _this );
806 this.el.append ( child_15.el );
807 var child_16 = new Xcls_MenuItem26( _this );
809 this.el.append ( child_16.el );
812 // user defined functions
814 public class Xcls_MenuItem10 : Object
816 public Gtk.MenuItem el;
817 private Xcls_LeftProps _this;
823 public Xcls_MenuItem10(Xcls_LeftProps _owner )
826 this.el = new Gtk.MenuItem();
830 // set gobject values
831 this.el.tooltip_markup = "Using _this.{ID} will map to this element";
832 this.el.label = "id: _this.{ID} (Vala)";
835 this.el.activate.connect( () => {
836 // is this userdef or special??
837 _this.addProp( new JsRender.NodeProp.prop("id") );
841 // user defined functions
844 public class Xcls_MenuItem11 : Object
846 public Gtk.MenuItem el;
847 private Xcls_LeftProps _this;
853 public Xcls_MenuItem11(Xcls_LeftProps _owner )
856 this.el = new Gtk.MenuItem();
860 // set gobject values
861 this.el.tooltip_markup = "how to pack this element onto parent, (method, 2nd arg, 3rd arg) .. the 1st argument is filled by the element";
862 this.el.label = "pack: Pack method (Vala)";
865 this.el.activate.connect( ( ) => {
867 _this.addProp( new JsRender.NodeProp.special("pack", "add") );
871 // user defined functions
874 public class Xcls_MenuItem12 : Object
876 public Gtk.MenuItem el;
877 private Xcls_LeftProps _this;
883 public Xcls_MenuItem12(Xcls_LeftProps _owner )
886 this.el = new Gtk.MenuItem();
890 // set gobject values
891 this.el.tooltip_markup = "eg. \n\nnew Clutter.Image.from_file(.....)";
892 this.el.label = "ctor: Alterative to default contructor (Vala)";
895 this.el.activate.connect( ( ) => {
897 _this.addProp( new JsRender.NodeProp.special("ctor") );
901 // user defined functions
904 public class Xcls_MenuItem13 : Object
906 public Gtk.MenuItem el;
907 private Xcls_LeftProps _this;
913 public Xcls_MenuItem13(Xcls_LeftProps _owner )
916 this.el = new Gtk.MenuItem();
920 // set gobject values
921 this.el.tooltip_markup = "This code is called after the ctor";
922 this.el.label = "init: initialziation code (vala)";
925 this.el.activate.connect( ( ) => {
926 _this.addProp( new JsRender.NodeProp.special("init","{\n\n}\n" ) );
931 // user defined functions
934 public class Xcls_MenuItem14 : Object
936 public Gtk.MenuItem el;
937 private Xcls_LeftProps _this;
943 public Xcls_MenuItem14(Xcls_LeftProps _owner )
946 this.el = new Gtk.MenuItem();
950 // set gobject values
951 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";
952 this.el.label = "cms-id: (Roo JS/Pman library)";
955 this.el.activate.connect( () => {
957 _this.addProp( new JsRender.NodeProp.prop("cms-id","string", "" ) );
964 // user defined functions
967 public class Xcls_SeparatorMenuItem15 : Object
969 public Gtk.SeparatorMenuItem el;
970 private Xcls_LeftProps _this;
976 public Xcls_SeparatorMenuItem15(Xcls_LeftProps _owner )
979 this.el = new Gtk.SeparatorMenuItem();
983 // set gobject values
986 // user defined functions
989 public class Xcls_MenuItem16 : Object
991 public Gtk.MenuItem el;
992 private Xcls_LeftProps _this;
998 public Xcls_MenuItem16(Xcls_LeftProps _owner )
1001 this.el = new Gtk.MenuItem();
1005 // set gobject values
1006 this.el.tooltip_markup = "Add a user defined string property";
1007 this.el.label = "String";
1010 this.el.activate.connect( (self) => {
1012 _this.view.popover.show(
1015 new JsRender.NodeProp.prop("", "string", "") ,
1023 // user defined functions
1026 public class Xcls_MenuItem17 : Object
1028 public Gtk.MenuItem el;
1029 private Xcls_LeftProps _this;
1035 public Xcls_MenuItem17(Xcls_LeftProps _owner )
1038 this.el = new Gtk.MenuItem();
1042 // set gobject values
1043 this.el.tooltip_markup = "Add a user defined number property";
1044 this.el.label = "Number";
1047 this.el.activate.connect( ( ) =>{
1048 _this.view.popover.show(
1051 new JsRender.NodeProp.prop("", "int", "0") ,
1059 // user defined functions
1062 public class Xcls_MenuItem18 : Object
1064 public Gtk.MenuItem el;
1065 private Xcls_LeftProps _this;
1071 public Xcls_MenuItem18(Xcls_LeftProps _owner )
1074 this.el = new Gtk.MenuItem();
1078 // set gobject values
1079 this.el.tooltip_markup = "Add a user defined boolean property";
1080 this.el.label = "Boolean";
1083 this.el.activate.connect( ( ) =>{
1086 _this.view.popover.show(
1089 new JsRender.NodeProp.prop("", "bool", "true") ,
1097 // user defined functions
1100 public class Xcls_SeparatorMenuItem19 : Object
1102 public Gtk.SeparatorMenuItem el;
1103 private Xcls_LeftProps _this;
1109 public Xcls_SeparatorMenuItem19(Xcls_LeftProps _owner )
1112 this.el = new Gtk.SeparatorMenuItem();
1116 // set gobject values
1119 // user defined functions
1122 public class Xcls_MenuItem20 : Object
1124 public Gtk.MenuItem el;
1125 private Xcls_LeftProps _this;
1131 public Xcls_MenuItem20(Xcls_LeftProps _owner )
1134 this.el = new Gtk.MenuItem();
1138 // set gobject values
1139 this.el.tooltip_markup = "Add a user function boolean property";
1140 this.el.label = "Javascript Function";
1143 this.el.activate.connect( ( ) =>{
1145 _this.view.popover.show(
1148 new JsRender.NodeProp.jsmethod("") ,
1157 // user defined functions
1160 public class Xcls_MenuItem21 : Object
1162 public Gtk.MenuItem el;
1163 private Xcls_LeftProps _this;
1169 public Xcls_MenuItem21(Xcls_LeftProps _owner )
1172 this.el = new Gtk.MenuItem();
1176 // set gobject values
1177 this.el.tooltip_markup = "Add a user function boolean property";
1178 this.el.label = "Vala Method";
1181 this.el.activate.connect( ( ) =>{
1183 _this.view.popover.show(
1186 new JsRender.NodeProp.valamethod("") ,
1193 // user defined functions
1196 public class Xcls_MenuItem22 : Object
1198 public Gtk.MenuItem el;
1199 private Xcls_LeftProps _this;
1205 public Xcls_MenuItem22(Xcls_LeftProps _owner )
1208 this.el = new Gtk.MenuItem();
1212 // set gobject values
1213 this.el.tooltip_markup = "Add a vala signal";
1214 this.el.label = "Vala Signal";
1217 this.el.activate.connect( ( ) =>{
1218 _this.view.popover.show(
1221 new JsRender.NodeProp.sig("" ) ,
1228 // user defined functions
1231 public class Xcls_SeparatorMenuItem23 : Object
1233 public Gtk.SeparatorMenuItem el;
1234 private Xcls_LeftProps _this;
1240 public Xcls_SeparatorMenuItem23(Xcls_LeftProps _owner )
1243 this.el = new Gtk.SeparatorMenuItem();
1247 // set gobject values
1250 // user defined functions
1253 public class Xcls_MenuItem24 : Object
1255 public Gtk.MenuItem el;
1256 private Xcls_LeftProps _this;
1262 public Xcls_MenuItem24(Xcls_LeftProps _owner )
1265 this.el = new Gtk.MenuItem();
1269 // set gobject values
1270 this.el.tooltip_markup = "Add a flexy if (for HTML templates)";
1271 this.el.label = "Flexy - If";
1274 this.el.activate.connect( ( ) =>{
1275 _this.view.popover.show(
1278 new JsRender.NodeProp.prop("flexy:if", "string", "value_or_condition") ,
1287 // user defined functions
1290 public class Xcls_MenuItem25 : Object
1292 public Gtk.MenuItem el;
1293 private Xcls_LeftProps _this;
1299 public Xcls_MenuItem25(Xcls_LeftProps _owner )
1302 this.el = new Gtk.MenuItem();
1306 // set gobject values
1307 this.el.tooltip_markup = "Add a flexy include (for HTML templates)";
1308 this.el.label = "Flexy - Include";
1311 this.el.activate.connect( ( ) =>{
1312 _this.view.popover.show(
1315 new JsRender.NodeProp.prop("flexy:include", "string", "name_of_file.html") ,
1324 // user defined functions
1327 public class Xcls_MenuItem26 : Object
1329 public Gtk.MenuItem el;
1330 private Xcls_LeftProps _this;
1336 public Xcls_MenuItem26(Xcls_LeftProps _owner )
1339 this.el = new Gtk.MenuItem();
1343 // set gobject values
1344 this.el.tooltip_markup = "Add a flexy foreach (for HTML templates)";
1345 this.el.label = "Flexy - Foreach";
1348 this.el.activate.connect( ( ) =>{
1350 _this.view.popover.show(
1353 new JsRender.NodeProp.prop("flexy:foreach", "string", "array,key,value") ,
1362 // user defined functions
1366 public class Xcls_Image27 : Object
1368 public Gtk.Image el;
1369 private Xcls_LeftProps _this;
1375 public Xcls_Image27(Xcls_LeftProps _owner )
1378 this.el = new Gtk.Image();
1382 // set gobject values
1383 this.el.stock = Gtk.Stock.ADD;
1384 this.el.icon_size = Gtk.IconSize.MENU;
1387 // user defined functions
1392 public class Xcls_EditProps : Object
1394 public Gtk.ScrolledWindow el;
1395 private Xcls_LeftProps _this;
1399 public bool editing;
1402 public Xcls_EditProps(Xcls_LeftProps _owner )
1405 _this.EditProps = this;
1406 this.el = new Gtk.ScrolledWindow( null, null );
1409 this.editing = false;
1411 // set gobject values
1412 this.el.shadow_type = Gtk.ShadowType.IN;
1413 var child_0 = new Xcls_view( _this );
1415 this.el.add ( child_0.el );
1421 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
1425 // user defined functions
1427 public class Xcls_view : Object
1429 public Gtk.TreeView el;
1430 private Xcls_LeftProps _this;
1434 public Xcls_PopoverProperty popover;
1437 public Xcls_view(Xcls_LeftProps _owner )
1441 this.el = new Gtk.TreeView();
1444 this.popover = null;
1446 // set gobject values
1447 this.el.tooltip_column = 3;
1448 this.el.enable_tree_lines = true;
1449 this.el.headers_visible = true;
1450 var child_0 = new Xcls_model( _this );
1452 this.el.set_model ( child_0.el );
1453 var child_1 = new Xcls_keycol( _this );
1455 this.el.append_column ( child_1.el );
1456 var child_2 = new Xcls_valcol( _this );
1458 this.el.append_column ( child_2.el );
1459 var child_3 = new Xcls_ContextMenu( _this );
1465 var selection = this.el.get_selection();
1466 selection.set_mode( Gtk.SelectionMode.SINGLE);
1469 var description = new Pango.FontDescription();
1470 description.set_size(10000);
1471 this.el.override_font(description);
1476 this.el.button_press_event.connect( ( ev) => {
1478 Gtk.TreeViewColumn col;
1483 // event x /y are relative to the widget..
1484 if (!this.el.get_path_at_pos((int)ev.x, (int) ev.y, out path, out col, out cell_x, out cell_y )) {
1485 GLib.debug("nothing selected on click");
1486 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
1487 this.el.get_selection().unselect_all();
1491 _this.before_edit();
1492 return false; //not on a element.
1496 // single click on name..
1497 //if (ev.type == Gdk.EventType.2BUTTON_PRESS && ev.button == 1 && col.title == "Name") {
1498 if (ev.button == 1 && col.title == "Property") {
1499 // need to shift down, as ev.y does not inclucde header apparently..
1500 // or popover might be trying to do a central?
1501 this.editPropertyDetails(path, (int) ev.y + 12);
1510 if (ev.type == Gdk.EventType.BUTTON_PRESS && ev.button == 3) {
1512 //if (col.title == "Value") {
1513 // _this.before_edit();
1517 var p = _this.ContextMenu;
1519 p.el.set_screen(Gdk.Screen.get_default());
1521 p.el.popup(null, null, null, ev.button, ev.time);
1522 //Seed.print("click:" + res.column.title);
1524 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
1526 this.el.get_selection().select_path(path);
1529 _this.before_edit();
1534 if (col.title != "Value") {
1535 GLib.debug("col title != Value");
1537 GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
1538 this.el.get_selection().select_path(path);
1542 _this.before_edit();
1543 // XObject.error("column is not value?");
1544 return false; // ignore.. - key click.. ??? should we do this??
1548 // if the cell can be edited with a pulldown
1549 // then we should return true... - and let the start_editing handle it?
1556 // _this.before_edit(); <<< we really need to stop the other editor..
1557 _this.keyrender.el.stop_editing(false);
1558 _this.keyrender.el.editable =false;
1561 return _this.startEditingValue(path); // assumes selected row..
1570 // user defined functions
1571 public void editPropertyDetails (Gtk.TreePath path, int y) {
1576 _this.before_edit();
1577 _this.stop_editor();
1579 _this.keyrender.el.stop_editing(false);
1580 _this.keyrender.el.editable =false;
1582 _this.valrender.el.stop_editing(false);
1583 _this.valrender.el.editable =false;
1585 var mod = this.el.get_model();
1586 mod.get_iter (out iter, path);
1591 mod.get_value(iter,0, out gval);
1593 this.popover.show(_this.view.el, _this.node, (JsRender.NodeProp)gval, y);
1598 public class Xcls_model : Object
1600 public Gtk.TreeStore el;
1601 private Xcls_LeftProps _this;
1607 public Xcls_model(Xcls_LeftProps _owner )
1611 this.el = new Gtk.TreeStore( 5, typeof(JsRender.NodeProp), // 0 key type
1612 typeof(string), // 1 display_key
1613 typeof(string), // 2 display_value
1614 typeof(string), // 3 display_tooltip
1615 typeof(string) // 4 sortable value
1618 1, prop.to_display_name(),
1620 3, "<tt>" + GLib.Markup.escape_text(key + " " +kvalue) + "</tt>",
1628 // set gobject values
1631 // user defined functions
1634 public class Xcls_keycol : Object
1636 public Gtk.TreeViewColumn el;
1637 private Xcls_LeftProps _this;
1643 public Xcls_keycol(Xcls_LeftProps _owner )
1646 _this.keycol = this;
1647 this.el = new Gtk.TreeViewColumn();
1651 // set gobject values
1652 this.el.title = "Property";
1653 this.el.resizable = true;
1654 var child_0 = new Xcls_keyrender( _this );
1656 this.el.pack_start ( child_0.el , false );
1660 this.el.add_attribute(_this.keyrender.el , "markup", 1 ); // 1 is the key.
1661 //this.el.add_attribute(_this.keyrender.el , "text", 1 );
1664 // user defined functions
1666 public class Xcls_keyrender : Object
1668 public Gtk.CellRendererText el;
1669 private Xcls_LeftProps _this;
1675 public Xcls_keyrender(Xcls_LeftProps _owner )
1678 _this.keyrender = this;
1679 this.el = new Gtk.CellRendererText();
1683 // set gobject values
1686 // user defined functions
1690 public class Xcls_valcol : Object
1692 public Gtk.TreeViewColumn el;
1693 private Xcls_LeftProps _this;
1699 public Xcls_valcol(Xcls_LeftProps _owner )
1702 _this.valcol = this;
1703 this.el = new Gtk.TreeViewColumn();
1707 // set gobject values
1708 this.el.title = "Value";
1709 this.el.resizable = true;
1710 var child_0 = new Xcls_valrender( _this );
1712 this.el.pack_start ( child_0.el , true );
1721 this.el.add_attribute(_this.valrender.el , "text", 2 );
1726 // user defined functions
1728 public class Xcls_valrender : Object
1730 public Gtk.CellRendererCombo el;
1731 private Xcls_LeftProps _this;
1737 public Xcls_valrender(Xcls_LeftProps _owner )
1740 _this.valrender = this;
1741 this.el = new Gtk.CellRendererCombo();
1745 // set gobject values
1746 this.el.editable = false;
1747 this.el.text_column = 0;
1748 this.el.has_entry = true;
1749 var child_0 = new Xcls_valrendermodel( _this );
1751 this.el.model = child_0.el;
1754 this.el.editing_started.connect( ( editable, path) => {
1755 //_this.editing = true;
1756 GLib.debug("editing started called\n");
1757 if (!_this.allow_edit) {
1759 GLib.debug("val - editing_Started\n");
1760 this.el.editable = false; // make sure it's not editor...
1765 _this.allow_edit =false;
1768 if ( this.el.has_entry ) {
1771 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1776 // this.get('/LeftPanel.model').activePath = path;
1777 _this.model.el.get_value(iter,0, out gval);
1780 var prop = (JsRender.NodeProp)gval;
1781 var combo = (Gtk.ComboBox)editable;
1783 var entry = (Gtk.Entry) combo.get_child();
1784 entry.set_text(prop.val);
1788 this.el.edited.connect( (path, newtext) => {
1789 GLib.debug("Valrender - signal:edited\n");
1791 this.el.editable = false;
1795 _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1798 _this.model.el.get_value(iter,0, out gval);
1799 var prop = (JsRender.NodeProp)gval;
1801 _this.updateIter(iter,prop);
1807 // user defined functions
1808 public void setOptions (string[] ar) {
1809 var m = _this.valrendermodel.el;
1812 for (var i =0; i < ar.length; i++) {
1814 m.set_value(iret, 0, ar[i]);
1819 public class Xcls_valrendermodel : Object
1821 public Gtk.ListStore el;
1822 private Xcls_LeftProps _this;
1828 public Xcls_valrendermodel(Xcls_LeftProps _owner )
1831 _this.valrendermodel = this;
1832 this.el = new Gtk.ListStore( 1, typeof(string) );
1836 // set gobject values
1839 // user defined functions
1844 public class Xcls_ContextMenu : Object
1847 private Xcls_LeftProps _this;
1853 public Xcls_ContextMenu(Xcls_LeftProps _owner )
1856 _this.ContextMenu = this;
1857 this.el = new Gtk.Menu();
1861 // set gobject values
1862 var child_0 = new Xcls_MenuItem37( _this );
1864 this.el.append ( child_0.el );
1867 // user defined functions
1869 public class Xcls_MenuItem37 : Object
1871 public Gtk.MenuItem el;
1872 private Xcls_LeftProps _this;
1878 public Xcls_MenuItem37(Xcls_LeftProps _owner )
1881 this.el = new Gtk.MenuItem();
1885 // set gobject values
1886 this.el.label = "Delete";
1889 this.el.activate.connect( ( ) =>{
1890 _this.deleteSelected();
1894 // user defined functions