diff options
author | Russ Allbery <rra@debian.org> | 2016-07-02 13:38:40 -0700 |
---|---|---|
committer | Russ Allbery <rra@debian.org> | 2016-07-02 13:38:40 -0700 |
commit | a92a560637b87da633f44af0049f55e419a0dd05 (patch) | |
tree | ce8d2ad89e6769d97e8662f95867823eea9b6e84 /gtkgame.c | |
parent | 6fd8c2586f4de4f7f8f70dfc19f0ef51f44ea4c7 (diff) |
Imported Upstream version 1.05.002
Diffstat (limited to 'gtkgame.c')
-rw-r--r-- | gtkgame.c | 176 |
1 files changed, 91 insertions, 85 deletions
@@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: gtkgame.c,v 1.890 2015/04/02 23:40:09 plm Exp $ + * $Id: gtkgame.c,v 1.900 2016/05/14 22:28:32 plm Exp $ */ #include "config.h" @@ -34,11 +34,12 @@ #include <string.h> #include <errno.h> #include <locale.h> +#include "glib-ext.h" -#if HAVE_UNISTD_H +#if defined(HAVE_UNISTD_H) #include <unistd.h> #endif -#if HAVE_LIBREADLINE +#if defined(HAVE_LIB_READLINE) #include <readline/history.h> #include <readline/readline.h> #endif @@ -78,19 +79,19 @@ #include "gtkmovelistctrl.h" #include "rollout.h" #include "util.h" -#if USE_BOARD3D +#if defined(USE_BOARD3D) #include "fun3d.h" #endif #include "gnubgstock.h" #define KEY_ESCAPE -229 -#if (USE_BOARD3D && !USE_GTKUIMANAGER) +#if defined(USE_BOARD3D) && !defined(USE_GTKUIMANAGER) /* Offset action to avoid predefined values */ #define MENU_OFFSET 50 #endif -#if (USE_GTKUIMANAGER) +#if defined(USE_GTKUIMANAGER) static void TogglePanel(guint iType, guint iActionID, GtkToggleAction * action, GtkToggleAction * alt, gpointer user_data); @@ -190,7 +191,7 @@ typedef enum _gnubgcommand { /* TRUE if gnubg is automatically setting the state of a menu item. */ static int fAutoCommand; -#if (USE_GTKUIMANAGER) +#if defined(USE_GTKUIMANAGER) static void ExecToggleActionCommand_internal(guint UNUSED(iWidgetType), guint UNUSED(iCommand), gchar * szCommand, gpointer * widget, gpointer * UNUSED(widgetalt), gpointer UNUSED(user_data)) @@ -545,7 +546,7 @@ GtkAccelGroup *pagMain; #if ! GTK_CHECK_VERSION(2,12,0) GtkTooltips *ptt; #endif -#if (USE_GTKUIMANAGER) +#if defined(USE_GTKUIMANAGER) GtkUIManager *puim = NULL; #else GtkItemFactory *pif; @@ -627,7 +628,7 @@ GTKResumeInput(void) static gboolean StdinReadNotify(GIOChannel * UNUSED(source), GIOCondition UNUSED(cond), gpointer UNUSED(p)) { -#if HAVE_LIBREADLINE +#if defined(HAVE_LIB_READLINE) /* Handle "next turn" processing before more input (otherwise we might * not even have a readline handler installed!) */ while (nNextTurn) @@ -951,7 +952,7 @@ luck_label(lucktype lt) GtkWidget *label; gchar *markup; const gchar *skill; - gchar *color[N_LUCKS] = { "red", "orange", "black", "green", "white" }; + const gchar *color[N_LUCKS] = { "red", "orange", "black", "green", "white" }; label = gtk_label_new(NULL); skill = aszLuckType[lt] ? gettext(aszLuckType[lt]) : ""; @@ -968,7 +969,7 @@ skill_label(skilltype st) GtkWidget *label; gchar *markup; const gchar *skill; - gchar *color[] = { "red", "orange", "yellow", "black" }; + const gchar *color[N_SKILLS] = { "red", "orange", "yellow", "black" }; label = gtk_label_new(NULL); skill = aszSkillType[st] ? gettext(aszSkillType[st]) : ""; @@ -1058,7 +1059,7 @@ SetAnnotation(moverecord * pmr) char sz[64], *pch; cubeinfo ci; - pch = sz + sprintf(sz, _("Rolled %d%d"), pmr->anDice[0], pmr->anDice[1]); + pch = sz + sprintf(sz, _("Rolled %u%u"), pmr->anDice[0], pmr->anDice[1]); if (pmr->rLuck != ERR_VAL) { if (fOutputMWC && ms.nMatchTo) { @@ -1340,7 +1341,7 @@ MainSize(GtkWidget * pw, GtkRequisition * preq, gpointer p) } -#if !(USE_GTKUIMANAGER) +#if !defined(USE_GTKUIMANAGER) static gchar * GTKTranslate(const gchar * path, gpointer UNUSED(func_data)) { @@ -1348,7 +1349,7 @@ GTKTranslate(const gchar * path, gpointer UNUSED(func_data)) } #endif -#if (USE_GTKUIMANAGER) +#if defined(USE_GTKUIMANAGER) static void ToolbarStyle(guint UNUSED(iType), guint UNUSED(iActionID), GtkRadioAction * action, GtkRadioAction * UNUSED(alt), gpointer UNUSED(user_data)) @@ -1483,13 +1484,13 @@ CopyPositionID(gpointer UNUSED(p), guint UNUSED(n), GtkWidget * UNUSED(pw)) gtk_statusbar_push(GTK_STATUSBAR(pwStatus), idOutput, _("Position ID copied to the clipboard")); } -#if (USE_GTKUIMANAGER) +#if defined(USE_GTKUIMANAGER) static void TogglePanel(guint UNUSED(iType), guint iActionID, GtkToggleAction * action, GtkToggleAction * UNUSED(alt), gpointer UNUSED(user_data)) { int f; - gnubgwindow panel = 0; + gnubgwindow panel = WINDOW_MAIN; f = gtk_toggle_action_get_active(action); switch (iActionID) { @@ -1528,7 +1529,7 @@ static void TogglePanel(gpointer UNUSED(p), guint n, GtkWidget * pw) { int f; - gnubgwindow panel = 0; + gnubgwindow panel = WINDOW_MAIN; g_assert(GTK_IS_CHECK_MENU_ITEM(pw)); @@ -1570,7 +1571,7 @@ GTKUndo(void) { BoardData *bd = BOARD(pwBoard)->board_data; -#if USE_BOARD3D +#if defined(USE_BOARD3D) RestrictiveRedraw(); #endif @@ -1585,12 +1586,12 @@ GTKUndo(void) UpdateTheoryData(bd, TT_RETURNHITS, msBoard()); } -#if USE_BOARD3D +#if defined(USE_BOARD3D) extern void SetSwitchModeMenuText(void) { /* Update menu text */ BoardData *bd = BOARD(pwBoard)->board_data; -#if (USE_GTKUIMANAGER) +#if defined(USE_GTKUIMANAGER) GtkWidget *pMenuItem = gtk_ui_manager_get_widget(puim, "/MainMenu/ViewMenu/SwitchMode"); #else @@ -1601,7 +1602,7 @@ SetSwitchModeMenuText(void) text = _("Switch to 3D view"); else text = _("Switch to 2D view"); -#if (USE_GTKUIMANAGER) +#if defined(USE_GTKUIMANAGER) gtk_label_set_text(GTK_LABEL(gtk_bin_get_child(GTK_BIN(pMenuItem))), text); #else gtk_label_set_text(GTK_LABEL(gtk_bin_get_child(GTK_BIN(pMenuItem))), text); @@ -1647,7 +1648,7 @@ SwitchDisplayMode(gpointer UNUSED(p), guint UNUSED(n), GtkWidget * UNUSED(pw)) #endif -#if (USE_GTKUIMANAGER) +#if defined(USE_GTKUIMANAGER) static void ToggleShowingIDs(GtkToggleAction * action, gpointer UNUSED(user_data)) { @@ -1678,7 +1679,7 @@ ShowToolbar(void) gtk_widget_show(pwToolbar); gtk_widget_show(pwHandle); -#if (USE_GTKUIMANAGER) +#if defined(USE_GTKUIMANAGER) gtk_widget_show((gtk_ui_manager_get_widget(puim, "/MainMenu/ViewMenu/ToolBarMenu/HideToolBar"))); gtk_widget_hide((gtk_ui_manager_get_widget(puim, "/MainMenu/ViewMenu/ToolBarMenu/ShowToolBar"))); gtk_widget_set_sensitive((gtk_ui_manager_get_widget(puim, "/MainMenu/ViewMenu/ToolBarMenu/TextOnly")), TRUE); @@ -1701,7 +1702,7 @@ HideToolbar(void) gtk_widget_hide(pwToolbar); gtk_widget_hide(pwHandle); -#if (USE_GTKUIMANAGER) +#if defined(USE_GTKUIMANAGER) gtk_widget_hide((gtk_ui_manager_get_widget(puim, "/MainMenu/ViewMenu/ToolBarMenu/HideToolBar"))); gtk_widget_show((gtk_ui_manager_get_widget(puim, "/MainMenu/ViewMenu/ToolBarMenu/ShowToolBar"))); gtk_widget_set_sensitive((gtk_ui_manager_get_widget(puim, "/MainMenu/ViewMenu/ToolBarMenu/TextOnly")), FALSE); @@ -1747,7 +1748,7 @@ DoFullScreenMode(gpointer UNUSED(p), guint UNUSED(n), GtkWidget * UNUSED(pw)) static gulong id; static int changedRP, changedDP; -#if (USE_GTKUIMANAGER) +#if defined(USE_GTKUIMANAGER) GtkWidget *pmiRP = gtk_ui_manager_get_widget(puim, "/MainMenu/ViewMenu/RestorePanels"); GtkWidget *pmiDP = gtk_ui_manager_get_widget(puim, "/MainMenu/ViewMenu/DockPanels"); #else @@ -1755,13 +1756,13 @@ DoFullScreenMode(gpointer UNUSED(p), guint UNUSED(n), GtkWidget * UNUSED(pw)) GtkWidget *pmiDP = gtk_item_factory_get_widget(pif, "/View/Dock panels"); #endif -#if USE_BOARD3D +#if defined(USE_BOARD3D) if (display_is_3d(bd->rd)) { /* Stop any 3d animations */ StopIdle3d(bd, bd->bd3d); } #endif -#if (USE_GTKUIMANAGER) +#if defined(USE_GTKUIMANAGER) fFullScreen = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(gtk_ui_manager_get_widget(puim, "/MainMenu/ViewMenu/FullScreen"))); #else @@ -1821,7 +1822,7 @@ DoFullScreenMode(gpointer UNUSED(p), guint UNUSED(n), GtkWidget * UNUSED(pw)) gtk_widget_show(pwHandle); } gtk_widget_show(GTK_WIDGET(bd->table)); -#if USE_BOARD3D +#if defined(USE_BOARD3D) /* Only show 2d dice below board if in 2d */ if (display_is_2d(bd->rd)) #endif @@ -1860,7 +1861,7 @@ extern void FullScreenMode(int state) { BoardData *bd = BOARD(pwBoard)->board_data; -#if (USE_GTKUIMANAGER) +#if defined(USE_GTKUIMANAGER) GtkWidget *pw = gtk_ui_manager_get_widget(puim, "/MainMenu/ViewMenu/FullScreen"); #else @@ -2782,18 +2783,18 @@ static void PlayersOK(GtkWidget * pw, playerswidget * pplw) { - int i, j; + int i; + playertype j; *pplw->pfOK = TRUE; for (i = 0; i < 2; i++) { strcpyn(pplw->ap[i].szName, gtk_entry_get_text(GTK_ENTRY(pplw->apwName[i])), MAX_NAME_LEN); - for (j = 0; j < 3; j++) + for (j = (playertype) 0; j < (playertype) 3; j++) if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pplw->apwRadio[i][j]))) { pplw->ap[i].pt = j; break; } - g_assert(j < 4); strcpyn(pplw->aszSocket[i], gtk_entry_get_text(GTK_ENTRY(pplw->apwSocket[i])), 128); } @@ -2893,6 +2894,7 @@ static char *aaszLang[][3] = { {N_("English (US)"), "en_US", "flags/usa.png"}, {N_("French"), "fr_FR", "flags/france.png"}, {N_("German"), "de_DE", "flags/germany.png"}, + {N_("Greek"), "el_GR", "flags/greece.png"}, {N_("Icelandic"), "is_IS", "flags/iceland.png"}, {N_("Italian"), "it_IT", "flags/italy.png"}, {N_("Japanese"), "ja_JP", "flags/japan.png"}, @@ -3088,7 +3090,7 @@ AddLangWidgets(GtkWidget * cont) GtkWidget *flag = GetFlagWidget(aaszLang[i + 1][0], aaszLang[i + 1][1], aaszLang[i + 1][2]); int row = i / NUM_COLS; int col = i - row * NUM_COLS; - gtk_table_attach(GTK_TABLE(pwLangTable), flag, col, col + 1, row, row + 1, 0, 0, 0, 0); + gtk_table_attach(GTK_TABLE(pwLangTable), flag, col, col + 1, row, row + 1, (GtkAttachOptions) 0, (GtkAttachOptions) 0, 0, 0); if (!StrCaseCmp(szLang, aaszLang[i + 1][1])) selLang = flag; } @@ -3139,7 +3141,7 @@ ReportBug(gpointer UNUSED(p), guint UNUSED(n), GtkWidget * UNUSED(pwEvent)) OpenURL("http://savannah.gnu.org/bugs/?func=additem&group=gnubg"); } -#if (USE_GTKUIMANAGER) +#if defined(USE_GTKUIMANAGER) static GtkActionEntry actionEntries[] = { {"FileMenuAction", NULL, N_("_File"), NULL, NULL, G_CALLBACK(NULL)}, @@ -3177,7 +3179,7 @@ static GtkActionEntry actionEntries[] = { {"HideToolBarAction", NULL, N_("_Hide Toolbar"), NULL, NULL, G_CALLBACK(HideToolbar)}, {"ShowToolBarAction", NULL, N_("_Show Toolbar"), NULL, NULL, G_CALLBACK(ShowToolbar)}, -#if USE_BOARD3D +#if defined(USE_BOARD3D) {"SwitchModeAction", NULL, N_("Switch to xD view"), NULL, NULL, G_CALLBACK(SwitchDisplayMode)}, #endif @@ -3400,7 +3402,7 @@ static GtkItemFactoryEntry aife[] = { {N_("/_View/Full screen"), "F11", DoFullScreenMode, 0, "<CheckItem>", NULL}, {N_("/_View/-"), NULL, NULL, 0, "<Separator>", NULL}, {N_("/_View/Play _Clockwise"), NULL, click_swapdirection, 0, "<CheckItem>", NULL}, -#if USE_BOARD3D +#if defined(USE_BOARD3D) {N_("/_View/-"), NULL, NULL, 0, "<Separator>", NULL}, {N_("/_View/Switch to xD view"), NULL, SwitchDisplayMode, TOOLBAR_ACTION_OFFSET + MENU_OFFSET, NULL, NULL}, #endif @@ -3540,8 +3542,6 @@ static GtkItemFactoryEntry aife[] = { }; #endif -extern int automaticTask; - static void Stop(GtkWidget * pw, gpointer UNUSED(unused)) { @@ -3551,7 +3551,7 @@ Stop(GtkWidget * pw, gpointer UNUSED(unused)) return; fInterrupt = TRUE; -#if USE_BOARD3D +#if defined(USE_BOARD3D) { BoardData *bd = BOARD(pwBoard)->board_data; if (display_is_3d(bd->rd)) { @@ -3566,7 +3566,7 @@ Stop(GtkWidget * pw, gpointer UNUSED(unused)) static gboolean StopAnyAnimations(void) { -#if USE_BOARD3D +#if defined(USE_BOARD3D) BoardData *bd = BOARD(pwBoard)->board_data; if (display_is_3d(bd->rd)) { @@ -3663,7 +3663,7 @@ CreateMainWindow(void) gtk_container_add(GTK_CONTAINER(pwMain), pwVbox = gtk_vbox_new(FALSE, 0)); -#if (USE_GTKUIMANAGER) +#if defined(USE_GTKUIMANAGER) GError *error = NULL; GtkActionGroup *action_group; @@ -3685,7 +3685,7 @@ CreateMainWindow(void) g_error_free(error); error = NULL; } -#if USE_BOARD3D +#if defined(USE_BOARD3D) gtk_ui_manager_add_ui_from_string(puim, UIADDITIONS3D, -1, &error); if (error) { g_warning("Cannot load UI: %s", error->message); @@ -3712,7 +3712,7 @@ CreateMainWindow(void) gtk_window_add_accel_group(GTK_WINDOW(pwMain), pagMain); #endif gtk_box_pack_start(GTK_BOX(pwVbox), pwHandle = gtk_handle_box_new(), FALSE, FALSE, 0); -#if (USE_GTKUIMANAGER) +#if defined(USE_GTKUIMANAGER) pwMenuBar = gtk_ui_manager_get_widget(puim, "/MainMenu"); gtk_container_add(GTK_CONTAINER(pwHandle), pwMenuBar); @@ -3739,7 +3739,7 @@ CreateMainWindow(void) gtk_box_pack_start(GTK_BOX(pwPanelHbox), pwPanelVbox = gtk_vbox_new(FALSE, 1), TRUE, TRUE, 0); /* Do this so that the menu is packed now instead of in the idle loop */ -#if (USE_GTKUIMANAGER) +#if defined(USE_GTKUIMANAGER) gtk_ui_manager_ensure_update(puim); #endif @@ -3876,7 +3876,7 @@ InitGTK(int *argc, char ***argv) gnubg_stock_init(); -#if USE_BOARD3D +#if defined(USE_BOARD3D) InitGTK3d(argc, argv); #endif @@ -3906,7 +3906,7 @@ static int reasonExited; extern void RunGTK(GtkWidget * pwSplash, char *commands, char *python_script, char *match) { -#if USE_BOARD3D +#if defined(USE_BOARD3D) /* Use 1st predefined board settings if none have been loaded */ Default3dSettings(BOARD(pwBoard)->board_data); #endif @@ -3926,7 +3926,7 @@ RunGTK(GtkWidget * pwSplash, char *commands, char *python_script, char *match) GTKAllowStdin(); if (fTTY) { -#if HAVE_LIBREADLINE +#if defined(HAVE_LIB_READLINE) fReadingCommand = TRUE; rl_callback_handler_install(FormatPrompt(), ProcessInput); atexit(rl_callback_handler_remove); @@ -3948,7 +3948,7 @@ RunGTK(GtkWidget * pwSplash, char *commands, char *python_script, char *match) int style = nToolbarStyle; nToolbarStyle = 2; /* Default style is fine */ SetToolbarStyle(style); -#if (USE_GTKUIMANAGER) +#if defined(USE_GTKUIMANAGER) gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_ui_manager_get_widget(puim, "/MainMenu/ViewMenu/ToolBarMenu/Both")), nToolbarStyle); @@ -3956,7 +3956,7 @@ RunGTK(GtkWidget * pwSplash, char *commands, char *python_script, char *match) } -#if USE_BOARD3D +#if defined(USE_BOARD3D) { BoardData *bd = BOARD(pwBoard)->board_data; BoardData3d *bd3d = bd->bd3d; @@ -3976,7 +3976,7 @@ RunGTK(GtkWidget * pwSplash, char *commands, char *python_script, char *match) /* Make sure some things stay hidden */ if (!ArePanelsDocked()) { gtk_widget_hide(hpaned); -#if (USE_GTKUIMANAGER) +#if defined(USE_GTKUIMANAGER) gtk_widget_hide((gtk_ui_manager_get_widget(puim, "/MainMenu/ViewMenu/PanelsMenu/Commentary"))); gtk_widget_hide((gtk_ui_manager_get_widget(puim, "/MainMenu/ViewMenu/HidePanels"))); gtk_widget_hide((gtk_ui_manager_get_widget(puim, "/MainMenu/ViewMenu/RestorePanels"))); @@ -3987,14 +3987,14 @@ RunGTK(GtkWidget * pwSplash, char *commands, char *python_script, char *match) #endif } else { if (ArePanelsShowing()) { -#if (USE_GTKUIMANAGER) +#if defined(USE_GTKUIMANAGER) gtk_widget_hide((gtk_ui_manager_get_widget(puim, "/MainMenu/ViewMenu/RestorePanels"))); #else gtk_widget_hide(gtk_item_factory_get_widget(pif, "/View/Restore panels")); #endif gtk_widget_hide(pwGameBox); } else -#if (USE_GTKUIMANAGER) +#if defined(USE_GTKUIMANAGER) gtk_widget_hide((gtk_ui_manager_get_widget(puim, "/MainMenu/ViewMenu/HidePanels"))); #else gtk_widget_hide(gtk_item_factory_get_widget(pif, "/View/Hide panels")); @@ -4009,7 +4009,7 @@ RunGTK(GtkWidget * pwSplash, char *commands, char *python_script, char *match) ShowBoard(); if (fToolbarShowing) -#if (USE_GTKUIMANAGER) +#if defined(USE_GTKUIMANAGER) gtk_widget_hide((gtk_ui_manager_get_widget(puim, "/MainMenu/ViewMenu/ToolBarMenu/ShowToolBar"))); #else gtk_widget_hide(gtk_item_factory_get_widget(pif, "/View/Toolbar/Show Toolbar")); @@ -4123,7 +4123,7 @@ static void TutorRethink(GtkWidget * pw, void *UNUSED(unused)) { -#if USE_BOARD3D +#if defined(USE_BOARD3D) RestrictiveRedraw(); #endif gtk_widget_destroy(gtk_widget_get_toplevel(pw)); @@ -4499,12 +4499,12 @@ NewSet(newwidget * pnw) extern void GTKNew(void) { - GtkWidget *pwDialog, *pwPage; + GtkWidget *pwDialog; newwidget nw; GtkAllocation allocation; pwDialog = GTKCreateDialog(_("GNU Backgammon - New"), DT_QUESTION, NULL, DIALOG_FLAG_MODAL, G_CALLBACK(NewOK), &nw); - gtk_container_add(GTK_CONTAINER(DialogArea(pwDialog, DA_MAIN)), pwPage = NewWidget(&nw)); + gtk_container_add(GTK_CONTAINER(DialogArea(pwDialog, DA_MAIN)), NewWidget(&nw)); gtk_widget_get_allocation(pwToolbar, &allocation); gtk_widget_set_size_request(pwToolbar, allocation.width, allocation.height); @@ -5004,7 +5004,7 @@ gtk_save_rollout_settings(void) } errno = 0; - pf = g_fopen(filename, "w"); + pf = gnubg_g_fopen(filename, "w"); if (!pf) { outputerr(filename); g_free(filename); @@ -5113,20 +5113,20 @@ SetRollouts(gpointer UNUSED(p), guint UNUSED(n), GtkWidget * UNUSED(pwIgnore)) gtk_box_pack_start(GTK_BOX(pwVBox), pwTable, FALSE, FALSE, 0); rw.analysisDetails[0] = RolloutPage(rw.prpwPages[0], _("First Play (0) "), TRUE, &rw.frame[0]); gtk_table_attach(GTK_TABLE(pwTable), gtk_widget_get_parent(rw.analysisDetails[0]->pwSettingWidgets), 0, 1, 0, 1, - 0, 0, 4, 4); + (GtkAttachOptions) 0, (GtkAttachOptions) 0, 4, 4); rw.analysisDetails[1] = RolloutPage(rw.prpwPages[1], _("First Play (1) "), TRUE, NULL); gtk_table_attach(GTK_TABLE(pwTable), gtk_widget_get_parent(rw.analysisDetails[1]->pwSettingWidgets), 1, 2, 0, 1, - 0, 0, 4, 4); + (GtkAttachOptions) 0, (GtkAttachOptions) 0, 4, 4); rw.analysisDetails[2] = RolloutPage(rw.prpwPages[2], _("Later Play (0) "), TRUE, &rw.frame[1]); gtk_table_attach(GTK_TABLE(pwTable), gtk_widget_get_parent(rw.analysisDetails[2]->pwSettingWidgets), 0, 1, 1, 2, - 0, 0, 4, 4); + (GtkAttachOptions) 0, (GtkAttachOptions) 0, 4, 4); rw.analysisDetails[3] = RolloutPage(rw.prpwPages[3], _("Later Play (1) "), TRUE, NULL); gtk_table_attach(GTK_TABLE(pwTable), gtk_widget_get_parent(rw.analysisDetails[3]->pwSettingWidgets), 1, 2, 1, 2, - 0, 0, 4, 4); + (GtkAttachOptions) 0, (GtkAttachOptions) 0, 4, 4); rw.prpwTrunc->pmf = NULL; rw.analysisDetails[4] = RolloutPage(rw.prpwTrunc, _("Truncation Pt."), FALSE, NULL); gtk_table_attach(GTK_TABLE(pwTable), gtk_widget_get_parent(rw.analysisDetails[4]->pwSettingWidgets), 0, 1, 2, 3, - 0, 0, 4, 4); + (GtkAttachOptions) 0, (GtkAttachOptions) 0, 4, 4); RPGeneral.pwPlayersAreSame = gtk_check_button_new_with_label(_("Use same settings for both players")); gtk_box_pack_start(GTK_BOX(pwVBox), RPGeneral.pwPlayersAreSame, FALSE, FALSE, 0); @@ -5247,7 +5247,7 @@ SetRollouts(gpointer UNUSED(p), guint UNUSED(n), GtkWidget * UNUSED(pwIgnore)) } if (rw.rcRollout.nTruncate != rcRollout.nTruncate) { - sprintf(sz, "set rollout truncation plies %d", rw.rcRollout.nTruncate); + sprintf(sz, "set rollout truncation plies %u", rw.rcRollout.nTruncate); UserCommand(sz); } @@ -5294,7 +5294,7 @@ SetRollouts(gpointer UNUSED(p), guint UNUSED(n), GtkWidget * UNUSED(pwIgnore)) if (rw.rcRollout.nLate != rcRollout.nLate) { - sprintf(sz, "set rollout late plies %d", rw.rcRollout.nLate); + sprintf(sz, "set rollout late plies %u", rw.rcRollout.nLate); UserCommand(sz); } @@ -5341,7 +5341,7 @@ SetRollouts(gpointer UNUSED(p), guint UNUSED(n), GtkWidget * UNUSED(pwIgnore)) } void -GTKTextWindow(const char *szOutput, const char *title, const int type, GtkWidget * parent) +GTKTextWindow(const char *szOutput, const char *title, const dialogtype type, GtkWidget * parent) { GtkWidget *pwDialog = GTKCreateDialog(title, type, parent, 0, NULL, NULL); @@ -5603,7 +5603,7 @@ GTKProgressEnd(void) gtk_progress_bar_set_text(GTK_PROGRESS_BAR(pwProgress), " "); gtk_statusbar_pop(GTK_STATUSBAR(pwStatus), idProgress); - SetMouseCursor(0); + SetMouseCursor(GDK_X_CURSOR); } extern void @@ -6181,7 +6181,7 @@ GTKSet(void *p) if (p == ap) { /* Handle the player names. */ -#if (USE_GTKUIMANAGER) +#if defined(USE_GTKUIMANAGER) gtk_label_set_text(GTK_LABEL (gtk_bin_get_child (GTK_BIN(gtk_ui_manager_get_widget(puim, "/MainMenu/GameMenu/SetTurnMenu/SetTurnPlayer0") @@ -6210,7 +6210,7 @@ GTKSet(void *p) } else if (p == &ms.fTurn) { /* Handle the player on roll. */ fAutoCommand = TRUE; -#if (USE_GTKUIMANAGER) +#if defined(USE_GTKUIMANAGER) if (ms.fTurn >= 0) { if (ms.fTurn) gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_ui_manager_get_widget(puim, @@ -6242,7 +6242,7 @@ GTKSet(void *p) board_set_playing(BOARD(pwBoard), plGame != NULL); ToolbarSetPlaying(pwToolbar, plGame != NULL); -#if (USE_GTKUIMANAGER) +#if defined(USE_GTKUIMANAGER) gtk_widget_set_sensitive(gtk_ui_manager_get_widget(puim, "/MainMenu/FileMenu/Save"), plGame != NULL); enable_menu(gtk_ui_manager_get_widget(puim, "/MainMenu/GameMenu"), ms.gs == GAME_PLAYING); if (ms.fTurn >= 0) @@ -6413,7 +6413,7 @@ GTKSet(void *p) ShowHidePanel(WINDOW_COMMAND); } else if (p == &bd->rd->fDiceArea) { if (gtk_widget_get_realized(pwBoard)) { -#if USE_BOARD3D +#if defined(USE_BOARD3D) /* If in 3d mode may need to update sizes */ if (display_is_3d(bd->rd)) SetupViewingVolume3d(bd, bd->bd3d, bd->rd); @@ -6430,7 +6430,7 @@ GTKSet(void *p) } } else if (p == &fShowIDs) { inCallback = TRUE; -#if (USE_GTKUIMANAGER) +#if defined(USE_GTKUIMANAGER) gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_ui_manager_get_widget(puim, "/MainMenu/ViewMenu/ShowIDStatusBar")), fShowIDs); @@ -6457,8 +6457,8 @@ GTKSet(void *p) /* Match stats variables */ -#define FORMATGS_ALL -1 -#define NUM_STAT_TYPES 4 +#define NUM_STAT_TYPES (FORMATGS_OVERALL - FORMATGS_ALL) + static char *aszStatHeading[NUM_STAT_TYPES] = { N_("Chequer Play Statistics:"), N_("Cube Statistics:"), @@ -6653,7 +6653,8 @@ AddNavigation(GtkWidget * pvbox) sprintf(sz, _("All games: %s %d, %s %d"), ap[0].szName, anFinalScore[0], ap[1].szName, anFinalScore[1]); else sprintf(sz, _("All games: %s, %s"), ap[0].szName, ap[1].szName); - phbox = gtk_hbox_new(FALSE, 0), gtk_box_pack_start(GTK_BOX(pvbox), phbox, FALSE, FALSE, 4); + phbox = gtk_hbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(pvbox), phbox, FALSE, FALSE, 4); pw = button_from_image(gtk_image_new_from_stock(GNUBG_STOCK_GO_PREV_GAME, GTK_ICON_SIZE_LARGE_TOOLBAR)); g_signal_connect(G_OBJECT(pw), "clicked", G_CALLBACK(StatsPreviousGame), box); gtk_box_pack_start(GTK_BOX(phbox), pw, FALSE, FALSE, 0); @@ -6717,19 +6718,18 @@ StatcontextCopy(GtkWidget * UNUSED(pw), GtkTreeView * view) GtkTreeIter iter; gchar *sz; GtkTreePath *path = row->data; - gchar *pc; gtk_tree_model_get_iter(model, &iter, path); gtk_tree_model_get(model, &iter, 0, &sz, -1); - sprintf(pc = strchr(szOutput, 0), "%-37s ", sz ? sz : ""); + sprintf(strchr(szOutput, 0), "%-37s ", sz ? sz : ""); g_free(sz); gtk_tree_model_get(model, &iter, 1, &sz, -1); - sprintf(pc = strchr(szOutput, 0), "%-20s ", sz ? sz : ""); + sprintf(strchr(szOutput, 0), "%-20s ", sz ? sz : ""); g_free(sz); gtk_tree_model_get(model, &iter, 2, &sz, -1); - sprintf(pc = strchr(szOutput, 0), "%-20s\n", sz ? sz : ""); + sprintf(strchr(szOutput, 0), "%-20s\n", sz ? sz : ""); g_free(sz); gtk_tree_path_free(path); @@ -6790,7 +6790,8 @@ GTKDumpStatcontext(int game) { GtkWidget *copyMenu, *menu_item, *pvbox, *pwUsePanels; GtkWidget *navi_combo; -#if USE_BOARD3D + GtkWidget *addToDbButton; +#if defined(USE_BOARD3D) int i; GtkWidget *pw; listOLD *pl; @@ -6798,11 +6799,16 @@ GTKDumpStatcontext(int game) #endif pwStatDialog = GTKCreateDialog("", DT_INFO, NULL, DIALOG_FLAG_MODAL, NULL, NULL); + gtk_container_add(GTK_CONTAINER(DialogArea(pwStatDialog, DA_BUTTONS)), + addToDbButton = gtk_button_new_with_label(_("Add to DB"))); + g_signal_connect(addToDbButton, "clicked", G_CALLBACK(GtkRelationalAddMatch), pwStatDialog); + pwNotebook = gtk_notebook_new(); gtk_notebook_set_scrollable(GTK_NOTEBOOK(pwNotebook), TRUE); gtk_notebook_popup_disable(GTK_NOTEBOOK(pwNotebook)); - pvbox = gtk_vbox_new(FALSE, 0), gtk_box_pack_start(GTK_BOX(pvbox), pwNotebook, TRUE, TRUE, 0); + pvbox = gtk_vbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(pvbox), pwNotebook, TRUE, TRUE, 0); gtk_notebook_append_page(GTK_NOTEBOOK(pwNotebook), statViews[FORMATGS_OVERALL] = CreateList(), gtk_label_new(_("Overall"))); @@ -6827,7 +6833,7 @@ GTKDumpStatcontext(int game) navi_combo = AddNavigation(pvbox); gtk_container_add(GTK_CONTAINER(DialogArea(pwStatDialog, DA_MAIN)), pvbox); -#if USE_BOARD3D +#if defined(USE_BOARD3D) SetNumGames(gd, numStatGames); pl = lMatch.plNext; @@ -6899,7 +6905,7 @@ GTKDumpStatcontext(int game) GTKRunDialog(pwStatDialog); -#if USE_BOARD3D +#if defined(USE_BOARD3D) TidyGraphData(gd); #endif } @@ -6993,8 +6999,8 @@ GTKMatchInfo(void) char sz[128]; pwDialog = GTKCreateDialog(_("GNU Backgammon - Match information"), - DT_QUESTION, NULL, DIALOG_FLAG_MODAL, G_CALLBACK(MatchInfoOK), &fOK), - pwTable = gtk_table_new(5, 7, FALSE); + DT_QUESTION, NULL, DIALOG_FLAG_MODAL, G_CALLBACK(MatchInfoOK), &fOK); + pwTable = gtk_table_new(5, 7, FALSE); gtk_container_add(GTK_CONTAINER(DialogArea(pwDialog, DA_MAIN)), pwTable); sprintf(sz, _("%s's rating:"), ap[0].szName); @@ -7009,7 +7015,7 @@ GTKMatchInfo(void) AddToTable(pwTable, _("Place:"), 0, 5); AddToTable(pwTable, _("Annotator:"), 0, 6); - gtk_table_attach(GTK_TABLE(pwTable), gtk_label_new(_("Comments:")), 2, 3, 0, 1, 0, 0, 0, 0); + gtk_table_attach(GTK_TABLE(pwTable), gtk_label_new(_("Comments:")), 2, 3, 0, 1, (GtkAttachOptions)0, (GtkAttachOptions)0, 0, 0); apwRating[0] = gtk_entry_new(); if (mi.pchRating[0]) |