COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

	Copyright (c) Berkeley Softworks 1991 -- All Rights Reserved

PROJECT:	Pen library
FILE:		pen.def


REVISION HISTORY:
	
	Name	Date		Description
	----	----		-----------
	atw	10/10/91	Initial revision


DESCRIPTION:
	This file contains various exported routines and classes for the
	Pen library
		
	$Id: pen.def,v 1.1 97/04/04 14:22:11 newdeal Exp $

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SetDef	__PEN

StartLibrary	pen

include dbase.def
UseLib	ui.def

InkClass	class	VisClass

InkDBFrame	struct
	IDBF_bounds	Rectangle
	; Bounds of ink to write out - if you want all of the ink, pass
	; <(0,0), (0xffff, 0xffff)>

	IDBF_VMFile	hptr
	; VM File to write to/read from

	IDBF_DBGroupAndItem	DBGroupAndItem
	; DB Item to save to/load from (or 0 to create a new one)

	IDBF_DBExtra	word
	; Extra space to skip at the start of the block
InkDBFrame	ends

MSG_INK_SAVE_TO_DB_ITEM		message
;
;	Saves the data from the ink into the passed DB item (or creates a new
;	one if none passed). This also marks the object as clean.
;
;	Pass: 	SS:BP - InkDBFrame
;
;	Return: AX.BP - DB group/item written to (VM Chain)
;

MSG_INK_LOAD_FROM_DB_ITEM		message
;
;	Loads the data into the ink from the passed DB item (or clears any
;	current data if no DB item passed). This marks the object as clean.
;
;	The upper left corner of the bounds is the position at which the data
;	will be loaded (0,0 will be the upper left corner).
;
;	Pass: ss:bp - InkDBFrame
;

InkMessages  = InkMessages+1

MSG_INK_SET_TOOL			message
;
;	Sets the current tool to be used when the user clicks on the ink obj.
;
;	Pass: cx - InkTool
;

MSG_INK_GET_TOOL			message
;
;	Gets the current tool to be used when the user clicks on the ink obj.
;
;	Return: cx - InkTool
;

MSG_INK_SET_PEN_COLOR			message
;
;	Sets the current pen color.
;
;	Pass: cl - Color
;

MSG_INK_SET_DIRTY_AD	message
;
;	Sets the AD to be activated when the user dirties the object
;
;	Pass: BP - method
;	      CX:DX - optr
;
;	Destroyed: nothing

MSG_INK_SET_FLAGS	message
;
;	Sets the ink flags.
;
;	Pass: cx - flags to set
;	      dx - flags to clear
;	Return: nothing
;

MSG_INK_GET_FLAGS	message
;
; 	Gets the current ink flags
;
;	Pass: nothing
;	Return: cx - current InkFlags
;

InkFlags	record
	IF_HAS_MOUSE_GRAB:1
	; Set if the object has grabbed the mouse

	IF_SELECTING:1
	; Set if doing a selection

	IF_HAS_TARGET:1
	; Set if this object has the target.

	IF_HAS_SYS_TARGET:1
	; Set if this object has the target.

	IF_DIRTY:1
	; Set when we are dirty

	IF_ONLY_CHILD_OF_CONTENT:1
	; Set if this is the only child of a VisContent, in which case it
	; should use some optimizations to reply to ink at the view level.

	IF_CONTROLLED:1
	; Set if this object is to be used in conjunction with an InkControl
	; object.

	IF_INVALIDATE_ERASURES:1
	; Set if we should invalidate the bounds of all erasures, in case
	; there is a subclass that needs to redraw the background.

	IF_HAS_UNDO:1
	;  Set if this object should be undoable.
	:7
InkFlags	end

InkTool	etype	word,0,2
	IT_PENCIL	enum	InkTool	;Default tool
	IT_ERASER	enum	InkTool
	IT_SELECTOR	enum	InkTool

MSG_INK_ADVANCE_SELECTION_ANTS	message	private
;
;	Message sent internally to advance the ants in an ink selection.
;
;	Pass: nothing
;	Return: nothing
;	Destroyed: ax, cx, dx, bp

MSG_INK_SET_STROKE_SIZE		message
;
;	Message sent to the ink object to change the stroke size.
;
;	NOTE: If you have a ink object with a stroke width greater than
;	      2, you may want to disable all tools other than the pen
;	      - the problem is that the eraser/selector tools do not ratchet
;	      to stroke width boundaries, so you can end up with line segments
;	      that are partially deleted on screen, but either completely
;	      deleted or not deleted at all within the internal data structure,
;	      and screen glitches can result.
;
;	NOTE #2: The stroke width must be the same as the stroke height, or
;		 else the ink will not print correctly..
;
;	Pass: cl - stroke width in pixels
;	      ch - stroke height in pixels
;
;	Return: nothing
;	Destroyed: ax, cx, dx, bp	
;

