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 newtext += (string)gval;
59 newtext += this.ktype.el.get_text().length > 0 && newtext.length > 0 ? " " :"";
60 newtext += this.ktype.el.get_text() ;
61 newtext += this.kname.el.get_text().length > 0 && newtext.length > 0 ? " " :"";
62 newtext += this.kname.el.get_text();
65 var lp = _this.mainwindow.windowstate.left_props;
67 switch(this.key_type) {
69 var ov = _this.node.listeners.get(this.old_keyname);
70 _this.node.listeners.set(newtext, ov);
71 _this.node.listeners.unset(this.old_keyname);
74 lp.updateKey(this.old_keyname, this.key_type, newtext);
78 var ov = _this.node.props.get(this.old_keyname);
79 _this.node.props.set(newtext, ov);
80 _this.node.props.unset(this.old_keyname);
81 lp.updateKey(this.old_keyname, this.key_type, newtext);
90 // user defined functions
91 public void show (Gtk.Widget btn, JsRender.Node node, string key_type, string key)
94 string kname = "", kflag = "", ktype = "";
96 node.normalize_key( key, out kname, out kflag, out ktype);
99 if (key_type == "listener") {
100 this.header.el.title = "Modify Event Listener";
102 this.header.el.title = "Modify Property";
105 this.key_type = key_type;
106 this.old_keyname = key;
109 _this.kname.el.set_text(kname);
110 _this.ktype.el.set_text(ktype);
112 _this.dbmodel.loadData(kflag);
113 // does node have this property...
119 //console.log('show all');
120 this.el.set_modal(true);
121 this.el.set_relative_to(btn);
123 this.el.set_position(Gtk.PositionType.TOP);
126 print("SHOWALL - POPIP\n");
128 this.kname.el.grab_focus();
130 //this.success = c.success;
133 public void updateNodeFromValues () {
135 /* _this.file.title = _this.title.el.get_text();
136 _this.file.region = _this.region.el.get_text();
137 _this.file.parent = _this.parent.el.get_text();
138 _this.file.permname = _this.permname.el.get_text();
139 _this.file.modOrder = _this.modOrder.el.get_text();
141 if (_this.file.name.length > 0 && _this.file.name != _this.name.el.get_text()) {
142 _this.file.renameTo(_this.name.el.get_text());
144 // store the module...
145 _this.file.build_module = "";
147 if (_this.build_module.el.get_active_iter (out iter)) {
149 this.dbmodel.el.get_value (iter, 0, out vfname);
150 if (((string)vfname).length > 0) {
151 _this.file.build_module = (string)vfname;
161 public class Xcls_Box2 : Object
164 private Xcls_PopoverProperty _this;
170 public Xcls_Box2(Xcls_PopoverProperty _owner )
173 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
177 // set gobject values
178 this.el.homogeneous = false;
179 var child_0 = new Xcls_header( _this );
181 this.el.pack_start ( child_0.el , false,true,0 );
182 var child_1 = new Xcls_Table4( _this );
184 this.el.pack_start ( child_1.el , false,false,4 );
187 // user defined functions
189 public class Xcls_header : Object
191 public Gtk.HeaderBar el;
192 private Xcls_PopoverProperty _this;
198 public Xcls_header(Xcls_PopoverProperty _owner )
202 this.el = new Gtk.HeaderBar();
206 // set gobject values
207 this.el.title = "Modify / Create Property";
210 // user defined functions
213 public class Xcls_Table4 : Object
216 private Xcls_PopoverProperty _this;
222 public Xcls_Table4(Xcls_PopoverProperty _owner )
225 this.el = new Gtk.Table( 3, 2, true );
229 // set gobject values
230 this.el.margin_right = 4;
231 this.el.margin_left = 4;
232 this.el.row_spacing = 2;
233 var child_0 = new Xcls_Label5( _this );
235 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
236 var child_1 = new Xcls_kflag( _this );
238 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
239 var child_2 = new Xcls_Label9( _this );
241 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
242 var child_3 = new Xcls_ktype( _this );
244 this.el.attach_defaults ( child_3.el , 1,2,1,2 );
245 var child_4 = new Xcls_Label11( _this );
247 this.el.attach_defaults ( child_4.el , 0,1,2,3 );
248 var child_5 = new Xcls_kname( _this );
250 this.el.attach_defaults ( child_5.el , 1,2,2,3 );
253 // user defined functions
255 public class Xcls_Label5 : Object
258 private Xcls_PopoverProperty _this;
264 public Xcls_Label5(Xcls_PopoverProperty _owner )
267 this.el = new Gtk.Label( "Special Flags" );
271 // set gobject values
272 this.el.justify = Gtk.Justification.RIGHT;
273 this.el.xalign = 0.900000f;
276 // user defined functions
279 public class Xcls_kflag : Object
281 public Gtk.ComboBox el;
282 private Xcls_PopoverProperty _this;
288 public Xcls_kflag(Xcls_PopoverProperty _owner )
292 this.el = new Gtk.ComboBox();
296 // set gobject values
297 var child_0 = new Xcls_dbcellrenderer( _this );
299 this.el.pack_start ( child_0.el , true );
300 var child_1 = new Xcls_dbmodel( _this );
302 this.el.set_model ( child_1.el );
306 this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 );
309 // user defined functions
311 public class Xcls_dbcellrenderer : Object
313 public Gtk.CellRendererText el;
314 private Xcls_PopoverProperty _this;
320 public Xcls_dbcellrenderer(Xcls_PopoverProperty _owner )
323 _this.dbcellrenderer = this;
324 this.el = new Gtk.CellRendererText();
328 // set gobject values
331 // user defined functions
334 public class Xcls_dbmodel : Object
336 public Gtk.ListStore el;
337 private Xcls_PopoverProperty _this;
343 public Xcls_dbmodel(Xcls_PopoverProperty _owner )
346 _this.dbmodel = this;
347 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
351 // set gobject values
354 // user defined functions
355 public void loadData (string kflag) {
363 // user defined property '#'
364 // user defined method '|'
365 // special property '*' => prop |args|ctor|init
369 /// el.append(out iter);
372 // el.set_value(iter, 0, "");
373 // el.set_value(iter, 1, "aaa - Just add Element - aaa");
376 el.set(iter, 0, "", 1, "Normal Property", -1);
378 if (_this.mainwindow.windowstate.file.xtype == "Gtk") {
380 el.set(iter, 0, "$", 1, "($) Raw Property (not escaped)", -1);
384 el.set(iter, 0, "#", 1, "(#) User defined property", -1);
387 el.set(iter, 0, "|", 1, "(|) User defined method", -1);
390 el.set(iter, 0, "*", 1, "(*) Special property (eg. prop | args | ctor | init )", -1);
394 el.set(iter, 0, "@", 1, "(@) Vala Signal", -1);
400 el.set(iter, 0, "$", 1, "($) Raw Property (not escaped)", -1);
403 el.set(iter, 0, "|", 1, "(|) User defined method", -1);
406 el.set(iter, 0, "*", 1, "(*) Special property (eg. prop )", -1);
410 el.foreach((tm, tp, titer) => {
412 el.get_value(titer, 0, out val);
414 print("check %s against %s\n", (string)val, kflag);
415 if (((string)val) == kflag) {
416 _this.kflag.el.set_active_iter(titer);
428 public class Xcls_Label9 : Object
431 private Xcls_PopoverProperty _this;
437 public Xcls_Label9(Xcls_PopoverProperty _owner )
440 this.el = new Gtk.Label( "Type or Return Type" );
444 // set gobject values
445 this.el.justify = Gtk.Justification.RIGHT;
446 this.el.xalign = 0.900000f;
447 this.el.visible = true;
450 // user defined functions
453 public class Xcls_ktype : Object
456 private Xcls_PopoverProperty _this;
462 public Xcls_ktype(Xcls_PopoverProperty _owner )
466 this.el = new Gtk.Entry();
470 // set gobject values
471 this.el.visible = true;
474 // user defined functions
477 public class Xcls_Label11 : Object
480 private Xcls_PopoverProperty _this;
486 public Xcls_Label11(Xcls_PopoverProperty _owner )
489 this.el = new Gtk.Label( "Name" );
493 // set gobject values
494 this.el.justify = Gtk.Justification.RIGHT;
495 this.el.xalign = 0.900000f;
496 this.el.tooltip_text = "center, north, south, east, west";
497 this.el.visible = true;
500 // user defined functions
503 public class Xcls_kname : Object
506 private Xcls_PopoverProperty _this;
512 public Xcls_kname(Xcls_PopoverProperty _owner )
516 this.el = new Gtk.Entry();
520 // set gobject values
521 this.el.visible = true;
524 // user defined functions