4 ; Definitions for the colour selector
9 ;----- Licensing note -------------------------------------------------------
11 ; This file is part of Straylight's Sapphire library.
13 ; Sapphire is free software; you can redistribute it and/or modify
14 ; it under the terms of the GNU General Public License as published by
15 ; the Free Software Foundation; either version 2, or (at your option)
18 ; Sapphire is distributed in the hope that it will be useful,
19 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ; GNU General Public License for more details.
23 ; You should have received a copy of the GNU General Public License
24 ; along with Sapphire. If not, write to the Free Software Foundation,
25 ; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 ;----- Overview -------------------------------------------------------------
35 [ :LNOT::DEF:colSelect__dfn
38 ;----- Definition of a colour -----------------------------------------------
40 ; --- A colour block ---
42 ; The first word is the only bit which applications should really be
43 ; interested in: it's a colour in RGB format suitable for passing to
44 ; ColourTrans_SetColour or similar.
46 ; The model id is used by the colour selector to ensure that the colour
47 ; is edited in the correct way. The date area is specific to a particular
48 ; colour model, and its format is not described here. However, the model-
49 ; specific data must not contain pointers to external data areas or other
50 ; references to session-specific information. Applications are permitted
51 ; to save colour blocks to disk and expect them to work properly when read
55 csColour_rgb # 4 ;A ColourTrans RGB colour
56 csColour_model # 4 ;A ColSelect model ID
57 csColour_data # 24 ;Model-specific data
58 csColour_size # 0 ;Size of a colour block
60 ;----- Colour model interface -----------------------------------------------
62 ; --- A colour model definition block ---
65 csModel_id # 4 ;Colour model ID number
66 csModel_size # 4 ;Size of workspace required
67 csModel_handler # 4 ;Pointer to handler routine
68 csModel_name # 0 ;Null terminated name string
70 ; --- Colour selector event codes ---
72 csEvent_base EQU &C0000000
75 csEvent_res # 1 ;Diagram changed resolution
76 csEvent_get # 1 ;Get colour; reset panel
78 ; --- Resolution codes ---
86 ; --- Known colour models ---
88 csModelId_trans EQU 0 ;The `transparent' colour
89 csModelId_rgb EQU 1 ;Standard red/green/blue
90 csModelId_cmyk EQU 2 ;Cyan/Magenta/Yellow/Black
91 csModelId_hsv EQU 3 ;Hue/Saturation/Value
92 csModelId_named EQU 4 ;Named colours
94 ; --- Colour selector data layout ---
97 csData_frame # 4 ;Dialogue handle of frame
98 csData_panel # 4 ;Dialogue handle of panel
99 csData_colour # csColour_size ;Working copy of colour data
100 csData_res # 4 ;Diagram resolution
101 csData_flags # 4 ;Various useful flags
102 csData_userCol # 4 ;Pointer to user's colour
103 csData_model # 0 ;Model-specific data
104 csData_size EQU {VAR} - csData_frame
106 ; --- cs_addModel ---
108 ; On entry: R0 = pointer to model definition block
109 ; R1 = pointer to model workspace
111 ; On exit: May return an error.
113 ; Use: Registers a colour model with the colour selector.
115 ; The colour model block contains a pointer to a handler
116 ; routine, csModel_handler, which is called to create the
117 ; model's panel. It is called as follows:
119 ; R10 = pointer to colour selector data
120 ; R12 = workspace value passed to cs_addModel in R1
122 ; The handler returns a dialogue box handle in R0. Further
123 ; requests are sent to the dialogue box as events