MSG_INK_SET_MAX_POINTS		message
;
;	Sets the maximum # points allowed in the ink object
;
;	NOTE: It is possible for the # points to slightly exceed this, since
;	      an erase can, in some circumstances, produce a few more line
;	      segments/points than existed before the erase.
;
;	Pass: cx - max # points
;	Return: nothing
;	Destroyed: ax, cx, dx, bp
;
protominor	BackspaceInk

MSG_INK_DELETE_LAST_GESTURE		message
;
;	Removes the last gesture in the ink, if there is no ink nothing
;	happens.
;
;	Pass:   nothing
;	Return:	ax = 0 if no ink deleted
;	Destroyed: cx, dx, bp
;

protoreset

InkStrokeSize	struct
	ISS_width	byte;
	ISS_height	byte;	
InkStrokeSize	ends



	II_flags	InkFlags
	II_tool		InkTool
	II_penColor	Color
	II_segments	lptr
	II_dirtyOutput	optr
	II_dirtyMsg	word
	II_selectBounds	Rectangle <>
	II_cachedGState	hptr.GState
	II_antTimer	hptr
	II_antTimerID	word
	II_antMask	byte

ATTR_INK_STROKE_SIZE		vardata	InkStrokeSize
;
;	Sets the stroke size for the ink object.
;

ATTR_INK_MAX_POINTS		vardata	word
;
;	Sets the max # points allowed in the ink object
;
InkClass	endc

InkMPFlags	record
	IMPF_DRAGGING:1
	IMPF_HAS_PASTE_SELECTION:1
	:6
InkMPFlags	end

InkMPClass		class	InkClass

MSG_INKMP_CREATE_PASTE_BITMAP		message
;
;	Creates a bitmap to represent the paste while the user
;	is dragging the thing around. The bitmap is allocated in
;	the clipboard file, the block handle of which gets stored
;	in IMPI_pasteBitmap, while a GState to the bitmap is stored
;	to IMPI_pasteBitmapGState.
;
;	PASS:		nothing
;
;	RETURN:		nothing

MSG_INKMP_DRAW_PASTE_BITMAP			message
;
;	Draws the draggable paste bitmap (if any) to the passed GState.
;
;	PASS:		bp - GState
;
;	RETURN:		nothing


MSG_INKMP_FINISH_PASTE			message
;
;	Erases the paste bitmap drawn at IMPI_lastPos, frees the bitmap,
;	and arranges the pasted points properly.
;
;	PASS:		nothing
;
;	RETURN:		nothing

protominor InkNewForDrag

MSG_INKMP_ABORT_PASTE			message
;
;	Erases the paste bitmap drawn at IMPI_lastPosition, frees
;	the bitmap, and gets rid of the pasted points.
;
;	PASS:		nothing
;	RETURN:		nothing
;

MSG_INKMP_DRAG_BITMAP			message
;
;	moves the paste bitmap to the passed position.
;
;	PASS:		same as MSG_META_PTR
;
;	RETURN:		nothing
;

protoreset

	IMPI_pastedStart	word         ; First point of pasted region
	IMPI_pastedEnd		word	     ; Last point of pasted region
	IMPI_pastedBounds	Rectangle    ; Bounding box of dragged region
	IMPI_lastPos		Point	     ; last pen position
	IMPI_bitmapMouseOffset	Point	     ; offset from the point at which
					     ; the user clicked to the upper
					     ; left corner of the paste bitmap.
	IMPI_flags		InkMPFlags   ; state flags used for dragging
	IMPI_oldTool		InkTool	     ; place to store the tool while
					     ; we're dragging
	IMPI_pasteBitmap	word	     ; block handle of bitmap
					     ; within clipboard file
	IMPI_pasteBitmapGState	hptr.GState  ; GState to the paste bitmap

InkMPClass		endc

;
; GenApplication GCN lists to be placed on:
;	GAGCNLT_SELF_LOAD_OPTIONS

InkControlClass	class	GenControlClass

;-----------------------------------------------------------------------------
;		Messages
;-----------------------------------------------------------------------------

