TextSink.c File Reference

#include <stdio.h>
#include <ctype.h>
#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>
#include <X11/Xaw3d/XawInit.h>
#include <X11/Xaw3d/TextSinkP.h>
#include <X11/Xaw3d/TextP.h>

Include dependency graph for TextSink.c:

Go to the source code of this file.

Defines

#define offset(field)   XtOffsetOf(TextSinkRec, text_sink.field)
#define SuperClass   (&objectClassRec)

Functions

static void ClassPartInitialize ()
static void Initialize ()
static void Destroy ()
static Boolean SetValues ()
static int MaxHeight ()
static int MaxLines ()
static void DisplayText ()
static void InsertCursor ()
static void ClearToBackground ()
static void FindPosition ()
static void FindDistance ()
static void Resolve ()
static void SetTabs ()
static void GetCursorBounds ()
static void ClassPartInitialize (WidgetClass wc)
static void Initialize (Widget request, Widget new, ArgList args, Cardinal *num_args)
static void Destroy (Widget w)
static Boolean SetValues (Widget current, Widget request, Widget new, ArgList args, Cardinal *num_args)
static void DisplayText (Widget w, Position x, Position y, XawTextPosition pos1, XawTextPosition pos2, Boolean highlight)
static void InsertCursor (Widget w, Position x, Position y, XawTextInsertState state)
static void ClearToBackground (Widget w, Position x, Position y, Dimension width, Dimension height)
static void FindPosition (Widget w, XawTextPosition fromPos, int fromx, int width, Boolean stopAtWordBreak, XawTextPosition *resPos, int *resWidth, int *resHeight)
static void FindDistance (Widget w, XawTextPosition fromPos, int fromx, XawTextPosition toPos, int *resWidth, XawTextPosition *resPos, int *resHeight)
static void Resolve (Widget w, XawTextPosition pos, int fromx, int width, XawTextPosition *resPos)
static int MaxLines (Widget w, Dimension height)
static int MaxHeight (Widget w, int lines)
static void SetTabs (Widget w, int tab_count, short *tabs)
static void GetCursorBounds (Widget w, XRectangle *rect)
void XawTextSinkDisplayText (Widget w, Position x, Position y, XawTextPosition pos1, XawTextPosition pos2, Boolean highlight)
void XawTextSinkInsertCursor (Widget w, Position x, Position y, XawTextInsertState state)
void XawTextSinkClearToBackground (Widget w, Position x, Position y, Dimension width, Dimension height)
void XawTextSinkFindPosition (Widget w, XawTextPosition fromPos, int fromx, int width, Boolean stopAtWordBreak, XawTextPosition *resPos, int *resWidth, int *resHeight)
void XawTextSinkFindDistance (Widget w, XawTextPosition fromPos, int fromx, XawTextPosition toPos, int *resWidth, XawTextPosition *resPos, int *resHeight)
void XawTextSinkResolve (Widget w, XawTextPosition pos, int fromx, int width, XawTextPosition *resPos)
int XawTextSinkMaxLines (Widget w, Dimension height)
int XawTextSinkMaxHeight (Widget w, int lines)
void XawTextSinkSetTabs (Widget w, int tab_count, int *tabs)
void XawTextSinkGetCursorBounds (Widget w, XRectangle *rect)

Variables

static XtResource resources []
TextSinkClassRec textSinkClassRec
WidgetClass textSinkObjectClass = (WidgetClass)&textSinkClassRec


Define Documentation

#define offset ( field   )     XtOffsetOf(TextSinkRec, text_sink.field)

Definition at line 61 of file TextSink.c.

#define SuperClass   (&objectClassRec)

Definition at line 70 of file TextSink.c.


Function Documentation

static void ClassPartInitialize ( WidgetClass  wc  )  [static]

Definition at line 125 of file TextSink.c.

References _TextSinkClassPart::ClearToBackground, _TextSinkClassPart::DisplayText, _TextSinkClassPart::FindDistance, _TextSinkClassPart::FindPosition, _TextSinkClassPart::GetCursorBounds, _TextSinkClassPart::InsertCursor, _TextSinkClassPart::MaxHeight, _TextSinkClassPart::MaxLines, _TextSinkClassRec::object_class, _TextSinkClassPart::Resolve, _TextSinkClassPart::SetTabs, _TextSinkClassRec::text_sink_class, XtInheritClearToBackground, XtInheritDisplayText, XtInheritFindDistance, XtInheritFindPosition, XtInheritGetCursorBounds, XtInheritInsertCursor, XtInheritMaxHeight, XtInheritMaxLines, XtInheritResolve, and XtInheritSetTabs.

00127 {
00128   TextSinkObjectClass t_src, superC;
00129 
00130   t_src = (TextSinkObjectClass) wc;
00131   superC = (TextSinkObjectClass) t_src->object_class.superclass;
00132 
00133 /* 
00134  * We don't need to check for null super since we'll get to TextSink
00135  * eventually.
00136  */
00137 
00138     if (t_src->text_sink_class.DisplayText == XtInheritDisplayText) 
00139       t_src->text_sink_class.DisplayText = superC->text_sink_class.DisplayText;
00140 
00141     if (t_src->text_sink_class.InsertCursor == XtInheritInsertCursor) 
00142       t_src->text_sink_class.InsertCursor =
00143                                           superC->text_sink_class.InsertCursor;
00144 
00145     if (t_src->text_sink_class.ClearToBackground== XtInheritClearToBackground) 
00146       t_src->text_sink_class.ClearToBackground = 
00147                                      superC->text_sink_class.ClearToBackground;
00148 
00149     if (t_src->text_sink_class.FindPosition == XtInheritFindPosition) 
00150       t_src->text_sink_class.FindPosition = 
00151                                           superC->text_sink_class.FindPosition;
00152 
00153     if (t_src->text_sink_class.FindDistance == XtInheritFindDistance) 
00154       t_src->text_sink_class.FindDistance = 
00155                                          superC->text_sink_class.FindDistance;
00156 
00157     if (t_src->text_sink_class.Resolve == XtInheritResolve) 
00158       t_src->text_sink_class.Resolve = superC->text_sink_class.Resolve;
00159 
00160     if (t_src->text_sink_class.MaxLines == XtInheritMaxLines) 
00161       t_src->text_sink_class.MaxLines = superC->text_sink_class.MaxLines;
00162 
00163     if (t_src->text_sink_class.MaxHeight == XtInheritMaxHeight) 
00164       t_src->text_sink_class.MaxHeight = superC->text_sink_class.MaxHeight;
00165 
00166     if (t_src->text_sink_class.SetTabs == XtInheritSetTabs) 
00167       t_src->text_sink_class.SetTabs = superC->text_sink_class.SetTabs;
00168 
00169     if (t_src->text_sink_class.GetCursorBounds == XtInheritGetCursorBounds) 
00170       t_src->text_sink_class.GetCursorBounds = 
00171                                        superC->text_sink_class.GetCursorBounds;
00172 }

static void ClassPartInitialize (  )  [static]

static void ClearToBackground ( Widget  w,
Position  x,
Position  y,
Dimension  width,
Dimension  height 
) [static]

Definition at line 299 of file TextSink.c.

00303 {
00304 /* 
00305  * Don't clear in height or width are zero.
00306  * XClearArea() has special semantic for these values.
00307  */
00308 
00309     if ( (height == 0) || (width == 0) ) return;
00310     XClearArea(XtDisplayOfObject(w), XtWindowOfObject(w),
00311                x, y, width, height, False);
00312 }

static void ClearToBackground (  ) 

static void Destroy ( Widget  w  )  [static]

Definition at line 204 of file TextSink.c.

References TextSinkPart::char_tabs, TextSinkPart::tabs, and _TextSinkRec::text_sink.

00206 {
00207   TextSinkObject sink = (TextSinkObject) w;
00208 
00209   XtFree((char *) sink->text_sink.tabs);
00210   XtFree((char *) sink->text_sink.char_tabs);
00211 }

static void Destroy (  ) 

static void DisplayText ( Widget  w,
Position  x,
Position  y,
XawTextPosition  pos1,
XawTextPosition  pos2,
Boolean  highlight 
) [static]

Definition at line 258 of file TextSink.c.

00263 {
00264   return;
00265 }

static void DisplayText (  )  [static]

static void FindDistance ( Widget  w,
XawTextPosition  fromPos,
int  fromx,
XawTextPosition  toPos,
int resWidth,
XawTextPosition resPos,
int resHeight 
) [static]

Definition at line 356 of file TextSink.c.

00364 {
00365   *resWidth = *resHeight = 0;
00366   *resPos = fromPos;
00367 }

static void FindDistance (  )  [static]

static void FindPosition ( Widget  w,
XawTextPosition  fromPos,
int  fromx,
int  width,
Boolean  stopAtWordBreak,
XawTextPosition resPos,
int resWidth,
int resHeight 
) [static]

Definition at line 329 of file TextSink.c.

