[comp.sys.mac.programmer] Code I'd like to borrow from you :-)

vrm@blackwater.cerc.wvu.wvnet.edu (Vasile R. Montan) (04/18/91)

I am writing a long shareware program, and to simplify the job I am
interested in borrowing chunks of code from others.  If anyone has Pascal
code resembling any the following, I would be very grateful to get a copy. 
(I don't understand a word of C, unfortunately.)  Any code I incorporate will
be duly acknowleged in the program's credits, of course. 

Dynamic list management 
     Someone once sent me some excellent code for setting up a list of
strings using the List Manager.  What I need, though, is something a bit
more complex:  I need to be able to dynamically add and delete items to and
from the list.  Does anyone have any code to do this?  When I try to write
my own code calling the List Manager I have a terrible time. 

Select an icon from a list 
     Speaking of the List Manager, I'd like to find some code where the user
chooses an icon from a list.  If I could find something like the icon
selection window in HyperCard, that would be excellent.  Even something
like the icon selector in ResEdit would be great. 

Text editing for a script 
     Objects in my program will have scripts, very much as they do in
HyperCard.  Does anyone have code for something like HyperCard's
script-editing modal dialog?  This code allows cut and paste with
command key combinations, and also seems tomake provision for tabs. 
The nicest thing would be if I could pass a handle to the initial text and
not have to worry about anything else.  Any text-editing code would be a
start, however. 

MDEF for patterns and tools menu 
     I have spent considerable time trying to write a 'patterns' menu MDEF,
but for some reason my code never works.  Does anyone have code for a
MDEF?  I understand that some version of Think Pascal has some kind of
strange library or something containing a menu definition outside any
MDEF, but since I am stuck with good old Lightspeed Pascal this won't help
me.  I want to write a 'tools' menu and a 'patterns' menu-- nothing fancy:
no tear-off menus or anything.  A model would be excellent. 

Sound management 
     Finally, how about some prepared code for using the sound manager? 
What I need is a routine to which I can simply pass handles for snds, and
have the sounds queued and played synchronously while my program is off
doing other things.  It would also be nice if this piece of code included
some sort of "Kill Sound" routine to stop the sound and clear the queue. 

P.S.  If any of this code is available at an FTP site, I would appreciate
getting the address.  Thank you for your help! 

--Kurisuto
un020070@vaxa.wvnet.edu

mxmora@unix.SRI.COM (Matt Mora) (04/19/91)

Check out the "Usenet Macintosh Programmers Guide" on sumex.
It has A LOT of source code that you could use.

Matt




-- 
___________________________________________________________
Matthew Mora                |   my Mac  Matt_Mora@sri.com
SRI International           |  my unix  mxmora@unix.sri.com
___________________________________________________________

REEKES@applelink.apple.com (Jim Reekes) (04/24/91)

In article <1601@babcock.cerc.wvu.wvnet.edu>, vrm@blackwater.cerc.wvu.wvnet.edu (Vasile R. Montan) writes:
> 
> Sound management 
>      Finally, how about some prepared code for using the sound manager? 
> What I need is a routine to which I can simply pass handles for snds, and
> have the sounds queued and played synchronously while my program is off
> doing other things.  It would also be nice if this piece of code included
> some sort of "Kill Sound" routine to stop the sound and clear the queue. 
> 
> P.S.  If any of this code is available at an FTP site, I would appreciate
> getting the address.  Thank you for your help! 
> 

Yup, you can download the MacDTS-issue sample code.  Look for the one
named, "SoundApp."  It does exactly what you've asked for.  Its also on
nearly all of the Developer CD releases.

Jim Reekes, Mac Toolbox Engineer

P.S. You can read about the other requests in "The Best of MacTutor series.
As an example, the source to an icon LDEF was published.  They also printed
an article on a MDEF for patterns.  As for serious list management,
you should skip the List Manager and write a decent database engine or
B-tree system.  Most of this you can copy from a college text book.