📄 test15.c
字号:
PrintDiffs ( ctx ); PrintLead(); printf ( "InInvalidateProc: stop\n" ); indent --;}void MyOutputInvalidateProc ( XmTextWidget ctx, XmTextPosition position, XmTextPosition topos, long delta ){ indent ++; PrintDiffs ( ctx ); PrintLead(); printf ( "OutputInvalidateProc: start - position = %i topos = %i : delta = %li\n", (int)position, (int)topos, delta ); DefaultOutputInvalidateProc ( ctx, position, topos, delta ); PrintDiffs ( ctx ); PrintLead(); printf ( "OutInvalidateProc: stop\n" ); indent --;}int MyCountLines ( XmTextSource source, XmTextPosition start, unsigned long length){ int result; PrintDiffs ( source->data->widgets[0] ); indent ++; PrintLead(); printf ( "CountLines: start\n" ); result = DefaultCountLines ( source, start, length ); PrintLead(); printf ( "CountLines: start = %i length = %li : result = %i", (int) start, length, result ); indent --; return result;}void MyGetSecResData ( XmSecondaryResourceData *secResData){ indent ++; PrintLead(); printf ( "GetSecResData: start\n" ); DefaultInputGetSecResDataProc ( secResData );/* PrintDiffs ( (XmTextWidget)w );*/ PrintLead(); printf ( "GetSecResData: for resource %s\n", (*secResData)->name ); indent --;}XmTextPosition MyScanProc( XmTextSource source, XmTextPosition pos, XmTextScanType type, XmTextScanDirection dir, /* Either XmsdLeft or XmsdRight. */ int count, Boolean include ){ XmTextPosition result; indent ++; PrintDiffs ( source->data->widgets[0] ); PrintLead(); printf ( "Scan: start\n" ); result = DefaultScanProc ( source, pos, type, dir, count, include ); PrintDiffs ( source->data->widgets[0] ); PrintLead(); printf ( "Scan: curPos = %i fromPosition = %i type = ", (int)Source_CurPos(source), (int) pos ); switch ( type ) { case XmSELECT_POSITION: printf ( "POSITION" ); break; case XmSELECT_WHITESPACE: printf ( "WHITESPACE" ); break; case XmSELECT_WORD: printf ( "WORD" ); break; case XmSELECT_LINE: printf ( "LINE" ); break; case XmSELECT_ALL: printf ( "ALL" ); break; case XmSELECT_PARAGRAPH: printf ( "PARAGRAPH" ); break; default: printf ( "**UNKNOWN**" ); break; } printf ( " direction = %s count = %i include = %s : ", dir == XmsdLeft ? "left " : "right", count, include == 1 ? "yes" : "no " ); printf ( " result = %i\n", (int) result ); indent --; return result;}void MyClassInitialize(){ indent++; PrintLead(); printf ( "ClassInitialize: start\n" ); DefaultClassInitialize(); PrintLead(); printf ( "ClassInitialize: stop\n" ); indent--;}void MyClassPartInitialize ( WidgetClass wclass){ indent++; PrintLead(); printf ( "ClassPartInitialize: start\n" ); DefaultClassPartInitialize ( wclass ); PrintLead(); printf ( "ClassPartInitialize: stop\n" ); indent--;}void MyOutputCreate( Widget w, ArgList al, Cardinal num){ indent++; PrintDiffs ( (XmTextWidget)w ); PrintLead(); printf ( "OutputCreate: start\n" ); DefaultOutputCreate ( w, al, num ); PrintDiffs ( (XmTextWidget)w ); PrintLead(); printf ( "OutputCreate: stop\n" ); indent--;#ifdef INITIALIAZE_MYPROCS_AT_OUTPUT_CREATION_PROC AddMyProcs ( w );#endif}void AddMyProcs( XmTextWidget textWid ) { DefaultDraw = textWid->text.output->Draw; textWid->text.output->Draw = MyDraw; DefaultMeasureLineProc = textWid->text.output->MeasureLine; textWid->text.output->MeasureLine = MyMeasureLineProc; if ( argShowDrawCursor ) { DefaultDrawInsertionPoint = textWid->text.output->DrawInsertionPoint; textWid->text.output->DrawInsertionPoint = (DrawInsertionPointProc)MyDrawInsertionPointProc ; } DefaultInputGetSecResDataProc = textWid->text.input->GetSecResData ; textWid->text.input->GetSecResData = MyGetSecResData; DefaultInputInvalidateProc = textWid->text.input-> Invalidate; textWid->text.input->Invalidate = MyInputInvalidateProc; DefaultMakePositionVisible = textWid->text.output->MakePositionVisible; textWid->text.output->MakePositionVisible = MyMakePositionVisibleProc; DefaultMoveLines = textWid->text.output->MoveLines ; textWid->text.output->MoveLines = MyMoveLinesProc; DefaultXYToPos = textWid->text.output-> XYToPos; textWid->text.output-> XYToPos = MyXYToPos; DefaultPosToXY = textWid->text.output-> PosToXY; textWid->text.output-> PosToXY = MyPosToXY; DefaultGetPreferredSize = textWid->text.output->GetPreferredSize ; textWid->text.output->GetPreferredSize = MyGetPreferredSize; DefaultOutputSetValues = textWid->text.output-> SetValues; textWid->text.output->SetValues = MyOutputSetValues; DefaultOutputRealize = textWid->text.output-> realize; textWid->text.output->realize = MyOutputRealize; DefaultOutputResize = textWid->text.output-> resize; textWid->text.output->resize = MyOutputResize; DefaultOutputExpose = textWid->text.output-> expose; textWid->text.output->expose = MyOutputExpose; DefaultScanProc = textWid->text.source->Scan; textWid->text.source->Scan = MyScanProc; DefaultCountLines = textWid->text.source->CountLines; textWid->text.source->CountLines = MyCountLines; DefaultGetSelectionProc = textWid->text.source->GetSelection; textWid->text.source->GetSelection = MyGetSelectionProc; DefaultSetSelectionProc = textWid->text.source->SetSelection; textWid->text.source->SetSelection = MySetSelectionProc; DefaultReplace = textWid->text.source->Replace; textWid->text.source->Replace = MyReplaceProc; if ( argShowReadProc ) { DefaultRead = textWid->text.source->ReadSource; textWid->text.source->ReadSource = MyReadProc; } DefaultOutputInvalidateProc = textWid->text.output-> Invalidate; textWid->text.output->Invalidate = MyOutputInvalidateProc;}void MyInputCreate( Widget w, ArgList al, Cardinal num){ indent++; PrintDiffs ( (XmTextWidget)w ); PrintLead(); printf ( "InputCreate: start\n" ); DefaultInputCreate ( w, al, num ); PrintDiffs ( (XmTextWidget)w ); PrintLead(); printf ( "InputCreate: stop\n" ); indent--;}void MyRealize( Widget widget, XtValueMask* mask, XSetWindowAttributes* attributes ){ indent++; PrintDiffs ( (XmTextWidget)widget ); PrintLead(); printf ( "Realize: start\n" ); DefaultRealize ( widget, mask, attributes ); PrintDiffs ( (XmTextWidget)widget ); PrintLead(); printf ( "Realize: stop\n" ); indent--;}void MyResize ( Widget w ){ indent++; PrintDiffs ( (XmTextWidget)w ); PrintLead(); printf ( "Resize: start\n" ); DefaultResize ( w ); PrintDiffs ( (XmTextWidget)w ); PrintLead(); printf ( "Resize: stop\n" ); indent--;}void MyExpose ( Widget widget, XEvent* event, Region region ){ indent++; PrintDiffs ( (XmTextWidget)widget ); PrintLead(); printf ( "Expose: start\n" ); DefaultExpose ( widget, event, region ); PrintDiffs ( (XmTextWidget)widget ); PrintLead(); printf ( "Expose: stop\n" ); indent--;}/*-------------------------------------------------------------** AddTextCBs ** Create Text.*//* ARGSUSED */static void AddTextCBs ( Widget textA ) { XtAddCallback (textA, XmNmodifyVerifyCallback, (XtCallbackProc) TextModifyVerifyCB, NULL); XtAddCallback (textA, XmNvalueChangedCallback, (XtCallbackProc) TextValueChangedCB, NULL); XtAddCallback (textA, XmNmotionVerifyCallback, (XtCallbackProc) TextMotionCB, NULL); XtAddCallback (textA, XmNfocusCallback, (XtCallbackProc) TextFocusCB, (XtPointer) True ); XtAddCallback (textA, XmNlosingFocusCallback, (XtCallbackProc) TextFocusCB, (XtPointer) False ); }void MyActivateCB ( Widget but, XmTextWidget textw , XtPointer unused1){ XmTextPosition pos = 10; Widget w = (Widget)textw; XtUngrabPointer(w, CurrentTime); PrintDiffs ( textw ); printf ( "\n\n*******************************************************************\n" ); printf ( "*******calling XmTextInsert ( w, %i, \"4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n\" );\n", (int)pos ); XmTextInsert( w, pos, "4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n24\n225\n226\n227\n228\n29\n210\n211\n212\n13\n" ); PrintDiffs ( textw ); printf ( "\n\n*******************************************************************\n" ); XmTextInsert( w, XmTextGetLastPosition(w), "4444\n5555\n6666\n7777\n8\n9\n10\n11\n12\n13\n24\n225\n226\n227\n228\n29\n210\n211\n212\n13\n" ); PrintDiffs ( textw ); printf ( "\n\n*******************************************************************\n" );}#if 0void f(XmTextWidget textw) { LineNum line; XmTextPosition pos = 10; Widget w = (Widget)textw; PrintDiffs ( textw ); printf ( "\n\n*******************************************************************\n" ); printf ( "*******calling XmTextInsert ( w, %i, \"14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n\" );\n", (int)pos ); XmTextInsert( w, pos, "14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n" ); PrintDiffs ( textw ); printf ( "\n\n*******************************************************************\n" ); printf ( "*******calling XmTextGetLastPosition( w );\n" ); pos = XmTextGetLastPosition( w ); printf ( "result = %i \n\n", (int)pos ); PrintDiffs ( textw ); printf ( "\n\n*******************************************************************\n" ); printf ( "*******calling XmTextSetInsertionPosition ( w, 14);\n" ); XmTextSetInsertionPosition ( w, 14 ); PrintDiffs ( textw ); printf ( "\n\n*******************************************************************\n" ); printf ( "*******calling XmTextSetInsertionPosition ( w, 45);\n" ); XmTextSetInsertionPosition ( w, 45 ); PrintDiffs ( textw ); printf ( "\n\n*******************************************************************\n" ); printf ( "*******calling XmTextScroll ( w, -20);\n" ); XmTextScroll ( w, -20 ); PrintDiffs ( textw ); printf ( "\n\n*******************************************************************\n" ); printf ( "*******calling XmTextScroll ( w, 20);\n" ); XmTextScroll ( w, 20 ); PrintDiffs ( textw ); printf ( "\n\n*******************************************************************\n" ); printf ( "*******calling XmTextScroll ( w, -30);\n" ); XmTextScroll ( w, -20 ); PrintDiffs ( textw ); printf ( "\n\n*******************************************************************\n" ); printf ( "*******calling XmTextScroll ( w, 40);\n" ); XmTextScroll ( w, 20 ); PrintDiffs ( textw ); printf ( "\n\n*******************************************************************\n" ); printf ( "*******calling _XmTextSetCursorPosition( w, 30 );\n" ); _XmTextSetCursorPosition( w, 30 ) ; PrintDiffs ( textw ); printf ( "\n\n*******************************************************************\n" ); printf ( "*******calling XmTextShowPosition ( w, 0);\n" ); XmTextShowPosition( w, 0 ); PrintDiffs ( textw ); printf ( "\n\n*******************************************************************\n" ); printf ( "*******calling XmTextShowPosition ( w, XmTextGetLastPosition( w ));\n" ); XmTextShowPosition( w, XmTextGetLastPosition( w ) ); PrintDiffs ( textw ); printf ( "\n\n*******************************************************************\n" ); printf ( "*******calling XmTextSetTopCharacter ( w, 50 );\n" ); XmTextSetTopCharacter ( w, 50 ); PrintDiffs ( textw ); printf ( "\n\n*******************************************************************\n" ); printf ( "*******calling _XmTextSetTopCharacter ( w, 50 );\n" ); _XmTextSetTopCharacter ( w, 50 ); { XmTextPosition left, right; Boolean setSelection, getSelection; PrintDiffs ( textw ); printf ( "\n\n*******************************************************************\n" ); printf ( "*******calling __XmTextSetSel2( textw, 40, 70, CurrentTime );\n" ); setSelection = _XmTextSetSel2( textw, 40, 70, CurrentTime ); printf ( "result = %i \n\n", (int)setSelection ); PrintDiffs ( textw ); printf ( "\n\n*******************************************************************\n" ); printf ( "*******calling __XmTextGetSel2( textw, &left, &right );\n" ); getSelection = _XmTextGetSel2( textw, &left, &right ); printf ( "result hasSel = %i left = %i right = %i \n\n", getSelection, (int)left, (int)right ); } { PrintDiffs ( textw ); printf ( "\n\n*******************************************************************\n" ); printf ( "*******calling _XmTextMarkRedraw( textw, 10, 30 );\n" ); _XmTextMarkRedraw( textw, 10, 30 ); } PrintDiffs ( textw ); printf ( "\n\n*******************************************************************\n" ); printf ( "*******calling XmTextSetString ( w, \"this is \n a test \n over 3 lines\n\" );\n" ); XmTextSetString ( w, "this is \n a test \n over 3 lines\n" ); PrintDiffs ( textw ); printf ( "\n\n*******************************************************************\n" ); printf ( "*******calling XmTextReplace ( w, 0, 3, \"replaced\" );\n" ); XmTextReplace ( w, 0, 3, "replaced" ); PrintDiffs ( textw ); printf ( "\n\n*******************************************************************\n" ); printf ( "*******calling XmTextSetSelection ( w, 4, 7, CurrentTime );\n" ); XmTextSetSelection ( w, 4, 7, CurrentTime ); PrintDiffs ( textw );
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -