Hey Alex,

You can basically just copy & paste the type of code that btouch generates
and just put them into extensions.cs in partial classes and then use the
following build rule:

-mkdir -p generated
$(BTOUCH) -e DescriptionFile.cs enums.cs --tmpdir=generated
--sourceonly=list
$(SMCS) -out:$@ @list enums.cs extensions.cs AssemblyInfo.cs
-r:monotouch.dll -res:libAjiPDFLib.a,libAjiPDFLib.a


if you take a look at generated/AlexTouch.AjiPDF/APOutlineElement.g.cs you
can see the generale structure of generated code.

For example, you could add the following partial class to the build (either
as part of extensions.cs or simply as a new file):

partial class APOutlineElement {
static IntPtr selChild = Selector.GetHandle ("children:");

[Export ("children:")]
public virtual APOutlineElement Child (uint index)
{
return (APOutlineElement) Runtime.GetNSObject
(MonoTouch.ObjCRuntime.Messaging.IntPtr_objc_msgSend_UInt32 (this.Handle,
selChild, index));
}
}


I renamed the method "Child" because it doesn't really return children, it
simply returns 1 of the children (the one at a specific index) and also
because Child/selChild doen't conflict with other
methods/properties/selector names ;-)

Anyways, hope that gives you the general idea of how to do it.

Jeff

On Tue, Nov 8, 2011 at 11:28 AM, Alex Soto <[email protected]> wrote:

> Thanks a lot Jeff i hope you guys release 5.0.3 before November 19 because
> that day my MTouch Pro Expires :( and I don't have  money right now to
> renew it its been a tough year for me and also I'm Getting Married hehehe.
>
> Thanks again I will make those changes and just one more question how can
> i manually bind it? i mean can Btouch and Manually binding selectors can
> coexist? any sample would be very useful.
>
> Alex
>
> On Nov 8, 2011, at 10:12 AM, Jeff Stedfast wrote:
>
> Oh! Actually... there's a bug in btouch wrt -x in MonoTouch <= 5.0.2 (will
> be fixed in 5.0.3), so you can't actually use -x and will need to do a
> 2-stage compile like the CorePlot binding. Not using -x works fine, as in
> your case, but only because the partial classes in extensions.cs don't
> conflict with any interfaces in DescriptionFile.cs.
>
> Jeff
>
> On Tue, Nov 8, 2011 at 11:06 AM, Jeff Stedfast <[email protected]> wrote:
>
>> Hey Alex,
>>
>> I'd probably suggest a few slight changes:
>>
>> For APPDFDocument, I'd suggest making IsEncrypted(), IsDecrypted(), and
>> PageCount() into getter properties rather than methods.
>>
>> Same for other cases like AreasCount(), etc in some of the other classes.
>>
>> As far as the TODO's... seems like btouch's assumptions about conventions
>> don't hold true for this particular case. Might have to manually bind them
>> for now :-(
>>
>> I'll try to bring this up with Miguel and see if we cant come up with a
>> fix for btouch that would solve this and not break anything else. Perhaps
>> the generator can be made to name the getter selector for "children" to be
>> selGetChildren rather than selChildren, so that "children:" can safely
>> exist as selChildren.
>>
>>
>> When playing around with this, I did notice a problem with the Makefile.
>> The btouch command should probably be:
>>
>> $(BTOUCH) -e DescriptionFile.cs -s enums.cs -x extensions.cs -x
>> AssemblyInfo.cs --out=$@ --link-with=libAjiPDFLib.a,libAjiPDFLib.a
>>
>> The -s means that the following source file is meant to be built into
>> temp.dll *and* the final .dll, the -x's are for files meant to only be
>> included in the build of the final .dll.
>>
>> In this particular case, it doesn't seem to matter (it still builds
>> fine), but depending on how the binding evolves, it might not continue
>> working.
>>
>> Also, the rule:
>>
>> libAjiPDFLib.a: libAjiPDFLib.a
>>
>> Doesn't actually do anything. I suspect this was just accidently left
>> there as the Makefile evolved for the purpose of this particular binding.
>>
>> Jeff
>>
>>
>> On Tue, Nov 8, 2011 at 1:47 AM, Alex Soto <[email protected]> wrote:
>>
>>> Hello!!
>>>
>>> Sorry it took me a little bit longer than expected but here you are i
>>> bound AjiPDF to MonoTouch
>>>
>>> https://github.com/dalexsoto/AlexTouch.AjiPDF
>>>
>>> its almost complete i just would like Jeff to review the TODOS on this
>>> file or anyone with more btouch experience than me ;)
>>>
>>>
>>> https://github.com/dalexsoto/AlexTouch.AjiPDF/blob/master/binding/DescriptionFile.cs
>>>
>>>
>>> the problem in witch i got stuck is that on the .h files there are 4
>>> Properties that are named equal to another 4 selectors in the same class,
>>> for example
>>>
>>> [Export ("children")]
>>>
>>> NSArray children { get;  }
>>>
>>>
>>> and
>>>
>>> [Export ("children:")]
>>>
>>> APOutlineElement Children (uint index);
>>>
>>>
>>> so when i ran btouch command it complains about on temp xxxxx.g.cs files
>>> it has already defined selChildren so i commented out those 4 selectors and
>>> left uncommented the 4 props for now, until someone can put me on the right
>>> direction.
>>>
>>> any ideas are more than welcome :)
>>>
>>> btw, I have not tested the binding I'm kinda short in time this week  so
>>> Jason if you could give this a try or anyone else that would be really cool
>>> and Jeff I will send the pull request as soon as the issue of the
>>> properties gets fixed :)
>>>
>>> Happy Mono Coding.
>>>
>>> Alex Soto
>>>
>>>
>>> On Nov 4, 2011, at 4:12 PM, Jason Awbrey wrote:
>>>
>>> Alex, that would be extremely helpful, thanks
>>>
>>> On Fri, Nov 4, 2011 at 4:16 PM, Alex Soto <[email protected]> wrote:
>>>
>>>> I will see if i get some time today to take a look into binding the lib
>>>> so Jason can test it :)
>>>>
>>>> Alex soto
>>>>
>>>> El 04/11/2011, a las 02:49 p.m., Jeff Stedfast <[email protected]>
>>>> escribió:
>>>>
>>>> Hi Jason,
>>>>
>>>> Doesn't looks like you can actually get the source, so you'll probably
>>>> have to bind it instead.
>>>>
>>>> If you do decide to bind it, fork monotouch-bindings on github and add
>>>> a new directory with your binding, then submit a pull request and I'll be
>>>> happy to pull it into monotouch-bindings mainline.
>>>>
>>>> Jeff
>>>>
>>>> On Fri, Nov 4, 2011 at 4:21 PM, Jason Awbrey <[email protected]> wrote:
>>>>
>>>>> Has anyone tried doing PDF annotation with MT?
>>>>>
>>>>> I've found a few links about doing it with ObjC, and at least one
>>>>> library (http://www.ajidev.com/iannotate/developers.html) that
>>>>> provides support for iOS.
>>>>>
>>>>> Before I go down the road of trying to port something to MT, I wanted
>>>>> to be sure someone else hadn't already tackled this.
>>>>>
>>>>> thanks - Jason
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> MonoTouch mailing list
>>>>> [email protected]
>>>>> http://lists.ximian.com/mailman/listinfo/monotouch
>>>>>
>>>>>
>>>> _______________________________________________
>>>> MonoTouch mailing list
>>>> [email protected]
>>>> http://lists.ximian.com/mailman/listinfo/monotouch
>>>>
>>>>
>>>
>>>
>>
>
>
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to