X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=xengineoutput.c;h=70235ab05eb14ae70bf1c8cee1b6b11e7d328c7c;hb=ad98ed57601f8782ffb345ed264a9def813157cc;hp=7a0b5bcf72ccbf7add5733e39f8543487fd451ba;hpb=b80a07a436b0211145c915a7d79bf7c41ae891e4;p=xboard.git diff --git a/xengineoutput.c b/xengineoutput.c index 7a0b5bc..70235ab 100644 --- a/xengineoutput.c +++ b/xengineoutput.c @@ -132,7 +132,7 @@ Pixmap icons[8]; // [HGM] this front-end array translates back-end icon indicato Widget outputField[2][7]; // [HGM] front-end array to translate output field to window handle void EngineOutputPopDown(); -void engineOutputPopUp(char *title, char *text); +void engineOutputPopUp(); int EngineOutputIsUp(); static void SetEngineColorIcon( int which ); @@ -188,9 +188,9 @@ typedef struct { int an_move_count; } EngineOutputData; -static int VerifyDisplayMode(); +static void VerifyDisplayMode(); static void UpdateControls( EngineOutputData * ed ); -static SetEngineState( int which, int state, char * state_data ); +static void SetEngineState( int which, int state, char * state_data ); void ReadIcon(char *pixData[], int iconNr) { @@ -230,6 +230,10 @@ static void InsertIntoMemo( int which, char * text ) { Arg arg; 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, 0, 0, &t); @@ -349,13 +353,9 @@ void PositionControlSet(which, form, bw_width) XtSetArg(args[j], XtNright, XtChainRight); j++; XtSetArg(args[j], XtNresizable, True); j++; XtSetArg(args[j], XtNwidth, bw_width); j++; /*force wider than buttons*/ -#if 0 - XtSetArg(args[j], XtNscrollVertical, XawtextScrollWhenNeeded); j++; -#else /* !!Work around an apparent bug in XFree86 4.0.1 (X11R6.4.3) */ XtSetArg(args[j], XtNscrollVertical, XawtextScrollAlways); j++; XtSetArg(args[j], XtNscrollHorizontal, XawtextScrollWhenNeeded); j++; -#endif // XtSetArg(args[j], XtNautoFill, True); j++; // XtSetArg(args[j], XtNwrap, XawtextWrapWord); j++; outputField[which][nMemo] = edit = @@ -385,7 +385,11 @@ Widget EngineOutputCreate(name, text) j = 0; XtSetArg(args[j], XtNresizable, True); j++; shell = +#if TOPLEVEL + XtCreatePopupShell(name, topLevelShellWidgetClass, +#else XtCreatePopupShell(name, transientShellWidgetClass, +#endif shellWidget, args, j); layout = XtCreateManagedWidget(layoutName, formWidgetClass, shell, @@ -417,20 +421,8 @@ Widget EngineOutputCreate(name, text) Window junk; Dimension pw_height; Dimension ew_height; -#if 0 - j = 0; - XtSetArg(args[j], XtNheight, &ew_height); j++; - XtGetValues(edit, args, j); - - j = 0; - XtSetArg(args[j], XtNheight, &pw_height); j++; - XtGetValues(shell, args, j); - engineOutputH = pw_height + (lines - 1) * ew_height; - engineOutputW = bw_width - 16; -#else engineOutputH = bw_height/2; engineOutputW = bw_width-16; -#endif XSync(xDisplay, False); #ifdef NOTDEF @@ -499,12 +491,13 @@ void ResizeWindowControls(shell, mode) } } -void EngineOutputPopUp(title, text) - char *title, *text; +void +EngineOutputPopUp() { Arg args[16]; int j; Widget edit; + static char *title = _("Engine output"), *text = _("This feature is experimental"); if (engineOutputShell == NULL) { engineOutputShell = @@ -570,7 +563,7 @@ void EngineOutputPopDown() // back end, due to front-end wrapper for SetWindowText, and new SetIcon arguments -static SetEngineState( int which, int state, char * state_data ) +static void SetEngineState( int which, int state, char * state_data ) { int x_which = 1 - which; @@ -756,7 +749,7 @@ static void SetDisplayMode( int mode ) } // pure back end -int VerifyDisplayMode() +void VerifyDisplayMode() { int mode; @@ -862,7 +855,8 @@ static void UpdateControls( EngineOutputData * ed ) strncpy( mov, ed->hint, sizeof(mov) ); mov[ sizeof(mov)-1 ] = '\0'; - sprintf( buf, "%d/%d: %s [%02d:%02d:%02d]", ed->an_move_index, ed->an_move_count, mov, time_mins / 60, time_mins % 60, time_secs % 60 ); + sprintf( buf, "[%d] %d/%d: %s [%02d:%02d:%02d]", ed->depth, ed->an_move_index, + ed->an_move_count, mov, time_mins / 60, time_mins % 60, time_secs % 60 ); } SetEngineState( ed->which, STATE_ANALYZING, buf ); @@ -917,8 +911,8 @@ static void UpdateControls( EngineOutputData * ed ) sprintf( s_time, "%d:%02d.%02d", time_secs / 60, time_secs % 60, time_cent ); /* Put all together... */ - if(ed->nodes == 0) /*sprintf( buf, "%3d\t \t \t \t", ed->depth );*/ buf[0]=0; else - sprintf( buf, "%3d\t%s\t%s\t%s\t", ed->depth, s_score, s_nodes, s_time ); + if(ed->nodes == 0 && ed->score == 0 && ed->time == 0) sprintf( buf, "%3d\t", ed->depth ); else + sprintf( buf, "%3d %s %s\t%s\t", ed->depth, s_score, s_nodes, s_time ); /* Add PV */ buflen = strlen(buf); @@ -953,7 +947,7 @@ EngineOutputProc(w, event, prms, nprms) if (engineOutputDialogUp) { EngineOutputPopDown(); } else { - EngineOutputPopUp(_("engine output"),_("This feature is experimental")); + EngineOutputPopUp(); } // ToNrEvent(currentMove); }