#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <X11/Xmu/Misc.h>
#include <X11/Xmu/StdSel.h>
#include <X11/Xmu/Atoms.h>
#include <X11/Xaw3d/TextP.h>
#include <X11/Xaw3d/MultiSrcP.h>
#include <X11/Xaw3d/XawImP.h>
#include <X11/Xfuncs.h>
#include "XawI18n.h"
#include <stdio.h>
#include <ctype.h>
Include dependency graph for TextAction.c:
Go to the source code of this file.
Data Structures | |
struct | _SelectionList |
Defines | |
#define | SrcScan XawTextSourceScan |
#define | FindDist XawTextSinkFindDistance |
#define | FindPos XawTextSinkFindPosition |
#define | XawTextActionMaxHexChars 100 |
#define | SrcCvtSel XawTextSourceConvertSelection |
Functions | |
void | _XawTextInsertFileAction () |
void | _XawTextInsertFile () |
void | _XawTextSearch () |
void | _XawTextDoSearchAction () |
void | _XawTextDoReplaceAction () |
void | _XawTextSetField () |
void | _XawTextPopdownSearchAction () |
char * | _XawTextGetText () |
void | _XawTextAlterSelection () |
void | _XawTextVScroll () |
void | _XawTextSetSelection () |
void | _XawTextCheckResize () |
void | _XawTextExecuteUpdate () |
void | _XawTextSetScrollBars () |
void | _XawTextClearAndCenterDisplay () |
Atom * | _XawTextSelectionList () |
void | _XawTextPrepareToUpdate () |
int | _XawTextReplace () |
static void | ParameterError (Widget w, String param) |
static void | StartAction (TextWidget ctx, XEvent *event) |
static void | NotePosition (TextWidget ctx, XEvent *event) |
static void | EndAction (TextWidget ctx) |
static int | ProbablyMB (char *s) |
static void | GetSelection () |
static void | _SelectionReceived (Widget w, XtPointer client_data, Atom *selection, Atom *type, XtPointer value, unsigned long *length, int *format) |
static void | GetSelection (Widget w, Time time, String *params, Cardinal num_params) |
static void | InsertSelection (Widget w, XEvent *event, String *params, Cardinal *num_params) |
static void | Move (TextWidget ctx, XEvent *event, XawTextScanDirection dir, XawTextScanType type, Boolean include) |
static void | MoveForwardChar (Widget w, XEvent *event, String *p, Cardinal *n) |
static void | MoveBackwardChar (Widget w, XEvent *event, String *p, Cardinal *n) |
static void | MoveForwardWord (Widget w, XEvent *event, String *p, Cardinal *n) |
static void | MoveBackwardWord (Widget w, XEvent *event, String *p, Cardinal *n) |
static void | MoveForwardParagraph (Widget w, XEvent *event, String *p, Cardinal *n) |
static void | MoveBackwardParagraph (Widget w, XEvent *event, String *p, Cardinal *n) |
static void | MoveToLineEnd (Widget w, XEvent *event, String *p, Cardinal *n) |
static void | MoveToLineStart (Widget w, XEvent *event, String *p, Cardinal *n) |
static void | MoveLine (TextWidget ctx, XEvent *event, XawTextScanDirection dir) |
static void | MoveNextLine (Widget w, XEvent *event, String *p, Cardinal *n) |
static void | MovePreviousLine (Widget w, XEvent *event, String *p, Cardinal *n) |
static void | MoveBeginningOfFile (Widget w, XEvent *event, String *p, Cardinal *n) |
static void | MoveEndOfFile (Widget w, XEvent *event, String *p, Cardinal *n) |
static void | Scroll (TextWidget ctx, XEvent *event, XawTextScanDirection dir) |
static void | ScrollOneLineUp (Widget w, XEvent *event, String *p, Cardinal *n) |
static void | ScrollOneLineDown (Widget w, XEvent *event, String *p, Cardinal *n) |
static void | MovePage (TextWidget ctx, XEvent *event, XawTextScanDirection dir) |
static void | MoveNextPage (Widget w, XEvent *event, String *p, Cardinal *n) |
static void | MovePreviousPage (Widget w, XEvent *event, String *p, Cardinal *n) |
static Boolean | MatchSelection (Atom selection, XawTextSelection *s) |
static Boolean | ConvertSelection (Widget w, Atom *selection, Atom *target, Atom *type, XtPointer *value, unsigned long *length, int *format) |
static void | LoseSelection (Widget w, Atom *selection) |
static void | _DeleteOrKill (TextWidget ctx, XawTextPosition from, XawTextPosition to, Boolean kill) |
static void | DeleteOrKill (TextWidget ctx, XEvent *event, XawTextScanDirection dir, XawTextScanType type, Boolean include, Boolean kill) |
static void | DeleteForwardChar (Widget w, XEvent *event, String *p, Cardinal *n) |
static void | DeleteBackwardChar (Widget w, XEvent *event, String *p, Cardinal *n) |
static void | DeleteForwardWord (Widget w, XEvent *event, String *p, Cardinal *n) |
static void | DeleteBackwardWord (Widget w, XEvent *event, String *p, Cardinal *n) |
static void | KillForwardWord (Widget w, XEvent *event, String *p, Cardinal *n) |
static void | KillBackwardWord (Widget w, XEvent *event, String *p, Cardinal *n) |
static void | KillToEndOfLine (Widget w, XEvent *event, String *p, Cardinal *n) |
static void | KillToEndOfParagraph (Widget w, XEvent *event, String *p, Cardinal *n) |
void | _XawTextZapSelection (TextWidget ctx, XEvent *event, Boolean kill) |
static void | KillCurrentSelection (Widget w, XEvent *event, String *p, Cardinal *n) |
static void | DeleteCurrentSelection (Widget w, XEvent *event, String *p, Cardinal *n) |
static int | InsertNewLineAndBackupInternal (TextWidget ctx) |
static void | InsertNewLineAndBackup (Widget w, XEvent *event, String *p, Cardinal *n) |
static int | LocalInsertNewLine (TextWidget ctx, XEvent *event) |
static void | InsertNewLine (Widget w, XEvent *event, String *p, Cardinal *n) |
static void | InsertNewLineAndIndent (Widget w, XEvent *event, String *p, Cardinal *n) |
static void | SelectWord (Widget w, XEvent *event, String *params, Cardinal *num_params) |
static void | SelectAll (Widget w, XEvent *event, String *params, Cardinal *num_params) |
static void | ModifySelection (TextWidget ctx, XEvent *event, XawTextSelectionMode mode, XawTextSelectionAction action, String *params, Cardinal *num_params) |
static void | SelectStart (Widget w, XEvent *event, String *params, Cardinal *num_params) |
static void | SelectAdjust (Widget w, XEvent *event, String *params, Cardinal *num_params) |
static void | SelectEnd (Widget w, XEvent *event, String *params, Cardinal *num_params) |
static void | ExtendStart (Widget w, XEvent *event, String *params, Cardinal *num_params) |
static void | ExtendAdjust (Widget w, XEvent *event, String *params, Cardinal *num_params) |
static void | ExtendEnd (Widget w, XEvent *event, String *params, Cardinal *num_params) |
static void | SelectSave (Widget w, XEvent *event, String *params, Cardinal *num_params) |
static void | RedrawDisplay (Widget w, XEvent *event, String *p, Cardinal *n) |
static void | TextFocusIn (Widget w, XEvent *event, String *p, Cardinal *n) |
static void | TextFocusOut (Widget w, XEvent *event, String *p, Cardinal *n) |
static void | TextEnterWindow (Widget w, XEvent *event, String *params, Cardinal *num_params) |
static void | TextLeaveWindow (Widget w, XEvent *event, String *params, Cardinal *num_params) |
static void | AutoFill (TextWidget ctx) |
static void | InsertChar (Widget w, XEvent *event, String *p, Cardinal *n) |
static char * | IfHexConvertHexElseReturnParam (char *param, int *len_return) |
static void | InsertString (Widget w, XEvent *event, String *params, Cardinal *num_params) |
static void | DisplayCaret (Widget w, XEvent *event, String *params, Cardinal *num_params) |
static void | Multiply (Widget w, XEvent *event, String *params, Cardinal *num_params) |
static XawTextPosition | StripOutOldCRs (TextWidget ctx, XawTextPosition from, XawTextPosition to) |
static void | InsertNewCRs (TextWidget ctx, XawTextPosition from, XawTextPosition to) |
static int | FormRegion (TextWidget ctx, XawTextPosition from, XawTextPosition to) |
static void | FormParagraph (Widget w, XEvent *event, String *params, Cardinal *num_params) |
static void | TransposeCharacters (Widget w, XEvent *event, String *params, Cardinal *num_params) |
static void | NoOp (Widget w, XEvent *event, String *params, Cardinal *num_params) |
static void | Reconnect (Widget w, XEvent *event, String *params, Cardinal *num_params) |
Variables | |
static XComposeStatus | compose_status = {NULL, 0} |
XtActionsRec | _XawTextActionsTable [] |
Cardinal | _XawTextActionsTableCount = XtNumber(_XawTextActionsTable) |
#define FindDist XawTextSinkFindDistance |
#define FindPos XawTextSinkFindPosition |
#define SrcCvtSel XawTextSourceConvertSelection |
Definition at line 627 of file TextAction.c.
#define SrcScan XawTextSourceScan |
Definition at line 44 of file TextAction.c.
#define XawTextActionMaxHexChars 100 |
static void _DeleteOrKill | ( | TextWidget | ctx, | |
XawTextPosition | from, | |||
XawTextPosition | to, | |||
Boolean | kill | |||
) | [static] |
Definition at line 862 of file TextAction.c.
References _XawTextFormat(), _XawTextGetSTRING(), _XawTextReplace(), XawTextSelection::atom_count, _XawTextSelectionSalt::contents, ConvertSelection(), XawTextBlock::firstPos, XawTextBlock::format, XawTextSelection::left, XawTextBlock::length, _XawTextSelectionSalt::length, LoseSelection(), _XawTextSelectionSalt::next, NULL, XawTextBlock::ptr, XawTextSelection::right, _XawTextSelectionSalt::s, _SelectionList::selection, XawTextSelection::selections, TRUE, and XawFmtWide.
Referenced by _XawTextZapSelection(), DeleteOrKill(), and KillToEndOfLine().
00866 { 00867 XawTextBlock text; 00868 00869 if (kill && from < to) { 00870 XawTextSelectionSalt *salt; 00871 Atom selection = XInternAtom(XtDisplay(ctx), "SECONDARY", False); 00872 00873 LoseSelection ((Widget) ctx, &selection); 00874 salt = (XawTextSelectionSalt *) XtMalloc (sizeof (XawTextSelectionSalt)); 00875 if (!salt) 00876 return; 00877 salt->s.selections = (Atom *) XtMalloc (sizeof (Atom)); 00878 if (!salt->s.selections) 00879 { 00880 XtFree ((char *) salt); 00881 return; 00882 } 00883 salt->s.left = from; 00884 salt->s.right = to; 00885 salt->contents = (char *)_XawTextGetSTRING(ctx, from, to); 00886 if (_XawTextFormat(ctx) == XawFmtWide) { 00887 XTextProperty textprop; 00888 if (XwcTextListToTextProperty(XtDisplay((Widget)ctx), 00889 (wchar_t**)(&(salt->contents)), 1, XCompoundTextStyle, 00890 &textprop) < Success) { 00891 XtFree(salt->contents); 00892 salt->length = 0; 00893 return; 00894 } 00895 XtFree(salt->contents); 00896 salt->contents = (char *)textprop.value; 00897 salt->length = textprop.nitems; 00898 } else 00899 salt->length = strlen (salt->contents); 00900 salt->next = ctx->text.salt2; 00901 ctx->text.salt2 = salt; 00902 salt->s.selections[0] = selection; 00903 XtOwnSelection ((Widget) ctx, selection, ctx->text.time, 00904 ConvertSelection, LoseSelection, NULL); 00905 salt->s.atom_count = 1; 00906 /* 00907 XStoreBuffer(XtDisplay(ctx), ptr, strlen(ptr), 1); 00908 XtFree(ptr); 00909 */ 00910 } 00911 text.length = 0; 00912 text.firstPos = 0; 00913 00914 text.format = _XawTextFormat(ctx); 00915 text.ptr = ""; /* These two lines needed to make legal TextBlock */ 00916 00917 if (_XawTextReplace(ctx, from, to, &text)) { 00918 XBell(XtDisplay(ctx), 50); 00919 return; 00920 } 00921 ctx->text.insertPos = from; 00922 ctx->text.showposition = TRUE; 00923 }
Here is the call graph for this function:
Here is the caller graph for this function:
static void _SelectionReceived | ( | Widget | w, | |
XtPointer | client_data, | |||
Atom * | selection, | |||
Atom * | type, | |||
XtPointer | value, | |||
unsigned long * | length, | |||
int* | format | |||
) | [static] |
Definition at line 184 of file TextAction.c.
References _XawTextFormat(), _XawTextReplace(), _XawTextSetScrollBars(), count, _SelectionList::count, _SelectionList::CT_asked, EndAction(), XawTextBlock::firstPos, XawTextBlock::format, GetSelection(), _TextPart::insertPos, XawTextBlock::length, NULL, _SelectionList::params, ProbablyMB(), XawTextBlock::ptr, _SelectionList::selection, _TextPart::source, SrcScan, StartAction(), _TextRec::text, _SelectionList::time, TRUE, XA_COMPOUND_TEXT, XawFmt8Bit, XawFmtWide, XawsdRight, and XawstPositions.
Referenced by GetSelection().
00191 { 00192 TextWidget ctx = (TextWidget)w; 00193 XawTextBlock text; 00194 00195 if (*type == 0 /*XT_CONVERT_FAIL*/ || *length == 0) { 00196 struct _SelectionList* list = (struct _SelectionList*)client_data; 00197 if (list != NULL) { 00198 if (list->CT_asked) { 00199 00200 /* If we just asked for a XA_COMPOUND_TEXT and got a null 00201 response, we'll ask again, this time for an XA_STRING. */ 00202 00203 list->CT_asked = False; 00204 XtGetSelectionValue(w, list->selection, XA_STRING, _SelectionReceived, 00205 (XtPointer)list, list->time); 00206 } else { 00207 GetSelection(w, list->time, list->params, list->count); 00208 XtFree(client_data); 00209 } 00210 } 00211 return; 00212 } 00213 00214 /* Many programs, especially old terminal emulators, give us multibyte text 00215 but tell us it is COMPOUND_TEXT :( The following routine checks to see if the 00216 string is a legal multibyte string in our locale using a spooky heuristic :O 00217 and if it is we can only assume the sending client is using the same locale as 00218 we are, and convert it. I also warn the user that the other client is evil. */ 00219 00220 StartAction( ctx, (XEvent*) NULL ); 00221 if (_XawTextFormat(ctx) == XawFmtWide) { 00222 XTextProperty textprop; 00223 Display *d = XtDisplay((Widget)ctx); 00224 wchar_t **wlist; 00225 int count; 00226 int try_CT = 1; 00227 00228 /* IS THE SELECTION IN MULTIBYTE FORMAT? */ 00229 00230 if ( ProbablyMB( (char *) value ) ) { 00231 char * list[1]; 00232 list[0] = (char *) value; 00233 if ( XmbTextListToTextProperty( d, (char**) list, 1, 00234 XCompoundTextStyle, &textprop ) == Success ) 00235 try_CT = 0; 00236 } 00237 00238 /* OR IN COMPOUND TEXT FORMAT? */ 00239 00240 if ( try_CT ) { 00241 textprop.encoding = XA_COMPOUND_TEXT(d); 00242 textprop.value = (unsigned char *)value; 00243 textprop.nitems = strlen(value); 00244 textprop.format = 8; 00245 } 00246 00247 if ( XwcTextPropertyToTextList( d, &textprop, (wchar_t***) &wlist, &count ) 00248 != Success) { 00249 XwcFreeStringList( (wchar_t**) wlist ); 00250 00251 /* Notify the user on strerr and in the insertion :) */ 00252 textprop.value = (unsigned char *) " >> ILLEGAL SELECTION << "; 00253 count = 1; 00254 fprintf( stderr, "Xaw Text Widget: An attempt was made to insert an illegal selection.\n" ); 00255 00256 if ( XwcTextPropertyToTextList( d, &textprop, (wchar_t***) &wlist, &count ) 00257 != Success) return; 00258 } 00259 00260 XFree(value); 00261 value = (XPointer)wlist[0]; 00262 00263 *length = wcslen(wlist[0]); 00264 XtFree((XtPointer)wlist); 00265 text.format = XawFmtWide; 00266 } else 00267 text.format = XawFmt8Bit; 00268 text.ptr = (char*)value; 00269 text.firstPos = 0; 00270 text.length = *length; 00271 if (_XawTextReplace(ctx, ctx->text.insertPos, ctx->text.insertPos, &text)) { 00272 XBell(XtDisplay(ctx), 0); 00273 return; 00274 } 00275 ctx->text.insertPos = SrcScan(ctx->text.source, ctx->text.insertPos, 00276 XawstPositions, XawsdRight, text.length, TRUE); 00277 00278 _XawTextSetScrollBars(ctx); 00279 EndAction(ctx); 00280 XtFree(client_data); 00281 XFree(value); /* the selection value should be freed with XFree */ 00282 }
Here is the call graph for this function:
Here is the caller graph for this function:
void _XawTextAlterSelection | ( | ) |
void _XawTextCheckResize | ( | ) |
void _XawTextClearAndCenterDisplay | ( | ) |
void _XawTextDoReplaceAction | ( | ) |
void _XawTextDoSearchAction | ( | ) |
void _XawTextExecuteUpdate | ( | ) |
char* _XawTextGetText | ( | ) |
void _XawTextInsertFile | ( | ) |
void _XawTextInsertFileAction | ( | ) |
void _XawTextPopdownSearchAction | ( | ) |
void _XawTextPrepareToUpdate | ( | ) |
int _XawTextReplace | ( | ) |
void _XawTextSearch | ( | ) |
Atom* _XawTextSelectionList | ( | ) |
void _XawTextSetField | ( | ) |
void _XawTextSetScrollBars | ( | ) |
void _XawTextSetSelection | ( | ) |
void _XawTextVScroll | ( | ) |
void _XawTextZapSelection | ( | TextWidget | ctx, | |
XEvent* | event, | |||
Boolean | kill | |||
) |
Definition at line 1066 of file TextAction.c.
References _DeleteOrKill(), _XawTextSetScrollBars(), EndAction(), and StartAction().
Referenced by ConvertSelection(), DeleteCurrentSelection(), and KillCurrentSelection().
01070 { 01071 StartAction(ctx, event); 01072 _DeleteOrKill(ctx, ctx->text.s.left, ctx->text.s.right, kill); 01073 _XawTextSetScrollBars(ctx); 01074 EndAction(ctx); 01075 }
Here is the call graph for this function:
Here is the caller graph for this function:
static void AutoFill | ( | TextWidget | ctx | ) | [static] |
Definition at line 1495 of file TextAction.c.
References _Xaw_atowc(), _XawTextFormat(), _XawTextReplace(), XawTextBlock::firstPos, XawTextBlock::format, height, HMargins, XawTextBlock::length, Max, XawTextBlock::ptr, TRUE, width, x, XawFmt8Bit, XawFmtWide, XawLF, and XawTextSinkFindPosition().
Referenced by InsertChar().
01497 { 01498 int width, height, x, line_num, max_width; 01499 XawTextPosition ret_pos; 01500 XawTextBlock text; 01501 01502 if ( !((ctx->text.auto_fill) && (ctx->text.mult == 1)) ) 01503 return; 01504 01505 for ( line_num = 0; line_num < ctx->text.lt.lines ; line_num++) 01506 if ( ctx->text.lt.info[line_num].position >= ctx->text.insertPos ) 01507 break; 01508 line_num--; /* backup a line. */ 01509 01510 max_width = Max(0, (int)(ctx->core.width - HMargins(ctx))); 01511 01512 x = ctx->text.margin.left; 01513 XawTextSinkFindPosition( ctx->text.sink,ctx->text.lt.info[line_num].position, 01514 x, max_width, TRUE, &ret_pos, &width, &height); 01515 01516 if ( ret_pos >= ctx->text.insertPos ) 01517 return; 01518 01519 text.format = XawFmt8Bit; 01520 if (_XawTextFormat(ctx) == XawFmtWide) { 01521 text.format = XawFmtWide; 01522 text.ptr = (char *)XtMalloc(sizeof(wchar_t) * 2); 01523 ((wchar_t*)text.ptr)[0] = _Xaw_atowc(XawLF); 01524 ((wchar_t*)text.ptr)[1] = 0; 01525 } else 01526 text.ptr = "\n"; 01527 text.length = 1; 01528 text.firstPos = 0; 01529 01530 if (_XawTextReplace(ctx, ret_pos - 1, ret_pos, &text)) 01531 XBell(XtDisplay((Widget) ctx), 0); /* Unable to edit, complain. */ 01532 }
Here is the call graph for this function:
Here is the caller graph for this function:
static Boolean ConvertSelection | ( | Widget | w, | |
Atom * | selection, | |||
Atom * | target, | |||
Atom * | type, | |||
XtPointer* | value, | |||
unsigned long* | length, | |||
int* | format | |||
) | [static] |
Definition at line 630 of file TextAction.c.
References _XawTextFormat(), _XawTextGetSTRING(), _XawTextZapSelection(), args, _XawTextSelectionSalt::contents, count, L, _XawTextSelectionSalt::length, MatchSelection(), memcpy(), _XawTextSelectionSalt::next, NULL, _XawTextSelectionSalt::s, s, _TextPart::salt2, _TextPart::source, SrcCvtSel, _TextRec::text, _TextPart::time, TRUE, XA_CHARACTER_POSITION, XA_COMPOUND_TEXT, XA_DELETE, XA_LENGTH, XA_LIST_LENGTH, XA_NULL, XA_SPAN, XA_TARGETS, XA_TEXT, XawFmtWide, XawtextEdit, and XmuConvertStandardSelection().
00636 { 00637 Display* d = XtDisplay(w); 00638 TextWidget ctx = (TextWidget)w; 00639 Widget src = ctx->text.source; 00640 XawTextEditType edit_mode; 00641 Arg args[1]; 00642 XawTextSelectionSalt *salt = NULL; 00643 XawTextSelection *s; 00644 00645 if (*target == XA_TARGETS(d)) { 00646 Atom* targetP, * std_targets; 00647 unsigned long std_length; 00648 00649 if ( SrcCvtSel(src, selection, target, type, value, length, format) ) 00650 return True; 00651 00652 XmuConvertStandardSelection(w, ctx->text.time, selection, 00653 target, type, (XPointer*)&std_targets, 00654 &std_length, format); 00655 00656 *value = XtMalloc((unsigned) sizeof(Atom)*(std_length + 7)); 00657 targetP = *(Atom**)value; 00658 00659 *length = std_length + 6; 00660 *targetP++ = XA_STRING; 00661 *targetP++ = XA_TEXT(d); 00662 *targetP++ = XA_COMPOUND_TEXT(d); 00663 *targetP++ = XA_LENGTH(d); 00664 *targetP++ = XA_LIST_LENGTH(d); 00665 *targetP++ = XA_CHARACTER_POSITION(d); 00666 00667 XtSetArg(args[0], XtNeditType,&edit_mode); 00668 XtGetValues(src, args, 1); 00669 00670 if (edit_mode == XawtextEdit) { 00671 *targetP++ = XA_DELETE(d); 00672 (*length)++; 00673 } 00674 memcpy((char*)targetP, (char*)std_targets, sizeof(Atom)*std_length); 00675 XtFree((char*)std_targets); 00676 *type = XA_ATOM; 00677 *format = 32; 00678 return True; 00679 } 00680 00681 if ( SrcCvtSel(src, selection, target, type, value, length, format) ) 00682 return True; 00683 00684 for (salt = ctx->text.salt2; salt; salt = salt->next) 00685 if (MatchSelection (*selection, &salt->s)) 00686 break; 00687 if (!salt) 00688 return False; 00689 s = &salt->s; 00690 if (*target == XA_STRING || 00691 *target == XA_TEXT(d) || 00692 *target == XA_COMPOUND_TEXT(d)) { 00693 if (*target == XA_TEXT(d)) { 00694 if (_XawTextFormat(ctx) == XawFmtWide) 00695 *type = XA_COMPOUND_TEXT(d); 00696 else 00697 *type = XA_STRING; 00698 } else { 00699 *type = *target; 00700 } 00701 /* 00702 * If salt is True, the salt->contents stores CT string, 00703 * its length is measured in bytes. 00704 * Refer to _XawTextSaltAwaySelection(). 00705 * 00706 * by Li Yuhong, Mar. 20, 1991. 00707 */ 00708 if (!salt) { 00709 *value = (char *)_XawTextGetSTRING(ctx, s->left, s->right); 00710 if (_XawTextFormat(ctx) == XawFmtWide) { 00711 XTextProperty textprop; 00712 if (XwcTextListToTextProperty(d, (wchar_t**)value, 1, 00713 XCompoundTextStyle, &textprop) 00714 < Success) { 00715 XtFree(*value); 00716 return False; 00717 } 00718 XtFree(*value); 00719 *value = (XtPointer)textprop.value; 00720 *length = textprop.nitems; 00721 } else { 00722 *length = strlen(*value); 00723 } 00724 } else { 00725 *value = XtMalloc((salt->length + 1) * sizeof(unsigned char)); 00726 strcpy (*value, salt->contents); 00727 *length = salt->length; 00728 } 00729 if (_XawTextFormat(ctx) == XawFmtWide && *type == XA_STRING) { 00730 XTextProperty textprop; 00731 wchar_t** wlist; 00732 int count; 00733 textprop.encoding = XA_COMPOUND_TEXT(d); 00734 textprop.value = (unsigned char *)*value; 00735 textprop.nitems = strlen(*value); 00736 textprop.format = 8; 00737 if (XwcTextPropertyToTextList(d, &textprop, (wchar_t***)&wlist, &count) 00738 < Success) { 00739 XtFree(*value); 00740 return False; 00741 } 00742 XtFree(*value); 00743 if (XwcTextListToTextProperty(d, (wchar_t**)wlist, 1, 00744 XStringStyle, &textprop) < Success) { 00745 XwcFreeStringList( (wchar_t**) wlist ); 00746 return False; 00747 } 00748 *value = (XtPointer)textprop.value; 00749 *length = textprop.nitems; 00750 XwcFreeStringList( (wchar_t**) wlist ); 00751 } 00752 *format = 8; 00753 return True; 00754 } 00755 00756 if ( (*target == XA_LIST_LENGTH(d)) || (*target == XA_LENGTH(d)) ) { 00757 long * temp; 00758 00759 temp = (long *) XtMalloc(sizeof(long)); 00760 if (*target == XA_LIST_LENGTH(d)) 00761 *temp = 1L; 00762 else /* *target == XA_LENGTH(d) */ 00763 *temp = (long) (s->right - s->left); 00764 00765 *value = (XPointer) temp; 00766 *type = XA_INTEGER; 00767 *length = 1L; 00768 *format = 32; 00769 return True; 00770 } 00771 00772 if (*target == XA_CHARACTER_POSITION(d)) { 00773 long * temp; 00774 00775 temp = (long *) XtMalloc(2 * sizeof(long)); 00776 temp[0] = (long) (s->left + 1); 00777 temp[1] = s->right; 00778 *value = (XPointer) temp; 00779 *type = XA_SPAN(d); 00780 *length = 2L; 00781 *format = 32; 00782 return True; 00783 } 00784 00785 if (*target == XA_DELETE(d)) { 00786 void _XawTextZapSelection(); /* From TextAction.c */ 00787 00788 if (!salt) 00789 _XawTextZapSelection( ctx, (XEvent *) NULL, TRUE); 00790 *value = NULL; 00791 *type = XA_NULL(d); 00792 *length = 0; 00793 *format = 32; 00794 return True; 00795 } 00796 00797 if (XmuConvertStandardSelection(w, ctx->text.time, selection, target, type, 00798 (XPointer *)value, length, format)) 00799 return True; 00800 00801 /* else */ 00802 return False; 00803 }
Here is the call graph for this function:
static void DeleteBackwardChar | ( | Widget | w, | |
XEvent* | event, | |||
String* | p, | |||
Cardinal* | n | |||
) | [static] |
Definition at line 974 of file TextAction.c.
References DeleteOrKill(), FALSE, TRUE, XawsdLeft, and XawstPositions.
00979 { 00980 DeleteOrKill((TextWidget) w, event, XawsdLeft, XawstPositions, TRUE, FALSE); 00981 }
Here is the call graph for this function:
static void DeleteBackwardWord | ( | Widget | w, | |
XEvent* | event, | |||
String* | p, | |||
Cardinal* | n | |||
) | [static] |
Definition at line 997 of file TextAction.c.
References DeleteOrKill(), FALSE, XawsdLeft, and XawstWhiteSpace.
01002 { 01003 DeleteOrKill((TextWidget) w, event, 01004 XawsdLeft, XawstWhiteSpace, FALSE, FALSE); 01005 }
Here is the call graph for this function:
static void DeleteCurrentSelection | ( | Widget | w, | |
XEvent* | event, | |||
String* | p, | |||
Cardinal* | n | |||
) | [static] |
Definition at line 1090 of file TextAction.c.
References _XawTextZapSelection(), and FALSE.
01095 { 01096 _XawTextZapSelection( (TextWidget) w, event, FALSE); 01097 }
Here is the call graph for this function:
static void DeleteForwardChar | ( | Widget | w, | |
XEvent* | event, | |||
String* | p, | |||
Cardinal* | n | |||
) | [static] |
Definition at line 963 of file TextAction.c.
References DeleteOrKill(), FALSE, TRUE, XawsdRight, and XawstPositions.
00968 { 00969 DeleteOrKill((TextWidget) w, event, XawsdRight, XawstPositions, TRUE, FALSE); 00970 }
Here is the call graph for this function:
static void DeleteForwardWord | ( | Widget | w, | |
XEvent* | event, | |||
String* | p, | |||
Cardinal* | n | |||
) | [static] |
Definition at line 985 of file TextAction.c.
References DeleteOrKill(), FALSE, XawsdRight, and XawstWhiteSpace.
00990 { 00991 DeleteOrKill((TextWidget) w, event, 00992 XawsdRight, XawstWhiteSpace, FALSE, FALSE); 00993 }
Here is the call graph for this function:
static void DeleteOrKill | ( | TextWidget | ctx, | |
XEvent* | event, | |||
XawTextScanDirection | dir, | |||
XawTextScanType | type, | |||
Boolean | include, | |||
Boolean | kill | |||
) | [static] |
Definition at line 926 of file TextAction.c.
References _DeleteOrKill(), _XawTextSetScrollBars(), EndAction(), SrcScan, StartAction(), and XawsdLeft.
Referenced by DeleteBackwardChar(), DeleteBackwardWord(), DeleteForwardChar(), DeleteForwardWord(), KillBackwardWord(), KillForwardWord(), and KillToEndOfParagraph().
00932 { 00933 XawTextPosition from, to; 00934 00935 StartAction(ctx, event); 00936 to = SrcScan(ctx->text.source, ctx->text.insertPos, 00937 type, dir, ctx->text.mult, include); 00938 00939 /* 00940 * If no movement actually happened, then bump the count and try again. 00941 * This causes the character position at the very beginning and end of 00942 * a boundary to act correctly. 00943 */ 00944 00945 if (to == ctx->text.insertPos) 00946 to = SrcScan(ctx->text.source, ctx->text.insertPos, 00947 type, dir, ctx->text.mult + 1, include); 00948 00949 if (dir == XawsdLeft) { 00950 from = to; 00951 to = ctx->text.insertPos; 00952 } 00953 else 00954 from = ctx->text.insertPos; 00955 00956 _DeleteOrKill(ctx, from, to, kill); 00957 _XawTextSetScrollBars(ctx); 00958 EndAction(ctx); 00959 }
Here is the call graph for this function:
Here is the caller graph for this function:
static void DisplayCaret | ( | Widget | w, | |
XEvent* | event, | |||
String* | params, | |||
Cardinal* | num_params | |||
) | [static] |
Definition at line 1765 of file TextAction.c.
References _TextPart::display_caret, EndAction(), NULL, StartAction(), and _TextRec::text.
01770 { 01771 TextWidget ctx = (TextWidget)w; 01772 Boolean display_caret = True; 01773 01774 if ( ( event->type == EnterNotify || event->type == LeaveNotify ) && 01775 ( ( *num_params >= 2 ) && ( strcmp( params[1], "always" ) == 0 ) ) && 01776 ( !event->xcrossing.focus ) ) 01777 return; 01778 01779 if (*num_params > 0) { /* default arg is "True" */ 01780 XrmValue from, to; 01781 from.size = strlen(from.addr = params[0]); 01782 XtConvert( w, XtRString, &from, XtRBoolean, &to ); 01783 01784 if ( to.addr != NULL ) 01785 display_caret = *(Boolean*)to.addr; 01786 if ( ctx->text.display_caret == display_caret ) 01787 return; 01788 } 01789 StartAction(ctx, event); 01790 ctx->text.display_caret = display_caret; 01791 EndAction(ctx); 01792 }
Here is the call graph for this function:
static void EndAction | ( | TextWidget | ctx | ) | [static] |
Definition at line 144 of file TextAction.c.
References _XawTextCheckResize(), and _XawTextExecuteUpdate().
Referenced by _SelectionReceived(), _XawTextZapSelection(), DeleteOrKill(), DisplayCaret(), FormParagraph(), InsertChar(), InsertNewLineAndBackup(), InsertNewLineAndIndent(), InsertSelection(), InsertString(), KillToEndOfLine(), LocalInsertNewLine(), ModifySelection(), Move(), MoveLine(), MovePage(), RedrawDisplay(), Scroll(), SelectAll(), SelectSave(), SelectWord(), and TransposeCharacters().
00146 { 00147 _XawTextCheckResize(ctx); 00148 _XawTextExecuteUpdate(ctx); 00149 ctx->text.mult = 1; 00150 }
Here is the call graph for this function:
Here is the caller graph for this function:
static void ExtendAdjust | ( | Widget | w, | |
XEvent* | event, | |||
String* | params, | |||
Cardinal* | num_params | |||
) | [static] |
Definition at line 1357 of file TextAction.c.
References ModifySelection(), XawactionAdjust, and XawsmTextExtend.
01362 { 01363 ModifySelection((TextWidget) w, event, 01364 XawsmTextExtend, XawactionAdjust, params, num_params); 01365 }
Here is the call graph for this function:
static void ExtendEnd | ( | Widget | w, | |
XEvent* | event, | |||
String* | params, | |||
Cardinal* | num_params | |||
) | [static] |
Definition at line 1368 of file TextAction.c.
References ModifySelection(), XawactionEnd, and XawsmTextExtend.
01373 { 01374 ModifySelection((TextWidget) w, event, 01375 XawsmTextExtend, XawactionEnd, params, num_params); 01376 }
Here is the call graph for this function:
static void ExtendStart | ( | Widget | w, | |
XEvent* | event, | |||
String* | params, | |||
Cardinal* | num_params | |||
) | [static] |
Definition at line 1345 of file TextAction.c.
References ModifySelection(), XawactionStart, and XawsmTextExtend.
01350 { 01351 ModifySelection((TextWidget) w, event, 01352 XawsmTextExtend, XawactionStart, params, num_params); 01353 }
Here is the call graph for this function:
static void FormParagraph | ( | Widget | w, | |
XEvent* | event, | |||
String* | params, | |||
Cardinal* | num_params | |||
) | [static] |
Definition at line 2040 of file TextAction.c.
References _XawTextSetScrollBars(), EndAction(), FALSE, FormRegion(), _TextPart::insertPos, _TextPart::source, SrcScan, StartAction(), _TextRec::text, XawReplaceError, XawsdLeft, XawsdRight, and XawstParagraph.
02045 { 02046 TextWidget ctx = (TextWidget) w; 02047 XawTextPosition from, to; 02048 02049 StartAction(ctx, event); 02050 02051 from = SrcScan( ctx->text.source, ctx->text.insertPos, 02052 XawstParagraph, XawsdLeft, 1, FALSE ); 02053 to = SrcScan( ctx->text.source, from, 02054 XawstParagraph, XawsdRight, 1, FALSE ); 02055 02056 if ( FormRegion( ctx, from, to ) == XawReplaceError ) 02057 XBell( XtDisplay( w ), 0 ); 02058 _XawTextSetScrollBars( ctx ); 02059 EndAction( ctx ); 02060 }
Here is the call graph for this function:
static int FormRegion | ( | TextWidget | ctx, | |
XawTextPosition | from, | |||
XawTextPosition | to | |||
) | [static] |
Definition at line 2014 of file TextAction.c.
References _XawTextBuildLineTable(), InsertNewCRs(), SrcScan, StripOutOldCRs(), TRUE, XawEditDone, XawReplaceError, XawsdRight, and XawstAll.
Referenced by FormParagraph().
02017 { 02018 if ( from >= to ) return XawEditDone; 02019 02020 if ( ( to = StripOutOldCRs( ctx, from, to ) ) == XawReplaceError ) 02021 return XawReplaceError; 02022 02023 /* insure that the insertion point is within legal bounds */ 02024 if ( ctx->text.insertPos > SrcScan( ctx->text.source, 0, 02025 XawstAll, XawsdRight, 1, TRUE ) ) 02026 ctx->text.insertPos = to; 02027 02028 InsertNewCRs(ctx, from, to); 02029 _XawTextBuildLineTable(ctx, ctx->text.lt.top, TRUE); 02030 return XawEditDone; 02031 }
Here is the call graph for this function:
Here is the caller graph for this function:
static void GetSelection | ( | Widget | w, | |
Time | time, | |||
String* | params, | |||
Cardinal | num_params | |||
) | [static] |
Definition at line 285 of file TextAction.c.
References _SelectionReceived(), buffer, _SelectionList::count, _SelectionList::CT_asked, GetSelection(), line, NULL, _SelectionList::params, _SelectionList::selection, _SelectionList::time, type, and XA_COMPOUND_TEXT.
00290 { 00291 Atom selection; 00292 int buffer; 00293 00294 selection = XInternAtom(XtDisplay(w), *params, False); 00295 00296 switch (selection) { 00297 case XA_CUT_BUFFER0: buffer = 0; break; 00298 case XA_CUT_BUFFER1: buffer = 1; break; 00299 case XA_CUT_BUFFER2: buffer = 2; break; 00300 case XA_CUT_BUFFER3: buffer = 3; break; 00301 case XA_CUT_BUFFER4: buffer = 4; break; 00302 case XA_CUT_BUFFER5: buffer = 5; break; 00303 case XA_CUT_BUFFER6: buffer = 6; break; 00304 case XA_CUT_BUFFER7: buffer = 7; break; 00305 default: buffer = -1; 00306 } 00307 if (buffer >= 0) { 00308 int nbytes; 00309 unsigned long length; 00310 int fmt8 = 8; 00311 Atom type = XA_STRING; 00312 char *line = XFetchBuffer(XtDisplay(w), &nbytes, buffer); 00313 if ((length = nbytes)) 00314 _SelectionReceived(w, (XtPointer) NULL, &selection, &type, (XPointer)line, 00315 &length, &fmt8); 00316 else if (num_params > 1) 00317 GetSelection(w, time, params+1, num_params-1); 00318 } else { 00319 struct _SelectionList* list; 00320 if (--num_params) { 00321 list = XtNew(struct _SelectionList); 00322 list->params = params + 1; 00323 list->count = num_params; 00324 list->time = time; 00325 list->CT_asked = True; 00326 list->selection = selection; 00327 } else list = NULL; 00328 XtGetSelectionValue(w, selection, XA_COMPOUND_TEXT(XtDisplay(w)), 00329 _SelectionReceived, (XtPointer)list, time); 00330 } 00331 }
Here is the call graph for this function:
static void GetSelection | ( | ) | [static] |
Referenced by _SelectionReceived(), GetSelection(), and InsertSelection().
Here is the caller graph for this function:
static char* IfHexConvertHexElseReturnParam | ( | char* | param, | |
int* | len_return | |||
) | [static] |
Definition at line 1613 of file TextAction.c.
References ind, p, and XawTextActionMaxHexChars.
Referenced by InsertString().
01616 { 01617 char *p; /* steps through param char by char */ 01618 char c; /* holds the character pointed to by p */ 01619 01620 int ind; /* steps through hexval buffer char by char */ 01621 static char hexval[ XawTextActionMaxHexChars ]; 01622 Boolean first_digit; 01623 01624 /* reject if it doesn't begin with 0x and at least one more character. */ 01625 01626 if ( ( param[0] != '0' ) || ( param[1] != 'x' ) || ( param[2] == '\0' ) ) { 01627 *len_return = strlen( param ); 01628 return( param ); 01629 } 01630 01631 /* Skip the 0x; go character by character shifting and adding. */ 01632 01633 first_digit = True; 01634 ind = 0; 01635 hexval[ ind ] = '\0'; 01636 01637 for ( p = param+2; ( c = *p ); p++ ) { 01638 hexval[ ind ] *= 16; 01639 if (c >= '0' && c <= '9') 01640 hexval[ ind ] += c - '0'; 01641 else if (c >= 'a' && c <= 'f') 01642 hexval[ ind ] += c - 'a' + 10; 01643 else if (c >= 'A' && c <= 'F') 01644 hexval[ ind ] += c - 'A' + 10; 01645 else break; 01646 01647 /* If we didn't break in preceding line, it was a good hex char. */ 01648 01649 if ( first_digit ) 01650 first_digit = False; 01651 else { 01652 first_digit = True; 01653 if ( ++ind < XawTextActionMaxHexChars ) 01654 hexval[ ind ] = '\0'; 01655 else { 01656 *len_return = strlen( param ); 01657 return( param ); 01658 } 01659 } 01660 } 01661 01662 /* We quit the above loop becasue we hit a non hex. If that char is \0... */ 01663 01664 if ( ( c == '\0' ) && first_digit ) { 01665 *len_return = strlen( hexval ); 01666 return( hexval ); /* ...it was a legal hex string, so return it.*/ 01667 } 01668 01669 /* Else, there were non-hex chars or odd digit count, so... */ 01670 01671 *len_return = strlen( param ); 01672 return( param ); /* ...return the verbatim string. */ 01673 }
Here is the caller graph for this function:
static void InsertChar | ( | Widget | w, | |
XEvent* | event, | |||
String* | p, | |||
Cardinal* | n | |||
) | [static] |
Definition at line 1536 of file TextAction.c.
References _XawImWcLookupString(), _XawTextFormat(), _XawTextReplace(), _XawTextSetScrollBars(), AutoFill(), compose_status, count, EndAction(), error, XawTextBlock::firstPos, XawTextBlock::format, _TextPart::insertPos, XawTextBlock::length, memcpy(), _TextPart::mult, multiSrcObjectClass, XawTextBlock::ptr, _TextPart::source, SrcScan, StartAction(), _TextRec::text, TRUE, XawEditDone, XawFmtWide, XawsdRight, and XawstPositions.
Referenced by WriteText(), and Xputchar().
01541 { 01542 TextWidget ctx = (TextWidget) w; 01543 char *ptr, strbuf[BUFSIZ]; 01544 int count, error; 01545 KeySym keysym; 01546 XawTextBlock text; 01547 01548 if (XtIsSubclass (ctx->text.source, (WidgetClass) multiSrcObjectClass)) 01549 text.length = _XawImWcLookupString (w, &event->xkey, 01550 (wchar_t*) strbuf, BUFSIZ, &keysym, (Status*) &compose_status); 01551 else 01552 text.length = XLookupString ((XKeyEvent*)event, strbuf, BUFSIZ, &keysym, &compose_status); 01553 01554 if (text.length == 0) 01555 return; 01556 01557 text.format = _XawTextFormat( ctx ); 01558 if ( text.format == XawFmtWide ) { 01559 text.ptr = ptr = XtMalloc(sizeof(wchar_t) * text.length * ctx->text.mult ); 01560 for (count = 0; count < ctx->text.mult; count++ ) { 01561 memcpy((char*) ptr, (char *)strbuf, sizeof(wchar_t) * text.length ); 01562 ptr += sizeof(wchar_t) * text.length; 01563 } 01564 01565 } else { /* == XawFmt8Bit */ 01566 text.ptr = ptr = XtMalloc( sizeof(char) * text.length * ctx->text.mult ); 01567 for ( count = 0; count < ctx->text.mult; count++ ) { 01568 strncpy( ptr, strbuf, text.length ); 01569 ptr += text.length; 01570 } 01571 } 01572 01573 text.length = text.length * ctx->text.mult; 01574 text.firstPos = 0; 01575 01576 StartAction(ctx, event); 01577 01578 error = _XawTextReplace(ctx, ctx->text.insertPos,ctx->text.insertPos, &text); 01579 01580 if (error == XawEditDone) { 01581 ctx->text.insertPos = SrcScan(ctx->text.source, ctx->text.insertPos, 01582 XawstPositions, XawsdRight, text.length, TRUE); 01583 AutoFill(ctx); 01584 } 01585 else 01586 XBell(XtDisplay(ctx), 50); 01587 01588 XtFree(text.ptr); 01589 _XawTextSetScrollBars(ctx); 01590 EndAction(ctx); 01591 }
Here is the call graph for this function:
Here is the caller graph for this function:
static void InsertNewCRs | ( | TextWidget | ctx, | |
XawTextPosition | from, | |||
XawTextPosition | to | |||
) | [static] |
Definition at line 1944 of file TextAction.c.
References _Xaw_atowc(), _XawTextFormat(), _XawTextGetText(), _XawTextReplace(), buf, eol, XawTextBlock::firstPos, XawTextBlock::format, height, HMargins, i, int, iswspace, len, XawTextBlock::length, XawTextBlock::ptr, SrcScan, TRUE, width, XawFmt8Bit, XawFmtWide, XawLF, XawsdLeft, XawsdRight, XawstPositions, XawstWhiteSpace, and XawTextSinkFindPosition().
Referenced by FormRegion().
01947 { 01948 XawTextPosition startPos, endPos, space, eol; 01949 XawTextBlock text; 01950 int i, width, height, len; 01951 char * buf; 01952 static wchar_t wide_CR[ 2 ]; 01953 01954 text.firstPos = 0; 01955 text.length = 1; 01956 text.format = _XawTextFormat( ctx ); 01957 01958 if ( text.format == XawFmt8Bit ) 01959 text.ptr = "\n"; 01960 else { 01961 wide_CR[0] = _Xaw_atowc(XawLF); 01962 wide_CR[1] = 0; 01963 text.ptr = (char*) wide_CR; 01964 } 01965 01966 startPos = from; 01967 /* CONSTCOND */ 01968 while (TRUE) { 01969 XawTextSinkFindPosition( ctx->text.sink, startPos, 01970 (int) ctx->text.margin.left, 01971 (int) (ctx->core.width - HMargins(ctx)), 01972 TRUE, &eol, &width, &height); 01973 if (eol >= to) 01974 break; 01975 01976 eol = SrcScan(ctx->text.source, eol, XawstPositions, XawsdLeft, 1, TRUE); 01977 space= SrcScan(ctx->text.source, eol, XawstWhiteSpace,XawsdRight,1, TRUE); 01978 01979 startPos = endPos = eol; 01980 if (eol == space) 01981 return; 01982 01983 len = (int) (space - eol); 01984 buf = _XawTextGetText(ctx, eol, space); 01985 for ( i = 0 ; i < len ; i++) 01986 if (text.format == XawFmtWide) { 01987 if (!iswspace(((wchar_t*)buf)[i])) 01988 break; 01989 } else 01990 if (!isspace(buf[i])) 01991 break; 01992 01993 to -= (i - 1); 01994 endPos = SrcScan(ctx->text.source, endPos, 01995 XawstPositions, XawsdRight, i, TRUE); 01996 XtFree(buf); 01997 01998 if (_XawTextReplace(ctx, startPos, endPos, &text)) 01999 return; 02000 02001 startPos = SrcScan(ctx->text.source, startPos, 02002 XawstPositions, XawsdRight, 1, TRUE); 02003 } 02004 }
Here is the call graph for this function:
Here is the caller graph for this function:
static void InsertNewLine | ( | Widget | w, | |
XEvent* | event, | |||
String* | p, | |||
Cardinal* | n | |||
) | [static] |
Definition at line 1171 of file TextAction.c.
References LocalInsertNewLine(), and void().
01176 { 01177 (void) LocalInsertNewLine( (TextWidget) w, event); 01178 }
Here is the call graph for this function:
static void InsertNewLineAndBackup | ( | Widget | w, | |
XEvent* | event, | |||
String* | p, | |||
Cardinal* | n | |||
) | [static] |
Definition at line 1142 of file TextAction.c.
References _XawTextSetScrollBars(), EndAction(), InsertNewLineAndBackupInternal(), StartAction(), void(), and w.
01147 { 01148 StartAction( (TextWidget) w, event ); 01149 (void) InsertNewLineAndBackupInternal( (TextWidget) w ); 01150 _XawTextSetScrollBars( (TextWidget) w); 01151 EndAction( (TextWidget) w ); 01152 }
Here is the call graph for this function:
static int InsertNewLineAndBackupInternal | ( | TextWidget | ctx | ) | [static] |
Definition at line 1106 of file TextAction.c.
References _Xaw_atowc(), _XawTextFormat(), _XawTextReplace(), count, error, XawTextBlock::firstPos, XawTextBlock::format, XawTextBlock::length, XawTextBlock::ptr, XawEditDone, XawEditError, XawFmtWide, and XawLF.
Referenced by InsertNewLineAndBackup(), and LocalInsertNewLine().
01108 { 01109 int count, error = XawEditDone; 01110 XawTextBlock text; 01111 01112 text.format = _XawTextFormat(ctx); 01113 text.length = ctx->text.mult; 01114 text.firstPos = 0; 01115 01116 if ( text.format == XawFmtWide ) { 01117 wchar_t* wptr; 01118 text.ptr = XtMalloc(sizeof(wchar_t) * ctx->text.mult); 01119 wptr = (wchar_t *)text.ptr; 01120 for (count = 0; count < ctx->text.mult; count++ ) 01121 wptr[count] = _Xaw_atowc(XawLF); 01122 } 01123 else { 01124 text.ptr = XtMalloc(sizeof(char) * ctx->text.mult); 01125 for (count = 0; count < ctx->text.mult; count++ ) 01126 text.ptr[count] = XawLF; 01127 } 01128 01129 if (_XawTextReplace(ctx, ctx->text.insertPos, ctx->text.insertPos, &text)) { 01130 XBell( XtDisplay(ctx), 50); 01131 error = XawEditError; 01132 } 01133 else 01134 ctx->text.showposition = TRUE; 01135 01136 XtFree( text.ptr ); 01137 return( error ); 01138 }
Here is the call graph for this function:
Here is the caller graph for this function:
static void InsertNewLineAndIndent | ( | Widget | w, | |
XEvent * | event, | |||
String * | p, | |||
Cardinal * | n | |||
) | [static] |
Definition at line 1182 of file TextAction.c.
References _Xaw_atowc(), _XawTextFormat(), _XawTextGetText(), _XawTextReplace(), _XawTextSetScrollBars(), EndAction(), FALSE, XawTextBlock::firstPos, XawTextBlock::format, _TextPart::insertPos, iswspace, XawTextBlock::length, XawTextBlock::ptr, _TextPart::source, SrcScan, StartAction(), _TextRec::text, TRUE, XawFmtWide, XawLF, XawsdLeft, XawsdRight, XawstEOL, XawstPositions, and XawTAB.
01187 { 01188 XawTextBlock text; 01189 XawTextPosition pos1; 01190 int length; 01191 TextWidget ctx = (TextWidget) w; 01192 String line_to_ip; 01193 01194 StartAction(ctx, event); 01195 pos1 = SrcScan(ctx->text.source, ctx->text.insertPos, 01196 XawstEOL, XawsdLeft, 1, FALSE); 01197 01198 line_to_ip = _XawTextGetText(ctx, pos1, ctx->text.insertPos); 01199 01200 text.format = _XawTextFormat(ctx); 01201 text.firstPos = 0; 01202 01203 if ( text.format == XawFmtWide ) { 01204 wchar_t* ptr; 01205 text.ptr = XtMalloc( ( 2 + wcslen((wchar_t*)line_to_ip) ) * sizeof(wchar_t) ); 01206 01207 ptr = (wchar_t*)text.ptr; 01208 ptr[0] = _Xaw_atowc( XawLF ); 01209 wcscpy( (wchar_t*) ++ptr, (wchar_t*) line_to_ip ); 01210 01211 length = wcslen((wchar_t*)text.ptr); 01212 while ( length && ( iswspace(*ptr) || ( *ptr == _Xaw_atowc(XawTAB) ) ) ) 01213 ptr++, length--; 01214 *ptr = (wchar_t)0; 01215 text.length = wcslen((wchar_t*)text.ptr); 01216 01217 } else { 01218 char *ptr; 01219 length = strlen(line_to_ip); 01220 /* The current line + \0 and LF will be copied to this 01221 buffer. Before my fix, only length + 1 bytes were 01222 allocated, causing on machine with non-wasteful 01223 malloc implementation segmentation violations by 01224 overwriting the bypte after the allocated area 01225 01226 -gustaf neumann 01227 */ 01228 text.ptr = XtMalloc( ( 2 + length ) * sizeof( char ) ); 01229 01230 ptr = text.ptr; 01231 ptr[0] = XawLF; 01232 strcpy( ++ptr, line_to_ip ); 01233 01234 length++; 01235 while ( length && ( isspace(*ptr) || ( *ptr == XawTAB ) ) ) 01236 ptr++, length--; 01237 *ptr = '\0'; 01238 text.length = strlen(text.ptr); 01239 } 01240 XtFree( line_to_ip ); 01241 01242 if (_XawTextReplace(ctx,ctx->text.insertPos, ctx->text.insertPos, &text)) { 01243 XBell(XtDisplay(ctx), 50); 01244 XtFree(text.ptr); 01245 EndAction(ctx); 01246 return; 01247 } 01248 XtFree(text.ptr); 01249 ctx->text.insertPos = SrcScan(ctx->text.source, ctx->text.insertPos, 01250 XawstPositions, XawsdRight, text.length, TRUE); 01251 _XawTextSetScrollBars(ctx); 01252 EndAction(ctx); 01253 }
Here is the call graph for this function:
static void InsertSelection | ( | Widget | w, | |
XEvent* | event, | |||
String* | params, | |||
Cardinal* | num_params | |||
) | [static] |
Definition at line 334 of file TextAction.c.
References EndAction(), GetSelection(), StartAction(), and w.
00339 { 00340 StartAction((TextWidget)w, event); /* Get Time. */ 00341 GetSelection(w, ((TextWidget)w)->text.time, params, *num_params); 00342 EndAction((TextWidget)w); 00343 }
Here is the call graph for this function:
static void InsertString | ( | Widget | w, | |
XEvent* | event, | |||
String* | params, | |||
Cardinal* | num_params | |||
) | [static] |
Definition at line 1689 of file TextAction.c.
References _XawTextFormat(), _XawTextMBToWC(), _XawTextReplace(), _XawTextWCToMB(), app_con, EndAction(), XawTextBlock::firstPos, XawTextBlock::format, i, IfHexConvertHexElseReturnParam(), _TextPart::insertPos, XawTextBlock::length, NULL, ParameterError(), XawTextBlock::ptr, _TextPart::source, SrcScan, StartAction(), _TextRec::text, TRUE, XawFmtWide, XawsdRight, and XawstPositions.
01694 { 01695 TextWidget ctx = (TextWidget) w; 01696 XtAppContext app_con = XtWidgetToApplicationContext(w); 01697 XawTextBlock text; 01698 int i; 01699 01700 text.firstPos = 0; 01701 text.format = _XawTextFormat( ctx ); 01702 01703 StartAction(ctx, event); 01704 for ( i = *num_params; i; i--, params++ ) { /* DO FOR EACH PARAMETER */ 01705 01706 text.ptr = IfHexConvertHexElseReturnParam( *params, &text.length ); 01707 01708 if ( text.length == 0 ) continue; 01709 01710 if ( _XawTextFormat( ctx ) == XawFmtWide ) { /* convert to WC */ 01711 01712 int temp_len; 01713 text.ptr = (char*) _XawTextMBToWC( XtDisplay(w), text.ptr, 01714 &text.length ); 01715 01716 if ( text.ptr == NULL ) { /* conversion error */ 01717 XtAppWarningMsg( app_con, 01718 "insertString", "textAction", "XawError", 01719 "insert-string()'s parameter contents not legal in this locale.", 01720 NULL, NULL ); 01721 ParameterError( w, *params ); 01722 continue; 01723 } 01724 01725 /* Double check that the new input is legal: try to convert to MB. */ 01726 01727 temp_len = text.length; /* _XawTextWCToMB's 3rd arg is in_out */ 01728 if ( _XawTextWCToMB( XtDisplay(w), (wchar_t*)text.ptr, &temp_len ) == NULL ) { 01729 XtAppWarningMsg( app_con, 01730 "insertString", "textAction", "XawError", 01731 "insert-string()'s parameter contents not legal in this locale.", 01732 NULL, NULL ); 01733 ParameterError( w, *params ); 01734 continue; 01735 } 01736 } /* convert to WC */ 01737 01738 if ( _XawTextReplace( ctx, ctx->text.insertPos, 01739 ctx->text.insertPos, &text ) ) { 01740 XBell( XtDisplay( ctx ), 50 ); 01741 EndAction( ctx ); 01742 return; 01743 } 01744 01745 /* Advance insertPos to the end of the string we just inserted. */ 01746 ctx->text.insertPos = SrcScan( ctx->text.source, ctx->text.insertPos, 01747 XawstPositions, XawsdRight, text.length, TRUE ); 01748 01749 } /* DO FOR EACH PARAMETER */ 01750 01751 EndAction( ctx ); 01752 }
Here is the call graph for this function:
static void KillBackwardWord | ( | Widget | w, | |
XEvent* | event, | |||
String* | p, | |||
Cardinal* | n | |||
) | [static] |
Definition at line 1021 of file TextAction.c.
References DeleteOrKill(), FALSE, TRUE, XawsdLeft, and XawstWhiteSpace.
01026 { 01027 DeleteOrKill((TextWidget) w, event, 01028 XawsdLeft, XawstWhiteSpace, FALSE, TRUE); 01029 }
Here is the call graph for this function:
static void KillCurrentSelection | ( | Widget | w, | |
XEvent* | event, | |||
String* | p, | |||
Cardinal* | n | |||
) | [static] |
Definition at line 1079 of file TextAction.c.
References _XawTextZapSelection(), and TRUE.
01084 { 01085 _XawTextZapSelection( (TextWidget) w, event, TRUE); 01086 }
Here is the call graph for this function:
static void KillForwardWord | ( | Widget | w, | |
XEvent* | event, | |||
String* | p, | |||
Cardinal* | n | |||
) | [static] |
Definition at line 1009 of file TextAction.c.
References DeleteOrKill(), FALSE, TRUE, XawsdRight, and XawstWhiteSpace.
01014 { 01015 DeleteOrKill((TextWidget) w, event, 01016 XawsdRight, XawstWhiteSpace, FALSE, TRUE); 01017 }
Here is the call graph for this function:
static void KillToEndOfLine | ( | Widget | w, | |
XEvent* | event, | |||
String* | p, | |||
Cardinal* | n | |||
) | [static] |
Definition at line 1033 of file TextAction.c.
References _DeleteOrKill(), _XawTextSetScrollBars(), EndAction(), FALSE, _TextPart::insertPos, _TextPart::mult, _TextPart::source, SrcScan, StartAction(), _TextRec::text, TRUE, XawsdRight, and XawstEOL.
01038 { 01039 TextWidget ctx = (TextWidget) w; 01040 XawTextPosition end_of_line; 01041 01042 StartAction(ctx, event); 01043 end_of_line = SrcScan(ctx->text.source, ctx->text.insertPos, XawstEOL, 01044 XawsdRight, ctx->text.mult, FALSE); 01045 if (end_of_line == ctx->text.insertPos) 01046 end_of_line = SrcScan(ctx->text.source, ctx->text.insertPos, XawstEOL, 01047 XawsdRight, ctx->text.mult, TRUE); 01048 01049 _DeleteOrKill(ctx, ctx->text.insertPos, end_of_line, TRUE); 01050 _XawTextSetScrollBars(ctx); 01051 EndAction(ctx); 01052 }
Here is the call graph for this function:
static void KillToEndOfParagraph | ( | Widget | w, | |
XEvent* | event, | |||
String* | p, | |||
Cardinal* | n | |||
) | [static] |
Definition at line 1056 of file TextAction.c.
References DeleteOrKill(), FALSE, TRUE, XawsdRight, and XawstParagraph.
01061 { 01062 DeleteOrKill((TextWidget) w, event, XawsdRight, XawstParagraph, FALSE, TRUE); 01063 }
Here is the call graph for this function:
static int LocalInsertNewLine | ( | TextWidget | ctx, | |
XEvent* | event | |||
) | [static] |
Definition at line 1155 of file TextAction.c.
References _XawTextSetScrollBars(), EndAction(), InsertNewLineAndBackupInternal(), SrcScan, StartAction(), TRUE, XawEditDone, XawEditError, XawsdRight, and XawstPositions.
Referenced by InsertNewLine().
01158 { 01159 StartAction(ctx, event); 01160 if (InsertNewLineAndBackupInternal(ctx) == XawEditError) 01161 return(XawEditError); 01162 ctx->text.insertPos = SrcScan(ctx->text.source, ctx->text.insertPos, 01163 XawstPositions, XawsdRight, ctx->text.mult, TRUE); 01164 _XawTextSetScrollBars(ctx); 01165 EndAction(ctx); 01166 return(XawEditDone); 01167 }
Here is the call graph for this function:
Here is the caller graph for this function:
static void LoseSelection | ( | Widget | w, | |
Atom* | selection | |||
) | [static] |
Definition at line 806 of file TextAction.c.
References XawTextSelection::atom_count, _XawTextSelectionSalt::contents, i, _XawTextSelectionSalt::next, _XawTextSelectionSalt::s, _TextPart::salt2, XawTextSelection::selections, and _TextRec::text.
00809 { 00810 TextWidget ctx = (TextWidget) w; 00811 Atom* atomP; 00812 int i; 00813 XawTextSelectionSalt *salt, *prevSalt, *nextSalt; 00814 00815 prevSalt = 0; 00816 for (salt = ctx->text.salt2; salt; salt = nextSalt) 00817 { 00818 atomP = salt->s.selections; 00819 nextSalt = salt->next; 00820 for (i = 0 ; i < salt->s.atom_count; i++, atomP++) 00821 if (*selection == *atomP) 00822 *atomP = (Atom)0; 00823 00824 while (salt->s.atom_count && 00825 salt->s.selections[salt->s.atom_count-1] == 0) 00826 { 00827 salt->s.atom_count--; 00828 } 00829 00830 /* 00831 * Must walk the selection list in opposite order from UnsetSelection. 00832 */ 00833 00834 atomP = salt->s.selections; 00835 for (i = 0 ; i < salt->s.atom_count; i++, atomP++) 00836 if (*atomP == (Atom)0) 00837 { 00838 *atomP = salt->s.selections[--salt->s.atom_count]; 00839 while (salt->s.atom_count && 00840 salt->s.selections[salt->s.atom_count-1] == 0) 00841 salt->s.atom_count--; 00842 } 00843 if (salt->s.atom_count == 0) 00844 { 00845 XtFree ((char *) salt->s.selections); 00846 00847 /* WARNING: the next line frees memory not allocated in Xaw. */ 00848 /* Could be a serious bug. Someone look into it. */ 00849 XtFree (salt->contents); 00850 if (prevSalt) 00851 prevSalt->next = nextSalt; 00852 else 00853 ctx->text.salt2 = nextSalt; 00854 XtFree ((char *) salt); 00855 } 00856 else 00857 prevSalt = salt; 00858 } 00859 }
static Boolean MatchSelection | ( | Atom | selection, | |
XawTextSelection* | s | |||
) | [static] |
Definition at line 614 of file TextAction.c.
References count, match(), and s.
00617 { 00618 Atom *match; 00619 int count; 00620 00621 for (count = 0, match = s->selections; count < s->atom_count; match++, count++) 00622 if (*match == selection) 00623 return True; 00624 return False; 00625 }
Here is the call graph for this function:
static void ModifySelection | ( | TextWidget | ctx, | |
XEvent* | event, | |||
XawTextSelectionMode | mode, | |||
XawTextSelectionAction | action, | |||
String* | params, | |||
Cardinal* | num_params | |||
) | [static] |
Definition at line 1294 of file TextAction.c.
References _XawTextAlterSelection(), EndAction(), NotePosition(), and StartAction().
01301 { 01302 StartAction(ctx, event); 01303 NotePosition(ctx, event); 01304 _XawTextAlterSelection(ctx, mode, action, params, num_params); 01305 EndAction(ctx); 01306 }
Here is the call graph for this function:
static void Move | ( | TextWidget | ctx, | |
XEvent* | event, | |||
XawTextScanDirection | dir, | |||
XawTextScanType | type, | |||
Boolean | include | |||
) | [static] |
Definition at line 352 of file TextAction.c.
References EndAction(), SrcScan, and StartAction().
Referenced by MoveBackwardChar(), MoveBackwardParagraph(), MoveBackwardWord(), MoveBeginningOfFile(), MoveEndOfFile(), MoveForwardChar(), MoveForwardParagraph(), MoveForwardWord(), MoveToLineEnd(), and MoveToLineStart().
00358 { 00359 StartAction(ctx, event); 00360 ctx->text.insertPos = SrcScan(ctx->text.source, ctx->text.insertPos, 00361 type, dir, ctx->text.mult, include); 00362 EndAction(ctx); 00363 }
Here is the call graph for this function:
Here is the caller graph for this function:
static void MoveBackwardChar | ( | Widget | w, | |
XEvent* | event, | |||
String* | p, | |||
Cardinal* | n | |||
) | [static] |
Definition at line 378 of file TextAction.c.
References Move(), TRUE, XawsdLeft, and XawstPositions.
00383 { 00384 Move((TextWidget) w, event, XawsdLeft, XawstPositions, TRUE); 00385 }
Here is the call graph for this function:
static void MoveBackwardParagraph | ( | Widget | w, | |
XEvent* | event, | |||
String* | p, | |||
Cardinal* | n | |||
) | [static] |
Definition at line 420 of file TextAction.c.
References FALSE, Move(), XawsdLeft, and XawstParagraph.
00425 { 00426 Move((TextWidget) w, event, XawsdLeft, XawstParagraph, FALSE); 00427 }
Here is the call graph for this function:
static void MoveBackwardWord | ( | Widget | w, | |
XEvent* | event, | |||
String* | p, | |||
Cardinal* | n | |||
) | [static] |
Definition at line 400 of file TextAction.c.
References FALSE, Move(), XawsdLeft, and XawstWhiteSpace.
00405 { 00406 Move((TextWidget) w, event, XawsdLeft, XawstWhiteSpace, FALSE); 00407 }
Here is the call graph for this function:
static void MoveBeginningOfFile | ( | Widget | w, | |
XEvent* | event, | |||
String* | p, | |||
Cardinal* | n | |||
) | [static] |
static void MoveEndOfFile | ( | Widget | w, | |
XEvent* | event, | |||
String* | p, | |||
Cardinal* | n | |||
) | [static] |
Definition at line 521 of file TextAction.c.
References Move(), TRUE, XawsdRight, and XawstAll.
00526 { 00527 Move((TextWidget) w, event, XawsdRight, XawstAll, TRUE); 00528 }
Here is the call graph for this function:
static void MoveForwardChar | ( | Widget | w, | |
XEvent* | event, | |||
String* | p, | |||
Cardinal* | n | |||
) | [static] |
Definition at line 367 of file TextAction.c.
References Move(), TRUE, XawsdRight, and XawstPositions.
00372 { 00373 Move((TextWidget) w, event, XawsdRight, XawstPositions, TRUE); 00374 }
Here is the call graph for this function:
static void MoveForwardParagraph | ( | Widget | w, | |
XEvent* | event, | |||
String* | p, | |||
Cardinal* | n | |||
) | [static] |
Definition at line 410 of file TextAction.c.
References FALSE, Move(), XawsdRight, and XawstParagraph.
00415 { 00416 Move((TextWidget) w, event, XawsdRight, XawstParagraph, FALSE); 00417 }
Here is the call graph for this function:
static void MoveForwardWord | ( | Widget | w, | |
XEvent* | event, | |||
String* | p, | |||
Cardinal* | n | |||
) | [static] |
Definition at line 389 of file TextAction.c.
References FALSE, Move(), XawsdRight, and XawstWhiteSpace.
00394 { 00395 Move((TextWidget) w, event, XawsdRight, XawstWhiteSpace, FALSE); 00396 }
Here is the call graph for this function:
static void MoveLine | ( | TextWidget | ctx, | |
XEvent* | event, | |||
XawTextScanDirection | dir | |||
) | [static] |
Definition at line 453 of file TextAction.c.
References EndAction(), FALSE, FindDist, FindPos, SrcScan, StartAction(), XawsdLeft, XawsdRight, and XawstEOL.
Referenced by MoveNextLine(), and MovePreviousLine().
00457 { 00458 XawTextPosition new, next_line, junk; 00459 int from_left, garbage; 00460 00461 StartAction(ctx, event); 00462 00463 if (dir == XawsdLeft) 00464 ctx->text.mult++; 00465 00466 new = SrcScan(ctx->text.source, ctx->text.insertPos, 00467 XawstEOL, XawsdLeft, 1, FALSE); 00468 00469 FindDist(ctx->text.sink, new, ctx->text.margin.left, ctx->text.insertPos, 00470 &from_left, &junk, &garbage); 00471 00472 new = SrcScan(ctx->text.source, ctx->text.insertPos, XawstEOL, dir, 00473 ctx->text.mult, (dir == XawsdRight)); 00474 00475 next_line = SrcScan(ctx->text.source, new, XawstEOL, XawsdRight, 1, FALSE); 00476 00477 FindPos(ctx->text.sink, new, ctx->text.margin.left, from_left, FALSE, 00478 &(ctx->text.insertPos), &garbage, &garbage); 00479 00480 if (ctx->text.insertPos > next_line) 00481 ctx->text.insertPos = next_line; 00482 00483 EndAction(ctx); 00484 }
Here is the call graph for this function:
Here is the caller graph for this function:
static void MoveNextLine | ( | Widget | w, | |
XEvent* | event, | |||
String* | p, | |||
Cardinal* | n | |||
) | [static] |
Definition at line 488 of file TextAction.c.
References MoveLine(), and XawsdRight.
00493 { 00494 MoveLine( (TextWidget) w, event, XawsdRight); 00495 }
Here is the call graph for this function:
static void MoveNextPage | ( | Widget | w, | |
XEvent* | event, | |||
String* | p, | |||
Cardinal* | n | |||
) | [static] |
Definition at line 587 of file TextAction.c.
References MovePage(), and XawsdRight.
00592 { 00593 MovePage((TextWidget) w, event, XawsdRight); 00594 }
Here is the call graph for this function:
static void MovePage | ( | TextWidget | ctx, | |
XEvent* | event, | |||
XawTextScanDirection | dir | |||
) | [static] |
Definition at line 569 of file TextAction.c.
References _XawTextVScroll(), EndAction(), Max, StartAction(), and XawsdLeft.
Referenced by MoveNextPage(), and MovePreviousPage().
00573 { 00574 int scroll_val = Max(1, ctx->text.lt.lines - 2); 00575 00576 if (dir == XawsdLeft) 00577 scroll_val = -scroll_val; 00578 00579 StartAction(ctx, event); 00580 _XawTextVScroll(ctx, scroll_val); 00581 ctx->text.insertPos = ctx->text.lt.top; 00582 EndAction(ctx); 00583 }
Here is the call graph for this function:
Here is the caller graph for this function:
static void MovePreviousLine | ( | Widget | w, | |
XEvent* | event, | |||
String* | p, | |||
Cardinal* | n | |||
) | [static] |
Definition at line 499 of file TextAction.c.
References MoveLine(), and XawsdLeft.
00504 { 00505 MoveLine( (TextWidget) w, event, XawsdLeft); 00506 }
Here is the call graph for this function:
static void MovePreviousPage | ( | Widget | w, | |
XEvent* | event, | |||
String* | p, | |||
Cardinal* | n | |||
) | [static] |
Definition at line 598 of file TextAction.c.
References MovePage(), and XawsdLeft.
00603 { 00604 MovePage((TextWidget) w, event, XawsdLeft); 00605 }
Here is the call graph for this function:
static void MoveToLineEnd | ( | Widget | w, | |
XEvent* | event, | |||
String* | p, | |||
Cardinal* | n | |||
) | [static] |
Definition at line 431 of file TextAction.c.
References FALSE, Move(), XawsdRight, and XawstEOL.
00436 { 00437 Move((TextWidget) w, event, XawsdRight, XawstEOL, FALSE); 00438 }
Here is the call graph for this function:
static void MoveToLineStart | ( | Widget | w, | |
XEvent* | event, | |||
String* | p, | |||
Cardinal* | n | |||
) | [static] |
static void Multiply | ( | Widget | w, | |
XEvent* | event, | |||
String* | params, | |||
Cardinal* | num_params | |||
) | [static] |
Definition at line 1807 of file TextAction.c.
References buf, _TextPart::mult, and _TextRec::text.
01812 { 01813 TextWidget ctx = (TextWidget) w; 01814 int mult; 01815 01816 if (*num_params != 1) { 01817 XtAppError( XtWidgetToApplicationContext( w ), 01818 "Xaw Text Widget: multiply() takes exactly one argument."); 01819 XBell( XtDisplay( w ), 0 ); 01820 return; 01821 } 01822 01823 if ( ( params[0][0] == 'r' ) || ( params[0][0] == 'R' ) ) { 01824 XBell( XtDisplay( w ), 0 ); 01825 ctx->text.mult = 1; 01826 return; 01827 } 01828 01829 if ( ( mult = atoi( params[0] ) ) == 0 ) { 01830 char buf[ BUFSIZ ]; 01831 sprintf(buf, "%s %s", "Xaw Text Widget: multiply() argument", 01832 "must be a number greater than zero, or 'Reset'." ); 01833 XtAppError( XtWidgetToApplicationContext( w ), buf ); 01834 XBell( XtDisplay( w ), 50 ); 01835 return; 01836 } 01837 01838 ctx->text.mult *= mult; 01839 }
static void NoOp | ( | Widget | w, | |
XEvent* | event, | |||
String* | params, | |||
Cardinal* | num_params | |||
) | [static] |
Definition at line 2149 of file TextAction.c.
02154 { 02155 if (*num_params != 1) 02156 return; 02157 02158 switch(params[0][0]) { 02159 case 'R': 02160 case 'r': 02161 XBell(XtDisplay(w), 0); 02162 default: /* Fall Through */ 02163 break; 02164 } 02165 }
static void NotePosition | ( | TextWidget | ctx, | |
XEvent* | event | |||
) | [static] |
Definition at line 113 of file TextAction.c.
References XawTextSinkGetCursorBounds().
Referenced by ModifySelection().
00116 { 00117 switch (event->type) { 00118 case ButtonPress: 00119 case ButtonRelease: 00120 ctx->text.ev_x = event->xbutton.x; 00121 ctx->text.ev_y = event->xbutton.y; 00122 break; 00123 case KeyPress: 00124 case KeyRelease: 00125 { 00126 XRectangle cursor; 00127 XawTextSinkGetCursorBounds(ctx->text.sink, &cursor); 00128 ctx->text.ev_x = cursor.x + cursor.width / 2;; 00129 ctx->text.ev_y = cursor.y + cursor.height / 2;; 00130 } 00131 break; 00132 case MotionNotify: 00133 ctx->text.ev_x = event->xmotion.x; 00134 ctx->text.ev_y = event->xmotion.y; 00135 break; 00136 case EnterNotify: 00137 case LeaveNotify: 00138 ctx->text.ev_x = event->xcrossing.x; 00139 ctx->text.ev_y = event->xcrossing.y; 00140 } 00141 }
Here is the call graph for this function:
Here is the caller graph for this function:
static void ParameterError | ( | Widget | w, | |
String | param | |||
) | [static] |
Definition at line 70 of file TextAction.c.
Referenced by InsertString().
00073 { 00074 String params[2]; 00075 Cardinal num_params = 2; 00076 params[0] = XtName(w); 00077 params[1] = param; 00078 00079 XtAppWarningMsg( XtWidgetToApplicationContext(w), 00080 "parameterError", "textAction", "XawError", 00081 "Widget: %s Parameter: %s", 00082 params, &num_params); 00083 XBell( XtDisplay( w ), 50 ); 00084 }
Here is the caller graph for this function:
static int ProbablyMB | ( | char* | s | ) | [static] |
Definition at line 161 of file TextAction.c.
References escapes.
Referenced by _SelectionReceived().
00163 { 00164 int escapes = 0; 00165 int has_hi_bit = False; 00166 00167 /* if it has more than one ESC char, I assume it is COMPOUND_TEXT. 00168 If it has at least one hi bit set character, I pretend it is multibyte. */ 00169 00170 while ( (wchar_t)(*s) != (wchar_t)0 ) { 00171 if ( *s & 128 ) 00172 has_hi_bit = True; 00173 if ( *s++ == '\033' ) 00174 escapes++; 00175 if ( escapes >= 2 ) 00176 return( 0 ); 00177 } 00178 return( has_hi_bit ); 00179 }
Here is the caller graph for this function:
static void Reconnect | ( | Widget | w, | |
XEvent* | event, | |||
String* | params, | |||
Cardinal* | num_params | |||
) | [static] |
Definition at line 2175 of file TextAction.c.
References _XawImReconnect().
Referenced by _XawImReconnect().
02180 { 02181 _XawImReconnect( w ); 02182 }
Here is the call graph for this function:
Here is the caller graph for this function:
static void RedrawDisplay | ( | Widget | w, | |
XEvent* | event, | |||
String* | p, | |||
Cardinal* | n | |||
) | [static] |
Definition at line 1409 of file TextAction.c.
References _XawTextClearAndCenterDisplay(), EndAction(), StartAction(), and w.
01414 { 01415 StartAction( (TextWidget) w, event); 01416 _XawTextClearAndCenterDisplay((TextWidget) w); 01417 EndAction( (TextWidget) w); 01418 }
Here is the call graph for this function:
static void Scroll | ( | TextWidget | ctx, | |
XEvent* | event, | |||
XawTextScanDirection | dir | |||
) | [static] |
Definition at line 531 of file TextAction.c.
References _XawTextVScroll(), EndAction(), StartAction(), and XawsdLeft.
Referenced by Index(), ScrollOneLineDown(), and ScrollOneLineUp().
00535 { 00536 StartAction(ctx, event); 00537 00538 if (dir == XawsdLeft) 00539 _XawTextVScroll(ctx, ctx->text.mult); 00540 else 00541 _XawTextVScroll(ctx, -ctx->text.mult); 00542 00543 EndAction(ctx); 00544 }
Here is the call graph for this function:
Here is the caller graph for this function:
static void ScrollOneLineDown | ( | Widget | w, | |
XEvent* | event, | |||
String* | p, | |||
Cardinal* | n | |||
) | [static] |
Definition at line 559 of file TextAction.c.
References Scroll(), and XawsdRight.
00564 { 00565 Scroll( (TextWidget) w, event, XawsdRight); 00566 }
Here is the call graph for this function:
static void ScrollOneLineUp | ( | Widget | w, | |
XEvent* | event, | |||
String* | p, | |||
Cardinal* | n | |||
) | [static] |
Definition at line 548 of file TextAction.c.
References Scroll(), and XawsdLeft.
00553 { 00554 Scroll( (TextWidget) w, event, XawsdLeft); 00555 }
Here is the call graph for this function:
static void SelectAdjust | ( | Widget | w, | |
XEvent* | event, | |||
String* | params, | |||
Cardinal* | num_params | |||
) | [static] |
Definition at line 1322 of file TextAction.c.
References ModifySelection(), XawactionAdjust, and XawsmTextSelect.
01327 { 01328 ModifySelection((TextWidget) w, event, 01329 XawsmTextSelect, XawactionAdjust, params, num_params); 01330 }
Here is the call graph for this function:
static void SelectAll | ( | Widget | w, | |
XEvent* | event, | |||
String* | params, | |||
Cardinal* | num_params | |||
) | [static] |
Definition at line 1280 of file TextAction.c.
References _XawTextSetSelection(), EndAction(), StartAction(), and zeroPosition.
01285 { 01286 TextWidget ctx = (TextWidget) w; 01287 01288 StartAction(ctx, event); 01289 _XawTextSetSelection(ctx,zeroPosition,ctx->text.lastPos,params,*num_params); 01290 EndAction(ctx); 01291 }
Here is the call graph for this function:
static void SelectEnd | ( | Widget | w, | |
XEvent* | event, | |||
String* | params, | |||
Cardinal* | num_params | |||
) | [static] |
Definition at line 1333 of file TextAction.c.
References ModifySelection(), XawactionEnd, and XawsmTextSelect.
01338 { 01339 ModifySelection((TextWidget) w, event, 01340 XawsmTextSelect, XawactionEnd, params, num_params); 01341 }
Here is the call graph for this function:
static void SelectSave | ( | Widget | w, | |
XEvent* | event, | |||
String* | params, | |||
Cardinal* | num_params | |||
) | [static] |
Definition at line 1379 of file TextAction.c.
References _XawTextSaltAwaySelection(), dpy, EndAction(), StartAction(), and w.
01384 { 01385 int num_atoms; 01386 Atom* sel; 01387 Display* dpy = XtDisplay(w); 01388 Atom selections[256]; 01389 01390 StartAction( (TextWidget) w, event ); 01391 num_atoms = *num_params; 01392 if (num_atoms > 256) 01393 num_atoms = 256; 01394 for (sel=selections; --num_atoms >= 0; sel++, params++) 01395 *sel = XInternAtom(dpy, *params, False); 01396 num_atoms = *num_params; 01397 _XawTextSaltAwaySelection( (TextWidget) w, selections, num_atoms ); 01398 EndAction( (TextWidget) w ); 01399 }
Here is the call graph for this function:
static void SelectStart | ( | Widget | w, | |
XEvent* | event, | |||
String* | params, | |||
Cardinal* | num_params | |||
) | [static] |
Definition at line 1310 of file TextAction.c.
References ModifySelection(), XawactionStart, and XawsmTextSelect.
01315 { 01316 ModifySelection((TextWidget) w, event, 01317 XawsmTextSelect, XawactionStart, params, num_params); 01318 }
Here is the call graph for this function:
static void SelectWord | ( | Widget | w, | |
XEvent* | event, | |||
String* | params, | |||
Cardinal* | num_params | |||
) | [static] |
Definition at line 1262 of file TextAction.c.
References _XawTextSetSelection(), EndAction(), FALSE, _TextPart::insertPos, l, _TextPart::source, SrcScan, StartAction(), _TextRec::text, XawsdLeft, XawsdRight, and XawstWhiteSpace.
01267 { 01268 TextWidget ctx = (TextWidget) w; 01269 XawTextPosition l, r; 01270 01271 StartAction(ctx, event); 01272 l = SrcScan(ctx->text.source, ctx->text.insertPos, 01273 XawstWhiteSpace, XawsdLeft, 1, FALSE); 01274 r = SrcScan(ctx->text.source, l, XawstWhiteSpace, XawsdRight, 1, FALSE); 01275 _XawTextSetSelection(ctx, l, r, params, *num_params); 01276 EndAction(ctx); 01277 }
Here is the call graph for this function:
static void StartAction | ( | TextWidget | ctx, | |
XEvent * | event | |||
) | [static] |
Definition at line 87 of file TextAction.c.
References _XawTextPrepareToUpdate(), and NULL.
Referenced by _SelectionReceived(), _XawTextZapSelection(), DeleteOrKill(), DisplayCaret(), FormParagraph(), InsertChar(), InsertNewLineAndBackup(), InsertNewLineAndIndent(), InsertSelection(), InsertString(), KillToEndOfLine(), LocalInsertNewLine(), ModifySelection(), Move(), MoveLine(), MovePage(), RedrawDisplay(), Scroll(), SelectAll(), SelectSave(), SelectWord(), and TransposeCharacters().
00090 { 00091 _XawTextPrepareToUpdate(ctx); 00092 if (event != NULL) { 00093 switch (event->type) { 00094 case ButtonPress: 00095 case ButtonRelease: 00096 ctx->text.time = event->xbutton.time; 00097 break; 00098 case KeyPress: 00099 case KeyRelease: 00100 ctx->text.time = event->xkey.time; 00101 break; 00102 case MotionNotify: 00103 ctx->text.time = event->xmotion.time; 00104 break; 00105 case EnterNotify: 00106 case LeaveNotify: 00107 ctx->text.time = event->xcrossing.time; 00108 } 00109 } 00110 }
Here is the call graph for this function:
Here is the caller graph for this function:
static XawTextPosition StripOutOldCRs | ( | TextWidget | ctx, | |
XawTextPosition | from, | |||
XawTextPosition | to | |||
) | [static] |
Definition at line 1850 of file TextAction.c.
References _Xaw_atowc(), _XawTextFormat(), _XawTextGetText(), _XawTextReplace(), buf, FALSE, XawTextBlock::firstPos, XawTextBlock::format, i, iswspace, len, XawTextBlock::length, XawTextBlock::ptr, SrcScan, TRUE, XawEditDone, XawFmt8Bit, XawFmtWide, XawReplaceError, XawsdLeft, XawsdRight, XawSP, XawstEOL, XawstParagraph, XawstPositions, and XawstWhiteSpace.
Referenced by FormRegion().
01853 { 01854 XawTextPosition startPos, endPos, eop_begin, eop_end, temp; 01855 Widget src = ctx->text.source; 01856 XawTextBlock text; 01857 char *buf; 01858 static wchar_t wc_two_spaces[ 3 ]; 01859 01860 /* Initialize our TextBlock with two spaces. */ 01861 01862 text.firstPos = 0; 01863 text.format = _XawTextFormat(ctx); 01864 if ( text.format == XawFmt8Bit ) 01865 text.ptr= " "; 01866 else { 01867 wc_two_spaces[0] = _Xaw_atowc(XawSP); 01868 wc_two_spaces[1] = _Xaw_atowc(XawSP); 01869 wc_two_spaces[2] = 0; 01870 text.ptr = (char*) wc_two_spaces; 01871 } 01872 01873 /* Strip out CR's. */ 01874 01875 eop_begin = eop_end = startPos = endPos = from; 01876 /* CONSTCOND */ 01877 while (TRUE) { 01878 endPos=SrcScan(src, startPos, XawstEOL, XawsdRight, 1, FALSE); 01879 01880 temp = SrcScan(src, endPos, XawstWhiteSpace, XawsdLeft, 1, FALSE); 01881 temp = SrcScan(src, temp, XawstWhiteSpace, XawsdRight,1, FALSE); 01882 01883 if (temp > startPos) 01884 endPos = temp; 01885 01886 if (endPos >= to) 01887 break; 01888 01889 if (endPos >= eop_begin) { 01890 startPos = eop_end; 01891 eop_begin=SrcScan(src, startPos, XawstParagraph, XawsdRight, 1,FALSE); 01892 eop_end = SrcScan(src, startPos, XawstParagraph, XawsdRight, 1, TRUE); 01893 } 01894 else { 01895 XawTextPosition periodPos, next_word; 01896 int i, len; 01897 01898 periodPos= SrcScan(src, endPos, XawstPositions, XawsdLeft, 1, TRUE); 01899 next_word = SrcScan(src, endPos, XawstWhiteSpace, XawsdRight, 1, FALSE); 01900 01901 len = next_word - periodPos; 01902 01903 text.length = 1; 01904 buf = _XawTextGetText(ctx, periodPos, next_word); 01905 if (text.format == XawFmtWide) { 01906 if ( (periodPos < endPos) && (((wchar_t*)buf)[0] == _Xaw_atowc('.'))) 01907 text.length++; 01908 } else 01909 if ( (periodPos < endPos) && (buf[0] == '.') ) 01910 text.length++; /* Put in two spaces. */ 01911 01912 /* 01913 * Remove all extra spaces. 01914 */ 01915 01916 for (i = 1 ; i < len; i++) 01917 if (text.format == XawFmtWide) { 01918 if ( !iswspace(((wchar_t*)buf)[i]) || ((periodPos + i) >= to) ) { 01919 break; 01920 } 01921 } else 01922 if ( !isspace(buf[i]) || ((periodPos + i) >= to) ) { 01923 break; 01924 } 01925 01926 XtFree(buf); 01927 01928 to -= (i - text.length - 1); 01929 startPos = SrcScan(src, periodPos, XawstPositions, XawsdRight, i, TRUE); 01930 if (_XawTextReplace(ctx, endPos, startPos, &text) != XawEditDone) 01931 return XawReplaceError; 01932 startPos -= i - text.length; 01933 } 01934 } 01935 return(to); 01936 }
Here is the call graph for this function:
Here is the caller graph for this function:
static void TextEnterWindow | ( | Widget | w, | |
XEvent* | event, | |||
String* | params, | |||
Cardinal* | num_params | |||
) | [static] |
Definition at line 1455 of file TextAction.c.
References _XawImSetFocusValues(), _TextPart::hasfocus, NULL, and _TextRec::text.
01460 { 01461 TextWidget ctx = (TextWidget) w; 01462 01463 if ((event->xcrossing.detail != NotifyInferior) && event->xcrossing.focus && 01464 !ctx->text.hasfocus) { 01465 _XawImSetFocusValues(w, NULL, 0); 01466 } 01467 }
Here is the call graph for this function:
static void TextFocusIn | ( | Widget | w, | |
XEvent* | event, | |||
String* | p, | |||
Cardinal* | n | |||
) | [static] |
Definition at line 1422 of file TextAction.c.
References _XawImSetFocusValues(), _TextPart::hasfocus, NULL, _TextRec::text, and TRUE.
01427 { 01428 TextWidget ctx = (TextWidget) w; 01429 01430 /* Let the input method know focus has arrived. */ 01431 _XawImSetFocusValues (w, NULL, 0); 01432 if ( event->xfocus.detail == NotifyPointer ) return; 01433 01434 ctx->text.hasfocus = TRUE; 01435 }
Here is the call graph for this function:
static void TextFocusOut | ( | Widget | w, | |
XEvent* | event, | |||
String* | p, | |||
Cardinal* | n | |||
) | [static] |
Definition at line 1439 of file TextAction.c.
References _XawImUnsetFocus(), FALSE, _TextPart::hasfocus, and _TextRec::text.
01444 { 01445 TextWidget ctx = (TextWidget) w; 01446 01447 /* Let the input method know focus has left.*/ 01448 _XawImUnsetFocus(w); 01449 if ( event->xfocus.detail == NotifyPointer ) return; 01450 ctx->text.hasfocus = FALSE; 01451 }
Here is the call graph for this function:
static void TextLeaveWindow | ( | Widget | w, | |
XEvent* | event, | |||
String* | params, | |||
Cardinal* | num_params | |||
) | [static] |
Definition at line 1471 of file TextAction.c.
References _XawImUnsetFocus(), _TextPart::hasfocus, and _TextRec::text.
01476 { 01477 TextWidget ctx = (TextWidget) w; 01478 01479 if ((event->xcrossing.detail != NotifyInferior) && event->xcrossing.focus && 01480 !ctx->text.hasfocus) { 01481 _XawImUnsetFocus(w); 01482 } 01483 }
Here is the call graph for this function:
static void TransposeCharacters | ( | Widget | w, | |
XEvent* | event, | |||
String* | params, | |||
Cardinal* | num_params | |||
) | [static] |
Definition at line 2070 of file TextAction.c.
References _XawTextFormat(), _XawTextGetText(), _XawTextReplace(), buf, EndAction(), XawTextBlock::firstPos, XawTextBlock::format, i, _TextPart::insertPos, XawTextBlock::length, _TextPart::mult, XawTextBlock::ptr, _TextPart::source, SrcScan, StartAction(), _TextRec::text, TRUE, XawFmtWide, XawsdLeft, XawsdRight, and XawstPositions.
02075 { 02076 TextWidget ctx = (TextWidget) w; 02077 XawTextPosition start, end; 02078 XawTextBlock text; 02079 char* buf; 02080 int i; 02081 02082 StartAction(ctx, event); 02083 02084 /* Get bounds. */ 02085 02086 start = SrcScan( ctx->text.source, ctx->text.insertPos, XawstPositions, 02087 XawsdLeft, 1, TRUE ); 02088 end = SrcScan( ctx->text.source, ctx->text.insertPos, XawstPositions, 02089 XawsdRight, ctx->text.mult, TRUE ); 02090 02091 /* Make sure we aren't at the very beginning or end of the buffer. */ 02092 02093 if ( ( start == ctx->text.insertPos ) || ( end == ctx->text.insertPos ) ) { 02094 XBell( XtDisplay( w ), 0 ); /* complain. */ 02095 EndAction( ctx ); 02096 return; 02097 } 02098 02099 ctx->text.insertPos = end; 02100 02101 text.firstPos = 0; 02102 text.format = _XawTextFormat(ctx); 02103 02104 /* Retrieve text and swap the characters. */ 02105 02106 if ( text.format == XawFmtWide) { 02107 wchar_t wc; 02108 wchar_t* wbuf; 02109 02110 wbuf = (wchar_t*) _XawTextGetText(ctx, start, end); 02111 text.length = wcslen( wbuf ); 02112 wc = wbuf[ 0 ]; 02113 for ( i = 1; i < text.length; i++ ) 02114 wbuf[ i-1 ] = wbuf[ i ]; 02115 wbuf[ i-1 ] = wc; 02116 buf = (char*) wbuf; /* so that it gets assigned and freed */ 02117 02118 } else { /* thus text.format == XawFmt8Bit */ 02119 char c; 02120 buf = _XawTextGetText( ctx, start, end ); 02121 text.length = strlen( buf ); 02122 c = buf[ 0 ]; 02123 for ( i = 1; i < text.length; i++ ) 02124 buf[ i-1 ] = buf[ i ]; 02125 buf[ i-1 ] = c; 02126 } 02127 02128 text.ptr = buf; 02129 02130 /* Store new text in source. */ 02131 02132 if (_XawTextReplace (ctx, start, end, &text)) /* Unable to edit, complain. */ 02133 XBell(XtDisplay(w), 0); 02134 XtFree((char *) buf); 02135 EndAction(ctx); 02136 }
Here is the call graph for this function:
XtActionsRec _XawTextActionsTable[] |
Definition at line 2185 of file TextAction.c.
Cardinal _XawTextActionsTableCount = XtNumber(_XawTextActionsTable) |
XComposeStatus compose_status = {NULL, 0} [static] |
Definition at line 1485 of file TextAction.c.
Referenced by ctrl_key(), Input(), InsertChar(), key_pressed(), and key_released().