📄 test15.c
字号:
|| ( strcmp ( actionName, "enter" ) == 0 ) || ( strcmp ( actionName, "PrimitiveFocusIn" ) == 0 ) || ( strcmp ( actionName, "leave" ) == 0 ) ) return; PrintDiffs ( (XmTextWidget)w ); indent ++; PrintLead(); printf ("action %s called", actionName ); if ( *noOfParams > 0 ) { int i=0; printf (" with %i paramaters :", *noOfParams ); while ( i < *noOfParams ) { printf ("%s:", params[i] ); i++; } } printf ("\n" );/* ShowAllSelectionData ( (XmTextWidget)w );*/ fflush (NULL); indent --;}/*-------------------------------------------------------------** ModifyVerifyCB** The text in the text widget has been altered.*//*ARGSUSED*/void TextModifyVerifyCB ( Widget w, XtPointer unused_client_data, XmTextVerifyPtr call_data ){ indent ++; PrintTextVerifyPtr ( w, "TextModifyVerifyCB", call_data ); indent --;}static void TextFocusCB ( Widget w, Boolean client_data, XmAnyCallbackStruct* call_data ) { static XtActionHookId actionHookId = 0; indent ++; PrintDiffs ( (XmTextWidget)w ); PrintLead(); printf ( "TextFocusCB start : %s focus\n", (call_data -> reason == XmCR_LOSING_FOCUS ? "loosing" : "gaining" ) ); if ( call_data -> reason == XmCR_LOSING_FOCUS ) XtRemoveActionHook ( actionHookId ); else actionHookId = XtAppAddActionHook ( app_context, (XtActionHookProc)TextActionHook, NULL ); PrintDiffs ( (XmTextWidget)w ); PrintLead(); printf ( "TextFocusCB stop\n" ); indent --; }/*-------------------------------------------------------------** MotionCB** Text widget motion callback.*/static void TextMotionCB ( Widget w, XtPointer client_data, XmTextVerifyPtr call_data ) { PrintTextVerifyPtr ( w, "TextMotionCB", call_data ); }/*-------------------------------------------------------------** TextValueChangedCB ** Text widget motion callback.*/void TextValueChangedCB ( Widget w, XtPointer client_data, XmAnyCallbackStruct* call_data ) { indent ++; PrintDiffs ( (XmTextWidget)w ); PrintLead(); printf ( "TextValueChangedCB" ); switch ( call_data -> reason ) { case XmCR_LOSING_FOCUS: printf ( " : reason XmCR_LOSING_FOCUS\n"); break; case XmCR_MODIFYING_TEXT_VALUE: printf ( " : reason XmCR_MODIFYING_TEXT_VALUE\n"); break; case XmCR_MOVING_INSERT_CURSOR: printf ( " : reason XmCR_MOVING_INSERT_CURSOR\n"); break; case XmCR_VALUE_CHANGED: printf ( " : reason XmCR_VALUE_CHANGED\n"); break; default : printf ( ": INVALID REASON %i\n\n", call_data -> reason ); } indent --; }void MyDraw ( XmTextWidget wid, LineNum lineNum, XmTextPosition pos1, XmTextPosition pos2, XmHighlightMode high) { indent ++; PrintDiffs ( wid ); PrintLead(); printf ("Draw: start\n" ); ShowRangeData ( wid, 0, False ); if ( ( DefaultDraw != NULL ) && ( DefaultDraw != MyDraw ) ) DefaultDraw ( wid, lineNum, pos1, pos2, high ); PrintDiffs ( wid ); PrintLead(); printf ("Draw: lineNum = %i left = %i right = %i highlightMode = %i\n", lineNum, (int) pos1, (int) pos2, high) ; PrintLead(); printf ("Draw: booleans :") ; if ( Text_OutputData(wid)-> handlingexposures ) printf (" handlingExposures, ") ; if ( Text(wid). in_redisplay ) printf (" in_redisplay, ") ; if ( Text(wid). needs_redisplay ) printf (" needs_redisplay, ") ; if ( Text(wid). in_refigure_lines ) printf (" in_refigure_lines, ") ; if ( Text(wid). needs_refigure_lines ) printf (" needs_refigure_lines, ") ; if ( Text(wid). in_resize ) printf (" in_resize, ") ; if ( Text(wid). in_expose ) printf (" in_expose, ") ; if ( Text(wid). highlight_changed ) printf (" highlight_changed, ") ; printf ("\n") ; indent --; }XmTextStatus MyReplaceProc( XmTextWidget wid, XEvent *ev, XmTextPosition *start, XmTextPosition *end, XmTextBlock block, Boolean callcallback ){ LineNum lineNum; XmTextStatus status; XmTextPosition oldStart = *start, oldEnd = *end; indent ++; PrintDiffs ( wid ); PrintLead(); printf ( "ReplaceProc : start = %i end = %i\n", (int) *start,(int) *end); printf ( "\t\tblock ( length = %i ptr =\"%s\" ) :\n", block->length, block->ptr ); lineNum = _XmTextPosToLine( wid, *start ); if ( lineNum - Text_TopLine(wid) > Out_Rows ( Text_OutputData(wid) ) ) printf ( "*****CRAZY value for _XmTextPosToLine( wid, %i ) = %i\n", (int)*start, lineNum ); else { ShowLine ( wid, lineNum, False ); if ( lineNum > 0 ) ShowLine ( wid, lineNum-1, False ); } status = DefaultReplace ( wid, ev, start, end, block, callcallback ); PrintDiffs ( wid ); lineNum = _XmTextPosToLine( wid, *start ); if ( lineNum - Text_TopLine(wid) > Out_Rows ( Text_OutputData(wid) ) ) printf ( "*****CRAZY value for _XmTextPosToLine( wid, %i ) = %i\n", (int)*start, lineNum ); else { ShowLine ( wid, lineNum, False ); if ( lineNum > 0 ) ShowLine ( wid, lineNum-1, False ); } PrintLead(); printf ( "ReplaceProc : start = %i%s end = %i%s", (int) *start, (*start != oldStart)?"CHANGED":"", (int) *end, (*end != oldEnd)?"CHANGED":"" ); printf ( " block ( length = %i ptr =\"%s\" ) %s : ", block->length, block->ptr, (callcallback ? "call-callback" : "no-callback") ); switch ( status ) { case EditDone : printf ( "EditDone\n" ); break; case EditError : printf ( "EditError\n" ); break; case EditReject : printf ( "EditReject\n" ); break; } indent --; return status;}XmTextPosition MyReadProc( XmTextSource source, XmTextPosition start, XmTextPosition end, XmTextBlock block ){ char *str; XmTextPosition result ; indent ++; PrintDiffs ( source->data->widgets[0] ); PrintLead(); printf ( "ReadProc : start = %i end = %i\n", (int) start,(int) end); result = DefaultRead ( source, start, end, block ); PrintDiffs ( source->data->widgets[0] ); PrintLead(); str = XtMalloc ( sizeof (char) * (block->length + 1 )); strncpy ( str, block->ptr, block->length ); str [ block->length ] = 0; printf ( "ReadProc : block ( length = %i ptr =\"%s\" ) : result = %i\n", block->length, str, (int)result ); XtFree ( str ); indent --; return result;}Boolean MyGetSelectionProc ( XmTextSource source, XmTextPosition* left, XmTextPosition* right ){ Boolean retStatus ; indent ++; PrintDiffs ( source->data->widgets[0] ); PrintLead(); printf ( "GetSelectionProc: start\n" );#ifdef SHOW_INITIAL_VALUES_FOR_IO_PARAMS printf ( "\t\tinital values for *left = %i *right = %i \n", (int)*left, (int)*right );#endif retStatus = DefaultGetSelectionProc ( source, left, right ); PrintDiffs ( source->data->widgets[0] ); PrintLead(); printf ( "GetSelectionProc: returned " ); if ( retStatus ) printf ( "left = %i right = %i \n", (int)*left, (int)*right ); else printf ( "false\n" ); indent --; return retStatus;}Boolean MyMeasureLineProc ( XmTextWidget wid, LineNum line, XmTextPosition pos, XmTextPosition *nextPos, LineTableExtraRec **extra){ Line lineData = &Text_Line(text) [ line ]; Boolean retStatus ; indent ++; PrintDiffs ( wid ); PrintLead(); printf ( "MeasureLineProc: start : pos = %i \n", (int)pos ); if ( ! lineData -> past_end ) printf ( "\t\tinital values for *nextPos = %i\n", nextPos==0 ? 0 : (int)*nextPos ); ShowLine ( wid, line, False ); if ( lineData -> start != PASTENDPOS && ! lineData -> past_end && line < wid->text.maximum_lines - 1 ) ShowLine ( wid, line+1, False ); retStatus = DefaultMeasureLineProc ( wid, line, pos, nextPos, extra ); PrintDiffs ( wid ); ShowLine ( wid, line, False ); if ( lineData -> start != PASTENDPOS && ! lineData -> past_end && line < wid->text.maximum_lines - 1 ) ShowLine ( wid, line+1, False ); PrintLead(); printf ( "MeasureLineProc: line = %i pos = %i : returned = %s ", (int)line, (int)pos, retStatus == 1 ? "true " : "false" ); if ( nextPos ) { if ( retStatus == True) printf ( "nextPos = %i ", (int)*nextPos ); } else printf ( "nextPos = NULL " ); if ( extra && *extra ) { /* printf ( "extra ( NOT-SHOWING-WIDTH " ); */ printf ( "extra ( width = %i ", (int)(*extra)->width ); if ( (*extra) -> wrappedbychar ) printf ( "wrappedByChar = %c", (int)(*extra)->wrappedbychar ); printf ( ")" ); } printf ( "\n" ); indent --; return retStatus;}void MyDrawInsertionPointProc( XmTextWidget text, XmTextPosition pos, OnOrOff onOrOff ){ indent ++; PrintDiffs ( text ); PrintLead(); printf ( "DrawInsertionPointProc: start pos = %i : %s \n", (int)pos, onOrOff == on ? "on" : "off" ); DefaultDrawInsertionPoint ( text, pos, onOrOff ); PrintDiffs ( text ); PrintLead(); printf ( "DrawInsertionPointProc: stop \n" ); indent --;}void MyMakePositionVisibleProc( XmTextWidget text, XmTextPosition pos ){ indent ++; PrintDiffs ( text ); PrintLead(); printf ( "MakePositionVisibleProc: start pos = %i \n", (int)pos ); DefaultMakePositionVisible ( text, pos ); PrintDiffs ( text ); PrintLead(); printf ( "MakePositionVisibleProc: stop\n" ); indent --;}/* Text would like to move some lines around on the screen. It would like to * move lines fromline through toline (inclusive) to now start at line * destline. If output can perform this move by means of a XCopyArea or * similar simple call, it does so and returns TRUE; otherwise, it will return * FALSE. If TRUE, output should modify affected values in the * "extra" entries in the linetable, because after returning text will go ahead * and move linetable entries around. */Boolean MyMoveLinesProc( XmTextWidget text, LineNum from, LineNum to, LineNum dest ){ Boolean retStatus ; indent ++; PrintDiffs ( text ); PrintLead(); printf ( "MoveLinesProc: start\n" ); retStatus = DefaultMoveLines ( text, from, to, dest ); PrintDiffs ( text ); PrintLead(); printf ( "MoveLinesProc: from = %i to = %i destination = %i : possible = %s\n", (int)from, (int)to, (int)dest, retStatus ? "yes" : "no" ); indent --; return retStatus;}void MySetSelectionProc ( XmTextSource source, XmTextPosition left, XmTextPosition right, Time time ){ XmTextSourceRec* src ; src = (XmTextSourceRec*)source; PrintDiffs ( source->data->widgets[0] ); indent ++; PrintLead(); printf ( "SetSelectionProc: left = %i right = %i time =", (int)left, (int)right ); PrintTime ( (Widget)source->data->widgets[0], time ); DefaultSetSelectionProc ( source, left, right, time ); PrintDiffs ( source->data->widgets[0] ); PrintLead(); printf ( "SetSelectionProc: stop\n" ); indent --;}void MyInputInvalidateProc ( XmTextWidget ctx, XmTextPosition position, XmTextPosition topos, long delta ){ indent ++; PrintDiffs ( ctx ); PrintLead(); printf ( "InInvalidateProc: start - position = %i topos = %i : delta = %li\n", (int)position, (int)topos, delta ); DefaultInputInvalidateProc ( ctx, position, topos, delta );
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -