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 show_editor (JsRender.JsRender file, JsRender.Node node, JsRender.NodeProp prop);
public signal void changed ();
public signal void show_add_props (string type);
public Xcls_MainWindow main_window;
}
// 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 ()
- {
-
- GLib.debug("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
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);
-
+ GLib.Value gval;
mod.get_value(iter, 0 , out gval);
- var type = (string)gval; // listerner or prop..
-
-
+ var prop = (JsRender.NodeProp)gval;
+
+
var use_textarea = false;
//------------ things that require the text editor...
- if (type == "listener") {
+ if (prop.ptype == JsRender.NodePropType.LISTENER) {
use_textarea = true;
}
- if (key.length > 0 && key[0] == '|') { // user defined method
+ if (prop.ptype == JsRender.NodePropType.METHOD) {
use_textarea = true;
}
- if (key.length > 0 && key[0] == '$') { // raw string
+ if (prop.ptype == JsRender.NodePropType.RAW) { // raw string
use_textarea = true;
}
- if (key.length > 0 && key == "* init") {
+ if ( prop.name == "init" && prop.ptype == JsRender.NodePropType.SPECIAL) {
use_textarea = true;
}
- if (val.length > 40) { // long value...
+ if (prop.val.length > 40) { // long value...
use_textarea = true;
}
GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
this.view.el.get_selection().select_path(path);
- this.show_editor(file, node, type, key);
+ this.show_editor(file, node, prop);
return false;
});
var pal = this.file.project.palete;
string[] opts;
- var has_opts = pal.typeOptions(this.node.fqn(), kname, ktype, out opts);
+ var has_opts = pal.typeOptions(this.node.fqn(), prop.name, prop.rtype, out opts);
// others... - fill in options for true/false?
GLib.debug("turn on editing %s \n" , mod.get_path(iter).to_string());
- GLib.debug (ktype.up());
+ // GLib.debug (ktype.up());
if (has_opts) {
GLib.debug("start editing try/false)???");
this.valrender.el.has_entry = false;
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
+ path,
+ this.valcol.el,
+ this.valrender.el,
+ true
);
return false;
});
}
public void load (JsRender.JsRender file, JsRender.Node? node)
{
+ // not sure when to initialize this - we should do it on setting main window really.
+ if (this.view.popover == null) {
+ this.view.popover = new Xcls_PopoverProperty();
+ this.view.popover.mainwindow = _this.main_window;
+ }
+
+
+
+
GLib.debug("load leftprops\n");
this.before_edit();
this.node = node;
//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)
+
i++;
m.append(out iter,null);
- this.updateIter(iter, "listener", miter.get_key(), miter.get_value());
+ this.updateIter(iter, miter.get_value());
}
while(miter.next()) {
i++;
m.append(out iter,null);
- this.updateIter(iter, "prop", miter.get_key(), miter.get_value());
+ this.updateIter(iter, miter.get_value());
}
GLib.debug("clear selection\n");
// clear selection?
- this.model.el.set_sort_column_id(6,Gtk.SortType.ASCENDING); // sort by real key..
+ this.model.el.set_sort_column_id(4,Gtk.SortType.ASCENDING); // sort by real key..
this.view.el.get_selection().unselect_all();
- /**
-
- make outerpane = {current width of left pane} + width of props
- make innerpane = {current width of left pane}
-
-
-
-
- var outerpane = _this.main_window.leftpane.el;
- var pane = _this.main_window.editpane.el;
-
-
-
- var try_size = (i * 25) + 60; // est. 20px per line + 40px header
- GLib.Timeout.add_seconds(1, () => {
- // 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);
- return GLib.Source.REMOVE;
- });
- */
}
public string keyFormat (string val, string type) {
}
public void deleteSelected () {
+ this.stop_editor();
+
Gtk.TreeIter iter;
Gtk.TreeModel mod;
GLib.Value gval;
mod.get_value(iter, 0 , out gval);
- var type = (string)gval;
+ var prop = (JsRender.NodeProp)gval;
- mod.get_value(iter, 1 , out gval);
- var key = (string)gval;
-
- switch(type) {
- case "listener":
- this.node.listeners.unset(key);
+ switch(prop.ptype) {
+ case JsRender.NodePropType.LISTENER:
+ this.node.listeners.unset(prop.to_index_key());
break;
- case "props":
- this.node.props.unset(key);
+ default:
+ this.node.props.unset(prop.to_index_key());
break;
}
this.load(this.file, this.node);
}
- public void addProp (string in_type, string key, string value, string value_type) {
+ public void before_edit ()
+ {
+
+ GLib.debug("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 void reload () {
+ this.load(this.file, this.node);
+ }
+ public void addProp (JsRender.NodeProp prop) {
// 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)) {
+ if (prop.ptype == JsRender.NodePropType.LISTENER) {
+ if (this.node.listeners.has_key(prop.name)) {
return;
}
- this.node.listeners.set(key,value);
+ this.node.listeners.set(prop.name,prop);
} else {
assert(this.node != null);
assert(this.node.props != null);
- if (this.node.props.has_key(fkey)) {
+ if (this.node.props.has_key(prop.to_index_key())) {
return;
}
- this.node.props.set(fkey,value);
+ this.node.props.set(prop.to_index_key(),prop);
}
this.model.el.foreach((model, path, iter) => {
GLib.Value gval;
-
this.model.el.get_value(iter, 0 , out gval);
- if ((string)gval != type) {
- GLib.debug("not type: %s = %s\n", (string)gval , type);
- return false;
- }
- this.model.el.get_value(iter, 1 , out gval);
- if ((string)gval != fkey) {
- GLib.debug("not key: %s = %s\n", (string)gval , fkey);
- return false;
+
+ var iprop = (JsRender.NodeProp)gval;
+ if (iprop.to_index_key() != prop.to_index_key()) {
+ return false; // continue?
}
+
// delay this?
GLib.Timeout.add_full(GLib.Priority.DEFAULT,40 , () => {
-
+ /*
+ if (prop.name == "") { // empty string for key name.
+ _this.view.editPropertyDetails(this.model.el.get_path(iter));
+ return false;
+ }
+ */
+
this.startEditingValue(this.model.el.get_path(iter));
return false;
});
}
- public void updateIter (Gtk.TreeIter iter, string type, string key, string kvalue) {
+ public void updateIter (Gtk.TreeIter iter, JsRender.NodeProp prop) {
//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 dl = prop.val.strip().split("\n");
var dis_val = dl.length > 1 ? (dl[0].strip()+ "...") : dl[0];
- if (type == "listener") {
+ if (prop.ptype == JsRender.NodePropType.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
+ 0, prop,
+ 1, prop.to_display_name(),
+ 2, dis_val,
+ 3, "<tt>" + GLib.Markup.escape_text(prop.to_tooltip()) + "</tt>",
+ 4, prop.to_sort_key(),
+ -1
);
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)
+ 0, prop,
+ 1, prop.to_display_name(),
+ 2, dis_val,
+ 3, "<tt>" + GLib.Markup.escape_text(prop.to_tooltip()) + "</tt>",
+ 4, prop.to_sort_key(),
+ -1
+
);
}
public class Xcls_Box2 : Object
var child_1 = new Xcls_Button4( _this );
child_1.ref();
this.el.add ( child_1.el );
- var child_2 = new Xcls_Button24( _this );
+ var child_2 = new Xcls_Button6( _this );
child_2.ref();
this.el.add ( child_2.el );
- var child_3 = new Xcls_Button26( _this );
+ var child_3 = new Xcls_Button8( _this );
child_3.ref();
this.el.add ( child_3.el );
}
// my vars (dec)
// set gobject values
- this.el.margin_right = 5;
- this.el.margin_left = 5;
+ this.el.margin_end = 5;
+ this.el.margin_start = 5;
}
// user defined functions
// set gobject values
this.el.hexpand = true;
+ this.el.always_show_image = true;
+ this.el.tooltip_text = "Add Property";
+ this.el.label = "Property";
+ var child_0 = new Xcls_Image5( _this );
+ child_0.ref();
+ this.el.set_image ( child_0.el );
+
+ //listeners
+ this.el.clicked.connect( ( ) => {
+
+ _this.main_window.windowstate.showProps(
+ _this.view.el,
+ JsRender.NodePropType.PROP
+ );
+
+ });
+ }
+
+ // 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.icon_name = "format-justify-left";
+ }
+
+ // user defined functions
+ }
+
+
+ public class Xcls_Button6 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Button6(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.hexpand = true;
+ this.el.always_show_image = true;
+ this.el.tooltip_text = "Add Event Code";
+ this.el.label = "Event";
+ var child_0 = new Xcls_Image7( _this );
+ child_0.ref();
+ this.el.set_image ( child_0.el );
+
+ //listeners
+ this.el.clicked.connect( ( ) => {
+
+
+ _this.main_window.windowstate.showProps(
+ _this.view.el,
+ JsRender.NodePropType.LISTENER
+ );
+
+
+ });
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Image7 : Object
+ {
+ public Gtk.Image el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Image7(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Image();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.icon_name = "appointment-new";
+ }
+
+ // user defined functions
+ }
+
+
+ public class Xcls_Button8 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Button8(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.hexpand = true;
+ this.el.always_show_image = true;
this.el.label = "Other";
var child_0 = new Xcls_AddPropertyPopup( _this );
child_0.ref();
- var child_1 = new Xcls_Image23( _this );
+ var child_1 = new Xcls_Image27( _this );
child_1.ref();
this.el.set_image ( child_1.el );
// my vars (dec)
// set gobject values
- var child_0 = new Xcls_MenuItem6( _this );
+ var child_0 = new Xcls_MenuItem10( _this );
child_0.ref();
this.el.append ( child_0.el );
- var child_1 = new Xcls_MenuItem7( _this );
+ var child_1 = new Xcls_MenuItem11( _this );
child_1.ref();
this.el.append ( child_1.el );
- var child_2 = new Xcls_MenuItem8( _this );
+ var child_2 = new Xcls_MenuItem12( _this );
child_2.ref();
this.el.append ( child_2.el );
- var child_3 = new Xcls_MenuItem9( _this );
+ var child_3 = new Xcls_MenuItem13( _this );
child_3.ref();
this.el.append ( child_3.el );
- var child_4 = new Xcls_MenuItem10( _this );
+ var child_4 = new Xcls_MenuItem14( _this );
child_4.ref();
this.el.append ( child_4.el );
- var child_5 = new Xcls_SeparatorMenuItem11( _this );
+ var child_5 = new Xcls_SeparatorMenuItem15( _this );
child_5.ref();
this.el.add ( child_5.el );
- var child_6 = new Xcls_MenuItem12( _this );
+ var child_6 = new Xcls_MenuItem16( _this );
child_6.ref();
this.el.append ( child_6.el );
- var child_7 = new Xcls_MenuItem13( _this );
+ var child_7 = new Xcls_MenuItem17( _this );
child_7.ref();
this.el.append ( child_7.el );
- var child_8 = new Xcls_MenuItem14( _this );
+ var child_8 = new Xcls_MenuItem18( _this );
child_8.ref();
this.el.append ( child_8.el );
- var child_9 = new Xcls_SeparatorMenuItem15( _this );
+ var child_9 = new Xcls_SeparatorMenuItem19( _this );
child_9.ref();
this.el.add ( child_9.el );
- var child_10 = new Xcls_MenuItem16( _this );
+ var child_10 = new Xcls_MenuItem20( _this );
child_10.ref();
this.el.append ( child_10.el );
- var child_11 = new Xcls_MenuItem17( _this );
+ var child_11 = new Xcls_MenuItem21( _this );
child_11.ref();
this.el.append ( child_11.el );
- var child_12 = new Xcls_MenuItem18( _this );
+ var child_12 = new Xcls_MenuItem22( _this );
child_12.ref();
this.el.append ( child_12.el );
- var child_13 = new Xcls_SeparatorMenuItem19( _this );
+ var child_13 = new Xcls_SeparatorMenuItem23( _this );
child_13.ref();
this.el.add ( child_13.el );
- var child_14 = new Xcls_MenuItem20( _this );
+ var child_14 = new Xcls_MenuItem24( _this );
child_14.ref();
this.el.append ( child_14.el );
- var child_15 = new Xcls_MenuItem21( _this );
+ var child_15 = new Xcls_MenuItem25( _this );
child_15.ref();
this.el.append ( child_15.el );
- var child_16 = new Xcls_MenuItem22( _this );
+ var child_16 = new Xcls_MenuItem26( _this );
child_16.ref();
this.el.append ( child_16.el );
}
// user defined functions
}
- public class Xcls_MenuItem6 : Object
+ public class Xcls_MenuItem10 : Object
{
public Gtk.MenuItem el;
private Xcls_LeftProps _this;
// my vars (def)
// ctor
- public Xcls_MenuItem6(Xcls_LeftProps _owner )
+ public Xcls_MenuItem10(Xcls_LeftProps _owner )
{
_this = _owner;
this.el = new Gtk.MenuItem();
//listeners
this.el.activate.connect( () => {
- _this.addProp( "prop", "id", "", "");
+ // is this userdef or special??
+ _this.addProp( new JsRender.NodeProp.prop("id") );
});
}
// user defined functions
}
- public class Xcls_MenuItem7 : Object
+ public class Xcls_MenuItem11 : Object
{
public Gtk.MenuItem el;
private Xcls_LeftProps _this;
// my vars (def)
// ctor
- public Xcls_MenuItem7(Xcls_LeftProps _owner )
+ public Xcls_MenuItem11(Xcls_LeftProps _owner )
{
_this = _owner;
this.el = new Gtk.MenuItem();
//listeners
this.el.activate.connect( ( ) => {
-
- _this.addProp( "prop", "pack","add", "*");
+ // is this userdef?
+ _this.addProp( new JsRender.NodeProp.special("pack", "add") );
});
}
// user defined functions
}
- public class Xcls_MenuItem8 : Object
+ public class Xcls_MenuItem12 : Object
{
public Gtk.MenuItem el;
private Xcls_LeftProps _this;
// my vars (def)
// ctor
- public Xcls_MenuItem8(Xcls_LeftProps _owner )
+ public Xcls_MenuItem12(Xcls_LeftProps _owner )
{
_this = _owner;
this.el = new Gtk.MenuItem();
//listeners
this.el.activate.connect( ( ) => {
- _this.addProp( "prop", "ctor","", "*");
+ _this.addProp( new JsRender.NodeProp.special("ctor") );
});
}
// user defined functions
}
- public class Xcls_MenuItem9 : Object
+ public class Xcls_MenuItem13 : Object
{
public Gtk.MenuItem el;
private Xcls_LeftProps _this;
// my vars (def)
// ctor
- public Xcls_MenuItem9(Xcls_LeftProps _owner )
+ public Xcls_MenuItem13(Xcls_LeftProps _owner )
{
_this = _owner;
this.el = new Gtk.MenuItem();
//listeners
this.el.activate.connect( ( ) => {
+ _this.addProp( new JsRender.NodeProp.special("init","{\n\n}\n" ) );
- _this.addProp( "prop", "init", "{\n\n}\n", "*" );
});
}
// user defined functions
}
- public class Xcls_MenuItem10 : Object
+ public class Xcls_MenuItem14 : Object
{
public Gtk.MenuItem el;
private Xcls_LeftProps _this;
// my vars (def)
// ctor
- public Xcls_MenuItem10(Xcls_LeftProps _owner )
+ public Xcls_MenuItem14(Xcls_LeftProps _owner )
{
_this = _owner;
this.el = new Gtk.MenuItem();
//listeners
this.el.activate.connect( () => {
- _this.addProp( "prop", "cms-id", "", "string");
+
+ _this.addProp( new JsRender.NodeProp.prop("cms-id","string", "" ) );
+
+
+
});
}
// user defined functions
}
- public class Xcls_SeparatorMenuItem11 : Object
+ public class Xcls_SeparatorMenuItem15 : Object
{
public Gtk.SeparatorMenuItem el;
private Xcls_LeftProps _this;
// my vars (def)
// ctor
- public Xcls_SeparatorMenuItem11(Xcls_LeftProps _owner )
+ public Xcls_SeparatorMenuItem15(Xcls_LeftProps _owner )
{
_this = _owner;
this.el = new Gtk.SeparatorMenuItem();
// user defined functions
}
- public class Xcls_MenuItem12 : Object
+ public class Xcls_MenuItem16 : Object
{
public Gtk.MenuItem el;
private Xcls_LeftProps _this;
// my vars (def)
// ctor
- public Xcls_MenuItem12(Xcls_LeftProps _owner )
+ public Xcls_MenuItem16(Xcls_LeftProps _owner )
{
_this = _owner;
this.el = new Gtk.MenuItem();
//listeners
this.el.activate.connect( (self) => {
- _this.addProp( "prop", "XXXX", "","# string");
+ _this.view.popover.show(
+ _this.view.el,
+ _this.node,
+ new JsRender.NodeProp.prop("", "string", "") ,
+ -1,
+ true
+ );
});
}
// user defined functions
}
- public class Xcls_MenuItem13 : Object
+ public class Xcls_MenuItem17 : Object
{
public Gtk.MenuItem el;
private Xcls_LeftProps _this;
// my vars (def)
// ctor
- public Xcls_MenuItem13(Xcls_LeftProps _owner )
+ public Xcls_MenuItem17(Xcls_LeftProps _owner )
{
_this = _owner;
this.el = new Gtk.MenuItem();
//listeners
this.el.activate.connect( ( ) =>{
-
- _this.addProp("prop", "XXX", "0", "int");
+ _this.view.popover.show(
+ _this.view.el,
+ _this.node,
+ new JsRender.NodeProp.prop("", "int", "0") ,
+ -1,
+ true
+ );
+
});
}
// user defined functions
}
- public class Xcls_MenuItem14 : Object
+ public class Xcls_MenuItem18 : Object
{
public Gtk.MenuItem el;
private Xcls_LeftProps _this;
// my vars (def)
// ctor
- public Xcls_MenuItem14(Xcls_LeftProps _owner )
+ public Xcls_MenuItem18(Xcls_LeftProps _owner )
{
_this = _owner;
this.el = new Gtk.MenuItem();
//listeners
this.el.activate.connect( ( ) =>{
-
- _this.addProp( "prop", "XXX", "true", "bool");
+
+
+ _this.view.popover.show(
+ _this.view.el,
+ _this.node,
+ new JsRender.NodeProp.prop("", "bool", "true") ,
+ -1,
+ true
+ );
+
});
}
// user defined functions
}
- public class Xcls_SeparatorMenuItem15 : Object
+ public class Xcls_SeparatorMenuItem19 : Object
{
public Gtk.SeparatorMenuItem el;
private Xcls_LeftProps _this;
// my vars (def)
// ctor
- public Xcls_SeparatorMenuItem15(Xcls_LeftProps _owner )
+ public Xcls_SeparatorMenuItem19(Xcls_LeftProps _owner )
{
_this = _owner;
this.el = new Gtk.SeparatorMenuItem();
// user defined functions
}
- public class Xcls_MenuItem16 : Object
+ public class Xcls_MenuItem20 : Object
{
public Gtk.MenuItem el;
private Xcls_LeftProps _this;
// my vars (def)
// ctor
- public Xcls_MenuItem16(Xcls_LeftProps _owner )
+ public Xcls_MenuItem20(Xcls_LeftProps _owner )
{
_this = _owner;
this.el = new Gtk.MenuItem();
//listeners
this.el.activate.connect( ( ) =>{
-
- _this.addProp("prop", "XXXX", "function() { }", "| function");
+
+ _this.view.popover.show(
+ _this.view.el,
+ _this.node,
+ new JsRender.NodeProp.jsmethod("") ,
+ -1,
+ true
+ );
+
+
});
}
// user defined functions
}
- public class Xcls_MenuItem17 : Object
+ public class Xcls_MenuItem21 : Object
{
public Gtk.MenuItem el;
private Xcls_LeftProps _this;
// my vars (def)
// ctor
- public Xcls_MenuItem17(Xcls_LeftProps _owner )
+ public Xcls_MenuItem21(Xcls_LeftProps _owner )
{
_this = _owner;
this.el = new Gtk.MenuItem();
//listeners
this.el.activate.connect( ( ) =>{
- _this.addProp( "prop", "XXXX", "() {\n\n}\n", "| void");
+ _this.view.popover.show(
+ _this.view.el,
+ _this.node,
+ new JsRender.NodeProp.valamethod("") ,
+ -1,
+ true
+ );
});
}
// user defined functions
}
- public class Xcls_MenuItem18 : Object
+ public class Xcls_MenuItem22 : Object
{
public Gtk.MenuItem el;
private Xcls_LeftProps _this;
// my vars (def)
// ctor
- public Xcls_MenuItem18(Xcls_LeftProps _owner )
+ public Xcls_MenuItem22(Xcls_LeftProps _owner )
{
_this = _owner;
this.el = new Gtk.MenuItem();
//listeners
this.el.activate.connect( ( ) =>{
-
- _this.addProp( "prop", "XXXX", "()", "@ void");
+ _this.view.popover.show(
+ _this.view.el,
+ _this.node,
+ new JsRender.NodeProp.sig("" ) ,
+ -1,
+ true
+ );
});
}
// user defined functions
}
- public class Xcls_SeparatorMenuItem19 : Object
+ public class Xcls_SeparatorMenuItem23 : Object
{
public Gtk.SeparatorMenuItem el;
private Xcls_LeftProps _this;
// my vars (def)
// ctor
- public Xcls_SeparatorMenuItem19(Xcls_LeftProps _owner )
+ public Xcls_SeparatorMenuItem23(Xcls_LeftProps _owner )
{
_this = _owner;
this.el = new Gtk.SeparatorMenuItem();
// user defined functions
}
- public class Xcls_MenuItem20 : Object
+ public class Xcls_MenuItem24 : Object
{
public Gtk.MenuItem el;
private Xcls_LeftProps _this;
// my vars (def)
// ctor
- public Xcls_MenuItem20(Xcls_LeftProps _owner )
+ public Xcls_MenuItem24(Xcls_LeftProps _owner )
{
_this = _owner;
this.el = new Gtk.MenuItem();
//listeners
this.el.activate.connect( ( ) =>{
+ _this.view.popover.show(
+ _this.view.el,
+ _this.node,
+ new JsRender.NodeProp.prop("flexy:if", "string", "value_or_condition") ,
+ -1,
+ true
+ );
+
- _this.addProp("prop", "flexy:if", "value_or_condition", "string");
});
}
// user defined functions
}
- public class Xcls_MenuItem21 : Object
+ public class Xcls_MenuItem25 : Object
{
public Gtk.MenuItem el;
private Xcls_LeftProps _this;
// my vars (def)
// ctor
- public Xcls_MenuItem21(Xcls_LeftProps _owner )
+ public Xcls_MenuItem25(Xcls_LeftProps _owner )
{
_this = _owner;
this.el = new Gtk.MenuItem();
//listeners
this.el.activate.connect( ( ) =>{
+ _this.view.popover.show(
+ _this.view.el,
+ _this.node,
+ new JsRender.NodeProp.prop("flexy:include", "string", "name_of_file.html") ,
+ -1,
+ true
+ );
- _this.addProp("prop", "flexy:include", "name_of_file.html", "string");
+
});
}
// user defined functions
}
- public class Xcls_MenuItem22 : Object
+ public class Xcls_MenuItem26 : Object
{
public Gtk.MenuItem el;
private Xcls_LeftProps _this;
// my vars (def)
// ctor
- public Xcls_MenuItem22(Xcls_LeftProps _owner )
+ public Xcls_MenuItem26(Xcls_LeftProps _owner )
{
_this = _owner;
this.el = new Gtk.MenuItem();
//listeners
this.el.activate.connect( ( ) =>{
+
+ _this.view.popover.show(
+ _this.view.el,
+ _this.node,
+ new JsRender.NodeProp.prop("flexy:foreach", "string", "array,key,value") ,
+ -1,
+ true
+ );
- _this.addProp("prop", "flexy:foreach", "array,key,value", "string");
- });
- }
-
- // user defined functions
- }
-
-
- public class Xcls_Image23 : Object
- {
- public Gtk.Image el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Image23(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_Button24 : Object
- {
- public Gtk.Button el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Button24(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- this.el.hexpand = true;
- this.el.always_show_image = true;
- this.el.tooltip_text = "Add Property";
- this.el.label = "Property";
- var child_0 = new Xcls_Image25( _this );
- child_0.ref();
- this.el.set_image ( child_0.el );
-
- //listeners
- this.el.clicked.connect( ( ) => {
- _this.main_window.windowstate.showProps(this.el, "props");
-
-
});
}
// user defined functions
}
- public class Xcls_Image25 : Object
- {
- public Gtk.Image el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Image25(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.Image();
-
- // my vars (dec)
-
- // set gobject values
- this.el.icon_name = "format-justify-left";
- }
-
- // user defined functions
- }
-
- public class Xcls_Button26 : Object
- {
- public Gtk.Button el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Button26(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- this.el.hexpand = true;
- this.el.always_show_image = true;
- this.el.tooltip_text = "Add Event Code";
- this.el.label = "Event";
- var child_0 = new Xcls_Image27( _this );
- child_0.ref();
- this.el.set_image ( child_0.el );
-
- //listeners
- this.el.clicked.connect( ( ) => {
-
-
- _this.main_window.windowstate.showProps(this.el, "signals");
-
-
- });
- }
- // user defined functions
- }
public class Xcls_Image27 : Object
{
public Gtk.Image el;
// my vars (dec)
// set gobject values
- this.el.icon_name = "appointment-new";
+ this.el.stock = Gtk.Stock.ADD;
+ this.el.icon_size = Gtk.IconSize.MENU;
}
// user defined functions
this.popover = null;
// set gobject values
- this.el.tooltip_column = 5;
+ this.el.tooltip_column = 3;
this.el.enable_tree_lines = true;
this.el.headers_visible = true;
var child_0 = new Xcls_model( _this );
var description = new Pango.FontDescription();
description.set_size(10000);
this.el.override_font(description);
+
}
//listeners
int cell_x;
int cell_y;
Gtk.TreePath path;
+
+ // event x /y are relative to the widget..
if (!this.el.get_path_at_pos((int)ev.x, (int) ev.y, out path, out col, out cell_x, out cell_y )) {
GLib.debug("nothing selected on click");
GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
}
- // 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);
+ // single click on name..
+ //if (ev.type == Gdk.EventType.2BUTTON_PRESS && ev.button == 1 && col.title == "Name") {
+ if (ev.button == 1 && col.title == "Property") {
+ // need to shift down, as ev.y does not inclucde header apparently..
+ // or popover might be trying to do a central?
+ this.editPropertyDetails(path, (int) ev.y + 12);
return false;
}
}
// user defined functions
+ public void editPropertyDetails (Gtk.TreePath path, int y) {
+
+
+
+
+ _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 gval;
+
+ mod.get_value(iter,0, out gval);
+
+ this.popover.show(_this.view.el, _this.node, (JsRender.NodeProp)gval, y);
+
+
+ }
}
public class Xcls_model : Object
{
{
_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)
- );
+ this.el = new Gtk.TreeStore( 5, typeof(JsRender.NodeProp), // 0 key type
+ typeof(string), // 1 display_key
+ typeof(string), // 2 display_value
+ typeof(string), // 3 display_tooltip
+ typeof(string) // 4 sortable value
+/*
+ 0, prop,
+ 1, prop.to_display_name(),
+ 2, dis_val.
+ 3, "<tt>" + GLib.Markup.escape_text(key + " " +kvalue) + "</tt>",
+ 4, "0 " + prop.name
+
+ );
+ */ );
// my vars (dec)
// my vars (dec)
// set gobject values
- this.el.title = "Name";
+ this.el.title = "Property";
this.el.resizable = true;
var child_0 = new Xcls_keyrender( _this );
child_0.ref();
// init method
- this.el.add_attribute(_this.keyrender.el , "markup", 2 );
- this.el.add_attribute(_this.keyrender.el , "text", 1 );
+ this.el.add_attribute(_this.keyrender.el , "markup", 1 ); // 1 is the key.
+ //this.el.add_attribute(_this.keyrender.el , "text", 1 );
}
// user defined functions
// 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) => {
- GLib.debug("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;
- }
-
-
- GLib.debug("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
{
- // 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;
+ this.el.add_attribute(_this.valrender.el , "text", 2 );
+
}
}
// this.get('/LeftPanel.model').activePath = path;
- _this.model.el.get_value(iter,3, out gval);
+ _this.model.el.get_value(iter,0, out gval);
- var val = (string)gval;
+ var prop = (JsRender.NodeProp)gval;
var combo = (Gtk.ComboBox)editable;
var entry = (Gtk.Entry) combo.get_child();
- entry.set_text(val);
+ entry.set_text(prop.val);
}
});
GLib.debug("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();
+ var prop = (JsRender.NodeProp)gval;
+ prop.val = newtext;
+ _this.updateIter(iter,prop);
+ _this.changed();
});
}
// user defined functions
public void setOptions (string[] ar) {
- var m = _this.valrendermodel.el;
- m.clear();
- Gtk.TreeIter iret;
+ 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]);
+ m.append(out iret);
+ m.set_value(iret, 0, ar[i]);
}
}
var child_0 = new Xcls_MenuItem37( _this );
child_0.ref();
this.el.append ( child_0.el );
- var child_1 = new Xcls_SeparatorMenuItem38( _this );
- child_1.ref();
- this.el.append ( child_1.el );
- var child_2 = new Xcls_MenuItem39( _this );
- child_2.ref();
- this.el.append ( child_2.el );
}
// user defined functions
// 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_SeparatorMenuItem38 : Object
- {
- public Gtk.SeparatorMenuItem el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_SeparatorMenuItem38(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.SeparatorMenuItem();
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
- public class Xcls_MenuItem39 : Object
- {
- public Gtk.MenuItem el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_MenuItem39(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.MenuItem();
-
- // my vars (dec)
-
// set gobject values
this.el.label = "Delete";