public class Xcls_LeftProps : Object
{
- public Gtk.Box el;
- private Xcls_LeftProps _this;
-
- public static Xcls_LeftProps singleton()
- {
- if (_LeftProps == null) {
- _LeftProps= new Xcls_LeftProps();
- }
- return _LeftProps;
- }
- public Xcls_AddPropertyPopup AddPropertyPopup;
- public Xcls_EditProps EditProps;
- public Xcls_view view;
- public Xcls_model model;
- public Xcls_keycol keycol;
- public Xcls_keyrender keyrender;
- public Xcls_valcol valcol;
- public Xcls_valrender valrender;
- public Xcls_valrendermodel valrendermodel;
- public Xcls_ContextMenu ContextMenu;
-
- // my vars (def)
- public bool allow_edit;
- public JsRender.JsRender file;
- public signal bool stop_editor ();
- public signal void show_editor (JsRender.JsRender file, JsRender.Node node, string type, string key);
- public signal void changed ();
- public signal void show_add_props (string type);
- public Xcls_MainWindow main_window;
- public JsRender.Node node;
-
- // ctor
- public Xcls_LeftProps()
- {
- _this = this;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
-
- // my vars (dec)
- this.allow_edit = false;
- this.main_window = null;
-
- // set gobject values
- this.el.homogeneous = false ;
- var child_0 = new Xcls_Box2( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , false,true,0 );
- var child_1 = new Xcls_EditProps( _this );
- child_1.ref();
- this.el.pack_end ( child_1.el , true,true,0 );
- }
-
- // user defined functions
- public void updateKey (string oldkey, string type, string key ) {
-
-
-
- _this.model.el.foreach((mod, path, iter) => {
-
-
-
-
- GLib.Value gvaltype, gval,kvalue;
- mod.get_value(iter, 1 , out gval); // one is key..
-
- mod.get_value(iter,0, out gvaltype);
-
- mod.get_value(iter,3, out kvalue);
-
- if (oldkey == ((string)gval) && type == ((string)gvaltype)) {
-
- //print("update iter type=%s, key=%s value=%s\n", type, key,(string) kvalue);
-
- this.updateIter(iter, type, key, (string)kvalue);
- return true;
- }
-
-
- return false;
- });
-
- this.changed();
-
-
- }
- public void before_edit ()
- {
-
- print("before edit - stop editing\n");
-
- // these do not appear to trigger save...
- _this.keyrender.el.stop_editing(false);
- _this.keyrender.el.editable =false;
-
- _this.valrender.el.stop_editing(false);
- _this.valrender.el.editable =false;
-
-
- // technicall stop the popup editor..
-
- }
- public string keySortFormat (string key) {
- // listeners first - with 0
- // specials
- if (key[0] == '*') {
- return "1 " + key;
- }
- // functions
-
- var bits = key.split(" ");
-
- if (key[0] == '|') {
- return "2 " + bits[bits.length -1];
- }
- // signals
- if (key[0] == '@') {
- return "3 " + bits[bits.length -1];
- }
-
- // props
- if (key[0] == '#') {
- return "4 " + bits[bits.length -1];
- }
- // the rest..
- return "5 " + bits[bits.length -1];
-
-
-
- }
- public void finish_editing () {
- //
- this.before_edit();
- }
- public bool startEditingValue ( Gtk.TreePath path) {
-
- // ONLY return true if editing is allowed - eg. combo..
-
- print("start editing?\n");
- if (!this.stop_editor()) {
- print("stop editor failed\n");
- return false;
- }
-
- Gtk.TreeIter iter;
-
- var mod = this.model.el;
- mod.get_iter (out iter, path);
-
- /*
- m.set(iter,
- 0, "listener",
- 1, miter.get_key(),
- 2, "<b>" + miter.get_key() + "</b>",
- 3, miter.get_value()
- );
-
- */
- GLib.Value gval;
- mod.get_value(iter, 3 , out gval);
- var val = (string)gval;
-
- mod.get_value(iter, 1 , out gval);
- var key = (string)gval;
-
-
- string kname, kflag, ktype;
- this.node.normalize_key(key, out kname, out kflag, out ktype);
-
-
- mod.get_value(iter, 0 , out gval);
- var type = (string)gval; // listerner or prop..
-
-
-
- var use_textarea = false;
-
- //------------ things that require the text editor...
-
- if (type == "listener") {
- use_textarea = true;
- }
- if (key.length > 0 && key[0] == '|') { // user defined method
- use_textarea = true;
- }
- if (key.length > 0 && key[0] == '$') { // raw string
- use_textarea = true;
- }
- if (key.length > 0 && key == "* init") {
- use_textarea = true;
- }
- if (val.length > 40) { // long value...
- use_textarea = true;
- }
-
-
-
- if (use_textarea) {
- print("Call show editor\n");
- GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
- this.view.el.get_selection().select_path(path);
-
- this.show_editor(file, node, type, key);
-
- return false;
- });
-
-
- return false;
- }
-
- var pal = this.file.project.palete;
-
- string[] opts;
- var has_opts = pal.typeOptions(this.node.fqn(), kname, ktype, out opts);
-
-
-
- // others... - fill in options for true/false?
- print("turn on editing %s \n" , mod.get_path(iter).to_string());
-
- print (ktype.up());
- if (has_opts) {
- print("start editing try/false)???");
- this.valrender.el.has_entry = false;
-
- this.valrender.setOptions(opts);
-
- this.valrender.el.has_entry = false;
- this.valrender.el.editable = true;
- this.allow_edit = true;
- GLib.Timeout.add_full(GLib.Priority.DEFAULT,100 , () => {
- this.view.el.set_cursor_on_cell(
- path,
- this.valcol.el,
- this.valrender.el,
- true
- );
- return false;
- });
- return true;
- }
-
- // see if type is a Enum.
-
-
-
-
-
- opts = { };
- this.valrender.setOptions(opts);
-
- GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
-
- // at this point - work out the type...
- // if its' a combo... then show the options..
- this.valrender.el.has_entry = true;
-
- this.valrender.el.editable = true;
-
-
- this.allow_edit = true;
-
-
-
-
-
- this.view.el.set_cursor_on_cell(
- path,
- this.valcol.el,
- this.valrender.el,
- true
- );
- return false;
- });
- return false;
- }
- public void load (JsRender.JsRender file, JsRender.Node? node)
- {
- print("load leftprops\n");
- this.before_edit();
- this.node = node;
- this.file = file;
-
-
- this.model.el.clear();
-
- //this.get('/RightEditor').el.hide();
- if (node ==null) {
- return ;
- }
-
-
-
- //var provider = this.get('/LeftTree').getPaleteProvider();
- Gtk.TreeIter iter;
-
- //typeof(string), // 0 key type
- //typeof(string), // 1 key
- //typeof(string), // 2 key (display)
- //typeof(string), // 3 value
- //typeof(string), // 4 value (display)
- //typeof(string), // 5 both (tooltip)
-
-
-
-
- // really need a way to sort the hashmap...
- var m = this.model.el;
-
- var miter = node.listeners.map_iterator();
- var i = 0;
-
- while(miter.next()) {
- i++;
- m.append(out iter,null);
-
- this.updateIter(iter, "listener", miter.get_key(), miter.get_value());
-
-
- }
-
-
- miter = node.props.map_iterator();
-
-
- while(miter.next()) {
- i++;
- m.append(out iter,null);
- this.updateIter(iter, "prop", miter.get_key(), miter.get_value());
-
- }
- print("clear selection\n");
- // clear selection?
- this.model.el.set_sort_column_id(6,Gtk.SortType.ASCENDING); // sort by real key..
-
- this.view.el.get_selection().unselect_all();
-
- var pane = _this.main_window.editpane.el;
- var try_size = (i * 25) + 60; // est. 20px per line + 40px header
-
- // max 80%...
- pane.set_position(
- ((try_size * 1.0f) / (pane.max_position * 1.0f)) > 0.8f ?
- (int) (pane.max_position * 0.2f) :
- pane.max_position-try_size);
-
-
- }
- public string keyFormat (string val, string type) {
-
- // Glib.markup_escape_text(val);
-
- if (type == "listener") {
- return "<span font_weight=\"bold\" color=\"#660000\">" +
- GLib.Markup.escape_text(val) +
- "</span>";
- }
- // property..
- if (val.length < 1) {
- return "<span color=\"#FF0000\">--empty--</span>";
- }
-
- //@ = signal
- //$ = property with
- //# - object properties
- //* = special
- // all of these... - display value is last element..
- var ar = val.strip().split(" ");
-
-
- var dval = GLib.Markup.escape_text(ar[ar.length-1]);
-
-
-
-
- switch(val[0]) {
- case '@': // signal // just bold balck?
- if (dval[0] == '@') {
- dval = dval.substring(1);
- }
-
- return @"<span font_weight=\"bold\">@ $dval</span>";
- case '#': // object properties?
- if (dval[0] == '#') {
- dval = dval.substring(1);
- }
- return @"<span font_weight=\"bold\">$dval</span>";
- case '*': // special
- if (dval[0] == '*') {
- dval = dval.substring(1);
- }
- return @"<span color=\"#0000CC\" font_weight=\"bold\">$dval</span>";
- case '$':
- if (dval[0] == '$') {
- dval = dval.substring(1);
- }
- return @"<span style=\"italic\">$dval</span>";
- case '|': // user defined methods
- if (dval[0] == '|') {
- dval = dval.substring(1);
- }
- return @"<span color=\"#008000\" font_weight=\"bold\">$dval</span>";
-
-
-
- default:
- return dval;
- }
-
-
-
- }
- public void deleteSelected () {
-
- Gtk.TreeIter iter;
- Gtk.TreeModel mod;
-
- var s = this.view.el.get_selection();
- s.get_selected(out mod, out iter);
-
-
- GLib.Value gval;
- mod.get_value(iter, 0 , out gval);
- var type = (string)gval;
-
- mod.get_value(iter, 1 , out gval);
- var key = (string)gval;
-
- switch(type) {
- case "listener":
- this.node.listeners.unset(key);
- break;
-
- case "props":
- this.node.props.unset(key);
- break;
- }
- this.load(this.file, this.node);
-
- _this.changed();
- }
- public void startEditingKey ( Gtk.TreePath path) {
-
- if (!this.stop_editor()) {
- return;
- }
-
- // others... - fill in options for true/false?
-
-
- GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
- this.allow_edit = true;
- this.keyrender.el.editable = true;
-
- this.view.el.set_cursor_on_cell(
- path,
- this.keycol.el,
- this.keyrender.el,
- true
- );
-
- return false;
- });
-
-
- }
- public void addProp (string in_type, string key, string value, string value_type) {
- // info includes key, val, skel, etype..
- //console.dump(info);
- //type = info.type.toLowerCase();
- //var data = this.toJS();
-
- var type = in_type == "signals" ? "listener" : in_type;
-
- var fkey = (value_type.length > 0 ? value_type + " " : "") + key;
-
- if (type == "listener") {
- if (this.node.listeners.has_key(key)) {
- return;
- }
- this.node.listeners.set(key,value);
- } else {
- assert(this.node != null);
- assert(this.node.props != null);
- if (this.node.props.has_key(fkey)) {
- return;
- }
- this.node.props.set(fkey,value);
- }
-
-
- // add a row???
- this.load(this.file, this.node);
-
-
-
- /// need to find the row which I've just added..
-
-
- var s = this.view.el.get_selection();
- s.unselect_all();
-
- print("trying to find new iter");
-
- this.model.el.foreach((model, path, iter) => {
- GLib.Value gval;
-
- this.model.el.get_value(iter, 0 , out gval);
- if ((string)gval != type) {
- print("not type: %s = %s\n", (string)gval , type);
- return false;
- }
- this.model.el.get_value(iter, 1 , out gval);
- if ((string)gval != fkey) {
- print("not key: %s = %s\n", (string)gval , fkey);
- return false;
- }
- // delay this?
- GLib.Timeout.add_full(GLib.Priority.DEFAULT,40 , () => {
-
- this.startEditingValue(this.model.el.get_path(iter));
- return false;
- });
- //s.select_iter(iter);
- return true;
- });
-
-
-
-
- }
- public void updateIter (Gtk.TreeIter iter, string type, string key, string kvalue) {
-
- //print("update Iter %s, %s\n", key,kvalue);
- //typeof(string), // 0 key type
- //typeof(string), // 1 key
- //typeof(string), // 2 key (display)
- //typeof(string), // 3 value
- //typeof(string), // 4 value (display)
- //typeof(string), // 5 both (tooltip)
- //typeof(string), // 6 key (sort)
-
- var dl = kvalue.strip().split("\n");
-
- var dis_val = dl.length > 1 ? (dl[0].strip()+ "...") : dl[0];
-
- if (type == "listener") {
-
-
-
- this.model.el.set(iter,
- 0, type,
- 1, key,
- 2, this.keyFormat(key ,type),
- 3, kvalue,
- 4, dis_val,
- 5, "<tt>" + GLib.Markup.escape_text(key + " " +kvalue) + "</tt>",
- 6, "0 " + key
- );
- return;
- }
-
-
-
- this.model.el.set(iter,
- 0, "props",
- 1, key,
- 2, this.keyFormat(key , "prop"),
- 3, kvalue,
- 4, dis_val,
- 5, "<tt>" + GLib.Markup.escape_text(key + " " + kvalue) + "</tt>",
- 6, this.keySortFormat(key)
- );
- }
- public class Xcls_Box2 : Object
- {
- public Gtk.Box el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Box2(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- var child_0 = new Xcls_Button3( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- }
-
- // user defined functions
- }
- public class Xcls_Button3 : Object
- {
- public Gtk.Button el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Button3(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- this.el.hexpand = true;
- var child_0 = new Xcls_Box4( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- var child_1 = new Xcls_AddPropertyPopup( _this );
- child_1.ref();
-
- //listeners
- this.el.button_press_event.connect( (self, ev) => {
- _this.before_edit();
-
-
- var p = _this.AddPropertyPopup;
- p.el.set_screen(Gdk.Screen.get_default());
- p.el.show_all();
- p.el.popup(null, null, null, ev.button, ev.time);
- return true;
- });
- }
-
- // user defined functions
- }
- public class Xcls_Box4 : Object
- {
- public Gtk.Box el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Box4(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- var child_0 = new Xcls_Image5( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- var child_1 = new Xcls_Label6( _this );
- child_1.ref();
- this.el.add ( child_1.el );
- }
-
- // user defined functions
- }
- public class Xcls_Image5 : Object
- {
- public Gtk.Image el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Image5(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.Image();
-
- // my vars (dec)
-
- // set gobject values
- this.el.stock = Gtk.Stock.ADD;
- this.el.icon_size = Gtk.IconSize.MENU;
- }
-
- // user defined functions
- }
-
- public class Xcls_Label6 : Object
- {
- public Gtk.Label el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Label6(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "Other" );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
-
- public class Xcls_AddPropertyPopup : Object
- {
- public Gtk.Menu el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_AddPropertyPopup(Xcls_LeftProps _owner )
- {
- _this = _owner;
- _this.AddPropertyPopup = this;
- this.el = new Gtk.Menu();
-
- // my vars (dec)
-
- // set gobject values
- var child_0 = new Xcls_MenuItem8( _this );
- child_0.ref();
- this.el.append ( child_0.el );
- var child_1 = new Xcls_MenuItem9( _this );
- child_1.ref();
- this.el.append ( child_1.el );
- var child_2 = new Xcls_MenuItem10( _this );
- child_2.ref();
- this.el.append ( child_2.el );
- var child_3 = new Xcls_MenuItem11( _this );
- child_3.ref();
- this.el.append ( child_3.el );
- var child_4 = new Xcls_MenuItem12( _this );
- child_4.ref();
- this.el.append ( child_4.el );
- var child_5 = new Xcls_SeparatorMenuItem13( _this );
- child_5.ref();
- this.el.add ( child_5.el );
- var child_6 = new Xcls_MenuItem14( _this );
- child_6.ref();
- this.el.append ( child_6.el );
- var child_7 = new Xcls_MenuItem15( _this );
- child_7.ref();
- this.el.append ( child_7.el );
- var child_8 = new Xcls_MenuItem16( _this );
- child_8.ref();
- this.el.append ( child_8.el );
- var child_9 = new Xcls_SeparatorMenuItem17( _this );
- child_9.ref();
- this.el.add ( child_9.el );
- var child_10 = new Xcls_MenuItem18( _this );
- child_10.ref();
- this.el.append ( child_10.el );
- var child_11 = new Xcls_MenuItem19( _this );
- child_11.ref();
- this.el.append ( child_11.el );
- var child_12 = new Xcls_MenuItem20( _this );
- child_12.ref();
- this.el.append ( child_12.el );
- var child_13 = new Xcls_SeparatorMenuItem21( _this );
- child_13.ref();
- this.el.add ( child_13.el );
- var child_14 = new Xcls_MenuItem22( _this );
- child_14.ref();
- this.el.append ( child_14.el );
- var child_15 = new Xcls_MenuItem23( _this );
- child_15.ref();
- this.el.append ( child_15.el );
- var child_16 = new Xcls_MenuItem24( _this );
- child_16.ref();
- this.el.append ( child_16.el );
- }
-
- // user defined functions
- }
- public class Xcls_MenuItem8 : Object
- {
- public Gtk.MenuItem el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_MenuItem8(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.MenuItem();
-
- // my vars (dec)
-
- // set gobject values
- this.el.tooltip_markup = "Using _this.{ID} will map to this element";
- this.el.label = "id: _this.{ID} (Vala)";
-
- //listeners
- this.el.activate.connect( () => {
- _this.addProp( "prop", "id", "", "");
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_MenuItem9 : Object
- {
- public Gtk.MenuItem el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_MenuItem9(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.MenuItem();
-
- // my vars (dec)
-
- // set gobject values
- this.el.tooltip_markup = "how to pack this element onto parent, (method, 2nd arg, 3rd arg) .. the 1st argument is filled by the element";
- this.el.label = "pack: Pack method (Vala)";
-
- //listeners
- this.el.activate.connect( ( ) => {
-
- _this.addProp( "prop", "pack","add", "*");
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_MenuItem10 : Object
- {
- public Gtk.MenuItem el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_MenuItem10(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.MenuItem();
-
- // my vars (dec)
-
- // set gobject values
- this.el.tooltip_markup = "eg. \n\nnew Clutter.Image.from_file(.....)";
- this.el.label = "ctor: Alterative to default contructor (Vala)";
+ public Gtk.Box el;
+ private Xcls_LeftProps _this;
+
+ public static Xcls_LeftProps singleton()
+ {
+ if (_LeftProps == null) {
+ _LeftProps= new Xcls_LeftProps();
+ }
+ return _LeftProps;
+ }
+ public Xcls_addpop addpop;
+ public Xcls_EditProps EditProps;
+ public Xcls_view view;
+ public Xcls_deletemenu deletemenu;
+ public Xcls_selmodel selmodel;
+ public Xcls_model model;
+ public Xcls_keycol keycol;
+ public Xcls_valcol valcol;
+ public Xcls_ContextMenu ContextMenu;
+
+ // my vars (def)
+ public bool loading;
+ public bool allow_edit;
+ public signal void show_add_props (string type);
+ public signal bool stop_editor ();
+ public Xcls_MainWindow main_window;
+ public int last_error_counter;
+ public signal void changed ();
+ public JsRender.JsRender file;
+ public JsRender.Node node;
+ public signal void show_editor (JsRender.JsRender file, JsRender.Node node, JsRender.NodeProp prop);
+
+ // ctor
+ public Xcls_LeftProps()
+ {
+ _this = this;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+
+ // my vars (dec)
+ this.loading = false;
+ this.allow_edit = false;
+ this.main_window = null;
+ this.last_error_counter = -1;
+
+ // set gobject values
+ this.el.homogeneous = false ;
+ this.el.hexpand = true;
+ this.el.vexpand = true;
+ var child_1 = new Xcls_Box2( _this );
+ child_1.ref();
+ this.el.append( child_1.el );
+ new Xcls_EditProps( _this );
+ this.el.append( _this.EditProps.el );
+ }
+
+ // user defined functions
+ public string keySortFormat (string key) {
+ // listeners first - with 0
+ // specials
+ if (key[0] == '*') {
+ return "1 " + key;
+ }
+ // functions
+
+ var bits = key.split(" ");
+
+ if (key[0] == '|') {
+ return "2 " + bits[bits.length -1];
+ }
+ // signals
+ if (key[0] == '@') {
+ return "3 " + bits[bits.length -1];
+ }
+
+ // props
+ if (key[0] == '#') {
+ return "4 " + bits[bits.length -1];
+ }
+ // the rest..
+ return "5 " + bits[bits.length -1];
+
+
+
+ }
+ public void updateErrors () {
+ var file = this.file;
+ if (file == null) {
+ return;
+ }
+ var ar = file.getErrors();
+ if (ar == null || ar.size < 1) {
+ if (this.last_error_counter != file.error_counter) {
+ this.removeErrors();
+ }
+
+ this.last_error_counter = file.error_counter ;
+
+ return;
+ }
+ if (this.last_error_counter == file.error_counter) {
+ return;
+ }
+ this.removeErrors();
+
+ foreach(var diag in ar) {
+
+
+ // print("get inter\n");
+ var node= file.lineToNode( (int)diag.range.start.line) ;
+ if (node == null || node.oid != this.node.oid) {
+ continue;
+ }
+ var prop = node.lineToProp( (int)diag.range.start.line) ;
+
+ var row = _this.selmodel.propToRow(prop);
+ if (row < 0) {
+ continue;
+ }
+ var w = this.view.getWidgetAtRow(row);
+ if (w == null) {
+ return;
+ }
+ var ed = diag.category.down();
+ if (ed != "err" && w.has_css_class("node-err")) {
+ continue;
+ }
+ if (ed == "err" && w.has_css_class("node-warn")) {
+ w.remove_css_class("node-warn");
+ }
+ if (ed == "err" && w.has_css_class("node-depr")) {
+ w.remove_css_class("node-depr");
+ }
+ if (!w.has_css_class("node-"+ ed)) {
+ w.add_css_class("node-" + ed);
+ }
+
+ }
+
+ }
+ public string keyFormat (string val, string type) {
+
+ // Glib.markup_escape_text(val);
+
+ if (type == "listener") {
+ return "<span font_weight=\"bold\" color=\"#660000\">" +
+ GLib.Markup.escape_text(val) +
+ "</span>";
+ }
+ // property..
+ if (val.length < 1) {
+ return "<span color=\"#FF0000\">--empty--</span>";
+ }
+
+ //@ = signal
+ //$ = property with
+ //# - object properties
+ //* = special
+ // all of these... - display value is last element..
+ var ar = val.strip().split(" ");
+
+
+ var dval = GLib.Markup.escape_text(ar[ar.length-1]);
+
+
+
+
+ switch(val[0]) {
+ case '@': // signal // just bold balck?
+ if (dval[0] == '@') {
+ dval = dval.substring(1);
+ }
+
+ return @"<span font_weight=\"bold\">@ $dval</span>";
+ case '#': // object properties?
+ if (dval[0] == '#') {
+ dval = dval.substring(1);
+ }
+ return @"<span font_weight=\"bold\">$dval</span>";
+ case '*': // special
+ if (dval[0] == '*') {
+ dval = dval.substring(1);
+ }
+ return @"<span color=\"#0000CC\" font_weight=\"bold\">$dval</span>";
+ case '$':
+ if (dval[0] == '$') {
+ dval = dval.substring(1);
+ }
+ return @"<span style=\"italic\">$dval</span>";
+ case '|': // user defined methods
+ if (dval[0] == '|') {
+ dval = dval.substring(1);
+ }
+ return @"<span color=\"#008000\" font_weight=\"bold\">$dval</span>";
+
+
+
+ default:
+ return dval;
+ }
+
+
+
+ }
+ public void deleteSelected () {
+
+ return;
+ /*
+
+ Gtk.TreeIter iter;
+ Gtk.TreeModel mod;
+
+ var s = this.view.el.get_selection();
+ s.get_selected(out mod, out iter);
+
+
+ GLib.Value gval;
+ mod.get_value(iter, 0 , out gval);
+ var prop = (JsRender.NodeProp)gval;
+ if (prop == null) {
+ this.load(this.file, this.node);
+ return;
+ }
+ // stop editor after fetching property - otherwise prop is null.
+ this.stop_editor();
+
+
+ switch(prop.ptype) {
+ case JsRender.NodePropType.LISTENER:
+ this.node.listeners.unset(prop.to_index_key());
+ break;
+
+ default:
+ this.node.props.unset(prop.to_index_key());
+ break;
+ }
+ this.load(this.file, this.node);
+
+ _this.changed();
+ */
+ }
+ public void removeErrors () {
+ var child = this.view.el.get_first_child();
+
+ var reading_header = true;
+
+ while (child != null) {
+ //GLib.debug("Got %s", child.get_type().name());
+
+ if (reading_header) {
+
+
+ if (child.get_type().name() != "GtkColumnListView") {
+
+ child = child.get_next_sibling();
+ continue;
+ }
+ // should be columnlistview
+ child = child.get_first_child();
+
+
+
+ reading_header = false;
+ continue;
+ }
+
+ if (child.has_css_class("node-err")) {
+ child.remove_css_class("node-err");
+ }
+ if (child.has_css_class("node-warn")) {
+ child.remove_css_class("node-warn");
+ }
+
+ if (child.has_css_class("node-depr")) {
+ child.remove_css_class("node-depr");
+ }
+
+ child = child.get_next_sibling();
+ }
+ //GLib.debug("Rturning null");
+
+ }
+ public void load (JsRender.JsRender file, JsRender.Node? node)
+ {
+ // not sure when to initialize this - we should do it on setting main window really.
+
+ this.loading = true;
+ if (this.view.popover == null) {
+ this.view.popover = new Xcls_PopoverProperty();
+ this.view.popover.mainwindow = _this.main_window;
+ }
+
+
+ if (this.node != null) {
+ this.node.dupeProps(); // ensures removeall will not do somethign silly
+
+ }
+
+ GLib.debug("load leftprops\n");
+
+ this.node = node;
+ this.file = file;
+
+
+ this.model.el.remove_all();
+
+ //this.get('/RightEditor').el.hide();
+ if (node ==null) {
+ return ;
+ }
+ node.loadProps(this.model.el);
+
+
+ //GLib.debug("clear selection\n");
+
+ this.loading = false;
+ this.selmodel.el.set_selected(Gtk.INVALID_LIST_POSITION);
+ this.updateErrors();
+ // clear selection?
+ //this.model.el.set_sort_column_id(4,Gtk.SortType.ASCENDING); // sort by real key..
+
+ // this.view.el.get_selection().unselect_all();
+
+ // _this.keycol.el.set_max_width(_this.EditProps.el.get_allocated_width()/ 2);
+ // _this.valcol.el.set_max_width(_this.EditProps.el.get_allocated_width()/ 2);
+
+ }
+ public class Xcls_Box2 : Object
+ {
+ public Gtk.Box el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Box2(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.hexpand = true;
+ var child_1 = new Xcls_Label3( _this );
+ child_1.ref();
+ this.el.append( child_1.el );
+ var child_2 = new Xcls_Button4( _this );
+ child_2.ref();
+ this.el.append( child_2.el );
+ var child_3 = new Xcls_Button5( _this );
+ child_3.ref();
+ this.el.append( child_3.el );
+ var child_4 = new Xcls_MenuButton6( _this );
+ child_4.ref();
+ this.el.append( child_4.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Label3 : Object
+ {
+ public Gtk.Label el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Label3(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Label( "Add:" );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.margin_end = 5;
+ this.el.margin_start = 5;
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_Button4 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+ public bool always_show_image;
+
+ // ctor
+ public Xcls_Button4(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+ this.always_show_image = true;
+
+ // set gobject values
+ this.el.icon_name = "format-justify-left";
+ this.el.hexpand = true;
+ this.el.tooltip_text = "Add Property";
+ this.el.label = "Property";
+
+ //listeners
+ this.el.clicked.connect( ( ) => {
+
+ _this.main_window.windowstate.showProps(
+ _this.view.el,
+ JsRender.NodePropType.PROP
+ );
+
+ });
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_Button5 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+ public bool always_show_image;
+
+ // ctor
+ public Xcls_Button5(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+ this.always_show_image = true;
+
+ // set gobject values
+ this.el.icon_name = "appointment-new";
+ this.el.hexpand = true;
+ this.el.tooltip_text = "Add Event Code";
+ this.el.label = "Event";
+
+ //listeners
+ this.el.clicked.connect( ( ) => {
+
+
+ _this.main_window.windowstate.showProps(
+ _this.view.el,
+ JsRender.NodePropType.LISTENER
+ );
+
+
+ });
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_MenuButton6 : Object
+ {
+ public Gtk.MenuButton el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_MenuButton6(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.MenuButton();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.label = "Other";
+ new Xcls_addpop( _this );
+ this.el.popover = _this.addpop.el;
+ }
+
+ // user defined functions
+ }
+ public class Xcls_addpop : Object
+ {
+ public Gtk.Popover el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_addpop(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ _this.addpop = this;
+ this.el = new Gtk.Popover();
+
+ // my vars (dec)
+
+ // set gobject values
+ var child_1 = new Xcls_Box8( _this );
+ this.el.child = child_1.el;
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Box8 : Object
+ {
+ public Gtk.Box el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Box8(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+
+ // my vars (dec)
+
+ // set gobject values
+ var child_1 = new Xcls_Button9( _this );
+ child_1.ref();
+ this.el.append( child_1.el );
+ var child_2 = new Xcls_Button11( _this );
+ child_2.ref();
+ this.el.append( child_2.el );
+ var child_3 = new Xcls_Button13( _this );
+ child_3.ref();
+ this.el.append( child_3.el );
+ var child_4 = new Xcls_Button15( _this );
+ child_4.ref();
+ this.el.append( child_4.el );
+ var child_5 = new Xcls_Button17( _this );
+ child_5.ref();
+ this.el.append( child_5.el );
+ var child_6 = new Xcls_Separator19( _this );
+ child_6.ref();
+ this.el.append( child_6.el );
+ var child_7 = new Xcls_Button20( _this );
+ child_7.ref();
+ this.el.append( child_7.el );
+ var child_8 = new Xcls_Button22( _this );
+ child_8.ref();
+ this.el.append( child_8.el );
+ var child_9 = new Xcls_Button24( _this );
+ child_9.ref();
+ this.el.append( child_9.el );
+ var child_10 = new Xcls_Separator26( _this );
+ child_10.ref();
+ this.el.append( child_10.el );
+ var child_11 = new Xcls_Button27( _this );
+ child_11.ref();
+ this.el.append( child_11.el );
+ var child_12 = new Xcls_Button29( _this );
+ child_12.ref();
+ this.el.append( child_12.el );
+ var child_13 = new Xcls_Button31( _this );
+ child_13.ref();
+ this.el.append( child_13.el );
+ var child_14 = new Xcls_Separator33( _this );
+ child_14.ref();
+ this.el.append( child_14.el );
+ var child_15 = new Xcls_Button34( _this );
+ child_15.ref();
+ this.el.append( child_15.el );
+ var child_16 = new Xcls_Button36( _this );
+ child_16.ref();
+ this.el.append( child_16.el );
+ var child_17 = new Xcls_Button38( _this );
+ child_17.ref();
+ this.el.append( child_17.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Button9 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Button9(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.has_frame = false;
+ var child_1 = new Xcls_Label10( _this );
+ this.el.child = child_1.el;
+
+ //listeners
+ this.el.clicked.connect( () => {
+ _this.addpop.el.hide();
+ // is this userdef or special??
+ var add = new JsRender.NodeProp.prop("id");
+ if (_this.node.has_prop_key(add)) {
+ return;
+ }
+
+ _this.node.add_prop( add );
+
+ _this.view.editProp( add );
+
+ });
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Label10 : Object
+ {
+ public Gtk.Label el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Label10(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Label( "id: _this.{ID} (Vala)" );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.halign = Gtk.Align.START;
+ this.el.tooltip_text = "Using _this.{ID} will map to this element";
+ }
+
+ // user defined functions
+ }
+
+
+ public class Xcls_Button11 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Button11(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.has_frame = false;
+ var child_1 = new Xcls_Label12( _this );
+ this.el.child = child_1.el;
+
+ //listeners
+ this.el.clicked.connect( ( ) => {
+
+
+ _this.addpop.el.hide();
+ // is this userdef or special??
+ var add = new JsRender.NodeProp.special("pack", "add");
+ if (_this.node.has_prop_key(add)) {
+ return;
+ }
+
+ _this.node.add_prop( add );
+
+ _this.view.editProp( add );
+
+
+ });
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Label12 : Object
+ {
+ public Gtk.Label el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Label12(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Label( "pack: Pack method (Vala)" );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.halign = Gtk.Align.START;
+ this.el.tooltip_text = "how to pack this element onto parent, (method, 2nd arg, 3rd arg) .. the 1st argument is filled by the element";
+ }
+
+ // user defined functions
+ }
+
+
+ public class Xcls_Button13 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Button13(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.has_frame = false;
+ var child_1 = new Xcls_Label14( _this );
+ this.el.child = child_1.el;
+
+ //listeners
+ this.el.clicked.connect( ( ) => {
+
+ _this.addpop.el.hide();
+ // is this userdef or special??
+ var add = new JsRender.NodeProp.special("ctor");
+ if (_this.node.has_prop_key(add)) {
+ return;
+ }
+
+ _this.node.add_prop( add );
+
+ _this.view.editProp( add );
+
+ });
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Label14 : Object
+ {
+ public Gtk.Label el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Label14(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Label( "ctor: Alterative to default contructor (Vala)" );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.halign = Gtk.Align.START;
+ this.el.tooltip_text = "eg. \n\nnew Clutter.Image.from_file(.....)";
+ }
+
+ // user defined functions
+ }
+
+
+ public class Xcls_Button15 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Button15(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.has_frame = false;
+ var child_1 = new Xcls_Label16( _this );
+ this.el.child = child_1.el;
+
+ //listeners
+ this.el.clicked.connect( ( ) => {
+
+ _this.addpop.el.hide();
+ // is this userdef or special??
+ var add = new JsRender.NodeProp.special("init","{\n\n}\n" ) ;
+ if (_this.node.has_prop_key(add)) {
+ return;
+ }
+
+ _this.node.add_prop( add );
+
+ _this.view.editProp( add );
+ });
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Label16 : Object
+ {
+ public Gtk.Label el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Label16(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Label( "init: initialziation code (vala)" );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.halign = Gtk.Align.START;
+ this.el.tooltip_text = "This code is called after the ctor";
+ }
+
+ // user defined functions
+ }
+
+
+ public class Xcls_Button17 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
- //listeners
- this.el.activate.connect( ( ) => {
-
- _this.addProp( "prop", "ctor","", "*");
- });
- }
- // user defined functions
- }
+ // my vars (def)
- public class Xcls_MenuItem11 : Object
- {
- public Gtk.MenuItem el;
- private Xcls_LeftProps _this;
+ // ctor
+ public Xcls_Button17(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+ // my vars (dec)
- // my vars (def)
+ // set gobject values
+ this.el.has_frame = false;
+ var child_1 = new Xcls_Label18( _this );
+ this.el.child = child_1.el;
+
+ //listeners
+ this.el.clicked.connect( () => {
+ _this.addpop.el.hide();
+
+ // is this userdef or special??
+ var add = new JsRender.NodeProp.prop("cms-id","string", "" ) ;
+ if (_this.node.has_prop_key(add)) {
+ return;
+ }
+
+ _this.node.add_prop( add );
+
+ _this.view.editProp( add );
+
+ });
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Label18 : Object
+ {
+ public Gtk.Label el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Label18(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Label( "cms-id: (Roo JS/Pman library)" );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.halign = Gtk.Align.START;
+ this.el.tooltip_text = "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";
+ }
+
+ // user defined functions
+ }
- // ctor
- public Xcls_MenuItem11(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.MenuItem();
- // my vars (dec)
+ public class Xcls_Separator19 : Object
+ {
+ public Gtk.Separator el;
+ private Xcls_LeftProps _this;
- // set gobject values
- this.el.tooltip_markup = "This code is called after the ctor";
- this.el.label = "init: initialziation code (vala)";
- //listeners
- this.el.activate.connect( ( ) => {
-
- _this.addProp( "prop", "init", "{\n\n}\n", "*" );
- });
- }
+ // my vars (def)
- // user defined functions
- }
+ // ctor
+ public Xcls_Separator19(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Separator( Gtk.Orientation.HORIZONTAL );
- public class Xcls_MenuItem12 : Object
- {
- public Gtk.MenuItem el;
- private Xcls_LeftProps _this;
+ // my vars (dec)
+ // set gobject values
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_Button20 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_Button20(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.has_frame = false;
+ var child_1 = new Xcls_Label21( _this );
+ this.el.child = child_1.el;
+
+ //listeners
+ this.el.clicked.connect( (self) => {
+ _this.addpop.el.hide();
+ _this.view.popover.show(
+ _this.view.el,
+ _this.node,
+ new JsRender.NodeProp.prop("", "string", "") ,
+ -1,
+ true
+ );
+
+ });
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Label21 : Object
+ {
+ public Gtk.Label el;
+ private Xcls_LeftProps _this;
- // ctor
- public Xcls_MenuItem12(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.MenuItem();
- // my vars (dec)
+ // my vars (def)
- // set gobject values
- 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";
- this.el.label = "cms-id: (Roo JS/Pman library)";
+ // ctor
+ public Xcls_Label21(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Label( "String" );
- //listeners
- this.el.activate.connect( () => {
- _this.addProp( "prop", "cms-id", "", "string");
- });
- }
+ // my vars (dec)
- // user defined functions
- }
+ // set gobject values
+ this.el.halign = Gtk.Align.START;
+ this.el.tooltip_text = "Add a user defined string property";
+ }
- public class Xcls_SeparatorMenuItem13 : Object
- {
- public Gtk.SeparatorMenuItem el;
- private Xcls_LeftProps _this;
+ // user defined functions
+ }
- // my vars (def)
+ public class Xcls_Button22 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Button22(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.has_frame = false;
+ var child_1 = new Xcls_Label23( _this );
+ this.el.child = child_1.el;
+
+ //listeners
+ this.el.clicked.connect( ( ) =>{
+
+ _this.addpop.el.hide();
+ _this.view.popover.show(
+ _this.view.el,
+ _this.node,
+ new JsRender.NodeProp.prop("", "int", "0") ,
+ -1,
+ true
+ );
+
+ });
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Label23 : Object
+ {
+ public Gtk.Label el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Label23(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Label( "Number" );
+
+ // my vars (dec)
- // ctor
- public Xcls_SeparatorMenuItem13(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.SeparatorMenuItem();
+ // set gobject values
+ this.el.halign = Gtk.Align.START;
+ this.el.tooltip_text = "Add a user defined number property";
+ }
- // my vars (dec)
+ // user defined functions
+ }
- // set gobject values
- }
- // user defined functions
- }
+ public class Xcls_Button24 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
- public class Xcls_MenuItem14 : Object
- {
- public Gtk.MenuItem el;
- private Xcls_LeftProps _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_Button24(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
- // ctor
- public Xcls_MenuItem14(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.MenuItem();
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ this.el.has_frame = false;
+ var child_1 = new Xcls_Label25( _this );
+ this.el.child = child_1.el;
+
+ //listeners
+ this.el.clicked.connect( ( ) =>{
+
+ _this.addpop.el.hide();
+ _this.view.popover.show(
+ _this.view.el,
+ _this.node,
+ new JsRender.NodeProp.prop("", "bool", "true") ,
+ -1,
+ true
+ );
+
+ });
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Label25 : Object
+ {
+ public Gtk.Label el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Label25(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Label( "Boolean" );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.halign = Gtk.Align.START;
+ this.el.tooltip_text = "Add a user defined boolean property";
+ }
+
+ // user defined functions
+ }
- // set gobject values
- this.el.tooltip_markup = "Add a user defined string property";
- this.el.label = "String";
- //listeners
- this.el.activate.connect( (self) => {
-
- _this.addProp( "prop", "XXXX", "","string");
-
- });
- }
+ public class Xcls_Separator26 : Object
+ {
+ public Gtk.Separator el;
+ private Xcls_LeftProps _this;
- // user defined functions
- }
- public class Xcls_MenuItem15 : Object
- {
- public Gtk.MenuItem el;
- private Xcls_LeftProps _this;
+ // my vars (def)
+ // ctor
+ public Xcls_Separator26(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Separator( Gtk.Orientation.HORIZONTAL );
- // my vars (def)
+ // my vars (dec)
- // ctor
- public Xcls_MenuItem15(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.MenuItem();
+ // set gobject values
+ }
- // my vars (dec)
+ // user defined functions
+ }
+
+ public class Xcls_Button27 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
- // set gobject values
- this.el.tooltip_markup = "Add a user defined number property";
- this.el.label = "Number";
- //listeners
- this.el.activate.connect( ( ) =>{
-
- _this.addProp("prop", "XXX", "0", "int");
- });
- }
+ // my vars (def)
- // user defined functions
- }
+ // ctor
+ public Xcls_Button27(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
- public class Xcls_MenuItem16 : Object
- {
- public Gtk.MenuItem el;
- private Xcls_LeftProps _this;
+ // my vars (dec)
+
+ // set gobject values
+ this.el.has_frame = false;
+ var child_1 = new Xcls_Label28( _this );
+ this.el.child = child_1.el;
+
+ //listeners
+ this.el.clicked.connect( ( ) =>{
+ _this.addpop.el.hide();
+ _this.view.popover.show(
+ _this.view.el,
+ _this.node,
+ new JsRender.NodeProp.jsmethod("") ,
+ -1,
+ true
+ );
+
+
+ });
+ }
+ // user defined functions
+ }
+ public class Xcls_Label28 : Object
+ {
+ public Gtk.Label el;
+ private Xcls_LeftProps _this;
- // my vars (def)
- // ctor
- public Xcls_MenuItem16(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.MenuItem();
+ // my vars (def)
- // my vars (dec)
+ // ctor
+ public Xcls_Label28(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Label( "Javascript Function" );
- // set gobject values
- this.el.tooltip_markup = "Add a user defined boolean property";
- this.el.label = "Boolean";
+ // my vars (dec)
- //listeners
- this.el.activate.connect( ( ) =>{
-
- _this.addProp( "prop", "XXX", "true", "bool");
- });
- }
+ // set gobject values
+ this.el.halign = Gtk.Align.START;
+ this.el.tooltip_text = "Add a javascript function";
+ }
- // user defined functions
- }
+ // user defined functions
+ }
+
+
+ public class Xcls_Button29 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
- public class Xcls_SeparatorMenuItem17 : Object
- {
- public Gtk.SeparatorMenuItem el;
- private Xcls_LeftProps _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_Button29(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
- // ctor
- public Xcls_SeparatorMenuItem17(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.SeparatorMenuItem();
+ // my vars (dec)
+
+ // set gobject values
+ this.el.has_frame = false;
+ var child_1 = new Xcls_Label30( _this );
+ this.el.child = child_1.el;
- // my vars (dec)
+ //listeners
+ this.el.clicked.connect( ( ) =>{
+ _this.addpop.el.hide();
+ _this.view.popover.show(
+ _this.view.el,
+ _this.node,
+ new JsRender.NodeProp.valamethod("") ,
+ -1,
+ true
+ );
+ });
+ }
- // set gobject values
- }
+ // user defined functions
+ }
+ public class Xcls_Label30 : Object
+ {
+ public Gtk.Label el;
+ private Xcls_LeftProps _this;
- // user defined functions
- }
- public class Xcls_MenuItem18 : Object
- {
- public Gtk.MenuItem el;
- private Xcls_LeftProps _this;
+ // my vars (def)
+ // ctor
+ public Xcls_Label30(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Label( "Vala Method" );
- // my vars (def)
+ // my vars (dec)
- // ctor
- public Xcls_MenuItem18(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.MenuItem();
+ // set gobject values
+ this.el.halign = Gtk.Align.START;
+ this.el.tooltip_text = "Add a user defined method to a object";
+ }
- // my vars (dec)
+ // user defined functions
+ }
- // set gobject values
- this.el.tooltip_markup = "Add a user function boolean property";
- this.el.label = "Javascript Function";
- //listeners
- this.el.activate.connect( ( ) =>{
-
- _this.addProp("prop", "XXXX", "function() { }", "| function");
- });
- }
+ public class Xcls_Button31 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
- // user defined functions
- }
- public class Xcls_MenuItem19 : Object
- {
- public Gtk.MenuItem el;
- private Xcls_LeftProps _this;
+ // my vars (def)
+ // ctor
+ public Xcls_Button31(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
- // my vars (def)
+ // my vars (dec)
- // ctor
- public Xcls_MenuItem19(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.MenuItem();
+ // set gobject values
+ this.el.has_frame = false;
+ var child_1 = new Xcls_Label32( _this );
+ this.el.child = child_1.el;
- // my vars (dec)
+ //listeners
+ this.el.clicked.connect( ( ) =>{
+ _this.addpop.el.hide();
+ _this.view.popover.show(
+ _this.view.el,
+ _this.node,
+ new JsRender.NodeProp.sig("" ) ,
+ -1,
+ true
+ );
+ });
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Label32 : Object
+ {
+ public Gtk.Label el;
+ private Xcls_LeftProps _this;
- // set gobject values
- this.el.tooltip_markup = "Add a user function boolean property";
- this.el.label = "Vala Method";
- //listeners
- this.el.activate.connect( ( ) =>{
-
- _this.addProp( "prop", "XXXX", "() {\n\n}\n", "| return_type");
- });
- }
+ // my vars (def)
- // user defined functions
- }
+ // ctor
+ public Xcls_Label32(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Label( "Vala Signal" );
+
+ // my vars (dec)
- public class Xcls_MenuItem20 : Object
- {
- public Gtk.MenuItem el;
- private Xcls_LeftProps _this;
+ // set gobject values
+ this.el.halign = Gtk.Align.START;
+ this.el.tooltip_text = "Add a user defined signal to a object";
+ }
+ // user defined functions
+ }
- // my vars (def)
- // ctor
- public Xcls_MenuItem20(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.MenuItem();
+ public class Xcls_Separator33 : Object
+ {
+ public Gtk.Separator el;
+ private Xcls_LeftProps _this;
- // my vars (dec)
- // set gobject values
- this.el.tooltip_markup = "Add a vala signal";
- this.el.label = "Vala Signal";
+ // my vars (def)
- //listeners
- this.el.activate.connect( ( ) =>{
-
- _this.addProp( "prop", "XXXX", "()", "@ void");
- });
- }
+ // ctor
+ public Xcls_Separator33(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Separator( Gtk.Orientation.HORIZONTAL );
- // user defined functions
- }
+ // my vars (dec)
- public class Xcls_SeparatorMenuItem21 : Object
- {
- public Gtk.SeparatorMenuItem el;
- private Xcls_LeftProps _this;
+ // set gobject values
+ }
+ // user defined functions
+ }
+
+ public class Xcls_Button34 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
- // my vars (def)
- // ctor
- public Xcls_SeparatorMenuItem21(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.SeparatorMenuItem();
+ // my vars (def)
- // my vars (dec)
+ // ctor
+ public Xcls_Button34(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
- // set gobject values
- }
+ // set gobject values
+ this.el.has_frame = false;
+ var child_1 = new Xcls_Label35( _this );
+ this.el.child = child_1.el;
+
+ //listeners
+ this.el.clicked.connect( ( ) =>{
+ _this.addpop.el.hide();
+ _this.view.popover.show(
+ _this.view.el,
+ _this.node,
+ new JsRender.NodeProp.prop("flexy:if", "string", "value_or_condition") ,
+ -1,
+ true
+ );
+
+
+ });
+ }
- // user defined functions
- }
+ // user defined functions
+ }
+ public class Xcls_Label35 : Object
+ {
+ public Gtk.Label el;
+ private Xcls_LeftProps _this;
- public class Xcls_MenuItem22 : Object
- {
- public Gtk.MenuItem el;
- private Xcls_LeftProps _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_Label35(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Label( "Flexy - If" );
- // ctor
- public Xcls_MenuItem22(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.MenuItem();
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ this.el.halign = Gtk.Align.START;
+ this.el.tooltip_text = "Add a flexy if (for HTML templates)";
+ }
- // set gobject values
- this.el.tooltip_markup = "Add a flexy if (for HTML templates)";
- this.el.label = "Flexy - If";
+ // user defined functions
+ }
+
+
+ public class Xcls_Button36 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Button36(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.has_frame = false;
+ var child_1 = new Xcls_Label37( _this );
+ this.el.child = child_1.el;
+
+ //listeners
+ this.el.clicked.connect( ( ) =>{
+ _this.addpop.el.hide();
+ _this.view.popover.show(
+ _this.view.el,
+ _this.node,
+ new JsRender.NodeProp.prop("flexy:include", "string", "name_of_file.html") ,
+ -1,
+ true
+ );
+
+
+ });
+ }
- //listeners
- this.el.activate.connect( ( ) =>{
-
- _this.addProp("prop", "flexy:if", "value_or_condition", "string");
- });
- }
+ // user defined functions
+ }
+ public class Xcls_Label37 : Object
+ {
+ public Gtk.Label el;
+ private Xcls_LeftProps _this;
- // user defined functions
- }
- public class Xcls_MenuItem23 : Object
- {
- public Gtk.MenuItem el;
- private Xcls_LeftProps _this;
+ // my vars (def)
+ // ctor
+ public Xcls_Label37(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Label( "Flexy - Include" );
- // my vars (def)
+ // my vars (dec)
+
+ // set gobject values
+ this.el.halign = Gtk.Align.START;
+ this.el.tooltip_text = "Add a flexy include (for HTML templates)";
+ }
- // ctor
- public Xcls_MenuItem23(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.MenuItem();
+ // user defined functions
+ }
- // my vars (dec)
- // set gobject values
- this.el.tooltip_markup = "Add a flexy include (for HTML templates)";
- this.el.label = "Flexy - Include";
+ public class Xcls_Button38 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
- //listeners
- this.el.activate.connect( ( ) =>{
-
- _this.addProp("prop", "flexy:include", "name_of_file.html", "string");
- });
- }
- // user defined functions
- }
+ // my vars (def)
- public class Xcls_MenuItem24 : Object
- {
- public Gtk.MenuItem el;
- private Xcls_LeftProps _this;
+ // ctor
+ public Xcls_Button38(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+ // my vars (dec)
- // my vars (def)
+ // set gobject values
+ this.el.has_frame = false;
+ this.el.tooltip_markup = "Add a flexy include (for HTML templates)";
+ var child_1 = new Xcls_Label39( _this );
+ this.el.child = child_1.el;
- // ctor
- public Xcls_MenuItem24(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.MenuItem();
+ //listeners
+ this.el.clicked.connect( ( ) =>{
+ _this.addpop.el.hide();
+ _this.view.popover.show(
+ _this.view.el,
+ _this.node,
+ new JsRender.NodeProp.prop("flexy:if", "string", "value_or_condition") ,
+ -1,
+ true
+ );
+
+ });
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Label39 : Object
+ {
+ public Gtk.Label el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Label39(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Label( "Flexy - Foreach" );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.halign = Gtk.Align.START;
+ this.el.tooltip_text = "Add a flexy foreach (for HTML templates)";
+ }
+
+ // user defined functions
+ }
+
+
+
+
+
+
+ public class Xcls_EditProps : Object
+ {
+ public Gtk.ScrolledWindow el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+ public bool editing;
+
+ // ctor
+ public Xcls_EditProps(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ _this.EditProps = this;
+ this.el = new Gtk.ScrolledWindow();
+
+ // my vars (dec)
+ this.editing = false;
+
+ // set gobject values
+ this.el.hexpand = true;
+ this.el.vexpand = true;
+ new Xcls_view( _this );
+ this.el.set_child ( _this.view.el );
+
+ // init method
+
+ {
+
+ this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
+ }
+ }
+
+ // user defined functions
+ }
+ public class Xcls_view : Object
+ {
+ public Gtk.ColumnView el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+ public Gtk.CssProvider css;
+ public Xcls_PopoverProperty popover;
+
+ // ctor
+ public Xcls_view(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ _this.view = this;
+ new Xcls_selmodel( _this );
+ this.el = new Gtk.ColumnView( _this.selmodel.el );
+
+ // my vars (dec)
+ this.popover = null;
+
+ // set gobject values
+ this.el.name = "leftprops-view";
+ this.el.single_click_activate = false;
+ this.el.hexpand = true;
+ this.el.vexpand = true;
+ this.el.show_row_separators = true;
+ new Xcls_deletemenu( _this );
+ var child_3 = new Xcls_GestureClick45( _this );
+ child_3.ref();
+ this.el.add_controller( child_3.el );
+ var child_4 = new Xcls_GestureClick46( _this );
+ child_4.ref();
+ this.el.add_controller( child_4.el );
+ new Xcls_keycol( _this );
+ this.el.append_column ( _this.keycol.el );
+ new Xcls_valcol( _this );
+ this.el.append_column ( _this.valcol.el );
+ new Xcls_ContextMenu( _this );
+
+ // init method
+
+ {
+
+ this.css = new Gtk.CssProvider();
+
+ this.css.load_from_string("
+ #leftprops-view { font-size: 12px;}
+
+ #leftprops-view dropdown button {
+ min-height: 16px;
+ outline-offset : 0;
+ }
+ #leftprops-view cell dropdown label {
+ padding-top:0px;
+ padding-bottom:0px;
+ }
+ #leftprops-view cell {
+ padding-top:2px;
+ padding-bottom:2px;
+ }
+ #leftprops-view cell label, #leftprops-view cell editablelable {
+ padding-top:4px;
+ padding-bottom:4px;
+ }");
+
+ Gtk.StyleContext.add_provider_for_display(
+ this.el.get_display(),
+ this.css,
+ Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
+ );
+
+
+ }
+ }
+
+ // user defined functions
+ public Gtk.Widget? getWidgetAtRow (uint row) {
+ /*
+
+ from https://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465
+ var colview = gesture.widget;
+ var line_no = check_list_widget(colview, x,y);
+ if (line_no > -1) {
+ var item = colview.model.get_item(line_no);
+
+ }
+ */
+ GLib.debug("Get Widget At Row %d", (int)row);
+ var child = this.el.get_first_child();
+ var line_no = -1;
+ var reading_header = true;
+
+ while (child != null) {
+ GLib.debug("Got %s", child.get_type().name());
+ if (reading_header) {
+
+
+ if (child.get_type().name() != "GtkColumnListView") {
+ child = child.get_next_sibling();
+ continue;
+ }
+ child = child.get_first_child();
+ reading_header = false;
+ continue;
+ }
+ if (child.get_type().name() != "GtkColumnViewRowWidget") {
+ child = child.get_next_sibling();
+ continue;
+ }
+ line_no++;
+ if (line_no == row) {
+ GLib.debug("Returning widget %s", child.get_type().name());
+ return (Gtk.Widget)child;
+ }
+ child = child.get_next_sibling();
+ }
+ GLib.debug("Rturning null");
+ return null;
+
+ }
+ public void editProp (JsRender.NodeProp prop)
+ {
+ var sm = _this.selmodel.el;
+
+ var sr = -1;
+ GLib.debug("finding node");
+ _this.selmodel.selectProp(prop);
+
+ for (var i = 0 ; i < sm.n_items; i++) {
+ var r = (JsRender.NodeProp)sm.get_item(i);
+ if (r.equals(prop)) {
+ sr = i;
+ break;
+ }
+ }
+ if (sr < 0) {
+ GLib.debug("finding node - cant find it");
+
+ return;
+ }
+ var r = this.getWidgetAtRow(sr);
+ GLib.debug("r = %s", r.get_type().name());
+ var ca = r.get_first_child();
+ var ll = (Gtk.Label)ca.get_first_child();
+ var cb = ca.get_next_sibling();
+ var b = cb.get_first_child();
+ var e = (Gtk.EditableLabel) b.get_first_child();
+ var l = (Gtk.Label) e.get_next_sibling();
+ var d = (Gtk.DropDown) l.get_next_sibling();
+
+ GLib.debug("row key = %s", ll.label);
+ if (e.get_visible()) {
+ _this.stop_editor();
+ e.start_editing();
+ //GLib.Timeout.add_once(500, () => {
+ // var st = (Gtk.Stack) e.get_first_child();
+ // var ed = (Gtk.Entry) st.get_visible_child();
+ // ed.grab_focus_without_selecting();
+ //});
+ return;
+ }
+ if (d.get_visible()) {
+ _this.stop_editor();
+ d.activate();
+ return;
+ }
+ if (l.get_visible()) {
+ _this.stop_editor();
+ _this.show_editor(_this.file, prop.parent, prop);
+
+ }
+
+
+
+ //gtkcolumnviewrowwidget
+ // cell widet
+ // cell widget
+ // box
+ // entry / label / dropdown
+
+
+ }
+ public int getColAt (double x, double y) {
+ /*
+
+ from https://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465
+
+ */
+ //Gtk.Allocation alloc = { 0, 0, 0, 0 };
+ var child = this.el.get_first_child();
+
+ var col = 0;
+ var offx = 0;
+ while (child != null) {
+ GLib.debug("Got %s", child.get_type().name());
+
+ if (child.get_type().name() == "GtkColumnViewRowWidget") {
+ child = child.get_first_child();
+ continue;
+ }
+
+ //child.get_allocation(out alloc);
+ if (x < (child.get_width() + offx)) {
+ return col;
+ }
+ offx += child.get_width();
+ col++;
+ child = child.get_next_sibling();
+ }
+
+
+ return -1;
+
+ }
+ public int getRowAt (double x, double in_y, out string pos) {
+
+
+
+
+ /*
+
+ from https://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465
+ var colview = gesture.widget;
+ var line_no = check_list_widget(colview, x,y);
+ if (line_no > -1) {
+ var item = colview.model.get_item(line_no);
+
+ }
+ */
+
+
+ //GLib.debug("offset = %d y = %d", (int) voff, (int) in_y);
+ var y = in_y + _this.EditProps.el.vadjustment.value;
+ var child = this.el.get_first_child();
+ //Gtk.Allocation alloc = { 0, 0, 0, 0 };
+ var line_no = -1;
+ var reading_header = true;
+ var real_y = 0;
+ var header_height = 0;
+ pos = "none";
+ var h = 0;
+ while (child != null) {
+ //GLib.debug("Got %s", child.get_type().name());
+ if (reading_header) {
+
+
+ if (child.get_type().name() != "GtkColumnListView") {
+ h += child.get_height();
+ child = child.get_next_sibling();
+ continue;
+ }
+ // should be columnlistview
+ child = child.get_first_child();
+ //GLib.debug("header height=%d", h);
+ header_height = h;
+
+ reading_header = false;
+ continue;
+ }
+
+ if (child.get_type().name() != "GtkColumnViewRowWidget") {
+ child = child.get_next_sibling();
+ continue;
+ }
+
+ if (y < header_height) {
+ return -1;
+ }
+
+ line_no++;
+ var hh = child.get_height();
+ if (child.has_css_class("node-err") ||
+ child.has_css_class("node-warn") ||
+ child.has_css_class("node-depr")) {
+ hh += 10;
+
+ }
+
+ //child.get_allocation(out alloc);
+ //GLib.debug("got cell xy = %d,%d w,h= %d,%d", alloc.x, alloc.y, alloc.width, alloc.height);
+ //GLib.debug("row %d y= %d %s", line_no, (int) (header_height + alloc.y),
+
+ // child.visible ? "VIS" : "hidden");
+
+ if (y > (header_height + real_y) && y <= (header_height + real_y + hh) ) {
+ if (y > ( header_height + real_y + (hh * 0.8))) {
+ pos = "below";
+ } else if (y > ( header_height + real_y + (hh * 0.2))) {
+ pos = "over";
+ } else {
+ pos = "above";
+ }
+ GLib.debug("getRowAt return : %d, %s", line_no, pos);
+ return line_no;
+ }
+
+
+ if (real_y + hh > y) {
+ return -1;
+ }
+ real_y += hh;
+ child = child.get_next_sibling();
+ }
+ return -1;
+
+ }
+ }
+ public class Xcls_deletemenu : Object
+ {
+ public Gtk.Popover el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_deletemenu(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ _this.deletemenu = this;
+ this.el = new Gtk.Popover();
+
+ // my vars (dec)
+
+ // set gobject values
+ var child_1 = new Xcls_Box43( _this );
+ this.el.child = child_1.el;
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Box43 : Object
+ {
+ public Gtk.Box el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Box43(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+
+ // my vars (dec)
+
+ // set gobject values
+ var child_1 = new Xcls_Button44( _this );
+ child_1.ref();
+ this.el.append( child_1.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Button44 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Button44(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.label = "Delete";
+
+ //listeners
+ this.el.clicked.connect( ( ) => {
+
+
+ var n = (JsRender.NodeProp) _this.selmodel.el.selected_item;
+
+ _this.deletemenu.el.hide();
+ _this.node.remove_prop(n);
+ });
+ }
+
+ // user defined functions
+ }
+
+
+
+ public class Xcls_GestureClick45 : Object
+ {
+ public Gtk.GestureClick el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_GestureClick45(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.GestureClick();
+
+ // my vars (dec)
+
+ // set gobject values
+
+ //listeners
+ this.el.pressed.connect( (n_press, in_x, in_y) => {
+
+ GLib.debug("Prssed %d", (int) this.el.get_current_button());
+
+ var col = _this.view.getColAt(in_x, in_y);
+ if (col != 0) {
+ return;
+ }
+ string pos;
+ var row = _this.view.getRowAt(in_x, in_y, out pos);
+
+ if (row < 0) {
+ return;
+
+ }
+ GLib.debug("hit row %d", row);
+ var prop = _this.selmodel.getPropAt(row);
+ _this.selmodel.selectProp(prop);
+
+ //var point_at = _this.view.getWidgetAtRow(row);
+
+ // need to shift down, as ev.y does not inclucde header apparently..
+ // or popover might be trying to do a central?
+ // _this.view.editPropertyDetails(prop, (int) in_y + 12);
+ _this.stop_editor();
+ _this.view.popover.show(
+ _this.view.el,
+ _this.node, prop,
+ (int)in_y);
+
+
+
+ });
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_GestureClick46 : Object
+ {
+ public Gtk.GestureClick el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_GestureClick46(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.GestureClick();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.button = 3;
+
+ //listeners
+ this.el.pressed.connect( (n_press, in_x, in_y) => {
+
+
+
+ string pos;
+ var row = _this.view.getRowAt(in_x, in_y, out pos);
+
+ if (row < 0) {
+ return;
+
+ }
+
+ _this.stop_editor();
+ GLib.debug("hit row %d", row);
+ var prop = _this.selmodel.getPropAt(row);
+ _this.selmodel.selectProp(prop);
+
+
+
+ GLib.debug("Prssed %d", (int) this.el.get_current_button());
+ //_this.deletemenu.el.set_parent(_this.view.el);
+ if (_this.deletemenu.el.parent == null) {
+ _this.deletemenu.el.set_parent(_this.main_window.el);
+ }
+
+
+
+ _this.deletemenu.el.set_offset(
+ (int)in_x - _this.view.el.get_width() ,
+ (int)in_y - _this.view.el.get_height()
+ );
+ _this.deletemenu.el.set_position(Gtk.PositionType.BOTTOM);
+ _this.deletemenu.el.popup();
+
+ });
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_selmodel : Object
+ {
+ public Gtk.SingleSelection el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_selmodel(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ _this.selmodel = this;
+ new Xcls_model( _this );
+ this.el = new Gtk.SingleSelection( _this.model.el );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.can_unselect = true;
+ }
+
+ // user defined functions
+ public int propToRow (JsRender.NodeProp prop) {
+ for (var i = 0 ; i < this.el.n_items; i++) {
+ var r = (JsRender.NodeProp)this.el.get_item(i);
+ if (r.equals(prop)) {
+ return i;
+
+ }
+ }
+ return -1;
+
+ }
+ public void startEditing (JsRender.NodeProp prop) {
+ // should we call select?? - caller does int (from windowstate)
+
+ }
+ public void selectProp (JsRender.NodeProp prop) {
+ for (var i = 0 ; i < this.el.n_items; i++) {
+ var r = (JsRender.NodeProp)this.el.get_item(i);
+ if (r.equals(prop)) {
+ this.el.selected = i;
+ return;
+ }
+ }
+
+ }
+ public JsRender.NodeProp getPropAt (uint row) {
+
+ return (JsRender.NodeProp) this.el.get_item(row);
+
+
+ }
+ }
+ public class Xcls_model : Object
+ {
+ public GLib.ListStore el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_model(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ _this.model = this;
+ this.el = new GLib.ListStore(typeof(JsRender.NodeProp));
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ }
+
+
+ public class Xcls_keycol : Object
+ {
+ public Gtk.ColumnViewColumn el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_keycol(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ _this.keycol = this;
+ var child_1 = new Xcls_SignalListItemFactory50( _this );
+ child_1.ref();
+ this.el = new Gtk.ColumnViewColumn( "Property", child_1.el );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.id = "keycol";
+ this.el.expand = true;
+ this.el.resizable = true;
+ }
+
+ // user defined functions
+ }
+ public class Xcls_SignalListItemFactory50 : Object
+ {
+ public Gtk.SignalListItemFactory el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_SignalListItemFactory50(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.SignalListItemFactory();
+
+ // my vars (dec)
+
+ // set gobject values
+
+ //listeners
+ this.el.setup.connect( (listitem) => {
+ var lbl = new Gtk.Label("");
+ ((Gtk.ListItem)listitem).set_child(lbl);
+ lbl.justify = Gtk.Justification.LEFT;
+ lbl.xalign = 1;
+ lbl.use_markup = true;
+ lbl.ellipsize = Pango.EllipsizeMode.START;
+ /*lbl.changed.connect(() => {
+ // notify and save the changed value...
+ //var prop = (JsRender.NodeProp) ((Gtk.ListItem)listitem.get_item());
+
+ //prop.val = lbl.text;
+ //_this.updateIter(iter,prop);
+ _this.changed();
+ });
+ */
+ ((Gtk.ListItem)listitem).activatable = true;
+ });
+ this.el.bind.connect( (listitem) => {
+ var lb = (Gtk.Label) ((Gtk.ListItem)listitem).get_child();
+ var item = (JsRender.NodeProp) ((Gtk.ListItem)listitem).get_item();
+
+
+ item.bind_property("to_display_name_prop",
+ lb, "label",
+ GLib.BindingFlags.SYNC_CREATE);
+ item.bind_property("to_tooltip_name_prop",
+ lb, "tooltip_markup",
+ GLib.BindingFlags.SYNC_CREATE);
+ // was item (1) in old layout
+
+
+ });
+ }
+
+ // user defined functions
+ }
+
+
+ public class Xcls_valcol : Object
+ {
+ public Gtk.ColumnViewColumn el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_valcol(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ _this.valcol = this;
+ var child_1 = new Xcls_SignalListItemFactory52( _this );
+ child_1.ref();
+ this.el = new Gtk.ColumnViewColumn( "Value", child_1.el );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.id = "valcol";
+ this.el.expand = true;
+ this.el.resizable = true;
+ }
+
+ // user defined functions
+ }
+ public class Xcls_SignalListItemFactory52 : Object
+ {
+ public Gtk.SignalListItemFactory el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+ public bool is_setting;
+
+ // ctor
+ public Xcls_SignalListItemFactory52(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.SignalListItemFactory();
+
+ // my vars (dec)
+ this.is_setting = false;
+
+ // set gobject values
+
+ //listeners
+ this.el.setup.connect( (listitem) => {
+ var hb = new Gtk.Box(Gtk.Orientation.HORIZONTAL,0);
+ var elbl = new Gtk.EditableLabel("");
+ elbl.hexpand = true;
+ hb.append(elbl);
+ var lbl = new Gtk.Label("");
+ hb.append(lbl);
+ lbl.hexpand = true;
+ lbl.use_markup = true;
+ lbl.xalign =0;
+ lbl.ellipsize = Pango.EllipsizeMode.END;
+ var cb = new Gtk.DropDown(new Gtk.StringList({}), null);
+ cb.hexpand = true;
+
+ hb.append(cb);
+ ((Gtk.ListItem)listitem).set_child(hb);
+
+ var ef = new Gtk.EventControllerFocus();
+ ef.enter.connect(() => {
+ _this.stop_editor();
+ var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();
+ _this.selmodel.selectProp(prop);
+ });
+ elbl.add_controller(ef);
+
+
+ // dropdown??? - stop editing, and highliht node
+ var tb = (Gtk.ToggleButton) cb.get_first_child();
+ tb.clicked.connect(() => {
+ var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();
+
+ _this.stop_editor();
+ _this.selmodel.selectProp(prop);
+
+ });
+ elbl.changed.connect(() => {
+ // notify and save the changed value...
+
+ //_this.updateIter(iter,prop);
+ // this should happen automatically
+
+ if (!_this.loading && !this.is_setting) {
+ var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();
+
+
+ prop.val = elbl.text;
+ GLib.debug("calling changed");
+ _this.changed();
+
+ }
+
+ });
+
+
+ cb.notify["selected"].connect(() => {
+ // dropdown selection changed.
+
+
+
+ //_this.updateIter(iter,prop);
+ if (!_this.loading && !this.is_setting) {
+ var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();
+ var model = (Gtk.StringList)cb.model;
+ prop.val = model.get_string(cb.selected);
+ GLib.debug("property set to %s", prop.val);
+ GLib.debug("calling changed");
+ _this.changed();
+
+ }
+
+
+ });
+ var gc = new Gtk.GestureClick();
+ lbl.add_controller(gc);
+ gc.pressed.connect(() => {
+ var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();
+ _this.stop_editor();
+ _this.show_editor(_this.file, prop.parent, prop);
+ });
+
+
+
+ });
+ this.el.bind.connect( (listitem) => {
+ this.is_setting = true;
+
+
+ var bx = (Gtk.Box) ((Gtk.ListItem)listitem).get_child();
+
+
+
+
+ var elbl = (Gtk.EditableLabel)bx.get_first_child();
+ var lbl = (Gtk.Label) elbl.get_next_sibling();
+ var cb = (Gtk.DropDown) lbl.get_next_sibling();
+ // decide if it's a combo or editable text..
+ var model = (Gtk.StringList) cb.model;
+
+ elbl.hide();
+ lbl.hide();
+ cb.hide();
+
+ var prop = (JsRender.NodeProp) ((Gtk.ListItem)listitem).get_item();
+ //GLib.debug("prop = %s", prop.get_type().name());
+ //GLib.debug("prop.val = %s", prop.val);
+ //GLib.debug("prop.key = %s", prop.to_display_name());
+
+ var use_textarea = prop.useTextArea();
+
+
+ var pal = _this.file.project.palete;
+
+ string[] opts;
+ var has_opts = pal.typeOptions(_this.node.fqn(), prop.name, prop.rtype, out opts);
+
+ if (!has_opts && prop.ptype == JsRender.NodePropType.RAW) {
+ use_textarea = true;
+ }
+
+
+ if (use_textarea) {
+ prop.bind_property("val_short",
+ lbl, "label",
+ GLib.BindingFlags.SYNC_CREATE);
+ prop.bind_property("val_tooltip",
+ lbl, "tooltip_markup",
+ GLib.BindingFlags.SYNC_CREATE);
+ lbl.show();
+ this.is_setting = false;
+ return;
+
+ }
+
+
+
+
+
+ // others... - fill in options for true/false?
+ // GLib.debug (ktype.up());
+ if (has_opts) {
+
+ while(model.get_n_items() > 0) {
+ model.remove(0);
+ }
+ cb.show();
+ // can not remove - hopefully always empty.
+ var sel = -1;
+ for(var i = 0; i < opts.length; i ++) {
+ model.append( opts[i]);
+ // not sure this is a great idea...
+ if (opts[i].down() == prop.val.down()) {
+ sel = i;
+ }
+ }
+ GLib.debug("Set selected item to %d", sel);
+ cb.set_selected(sel > -1 ? sel : Gtk.INVALID_LIST_POSITION);
+ this.is_setting = false;
+ return ;
+ }
+
+ // see if type is a Enum.
+ // triggers a changed event
+
+ elbl.set_text(prop.val);
+
+ elbl.show();
+ this.is_setting = false;
+
+
+
+
+
+ });
+ }
+
+ // user defined functions
+ }
+
+
+ public class Xcls_ContextMenu : Object
+ {
+ public Gtk.Popover el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_ContextMenu(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ _this.ContextMenu = this;
+ this.el = new Gtk.Popover();
+
+ // my vars (dec)
+
+ // set gobject values
+ var child_1 = new Xcls_Box54( _this );
+ this.el.child = child_1.el;
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Box54 : Object
+ {
+ public Gtk.Box el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Box54(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+
+ // my vars (dec)
+
+ // set gobject values
+ var child_1 = new Xcls_Button55( _this );
+ child_1.ref();
+ this.el.append( child_1.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Button55 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Button55(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.label = "Delete";
+
+ //listeners
+ this.el.activate.connect( ( ) =>{
+ _this.deleteSelected();
+
+ });
+ }
+
+ // user defined functions
+ }
- // my vars (dec)
-
- // set gobject values
- this.el.tooltip_markup = "Add a flexy foreach (for HTML templates)";
- this.el.label = "Flexy - Foreach";
-
- //listeners
- this.el.activate.connect( ( ) =>{
-
- _this.addProp("prop", "flexy:foreach", "array,key,value", "string");
- });
- }
-
- // user defined functions
- }
-
-
-
-
- public class Xcls_EditProps : Object
- {
- public Gtk.ScrolledWindow el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
- public bool editing;
-
- // ctor
- public Xcls_EditProps(Xcls_LeftProps _owner )
- {
- _this = _owner;
- _this.EditProps = this;
- this.el = new Gtk.ScrolledWindow( null, null );
-
- // my vars (dec)
- this.editing = false;
-
- // set gobject values
- this.el.shadow_type = Gtk.ShadowType.IN;
- var child_0 = new Xcls_view( _this );
- child_0.ref();
- this.el.add ( child_0.el );
-
- // init method
-
- {
-
- this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
- }
- }
-
- // user defined functions
- }
- public class Xcls_view : Object
- {
- public Gtk.TreeView el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
- public Xcls_PopoverProperty popover;
-
- // ctor
- public Xcls_view(Xcls_LeftProps _owner )
- {
- _this = _owner;
- _this.view = this;
- this.el = new Gtk.TreeView();
-
- // my vars (dec)
- this.popover = null;
-
- // set gobject values
- this.el.tooltip_column = 5;
- this.el.enable_tree_lines = true;
- this.el.headers_visible = true;
- var child_0 = new Xcls_model( _this );
- child_0.ref();
- this.el.set_model ( child_0.el );
- var child_1 = new Xcls_keycol( _this );
- child_1.ref();
- this.el.append_column ( child_1.el );
- var child_2 = new Xcls_valcol( _this );
- child_2.ref();
- this.el.append_column ( child_2.el );
- var child_3 = new Xcls_ContextMenu( _this );
- child_3.ref();
-
- // init method
-
- {
- var selection = this.el.get_selection();
- selection.set_mode( Gtk.SelectionMode.SINGLE);
-
-
- var description = new Pango.FontDescription();
- description.set_size(10000);
- this.el.override_font(description);
- }
-
- //listeners
- this.el.button_press_event.connect( ( ev) => {
-
- Gtk.TreeViewColumn col;
- int cell_x;
- int cell_y;
- Gtk.TreePath path;
- if (!this.el.get_path_at_pos((int)ev.x, (int) ev.y, out path, out col, out cell_x, out cell_y )) {
- print("nothing selected on click");
- GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
- this.el.get_selection().unselect_all();
-
- return false;
- });
- _this.before_edit();
- return false; //not on a element.
- }
-
-
- // double click on name..
- if (ev.type == Gdk.EventType.2BUTTON_PRESS && ev.button == 1 && col.title == "Name") {
- // show popup!.
-
- if (this.popover == null) {
- this.popover = new Xcls_PopoverProperty();
- this.popover.mainwindow = _this.main_window;
- }
-
-
- _this.before_edit();
- _this.stop_editor();
-
- _this.keyrender.el.stop_editing(false);
- _this.keyrender.el.editable =false;
-
- _this.valrender.el.stop_editing(false);
- _this.valrender.el.editable =false;
- Gtk.TreeIter iter;
- var mod = this.el.get_model();
- mod.get_iter (out iter, path);
-
-
- GLib.Value gvaltype, gval;
- mod.get_value(iter, 1 , out gval); // one is key..
-
- mod.get_value(iter,0, out gvaltype);
-
- this.popover.show(this.el, _this.node, (string)gvaltype, (string)gval);
-
- // _this.startEditingKey(path);
-
- return false;
- }
-
-
-
-
- // right click.
- if (ev.type == Gdk.EventType.BUTTON_PRESS && ev.button == 3) {
- // show popup!.
- //if (col.title == "Value") {
- // _this.before_edit();
- // return false;
- //}
-
- var p = _this.ContextMenu;
-
- p.el.set_screen(Gdk.Screen.get_default());
- p.el.show_all();
- p.el.popup(null, null, null, ev.button, ev.time);
- //Seed.print("click:" + res.column.title);
- // select the
- GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
-
- this.el.get_selection().select_path(path);
- return false;
- });
- _this.before_edit();
- return false;
- }
-
-
- if (col.title != "Value") {
- print("col title != Value");
-
- GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
- this.el.get_selection().select_path(path);
- return false;
- });
-
- _this.before_edit();
- // XObject.error("column is not value?");
- return false; // ignore.. - key click.. ??? should we do this??
- }
-
-
- // if the cell can be edited with a pulldown
- // then we should return true... - and let the start_editing handle it?
-
-
-
-
-
-
- // _this.before_edit(); <<< we really need to stop the other editor..
- _this.keyrender.el.stop_editing(false);
- _this.keyrender.el.editable =false;
-
-
- return _this.startEditingValue(path); // assumes selected row..
-
-
-
-
-
- });
- }
-
- // user defined functions
- }
- public class Xcls_model : Object
- {
- public Gtk.TreeStore el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_model(Xcls_LeftProps _owner )
- {
- _this = _owner;
- _this.model = this;
- this.el = new Gtk.TreeStore( 7, typeof(string), // 0 key type
- typeof(string), // 1 key
- typeof(string), // 2 key (display)
- typeof(string), // 3 value
- typeof(string), // 4 value (display)
- typeof(string), // 5 both (tooltip)
- typeof(string) // 6 key (for sorting)
- );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
- public class Xcls_keycol : Object
- {
- public Gtk.TreeViewColumn el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_keycol(Xcls_LeftProps _owner )
- {
- _this = _owner;
- _this.keycol = this;
- this.el = new Gtk.TreeViewColumn();
-
- // my vars (dec)
-
- // set gobject values
- this.el.title = "Name";
- this.el.resizable = true;
- var child_0 = new Xcls_keyrender( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , false );
-
- // init method
-
- this.el.add_attribute(_this.keyrender.el , "markup", 2 );
- this.el.add_attribute(_this.keyrender.el , "text", 1 );
- }
-
- // user defined functions
- }
- public class Xcls_keyrender : Object
- {
- public Gtk.CellRendererText el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_keyrender(Xcls_LeftProps _owner )
- {
- _this = _owner;
- _this.keyrender = this;
- this.el = new Gtk.CellRendererText();
-
- // my vars (dec)
-
- // set gobject values
-
- //listeners
- this.el.editing_started.connect( ( editable, path) => {
-
- Gtk.TreeIter iter;
- _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
- GLib.Value gval;
-
-
-
- // this.get('/LeftPanel.model').activePath = path;
- _this.model.el.get_value(iter,1, out gval);
- var val = (string)gval;
-
- ((Gtk.Entry)editable).set_text(val);
- });
- this.el.edited.connect( (path, newtext) => {
- print("Keyrender - signal:edited\n");
-
- this.el.editable = false;
-
-
-
- Gtk.TreeIter iter;
- _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
- GLib.Value gval;
-
- _this.model.el.get_value(iter,1, out gval);
- var oldval = (string)gval;
-
- _this.model.el.get_value(iter,0, out gval);
- var ktype = (string)gval;
-
- _this.model.el.set_value(iter, 1, newtext);
-
- if (oldval == newtext) {
- return;
- }
-
-
- print("ktype: %s\n",ktype);
- switch(ktype) {
- case "listener":
- var ov = _this.node.listeners.get(oldval);
- _this.node.listeners.set(newtext, ov);
- _this.node.listeners.unset(oldval);
-
- _this.updateIter(iter, ktype, newtext, ov);
-
- break;
- case "props":
- var ov = _this.node.props.get(oldval);
- _this.node.props.set(newtext, ov);
- _this.node.props.unset(oldval);
- _this.updateIter(iter, ktype, newtext, ov);
- break;
- }
- _this.changed();
-
- });
- }
-
- // user defined functions
- }
-
-
- public class Xcls_valcol : Object
- {
- public Gtk.TreeViewColumn el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_valcol(Xcls_LeftProps _owner )
- {
- _this = _owner;
- _this.valcol = this;
- this.el = new Gtk.TreeViewColumn();
-
- // my vars (dec)
-
- // set gobject values
- this.el.title = "Value";
- this.el.resizable = true;
- var child_0 = new Xcls_valrender( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , true );
-
- // init method
-
- {
-
- // typeof(string), // 0 key type
- // typeof(string), // 1 key
- // typeof(string), // 2 key (display)
- // typeof(string), // 3 value
- // typeof(string) // 4 value (display)
-
-
- this.el.add_attribute(_this.valrender.el , "text", 4 );
- //this.el.add_attribute(_this.valrender.el , "sensitive", 4 );
- //this.el.add_attribute(this.items[0].el , 'editable', 3 );
- // this.el.set_cell_data_func(cell, age_cell_data_func, NULL, NULL);
-
- // this.get('/LeftPanel').editableColumn= this;
- }
- }
-
- // user defined functions
- }
- public class Xcls_valrender : Object
- {
- public Gtk.CellRendererCombo el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_valrender(Xcls_LeftProps _owner )
- {
- _this = _owner;
- _this.valrender = this;
- this.el = new Gtk.CellRendererCombo();
-
- // my vars (dec)
-
- // set gobject values
- this.el.editable = false;
- this.el.text_column = 0;
- this.el.has_entry = true;
- var child_0 = new Xcls_valrendermodel( _this );
- child_0.ref();
- this.el.model = child_0.el;
-
- //listeners
- this.el.editing_started.connect( ( editable, path) => {
- //_this.editing = true;
- print("editing started called\n");
- if (!_this.allow_edit) {
-
- print("val - editing_Started\n");
- this.el.editable = false; // make sure it's not editor...
-
-
- return;
- }
- _this.allow_edit =false;
-
-
- if ( this.el.has_entry ) {
-
- Gtk.TreeIter iter;
- _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
- GLib.Value gval;
-
-
-
- // this.get('/LeftPanel.model').activePath = path;
- _this.model.el.get_value(iter,3, out gval);
-
-
- var val = (string)gval;
- var combo = (Gtk.ComboBox)editable;
-
- var entry = (Gtk.Entry) combo.get_child();
- entry.set_text(val);
- }
-
- });
- this.el.edited.connect( (path, newtext) => {
- print("Valrender - signal:edited\n");
-
- this.el.editable = false;
- /*
- m.set(iter,
- 0, "listener",
- 1, miter.get_key(),
- 2, "<b>" + miter.get_key() + "</b>",
- 3, miter.get_value(),
- 4, display_value(short);
- );
-
- */
-
- Gtk.TreeIter iter;
- _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
- GLib.Value gval;
-
- _this.model.el.get_value(iter,0, out gval);
- var ktype = (string)gval;
-
-
- _this.model.el.get_value(iter,3, out gval);
- var oldval = (string)gval;
-
- _this.model.el.get_value(iter,1, out gval);
- var key = (string)gval;
-
-
-
- switch(ktype) {
- case "listener":
- _this.node.listeners.set(key, newtext);
- _this.updateIter(iter,ktype,key,newtext);
- break;
- case "props":
- _this.node.props.set(key,newtext);
- _this.updateIter(iter,ktype, key,newtext);
- break;
- }
- // _this.load(_this.file,_this.node);
- _this.changed();
-
- });
- }
-
- // user defined functions
- public void setOptions (string[] ar) {
- var m = _this.valrendermodel.el;
- m.clear();
- Gtk.TreeIter iret;
- for (var i =0; i < ar.length; i++) {
- m.append(out iret);
- m.set_value(iret, 0, ar[i]);
- }
-
- }
- }
- public class Xcls_valrendermodel : Object
- {
- public Gtk.ListStore el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_valrendermodel(Xcls_LeftProps _owner )
- {
- _this = _owner;
- _this.valrendermodel = this;
- this.el = new Gtk.ListStore( 1, typeof(string) );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
-
-
- public class Xcls_ContextMenu : Object
- {
- public Gtk.Menu el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_ContextMenu(Xcls_LeftProps _owner )
- {
- _this = _owner;
- _this.ContextMenu = this;
- this.el = new Gtk.Menu();
-
- // my vars (dec)
-
- // set gobject values
- var child_0 = new Xcls_MenuItem34( _this );
- child_0.ref();
- this.el.append ( child_0.el );
- var child_1 = new Xcls_SeparatorMenuItem35( _this );
- child_1.ref();
- this.el.append ( child_1.el );
- var child_2 = new Xcls_MenuItem36( _this );
- child_2.ref();
- this.el.append ( child_2.el );
- }
-
- // user defined functions
- }
- public class Xcls_MenuItem34 : Object
- {
- public Gtk.MenuItem el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_MenuItem34(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.MenuItem();
-
- // my vars (dec)
-
- // set gobject values
- this.el.label = "Edit (double click)";
-
- //listeners
- this.el.activate.connect( ( ) =>{
-
- var s = _this.view.el.get_selection();
- Gtk.TreeIter iter;
- Gtk.TreeModel mod;
- s.get_selected (out mod, out iter);
-
- if (_this.view.popover == null) {
- _this.view.popover = new Xcls_PopoverProperty();
- _this.view.popover.mainwindow = _this.main_window;
- }
-
-
- _this.before_edit();
- _this.stop_editor();
-
- _this.keyrender.el.stop_editing(false);
- _this.keyrender.el.editable =false;
-
- _this.valrender.el.stop_editing(false);
- _this.valrender.el.editable =false;
-
-
- GLib.Value gvaltype, gval;
- mod.get_value(iter, 1 , out gval); // one is key..
-
- mod.get_value(iter,0, out gvaltype);
-
- _this.view.popover.show(_this.view.el, _this.node, (string)gvaltype, (string)gval);
-
-
-
- // _this.startEditingKey(model.get_path(iter));
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_SeparatorMenuItem35 : Object
- {
- public Gtk.SeparatorMenuItem el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_SeparatorMenuItem35(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.SeparatorMenuItem();
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
- public class Xcls_MenuItem36 : Object
- {
- public Gtk.MenuItem el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_MenuItem36(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.MenuItem();
-
- // my vars (dec)
-
- // set gobject values
- this.el.label = "Delete";
-
- //listeners
- this.el.activate.connect( ( ) =>{
- _this.deleteSelected();
- });
- }
-
- // user defined functions
- }