}
return _PopoverProperty;
}
- public Xcls_name name;
- public Xcls_title title;
- public Xcls_region region;
- public Xcls_parent parent;
- public Xcls_permname permname;
- public Xcls_modOrder modOrder;
- public Xcls_build_module build_module;
+ public Xcls_header header;
+ public Xcls_kflag kflag;
public Xcls_dbcellrenderer dbcellrenderer;
public Xcls_dbmodel dbmodel;
- public Xcls_save_btn save_btn;
+ public Xcls_ktype ktype;
+ public Xcls_kname kname;
// my vars (def)
+ public string old_keyname;
public signal void success (Project.Project pr, JsRender.JsRender file);
public bool done;
- public Project.Project project;
- public JsRender.JsRender file;
public Xcls_MainWindow mainwindow;
+ public string key_type;
+ public JsRender.Node node;
// ctor
public Xcls_PopoverProperty()
// my vars (dec)
this.done = false;
- this.file = null;
this.mainwindow = null;
// set gobject values
//listeners
this.el.closed.connect( () => {
- if (!this.done) {
- _this.el.show();
+
+
+ var newtext = "";
+ Gtk.TreeIter citer;
+ GLib.Value gval;
+ this.kflag.el.get_active_iter(out citer);
+ this.dbmodel.el.get_value(citer, 0, out gval);
+
+ var ktype = this.ktype.el.get_text().strip();
+ var kname = this.kname.el.get_text().strip();
+ newtext += ((string)gval).strip();
+ newtext += ktype.length > 0 && newtext.length > 0 ? " " :"";
+ newtext += ktype;
+ newtext += kname.length > 0 && newtext.length > 0 ? " " :"";
+ newtext += kname;
+
+
+ var lp = _this.mainwindow.windowstate.left_props;
+
+ switch(this.key_type) {
+ case "listener":
+ var ov = _this.node.listeners.get(this.old_keyname);
+ _this.node.listeners.set(newtext, ov);
+ if (this.old_keyname != newtext) {
+ _this.node.listeners.unset(this.old_keyname);
+ }
+
+
+ lp.updateKey(this.old_keyname, this.key_type, newtext);
+
+ break;
+ case "props":
+ var ov = _this.node.props.get(this.old_keyname);
+ _this.node.props.set(newtext, ov);
+ if (this.old_keyname != newtext) {
+ _this.node.props.unset(this.old_keyname);
+ }
+ lp.updateKey(this.old_keyname, this.key_type, newtext);
+ break;
+ }
+
+
- }
});
}
// user defined functions
- public void updateFileFromEntry () {
+ public void show (Gtk.Widget btn, JsRender.Node node, string key_type, string key)
+ {
+
+ string kname = "", kflag = "", ktype = "";
+ if (key.length > 0) {
+ node.normalize_key( key, out kname, out kflag, out ktype);
+ }
+
+ if (key_type == "listener") {
+ this.header.el.title = "Modify Event Listener";
+ } else {
+ this.header.el.title = "Modify Property";
+ }
+
+ this.key_type = key_type;
+ this.old_keyname = key;
+ this.node = node;
+
+ _this.kname.el.set_text(kname);
+ _this.ktype.el.set_text(ktype);
+
+ _this.dbmodel.loadData(kflag);
+ // does node have this property...
+
+
+
+
+ _this.node = node;
+ //console.log('show all');
+ this.el.set_modal(true);
+ this.el.set_relative_to(btn);
+
+ this.el.set_position(Gtk.PositionType.TOP);
- _this.file.title = _this.title.el.get_text();
+ // window + header?
+ print("SHOWALL - POPIP\n");
+ this.el.show_all();
+ this.kname.el.grab_focus();
+
+ //this.success = c.success;
+
+ }
+ public void updateNodeFromValues () {
+
+ /* _this.file.title = _this.title.el.get_text();
_this.file.region = _this.region.el.get_text();
_this.file.parent = _this.parent.el.get_text();
_this.file.permname = _this.permname.el.get_text();
}
}
+ */
- }
- public void show (JsRender.JsRender c, Gtk.Widget btn)
- {
- this.project = c.project;
- this.done = false;
-
-
- //if (!this.el) {
- //this.init();
- //}
-
- _this.name.el.set_text(c.name);
- _this.title.el.set_text(c.title);
- _this.parent.el.set_text(c.parent);
- _this.region.el.set_text(c.region);
- _this.modOrder.el.set_text(c.modOrder);
- _this.permname.el.set_text(c.permname);
-
- if (c.path.length > 0) {
-
- this.save_btn.el.set_label("Save");
- } else {
- this.save_btn.el.set_label("Create");
- }
-
- var ar = new Gee.ArrayList<string>();
- _this.dbmodel.loadData(ar,"");
- // load the modules... if relivant..
- if (this.project.xtype == "Gtk") {
- var p = (Project.Gtk)c.project;
- var cg = p.compilegroups;
-
- var iter = cg.map_iterator();
- while(iter.next()) {
- var key = iter.get_key();
- if (key == "_default_") {
- continue;
- }
- ar.add(key);
- };
- _this.dbmodel.loadData(ar, c.build_module);
-
- }
-
-
- _this.file = c;
- //console.log('show all');
- this.el.set_modal(true);
- this.el.set_relative_to(btn);
-
- this.el.set_position(Gtk.PositionType.RIGHT);
-
- // window + header?
- print("SHOWALL - POPIP\n");
- this.el.show_all();
- this.name.el.grab_focus();
-
- //this.success = c.success;
-
-
}
public class Xcls_Box2 : Object
{
// set gobject values
this.el.homogeneous = false;
- var child_0 = new Xcls_HeaderBar3( _this );
+ var child_0 = new Xcls_header( _this );
child_0.ref();
this.el.pack_start ( child_0.el , false,true,0 );
var child_1 = new Xcls_Table4( _this );
child_1.ref();
this.el.pack_start ( child_1.el , false,false,4 );
- var child_2 = new Xcls_HButtonBox21( _this );
- child_2.ref();
- this.el.pack_end ( child_2.el , false,true,0 );
}
// user defined functions
}
- public class Xcls_HeaderBar3 : Object
+ public class Xcls_header : Object
{
public Gtk.HeaderBar el;
private Xcls_PopoverProperty _this;
// my vars (def)
// ctor
- public Xcls_HeaderBar3(Xcls_PopoverProperty _owner )
+ public Xcls_header(Xcls_PopoverProperty _owner )
{
_this = _owner;
+ _this.header = this;
this.el = new Gtk.HeaderBar();
// my vars (dec)
// set gobject values
- this.el.title = "Add / Edit File";
+ this.el.title = "Modify / Create Property";
}
// user defined functions
var child_0 = new Xcls_Label5( _this );
child_0.ref();
this.el.attach_defaults ( child_0.el , 0,1,0,1 );
- var child_1 = new Xcls_name( _this );
+ var child_1 = new Xcls_kflag( _this );
child_1.ref();
this.el.attach_defaults ( child_1.el , 1,2,0,1 );
- var child_2 = new Xcls_Label7( _this );
+ var child_2 = new Xcls_Label9( _this );
child_2.ref();
this.el.attach_defaults ( child_2.el , 0,1,1,2 );
- var child_3 = new Xcls_title( _this );
+ var child_3 = new Xcls_ktype( _this );
child_3.ref();
this.el.attach_defaults ( child_3.el , 1,2,1,2 );
- var child_4 = new Xcls_Label9( _this );
+ var child_4 = new Xcls_Label11( _this );
child_4.ref();
this.el.attach_defaults ( child_4.el , 0,1,2,3 );
- var child_5 = new Xcls_region( _this );
+ var child_5 = new Xcls_kname( _this );
child_5.ref();
this.el.attach_defaults ( child_5.el , 1,2,2,3 );
- var child_6 = new Xcls_Label11( _this );
- child_6.ref();
- this.el.attach_defaults ( child_6.el , 0,1,3,4 );
- var child_7 = new Xcls_parent( _this );
- child_7.ref();
- this.el.attach_defaults ( child_7.el , 1,2,3,4 );
- var child_8 = new Xcls_Label13( _this );
- child_8.ref();
- this.el.attach_defaults ( child_8.el , 0,1,4,5 );
- var child_9 = new Xcls_permname( _this );
- child_9.ref();
- this.el.attach_defaults ( child_9.el , 1,2,4,5 );
- var child_10 = new Xcls_Label15( _this );
- child_10.ref();
- this.el.attach_defaults ( child_10.el , 0,1,5,6 );
- var child_11 = new Xcls_modOrder( _this );
- child_11.ref();
- this.el.attach_defaults ( child_11.el , 1,2,5,6 );
- var child_12 = new Xcls_Label17( _this );
- child_12.ref();
- this.el.attach_defaults ( child_12.el , 0,1,6,7 );
- var child_13 = new Xcls_build_module( _this );
- child_13.ref();
- this.el.attach_defaults ( child_13.el , 1,2,6,7 );
}
// user defined functions
public Xcls_Label5(Xcls_PopoverProperty _owner )
{
_this = _owner;
- this.el = new Gtk.Label( "Component Name" );
-
- // my vars (dec)
-
- // set gobject values
- this.el.justify = Gtk.Justification.RIGHT;
- this.el.xalign = 0.900000f;
- }
-
- // user defined functions
- }
-
- public class Xcls_name : Object
- {
- public Gtk.Entry el;
- private Xcls_PopoverProperty _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_name(Xcls_PopoverProperty _owner )
- {
- _this = _owner;
- _this.name = this;
- this.el = new Gtk.Entry();
-
- // my vars (dec)
-
- // set gobject values
- this.el.visible = true;
- }
-
- // user defined functions
- }
-
- public class Xcls_Label7 : Object
- {
- public Gtk.Label el;
- private Xcls_PopoverProperty _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Label7(Xcls_PopoverProperty _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "Title" );
-
- // my vars (dec)
-
- // set gobject values
- this.el.justify = Gtk.Justification.RIGHT;
- this.el.xalign = 0.900000f;
- this.el.visible = true;
- }
-
- // user defined functions
- }
-
- public class Xcls_title : Object
- {
- public Gtk.Entry el;
- private Xcls_PopoverProperty _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_title(Xcls_PopoverProperty _owner )
- {
- _this = _owner;
- _this.title = this;
- this.el = new Gtk.Entry();
-
- // my vars (dec)
-
- // set gobject values
- this.el.visible = true;
- }
-
- // user defined functions
- }
-
- public class Xcls_Label9 : Object
- {
- public Gtk.Label el;
- private Xcls_PopoverProperty _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Label9(Xcls_PopoverProperty _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "Region" );
-
- // my vars (dec)
-
- // set gobject values
- this.el.justify = Gtk.Justification.RIGHT;
- this.el.xalign = 0.900000f;
- this.el.tooltip_text = "center, north, south, east, west";
- this.el.visible = true;
- }
-
- // user defined functions
- }
-
- public class Xcls_region : Object
- {
- public Gtk.Entry el;
- private Xcls_PopoverProperty _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_region(Xcls_PopoverProperty _owner )
- {
- _this = _owner;
- _this.region = this;
- this.el = new Gtk.Entry();
-
- // my vars (dec)
-
- // set gobject values
- this.el.visible = true;
- }
-
- // user defined functions
- }
-
- public class Xcls_Label11 : Object
- {
- public Gtk.Label el;
- private Xcls_PopoverProperty _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Label11(Xcls_PopoverProperty _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "Parent Name" );
-
- // my vars (dec)
-
- // set gobject values
- this.el.justify = Gtk.Justification.RIGHT;
- this.el.xalign = 0.900000f;
- this.el.visible = true;
- }
-
- // user defined functions
- }
-
- public class Xcls_parent : Object
- {
- public Gtk.Entry el;
- private Xcls_PopoverProperty _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_parent(Xcls_PopoverProperty _owner )
- {
- _this = _owner;
- _this.parent = this;
- this.el = new Gtk.Entry();
-
- // my vars (dec)
-
- // set gobject values
- this.el.visible = true;
- }
-
- // user defined functions
- }
-
- public class Xcls_Label13 : Object
- {
- public Gtk.Label el;
- private Xcls_PopoverProperty _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Label13(Xcls_PopoverProperty _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "Permission Name" );
+ this.el = new Gtk.Label( "Special Flags" );
// my vars (dec)
// set gobject values
this.el.justify = Gtk.Justification.RIGHT;
this.el.xalign = 0.900000f;
- this.el.visible = true;
}
// user defined functions
}
- public class Xcls_permname : Object
- {
- public Gtk.Entry el;
- private Xcls_PopoverProperty _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_permname(Xcls_PopoverProperty _owner )
- {
- _this = _owner;
- _this.permname = this;
- this.el = new Gtk.Entry();
-
- // my vars (dec)
-
- // set gobject values
- this.el.visible = true;
- }
-
- // user defined functions
- }
-
- public class Xcls_Label15 : Object
- {
- public Gtk.Label el;
- private Xcls_PopoverProperty _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Label15(Xcls_PopoverProperty _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "Order (for tabs)" );
-
- // my vars (dec)
-
- // set gobject values
- this.el.justify = Gtk.Justification.RIGHT;
- this.el.xalign = 0.900000f;
- this.el.visible = true;
- }
-
- // user defined functions
- }
-
- public class Xcls_modOrder : Object
- {
- public Gtk.Entry el;
- private Xcls_PopoverProperty _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_modOrder(Xcls_PopoverProperty _owner )
- {
- _this = _owner;
- _this.modOrder = this;
- this.el = new Gtk.Entry();
-
- // my vars (dec)
-
- // set gobject values
- this.el.visible = true;
- }
-
- // user defined functions
- }
-
- public class Xcls_Label17 : Object
- {
- public Gtk.Label el;
- private Xcls_PopoverProperty _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Label17(Xcls_PopoverProperty _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "Module to build (Vala only)" );
-
- // my vars (dec)
-
- // set gobject values
- this.el.justify = Gtk.Justification.RIGHT;
- this.el.xalign = 0.900000f;
- this.el.visible = true;
- }
-
- // user defined functions
- }
-
- public class Xcls_build_module : Object
+ public class Xcls_kflag : Object
{
public Gtk.ComboBox el;
private Xcls_PopoverProperty _this;
// my vars (def)
// ctor
- public Xcls_build_module(Xcls_PopoverProperty _owner )
+ public Xcls_kflag(Xcls_PopoverProperty _owner )
{
_this = _owner;
- _this.build_module = this;
+ _this.kflag = this;
this.el = new Gtk.ComboBox();
// my vars (dec)
}
// user defined functions
- public void loadData (Gee.ArrayList<string> data, string cur) {
+ public void loadData (string kflag) {
this.el.clear();
Gtk.TreeIter iter;
var el = this.el;
+
+ // vala signal.. '@'
+ // raw value '$'
+ // user defined property '#'
+ // user defined method '|'
+ // special property '*' => prop |args|ctor|init
+
+
+
/// el.append(out iter);
// el.set_value(iter, 1, "aaa - Just add Element - aaa");
el.append(out iter);
+ el.set(iter, 0, "", 1, "Normal Property", -1);
+
+ if (_this.mainwindow.windowstate.file.xtype == "Gtk") {
+ el.append(out iter);
+ el.set(iter, 0, "$", 1, "($) Raw Property (not escaped)", -1);
+
+
+ el.append(out iter);
+ el.set(iter, 0, "#", 1, "(#) User defined property", -1);
+
+ el.append(out iter);
+ el.set(iter, 0, "|", 1, "(|) User defined method", -1);
+
+ el.append(out iter);
+ el.set(iter, 0, "*", 1, "(*) Special property (eg. prop | args | ctor | init )", -1);
+
+
+ el.append(out iter);
+ el.set(iter, 0, "@", 1, "(@) Vala Signal", -1);
+
+
+ } else {
+ // javascript
+ el.append(out iter);
+ el.set(iter, 0, "$", 1, "($) Raw Property (not escaped)", -1);
+
+ el.append(out iter);
+ el.set(iter, 0, "|", 1, "(|) User defined method", -1);
+
+ el.append(out iter);
+ el.set(iter, 0, "*", 1, "(*) Special property (eg. prop )", -1);
+
+
+ }
+ el.foreach((tm, tp, titer) => {
+ GLib.Value val;
+ el.get_value(titer, 0, out val);
+
+ print("check %s against %s\n", (string)val, kflag);
+ if (((string)val) == kflag) {
+ _this.kflag.el.set_active_iter(titer);
+ return true;
+ }
+ return false;
+ });
+
-
- el.set_value(iter, 0, "");
- el.set_value(iter, 1, "-- select a module --");
- _this.build_module.el.set_active_iter(iter);
-
- for (var i = 0; i < data.size;i++) {
-
-
- el.append(out iter);
-
- el.set_value(iter, 0, data.get(i));
- el.set_value(iter, 1, data.get(i));
-
- if (data.get(i) == cur) {
- _this.build_module.el.set_active_iter(iter);
- }
-
- }
- this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
}
}
-
- public class Xcls_HButtonBox21 : Object
+ public class Xcls_Label9 : Object
{
- public Gtk.HButtonBox el;
+ public Gtk.Label el;
private Xcls_PopoverProperty _this;
// my vars (def)
// ctor
- public Xcls_HButtonBox21(Xcls_PopoverProperty _owner )
+ public Xcls_Label9(Xcls_PopoverProperty _owner )
{
_this = _owner;
- this.el = new Gtk.HButtonBox();
+ this.el = new Gtk.Label( "Type or Return Type" );
// my vars (dec)
// set gobject values
- this.el.margin_right = 4;
- this.el.margin_left = 4;
- this.el.margin_bottom = 4;
- var child_0 = new Xcls_Button22( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- var child_1 = new Xcls_save_btn( _this );
- child_1.ref();
- this.el.add ( child_1.el );
+ this.el.justify = Gtk.Justification.RIGHT;
+ this.el.xalign = 0.900000f;
+ this.el.visible = true;
}
// user defined functions
}
- public class Xcls_Button22 : Object
+
+ public class Xcls_ktype : Object
{
- public Gtk.Button el;
+ public Gtk.Entry el;
private Xcls_PopoverProperty _this;
// my vars (def)
// ctor
- public Xcls_Button22(Xcls_PopoverProperty _owner )
+ public Xcls_ktype(Xcls_PopoverProperty _owner )
{
_this = _owner;
- this.el = new Gtk.Button();
+ _this.ktype = this;
+ this.el = new Gtk.Entry();
// my vars (dec)
// set gobject values
- this.el.label = "Cancel";
-
- //listeners
- this.el.clicked.connect( () => {
-
- _this.done = true;
- _this.el.hide();
- });
+ this.el.visible = true;
}
// user defined functions
}
- public class Xcls_save_btn : Object
+ public class Xcls_Label11 : Object
{
- public Gtk.Button el;
+ public Gtk.Label el;
private Xcls_PopoverProperty _this;
// my vars (def)
// ctor
- public Xcls_save_btn(Xcls_PopoverProperty _owner )
+ public Xcls_Label11(Xcls_PopoverProperty _owner )
{
_this = _owner;
- _this.save_btn = this;
- this.el = new Gtk.Button();
+ this.el = new Gtk.Label( "Name" );
// my vars (dec)
// set gobject values
- this.el.label = "Save";
+ this.el.justify = Gtk.Justification.RIGHT;
+ this.el.xalign = 0.900000f;
+ this.el.tooltip_text = "center, north, south, east, west";
+ this.el.visible = true;
+ }
- //listeners
- this.el.clicked.connect( ( ) => {
-
-
-
-
- if (_this.name.el.get_text().length < 1) {
- StandardErrorDialog.show(
- _this.mainwindow.el,
- "You have to set Component name "
- );
-
- return;
- }
- // what does this do?
-
- var isNew = _this.file.name.length > 0 ? false : true;
- /*
- if (!isNew && this.file.name != _this.name.el.get_text()) {
- Xcls_StandardErrorDialog.singleton().show(
- this.el,
- "Sorry changing names does not work yet. "
- );
-
- return;
- }
- */
-
-
-
- // FIXME - this may be more complicated...
- //for (var i in this.def) {
- // this.file[i] = this.get(i).el.get_text();
- //}
-
- if (!isNew) {
- try {
- _this.updateFileFromEntry();
- } catch( JsRender.Error.RENAME_FILE_EXISTS er) {
- Xcls_StandardErrorDialog.singleton().show(
- _this.mainwindow.el,
- "The name you used already exists "
- );
- return;
-
- }
-
- _this.done = true;
- _this.file.save();
- _this.el.hide();
- return;
- }
- var fn = _this.name.el.get_text();
- var dir = _this.project.firstPath();
-
- if (GLib.FileUtils.test(dir + "/" + fn + ".bjs", GLib.FileTest.EXISTS)) {
- Xcls_StandardErrorDialog.singleton().show(
- _this.mainwindow.el,
- "That file already exists"
- );
- return;
- }
-
- var f = JsRender.JsRender.factory(
- _this.file.project.xtype,
- _this.file.project,
- dir + "/" + fn + ".bjs");
-
- _this.file = f;
-
-
-
- _this.updateFileFromEntry();
- _this.file.loaded = true;
- _this.file.save();
- _this.file.project.addFile(_this.file);
-
-
- // what about .js ?
- _this.done = true;
- _this.el.hide();
-
-
-
- _this.success(_this.project, _this.file);
-
- });
+ // user defined functions
+ }
+
+ public class Xcls_kname : Object
+ {
+ public Gtk.Entry el;
+ private Xcls_PopoverProperty _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_kname(Xcls_PopoverProperty _owner )
+ {
+ _this = _owner;
+ _this.kname = this;
+ this.el = new Gtk.Entry();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.visible = true;
}
// user defined functions