4 * Author: Alessandro Scotti (Dec 2005)
6 * Copyright 2005 Alessandro Scotti
8 * Enhancements Copyright 2009, 2010, 2011, 2012, 2013, 2014 Free Software Foundation, Inc.
10 * ------------------------------------------------------------------------
12 * GNU XBoard is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation, either version 3 of the License, or (at
15 * your option) any later version.
17 * GNU XBoard is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program. If not, see http://www.gnu.org/licenses/.
25 * ------------------------------------------------------------------------
26 ** See the file ChangeLog for a revision history. */
33 #include <sys/types.h>
38 #else /* not STDC_HEADERS */
39 extern char *getenv();
42 # else /* not HAVE_STRING_H */
44 # endif /* not HAVE_STRING_H */
45 #endif /* not STDC_HEADERS */
58 #include "engineoutput.h"
62 # define _(s) gettext (s)
63 # define N_(s) gettext_noop (s)
69 extern Option engoutOptions[]; // must go in header, but which?
71 /* Module variables */
73 static Widget memoWidget;
75 static GdkPixbuf *iconsGTK[8];
78 ReadIcon (gchar *svgFilename, int iconNr)
80 iconsGTK[iconNr] = LoadIconFile(svgFilename);
84 InitEngineOutput (Option *opt, Option *memo2)
85 { // front-end, because it must have access to the pixmaps
87 Widget w = opt->handle;
88 memoWidget = memo2->handle;
90 ReadIcon("eo_White", nColorWhite);
91 ReadIcon("eo_Black", nColorBlack);
92 ReadIcon("eo_Unknown", nColorUnknown);
94 ReadIcon("eo_Clear", nClear);
95 ReadIcon("eo_Ponder", nPondering);
96 ReadIcon("eo_Thinking", nThinking);
97 ReadIcon("eo_Analyzing", nAnalyzing);
101 DrawWidgetIcon (Option *opt, int nIcon)
102 { // as we are already in GTK front-end, so do GTK-stuff here
103 if( nIcon != 0 ) gtk_image_set_from_pixbuf(GTK_IMAGE(opt->handle), GDK_PIXBUF(iconsGTK[nIcon]));
107 InsertIntoMemo (int which, char * text, int where)
112 /* the backend adds \r\n, which is needed for winboard,
113 * for xboard we delete them again over here */
114 if(p = strchr(text, '\r')) *p = ' ';
116 GtkTextBuffer *tb = (GtkTextBuffer *) (engoutOptions[which ? 12 : 5].handle);
117 // gtk_text_buffer_get_start_iter(GTK_TEXT_BUFFER(tb), &start);
118 gtk_text_buffer_get_iter_at_offset(tb, &start, where);
119 gtk_text_buffer_insert(tb, &start, text, -1);
120 if(where < highTextStart[which]) { // [HGM] multiPVdisplay: move highlighting
121 int len = strlen(text);
122 highTextStart[which] += len; highTextEnd[which] += len;
126 //------------------------------- pane switching -----------------------------------
129 ResizeWindowControls (int mode)
130 { // another hideous kludge: to have only a single pane, we resize the
131 // second to 5 pixels (which makes it too small to display anything)
132 if(mode) gtk_widget_show(engoutOptions[13].handle);
133 else gtk_widget_hide(engoutOptions[13].handle);