#endif
/*
* Copyright 1989 Massachusetts Institute of Technology
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, 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 name of M.I.T. not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. M.I.T. makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
* 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.
*
* Author: Chris Peterson, MIT X Consortium.
*
* Much code taken from X11R3 AsciiSink.
*/
/*
* TextSink.c - TextSink object. (For use with the text widget).
*
*/
#include <stdio.h>
#include <ctype.h>
#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>
#include <./Xaw3_1XawInit.h>
#include <./Xaw3_1TextSinkP.h>
#include <./Xaw3_1TextP.h>
/****************************************************************
*
* Full class record constant
*
****************************************************************/
};
{
/* core_class fields */
/* class_name */ "TextSink",
/* widget_size */ sizeof(TextSinkRec),
/* class_initialize */ XawInitializeWidgetSet,
/* class_part_initialize */ ClassPartInitialize,
/* class_inited */ FALSE,
/* initialize */ Initialize,
/* initialize_hook */ NULL,
/* obj1 */ NULL,
/* obj2 */ NULL,
/* obj3 */ 0,
/* resources */ resources,
/* xrm_class */ NULLQUARK,
/* obj4 */ FALSE,
/* obj5 */ FALSE,
/* obj6 */ FALSE,
/* obj7 */ FALSE,
/* destroy */ Destroy,
/* obj8 */ NULL,
/* obj9 */ NULL,
/* set_values */ SetValues,
/* set_values_hook */ NULL,
/* obj10 */ NULL,
/* get_values_hook */ NULL,
/* obj11 */ NULL,
/* version */ XtVersion,
/* callback_private */ NULL,
/* obj12 */ NULL,
/* obj13 */ NULL,
/* obj14 */ NULL,
/* extension */ NULL
},
/* textSink_class fields */
{
/* DisplayText */ DisplayText,
/* InsertCursor */ InsertCursor,
/* ClearToBackground */ ClearToBackground,
/* FindPosition */ FindPosition,
/* FindDistance */ FindDistance,
/* Resolve */ Resolve,
/* MaxLines */ MaxLines,
/* MaxHeight */ MaxHeight,
/* SetTabs */ SetTabs,
/* GetCursorBounds */ GetCursorBounds,
}
};
static void
{
/*
* We don't need to check for null super since we'll get to TextSink
* eventually.
*/
}
/* Function Name: Initialize
* Description: Initializes the TextSink Object.
* Arguments: request, new - the requested and new values for the object
* instance.
* Returns: none.
*
*/
/* ARGSUSED */
static void
{
}
/* Function Name: Destroy
* Description: This function cleans up when the object is
* destroyed.
* Arguments: w - the TextSink Object.
* Returns: none.
*/
static void
Destroy(w)
{
}
/* Function Name: SetValues
* Description: Sets the values for the TextSink
* Arguments: current - current state of the object.
* request - what was requested.
* new - what the object will become.
* Returns: True if redisplay is needed.
*/
/* ARGSUSED */
static Boolean
{
} else {
}
return FALSE;
}
/************************************************************
*
* Class specific methods.
*
************************************************************/
/* Function Name: DisplayText
* Description: Stub function that in subclasses will display text.
* Arguments: w - the TextSink Object.
* x, y - location to start drawing text.
* pos1, pos2 - location of starting and ending points
* in the text buffer.
* highlight - hightlight this text?
* Returns: none.
*
* This function doesn't actually display anything, it is only a place
* holder.
*/
/* ARGSUSED */
static void
Widget w;
Position x, y;
{
return;
}
/* Function Name: InsertCursor
* Description: Places the InsertCursor.
* Arguments: w - the TextSink Object.
* x, y - location for the cursor.
* staye - whether to turn the cursor on, or off.
* Returns: none.
*
* This function doesn't actually display anything, it is only a place
* holder.
*/
/* ARGSUSED */
static void
Widget w;
Position x, y;
{
return;
}
/* Function Name: ClearToBackground
* Description: Clears a region of the sink to the background color.
* Arguments: w - the TextSink Object.
* x, y - location of area to clear.
* width, height - size of area to clear
* Returns: void.
*
*/
/* ARGSUSED */
static void
Widget w;
Position x, y;
{
/*
* Don't clear in height or width are zero.
* XClearArea() has special semantic for these values.
*/
}
/* Function Name: FindPosition
* Description: Finds a position in the text.
* Arguments: w - the TextSink Object.
* fromPos - reference position.
* fromX - reference location.
* width, - width of section to paint text.
* stopAtWordBreak - returned position is a word break?
* resPos - Position to return. *** RETURNED ***
* resWidth - Width actually used. *** RETURNED ***
* resHeight - Height actually used. *** RETURNED ***
* Returns: none (see above).
*/
/* ARGSUSED */
static void
Widget w;
{
}
/* Function Name: FindDistance
* Description: Find the Pixel Distance between two text Positions.
* Arguments: w - the TextSink Object.
* fromPos - starting Position.
* fromX - x location of starting Position.
* toPos - end Position.
* resWidth - Distance between fromPos and toPos.
* resPos - Acutal toPos used.
* resHeight - Height required by this text.
* Returns: none.
*/
/* ARGSUSED */
static void
Widget w;
int fromx;
int *resWidth;
int *resHeight;
{
}
/* Function Name: Resolve
* Description: Resloves a location to a position.
* Arguments: w - the TextSink Object.
* pos - a reference Position.
* fromx - a reference Location.
* width - width to move.
* resPos - the resulting position.
* Returns: none
*/
/* ARGSUSED */
static void
Widget w;
{
}
/* Function Name: MaxLines
* Description: Finds the Maximum number of lines that will fit in
* a given height.
* Arguments: w - the TextSink Object.
* height - height to fit lines into.
* Returns: the number of lines that will fit.
*/
/* ARGSUSED */
static int
Widget w;
{
int font_height;
return( ((int) height) / font_height );
}
/* Function Name: MaxHeight
* Description: Finds the Minium height that will contain a given number
* lines.
* Arguments: w - the TextSink Object.
* lines - the number of lines.
* Returns: the height.
*/
/* ARGSUSED */
static int
Widget w;
int lines;
{
}
/* Function Name: SetTabs
* Description: Sets the Tab stops.
* Arguments: w - the TextSink Object.
* tab_count - the number of tabs in the list.
* tabs - the text positions of the tabs.
* Returns: none
*/
static void
Widget w;
int tab_count;
short *tabs;
{
int i;
unsigned long figure_width = 0;
/*
* Find the figure width of the current font.
*/
if ( (XA_FIGURE_WIDTH != NULL) &&
(figure_width == 0)) )
else
}
for ( i = 0 ; i < tab_count ; i++ ) {
}
}
/* Function Name: GetCursorBounds
* Description: Finds the bounding box for the insert curor (caret).
* Arguments: w - the TextSinkObject.
* rect - an X rectance containing the cursor bounds.
* Returns: none (fills in rect).
*/
/* ARGSUSED */
static void
Widget w;
XRectangle * rect;
{
}
/************************************************************
*
* Public Functions.
*
************************************************************/
/* Function Name: XawTextSinkDisplayText
* Description: Stub function that in subclasses will display text.
* Arguments: w - the TextSink Object.
* x, y - location to start drawing text.
* pos1, pos2 - location of starting and ending points
* in the text buffer.
* highlight - hightlight this text?
* Returns: none.
*
* This function doesn't actually display anything, it is only a place
* holder.
*/
/* ARGSUSED */
void
Widget w;
Position x, y;
{
}
/* Function Name: XawTextSinkInsertCursor
* Description: Places the InsertCursor.
* Arguments: w - the TextSink Object.
* x, y - location for the cursor.
* staye - whether to turn the cursor on, or off.
* Returns: none.
*
* This function doesn't actually display anything, it is only a place
* holder.
*/
/* ARGSUSED */
void
Widget w;
Position x, y;
{
}
/* Function Name: XawTextSinkClearToBackground
* Description: Clears a region of the sink to the background color.
* Arguments: w - the TextSink Object.
* x, y - location of area to clear.
* width, height - size of area to clear
* Returns: void.
*
* This function doesn't actually display anything, it is only a place
* holder.
*/
/* ARGSUSED */
void
Widget w;
Position x, y;
{
}
/* Function Name: XawTextSinkFindPosition
* Description: Finds a position in the text.
* Arguments: w - the TextSink Object.
* fromPos - reference position.
* fromX - reference location.
* width, - width of section to paint text.
* stopAtWordBreak - returned position is a word break?
* resPos - Position to return. *** RETURNED ***
* resWidth - Width actually used. *** RETURNED ***
* resHeight - Height actually used. *** RETURNED ***
* Returns: none (see above).
*/
/* ARGSUSED */
void
Widget w;
{
}
/* Function Name: XawTextSinkFindDistance
* Description: Find the Pixel Distance between two text Positions.
* Arguments: w - the TextSink Object.
* fromPos - starting Position.
* fromX - x location of starting Position.
* toPos - end Position.
* resWidth - Distance between fromPos and toPos.
* resPos - Acutal toPos used.
* resHeight - Height required by this text.
* Returns: none.
*/
/* ARGSUSED */
void
Widget w;
{
}
/* Function Name: XawTextSinkResolve
* Description: Resloves a location to a position.
* Arguments: w - the TextSink Object.
* pos - a reference Position.
* fromx - a reference Location.
* width - width to move.
* resPos - the resulting position.
* Returns: none
*/
/* ARGSUSED */
void
Widget w;
{
}
/* Function Name: XawTextSinkMaxLines
* Description: Finds the Maximum number of lines that will fit in
* a given height.
* Arguments: w - the TextSink Object.
* height - height to fit lines into.
* Returns: the number of lines that will fit.
*/
/* ARGSUSED */
int
Widget w;
{
}
/* Function Name: XawTextSinkMaxHeight
* Description: Finds the Minium height that will contain a given number
* lines.
* Arguments: w - the TextSink Object.
* lines - the number of lines.
* Returns: the height.
*/
/* ARGSUSED */
int
Widget w;
int lines;
{
}
/* Function Name: XawTextSinkSetTabs
* Description: Sets the Tab stops.
* Arguments: w - the TextSink Object.
* tab_count - the number of tabs in the list.
* tabs - the text positions of the tabs.
* Returns: none
*/
void
Widget w;
{
if (tab_count > 0) {
register short *tab;
register int i;
}
}
/* Function Name: XawTextSinkGetCursorBounds
* Description: Finds the bounding box for the insert curor (caret).
* Arguments: w - the TextSinkObject.
* rect - an X rectance containing the cursor bounds.
* Returns: none (fills in rect).
*/
/* ARGSUSED */
void
Widget w;
XRectangle * rect;
{
}