00337 {
00338   *resPos = fromPos;
00339   *resHeight = *resWidth = 0;
00340 }

static void FindPosition (  ) 

static void GetCursorBounds ( Widget  w,
XRectangle *  rect 
) [static]

Definition at line 457 of file TextSink.c.

00460 {
00461   rect->x = rect->y = rect->width = rect->height = 0;
00462 }

static void GetCursorBounds (  ) 

static void Initialize ( Widget  request,
Widget  new,
ArgList  args,
Cardinal *  num_args 
) [static]

Definition at line 184 of file TextSink.c.

References TextSinkPart::char_tabs, NULL, TextSinkPart::tab_count, TextSinkPart::tabs, and _TextSinkRec::text_sink.

00188 {
00189   TextSinkObject sink = (TextSinkObject) new;
00190 
00191   sink->text_sink.tab_count = 0; /* Initialize the tab stops. */
00192   sink->text_sink.tabs = NULL;
00193   sink->text_sink.char_tabs = NULL;
00194 }

static void Initialize ( void   ) 

Initialisation of Scilab

static void InsertCursor ( Widget  w,
Position  x,
Position  y,
XawTextInsertState  state 
) [static]

Definition at line 280 of file TextSink.c.

00284 {
00285   return;
00286 }

static void InsertCursor (  ) 

static int MaxHeight ( Widget  w,
int  lines 
) [static]

Definition at line 423 of file TextSink.c.

00426 {
00427   return 0;
00428 }

static int MaxHeight (  )  [static]

static int MaxLines ( Widget  w,
Dimension  height 
) [static]

Definition at line 400 of file TextSink.c.

00403 {
00404   /*
00405    * The fontset has gone down to descent Sink Widget, so
00406    * the functions such MaxLines, SetTabs... are bound to the descent.
00407    *
00408    * by Li Yuhong, Jan. 15, 1991
00409    */
00410   return 0;
00411 }

static int MaxLines (  ) 

static void Resolve ( Widget  w,
XawTextPosition  pos,
int  fromx,
int  width,
XawTextPosition resPos 
) [static]

Definition at line 381 of file TextSink.c.

00386 {
00387   *resPos = pos;
00388 }

static void Resolve (  ) 

static void SetTabs ( Widget  w,
int  tab_count,
short *  tabs 
) [static]

Definition at line 440 of file TextSink.c.

00444 {
00445   return;
00446 }

static void SetTabs (  ) 

static Boolean SetValues ( Widget  current,
Widget  request,
Widget  new,
ArgList  args,
Cardinal *  num_args 
) [static]

Definition at line 223 of file TextSink.c.

References FALSE, TextSinkPart::foreground, _TextSinkRec::text_sink, and w.

00227 {
00228   TextSinkObject w = (TextSinkObject) new;
00229   TextSinkObject old_w = (TextSinkObject) current;
00230 
00231   if (w->text_sink.foreground != old_w->text_sink.foreground)
00232      ((TextWidget)XtParent(new))->text.redisplay_needed = True;
00233 
00234   return FALSE;
00235 }

static Boolean SetValues (  )  [static]

void XawTextSinkClearToBackground ( Widget  w,
Position  x,
Position  y,
Dimension  width,
Dimension  height 
)

Definition at line 566 of file TextSink.c.

References w.

00571 {
00572   TextSinkObjectClass class = (TextSinkObjectClass) w->core.widget_class;
00573 
00574   (*class->text_sink_class.ClearToBackground)(w, x, y, width, height);
00575 }

void XawTextSinkDisplayText ( Widget  w,
Position  x,
Position  y,
XawTextPosition  pos1,
XawTextPosition  pos2,
Boolean  highlight 
)

Definition at line 499 of file TextSink.c.

References w.

Referenced by DisplayText().

00505 {
00506   TextSinkObjectClass class = (TextSinkObjectClass) w->core.widget_class;
00507 
00508   (*class->text_sink_class.DisplayText)(w, x, y, pos1, pos2, highlight);
00509 }

Here is the caller graph for this function:

void XawTextSinkFindDistance ( Widget  w,
XawTextPosition  fromPos,
int  fromx,
XawTextPosition  toPos,
int resWidth,
XawTextPosition resPos,
int resHeight 
)

Definition at line 638 of file TextSink.c.

References w.

Referenced by LineAndXYForPosition().

00643 {
00644   TextSinkObjectClass class = (TextSinkObjectClass) w->core.widget_class;
00645 
00646   (*class->text_sink_class.FindDistance)(w, fromPos, fromx, toPos,
00647                                          resWidth, resPos, resHeight);
00648 }

