| T.R | Title | User | Personal Name
 | Date | Lines | 
|---|
| 591.1 | Intuition Manual | ELWOOD::WHERRY | Cyber Punk | Mon Jul 13 1987 13:20 | 8 | 
|  |     	THE RKM Intuition manual published by Addison & Weslley (sp?)
    has a listing of the Preferences data structure in C (struct)...I
    do believe there is some mention of how to access it as well, but
    I am not positive of the accessing part...anybody got the Intuition
    Manual handy??  There should also be a preferences "Include File"
    on a c-compiler disk...
    
    brad
 | 
| 591.2 | Find a wheel, don't invent one | TLE::RMEYERS | Randy Meyers | Mon Jul 13 1987 13:59 | 9 | 
|  | Re: .0
It sounds like you just need to find an Amiga 500 owner who is willing
to upload a file for you.  As is described in note 586.0, the 500 comes
with a program that does what you want.
>:System/InitPrinter
> 
>	Causes printer to abide newly changed Preferences settings.
 | 
| 591.3 | Piece o' cake | JON::SANTIAGO | Ed Santiago, LEDE | Mon Jul 13 1987 16:26 | 11 | 
|  |     Re: .2
    
    Actually I think what that does is tell the printer that there are
    new Preferences values (ie, probably restart the driver). Doesn't
    seem to actually CHANGE them.
    
    Changing printer is really easy - all you need to do is ReadPrefs(),
    toggle the flag for serial/parallel printer, then write it back.
    You don't even have to touch devs/system-configuration. It's all
    documented in the Intuition manual (I think), or any of the Sybex
    books.
 | 
| 591.4 | No SetPref from Intuition | NAAD::SWARR | Learner's Permit | Mon Jul 13 1987 20:01 | 27 | 
|  |     I took a look in the Intuition Ref Manual. It looks as though you
    can get Preferences but not set them.
    
    Intuition has two documented  calls
    
    	GetPrefs
    
    	GetDefPrefs
    
    In reading the manual It appears that Preferences must be run. Using
    GetPrefs in your own programs would allow newly defined Preferences
    information to be gathered by your programs.
    
    To furhter automate the process, If you are using IDCMP for input,
    you can set the IDCMP flag NEWPREFS and receive and IntiuMessage 
    indicating a change in the Preferences settings.
    
    Using the GetDefPrefs call will get the Prefernces used to initialize
    the system. (I think). I think what they mean is that it will retrieve
    the parameters from disk. Which means that the last "saved" prefernces
    will be retrieved.
    
    Anyway the above is probably moot as users are encouraged to use
    GetPrefs.
    
    <jim
    
 | 
| 591.5 |  | JON::SANTIAGO | Ed Santiago, LEDE | Tue Jul 14 1987 06:43 | 3 | 
|  |     No, there is definitely a way to write preferences without running
    Preferences (argh). I've seen it done. I'll try to bring in an example
    tomorrow.
 | 
| 591.6 |  | MORRIS::SMCAFEE | Steve McAfee | Tue Jul 14 1987 08:18 | 11 | 
|  |     
    Why don't you just keep two copies of your system-configuration
    file?  One specifying each printer.  A simple execute can swap the two
    files.  Then what you need is a utility to tell the system that you've
    specified a new printer driver.  I believe I saw that there is an
    AmigaDOS command to do this which is being distributed with the new
    A500's.
    
    regards,
    
    steve mcafee
 | 
| 591.7 |  | JON::SANTIAGO | Ed Santiago, LEDE | Tue Jul 14 1987 12:06 | 6 | 
|  |     Even if you swap system-configuration files, you still have to load
    them into memory - the change_printer_driver command probably uses
    the preferences structure in memory. Which means you'd have to go
    into Preferences and click "Restore saved settings", or write a
    program to read in a file and set prefs accordingly (there already
    is one, called SetPrefs, probably on the Fish disks).
 | 
