From: H.G. Muller Date: Mon, 9 May 2011 18:11:32 +0000 (+0200) Subject: Implement Edit Book in XBoard X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=1a04ba15645387771bde6f4ad03534722ec39314;p=xboard.git Implement Edit Book in XBoard --- diff --git a/xboard.c b/xboard.c index e5822a4..72c24da 100644 --- a/xboard.c +++ b/xboard.c @@ -463,6 +463,7 @@ void SoundOptionsProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms) void BoardOptionsProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms)); void LoadOptionsProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms)); void SaveOptionsProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms)); +void EditBookProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms)); void GameListOptionsPopDown P(()); void ShufflePopDown P(()); void TimeControlPopDown P(()); @@ -632,6 +633,7 @@ MenuItem editMenu[] = { {N_("Edit Position Ctrl+Shift+E"), "Edit Position", EditPositionProc}, {N_("Edit Tags"), "Edit Tags", EditTagsProc}, {N_("Edit Comment"), "Edit Comment", EditCommentProc}, + {N_("Edit Book"), "Edit Book", EditBookProc}, {"----", NULL, NothingProc}, {N_("Revert Home"), "Revert", RevertProc}, {N_("Annotate"), "Annotate", AnnotateProc}, @@ -942,6 +944,7 @@ XtActionsRec boardActions[] = { { "ShowGameListProc", ShowGameListProc }, { "ShowMoveListProc", HistoryShowProc}, { "EditTagsProc", EditCommentProc }, + { "EditBookProc", EditBookProc }, { "EditCommentProc", EditCommentProc }, { "IcsInputBoxProc", IcsInputBoxProc }, { "PauseProc", PauseProc }, diff --git a/xedittags.c b/xedittags.c index 27bb722..a83e47b 100644 --- a/xedittags.c +++ b/xedittags.c @@ -110,6 +110,7 @@ void EditTagsPopUp(tags, dest) void TagsPopDown() { PopDown(2); + bookUp = False; } void @@ -121,7 +122,7 @@ EditTagsProc(w, event, prms, nprms) { Arg args[5]; int j; - if (PopDown(2)) { + if (!bookUp && PopDown(2)) { j = 0; XtSetArg(args[j], XtNleftBitmap, None); j++; XtSetValues(XtNameToWidget(menuBarWidget, "menuView.Show Tags"), args, j); diff --git a/xoptions.c b/xoptions.c index 8592229..fd61145 100644 --- a/xoptions.c +++ b/xoptions.c @@ -1907,6 +1907,7 @@ void changeTags(int n) Arg args[16]; XtSetArg(args[0], XtNstring, &tagsText); XtGetValues(currentOption[1].handle, args, 1); + if(bookUp) SaveToBook(tagsText); else ReplaceTags(tagsText, &gameInfo); } @@ -1921,15 +1922,18 @@ void NewTagsPopup(char *text, char *msg) { Widget edit; Arg args[16]; + char *title = bookUp ? _("Edit book") : _("Tags"); if(shells[2]) { // if already exists, alter title and content XtSetArg(args[0], XtNstring, text); XtSetValues(tagsOptions[1].handle, args, 1); + XtSetArg(args[0], XtNtitle, title); + XtSetValues(shells[2], args, 1); } if(tagsText) free(tagsText); tagsText = strdup(text); tagsOptions[0].textValue = msg; MarkMenu("menuView.Show Tags", 2); - GenericPopUp(tagsOptions, _("Tags"), 2); + GenericPopUp(tagsOptions, title, 2); } char *icsText; @@ -2073,6 +2077,15 @@ void LoadEngineProc(w, event, prms, nprms) GenericPopUp(installOptions, _("Load engine"), 0); } +void EditBookProc(w, event, prms, nprms) + Widget w; + XEvent *event; + String *prms; + Cardinal *nprms; +{ + EditBookEvent(); +} + //---------------------------- Chat Windows ---------------------------------------------- void OutputChatMessage(int partner, char *mess)