From: Masao M. <mu...@us...> - 2005-05-06 08:32:26
|
Update of /cvsroot/ruby-gnome2/tools/mkrd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2779 Modified Files: ChangeLog mkrd.rb Log Message: Added to show Style/Child properties. Index: ChangeLog =================================================================== RCS file: /cvsroot/ruby-gnome2/tools/mkrd/ChangeLog,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- ChangeLog 5 May 2005 16:27:10 -0000 1.5 +++ ChangeLog 6 May 2005 08:31:58 -0000 1.6 @@ -1,6 +1,7 @@ 2005-05-06 Masao Mutoh <mu...@hi...> * mkrd.rb: Improve to show properties. + Added to show Style/Child properties. 2003-12-04 Masao Mutoh <mu...@hi...> Index: mkrd.rb =================================================================== RCS file: /cvsroot/ruby-gnome2/tools/mkrd/mkrd.rb,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- mkrd.rb 5 May 2005 16:27:10 -0000 1.5 +++ mkrd.rb 6 May 2005 08:31:58 -0000 1.6 @@ -42,9 +42,9 @@ class Property attr_reader :name - def initialize(klass, name) - @prop = klass.property(name) + def initialize(name, prop) @name = name + @prop = prop end def type @@ -141,6 +141,26 @@ end end +def find_properties(klass, parent, prefix) + properties = Array.new + if klass < parent + begin + props = klass.send("#{prefix}properties", false) + if props.size > 0 + properties = props.sort.collect{|name| + prop = klass.send("#{prefix}property", name) + Property.new(name, prop) + } + end + rescue + $stderr.print $! + $stderr.print klass.inspect, "\n" + exit + end + end + properties +end + def put_classmodule_info(modul) if Class === modul puts "= class #{modul.inspect}" @@ -193,6 +213,21 @@ end end +def put_properties(title, properties) + if properties.size > 0 + puts "== " + title + properties.each do |prop| + puts "--- #{prop.name}: #{prop.type} (#{prop.flags})" + puts " #{prop.blurb}\n\n" + end + end +end + +def put_special_properties(klass, title, parent, prefix) + properties = find_properties(klass, parent, prefix) + put_properties(title, properties) +end + def nest_classes(klass) if /(#{$TARGET_MODULES.join("|")})/ =~ klass.inspect put_classmodule_info(klass) @@ -211,26 +246,14 @@ methods -= Object.methods end - properties = Array.new + properties = find_properties(klass, GLib::Object, "") prop_methods = Array.new if (klass.kind_of? Class) #Class Methods put_methods("Class Methods", methods, klass.inspect + ".", RETURNS) # Properties -> getter/setter - if klass < GLib::Object - begin - props = klass.properties(false) - if props.size > 0 - properties = props.sort.collect{|name| Property.new(klass, name)} - prop_methods = properties.collect{|prop| prop.methods.collect{|m| m[0]}}.flatten - end - rescue - $stderr.print $! - $stderr.print klass.inspect, "\n" - exit - end - end + prop_methods = properties.collect{|prop| prop.methods.collect{|m| m[0]}}.flatten #Instance Methods instance_methods = klass.public_instance_methods(false) + klass.private_instance_methods(false) - ["initialize"] + klass.protected_instance_methods(false) - prop_methods @@ -252,15 +275,11 @@ put_methods("Constants", klass.constants_at) # - # Properties + # Properties/Style Properties/Child Properties # - if properties.size > 0 - puts "== Properties" - properties.each do |prop| - puts "--- #{prop.name}: #{prop.type} (#{prop.flags})" - puts " #{prop.blurb}\n\n" - end - end + put_properties("Properties", properties) + put_special_properties(klass, "Style Properties", Gtk::Widget, "style_") + put_special_properties(klass, "Child Properties", Gtk::Container, "child_") # # Signals |