Professional Web Applications Themes

Writing C stdio programs with drag and drop interface - Mac Programming

In article <BB35886A.32B54%plasticnitlionwrappermindspring.c om>, Bob Harris <plasticnitlionwrappermindspring.com> wrote: > The key that I'm looking for is how to open a file the stdio way, but which > won't collide with the use of the standard mac routines. The job is pretty much the same as it was 10 years ago. In your Init() routine, you register appleEvent handlers for the four required appleEvents: openApp, open, print, & quit. your open handler receives an AEList of AEDescriptors that can be coerced to FSSpecs. Metrowerks provides, in source code form, in its MSL (Metrowerks Standard Library) FSP_fopen, which takes an FSSpec and ...

  1. #1

    Default Re: Writing C stdio programs with drag and drop interface

    In article <BB35886A.32B54%plasticnitlionwrappermindspring.c om>,
    Bob Harris <plasticnitlionwrappermindspring.com> wrote:
    > The key that I'm looking for is how to open a file the stdio way, but which
    > won't collide with the use of the standard mac routines.
    The job is pretty much the same as it was 10 years ago. In your Init()
    routine, you register appleEvent handlers for the four required
    appleEvents:

    openApp, open, print, & quit.

    your open handler receives an AEList of AEDescriptors that can be coerced
    to FSSpecs. Metrowerks provides, in source code form, in its MSL
    (Metrowerks Standard Library) FSP_fopen, which takes an FSSpec and
    returns a FILE*

    The replacement for StdPutFile is in <Navigation.h>.

    NavPutFile calls a callback when the user chooses the "Save" button,
    passing the callback the FSSpec of the containing directory, and
    a CFString of the name (which may be long or contain characters outside
    the MacRoman character set of 256 characters (Japanese, Hebrew,
    Russian...)) Files.h has a system call to turn that into an FSRef,
    another to turn the FSRef into an FSSpec, then you can use FSP_fopen to
    make the output stream. Since the source code is all available, you can
    see how to write FSP_freopen(), if Metrowerks doesn't provice it, so you
    can map a file to stdin and stdout.

    Tricky points: most Mach-O (OS X only) stationery doesn't use the C MSL,
    but instead uses Apple's (Gnu's) C library, which isn't compatible with
    FSP_fopen. The FSSpecs built from FSRefs may have "mangled" names, so
    if you are going to show them to the user, for example, in a progress
    dialog, convert them to FSRefs, then to CFStrings, and pass the CFString
    to the StaticText control.
    David Phillip Oster Guest

  2. #2

    Default Re: Writing C stdio programs with drag and drop interface

    David Phillip Oster wrote:
    > The job is pretty much the same as it was 10 years ago. ...
    I should also have mentioned that I haven't done any real mac development in
    that ten year period. Have done stuff on the mac, but none if it would be
    considered a "real" mac app with a point-n-click interface. Point being
    that I'm pretty far behind the curve now.
    > ... In your Init() routine, you register appleEvent handlers for the four
    > required appleEvents:
    > openApp, open, print, & quit.
    Thanks, I'll take a look at that. What I was using originall used the
    routine CountAppFiles model of determineing what files to open. Just about
    30 minutes ago I discovered that that model is no longer supported. And was
    just open to start looking for how do use apple events to replace it.

    The rest of your tips look like they'll save me a good bit of hunting, too.
    > ... Since the source code is all available, you can see how to write
    > FSP_freopen(), if Metrowerks doesn't provice it, so you can map a file to
    > stdin and stdout.
    This may be a dumb question, but where can I find the source code?

    Thanks (bunches!)
    Bob H

    Bob Harris Guest

  3. #3

    Default Re: Writing C stdio programs with drag and drop interface

    In article <BB35B7AF.32B65%plasticnitlionwrappermindspring.c om>,
    Bob Harris <plasticnitlionwrappermindspring.com> wrote:
    > This may be a dumb question, but where can I find the source code?
    The source code for the Metrowrks standard library is in the MSL folder
    in the Metrowerks codewarrior folder.

    A droplet, that takes files dropped on to it, and processes them,
    is available as source code from my web site:

    <http://www.TurboZen.com/mac/yEnc/>

    It wraps an open source yEnc decode engine, and one of my goals
    was changing the original source as little as possible.

    I've complied the same source for 68K XCFM, PowerPC Classic, and
    PowerPC Carbon.

    It has some warts, but it might be a good starting place for you.
    David Phillip Oster Guest

  4. #4

    Default Re: Writing C stdio programs with drag and drop interface

    >> This may be a dumb question, but where can I find the source code?
    >
    > The source code for the Metrowrks standard library is in the MSL folder
    > in the Metrowerks codewarrior folder.
    OK, thanks. I found that. For some reason when I asked the question I
    thought you were saying that the source code for OS X was available. ;)
    That seemed pretty unlikely to me. So in fact, it *was* a dumb question.
    > A droplet, that takes files dropped on to it, and processes them, is available
    > as source code from my web site ... It has some warts, but it might be a good
    > starting place for you.
    I'll try that out. At first glance it seems like what I'm after. I also
    hunted around in the apple developer sample code yesterday. Had a hard time
    finding an example that supported opening files during launch.

    Thanks much for you help
    Bob H


    Bob Harris Guest

  5. #5

    Default Re: Writing C stdio programs with drag and drop interface

    In article <BB36E5E1.32B9B%plasticnitlionwrappermindspring.c om>,
    Bob Harris <plasticnitlionwrappermindspring.com> wrote:
    > I thought you were saying that the source code for OS X was available. ;)
    > That seemed pretty unlikely to me. So in fact, it *was* a dumb question.
    Much of the source code for OS X _is_ available, at:

    <http://developer.apple.com/darwin/>

    device drivers, the scheduler, the virtual memory system, networking,
    the file system interface...

    This page may clarify what you don't get:
    <http://developer.apple.com/macosx/architecture/>
    David Phillip Oster Guest

Similar Threads

  1. Drag and drop using drag manager
    By mmahuika in forum Macromedia Flex General Discussion
    Replies: 4
    Last Post: March 28th, 05:03 PM
  2. ASP.NET and Drag & Drop
    By Ivo Tcholakov in forum ASP.NET Web Services
    Replies: 1
    Last Post: October 17th, 05:43 PM
  3. Drag and Drop Interface
    By Robert in forum FileMaker
    Replies: 0
    Last Post: September 26th, 06:50 PM
  4. tabbed interface using drag layers
    By Farid in forum Macromedia Dynamic HTML
    Replies: 0
    Last Post: August 11th, 08:48 AM
  5. drag/drop
    By bob biebrich in forum Windows XP/2000/ME
    Replies: 4
    Last Post: July 23rd, 01:34 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139