X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=plugins%2Fdali-swig%2Fproperty-wrapper.rb;h=2701826c78199b5b6679e931e6d69550af681ecc;hp=e548f613de0a1b9b04e083970f8f1ca169f663e4;hb=97296c37e707676eb329e8b6e54e2b3efab83aae;hpb=7d13f3aa3f4ccf7c9c1c72ef182fd311663c6cd6 diff --git a/plugins/dali-swig/property-wrapper.rb b/plugins/dali-swig/property-wrapper.rb index e548f61..2701826 100755 --- a/plugins/dali-swig/property-wrapper.rb +++ b/plugins/dali-swig/property-wrapper.rb @@ -20,8 +20,8 @@ $typeTable = [ ["VECTOR4", "Vector4", "", "Vector4 temp = new Vector4(0.0f,0.0f,0.0f,0.0f);"], ["MATRIX3", "Matrix3", "", "Matrix3 temp = new Matrix3();"], ["MATRIX", "Matrix", "", "Matrix temp = new Matrix();" ], - ["RECTANGLE", "RectInteger", "", "RectInteger temp = new RectInteger(0,0,0,0);"], - ["ROTATION", "Quaternion", "", "Quaternion temp = new Quaternion();"], + ["RECTANGLE", "Rectangle", "", "Rectangle temp = new Rectangle(0,0,0,0);"], + ["ROTATION", "Rotation", "", "Rotation temp = new Rotation();"], ["STRING", "string", "out", "string temp;"], ["ARRAY", "Dali.Property.Array", "", "Dali.Property.Array temp = new Dali.Property.Array();"], ["MAP", "Dali.Property.Map", "", "Dali.Property.Map temp = new Dali.Property.Map();"], @@ -55,7 +55,7 @@ end # Property struct stores the information about a property after parsing the C++ DALI_PROPERTY macro -$propertyStruct = Struct.new("Property", :name, :type, :writable, :animatable,:constrainInput, :enum, :shortenum, :csharpGetter, :csharpSetter, :childProperty,) +$propertyStruct = Struct.new("Property", :name, :type, :writable, :animatable,:constrainInput, :enum, :shortenum, :develAPI, :csharpGetter, :csharpSetter, :childProperty,) # daliClass struct stores a class name and an array of properties $daliClassStruct = Struct.new("DaliClass", :name, :properties ) @@ -90,6 +90,16 @@ def extractPropertyInfo( propertyMacro ) # extract the property enum name Dali::Path::Property::POINTS -> POINTS shortenum = data[6].split(":").last + develAPI = false; + # Check if the property uses devel API + # Currently we ignore devel properties for now + if data[6].include? "Devel" + develAPI = true; + puts("Ignoring DEVEL API property: " + shortenum); + end + + + # store the :name, :type, :writable, :animatable, :constrainInput, :enum property = $propertyStruct.new; @@ -99,7 +109,7 @@ def extractPropertyInfo( propertyMacro ) property.animatable = (data[4] == "true") property.constrainInput = (data[5]=="true") property.enum = shortenum - + property.develAPI = develAPI; return property; end @@ -109,6 +119,14 @@ def extractToolkitPropertyInfo( propertyMacro ) # Extract the property name, type property = $propertyStruct.new; + #First strip out any comments at the end of the macro, some have text like // deprecated + commentIndex = propertyMacro.index("//"); + + if( commentIndex ) + propertyMacro = propertyMacro.slice(0..commentIndex-1) + end + + # Split the macro definition by comma and quotes, close bracket and delete any empty segments data = propertyMacro.split(/[\s,")]/).reject { |s| s.empty? } @@ -167,6 +185,7 @@ def extractToolkitPropertyInfo( propertyMacro ) property.type = data[4] end + # last item should be property enum, e.g. INPUT_POINT_SIZE property.enum = data[data.length-1] end @@ -221,7 +240,7 @@ def writePropertiesToCSharpFile( daliClass ) for property in daliClass.properties - if (!property.childProperty) + if( (!property.childProperty) && (!property.develAPI)) file.write( property.csharpGetter ); file.write( property.csharpSetter ); end @@ -293,6 +312,13 @@ def writeCSharpData next end + #exception case <<< + #Tooltip gives swig build error + if( property.name == "Tooltip" || property.name == "Color") + next + end + #exception case >>> + $totalProperties+=1 # keep track of total propertyType = propertyInfo[1] # e.g. bool or int @@ -309,9 +335,9 @@ def writeCSharpData hasChildProperties = true end - property.csharpGetter =" public #{propertyType} #{property.name} \n"\ - " { \n"\ - " get \n" \ + property.csharpGetter =" public #{propertyType} #{property.name}\n"\ + " {\n"\ + " get\n" \ " {\n"\ " #{tempDeclaration}\n"\ " GetProperty( #{propertyName}).Get( #{propertyArg} temp );\n"\ @@ -320,14 +346,31 @@ def writeCSharpData if property.writable #text.SetProperty(TextLabel.Property.HORIZONTAL_ALIGNMENT, new Property.Value("CENTER")); - property.csharpSetter = " set \n" \ - " { \n"\ + property.csharpSetter = " set\n" \ + " {\n"\ " SetProperty( #{propertyName}, new Dali.Property.Value( value ) );\n" \ " }\n"\ " }\n" else property.csharpSetter = "}" # close the opening property declaration end + + #exception case <<< + if( property.name == "Behavior" ) + property.csharpGetter =" public Layer.LayerBehavior #{property.name} \n"\ + " { \n"\ + " get \n" \ + " {\n"\ + " return GetBehavior();\n"\ + " }\n" + + property.csharpSetter = " set \n" \ + " { \n"\ + " SetBehavior( value );\n" \ + " }\n"\ + " }\n" + end + #exception case >>> end # write normal properties to the class's own csharp file writePropertiesToCSharpFile( daliClass ) @@ -460,13 +503,16 @@ def writeDaliToolkitProperties #puts(className); #puts(fileName); - # Get the property information ( name, type, read/writeable) + # Get the property information ( name, type, read/writeable) propertyInfo = extractToolkitPropertyInfo( macro ); # get or create a new DALi class item which stores the property information classItem = getDaliClassItem( className ) - classItem.properties.push( propertyInfo ) + # exclusion of control-data-impl + if ( className != "ControlData" ) + classItem.properties.push( propertyInfo ) + end end