MSG_IC_SET_TOOL_FROM_LIST		message
;
; 	Changes the currently selected Ink tool
;
;	Pass: CX - InkTool to change to
;	Return: nothing
;	Destroyed: ax, cx, dx, bp
;

;-----------------------------------------------------------------------------
;		Hints
;-----------------------------------------------------------------------------
protominor	InkNewForBullet

	TEMP_INK_CONTROL_SELECTED_TOOL	vardata	InkTool
	;
	; The tool that should be selected when the UI is built
	; 

protoreset


;-----------------------------------------------------------------------------
;		Constants & Structures
;-----------------------------------------------------------------------------

InkControlFeatures	record
	ICF_PENCIL_TOOL:1
	ICF_ERASER_TOOL:1
	ICF_SELECTION_TOOL:1
InkControlFeatures	end

; Toolbox features flags (used with ATTR_GEN_CONTROL_REQUIRE_TOOLBOX_UI and
; ATTR_GEN_CONTROL_PROHIBIT_TOOLBOX_UI)

InkControlToolboxFeatures	record
	ICTF_PENCIL_TOOL:1
	ICTF_ERASER_TOOL:1
	ICTF_SELECTION_TOOL:1
InkControlToolboxFeatures	end


IC_DEFAULT_FEATURES equ mask ICF_PENCIL_TOOL or mask ICF_ERASER_TOOL or mask ICF_SELECTION_TOOL
IC_DEFAULT_TOOLBOX_FEATURES equ mask ICTF_PENCIL_TOOL or mask ICTF_ERASER_TOOL  or mask ICTF_SELECTION_TOOL

;
;	Structure sent with GWNT_INK_HAS_TARGET notification
;
NotifyInkHasTarget	struct
	NIHT_optr	optr		
NotifyInkHasTarget	ends

InkControlClass	endc

;-----------------------------------------------------------------------------
;	FILE ACCESS ROUTINES
;-----------------------------------------------------------------------------

global InkCompress:far
;
; Takes ink and compresses it.
;
; Pass: CX - handle of block containing ink data:
;	     (This will *not* be freed by InkCompress)
;		word numPoints
;		InkPoint
;		InkPoint
;		InkPoint
;		  ...
;	BX - file in which to create DB Item
;	AX:DI - DBItem to hold data (pass 0:0 to create a new DBItem)
;
; Return: AX:DI - DBItem containing ink data
;

global InkDecompress:far
;
; Takes compressed ink and decompresses it
;
; Pass: BX - file
;	AX:DI - DBItem
;
; Returns: BX - block containing ink data, or 0 if out of memory:
;				
;		word	NumPoints
;
;		InkPoint
;		InkPoint
;		InkPoint
;		 ...
;


INK_DB_PROTOCOL_MAJOR	equ	1
INK_DB_PROTOCOL_MINOR	equ	1

global InkDBInit:far
;
; Takes a new Ink database file, and initializes it for use (creates all
; needed map structures, and creates a top-level folder).
;
; Pass:		BX	= VM file handle
; Returns: 	Nothing
;

global InkDBGetHeadFolder:far
;
; Gets the head folder for the DB file.
;
; Pass:		BX	= VM file handle
; Returns:	AX.DI	= opaque folder handle
;

global InkDBGetDisplayInfo:far
;
; Gets the current display info for the file
;
; Pass:		BX	= VM file handle
; Returns:	AX.DI	= opaque folder handle
;	   	DX.CX	= note
;	   	BP	= page

global InkDBSetDisplayInfo:far
;
; Sets the current display info for the file
;
; Pass:		BX	= VM file handle
;		AX.DI	= opaque folder handle
;		DX.CX	= note
;		BP	= page
; Returns:	Nothing

global	InkSetDocPageInfo:far
;
; Sets the current page info for the file
;
; Pass: 	BX	= VM file handle
;		DS:SI	= PageSizeReport structure
; Returns:	Nothing

global	InkGetDocPageInfo:far
;
; Gets the current page info for the file
;
; Pass:		BX	= VM file handle
;		DS:SI	= PageSizeReport structure (empty)
; Returns:	DS:SI	= PageSizeReport structure (filled)
;

InkBackgroundType	etype	word,	0, 2
	IBT_NO_BACKGROUND			enum	InkBackgroundType
	IBT_NARROW_LINED_PAPER			enum	InkBackgroundType
	IBT_MEDIUM_LINED_PAPER			enum	InkBackgroundType
	IBT_WIDE_LINED_PAPER			enum	InkBackgroundType
	IBT_NARROW_STENO_PAPER			enum	InkBackgroundType
	IBT_MEDIUM_STENO_PAPER			enum	InkBackgroundType
	IBT_WIDE_STENO_PAPER			enum	InkBackgroundType
	IBT_SMALL_GRID				enum	InkBackgroundType
	IBT_MEDIUM_GRID				enum	InkBackgroundType
	IBT_LARGE_GRID				enum	InkBackgroundType
	IBT_SMALL_CROSS_SECTION			enum	InkBackgroundType
	IBT_MEDIUM_CROSS_SECTION		enum	InkBackgroundType
	IBT_LARGE_CROSS_SECTION			enum	InkBackgroundType
	IBT_TO_DO_LIST				enum	InkBackgroundType
	IBT_PHONE_MESSAGE			enum	InkBackgroundType
	IBT_CUSTOM_BACKGROUND			enum	InkBackgroundType

global	InkSetDocGString:far
;
; Sets the GString info for the file
;
; Pass:		BX	= VM file handle
;		AX	= InkBackGroundType
; Returns:	Nothing

global	InkGetDocGString:far
;
; Gets the GString for the file
;
; Pass:		BX	= VM file handle
; Returns: 	AX	= InkBackgroundType
;

global	InkSetDocCustomGString:far
;
; Sets the GString info for the file
;
; Pass:		BX	= VM file handle
;		AX	= Custom GString handle
; Returns:	Nothing

global	InkGetDocCustomGString:far
;
; Gets the custom GString for the file
;
; Pass:		BX	= VM file handle
; Returns:	AX	= Custom Gstring handle
;

INK_DB_MAX_TITLE_SIZE 	equ	128

global InkSendTitleToTextObject:far
;
; Sets the passed text object with the name from the passed folder or note
;
; Pass:		BX	= VM file handle
;		AX.DI	= dword tag of folder or note
;		CX:DX	= optr of text object to set
; Returns: 	Nothing

global InkGetTitle:far
;
; Gets the name for the passed folder or note
;
; Pass: 	BX	= VM file handle
;		AX.DI	= dword tag of folder or note
;		DS:SI	= destination to store null-terminated name
;			  (should be INK_DB_MAX_TITLE_SIZE + 1)
; Return:	CX	= size of name (including null terminator)
;

global InkGetParentFolder:far
;
; Gets the parent of the passed folder or note
;
; Pass:		BX	= VM file handle
;		AX.DI	= dword tag of folder/note
; Returns: 	AX.DI	= parent folder
;

global InkFolderSetTitleFromTextObject:far
global InkNoteSetTitleFromTextObject:far
;
; Sets the name for the passed folder or note
;
; Pass: 	BX	= VM file handle
;		AX.DI	= dword handle of folder or note
;		CX:DX 	= text object to get title from
; Returns:	Nothing

global InkFolderSetTitle:far
global InkNoteSetTitle:far
;
; Sets the name for the passed folder or note
;
; Pass: 	BX 	= VM file handle
;		AX.DI	= dword handle of folder or note
;		DS:SI	= new null-terminated name
;			  (should be INK_DB_MAX_TITLE_SIZE + 1)
; Returns:	Nothing

global InkFolderGetContents:far
;
; Returns the group/item of a chunk array of subfolders (DB items) for the
; passed folder.
;
; Pass: 	BX	= VM file handle
;		AX.DI	= dword tag of FolderInfo
; Returns: 	AX.DI	= group/item of chunk array of sub folders
;		DX.CX	= group/item of chunk array of notes
;		   	  Call DBLock to access chunk array

global	InkFolderGetNumChildren:far
;
; Gets the # children of the folder.
;
; Pass: 	BX	= VM file handle
;		AX.DI	= folder
; Returns: 	CX	= # sub folders
;		DX	= # notes

global	InkFolderDisplayChildInList:far
;
; Routine to be called from the app's MSG_META_GEN_LIST_REQUEST_ENTRY_MONIKER
; handler.	
;
; Pass:		BX	= VM file handle
;		AX.DI	= folder
;		CX:DX	= OD of GenDynamicList object
;		BP	= entry # of child we want to display
;		SI 	= non-zero if we want to display folders
; Returns:	Nothing
;

global	InkFolderGetChildInfo:far
;
; Gets information for a numbered child.
;
; Pass: 	BX	= VM file handle
;		AX.DI	= folder
;		CX 	= child number
; Returns: 	carry	= set if folder / clear if item
;	  	AX.DI	= folder or item

global	InkFolderGetChildNumber:far
;
; Gets the number of a child given its ID
;
; Pass:		BX	= VM file handle
;		AX.DI	= folder
;		DX.CX	= note or folder
; Returns: 	AX	= child number

global InkFolderCreateSubFolder:far
;
; Creates a subfolder in the current folder. This automatically adds this
; folder to the chunk array of children of the passed parent.	
;
; Pass: 	BX	= VM file handle
;		AX.DI	= dword tag of parent Folder (0:0 if no parent)
; Returns: 	AX.DI	= new child folder

global InkFolderMove:far
;
; Moves the passed folder.
;
; Pass:		BX	= VM file handle
;		AX.DI	= folder to move
;		DX.CX	= new parent folder
; Returns: 	Nothing

global InkFolderDelete:far
;
; Deletes the passed folder. If there are children, it does a recursive
; deletion.	
;
; Pass: 	BX	= VM file handle
;		AX.DI	= dword tag of folder
; Returns: 	Nothing

global InkFolderDepthFirstTraverse:far
;
; Does a depth-first traversal of the folder tree.
;
; Pass: 	BX 	= VM file handle
;		AX.DI	= folder at "root" of tree
;		CX:DX	= far ptr to callback routine
;		BP 	= extra data to pass to callback routine
; Returns: 	BP	= data returned from callback routine
;
;		Callback:
;		Pass:		BX	= VM file handle
;				AX.DI	= folder
;				BP	= data passed in
;		Return: 	Carry	= Set to end traversal
;				BP	= data to pass on
;		Can destroy: ax, bx, cx, dx, di, si, es, ds

global InkNoteCreate:far
;
; Creates a new empty note.
;
; Pass: 	BX	= VM file handle
;		AX.DI	= dword tag of parent folder
; Returns: 	AX.DI	= dword tag of new note
;

global	InkNoteCopyMoniker:far
;
; Copy the icon and folder/note name into the vis moniker
;
; Pass: 	DI:CX	= title of the note or folder
;		BX:SI	= optr of output list
;		AX	= 1 if text note, 0 if ink note, -1 if folder
;		DX	= entry index
; Return: 	Nothing
;

global InkNoteGetPages:far
;
; Gets the page chunk array from the current note
;
; Pass: 	BX 	= VM file handle
;		AX.DI 	= dword tag of note
; Return: 	AX.DI	= group/item of DB item containing chunk
;			  array of page info
;

global InkNoteGetNumPages:far
;
; Gets the page chunk array from the current note
;
; Pass:		BX	= VM file handle
;	 	AX.DI	= group/item of DB item containing chunk
;			  array of page info
; Return: 	CX 	= total number of pages in a note
;

global InkNoteCreatePage:far
;
; Create a new page in a note
;
; Pass: 	BX 	= VM file handle
;		AX.DI	= dword tag of note
;		CX	= page number insert before (CA_NULL_ELEMENT to append)
; Return: 	CX	= new page number
;

global InkNoteLoadPage:far
;
; Load the ink object or the text object from a page of a note
;
; Pass: 	BX	= VM file handle
;		AX.DI	= dword tag of note
;		CX	= page number
;		DX:BP	= optr of ink object or text object
;		SI	= note type (0:ink, 1:text)
; Return: 	Nothing
;

global InkNoteSavePage:far
;
; Save the ink from a page of a note
;
; Pass: 	BX	= VM file handle
;		AX.DI	= dword tag of note
;		CX	= page number
;		DX:BP	= optr of ink object or text object
;		SI	= note type (0:ink, 1:text)
; Return: 	Nothing
;

INK_DB_MAX_NOTE_KEYWORDS_SIZE 	equ	128
global InkNoteSetKeywordsFromTextObject:far
;
; Sets the keyword text for the note with text from the text object
;
; Pass: 	BX	= VM file handle
;		AX.DI	= dword tag of note
;		CX:DX	= optr of text object
; Return: 	Nothing
;

global InkNoteSetKeywords:far
;
; Sets the keyword text for the note
;
; Pass: 	BX	= VM file handle
;		AX.DI	= dword tag of note
;		DS:SI	= new keyword text
;			  (must be < INK_DB_MAX_NOTE_KEYWORDS_SIZE chars)
; Return: 	Nothing	
;

global InkNoteGetKeywords:far
;
; Gets the keyword text for the passed note
;
; Pass:		BX 	= VM file handle
;		AX.DI	= dword tag of note
;		DS:SI	= destination to store null-terminated text
;			  (should be INK_DB_MAX_NOTE_KEYWORDS_SIZE + 1)
; Return: 	CX	= size of name (excluding null terminator)
;

