* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
* ------------------------------------------------------------------------\r
*/\r
-\r
#include "config.h"\r
\r
#include <windows.h> /* required for all Windows applications */\r
#include "frontend.h"\r
#include "backend.h"\r
\r
+#include "wsnap.h"
+
/* Module globals */\r
HWND gameListDialog = NULL;\r
BOOLEAN gameListUp = FALSE;\r
static BOOL filterHasFocus = FALSE;
int count;
struct GameListStats stats;
+ static SnapData sd;
\r
switch (message) {\r
case WM_INITDIALOG: \r
sizeY = newSizeY;\r
break;\r
\r
+ case WM_ENTERSIZEMOVE:
+ return OnEnterSizeMove( &sd, hDlg, wParam, lParam );
+
+ case WM_SIZING:
+ return OnSizing( &sd, hDlg, wParam, lParam );
+
+ case WM_MOVING:
+ return OnMoving( &sd, hDlg, wParam, lParam );
+
+ case WM_EXITSIZEMOVE:
+ return OnExitSizeMove( &sd, hDlg, wParam, lParam );
+
case WM_GETMINMAXINFO:\r
/* Prevent resizing window too small */\r
mmi = (MINMAXINFO *) lParam;\r
}\r
}\r
}\r
+
+HGLOBAL ExportGameListAsText()
+{
+ HGLOBAL result = NULL;
+ LPVOID lpMem = NULL;
+ ListGame * lg = (ListGame *) gameList.head;
+ int nItem;
+ DWORD dwLen = 0;
+
+ if( ! gameFileName || ((ListGame *) gameList.tailPred)->number <= 0 ) {
+ DisplayError("Game list not loaded or empty", 0);
+ return NULL;
+ }
+
+ /* Get list size */
+ for (nItem = 0; nItem < ((ListGame *) gameList.tailPred)->number; nItem++){
+ char * st = GameListLineFull(lg->number, &lg->gameInfo);
+
+ dwLen += strlen(st) + 2; /* Add extra characters for "\r\n" */
+
+ free(st);
+ lg = (ListGame *) lg->node.succ;
+ }
+
+ /* Allocate memory for the list */
+ result = GlobalAlloc(GHND, dwLen+1 );
+
+ if( result != NULL ) {
+ lpMem = GlobalLock(result);
+ }
+
+ /* Copy the list into the global memory block */
+ if( lpMem != NULL ) {
+ char * dst = (char *) lpMem;
+ size_t len;
+
+ lg = (ListGame *) gameList.head;
+
+ for (nItem = 0; nItem < ((ListGame *) gameList.tailPred)->number; nItem++){
+ char * st = GameListLineFull(lg->number, &lg->gameInfo);
+
+ len = sprintf( dst, "%s\r\n", st );
+ dst += len;
+
+ free(st);
+ lg = (ListGame *) lg->node.succ;
+ }
+
+ GlobalUnlock( result );
+ }
+
+ return result;
+}