X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=winboard%2Fwclipbrd.c;h=4d0fac9d11b92a67ae15d390896ef693c8b12fc5;hb=d016fb202fe45795e630e22ba516e754cf694ea6;hp=55b9dfd712e2fb0674d3083aca7b4a0ac4e34852;hpb=0efdc4c5ef60cf4c15e9dddf3658d2115e4d5d93;p=xboard.git diff --git a/winboard/wclipbrd.c b/winboard/wclipbrd.c index 55b9dfd..4d0fac9 100644 --- a/winboard/wclipbrd.c +++ b/winboard/wclipbrd.c @@ -1,25 +1,27 @@ /* * wclipbrd.c -- Clipboard routines for WinBoard - * $Id: wclipbrd.c,v 2.1 2003/10/27 19:21:02 mann Exp $ * - * Copyright 2000 Free Software Foundation, Inc. + * Copyright 2000,2009 Free Software Foundation, Inc. + * + * Enhancements Copyright 2005 Alessandro Scotti * * ------------------------------------------------------------------------ - * This program is free software; you can redistribute it and/or modify + * + * GNU XBoard is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * the Free Software Foundation, either version 3 of the License, or (at + * your option) any later version. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU XBoard is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * ------------------------------------------------------------------------ - */ + * along with this program. If not, see http://www.gnu.org/licenses/. * + * + *------------------------------------------------------------------------ + ** See the file ChangeLog for a revision history. */ #include "config.h" @@ -37,6 +39,7 @@ /* Imports from winboard.c */ extern HWND hwndMain; +Boolean ParseFEN(Board b, int *stm, char *FEN); /* File globals */ static char *copyTemp; @@ -47,7 +50,7 @@ CopyFENToClipboard() { char *fen = NULL; - fen = PositionToFEN(currentMove,1); + fen = PositionToFEN(currentMove, NULL); if (!fen) { DisplayError("Unable to convert position to FEN.", 0); return; @@ -197,7 +200,7 @@ CopyTextToClipboard(char *text) locked = !((err == NO_ERROR) || (err == ERROR_NOT_LOCKED)); if (appData.debugMode) { fprintf(debugFP, - "CopyTextToClipboard(): err %d locked %d\n", err, locked); + "CopyTextToClipboard(): err %d locked %d\n", (int)err, locked); } } if (locked) { @@ -290,18 +293,24 @@ PasteGameFromClipboard() VOID PasteGameOrFENFromClipboard() { char *buf; - char *tmp; +// char *tmp; + Board dummyBoard; int dummy; // [HGM] paste any if (!PasteTextFromClipboard(&buf)) { return; } +#if 0 tmp = buf; while( *tmp == ' ' || *tmp == '\t' || *tmp == '\r' || *tmp == '\n' ) { tmp++; } if( *tmp == '[' ) { +#else + // [HGM] paste any: make still smarter, to allow pasting of games without tags, recognize FEN in stead + if(!ParseFEN(dummyBoard, &dummy, buf) ) { +#endif PasteGameFromString( buf ); } else { @@ -367,7 +376,7 @@ PasteTextFromClipboard(char **text) locked = !((err == NO_ERROR) || (err == ERROR_NOT_LOCKED)); if (appData.debugMode) { fprintf(debugFP, - "PasteTextFromClipboard(): err %d locked %d\n", err, locked); + "PasteTextFromClipboard(): err %d locked %d\n", (int)err, locked); } } if (locked)