X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=nhistory.c;h=aa65b16dd8ab5017bc931dac64644d3e5ef6f92d;hb=5cab485d7a39f1b15558fc3b06d57d2164a7dc5d;hp=2cddab6b5dc087bf79f5506555c195ecd10a83b4;hpb=21a44c336aa8cd16a38f3c682386528c8f112650;p=xboard.git diff --git a/nhistory.c b/nhistory.c index 2cddab6..aa65b16 100644 --- a/nhistory.c +++ b/nhistory.c @@ -1,7 +1,7 @@ /* * New (WinBoard-style) Move history for XBoard * - * Copyright 2009, 2010, 2011, 2012 Free Software Foundation, Inc. + * Copyright 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Free Software Foundation, Inc. * ------------------------------------------------------------------------ * * GNU XBoard is free software: you can redistribute it and/or modify @@ -15,7 +15,7 @@ * General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. + * along with this program. If not, see http://www.gnu.org/licenses/. * * ------------------------------------------------------------------------ ** See the file ChangeLog for a revision history. */ @@ -26,8 +26,8 @@ #include #include "common.h" +#include "frontend.h" #include "backend.h" -#include "xhistory.h" #include "dialogs.h" #include "gettext.h" @@ -62,13 +62,33 @@ AppendToHistoryMemo (char * text, int bold, int colorNr) return AppendText(&historyOptions[0], text); // for now ignore bold & color stuff, as Xaw cannot handle that } +void +HighlightMove (int from, int to, Boolean highlight) +{ + HighlightText (&historyOptions[0], from, to, highlight); +} + char *historyText; +int +SelectMove (Option *opt, int n, int x, int y, char *text, int index) +{ + if(n != 3 && n != 1) return FALSE; // only on button-1 and 3 press + FindMoveByCharIndex( index ); // [HGM] also does the actual moving to it, now + return (n == 3); // suppress context menu for button 3, but allow selection with button 1 +} + Option historyOptions[] = { -{ 200, T_VSCRL | T_FILL | T_WRAP | T_TOP, 400, NULL, (void*) &historyText, "", NULL, TextBox, "" }, +{ 200, T_VSCRL | T_FILL | T_WRAP | T_TOP, 400, NULL, (void*) &historyText, NULL , (char**) &SelectMove, TextBox, "", &appData.historyFont }, { 0, NO_OK, 0, NULL, (void*) NULL, "", NULL, EndMark , "" } }; +void +ScrollToCurrent (int caretPos) +{ + ScrollToCursor(&historyOptions[0], caretPos); +} + // ------------ standard entry points into MoveHistory code ----------- Boolean @@ -86,8 +106,8 @@ MoveHistoryDialogExists () void HistoryPopUp () { - if(GenericPopUp(historyOptions, _("Move list"), HistoryDlg, BoardWindow, NONMODAL, 1)) - AddHandler(&historyOptions[0], 0); + if(GenericPopUp(historyOptions, _("Move list"), HistoryDlg, BoardWindow, NONMODAL, appData.topLevel)) + AddHandler(&historyOptions[0], HistoryDlg, 0); MarkMenu("View.MoveHistory", HistoryDlg); }