; ; colSelect.sh ; ; Definitions for the colour selector ; ; © 1998 Straylight ; ;----- Licensing note ------------------------------------------------------- ; ; This file is part of Straylight's Sapphire library. ; ; Sapphire is free software; you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by ; the Free Software Foundation; either version 2, or (at your option) ; any later version. ; ; Sapphire is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; GNU General Public License for more details. ; ; You should have received a copy of the GNU General Public License ; along with Sapphire. If not, write to the Free Software Foundation, ; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ;----- Overview ------------------------------------------------------------- ; ; Functions provided: ; ; Macros provided: ; ; Controls provided: [ :LNOT::DEF:colSelect__dfn GBLL colSelect__dfn ;----- Definition of a colour ----------------------------------------------- ; --- A colour block --- ; ; The first word is the only bit which applications should really be ; interested in: it's a colour in RGB format suitable for passing to ; ColourTrans_SetColour or similar. ; ; The model id is used by the colour selector to ensure that the colour ; is edited in the correct way. The date area is specific to a particular ; colour model, and its format is not described here. However, the model- ; specific data must not contain pointers to external data areas or other ; references to session-specific information. Applications are permitted ; to save colour blocks to disk and expect them to work properly when read ; back. ^ 0 csColour_rgb # 4 ;A ColourTrans RGB colour csColour_model # 4 ;A ColSelect model ID csColour_data # 24 ;Model-specific data csColour_size # 0 ;Size of a colour block ;----- Colour model interface ----------------------------------------------- ; --- A colour model definition block --- ^ 0 csModel_id # 4 ;Colour model ID number csModel_size # 4 ;Size of workspace required csModel_handler # 4 ;Pointer to handler routine csModel_name # 0 ;Null terminated name string ; --- Colour selector event codes --- csEvent_base EQU &C0000000 ^ csEvent_base csEvent_res # 1 ;Diagram changed resolution csEvent_get # 1 ;Get colour; reset panel ; --- Resolution codes --- ^ 0 csRes_perfect # 1 csRes_high # 1 csRes_medium # 1 csRes_low # 1 ; --- Known colour models --- csModelId_trans EQU 0 ;The `transparent' colour csModelId_rgb EQU 1 ;Standard red/green/blue csModelId_cmyk EQU 2 ;Cyan/Magenta/Yellow/Black csModelId_hsv EQU 3 ;Hue/Saturation/Value csModelId_named EQU 4 ;Named colours ; --- Colour selector data layout --- ^ 0,R10 csData_frame # 4 ;Dialogue handle of frame csData_panel # 4 ;Dialogue handle of panel csData_colour # csColour_size ;Working copy of colour data csData_res # 4 ;Diagram resolution csData_flags # 4 ;Various useful flags csData_userCol # 4 ;Pointer to user's colour csData_model # 0 ;Model-specific data csData_size EQU {VAR} - csData_frame ; --- cs_addModel --- ; ; On entry: R0 = pointer to model definition block ; R1 = pointer to model workspace ; ; On exit: May return an error. ; ; Use: Registers a colour model with the colour selector. ; ; The colour model block contains a pointer to a handler ; routine, csModel_handler, which is called to create the ; model's panel. It is called as follows: ; ; R10 = pointer to colour selector data ; R12 = workspace value passed to cs_addModel in R1 ; ; The handler returns a dialogue box handle in R0. Further ; requests are sent to the dialogue box as events IMPORT cs_addModel