1 static Xcls_PopoverProperty _PopoverProperty;
3 public class Xcls_PopoverProperty : Object
6 private Xcls_PopoverProperty _this;
8 public static Xcls_PopoverProperty singleton()
10 if (_PopoverProperty == null) {
11 _PopoverProperty= new Xcls_PopoverProperty();
13 return _PopoverProperty;
15 public Xcls_header header;
16 public Xcls_kflag kflag;
17 public Xcls_dbcellrenderer dbcellrenderer;
18 public Xcls_dbmodel dbmodel;
19 public Xcls_ktype ktype;
20 public Xcls_kname kname;
23 public string old_keyname;
24 public signal void success (Project.Project pr, JsRender.JsRender file);
26 public Xcls_MainWindow mainwindow;
27 public string key_type;
28 public JsRender.Node node;
31 public Xcls_PopoverProperty()
34 this.el = new Gtk.Popover( null );
38 this.mainwindow = null;
41 this.el.border_width = 0;
43 this.el.position = Gtk.PositionType.RIGHT;
44 var child_0 = new Xcls_Box2( _this );
46 this.el.add ( child_0.el );
49 this.el.closed.connect( () => {
55 this.kflag.el.get_active_iter(out citer);
56 this.dbmodel.el.get_value(citer, 0, out gval);
58 var ktype = this.ktype.el.get_text().strip();
59 var kname = this.kname.el.get_text().strip();
60 newtext += ((string)gval).strip();
61 newtext += ktype.length > 0 && newtext.length > 0 ? " " :"";
63 newtext += kname.length > 0 && newtext.length > 0 ? " " :"";
67 var lp = _this.mainwindow.windowstate.left_props;
69 switch(this.key_type) {
71 var ov = _this.node.listeners.get(this.old_keyname);
72 _this.node.listeners.set(newtext, ov);
73 if (this.old_keyname != newtext) {
74 _this.node.listeners.unset(this.old_keyname);
78 lp.updateKey(this.old_keyname, this.key_type, newtext);
82 var ov = _this.node.props.get(this.old_keyname);
83 _this.node.props.set(newtext, ov);
84 if (this.old_keyname != newtext) {
85 _this.node.props.unset(this.old_keyname);
87 lp.updateKey(this.old_keyname, this.key_type, newtext);
96 // user defined functions
97 public void show (Gtk.Widget btn, JsRender.Node node, string key_type, string key)
100 string kname = "", kflag = "", ktype = "";
101 if (key.length > 0) {
102 node.normalize_key( key, out kname, out kflag, out ktype);
105 if (key_type == "listener") {
106 this.header.el.title = "Modify Event Listener";
108 this.header.el.title = "Modify Property";
111 this.key_type = key_type;
112 this.old_keyname = key;
115 _this.kname.el.set_text(kname);
116 _this.ktype.el.set_text(ktype);
118 _this.dbmodel.loadData(kflag);
119 // does node have this property...
125 //console.log('show all');
126 this.el.set_modal(true);
127 this.el.set_relative_to(btn);
129 this.el.set_position(Gtk.PositionType.TOP);
132 print("SHOWALL - POPIP\n");
134 this.kname.el.grab_focus();
136 //this.success = c.success;
139 public void updateNodeFromValues () {
141 /* _this.file.title = _this.title.el.get_text();
142 _this.file.region = _this.region.el.get_text();
143 _this.file.parent = _this.parent.el.get_text();
144 _this.file.permname = _this.permname.el.get_text();
145 _this.file.modOrder = _this.modOrder.el.get_text();
147 if (_this.file.name.length > 0 && _this.file.name != _this.name.el.get_text()) {
148 _this.file.renameTo(_this.name.el.get_text());
150 // store the module...
151 _this.file.build_module = "";
153 if (_this.build_module.el.get_active_iter (out iter)) {
155 this.dbmodel.el.get_value (iter, 0, out vfname);
156 if (((string)vfname).length > 0) {
157 _this.file.build_module = (string)vfname;
167 public class Xcls_Box2 : Object
170 private Xcls_PopoverProperty _this;
176 public Xcls_Box2(Xcls_PopoverProperty _owner )
179 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
183 // set gobject values
184 this.el.homogeneous = false;
185 var child_0 = new Xcls_header( _this );
187 this.el.pack_start ( child_0.el , false,true,0 );
188 var child_1 = new Xcls_Table4( _this );
190 this.el.pack_start ( child_1.el , false,false,4 );
193 // user defined functions
195 public class Xcls_header : Object
197 public Gtk.HeaderBar el;
198 private Xcls_PopoverProperty _this;
204 public Xcls_header(Xcls_PopoverProperty _owner )
208 this.el = new Gtk.HeaderBar();
212 // set gobject values
213 this.el.title = "Modify / Create Property";
216 // user defined functions
219 public class Xcls_Table4 : Object
222 private Xcls_PopoverProperty _this;
228 public Xcls_Table4(Xcls_PopoverProperty _owner )
231 this.el = new Gtk.Table( 3, 2, true );
235 // set gobject values
236 this.el.margin_right = 4;
237 this.el.margin_left = 4;
238 this.el.row_spacing = 2;
239 var child_0 = new Xcls_Label5( _this );
241 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
242 var child_1 = new Xcls_kflag( _this );
244 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
245 var child_2 = new Xcls_Label9( _this );
247 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
248 var child_3 = new Xcls_ktype( _this );
250 this.el.attach_defaults ( child_3.el , 1,2,1,2 );
251 var child_4 = new Xcls_Label11( _this );
253 this.el.attach_defaults ( child_4.el , 0,1,2,3 );
254 var child_5 = new Xcls_kname( _this );
256 this.el.attach_defaults ( child_5.el , 1,2,2,3 );
259 // user defined functions
261 public class Xcls_Label5 : Object
264 private Xcls_PopoverProperty _this;
270 public Xcls_Label5(Xcls_PopoverProperty _owner )
273 this.el = new Gtk.Label( "Special Flags" );
277 // set gobject values
278 this.el.justify = Gtk.Justification.RIGHT;
279 this.el.xalign = 0.900000f;
282 // user defined functions
285 public class Xcls_kflag : Object
287 public Gtk.ComboBox el;
288 private Xcls_PopoverProperty _this;
294 public Xcls_kflag(Xcls_PopoverProperty _owner )
298 this.el = new Gtk.ComboBox();
302 // set gobject values
303 var child_0 = new Xcls_dbcellrenderer( _this );
305 this.el.pack_start ( child_0.el , true );
306 var child_1 = new Xcls_dbmodel( _this );
308 this.el.set_model ( child_1.el );
312 this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 );
315 // user defined functions
317 public class Xcls_dbcellrenderer : Object
319 public Gtk.CellRendererText el;
320 private Xcls_PopoverProperty _this;
326 public Xcls_dbcellrenderer(Xcls_PopoverProperty _owner )
329 _this.dbcellrenderer = this;
330 this.el = new Gtk.CellRendererText();
334 // set gobject values
337 // user defined functions
340 public class Xcls_dbmodel : Object
342 public Gtk.ListStore el;
343 private Xcls_PopoverProperty _this;
349 public Xcls_dbmodel(Xcls_PopoverProperty _owner )
352 _this.dbmodel = this;
353 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
357 // set gobject values
360 // user defined functions
361 public void loadData (string kflag) {
369 // user defined property '#'
370 // user defined method '|'
371 // special property '*' => prop |args|ctor|init
375 /// el.append(out iter);
378 // el.set_value(iter, 0, "");
379 // el.set_value(iter, 1, "aaa - Just add Element - aaa");
382 el.set(iter, 0, "", 1, "Normal Property", -1);
384 if (_this.mainwindow.windowstate.file.xtype == "Gtk") {
386 el.set(iter, 0, "$", 1, "($) Raw Property (not escaped)", -1);
390 el.set(iter, 0, "#", 1, "(#) User defined property", -1);
393 el.set(iter, 0, "|", 1, "(|) User defined method", -1);
396 el.set(iter, 0, "*", 1, "(*) Special property (eg. prop | args | ctor | init )", -1);
400 el.set(iter, 0, "@", 1, "(@) Vala Signal", -1);
406 el.set(iter, 0, "$", 1, "($) Raw Property (not escaped)", -1);
409 el.set(iter, 0, "|", 1, "(|) User defined method", -1);
412 el.set(iter, 0, "*", 1, "(*) Special property (eg. prop )", -1);
416 el.foreach((tm, tp, titer) => {
418 el.get_value(titer, 0, out val);
420 print("check %s against %s\n", (string)val, kflag);
421 if (((string)val) == kflag) {
422 _this.kflag.el.set_active_iter(titer);
434 public class Xcls_Label9 : Object
437 private Xcls_PopoverProperty _this;
443 public Xcls_Label9(Xcls_PopoverProperty _owner )
446 this.el = new Gtk.Label( "Type or Return Type" );
450 // set gobject values
451 this.el.justify = Gtk.Justification.RIGHT;
452 this.el.xalign = 0.900000f;
453 this.el.visible = true;
456 // user defined functions
459 public class Xcls_ktype : Object
462 private Xcls_PopoverProperty _this;
468 public Xcls_ktype(Xcls_PopoverProperty _owner )
472 this.el = new Gtk.Entry();
476 // set gobject values
477 this.el.visible = true;
480 // user defined functions
483 public class Xcls_Label11 : Object
486 private Xcls_PopoverProperty _this;
492 public Xcls_Label11(Xcls_PopoverProperty _owner )
495 this.el = new Gtk.Label( "Name" );
499 // set gobject values
500 this.el.justify = Gtk.Justification.RIGHT;
501 this.el.xalign = 0.900000f;
502 this.el.tooltip_text = "center, north, south, east, west";
503 this.el.visible = true;
506 // user defined functions
509 public class Xcls_kname : Object
512 private Xcls_PopoverProperty _this;
518 public Xcls_kname(Xcls_PopoverProperty _owner )
522 this.el = new Gtk.Entry();
526 // set gobject values
527 this.el.visible = true;
530 // user defined functions