From a58df46e1b619e6d5be974896e5b457ed4b37b23 Mon Sep 17 00:00:00 2001 From: Arun Persaud Date: Tue, 13 Oct 2009 20:51:17 -0700 Subject: [PATCH] removed AnalysisPopUp. Use EngineOutputPopUp instead this was already in Winboard, copied it to xboard and removed unused code. --- backend.c | 18 +++++++----------- frontend.h | 2 -- winboard/winboard.c | 47 ----------------------------------------------- xboard.c | 45 ++------------------------------------------- xoptions.c | 4 ++-- 5 files changed, 11 insertions(+), 105 deletions(-) diff --git a/backend.c b/backend.c index bdac10d..c144984 100644 --- a/backend.c +++ b/backend.c @@ -10328,8 +10328,7 @@ AnalyzeModeEvent() first.analyzing = TRUE; /*first.maybeThinking = TRUE;*/ first.maybeThinking = FALSE; /* avoid killing GNU Chess */ - AnalysisPopUp(_("Analysis"), - _("Starting analysis mode...\nIf this message stays up, your chess program does not support analysis.")); + EngineOutputPopUp(); } if (!appData.icsEngineAnalyze) gameMode = AnalyzeMode; pausing = FALSE; @@ -10355,8 +10354,7 @@ AnalyzeFileEvent() first.analyzing = TRUE; /*first.maybeThinking = TRUE;*/ first.maybeThinking = FALSE; /* avoid killing GNU Chess */ - AnalysisPopUp(_("Analysis"), - _("Starting analysis mode...\nIf this message stays up, your chess program does not support analysis.")); + EngineOutputPopUp(); } gameMode = AnalyzeFile; pausing = FALSE; @@ -10854,7 +10852,7 @@ ExitAnalyzeMode() SendToProgram("exit\n", &first); first.analyzing = FALSE; } - AnalysisPopDown(); + EngineOutputPopDown(); thinkOutput[0] = NULLCHAR; } @@ -12698,12 +12696,10 @@ void DisplayAnalysisText(text) char *text; { - char buf[MSG_SIZ]; - - if (gameMode == AnalyzeMode || gameMode == AnalyzeFile - || appData.icsEngineAnalyze) { - sprintf(buf, "Analysis (%s)", first.tidy); - AnalysisPopUp(buf, text); + if (gameMode == AnalyzeMode || gameMode == AnalyzeFile + || appData.icsEngineAnalyze) + { + EngineOutputPopUp(); } } diff --git a/frontend.h b/frontend.h index b5b38e3..ef8cef6 100644 --- a/frontend.h +++ b/frontend.h @@ -159,8 +159,6 @@ void TagsPopDown P((void)); void ICSInitScript P((void)); void StartAnalysisClock P((void)); -void AnalysisPopUp P((char *title, char *label)); -void AnalysisPopDown P((void)); void SetHighlights P((int fromX, int fromY, int toX, int toY)); void ClearHighlights P((void)); diff --git a/winboard/winboard.c b/winboard/winboard.c index 482beca..aaf6150 100644 --- a/winboard/winboard.c +++ b/winboard/winboard.c @@ -5631,14 +5631,12 @@ WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) switch (wmId) { case IDM_NewGame: ResetGameEvent(); - AnalysisPopDown(); SAY("new game enter a move to play against the computer with white"); break; case IDM_NewGameFRC: if( NewGameFRC() == 0 ) { ResetGameEvent(); - AnalysisPopDown(); } break; @@ -10699,51 +10697,6 @@ AnalysisDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) } VOID -AnalysisPopUp(char* title, char* str) -{ - FARPROC lpProc; - char *p, *q; - - /* [AS] */ - EngineOutputPopUp(); - return; - - if (str == NULL) str = ""; - p = (char *) malloc(2 * strlen(str) + 2); - q = p; - while (*str) { - if (*str == '\n') *q++ = '\r'; - *q++ = *str++; - } - *q = NULLCHAR; - if (analysisText != NULL) free(analysisText); - analysisText = p; - - if (analysisDialog) { - SetWindowText(analysisDialog, title); - SetDlgItemText(analysisDialog, OPT_AnalysisText, analysisText); - ShowWindow(analysisDialog, SW_SHOW); - } else { - analysisTitle = title; - lpProc = MakeProcInstance((FARPROC)AnalysisDialog, hInst); - CreateDialog(hInst, MAKEINTRESOURCE(DLG_Analysis), - hwndMain, (DLGPROC)lpProc); - FreeProcInstance(lpProc); - } - analysisDialogUp = TRUE; -} - -VOID -AnalysisPopDown() -{ - if (analysisDialog) { - ShowWindow(analysisDialog, SW_HIDE); - } - analysisDialogUp = FALSE; -} - - -VOID SetHighlights(int fromX, int fromY, int toX, int toY) { highlightInfo.sq[0].x = fromX; diff --git a/xboard.c b/xboard.c index 86fda44..982c373 100644 --- a/xboard.c +++ b/xboard.c @@ -1897,7 +1897,7 @@ XtActionsRec boardActions[] = { { "TagsPopDown", (XtActionProc) TagsPopDown }, { "ErrorPopDown", (XtActionProc) ErrorPopDown }, { "ICSInputBoxPopDown", (XtActionProc) ICSInputBoxPopDown }, - { "AnalysisPopDown", (XtActionProc) AnalysisPopDown }, + { "EngineOutputPopDown", (XtActionProc) EngineOutputPopDown }, { "FileNamePopDown", (XtActionProc) FileNamePopDown }, { "AskQuestionPopDown", (XtActionProc) AskQuestionPopDown }, { "GameListPopDown", (XtActionProc) GameListPopDown }, @@ -5744,37 +5744,6 @@ void CommentPopUp(title, text) commentUp = True; } -void AnalysisPopUp(title, text) - char *title, *text; -{ - Arg args[16]; - int j; - Widget edit; - - if (analysisShell == NULL) { - analysisShell = MiscCreate(title, text, False, NULL, 4); - XtRealizeWidget(analysisShell); - CatchDeleteWindow(analysisShell, "AnalysisPopDown"); - - } else { - edit = XtNameToWidget(analysisShell, "*form.text"); - j = 0; - XtSetArg(args[j], XtNstring, text); j++; - XtSetValues(edit, args, j); - j = 0; - XtSetArg(args[j], XtNiconName, (XtArgVal) title); j++; - XtSetArg(args[j], XtNtitle, (XtArgVal) title); j++; - XtSetValues(analysisShell, args, j); - } - - if (!analysisUp) { - XtPopup(analysisShell, XtGrabNone); - } - XSync(xDisplay, False); - - analysisUp = True; -} - void CommentCallback(w, client_data, call_data) Widget w; XtPointer client_data, call_data; @@ -5813,16 +5782,6 @@ void CommentPopDown() commentUp = False; } -void AnalysisPopDown() -{ - if (!analysisUp) return; - XtPopdown(analysisShell); - XSync(xDisplay, False); - analysisUp = False; - if (appData.icsEngineAnalyze) ExitAnalyzeMode(); /* [DM] icsEngineAnalyze */ -} - - void FileNamePopUp(label, def, proc, openMode) char *label; char *def; @@ -6294,7 +6253,7 @@ void ResetProc(w, event, prms, nprms) Cardinal *nprms; { ResetGameEvent(); - AnalysisPopDown(); + EngineOutputPopDown(); } int LoadGamePopUp(f, gameNumber, title) diff --git a/xoptions.c b/xoptions.c index 969a97d..514c9d6 100644 --- a/xoptions.c +++ b/xoptions.c @@ -142,7 +142,7 @@ void ShuffleCallback(w, client_data, call_data) ShufflePopDown(); shuffleOpenings = False; // [HGM] should be moved to New Variant menu, once we have it! ResetGameEvent(); - AnalysisPopDown(); + EngineOutputPopDown(); return; } if (strcmp(name, _("random")) == 0) { @@ -164,7 +164,7 @@ void ShuffleCallback(w, client_data, call_data) shuffleOpenings = True; ShufflePopDown(); ResetGameEvent(); - AnalysisPopDown(); + EngineOutputPopDown(); return; } } -- 1.7.0.4