global InkNoteSendKeywordsToTextObject:far
;
; Puts the keyword text into a text object
;
; Pass:		BX	= VM file handle
;		AX.DI	= dword tag of note
;		CX:DX	= optr of text object
; Return: 	Nothing
;

global InkNoteDelete:far
;
; Deletes the note and all of the associated pages/information, and all
; internal references to it.
;
; Pass:		BX	= VM file handle
;		AX.DI	= dword tag of note
; Return: 	Nothing
;

global InkNoteMove:far
;
; Moves the passed note.
;
; Pass:		BX	= VM file handle
;		AX.DI	= note to move
;  		DX.CX	= new parent folder
; Return: 	Nothing
;

global InkNoteSetModificationDate:far
;
; Sets the modification date
;
; Pass:		BX	= VM file handle
;		AX.DI	= note
;		CX	= Year (0 = 1980)
;		DL	= Month
;		DH	= Day
; Return: 	Nothing
;

global InkNoteGetModificationDate:far
global InkNoteGetCreationDate:far
;
; Gets the modification/creation date
;
; Pass:		BX	= VM file handle
;		AX.DI	= note
; Return: 	CX	= Year
;		DL	= Month
;		DH	= Day
;

NoteType	etype	byte,0,2
    NT_INK	enum	NoteType
    NT_TEXT	enum	NoteType

global InkNoteGetNoteType:far
;
; Gets the note type - text or ink
;
; Pass		BX	= VM file handle
;		AX.DI	= note
; Return: 	CX	= NoteType
;

global InkNoteSetNoteType:far
;
; Sets the note type - text or ink
;
; Pass:		BX	= VM file handle
;		AX.DI	= note
;		CL	= NoteType
; Return:	Nothing
;

global InkNoteFindByTitle:far
;
; Finds notes by searching for the title
;
; Pass:		BX	= VM file handle
;		DS:SI	= string to match
;			  (can contain C_WILDCARD or C_SINGLE_WILDCARD)
;		AL	= SearchOptions
;		AH	= non-zero to look into the body of text notes
;
; Return: 	DX	= handle of block containing dword tags of matching
;			  notes	in this format (or 0 if no match found).
;			- or -
;		DX	= 0 if none found
;
;		FindNoteHeader<>
;		     -dword tag-
;		     -dword tag-
;		     -dword tag-
;			etc...
;
; NOTE: Only returns first 20000 or so notes that match
;

FindNoteHeader		struct
    FNH_count		word		; the # matching notes we've found.
    FNH_data		label	dword
FindNoteHeader		ends

global InkNoteFindByKeywords:far
;
; Finds notes that contain the passed keywords
;
; Pass:		BX	= VM file handle
;		DS:SI	= keyword strings (separated by whitespace or commas)
;		AX	= TRUE for notes that contain *all* keywords
;			= FALSE for notes that matched at least one keyword
;
; Return: 	DX	= handle of block containing dword tags of matching
;			  notes	(same as InkNoteFindByTitle)
;			- or -
;		DX	= 0 if none found
;
;		FindNoteHeader<>
;		     -dword tag-
;		     -dword tag-
;		     -dword tag-
;			etc...
;
; NOTE: Only returns first 20000 or so notes that match
;

;
; Absolute digitizer bounds 
;
DigitizerBounds	struct
    DB_left	word;
    DB_top	word;
    DB_right	word;
    DB_bottom	word;
DigitizerBounds	ends

global InkGetBoundsInDigitizerCoords:far
;
; Returns the bounds of a vis object in absolute digitizer coordinates.
;
; Pass:		^lbx:si - optr of vis object
; Return:	carry	- set if unable to convert bounds to digitizer
;			  coordinates
;		if carry is clear:
;			ax = left bound
;			bx = top bound
;			cx = right bound
;			dx = bottom bound
; Destroyed:	nothing

global InkClipDigitizerCoordsInk:far
;
; Clip the digitizer ink to the passed absolute digitizer
; bounds by discarding points that lie outside the bounds.
;
; If an ink stroke is completely outside the clip bounds, it
; is discarded. This routine assumes the Y digitizer values
; increase from bottom to top and the X digitizer values
; increase from left to right.
;
; Pass:		bp - handle of InkDigitizerCoordsHeader data block
;		ax - left bound
;		bx - top bound
;		cx - right bound
;		dx - bottom bound
; Return:	carry set if clipping failed
; Destroyed:	nothing

EndLibrary	pen
