.\"
.\" $XConsortium: p077,v 5.2 94/04/17 20:55:10 rws Exp $
.\"
.\" 
$XMCOPY
.\" Copyright (c) 1990, 1991 by Sun Microsystems, Inc. and the X Consortium.
.\" 
.\"                         All Rights Reserved
.\" 
.\" Permission to use, copy, modify, and distribute this software and its 
.\" documentation for any purpose and without fee is hereby granted, 
.\" provided that the above copyright notice appear in all copies and that
.\" both that copyright notice and this permission notice appear in 
.\" supporting documentation, and that the names of Sun Microsystems,
.\" and the X Consortium not be used in advertising or publicity 
.\" pertaining to distribution of the software without specific, written 
.\" prior permission.  
.\" 
.\" SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 
.\" INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
.\" EVENT SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
.\" CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
.\" USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
.\" OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
.\" PERFORMANCE OF THIS SOFTWARE.
.TH "INITIALIZE LOCATOR" 3P "29 February 1991"
.SH NAME
INITIALIZE LOCATOR \- initialize a \s-2LOCATOR\s+2 input device
using \s-2\&2D\s+2 data
.IX "Locator Input Devices" "INITIALIZE LOCATOR"
.SH SYNOPSIS
.SS C Syntax
.ft B
.ta 1.5i 3.25i
.nf
void
pinit_loc ( ws, dev, init_view_ind, init_loc_pos, pet, echo_area, record )
Pint	ws;	\fIworkstation identifier\fP
Pint	dev;	\fIlocator device number\fP
Pint	init_view_ind;	\fIinitial view indicator\fP
Ppoint	*init_loc_pos;	\fIinitial locator pointer\fP
Pint	pet;	\fIprompt and echo type\fP
Plimit	*echo_area;	\fIecho area pointer\fP
Ploc_data	*record;	\fIdata record pointer\fP
.fi
.ft R
.SS Required PHIGS Operating States
(PHOP, WSOP, *, *)
.SH DESCRIPTION
.SS Purpose
Use \s-2INITIALIZE LOCATOR\s+2 to set the initialization parameters of a
\s-2LOCATOR\s+2 device.
This function stores these parameters in the workstation state list
of the workstation associated with the specified device.
The specified \fBdevice must be in \s-2REQUEST\s+2 mode\fP when this
function is called.
.SS C Input Parameters
.IP \fIws\fP
The workstation identifier of the workstation associated with the device.
.IP \fIdev\fP
The device number of the \s-2LOCATOR\s+2 device to initialize.
See the \fIAVAILABLE DEVICES\fP section below for a description of the
available devices.
.IP \fIinit_view_ind\fP
The index of the view representation in the
workstation's view table to use to map the specified initial position
from World Coordinates (\s-2WC\s+2) to
Normalized Projection Coordinates (\s-2NPC\s+2).
.IP \fIinit_loc_pos\fP
A Ppoint structure specifying the
\fIx\fP and \fIy\fP \s-2WC\s+2 coordinates of the initial locator position.
Ppoint is defined in phigs.h as follows:
.sp .4
.ta .5i +1i  +1i
.nf
typedef struct {
.sp .2
	Pfloat	x;	/* x coordinate */
	Pfloat	y;	/* y coordinate */
.sp .2
} Ppoint;
.fi
.IP \fIpet\fP
The prompt/echo type desired.
Those supported by each device are listed in the
\fIAVAILABLE DEVICES\fP section below.
.IP \fIecho_area\fP
A pointer to a Plimit structure defining the \fIx\fP and \fIy\fP
components of the echo volume, in Device Coordinates (\s-2DC\s+2).
The \fIz\fP component in the workstation state list is left unchanged.
Plimit is defined in phigs.h as follows:
.sp .4
.ta .5i +1i  +1i
.nf
typedef struct {
.sp .2
	Pfloat	x_min;		/* minimum x coordinate value */
	Pfloat	x_max;		/* maximum x coordinate value */
	Pfloat	y_min;		/* minimum y coordinate value */
	Pfloat	y_max;		/* maximum y coordinate value */
.sp .2
} Plimit;
.sp
.fi
.IP \fIrecord\fP
A pointer to a Ploc_data union containing the data record information.
The contents of the data record for each device and prompt/echo type are
described below in the \fIAVAILABLE DEVICES\fP section.
.IP
The members of the data record union correspond to the prompt/echo type
being used.
As an example, the appropriate member of the Ploc_data union for
prompt/echo type 1 is
\fIpet_r1\fP.
.IP
For some prompt/echo types the locator data record is not used;
however, the \fIrecord\fP parameter must still be supplied.
.SS Execution
.LP
\s-2INITIALIZE LOCATOR\s+2 sets the initialization parameters of a
\s-2LOCATOR\s+2 device.
This function stores these parameters in the workstation state list
of the workstation associated with the specified device.
The specified device must be in \s-2REQUEST\s+2 mode when this
function is called.
.LP
The state list values set by this function are 
\fIinitial value\fP, \fIprompt/echo type\fP, \fIecho volume\fP,
and \fIinput data record\fP.
.LP
The \fIinitial value\fP is the logical input value the device will be
set to whenever it is enabled.
The device's measure retains this value until operator input changes it.
A device is enabled when the appropriate \s-2\fIREQUEST\fP\s+2
function is called,
or when its input mode is set to \s-2SAMPLE\s+2 or \s-2EVENT\s+2.
.LP
A \s-2LOCATOR\s+2 device measure consists of a \fIposition\fP and a
\fIview index\fP.
\fIPosition\fP is the World Coordinate (\s-2WC\s+2) point corresponding to the
position on the workstation selected by the operator.
The \fIview index\fP is the index of the view representation used to
transform the locator position from Normalized Projection
Coordinates (\s-2NPC\s+2) to \s-2WC\s+2.
This view representation is determined by selecting the highest priority
representation that contains the locator position within its \s-2NPC\s+2 limits.
See \s-2SET VIEW TRANSFORMATION INPUT PRIORITY\s+2 for more information.
The workstation transform is used to transform the operator-selected
position from Device Coordinates (\s-2DC\s+2) to \s-2NPC\s+2.
.LP
The initial locator position is transformed to \s-2DC\s+2 by
applying the view-orientation and view-mapping transforms of the specified
view representation, and then applying the workstation transformation.
If the view index is invalid, an error is generated.
.LP
The \fIprompt/echo type\fP determines how the device will be presented to
the operator and respond to his actions.
Each device supports one or more prompt/echo types.
Those supported by each device are listed in the device's
description in the \fIAVAILABLE DEVICES\fP section below.
All devices support prompt/echo type 1.
Positive prompt/echo types are defined by the \s-2PHIGS\s+2 standard.
Negative types are implementation-dependent.
.LP
The \fIecho volume\fP defines the region of the display surface in which to
echo the device.
It is specified in \s-2DC\s+2.
Devices that use the echo volume may restrict their display to this
region.
This function only specifies the \fIx\fP and \fIy\fP components of the
echo volume.  The existing \fIz\fP component in the workstation state
list is left unchanged.
.LP
The \fIinput data record\fP contains the prompt/echo type specific
information that controls the device's appearance and characteristics.
Not all of the data record contents are used by some devices.
The device descriptions in the \fIAVAILABLE DEVICES\fP section below
list the data record contents that each device recognizes.
.LP
All the initialization parameters must be specified properly or this function
will generate an error.
The \s-2\fIERRORS\fP\s+2 section below lists the possible error conditions.
.LP
The default initialization parameters and the list of prompt/echo types
supported by a \s-2LOCATOR\s+2 input device can be inquired with the function
\s-2INQUIRE DEFAULT LOCATOR DEVICE DATA\s+2.
The current state of the device can be inquired with the function
\s-2INQUIRE LOCATOR DEVICE STATE\s+2.
.SH AVAILABLE DEVICES
.SS Devices 1 to 3 - "Pointer devices"
.LP
These devices are associated with the X pointer device, usually the mouse and cursor.
Devices 1, 2, and 3 are triggered by the left, middle, and right mouse button respectively.
The locator position in the \s-2\fILOCATOR\fP\s+2 device's measure is the 
\s-2WC\s+2 position corresponding to the pointer event position.
\s-2PHIGS\s+2 computes the \s-2WC\s+2 position from the two-dimensional pointer position by
transforming the pointer position to a \s-22D\s+2 \s-2NPC\s+2 point,
determining the highest priority view containing that point,
setting the \fIZ\fP coordinate of the \s-2NPC\s+2 point to the lower \fIZ\fP limit
of that view, and transforming the \s-2NPC\s+2 point to world coordinates.
This function returns only the \fIX\fP and \fIY\fP coordinates of the resulting
position.
.LP
Not all prompt/echo types use the initial locator position.
Only those that need an additional point to the current pointer position use
the initial position.
The pointer is not moved to the initial position when the device is
enabled.
.LP
This device does not use the echo volume.
.LP
\fBPrompt/echo types supported\fP: 
.IP "PET 1" .8i
Display the default cursor at the current locator position.
.IP
The data record is not used for this \s-2PET\s+2.
.LP
.RE
.SH ERRORS
.IP 003
Ignoring function, function requires state (\s-2PHOP, WSOP, *, *\s+2)
.IP 054
Ignoring function, the specified workstation is not open
.IP 061
Ignoring function, specified workstation is neither of category \s-2INPUT\s+2
nor of category \s-2OUTIN\s+2
.IP 114
Ignoring function, the view index value is less than zero
.IP 250
Ignoring function, the specified device is not available
on the specified workstation
.IP 251
Ignoring function, the function requires the input device to be in \s-2REQUEST\s+2 mode
.IP 253
Warning, the specified prompt/echo type is not available on the specified
workstation.
Prompt/echo type one will be used in its place
.IP 254
Ignoring function, invalid echo area/volume;
\s-2XMIN \(>= XMAX, YMIN \(>= YMAX,\s+2 or \s-2ZMIN > ZMAX\s+2
.IP 255
Ignoring function, one of the echo area/volume boundary points
is outside the range of the device
.IP 260
Ignoring function, one of the fields within the input device data record
is in error
.IP 261
Ignoring function, initial value is invalid
.SH SEE ALSO
.nf
.IP
.ta 0.5i
.SM "SET LOCATOR MODE (3P)"
.SM "REQUEST LOCATOR (3P)"
.SM "SAMPLE LOCATOR (3P)"
.SM "GET LOCATOR (3P)"
.SM "INQUIRE LOCATOR DEVICE STATE (3P)"
.SM "SET VIEW TRANSFORMATION INPUT PRIORITY (3P)"
.SM "INITIALIZE LOCATOR 3 (3P)"
.fi
