home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Fred Fish Collection 1.5
/
ffcollection-1-5-1992-11.iso
/
ff_disks
/
300-399
/
ff361.lzh
/
XColor-Lib
/
ColourRequester.doc
< prev
next >
Wrap
Text File
|
1990-08-11
|
6KB
|
209 lines
ColourRequester - XColor library
Roger Fischlin
Steigerwaldweg 6
6450 Hanau 7
West Germany
; sorry for any mistake but it 2 o'clock in the morning....
To run the ColourRequester you need a structure . This structure also
contains a few vectors for inserting own routines.
ColourRequester structure
CR_Screen : pointer to screen
CR_TextColour : pen used for writing text
CR_BackColour : background pen
CR_GBorderColour : pen for gadget boxes
CR_GTextColour : pen used for writing gadget texts
CR_Flags : some flags:
FLAG_HSV :use HSV instead of RGB
FLAG_RGB :use RGB
FLAG_HEX :use hexadecimal numbers
FLAG_NORMAL :use decimal numbers
FLAG_NOWINDOWDEPTH :window cannot be moved
FLAG_NOWINDOWDRAG :window cannot be pushed to the
background.
CR_LeftEdge : left edge
CR_TopEdge : top edge
CR_Font : pointer to font, used for calling OpenFont. If it's
0 the default font is used. The font should be 8x8.
CR_DefaultEntries: number of entries in default colortable
CR_Default- : pointer to default colortable or 0
ColorMap
CR_JMPWindow ¹ : ColourRequester will jump to that address (d0=^NewWindow)
before the window is opened.
CR_JMPMessage ¹ : ColourRequester will jump to that address if it receives
an unknown message.
CR_JMPMode ¹ : ColourRequester will jump to that address
(d0= selected colour) if it's in an user mode.
CR_JMPDraw ¹ : ColourRequester will jump to that address (d0=^Window)
after the window has been opened.
CR_ScreenTitle : pointer to screen title.
CR_DefaultWTitle : default window title
¹ These vectors should be used by programmers. If you don't want to insert
any routine, they should be zero.
The next part is used by the ColourRequester . To run the ColourRequester
they should be zero.
CR_imClass : Class of IntuiMesaage
CR_imCode : Code of IntuiMesaage
CR_imQualifier : Qualifier of IntuiMesaage
CR_imIAddress : IAddress of IntuiMesaage
CR_imMouseX : MouseX of IntuiMesaage
CR_imMouseY : MouseY of IntuiMesaage
CR_WindowPointer : Pointer to window struktur
CR_UndoSize : number of entries in the undo colortable
CR_UndoBuffer : pointer to undo colortable
CR_Undo : RGB of current colour
CR_Colour : number of current colour
CR_MemorySize : size of allocated memory.
CR_Memory : pointer to allocated memory.
CR_NewWindow : pointer to NewWindow strukture
CR_Mode : Mode, e.g. COPY,EXCHANGE or SPREAD.
CR_WindowTitle : pointer to window title for new mode.
CR_Reserved : ...
How to use the ColourRequesters
1. easy - without own routines
------------------------------
· init first part of the structure.
· call ColourRequester . If it returns something negative, something
went wrong (no memory, OpenWindow failed..)
example : DEMO_I
2. insert own routines
----------------------
If you want to modify the NewWindow structure (e.g. add IDCMAP flags)
use the CR_JMPWindow vector. GADGETDOWN and GADGETUP are already set.
You may also add your own gadgets. Use gg_NextGadget to get to the
last gadget and insert your one but NEVER USE A OFFSETS TO GET TO THE LAST
GADGET ! To avoid any problems bit 15 of GadgetID should be set.
Use CR_JMPDraw if you want to draw something into the window.
If the ColourRequester receives any message which doesn't belong to a
ColourRequester gadget the CR_JMPMessage vector will be used. All the
message information are put into the second part of the ColourRequester
structure.
There are two types of functions :
· Functions which are executed immediately. e.g. ANTIQUE
· Functions which need a second colour to be selected. e.g. COPY
If you function belongs to the fist type you must tell the ColourRequester
how to react (d0) :
· CR_NOTHING : Nothing will happen.
· CR_REMAKE : The whole window is redrawn (e.g. after changing
the window size).
· CR_EXIT : The Requester will disapper.
· CR_NEWCOLOUR : There's a new colour number in CR_Colour so the prop
gadgets have to been refreshed.
· CR_UPDATECOLOUR : RGB of the current colours have been changed. The
prop gadgets have to been refreshed.
Copy the code to d0, finish the routine by "RTS".
If your function needs a second colour you have to tell it to the
user by changing the window title. So CR_WindowTitle should
contain the pointer to the new title. But also the ColourRequester
must know that it's in a different mode. Write you Mode ID to
CR_Mode (bit 31 should be set to avoid any problems). Return CR_Mode
in d0. If the user now clicks a colour the ColourRequester will jump
to CR_JMPMode. Now d0 contains the number of the selected colour.
Now execute your function , clear CR_Mode and copy CR_DefaultWTitle
to CR_WindowTitle. Return a code listed above.
Rem.: If your function is selected a second time instead of clicking
a second colour cancel the function, clear CR_Mode and copy
CR_DefaultWTitle to CR_WindowTitle.
example : DEMO_II