Here is the caller graph for this function:

void XawTextSinkFindPosition ( Widget  w,
XawTextPosition  fromPos,
int  fromx,
int  width,
Boolean  stopAtWordBreak,
XawTextPosition resPos,
int resWidth,
int resHeight 
)

Definition at line 602 of file TextSink.c.

References w.

Referenced by _BuildLineTable(), AutoFill(), InsertNewCRs(), PositionForXY(), and UpdateTextInLine().

00611 {
00612   TextSinkObjectClass class = (TextSinkObjectClass) w->core.widget_class;
00613 
00614   (*class->text_sink_class.FindPosition)(w, fromPos, fromx, width,
00615                                          stopAtWordBreak, 
00616                                          resPos, resWidth, resHeight);
00617 }

Here is the caller graph for this function:

void XawTextSinkGetCursorBounds ( Widget  w,
XRectangle *  rect 
)

Definition at line 771 of file TextSink.c.

References w.

Referenced by NotePosition(), and ProcessExposeRegion().

00775 {
00776   TextSinkObjectClass class = (TextSinkObjectClass) w->core.widget_class;
00777 
00778   (*class->text_sink_class.GetCursorBounds)(w, rect);
00779 }

Here is the caller graph for this function:

void XawTextSinkInsertCursor ( Widget  w,
Position  x,
Position  y,
XawTextInsertState  state 
)

Definition at line 532 of file TextSink.c.

References w.

Referenced by InsertCursor().

00537 {
00538   TextSinkObjectClass class = (TextSinkObjectClass) w->core.widget_class;
00539     
00540   (*class->text_sink_class.InsertCursor)(w, x, y, state);
00541 }

Here is the caller graph for this function:

int XawTextSinkMaxHeight ( Widget  w,
int  lines 
)

Definition at line 719 of file TextSink.c.

References w.

Referenced by _XawTextCheckResize(), and Initialize().

00723 {
00724   TextSinkObjectClass class = (TextSinkObjectClass) w->core.widget_class;
00725 
00726   return((*class->text_sink_class.MaxHeight)(w, lines));
00727 }

Here is the caller graph for this function:

int XawTextSinkMaxLines ( Widget  w,
Dimension  height 
)

Definition at line 696 of file TextSink.c.

References w.

Referenced by _XawTextBuildLineTable().

00700 {
00701   TextSinkObjectClass class = (TextSinkObjectClass) w->core.widget_class;
00702 
00703   return((*class->text_sink_class.MaxLines)(w, height));
00704 }

Here is the caller graph for this function:

void XawTextSinkResolve ( Widget  w,
XawTextPosition  pos,
int  fromx,
int  width,
XawTextPosition resPos 
)

Definition at line 666 of file TextSink.c.

References w.

00672 {
00673   TextSinkObjectClass class = (TextSinkObjectClass) w->core.widget_class;
00674 
00675   (*class->text_sink_class.Resolve)(w, pos, fromx, width, resPos);
00676 }

void XawTextSinkSetTabs ( Widget  w,
int  tab_count,
int tabs 
)

Definition at line 741 of file TextSink.c.

References i, and w.

Referenced by Initialize().

00745 {
00746   if (tab_count > 0) {
00747     TextSinkObjectClass class = (TextSinkObjectClass) w->core.widget_class;
00748     short *char_tabs = (short*)XtMalloc( (unsigned)tab_count*sizeof(short) );
00749     short *tab;
00750     int i;
00751 
00752     for (i = tab_count, tab = char_tabs; i; i--) *tab++ = (short)*tabs++;
00753 
00754     (*class->text_sink_class.SetTabs)(w, tab_count, char_tabs);
00755     XtFree((char *)char_tabs);
00756   }
00757 }

Here is the caller graph for this function:


Variable Documentation

XtResource resources[] [static]

Initial value:

 {
  {XtNforeground, XtCForeground, XtRPixel, sizeof (Pixel),
     offset(foreground), XtRString, XtDefaultForeground}, 
  {XtNbackground, XtCBackground, XtRPixel, sizeof (Pixel),
     offset(background), XtRString, XtDefaultBackground}, 
}

Definition at line 62 of file TextSink.c.

TextSinkClassRec textSinkClassRec

Definition at line 71 of file TextSink.c.

WidgetClass textSinkObjectClass = (WidgetClass)&textSinkClassRec

Definition at line 122 of file TextSink.c.


Generated on Sun Mar 4 16:02:49 2007 for Scilab [trunk] by  doxygen 1.5.1