Fix #8076 - gtknotebookpage fake wrapper
[roobuilder] / src / JsRender / Node.vala
index 2db715f..c14b659 100644 (file)
@@ -110,7 +110,7 @@ public class JsRender.Node : GLib.Object {
        public Gee.HashMap<int,string> line_map; // store of l:xxx or p:....  // fixme - not needed as we can store line numbers in props now.
        public Gee.ArrayList<int> node_lines; 
        public Gee.HashMap<int,Node> node_lines_map; // store of l:xxx or p:....
-       
+       public JsRender? file = null;
        
        public string node_pad = "";
        
@@ -121,16 +121,17 @@ public class JsRender.Node : GLib.Object {
                }
                set  {
                        this.nodeTitleProp = ""; // ?? should trigger set?
-                       this.iconFilename = "";
+                       this.iconResourceName = "";
                        this._updated_count = value;
  
                                
                        //GLib.debug("Update Node %d p%d - rev %d", this.oid, this.parent != null ? this.parent.oid : -1, value);
                        if (this.parent != null) {
-                               this.parent.updated_count++;
+                               this.parent.updated_count++; // will recurse up.
                        }  else {
-                               //GLib.debug("UNDO top node is %d", value);
-                               this.version_changed();
+                               if (this.file != null) {
+                                       this.file.updateUndo();
+                               }
                        }
                }
  
@@ -138,8 +139,11 @@ public class JsRender.Node : GLib.Object {
        
        public string as_source = "";
        public int as_source_version = -1;
+       public int as_source_start_line = -1;
+        
        
-       public signal void  version_changed();
+       
+       //public signal void  version_changed();
        
        public Node()
        {
@@ -301,7 +305,7 @@ public class JsRender.Node : GLib.Object {
                
                for(var i= 0; i < this.propstore.get_n_items();i++) {
                        var p = (NodeProp) this.propstore.get_item(i);
-                       GLib.debug("prop %s lines %d -> %d", p.name, p.start_line, p.end_line);
+                       //GLib.debug("prop %s lines %d -> %d", p.name, p.start_line, p.end_line);
                        if (p.start_line > line) {
                                continue;
                        }
@@ -764,31 +768,30 @@ public class JsRender.Node : GLib.Object {
                                case PROP: 
                                case RAW: // should they be the same?
                                
-                                       props += "\n\t" + GLib.Markup.escape_text(prop.rtype) +
+                                       props += "\n\t" + (prop.rtype != null && prop.rtype.length > 0 ? GLib.Markup.escape_text(prop.rtype)  : "") +
                                                " <b>" + GLib.Markup.escape_text(i) +"</b> : " + 
-                                               GLib.Markup.escape_text(val.split("\n")[0]);
+                                               (val.length > 0 ? GLib.Markup.escape_text(val.split("\n")[0]) : "");
                                                
                                        break;
-                                       
-                       
+                                        
                                
                                case METHOD :
-                                       funcs += "\n\t" + GLib.Markup.escape_text(prop.rtype) +
+                                       funcs += "\n\t" + (prop.rtype != null && prop.rtype.length > 0 ? GLib.Markup.escape_text(prop.rtype)  : "")  +
                                                " <b>" + GLib.Markup.escape_text(i) +"</b> : "  +
-                                               GLib.Markup.escape_text(val.split("\n")[0]);
+                                               (val.length > 0 ? GLib.Markup.escape_text(val.split("\n")[0]) : "");
                                        break;
                                        
                                 
                                case USER : // user defined.
                                        uprops += "\n\t<b>" + 
                                                GLib.Markup.escape_text(i) +"</b> : " + 
-                                               GLib.Markup.escape_text(val.split("\n")[0]);
+                                               (val.length > 0 ? GLib.Markup.escape_text(val.split("\n")[0]) : "");
                                        break;
                                        
                                case SPECIAL : // * prop| args | ctor | init
                                        spec += "\n\t<b>" + 
                                                GLib.Markup.escape_text(i) +"</b> : " + 
-                                               GLib.Markup.escape_text(val.split("\n")[0]);
+                                               (val.length > 0 ? GLib.Markup.escape_text(val.split("\n")[0]) : "");
                                        break;
                                        
                                case LISTENER : return  "";  // always raw...
@@ -926,7 +929,7 @@ public class JsRender.Node : GLib.Object {
        }
        // used by trees to display icons?
        // needs more thought?!?
-       public string iconFilename { 
+       public string iconResourceName { 
                set {
                        // NOOp ??? should 
                }
@@ -935,7 +938,7 @@ public class JsRender.Node : GLib.Object {
     
                        var clsb = clsname.split(".");
                    var sub = clsb.length > 1 ? clsb[1].down()  : "";
-                       var fn = "/usr/share/glade/pixmaps/hicolor/16x16/actions/widget-gtk-" + sub + ".png";
+                       var fn = "/glade-icons/widget-gtk-" + sub + ".png";
                        //if (FileUtils.test (fn, FileTest.IS_REGULAR)) {
                                return fn;
                        //}
@@ -956,15 +959,17 @@ public class JsRender.Node : GLib.Object {
        
        public void insertChild(int pos, Node child)
        {
+               child.parent = this;
                this.items.insert(pos, child);
                this.childstore.insert(pos, child);
-               child.parent = this;
+               
        }
        public void appendChild(Node child)
        {
+               child.parent = this;
                this.items.add( child);
                this.childstore.append(child);
-               child.parent = this;
+
        }
        
        
@@ -985,7 +990,7 @@ public class JsRender.Node : GLib.Object {
 
        
        
-       public void loadProps(GLib.ListStore model) 
+       public void loadProps(GLib.ListStore model, Project.Project project
        {
        
                // fixme sorting?? - no need to loop twice .. just use sorting.!
@@ -993,6 +998,7 @@ public class JsRender.Node : GLib.Object {
                this.propstore = model;
                for(var i =  0; i < oldstore.n_items; i++ ) {
                        var it = (NodeProp) oldstore.get_item(i);
+                       it.update_is_valid_ptype(project);
                    model.append(it);
                        
                }