{N_("New Shuffle Game ..."), "NewShuffleGame", ShuffleMenuProc},
{N_("New Variant ... Alt+Shift+V"), "NewVariant", NewVariantProc}, // [HGM] variant: not functional yet
{"----", NULL, NothingProc},
- {N_("Load Game Ctrl+O"), "LoadGame", LoadGameProc},
+ {N_("Load Game Ctrl+O"), "LoadGame", LoadGameProc, CHECK},
{N_("Load Position Ctrl+Shift+O"), "LoadPosition", LoadPositionProc},
// {N_("Load Next Game"), "LoadNextGame", LoadNextGameProc},
// {N_("Load Previous Game"), "LoadPreviousGame", LoadPrevGameProc},
};
MenuItem viewMenu[] = {
- {N_("Flip View F2"), "FlipView", FlipViewProc},
+ {N_("Flip View F2"), "FlipView", FlipViewProc, CHECK},
{"----", NULL, NothingProc},
- {N_("Engine Output Alt+Shift+O"), "EngineOutput", EngineOutputProc},
- {N_("Move History Alt+Shift+H"), "MoveHistory", HistoryShowProc}, // [HGM] hist: activate 4.2.7 code
- {N_("Evaluation Graph Alt+Shift+E"), "EvaluationGraph", EvalGraphProc},
- {N_("Game List Alt+Shift+G"), "GameList", ShowGameListProc},
- {N_("ICS text menu"), "ICStextmenu", IcsTextProc},
+ {N_("Engine Output Alt+Shift+O"), "EngineOutput", EngineOutputProc, CHECK},
+ {N_("Move History Alt+Shift+H"), "MoveHistory", HistoryShowProc, CHECK}, // [HGM] hist: activate 4.2.7 code
+ {N_("Evaluation Graph Alt+Shift+E"), "EvaluationGraph", EvalGraphProc, CHECK},
+ {N_("Game List Alt+Shift+G"), "GameList", ShowGameListProc, CHECK},
+ {N_("ICS text menu"), "ICStextmenu", IcsTextProc, CHECK},
{"----", NULL, NothingProc},
- {N_("Tags"), "Tags", EditTagsProc},
- {N_("Comments"), "Comments", EditCommentProc},
- {N_("ICS Input Box"), "ICSInputBox", IcsInputBoxProc},
- {N_("Open Chat Window"), "OpenChatWindow", ChatProc},
+ {N_("Tags"), "Tags", EditTagsProc, CHECK},
+ {N_("Comments"), "Comments", EditCommentProc, CHECK},
+ {N_("ICS Input Box"), "ICSInputBox", IcsInputBoxProc, CHECK},
+ {N_("Open Chat Window"), "OpenChatWindow", ChatProc, CHECK},
{"----", NULL, NothingProc},
{N_("Board..."), "Board", BoardOptionsProc},
{N_("Game List Tags..."), "GameListTags", GameListOptionsProc},
};
MenuItem modeMenu[] = {
- {N_("Machine White Ctrl+W"), "MachineWhite", MachineWhiteEvent},
- {N_("Machine Black Ctrl+B"), "MachineBlack", MachineBlackEvent},
- {N_("Two Machines Ctrl+T"), "TwoMachines", TwoMachinesEvent},
- {N_("Analysis Mode Ctrl+A"), "AnalysisMode", (MenuProc*) AnalyzeModeEvent},
- {N_("Analyze Game Ctrl+G"), "AnalyzeFile", AnalyzeFileEvent },
- {N_("Edit Game Ctrl+E"), "EditGame", EditGameEvent},
- {N_("Edit Position Ctrl+Shift+E"), "EditPosition", EditPositionEvent},
- {N_("Training"), "Training", TrainingEvent},
- {N_("ICS Client"), "ICSClient", IcsClientEvent},
+ {N_("Machine White Ctrl+W"), "MachineWhite", MachineWhiteEvent, RADIO },
+ {N_("Machine Black Ctrl+B"), "MachineBlack", MachineBlackEvent, RADIO },
+ {N_("Two Machines Ctrl+T"), "TwoMachines", TwoMachinesEvent, RADIO },
+ {N_("Analysis Mode Ctrl+A"), "AnalysisMode", (MenuProc*) AnalyzeModeEvent, RADIO},
+ {N_("Analyze Game Ctrl+G"), "AnalyzeFile", AnalyzeFileEvent, RADIO },
+ {N_("Edit Game Ctrl+E"), "EditGame", EditGameEvent, RADIO },
+ {N_("Edit Position Ctrl+Shift+E"), "EditPosition", EditPositionEvent, RADIO },
+ {N_("Training"), "Training", TrainingEvent, RADIO },
+ {N_("ICS Client"), "ICSClient", IcsClientEvent, RADIO },
{"----", NULL, NothingProc},
- {N_("Machine Match"), "MachineMatch", MatchProc},
- {N_("Pause Pause"), "Pause", PauseEvent},
+ {N_("Machine Match"), "MachineMatch", MatchProc, CHECK },
+ {N_("Pause Pause"), "Pause", PauseEvent, CHECK },
{NULL, NULL, NULL}
};
{"----", NULL, NothingProc},
#endif
{N_("Save Settings Now"), "SaveSettingsNow", SaveSettingsProc},
- {N_("Save Settings on Exit"), "SaveSettingsonExit", SaveOnExitProc},
+ {N_("Save Settings on Exit"), "SaveSettingsonExit", SaveOnExitProc, CHECK },
{NULL, NULL, NULL}
};
{
MenuItem *item = MenuNameToItem(menuRef);
-#ifdef TODO_GTK
if(item) {
- Arg args[2];
- XtSetArg(args[0], XtNleftBitmap, state ? xMarkPixmap : None);
- XtSetValues(item->handle, args, 1);
+ ((GtkCheckMenuItem *) (item->handle))->active = state;
}
-#endif
}
void GetWidgetTextGTK(GtkWidget *w, char **buf)
#endif
}
-/* Sets a check box on (True) or off (False) in the menu */
-void SetCheckMenuItemActive(gchar *name, int menuDlgNr, gboolean active)
-{
-#ifdef TODO_GTK
-// This doesn't work anymore, as we don't use builder
- gchar menuItemName[50];
-
- if (name != NULL)
- strcpy(menuItemName, name);
- else
- GetMenuItemName(menuDlgNr, menuItemName);
-
- if (strcmp(menuItemName, "") == 0) return;
-
- GtkCheckMenuItem *chk;
- chk = GTK_CHECK_MENU_ITEM(gtk_builder_get_object(GTK_BUILDER(builder), menuItemName));
- if (chk == NULL) {
- printf("Error: failed to get check menu item %s from builder\n", menuItemName);
- return;
- }
- chk->active = active; // set the check box without emitting any signals
-#endif
-}
-
int
PopDown (DialogClass n)
{
gtk_widget_destroy(shells[n]);
shells[n] = NULL;
}
-#ifdef TODO_GTK
+
if(marked[n]) {
MarkMenuItem(marked[n], False);
marked[n] = NULL;
}
-#else
- // when popping down uncheck the check box of the menu item
- SetCheckMenuItemActive(NULL, n, False);
-#endif
+
if(!n) currentCps = NULL; // if an Engine Settings dialog was up, we must be popping it down now
currentOption = dialogOptions[TransientDlg]; // just in case a transient dialog was up (to allow its check and combo callbacks to work)
#ifdef TODO_GTK
#endif
static void
-GraphEventProc(GtkWidget *widget, GdkEventExpose *event, gpointer gdata)
+GraphEventProc(GtkWidget *widget, GdkEvent *event, gpointer gdata)
{ // handle expose and mouse events on Graph widget
int w, h;
int j, button=10, f=1, sizing=0;
PointerCallback *userHandler = graph->target;
GdkEventExpose *eevent = (GdkEventExpose *) event;
GdkEventButton *bevent = (GdkEventButton *) event;
- GdkEventMotion *mevent = (GdkEventButton *) event;
+ GdkEventMotion *mevent = (GdkEventMotion *) event;
cairo_t *cr;
// if (!XtIsRealized(widget)) return;
GdkEventExpose e;
if(!opt->handle) return;
e.area.x = x; e.area.y = y; e.area.width = w; e.area.height = h; e.count = -1; e.type = GDK_EXPOSE; // count = -1: kludge to suppress sizing
- GraphEventProc(opt->handle, (GdkEvent *) &e, (gpointer) opt); // fake expose event
+ GraphEventProc(opt->handle, (GdkEvent// gtk_check_menu_item_set_active((GtkCheckMenuItem *) item->handle, state);
+ *) &e, (gpointer) opt); // fake expose event
}
/* GTK callback used when OK/cancel clicked in genericpopup for non-modal dialog */
g_signal_connect (graph, "button-press-event", G_CALLBACK (GraphEventProc), (gpointer) &option[i]);
g_signal_connect (graph, "button-release-event", G_CALLBACK (GraphEventProc), (gpointer) &option[i]);
g_signal_connect (graph, "motion-notify-event", G_CALLBACK (GraphEventProc), (gpointer) &option[i]);
-// g_signal_connect (graph, "motion-event", G_CALLBACK (GraphEventProc), (gpointer) &option[i]);
#ifdef TODO_GTK
XtAddEventHandler(last, ExposureMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask, False,