Beispiel #1
0
void
HighlightText (Option *opt, int start, int end, Boolean on)
{
    if(on)
	XawTextSetSelection( opt->handle, start, end ); // for lack of a better method, use selection for highighting
    else
	XawTextSetSelection( opt->handle, 0, 0 );
}
Beispiel #2
0
void InsertIntoMemo( int which, char * text, int where )
{
	XawTextBlock t;
	Widget edit;

	/* the backend adds \r\n, which is needed for winboard,
	 * for xboard we delete them again over here */
	if(t.ptr = strchr(text, '\r')) *t.ptr = ' ';

	t.ptr = text; t.firstPos = 0; t.length = strlen(text); t.format = XawFmt8Bit;
	edit = XtNameToWidget(engineOutputShell, which ? "*form2.text" : "*form.text");
	XawTextReplace(edit, where, where, &t);
	if(where < highTextStart[which]) { // [HGM] multiPVdisplay: move highlighting
	    int len = strlen(text);
	    highTextStart[which] += len; highTextEnd[which] += len;
	    XawTextSetSelection( outputField[which][nMemo], highTextStart[which], highTextEnd[which] );
	}
}
Beispiel #3
0
void
SelectPV (Widget w, XEvent * event, String * params, Cardinal * nParams)
{	// [HGM] pv: translate click to PV line, and load it for display
	String val;
	int start, end;
	XawTextPosition index, dummy;
	int x, y;
	Arg arg;

	x = event->xmotion.x; y = event->xmotion.y;
	currentPV = (w == outputField[1][nMemo]);
	XawTextGetSelectionPos(w, &index, &dummy);
	XtSetArg(arg, XtNstring, &val);
	XtGetValues(w, &arg, 1);
	if(LoadMultiPV(x, y, val, index, &start, &end)) {
	    XawTextSetSelection( outputField[currentPV][nMemo], start, end );
	    highTextStart[currentPV] = start; highTextEnd[currentPV] = end;
	}
}