| 591.8 | SetPrefs sounds like what I want | KIRK::KYZIVAT | Paul Kyzivat | Tue Jul 14 1987 13:12 | 24 | 
|  |     Re: .6
    As noted in .7, this wouldn't help all that much, although it would be
    better than nothing.  But I would like to retain the ability to mung
    the other preference settings (other than printer) without having to
    remember to do them once in each version of the file.
    Re: .7
    I will look for SetPrefs in the Fish disk listings tonite.  If there
    really is such a program (especially if source is available) and
    someone has it, could you upload it?
    In general:
    Am I missing something?  I find huge voids in the documentation,
    particularly around AmigaDos and the Workbench.  The Rom Kernel and
    Intuition are fairly well documented, but if you want to know how
    anything else works, good luck.  I have all four volumes of the A/W
    books and the Bantam AmigaDos (v1) book.  Is there anything else which
    fills in the gaps?  Would the Developer Seminar materials now available
    from C/A be useful?
	Paul
 | 
| 591.9 |  | JON::SANTIAGO | Ed Santiago, LEDE | Tue Jul 14 1987 16:24 | 10 | 
|  |     Buy "Programmer's Guide to the Amiga" by Rob Peck. Sybex books,
    no clue what the ISBN is. I don't have it, but I've perused it
    and it seems very complete. Also, many people swear by it.
    Note: This is *NOT* the same as Eugene P. Mortimore's book,
    also from Sybex.
    
    Since my modem died a month ago, and I can't get one from my
    cost center, I won't be able to upload SetPrefs. I can bring
    a printout if you like (~3 pages), or just type in the important
    parts and email them to you. 
 | 
| 591.10 | thanks | KIRK::KYZIVAT | Paul Kyzivat | Tue Jul 14 1987 17:36 | 9 | 
|  |     Re: .9
    I'll look for the book.
    Before we start typing, maybe someone else has it.  Otherwise, if it is
    on a Fish disk I can get it with a bit of a drive.
	Thanks,
	Paul
 | 
| 591.11 | Documentation Gaps | TLE::RMEYERS | Randy Meyers | Tue Jul 14 1987 19:18 | 9 | 
|  | >    Am I missing something?  I find huge voids in the documentation,
>    particularly around AmigaDos and the Workbench.  The Rom Kernel and
>    Intuition are fairly well documented, but if you want to know how
>    anything else works, good luck.
What specific gaps in the documentation have you found regarding the
Workbench and AmigaDOS?  I have so far been able to find just about
anything (that I wanted to know at least) if I poked around in the
documentation enough.
 | 
| 591.12 |  | JON::SANTIAGO | Ed Santiago, LEDE | Wed Jul 15 1987 06:51 | 12 | 
|  |     Hoo boy, this is hilarious... the SetPrefs() function is,
    yes you guessed it, undocumented. Not too atypical, I guess!
    
    Anyway for those interested the format is:
    
    		SetPrefs(preference_structure, PREF_SIZE, 1L)
    
    which is the same as the GetPrefs() call except for the 1.
    
    I also have the source to SetPrefs (the program) for anyone
    interested, but it really is quite run-of-the-mill apart
    from the SetPrefs() call.
 | 
| 591.13 | why must they keep secrets? | KIRK::KYZIVAT | Paul Kyzivat | Wed Jul 15 1987 09:29 | 21 | 
|  |     Re: .11
    Reply .12 is an example.  Another example is the whole process of how
    all the junk in an icon is used to start a program - I find pieces of
    this but not a coherent explanation.  I would not be at all surprised
    to learn that the information I am looking for is in the documents I
    have somewhere, but it certainly isn't obvious where, short of reading
    all the manuals cover to cover, which I haven't done.
    Re: .12
    Then SetPrefs() is a supplied function that the linker can find?
    Exactly what does it do: 
    1) update an in-memory copy?
    2) update the disk copy?
    3) update the affected components, like workbench screen colors?
    In any case, thanks for the info.  That may be enough for me to do what
    I want.
	Paul
 | 
| 591.14 |  | JON::SANTIAGO | Ed Santiago, LEDE | Wed Jul 15 1987 12:34 | 9 | 
|  |     Since this C code compiles, I assume the linker is able to
    find SetPrefs().
    
    Probably what you want to do is read the Preferences structure
    (with GetPrefs(), *not* GetDefPrefs()), toggle the PrinterPort
    field (SERIAL_PRINTER or PARALLEL_PRINTER), then do SetPrefs().
    This will use the current Preferences settings and only modify
    the printer type. Reading the documentation for GetPrefs()
    should explain more clearly.
 | 
| 591.15 | GetPrefs won't link | KIRK::KYZIVAT | Paul Kyzivat | Mon Jul 20 1987 17:23 | 13 | 
|  |     I think I must be missing something obvious here, but ...
    As an experiment I just coded up a little routine to call GetPrefs and
    print out some things from the returned structure.  But I can't get it
    to link - the linker has an unsatisfied reference to _IntuitionBase.
    This reference is not coming from my routine, it is in GetPrefs itself.
    I have the feeling that this isn't supposed to be an external reference
    at all, but I am not sure of this.  Is there someplace I should be
    searching to get this reference satisfied?  I find it hard to believe I
    am supposed to define an external with that name.
	Paul
 | 
| 591.16 |  | JON::SANTIAGO | Ed Santiago, LEDE | Tue Jul 21 1987 06:48 | 9 | 
|  |     Try declaring a global:
    
    	struct IntuitionBase *Intuitionbase;
    
    and in your initialization coed, er, code:
    
    	IntuitionBase = OpenLibrary("intuition.library",<rev #, or NULL>);
    
    (and of course making sure you don't get NULL in return).
 | 
| 591.17 | Thanks - that did it | KIRK::KYZIVAT | Paul Kyzivat | Wed Jul 22 1987 08:28 | 8 | 
|  |     re: .16
    That did the trick.  One more black mark for the documentation.
    I was able to get GetPrefs and SetPrefs to do their thing, though so
    far only in a test program.  SetPrefs takes effect immediately - at
    least color changes do.
	Paul
 | 
| 591.18 | I wonder??? | NAAD::SWARR | Learner's Permit | Wed Jul 22 1987 20:14 | 4 | 
|  |     That makes me wonder if there is a SetDefPrefs to match the
    GetDefPrefs?
    <jim	z    {
 | 
| 591.19 | SetPrefs() documentation | TLE::RMEYERS | Randy Meyers | Sun Aug 02 1987 19:04 | 53 | 
|  | Re: .12
What follows is the official SetPrefs documentation from Commodore.
The reason why this function wasn't documented was do to an error in
commenting.  The function descriptions in the Addison-Wesley manuals
are automatically extracted from the source files.  A handful of
functions had mangled function headers, and were not extracted by
the program that built the Addison-Wesley manuals.
intuition.library/SetPrefs                           intuition.library/SetPrefs
    NAME
        SetPrefs  -�  Set Intuition Preferences.
    SYNOPSIS
        Prefs = SetPrefs(PrefBuffer, Size, Inform)
        D0               A0          D0    D1
        struct Preferences *Prefs;
        struct Preferences *PrefBuffer;
        int    Size;
        BOOL   Inform;
    FUNCTION
        Sets new Preferences values.  Copies the first 'Size' bytes
        from your Preferences buffer to the system Preferences table,
        and puts them into effect.
        The 'Inform' parameter, if TRUE, indicates that a NEWPREFS
        message is to be sent to all Windows that have the NEWPREFS
        IDCMPFlag set.
   
        It is legal to set a partial copy of the Preferences structure.
        The most frequently changed values are grouped at the beginning
        of the Preferences structure.
    INPUTS
        PrefBuffer = pointer to the memory buffer which contains your
            desired settings for Intuition Preferences
        Size = the number of bytes in your PrefBuffer, the number of bytes
           you want copied to the system's internal Preference settings
        Inform = whether you want the information of a new Preferences
            setting propagated to all windows.
    RESULT
        Returns your parameter PrefBuffer.
    BUGS
    SEE ALSO
        GetDefPrefs(), GetPrefs()
 |