]> git.saurik.com Git - wxWidgets.git/commitdiff
renaming and moving samples around
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 8 Jan 2000 15:28:31 +0000 (15:28 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 8 Jan 2000 15:28:31 +0000 (15:28 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5300 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

333 files changed:
demos/bombs/.cvsignore [new file with mode: 0644]
demos/bombs/Makefile.in [new file with mode: 0644]
demos/bombs/bombs.bmp [new file with mode: 0644]
demos/bombs/bombs.cpp [new file with mode: 0644]
demos/bombs/bombs.def [new file with mode: 0644]
demos/bombs/bombs.h [new file with mode: 0644]
demos/bombs/bombs.ico [new file with mode: 0644]
demos/bombs/bombs.rc [new file with mode: 0644]
demos/bombs/bombs.xpm [new file with mode: 0644]
demos/bombs/bombs1.cpp [new file with mode: 0644]
demos/bombs/descrip.mms [new file with mode: 0644]
demos/bombs/game.cpp [new file with mode: 0644]
demos/bombs/game.h [new file with mode: 0644]
demos/bombs/makefile.b32 [new file with mode: 0644]
demos/bombs/makefile.bcc [new file with mode: 0644]
demos/bombs/makefile.dos [new file with mode: 0644]
demos/bombs/makefile.g95 [new file with mode: 0644]
demos/bombs/makefile.unx [new file with mode: 0644]
demos/bombs/makefile.vc [new file with mode: 0644]
demos/bombs/makefile.wat [new file with mode: 0644]
demos/bombs/readme.txt [new file with mode: 0644]
demos/forty/.cvsignore [new file with mode: 0644]
demos/forty/Makefile.in [new file with mode: 0644]
demos/forty/canvas.cpp [new file with mode: 0644]
demos/forty/canvas.h [new file with mode: 0644]
demos/forty/card.cpp [new file with mode: 0644]
demos/forty/card.h [new file with mode: 0644]
demos/forty/cards.ico [new file with mode: 0644]
demos/forty/forty.cpp [new file with mode: 0644]
demos/forty/forty.def [new file with mode: 0644]
demos/forty/forty.h [new file with mode: 0644]
demos/forty/forty.rc [new file with mode: 0644]
demos/forty/game.cpp [new file with mode: 0644]
demos/forty/game.h [new file with mode: 0644]
demos/forty/make_cw.mcp [new file with mode: 0644]
demos/forty/makefile.b32 [new file with mode: 0644]
demos/forty/makefile.bcc [new file with mode: 0644]
demos/forty/makefile.dos [new file with mode: 0644]
demos/forty/makefile.g95 [new file with mode: 0644]
demos/forty/makefile.unx [new file with mode: 0644]
demos/forty/makefile.vc [new file with mode: 0644]
demos/forty/makefile.wat [new file with mode: 0644]
demos/forty/pictures.bmp [new file with mode: 0644]
demos/forty/pictures.xpm [new file with mode: 0644]
demos/forty/pile.cpp [new file with mode: 0644]
demos/forty/pile.h [new file with mode: 0644]
demos/forty/playerdg.cpp [new file with mode: 0644]
demos/forty/playerdg.h [new file with mode: 0644]
demos/forty/readme.txt [new file with mode: 0644]
demos/forty/scoredg.cpp [new file with mode: 0644]
demos/forty/scoredg.h [new file with mode: 0644]
demos/forty/scorefil.cpp [new file with mode: 0644]
demos/forty/scorefil.h [new file with mode: 0644]
demos/forty/symbols.bmp [new file with mode: 0644]
demos/forty/symbols.xbm [new file with mode: 0644]
demos/forty/symbols.xpm [new file with mode: 0644]
demos/fractal/.cvsignore [new file with mode: 0644]
demos/fractal/Makefile.in [new file with mode: 0644]
demos/fractal/fractal.cpp [new file with mode: 0644]
demos/fractal/fractal.def [new file with mode: 0644]
demos/fractal/fractal.rc [new file with mode: 0644]
demos/fractal/makefile.b32 [new file with mode: 0644]
demos/fractal/makefile.bcc [new file with mode: 0644]
demos/fractal/makefile.dos [new file with mode: 0644]
demos/fractal/makefile.g95 [new file with mode: 0644]
demos/fractal/makefile.unx [new file with mode: 0644]
demos/fractal/makefile.vc [new file with mode: 0644]
demos/fractal/makefile.wat [new file with mode: 0644]
demos/fractal/mondrian.ico [new file with mode: 0644]
demos/life/Makefile.in [new file with mode: 0644]
demos/life/bitmaps/play.bmp [new file with mode: 0644]
demos/life/bitmaps/play.xpm [new file with mode: 0644]
demos/life/bitmaps/reset.bmp [new file with mode: 0644]
demos/life/bitmaps/reset.xpm [new file with mode: 0644]
demos/life/bitmaps/stop.bmp [new file with mode: 0644]
demos/life/bitmaps/stop.xpm [new file with mode: 0644]
demos/life/life.cpp [new file with mode: 0644]
demos/life/life.def [new file with mode: 0644]
demos/life/life.rc [new file with mode: 0644]
demos/life/makefile.b32 [new file with mode: 0644]
demos/life/makefile.bcc [new file with mode: 0644]
demos/life/makefile.dos [new file with mode: 0644]
demos/life/makefile.g95 [new file with mode: 0644]
demos/life/makefile.unx [new file with mode: 0644]
demos/life/makefile.vc [new file with mode: 0644]
demos/life/makefile.wat [new file with mode: 0644]
demos/life/mondrian.ico [new file with mode: 0644]
demos/life/mondrian.xpm [new file with mode: 0644]
demos/life/samples.inc [new file with mode: 0644]
demos/poem/.cvsignore [new file with mode: 0644]
demos/poem/Makefile.in [new file with mode: 0644]
demos/poem/corner1.ico [new file with mode: 0644]
demos/poem/corner1.xpm [new file with mode: 0644]
demos/poem/corner2.ico [new file with mode: 0644]
demos/poem/corner2.xpm [new file with mode: 0644]
demos/poem/corner3.ico [new file with mode: 0644]
demos/poem/corner3.xpm [new file with mode: 0644]
demos/poem/corner4.ico [new file with mode: 0644]
demos/poem/corner4.xpm [new file with mode: 0644]
demos/poem/makefile.b32 [new file with mode: 0644]
demos/poem/makefile.bcc [new file with mode: 0644]
demos/poem/makefile.dos [new file with mode: 0644]
demos/poem/makefile.g95 [new file with mode: 0644]
demos/poem/makefile.vc [new file with mode: 0644]
demos/poem/makefile.wat [new file with mode: 0644]
demos/poem/wxpoem.cpp [new file with mode: 0644]
demos/poem/wxpoem.dat [new file with mode: 0644]
demos/poem/wxpoem.def [new file with mode: 0644]
demos/poem/wxpoem.h [new file with mode: 0644]
demos/poem/wxpoem.ico [new file with mode: 0644]
demos/poem/wxpoem.idx [new file with mode: 0644]
demos/poem/wxpoem.rc [new file with mode: 0644]
demos/poem/wxpoem.txt [new file with mode: 0644]
demos/poem/wxpoem.xpm [new file with mode: 0644]
samples/bombs/.cvsignore [deleted file]
samples/bombs/Makefile.in [deleted file]
samples/bombs/bombs.bmp [deleted file]
samples/bombs/bombs.cpp [deleted file]
samples/bombs/bombs.def [deleted file]
samples/bombs/bombs.h [deleted file]
samples/bombs/bombs.ico [deleted file]
samples/bombs/bombs.rc [deleted file]
samples/bombs/bombs.xpm [deleted file]
samples/bombs/bombs1.cpp [deleted file]
samples/bombs/descrip.mms [deleted file]
samples/bombs/game.cpp [deleted file]
samples/bombs/game.h [deleted file]
samples/bombs/makefile.b32 [deleted file]
samples/bombs/makefile.bcc [deleted file]
samples/bombs/makefile.dos [deleted file]
samples/bombs/makefile.g95 [deleted file]
samples/bombs/makefile.unx [deleted file]
samples/bombs/makefile.vc [deleted file]
samples/bombs/makefile.wat [deleted file]
samples/bombs/readme.txt [deleted file]
samples/dde/.cvsignore [deleted file]
samples/dde/client.cpp [deleted file]
samples/dde/client.def [deleted file]
samples/dde/client.g95 [deleted file]
samples/dde/client.h [deleted file]
samples/dde/client.rc [deleted file]
samples/dde/client.vc [deleted file]
samples/dde/client.wat [deleted file]
samples/dde/ddesetup.h [deleted file]
samples/dde/makefile.b32 [deleted file]
samples/dde/makefile.dos [deleted file]
samples/dde/makefile.g95 [deleted file]
samples/dde/makefile.vc [deleted file]
samples/dde/mondrian.ico [deleted file]
samples/dde/mondrian.xpm [deleted file]
samples/dde/server.cpp [deleted file]
samples/dde/server.def [deleted file]
samples/dde/server.g95 [deleted file]
samples/dde/server.h [deleted file]
samples/dde/server.rc [deleted file]
samples/dde/server.vc [deleted file]
samples/dde/server.wat [deleted file]
samples/dialup/Makefile.in [new file with mode: 0644]
samples/dialup/makefile.b32 [new file with mode: 0644]
samples/dialup/makefile.bcc [new file with mode: 0644]
samples/dialup/makefile.dos [new file with mode: 0644]
samples/dialup/makefile.g95 [new file with mode: 0644]
samples/dialup/makefile.unx [new file with mode: 0644]
samples/dialup/makefile.vc [new file with mode: 0644]
samples/dialup/nettest.cpp [new file with mode: 0644]
samples/dialup/nettest.def [new file with mode: 0644]
samples/dialup/nettest.rc [new file with mode: 0644]
samples/forty/.cvsignore [deleted file]
samples/forty/Makefile.in [deleted file]
samples/forty/canvas.cpp [deleted file]
samples/forty/canvas.h [deleted file]
samples/forty/card.cpp [deleted file]
samples/forty/card.h [deleted file]
samples/forty/cards.ico [deleted file]
samples/forty/forty.cpp [deleted file]
samples/forty/forty.def [deleted file]
samples/forty/forty.h [deleted file]
samples/forty/forty.rc [deleted file]
samples/forty/game.cpp [deleted file]
samples/forty/game.h [deleted file]
samples/forty/make_cw.mcp [deleted file]
samples/forty/makefile.b32 [deleted file]
samples/forty/makefile.bcc [deleted file]
samples/forty/makefile.dos [deleted file]
samples/forty/makefile.g95 [deleted file]
samples/forty/makefile.unx [deleted file]
samples/forty/makefile.vc [deleted file]
samples/forty/makefile.wat [deleted file]
samples/forty/pictures.bmp [deleted file]
samples/forty/pictures.xpm [deleted file]
samples/forty/pile.cpp [deleted file]
samples/forty/pile.h [deleted file]
samples/forty/playerdg.cpp [deleted file]
samples/forty/playerdg.h [deleted file]
samples/forty/readme.txt [deleted file]
samples/forty/scoredg.cpp [deleted file]
samples/forty/scoredg.h [deleted file]
samples/forty/scorefil.cpp [deleted file]
samples/forty/scorefil.h [deleted file]
samples/forty/symbols.bmp [deleted file]
samples/forty/symbols.xbm [deleted file]
samples/forty/symbols.xpm [deleted file]
samples/fractal/.cvsignore [deleted file]
samples/fractal/Makefile.in [deleted file]
samples/fractal/fractal.cpp [deleted file]
samples/fractal/fractal.def [deleted file]
samples/fractal/fractal.rc [deleted file]
samples/fractal/makefile.b32 [deleted file]
samples/fractal/makefile.bcc [deleted file]
samples/fractal/makefile.dos [deleted file]
samples/fractal/makefile.g95 [deleted file]
samples/fractal/makefile.unx [deleted file]
samples/fractal/makefile.vc [deleted file]
samples/fractal/makefile.wat [deleted file]
samples/fractal/mondrian.ico [deleted file]
samples/ipc/.cvsignore [new file with mode: 0644]
samples/ipc/client.cpp [new file with mode: 0644]
samples/ipc/client.def [new file with mode: 0644]
samples/ipc/client.g95 [new file with mode: 0644]
samples/ipc/client.h [new file with mode: 0644]
samples/ipc/client.rc [new file with mode: 0644]
samples/ipc/client.vc [new file with mode: 0644]
samples/ipc/client.wat [new file with mode: 0644]
samples/ipc/ddesetup.h [new file with mode: 0644]
samples/ipc/makefile.b32 [new file with mode: 0644]
samples/ipc/makefile.dos [new file with mode: 0644]
samples/ipc/makefile.g95 [new file with mode: 0644]
samples/ipc/makefile.vc [new file with mode: 0644]
samples/ipc/mondrian.ico [new file with mode: 0644]
samples/ipc/mondrian.xpm [new file with mode: 0644]
samples/ipc/server.cpp [new file with mode: 0644]
samples/ipc/server.def [new file with mode: 0644]
samples/ipc/server.g95 [new file with mode: 0644]
samples/ipc/server.h [new file with mode: 0644]
samples/ipc/server.rc [new file with mode: 0644]
samples/ipc/server.vc [new file with mode: 0644]
samples/ipc/server.wat [new file with mode: 0644]
samples/life/Makefile.in [deleted file]
samples/life/bitmaps/play.bmp [deleted file]
samples/life/bitmaps/play.xpm [deleted file]
samples/life/bitmaps/reset.bmp [deleted file]
samples/life/bitmaps/reset.xpm [deleted file]
samples/life/bitmaps/stop.bmp [deleted file]
samples/life/bitmaps/stop.xpm [deleted file]
samples/life/life.cpp [deleted file]
samples/life/life.def [deleted file]
samples/life/life.rc [deleted file]
samples/life/makefile.b32 [deleted file]
samples/life/makefile.bcc [deleted file]
samples/life/makefile.dos [deleted file]
samples/life/makefile.g95 [deleted file]
samples/life/makefile.unx [deleted file]
samples/life/makefile.vc [deleted file]
samples/life/makefile.wat [deleted file]
samples/life/mondrian.ico [deleted file]
samples/life/mondrian.xpm [deleted file]
samples/life/samples.inc [deleted file]
samples/nettest/Makefile.in [deleted file]
samples/nettest/makefile.b32 [deleted file]
samples/nettest/makefile.bcc [deleted file]
samples/nettest/makefile.dos [deleted file]
samples/nettest/makefile.g95 [deleted file]
samples/nettest/makefile.unx [deleted file]
samples/nettest/makefile.vc [deleted file]
samples/nettest/nettest.cpp [deleted file]
samples/nettest/nettest.def [deleted file]
samples/nettest/nettest.rc [deleted file]
samples/sockets/.cvsignore [new file with mode: 0644]
samples/sockets/Makefile.in [new file with mode: 0644]
samples/sockets/client.cpp [new file with mode: 0644]
samples/sockets/client.def [new file with mode: 0644]
samples/sockets/client.g95 [new file with mode: 0644]
samples/sockets/client.rc [new file with mode: 0644]
samples/sockets/client.vc [new file with mode: 0644]
samples/sockets/client.wat [new file with mode: 0644]
samples/sockets/connect.ico [new file with mode: 0644]
samples/sockets/makefile.b32 [new file with mode: 0644]
samples/sockets/makefile.dos [new file with mode: 0644]
samples/sockets/makefile.g95 [new file with mode: 0644]
samples/sockets/makefile.vc [new file with mode: 0644]
samples/sockets/mondrian.ico [new file with mode: 0644]
samples/sockets/mondrian.xpm [new file with mode: 0644]
samples/sockets/server.cpp [new file with mode: 0644]
samples/sockets/server.def [new file with mode: 0644]
samples/sockets/server.g95 [new file with mode: 0644]
samples/sockets/server.rc [new file with mode: 0644]
samples/sockets/server.vc [new file with mode: 0644]
samples/sockets/server.wat [new file with mode: 0644]
samples/wxpoem/.cvsignore [deleted file]
samples/wxpoem/Makefile.in [deleted file]
samples/wxpoem/corner1.ico [deleted file]
samples/wxpoem/corner1.xpm [deleted file]
samples/wxpoem/corner2.ico [deleted file]
samples/wxpoem/corner2.xpm [deleted file]
samples/wxpoem/corner3.ico [deleted file]
samples/wxpoem/corner3.xpm [deleted file]
samples/wxpoem/corner4.ico [deleted file]
samples/wxpoem/corner4.xpm [deleted file]
samples/wxpoem/makefile.b32 [deleted file]
samples/wxpoem/makefile.bcc [deleted file]
samples/wxpoem/makefile.dos [deleted file]
samples/wxpoem/makefile.g95 [deleted file]
samples/wxpoem/makefile.vc [deleted file]
samples/wxpoem/makefile.wat [deleted file]
samples/wxpoem/wxpoem.cpp [deleted file]
samples/wxpoem/wxpoem.dat [deleted file]
samples/wxpoem/wxpoem.def [deleted file]
samples/wxpoem/wxpoem.h [deleted file]
samples/wxpoem/wxpoem.ico [deleted file]
samples/wxpoem/wxpoem.rc [deleted file]
samples/wxpoem/wxpoem.txt [deleted file]
samples/wxpoem/wxpoem.xpm [deleted file]
samples/wxsocket/.cvsignore [deleted file]
samples/wxsocket/Makefile.in [deleted file]
samples/wxsocket/client.cpp [deleted file]
samples/wxsocket/client.def [deleted file]
samples/wxsocket/client.g95 [deleted file]
samples/wxsocket/client.rc [deleted file]
samples/wxsocket/client.vc [deleted file]
samples/wxsocket/client.wat [deleted file]
samples/wxsocket/connect.ico [deleted file]
samples/wxsocket/makefile.b32 [deleted file]
samples/wxsocket/makefile.dos [deleted file]
samples/wxsocket/makefile.g95 [deleted file]
samples/wxsocket/makefile.vc [deleted file]
samples/wxsocket/mondrian.ico [deleted file]
samples/wxsocket/mondrian.xpm [deleted file]
samples/wxsocket/server.cpp [deleted file]
samples/wxsocket/server.def [deleted file]
samples/wxsocket/server.g95 [deleted file]
samples/wxsocket/server.rc [deleted file]
samples/wxsocket/server.vc [deleted file]
samples/wxsocket/server.wat [deleted file]

diff --git a/demos/bombs/.cvsignore b/demos/bombs/.cvsignore
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/demos/bombs/Makefile.in b/demos/bombs/Makefile.in
new file mode 100644 (file)
index 0000000..90ec3d1
--- /dev/null
@@ -0,0 +1,21 @@
+#
+# File:                Makefile.in
+# Author:      Julian Smart
+# Created:     1998
+# Updated:     
+# Copyright:   (c) 1998 Julian Smart
+#
+# "%W% %G%"
+#
+# Makefile for bombs example (UNIX).
+
+top_srcdir = @top_srcdir@
+top_builddir = ../..
+program_dir = samples/bombs
+
+PROGRAM=bombs
+
+OBJECTS = bombs.o bombs1.o game.o
+
+include ../../src/makeprog.env
+
diff --git a/demos/bombs/bombs.bmp b/demos/bombs/bombs.bmp
new file mode 100644 (file)
index 0000000..0fffb1f
Binary files /dev/null and b/demos/bombs/bombs.bmp differ
diff --git a/demos/bombs/bombs.cpp b/demos/bombs/bombs.cpp
new file mode 100644 (file)
index 0000000..cdf7b85
--- /dev/null
@@ -0,0 +1,252 @@
+///////////////////////////////////////////////////////////////////////////////
+// Name:        bombs.cpp
+// Purpose:     Bombs game
+// Author:      P. Foggia 1996
+// Modified by:
+// Created:     1996
+// RCS-ID:      $Id$
+// Copyright:   (c) 1996 P. Foggia
+// Licence:     wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include "wx/wxprec.h"
+
+#ifndef  WX_PRECOMP
+  #include "wx/wx.h"
+#endif //precompiled headers
+
+#include "bombs.h"
+
+#include <time.h>
+#include <stdlib.h>
+
+#if defined(__WXGTK__) || defined(__WXMOTIF__)
+#include "bombs.xpm"
+#endif
+
+IMPLEMENT_APP(AppClass)
+
+// Called to initialize the program
+bool AppClass::OnInit()
+{
+  srand((unsigned)time(NULL));
+
+  // Initialize all the top-level window members to NULL.
+  BombsFrame = NULL;
+  level=IDM_EASY;
+
+  BombsFrame = 
+    new BombsFrameClass(NULL, "wxBombs", wxPoint(155, 165), wxSize(300, 300), wxMINIMIZE_BOX | wxSYSTEM_MENU | wxCAPTION);
+
+  int xmax=BombsFrame->BombsCanvas->field_width*BombsFrame->BombsCanvas->x_cell*X_UNIT;
+  int ymax=BombsFrame->BombsCanvas->field_height*BombsFrame->BombsCanvas->y_cell*Y_UNIT;
+  BombsFrame->SetClientSize(xmax, ymax);
+
+  return TRUE;
+}
+
+BEGIN_EVENT_TABLE(BombsFrameClass, wxFrame)
+    EVT_MENU(IDM_EASY, BombsFrameClass::OnEasy)
+    EVT_MENU(IDM_MEDIUM, BombsFrameClass::OnMedium)
+    EVT_MENU(IDM_DIFFICULT, BombsFrameClass::OnDifficult)
+    EVT_MENU(IDM_EXIT, BombsFrameClass::OnExit)
+    EVT_MENU(IDM_ABOUT, BombsFrameClass::OnAbout)
+    EVT_MENU(IDM_RESTART, BombsFrameClass::OnRestart)
+    EVT_CLOSE(BombsFrameClass::OnCloseWindow)
+END_EVENT_TABLE()
+
+BombsFrameClass::BombsFrameClass(wxFrame *parent, const wxString& title, const wxPoint& pos, const wxSize& size, long style):
+  wxFrame(parent, -1, title, pos, size, style)
+{
+  // Initialize child subwindow members.
+  BombsCanvas = NULL;
+
+  SetIcon(wxICON(bombs));
+
+  CreateStatusBar();
+  
+  // Create a menu bar for the frame
+  wxMenuBar *menuBar1 = new wxMenuBar;
+  wxMenu *menu1 = new wxMenu;
+  menu1->Append(IDM_EXIT, "E&xit"); // , "Quit the program");
+  menu1->AppendSeparator();
+  menu1->Append(IDM_ABOUT, "&About..."); // , "Infos on wxBombs");
+  menuBar1->Append(menu1, "&File");
+  wxMenu *menu2 = new wxMenu;
+  menu2->Append(IDM_RESTART, "&Restart"); // , "Clear the play field");
+  menu2->AppendSeparator();
+  menu2->Append(IDM_EASY, "&Easy", wxEmptyString, TRUE); // "10x10 play field", TRUE);
+  menu2->Append(IDM_MEDIUM, "&Medium", wxEmptyString, TRUE); // "15x15 play field", TRUE);
+  menu2->Append(IDM_DIFFICULT, "&Difficult", wxEmptyString, TRUE); // "25x20 play field", TRUE);
+  menuBar1->Append(menu2, "&Game");
+  SetMenuBar(menuBar1);
+  menuBar=menuBar1;
+  menuBar->Check(wxGetApp().level, TRUE);
+
+  // Create child subwindows.
+  BombsCanvas = new BombsCanvasClass(this);
+
+  // Ensure the subwindows get resized o.k.
+//  OnSize(width, height);
+
+  // Centre frame on the screen.
+  Centre(wxBOTH);
+
+  // Show the frame.
+  Show(TRUE);
+}
+
+BombsFrameClass::~BombsFrameClass(void)
+{
+}
+
+void BombsFrameClass::OnCloseWindow(wxCloseEvent& event)
+{
+  this->Destroy();
+}
+
+void BombsFrameClass::OnExit(wxCommandEvent& event)
+{
+    this->Destroy();
+}
+
+void BombsFrameClass::OnRestart(wxCommandEvent& event)
+{
+    BombsCanvas->UpdateFieldSize();
+    int xmax=BombsCanvas->field_width*BombsCanvas->x_cell*X_UNIT;
+    int ymax=BombsCanvas->field_height*BombsCanvas->y_cell*Y_UNIT;
+    wxGetApp().BombsFrame->SetClientSize(xmax, ymax);
+}
+
+void BombsFrameClass::OnAbout(wxCommandEvent& event)
+{
+    wxMessageBox("wxBombs (c) 1996 by P. Foggia\n<foggia@amalfi.dis.unina.it>", "About wxBombs");
+}
+
+void BombsFrameClass::OnEasy(wxCommandEvent& event)
+{
+    menuBar->Check(wxGetApp().level, FALSE);
+    wxGetApp().level=IDM_EASY;
+    menuBar->Check(wxGetApp().level, TRUE);
+}
+
+void BombsFrameClass::OnMedium(wxCommandEvent& event)
+{
+    menuBar->Check(wxGetApp().level, FALSE);
+    wxGetApp().level=IDM_MEDIUM;
+    menuBar->Check(wxGetApp().level, TRUE);
+}
+
+void BombsFrameClass::OnDifficult(wxCommandEvent& event)
+{
+    menuBar->Check(wxGetApp().level, FALSE);
+    wxGetApp().level=IDM_DIFFICULT;
+    menuBar->Check(wxGetApp().level, TRUE);
+}
+
+BEGIN_EVENT_TABLE(BombsCanvasClass, wxWindow)
+    EVT_PAINT(BombsCanvasClass::OnPaint)
+    EVT_MOUSE_EVENTS(BombsCanvasClass::OnEvent)
+END_EVENT_TABLE()
+
+BombsCanvasClass::BombsCanvasClass(wxFrame *parent, const wxPoint& pos, const wxSize& size, long style):
+  wxWindow(parent, -1, pos, size, style)
+{ 
+  int sx, sy;
+  wxClientDC dc(this);
+  wxFont font= BOMBS_FONT;
+  dc.SetFont(font);
+
+  long chw, chh;
+  char buf[]="M";
+
+  dc.GetTextExtent(buf, &chw, &chh);
+  dc.SetFont(wxNullFont);
+
+  dc.SetMapMode(wxMM_METRIC);
+
+  int xcm = dc.LogicalToDeviceX(10.0);
+  int ycm = dc.LogicalToDeviceY(10.0);
+    // To have a square cell, there must be :
+    //    sx*ycm == sy*xcm
+  if (chw*ycm < chh*xcm)
+    { sy=chh;
+      sx=chh*xcm/ycm;
+    }
+  else
+    { sx=chw;
+      sy=chw*ycm/xcm;
+    }
+  x_cell = (sx+3+X_UNIT)/X_UNIT;
+  y_cell = (sy+3+Y_UNIT)/Y_UNIT;
+  dc.SetMapMode(wxMM_TEXT);
+  bmp=NULL;
+  UpdateFieldSize();
+}
+
+BombsCanvasClass::~BombsCanvasClass(void)
+{
+  if (bmp)
+    delete bmp;
+}
+
+// Called when canvas needs to be repainted.
+void BombsCanvasClass::OnPaint(wxPaintEvent& event)
+{
+  wxPaintDC dc(this);
+
+  // Insert your drawing code here.
+  if (!bmp)
+    { bmp=new wxBitmap(field_width*x_cell*X_UNIT+1,
+                       field_height*y_cell*Y_UNIT+1);
+      if (bmp)
+        { wxMemoryDC memDC;
+          memDC.SelectObject(* bmp);
+          DrawField(&memDC, 0, 0, field_width-1, field_height-1);
+          memDC.SelectObject(wxNullBitmap);
+        }
+    }
+  if (bmp)
+    { wxMemoryDC memDC;
+      memDC.SelectObject(* bmp);
+      dc.Blit(0, 0, field_width*x_cell*X_UNIT+1,
+                          field_height*y_cell*Y_UNIT+1,
+                    &memDC, 0, 0, wxCOPY);
+      memDC.SelectObject(wxNullBitmap);
+    }
+  else
+    DrawField(& dc, 0, 0, field_width-1, field_height-1);
+}
+
+// Updates the field size depending on wxGetApp().level and
+// redraws the canvas
+void BombsCanvasClass::UpdateFieldSize()
+  { field_width=20;
+    field_height=20;
+
+    switch(wxGetApp().level)
+      { case IDM_EASY:
+          field_width=10;
+          field_height=10;
+          break;
+        case IDM_MEDIUM:
+          field_width=15;
+          field_height=15;
+          break;
+        case IDM_DIFFICULT:
+          field_width=25;
+          field_height=20;
+          break;
+      }
+    wxGetApp().Game.Init(field_width, field_height);
+
+    if (bmp)
+      delete bmp;
+    bmp=NULL;
+    
+    wxWindow::Refresh();
+  }
diff --git a/demos/bombs/bombs.def b/demos/bombs/bombs.def
new file mode 100644 (file)
index 0000000..a0dc764
--- /dev/null
@@ -0,0 +1,14 @@
+; bombs
+; Generated by wxBuilder
+;
+NAME          bombsapp
+DESCRIPTION   'A wxWindows application'
+;
+EXETYPE      WINDOWS
+STUB         'WINSTUB.EXE'
+;
+CODE         PRELOAD MOVEABLE DISCARDABLE
+DATA         PRELOAD MOVEABLE MULTIPLE
+;
+HEAPSIZE     1024
+STACKSIZE    8192
diff --git a/demos/bombs/bombs.h b/demos/bombs/bombs.h
new file mode 100644 (file)
index 0000000..9684aca
--- /dev/null
@@ -0,0 +1,119 @@
+///////////////////////////////////////////////////////////////////////////////
+// Name:        bombs.h
+// Purpose:     Bombs game
+// Author:      P. Foggia 1996
+// Modified by:
+// Created:     1996
+// RCS-ID:      $Id$
+// Copyright:   (c) 1996 P. Foggia
+// Licence:     wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _INC_BOMBS_H
+#define _INC_BOMBS_H
+
+#include "game.h"
+
+/*
+ * Forward declarations of all top-level window classes.
+ */
+class  BombsFrameClass;
+class  AboutFrameClass;
+
+/*
+ * Class representing the entire Application
+ */
+class AppClass: public wxApp
+{
+ public:
+  BombsFrameClass *BombsFrame;
+  int level;
+  BombsGame Game;
+
+  bool OnInit();
+};
+
+DECLARE_APP(AppClass)
+
+class BombsCanvasClass;
+
+class BombsFrameClass: public wxFrame
+{
+ private:
+ protected:
+ public:
+  // Subwindows for reference within the program.
+  BombsCanvasClass *BombsCanvas;
+  wxMenuBar *menuBar;
+
+  // Constructor and destructor
+  BombsFrameClass(wxFrame *parent, const wxString& title, const wxPoint& pos, const wxSize& size, long style);
+  ~BombsFrameClass(void);
+
+ void OnCloseWindow(wxCloseEvent& event);
+ void OnExit(wxCommandEvent& event);
+ void OnRestart(wxCommandEvent& event);
+ void OnAbout(wxCommandEvent& event);
+ void OnEasy(wxCommandEvent& event);
+ void OnMedium(wxCommandEvent& event);
+ void OnDifficult(wxCommandEvent& event);
+
+DECLARE_EVENT_TABLE()
+};
+
+/* Menu identifiers
+ */
+// File
+#define BOMBSFRAMECLASS_FILE 1
+// E&xit
+#define IDM_EXIT 2
+// About...
+#define IDM_ABOUT 3
+// Game
+#define BOMBSFRAMECLASS_GAME 4
+// &Restart
+#define IDM_RESTART 5
+// &Easy
+#define IDM_EASY 6
+// &Medium
+#define IDM_MEDIUM 7
+// &Difficult
+#define IDM_DIFFICULT 8
+
+class BombsCanvasClass: public wxWindow
+{
+ private:
+ protected:
+ public:
+   int field_width, field_height;
+   int x_cell, y_cell;
+   wxBitmap *bmp;
+  // Constructor and destructor
+  BombsCanvasClass(wxFrame *parent, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0);
+  ~BombsCanvasClass(void);
+
+ void OnPaint(wxPaintEvent& event);
+ void DrawField(wxDC *, int xc1, int yc1, int xc2, int yc2);
+ void Refresh(int xc1, int yc1, int xc2, int yc2);
+ void OnEvent(wxMouseEvent& event);
+ void UpdateFieldSize();
+
+DECLARE_EVENT_TABLE()
+};
+
+/* Menu identifiers
+ */
+
+/* The following sizes should probably be redefined */
+/* dimensions of a scroll unit, in pixels */
+#define X_UNIT 4
+#define Y_UNIT 4
+
+/* the dimensions of a cell, in scroll units are in
+ * BombsCanvasClass::x_cell and y_cell
+ */
+
+#define BOMBS_FONT wxFont(14, wxROMAN, wxNORMAL, wxNORMAL)
+
+#endif /* mutual exclusion */
+
diff --git a/demos/bombs/bombs.ico b/demos/bombs/bombs.ico
new file mode 100644 (file)
index 0000000..249893a
Binary files /dev/null and b/demos/bombs/bombs.ico differ
diff --git a/demos/bombs/bombs.rc b/demos/bombs/bombs.rc
new file mode 100644 (file)
index 0000000..9b852cc
--- /dev/null
@@ -0,0 +1,3 @@
+bombs ICON "bombs.ico"
+
+#include "wx/msw/wx.rc"
diff --git a/demos/bombs/bombs.xpm b/demos/bombs/bombs.xpm
new file mode 100644 (file)
index 0000000..9708aea
--- /dev/null
@@ -0,0 +1,44 @@
+/* XPM */
+static char *bombs_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"32 32 6 1",
+"  c Black",
+". c Blue",
+"X c #00bf00",
+"o c Red",
+"O c Yellow",
+"+ c Gray100",
+/* pixels */
+"                                ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+"                                ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++      ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++                    ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+"                                "
+};
diff --git a/demos/bombs/bombs1.cpp b/demos/bombs/bombs1.cpp
new file mode 100644 (file)
index 0000000..0b77417
--- /dev/null
@@ -0,0 +1,204 @@
+///////////////////////////////////////////////////////////////////////////////
+// Name:        bombs1.cpp
+// Purpose:     Bombs game
+// Author:      P. Foggia 1996
+// Modified by:
+// Created:     1996
+// RCS-ID:      $Id$
+// Copyright:   (c) 1996 P. Foggia
+// Licence:     wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+/*
+ * implementation of the methods DrawField and OnEvent of the
+ * class BombsCanvas
+ */
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include "wx/wxprec.h"
+
+#ifndef  WX_PRECOMP
+  #include "wx/wx.h"
+#endif //precompiled headers
+
+#include "bombs.h"
+
+/*--------  BombCanvasClass::DrawField(dc, xc1, yc1, xc2, yc2)  -------*/
+/* Draws the field on the device context dc                            */
+/* xc1,yc1 etc. are the (inclusive) limits of the area to be drawn,    */
+/* expressed in cells.                                                 */
+/*---------------------------------------------------------------------*/
+void BombsCanvasClass::DrawField(wxDC *dc, int xc1, int yc1, int xc2, int yc2)
+{ int x,y,xmax,ymax;
+  char buf[2];
+  long chw, chh;
+
+  wxColour *wxBlack = wxTheColourDatabase->FindColour("BLACK");
+  wxColour *wxWhite = wxTheColourDatabase->FindColour("WHITE");
+  wxColour *wxRed = wxTheColourDatabase->FindColour("RED");
+  wxColour *wxBlue = wxTheColourDatabase->FindColour("BLUE");
+  wxColour *wxGrey = wxTheColourDatabase->FindColour("LIGHT GREY");
+  wxColour *wxGreen = wxTheColourDatabase->FindColour("GREEN");
+
+  wxPen *blackPen = wxThePenList->FindOrCreatePen(*wxBlack, 1, wxSOLID);
+  wxPen *redPen = wxThePenList->FindOrCreatePen(*wxRed, 1, wxSOLID);
+  wxPen *bluePen = wxThePenList->FindOrCreatePen(*wxBlue, 1, wxSOLID);
+  wxBrush *whiteBrush = wxTheBrushList->FindOrCreateBrush(*wxWhite, wxSOLID);
+  wxBrush *greyBrush = wxTheBrushList->FindOrCreateBrush(*wxGrey, wxSOLID);
+  wxBrush *redBrush = wxTheBrushList->FindOrCreateBrush(*wxRed, wxSOLID);
+
+  xmax=field_width*x_cell*X_UNIT;
+  ymax=field_height*y_cell*Y_UNIT;
+
+
+  dc->SetPen(* blackPen);
+  for(x=xc1; x<=xc2; x++)
+    dc->DrawLine(x*x_cell*X_UNIT, 0, x*x_cell*X_UNIT, ymax);
+  for(y=xc1; y<=yc2; y++)
+    dc->DrawLine(0, y*y_cell*Y_UNIT, xmax, y*y_cell*Y_UNIT);
+
+
+  wxFont font= BOMBS_FONT;
+  dc->SetFont(font); 
+
+  buf[1]='\0';
+  for(x=xc1; x<=xc2; x++)
+    for(y=yc1; y<=yc2; y++)
+      { if (wxGetApp().Game.IsMarked(x,y))
+          { dc->SetPen(* blackPen);
+            dc->SetBrush(* greyBrush);
+            dc->DrawRectangle( x*x_cell*X_UNIT, y*y_cell*Y_UNIT,
+                               x_cell*X_UNIT+1, y_cell*Y_UNIT+1);
+            *buf='M';
+            if (!wxGetApp().Game.IsHidden(x,y) && wxGetApp().Game.IsBomb(x,y))
+              dc->SetTextForeground(*wxBlue);
+            else
+              dc->SetTextForeground(*wxRed);
+            dc->SetTextBackground(*wxGrey);
+            dc->GetTextExtent(buf, &chw, &chh);
+            dc->DrawText( buf,
+                  x*x_cell*X_UNIT + (x_cell*X_UNIT-chw)/2,
+                  y*y_cell*Y_UNIT + (y_cell*Y_UNIT-chh)/2
+                );
+            if (!wxGetApp().Game.IsHidden(x,y) && wxGetApp().Game.IsBomb(x,y))
+              { dc->SetPen(*redPen);
+                dc->DrawLine(x*x_cell*X_UNIT, y*y_cell*Y_UNIT,
+                             (x+1)*x_cell*X_UNIT, (y+1)*y_cell*Y_UNIT);
+                dc->DrawLine(x*x_cell*X_UNIT, (y+1)*y_cell*Y_UNIT,
+                             (x+1)*x_cell*X_UNIT, y*y_cell*Y_UNIT);
+              }
+          }
+        else if (wxGetApp().Game.IsHidden(x,y))
+          { dc->SetPen(*blackPen);
+            dc->SetBrush(*greyBrush);
+            dc->DrawRectangle( x*x_cell*X_UNIT, y*y_cell*Y_UNIT,
+                               x_cell*X_UNIT+1, y_cell*Y_UNIT+1);
+          }
+        else if (wxGetApp().Game.IsBomb(x,y))
+          { dc->SetPen(* blackPen);
+            dc->SetBrush(* redBrush);
+            dc->DrawRectangle( x*x_cell*X_UNIT, y*y_cell*Y_UNIT,
+                               x_cell*X_UNIT+1, y_cell*Y_UNIT+1);
+            *buf='B';
+            dc->SetTextForeground(* wxBlack);
+            dc->SetTextBackground(* wxRed);
+            dc->GetTextExtent(buf, &chw, &chh);
+            dc->DrawText( buf,
+                  x*x_cell*X_UNIT + (x_cell*X_UNIT-chw)/2,
+                  y*y_cell*Y_UNIT + (y_cell*Y_UNIT-chh)/2
+                );
+            if (wxGetApp().Game.IsExploded(x,y))
+              { dc->SetPen(* bluePen);
+                dc->DrawLine(x*x_cell*X_UNIT, y*y_cell*Y_UNIT,
+                             (x+1)*x_cell*X_UNIT, (y+1)*y_cell*Y_UNIT);
+                dc->DrawLine(x*x_cell*X_UNIT, (y+1)*y_cell*Y_UNIT,
+                             (x+1)*x_cell*X_UNIT, y*y_cell*Y_UNIT);
+              }
+          }
+        else   // Display a digit
+          { dc->SetPen(* blackPen);
+            dc->SetBrush(* whiteBrush);
+            dc->DrawRectangle( x*x_cell*X_UNIT, y*y_cell*Y_UNIT,
+                               x_cell*X_UNIT+1, y_cell*Y_UNIT+1);
+            *buf = (wxGetApp().Game.Get(x,y) & BG_MASK) + '0';
+            dc->GetTextExtent(buf, &chw, &chh);
+            switch(*buf)
+              { case '0': dc->SetTextForeground(* wxGreen); break;
+                case '1': dc->SetTextForeground(* wxBlue); break;
+                default:  dc->SetTextForeground(* wxBlack); break;
+              }
+            dc->SetTextBackground(* wxWhite);
+            dc->DrawText( buf,
+                  x*x_cell*X_UNIT + (x_cell*X_UNIT-chw)/2,
+                  y*y_cell*Y_UNIT + (y_cell*Y_UNIT-chh)/2
+                );
+          }
+      }
+  dc->SetFont(wxNullFont);
+
+  if (wxGetApp().BombsFrame)
+    { char buf[80];
+      sprintf(buf, "%d bombs  %d remaining cells",
+              wxGetApp().Game.GetBombs(), wxGetApp().Game.GetRemainingCells());
+      wxGetApp().BombsFrame->SetStatusText(buf, 0);
+    }
+}
+
+/*--------  BombCanvasClass::Refresh(xc1, yc1, xc2, yc2)  -------------*/
+/* Refreshes the field image                                           */
+/* xc1,yc1 etc. are the (inclusive) limits of the area to be drawn,    */
+/* expressed in cells.                                                 */
+/*---------------------------------------------------------------------*/
+void BombsCanvasClass::Refresh(int xc1, int yc1, int xc2, int yc2)
+  {
+    wxClientDC dc(this);
+    DrawField(& dc, xc1, yc1, xc2, yc2);
+    if (bmp)
+      { wxMemoryDC memDC;
+        memDC.SelectObject(* bmp);
+        DrawField(&memDC, xc1, yc1, xc2, yc2);
+        memDC.SelectObject(wxNullBitmap);
+      }
+  }
+
+// Called when the canvas receives a mouse event.
+void BombsCanvasClass::OnEvent(wxMouseEvent& event)
+{
+  wxCoord fx, fy;
+  event.GetPosition(&fx, &fy);
+  int x = fx/(x_cell*X_UNIT);
+  int y = fy/(y_cell*Y_UNIT);
+  if (x<field_width && y<field_height)
+    { if ( (event.RightDown() || (event.LeftDown() && event.ShiftDown()))
+           && (wxGetApp().Game.IsHidden(x,y)
+               || wxGetApp().Game.GetRemainingCells()==0))
+        { wxGetApp().Game.Mark(x,y);
+          Refresh(x, y, x, y);
+          return;
+        }
+      else if (event.LeftDown() && wxGetApp().Game.IsHidden(x,y)
+               && !wxGetApp().Game.IsMarked(x,y))
+        { wxGetApp().Game.Unhide(x,y);
+          Refresh(x, y, x, y);
+          if (wxGetApp().Game.IsBomb(x,y) || wxGetApp().Game.GetRemainingCells()==0)
+            { wxBell();
+              if (!wxGetApp().Game.IsBomb(x,y))
+                { wxMessageBox("Nice! You found all the bombs!", "wxWin Bombs",
+                             wxOK|wxCENTRE, wxGetApp().BombsFrame);
+                }
+              else // x,y is a bomb
+                { wxGetApp().Game.Explode(x, y);
+                }
+              for(x=0; x<field_width; x++)
+                for(y=0; y<field_height; y++)
+                  wxGetApp().Game.Unhide(x,y);
+              Refresh(0, 0, field_width-1, field_height-1);
+            }
+          return;
+        }
+    }
+}
+
diff --git a/demos/bombs/descrip.mms b/demos/bombs/descrip.mms
new file mode 100644 (file)
index 0000000..2d2cdaa
--- /dev/null
@@ -0,0 +1,32 @@
+#*****************************************************************************
+#                                                                            *
+# Make file for VMS                                                          *
+# Author : J.Jansen (joukj@hrem.stm.tudelft.nl)                              *
+# Date : 10 November 1999                                                     *
+#                                                                            *
+#*****************************************************************************
+.first
+       define wx [--.include.wx]
+
+.ifdef __WXMOTIF__
+CXX_DEFINE = /define=(__WXMOTIF__=1)
+.else
+CXX_DEFINE =
+.endif
+
+.suffixes : .cpp
+
+.cpp.obj :
+       cxx $(CXXFLAGS)$(CXX_DEFINE) $(MMS$TARGET_NAME).cpp
+
+all :
+       $(MMS)$(MMSQUALIFIERS) game.exe
+
+game.exe : game.obj bombs1.obj bombs.obj
+.ifdef __WXMOTIF__
+       cxxlink game,bombs1,bombs,[--.lib]vms/opt
+.endif
+
+game.obj : game.cpp
+bombs1.obj : bombs1.cpp
+bombs.obj : bombs.cpp
diff --git a/demos/bombs/game.cpp b/demos/bombs/game.cpp
new file mode 100644 (file)
index 0000000..d49b6a4
--- /dev/null
@@ -0,0 +1,105 @@
+///////////////////////////////////////////////////////////////////////////////
+// Name:        bombs1.cpp
+// Purpose:     Implementation of the class BombsGame
+// Author:      P. Foggia 1996
+// Modified by:
+// Created:     1996
+// RCS-ID:      $Id$
+// Copyright:   (c) 1996 P. Foggia
+// Licence:     wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include "wx/wxprec.h"
+
+#ifndef  WX_PRECOMP
+  #include "wx/wx.h"
+#endif //precompiled headers
+
+#include "game.h"
+#include <stdlib.h>
+#include <limits.h>
+
+#define PROB 0.2
+
+#ifndef RAND_MAX
+#define RAND_MAX INT_MAX
+#endif
+
+
+/*--------------------  BombsGame::~BombsGame()  ---------------------*/
+/*--------------------------------------------------------------------*/
+BombsGame::~BombsGame()
+  { if (field)
+      free(field);
+  }
+
+/*------------------  int BombsGame::Init(width,height)  -------------------*/
+/* Initialize the play field.   Returns 0 on failure                        */
+/*--------------------------------------------------------------------------*/
+int BombsGame::Init(int aWidth, int aHeight)
+  { int x, y;
+    int xx, yy;
+
+    if (field)
+      free(field);
+    field=(short *)malloc(aWidth*aHeight*sizeof(short));
+    if (!field)
+      { width=height=0;
+        return 0;
+      }
+    width=aWidth;
+    height=aHeight;
+
+    for(x=0; x<width; x++)
+      for(y=0; y<height; y++)
+        { field[x+y*width] = ((float)rand()/RAND_MAX <PROB)?
+                             BG_HIDDEN | BG_BOMB :
+                             BG_HIDDEN;
+        }
+
+    bombs=0;
+    for(x=0; x<width; x++)
+      for(y=0; y<height; y++)
+        if (field[x+y*width] & BG_BOMB)
+          { bombs++;
+            for(xx=x-1; xx<=x+1; xx++)
+              if (xx>=0 && xx<width)
+                for(yy=y-1; yy<=y+1; yy++)
+                  if (yy>=0 && yy<height && (yy!=y || xx!=x))
+                    field[xx+yy*width]++;
+          }
+    normal_cells=height*width-bombs;
+    return 1;
+  }
+
+/*----------------------  BombsGame::Mark(x,y)  -------------------------*/
+/* Marks/unmarks a cell                                                  */
+/*-----------------------------------------------------------------------*/
+void BombsGame::Mark(int x, int y)
+  {
+      field[x+y*width] ^= BG_MARKED;
+  }
+
+/*-------------------  BombsGame::Unhide(x,y)  ------------------------*/
+/* Unhides a cell                                                      */
+/*---------------------------------------------------------------------*/
+void BombsGame::Unhide(int x, int y)
+  { if (!IsHidden(x,y))
+      return;
+    field[x+y*width] &= ~BG_HIDDEN;
+    if (!IsBomb(x,y))
+      normal_cells--;
+  }
+
+/*-------------------  BombsGame::Explode(x,y)  ------------------------*/
+/* Makes a cell exploded                                                */
+/*----------------------------------------------------------------------*/
+void BombsGame::Explode(int x, int y)
+  {
+    field[x+y*width] |= BG_EXPLODED;
+  }
+
diff --git a/demos/bombs/game.h b/demos/bombs/game.h
new file mode 100644 (file)
index 0000000..ad16000
--- /dev/null
@@ -0,0 +1,42 @@
+//---------------------------------------------------------------
+// game.h
+// Definition of the class BombsGame, containing the data for a
+// playfield
+//---------------------------------------------------------------
+#ifndef GAME_H
+#define GAME_H
+
+#define BG_HIDDEN   0x100
+#define BG_BOMB     0x200
+#define BG_MARKED   0x400
+#define BG_EXPLODED 0x800
+#define BG_MASK     0x0FF
+
+
+#include <stddef.h>
+
+class BombsGame
+  { protected:
+      int width,height;
+      short *field;
+      int bombs,normal_cells;
+    public:
+      BombsGame() { width=height=0; field=NULL; };
+      ~BombsGame();
+      int Init(int width, int height);
+      int GetWidth() { return width; };
+      int GetHeight() { return height; };
+      int Get(int x, int y) { return field[x+y*width]; };
+      void Mark(int x, int y);
+      void Unhide(int x, int y);
+      void Explode(int x, int y);
+      int IsHidden(int x, int y) { return Get(x,y) & BG_HIDDEN; };
+      int IsMarked(int x, int y) { return Get(x,y) & BG_MARKED; };
+      int IsBomb(int x, int y) { return Get(x,y) & BG_BOMB; };
+      int IsExploded(int x, int y) { return Get(x,y) & BG_EXPLODED; };
+      int GetBombs() { return bombs; };
+      int GetRemainingCells() { return normal_cells; };
+  };
+
+#endif /* def GAME_H */
+
diff --git a/demos/bombs/makefile.b32 b/demos/bombs/makefile.b32
new file mode 100644 (file)
index 0000000..563f61f
--- /dev/null
@@ -0,0 +1,16 @@
+#
+# File:                makefile.b32
+# Author:      Julian Smart
+# Created:     1999
+# Updated:     
+# Copyright:
+#
+# Makefile : Builds sample for 32-bit BC++
+
+WXDIR = $(WXWIN)
+
+TARGET=bombs
+OBJECTS = $(TARGET).obj bombs1.obj game.obj
+
+!include $(WXDIR)\src\makeprog.b32
+
diff --git a/demos/bombs/makefile.bcc b/demos/bombs/makefile.bcc
new file mode 100644 (file)
index 0000000..38896fc
--- /dev/null
@@ -0,0 +1,19 @@
+#
+# File:                makefile.bcc
+# Author:      Julian Smart
+# Created:     1998
+# Updated:     
+#
+# Builds a BC++ 16-bit sample
+
+!if "$(WXWIN)" == ""
+!error You must define the WXWIN variable in autoexec.bat, e.g. WXWIN=c:\wx
+!endif
+
+WXDIR = $(WXWIN)
+
+TARGET=bombs
+OBJECTS=$(TARGET).obj bombs1.obj game.obj
+
+!include $(WXDIR)\src\makeprog.bcc
+
diff --git a/demos/bombs/makefile.dos b/demos/bombs/makefile.dos
new file mode 100644 (file)
index 0000000..8af1fd0
--- /dev/null
@@ -0,0 +1,17 @@
+#
+# File:                makefile.dos
+# Author:      Julian Smart
+# Created:     1998
+# Updated:     
+#
+# Makefile : Builds 16-bit sample, VC++ 1.5
+# Use FINAL=1 argument to nmake to build final version with no debugging
+# info
+
+WXDIR = $(WXWIN)
+
+TARGET=bombs
+OBJECTS = $(TARGET).obj bombs1.obj game.obj
+
+!include $(WXDIR)\src\makeprog.msc
+
diff --git a/demos/bombs/makefile.g95 b/demos/bombs/makefile.g95
new file mode 100644 (file)
index 0000000..43119df
--- /dev/null
@@ -0,0 +1,16 @@
+#
+# File:         makefile.g95
+# Author:       Julian Smart
+# Created:      1999
+# Updated:
+# Copyright:    (c) Julian Smart, 1999
+#
+# Makefile for wxWindows sample (Cygwin/Mingw32).
+
+WXDIR = ../..
+
+TARGET=bombs
+OBJECTS = $(TARGET).o bombs1.o game.o
+
+include $(WXDIR)/src/makeprog.g95
+
diff --git a/demos/bombs/makefile.unx b/demos/bombs/makefile.unx
new file mode 100644 (file)
index 0000000..9b4f82a
--- /dev/null
@@ -0,0 +1,35 @@
+#
+# File:                Makefile for samples
+# Author:      Robert Roebling
+# Created:     1999
+# Updated:     
+# Copyright:   (c) 1998 Robert Roebling
+#
+# This makefile requires a Unix version of wxWindows
+# to be installed on your system. This is most often
+# done typing "make install" when using the complete
+# sources of wxWindows or by installing the two
+# RPM packages wxGTK.XXX.rpm and wxGTK-devel.XXX.rpm
+# under Linux.
+#
+
+CC = gcc
+
+PROGRAM = bombs
+
+OBJECTS = $(PROGRAM).o game.o bombs1.o
+
+# implementation
+
+.SUFFIXES:     .o .cpp
+
+.cpp.o :
+       $(CC) -c `wx-config --cflags` -o $@ $<
+
+all:    $(PROGRAM)
+
+$(PROGRAM):    $(OBJECTS)
+       $(CC) -o $(PROGRAM) $(OBJECTS) `wx-config --libs`
+
+clean: 
+       rm -f *.o $(PROGRAM)
diff --git a/demos/bombs/makefile.vc b/demos/bombs/makefile.vc
new file mode 100644 (file)
index 0000000..06a647f
--- /dev/null
@@ -0,0 +1,18 @@
+#
+# File:                makefile.vc
+# Author:      Julian Smart
+# Created:     1999
+# Updated:     
+# Copyright:   (c) Julian Smart
+#
+# Makefile : Builds sample (VC++, WIN32)
+# Use FINAL=1 argument to nmake to build final version with no debug info.
+
+# Set WXDIR for your system
+WXDIR = $(WXWIN)
+
+PROGRAM=bombs
+OBJECTS = $(PROGRAM).obj bombs1.obj game.obj
+
+!include $(WXDIR)\src\makeprog.vc
+
diff --git a/demos/bombs/makefile.wat b/demos/bombs/makefile.wat
new file mode 100644 (file)
index 0000000..08562fa
--- /dev/null
@@ -0,0 +1,15 @@
+#
+# Makefile for WATCOM
+#
+# Created by Julian Smart, January 1999
+# 
+#
+
+WXDIR = $(%WXWIN)
+
+PROGRAM = bombs
+OBJECTS = $(PROGRAM).obj bombs1.obj game.obj
+
+!include $(WXDIR)\src\makeprog.wat
+
+
diff --git a/demos/bombs/readme.txt b/demos/bombs/readme.txt
new file mode 100644 (file)
index 0000000..4e6e8da
--- /dev/null
@@ -0,0 +1,78 @@
+                    wxWin Bombs
+                 by Pasquale Foggia
+
+1. The aim of the program
+wxWin Bombs is the wxWin implementation of the minesweeper game you find
+under MSWindows 3.1+. Later the rules of the game will be explained for
+the lucky ones of you that have never used Windows.
+
+2. Installation
+If you are reading this file, I suppose you have succesfully unpacked the
+files in a directory of your hard disk :-). You should already have
+installed wxWin on your system.
+Now you have to modify makefile.bcc
+(if a Windows user) or makefile.unx (if you use a real OS) setting the 
+proper values for the directories. Finally, you have to run:
+  make -f makefile.bcc
+for Windows (nmake if you use a MicroSoft compiler), or:
+  make -f makefile.unx xview
+for Unix+xview and
+  make -f makefile.unx motif
+for Unix+motif
+
+If you are lucky, you will find the bombs executable, ready to be run.
+
+3. Test
+Bombs has been tested under the following platforms:
+  PC + MSWindos 3.1 + wxWin 1.60 + Borland C 3.1
+  Sun SPARCstation 20 + SunOS + xview + wxWin 1.63 + gcc 2.3.3
+and all seems to work fine.
+
+4. The author
+This program has been developed by Pasquale Foggia, a PhD student 
+in Computer Engineering at the "Federico II" University of Naples, Italy.
+You can contacting him using the following address:
+  foggia@amalfi.dis.unina.it
+
+5. Disclaimer
+This program is freeware. You can do everything you want with it, including
+copying and modifying, without the need of a permission from the author.
+On the other hand, this program is provided AS IS, with NO KIND OF WARRANTY.
+The author will be in NO CASE responsible for damages directly or indirectly 
+caused by this program. Use it AT YOUR OWN RISK, or don't use it at all. 
+
+6. The rules of the game
+Your aim is to discover all the bombs in a mined field. If you click with
+the left mouse button on a cell containing a bomb, your game ends. 
+Otherwise, the number of bombs in the 8 neighbour cells will be displayed. 
+When you have clicked all the cells without a bomb, you win.
+You can also use the right button (or left button+shift) to mark a cell
+you think hides a bomb, in order to not click it accidentally.
+
+7. Concluding remarks
+I hope someone of you will enjoy this program. However, I enjoyed writing
+it (thanks to Julian Smart and all the other wxWin developers).   
+In the near future I plan to implement under wxWin the great 'empire'
+(is there someone that still remember it?), IMHO one of the most addictive
+strategy games. If someone is interested, please contact me by e-mail.
+I beg you pardon for my approximative english.
+
+                                               Pasquale Foggia
+                                               foggia@amalfi.dis.unina.it
+
+
+------
+A note from Julian Smart: Many thanks to Pasquale for the contribution.
+I've taken the liberty of making a few changes.
+
+1) I've made the status line have a single field so that you
+can see the 'cells remaining' message properly.
+
+2) I've changed the title from "wxWin Bombs" (which, as a statement,
+is an unfortunate reflection of the reality of earlier versions of
+wxWindows :-)) to wxBombs.
+
+3) Added SetClientData to resize the window on Restart; eliminated
+scrollbars; made the frame unresizeable.
+
+4) Added makefile.dos for VC++ 1.x, makefile.wat for Watcom C++.
\ No newline at end of file
diff --git a/demos/forty/.cvsignore b/demos/forty/.cvsignore
new file mode 100644 (file)
index 0000000..8b13789
--- /dev/null
@@ -0,0 +1 @@
+
diff --git a/demos/forty/Makefile.in b/demos/forty/Makefile.in
new file mode 100644 (file)
index 0000000..9398b93
--- /dev/null
@@ -0,0 +1,21 @@
+#
+# File:                Makefile.in
+# Author:      Julian Smart
+# Created:     1998
+# Updated:     
+# Copyright:   (c) 1998 Julian Smart
+#
+# "%W% %G%"
+#
+# Makefile for forty example (UNIX).
+
+top_srcdir = @top_srcdir@
+top_builddir = ../..
+program_dir = samples/forty
+
+PROGRAM=forty
+
+OBJECTS=$(PROGRAM).o canvas.o card.o game.o pile.o playerdg.o scoredg.o scorefil.o
+
+include ../../src/makeprog.env
+
diff --git a/demos/forty/canvas.cpp b/demos/forty/canvas.cpp
new file mode 100644 (file)
index 0000000..384d2be
--- /dev/null
@@ -0,0 +1,253 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        canvas.cpp
+// Purpose:     Forty Thieves patience game
+// Author:      Chris Breeze
+// Modified by:
+// Created:     21/07/97
+// RCS-ID:      $Id$
+// Copyright:   (c) 1993-1998 Chris Breeze
+// Licence:    wxWindows licence
+//---------------------------------------------------------------------------
+// Last modified: 22nd July 1998 - ported to wxWindows 2.0
+/////////////////////////////////////////////////////////////////////////////
+
+#ifdef __GNUG__
+#pragma implementation
+#pragma interface
+#endif
+
+// For compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+
+#include "forty.h"
+#include "card.h"
+#include "game.h"
+#include "scorefil.h"
+#include "playerdg.h"
+#include "canvas.h"
+
+BEGIN_EVENT_TABLE(FortyCanvas, wxScrolledWindow)
+    EVT_MOUSE_EVENTS(FortyCanvas::OnMouseEvent)
+END_EVENT_TABLE()
+
+FortyCanvas::FortyCanvas(wxWindow* parent, int x, int y, int w, int h) :
+       wxScrolledWindow(parent, -1, wxPoint(x, y), wxSize(w, h)),
+       m_helpingHand(TRUE),
+       m_rightBtnUndo(TRUE),
+       m_playerDialog(0),
+       m_leftBtnDown(FALSE)
+{
+#ifdef __WXGTK__
+       m_font = wxTheFontList->FindOrCreateFont(12, wxROMAN, wxNORMAL, wxNORMAL);
+#else
+       m_font = wxTheFontList->FindOrCreateFont(10, wxSWISS, wxNORMAL, wxNORMAL);
+#endif
+       SetBackgroundColour(FortyApp::BackgroundColour());
+
+       m_handCursor = new wxCursor(wxCURSOR_HAND);
+       m_arrowCursor = new wxCursor(wxCURSOR_ARROW);
+
+       wxString name = wxTheApp->GetAppName();
+       if (name.Length() <= 0) name = "forty";
+       m_scoreFile = new ScoreFile(name);
+       m_game = new Game(0, 0, 0);
+       m_game->Deal();
+}
+
+
+FortyCanvas::~FortyCanvas()
+{
+       UpdateScores();
+       delete m_game;
+       delete m_scoreFile;
+}
+
+
+/*
+Write the current player's score back to the score file
+*/
+void FortyCanvas::UpdateScores()
+{
+       if (m_player.Length() > 0 && m_scoreFile && m_game)
+       {
+               m_scoreFile->WritePlayersScore(
+                               m_player,
+                               m_game->GetNumWins(),
+                               m_game->GetNumGames(),
+                               m_game->GetScore()
+                               );
+       }
+}
+
+
+void FortyCanvas::OnDraw(wxDC& dc)
+{
+       dc.SetFont(* m_font);
+       m_game->Redraw(dc);
+
+       // if player name not set (and selection dialog is not displayed)
+       // then ask the player for their name
+       if (m_player.Length() == 0 && !m_playerDialog)
+       {
+               m_playerDialog = new PlayerSelectionDialog(this, m_scoreFile);
+               m_playerDialog->ShowModal();
+               m_player = m_playerDialog->GetPlayersName();
+               if (m_player.Length() > 0)
+               {
+                       // user entered a name - lookup their score
+                       int wins, games, score;
+                       m_scoreFile->ReadPlayersScore(m_player, wins, games, score);
+                       m_game->NewPlayer(wins, games, score);
+                       m_game->DisplayScore(dc);
+                       m_playerDialog->Destroy();
+                       m_playerDialog = 0;
+                       Refresh();
+               }
+               else
+               {
+                       // user cancelled the dialog - exit the app
+                       ((wxFrame*)GetParent())->Close(TRUE);
+               }
+       }
+}
+
+/*
+Called when the main frame is closed
+*/
+bool FortyCanvas::OnCloseCanvas()
+{
+       if (m_game->InPlay() &&
+               wxMessageBox("Are you sure you want to\nabandon the current game?",
+                       "Warning", wxYES_NO | wxICON_QUESTION) == wxNO)
+       {
+        return FALSE;
+       }
+       return TRUE;
+}
+
+void FortyCanvas::OnMouseEvent(wxMouseEvent& event)
+{
+       int mouseX = (int)event.GetX();
+       int mouseY = (int)event.GetY();
+
+       wxClientDC dc(this); 
+       PrepareDC(dc);
+       dc.SetFont(* m_font);
+
+       if (event.LeftDClick())
+       {
+               if (m_leftBtnDown)
+               {
+                       m_leftBtnDown = FALSE;
+                       ReleaseMouse();
+                       m_game->LButtonUp(dc, mouseX, mouseY);
+               }
+               m_game->LButtonDblClk(dc, mouseX, mouseY);
+       }
+       else if (event.LeftDown())
+       {
+               if (!m_leftBtnDown)
+               {
+                       m_leftBtnDown = TRUE;
+                       CaptureMouse();
+                       m_game->LButtonDown(dc, mouseX, mouseY);
+               }
+       }
+       else if (event.LeftUp())
+       {
+               if (m_leftBtnDown)
+               {
+                       m_leftBtnDown = FALSE;
+                       ReleaseMouse();
+                       m_game->LButtonUp(dc, mouseX, mouseY);
+               }
+       }
+       else if (event.RightDown() && !event.LeftIsDown())
+       {
+               // only allow right button undo if m_rightBtnUndo is TRUE
+               if (m_rightBtnUndo)
+               {
+                       if (event.ControlDown() || event.ShiftDown())
+                       {
+                               m_game->Redo(dc);
+                       }
+                       else
+                       {
+                               m_game->Undo(dc);
+                       }
+               }
+       }
+       else if (event.Dragging())
+       {
+               m_game->MouseMove(dc, mouseX, mouseY);
+       }
+
+       if (!event.LeftIsDown())
+       {
+               SetCursorStyle(mouseX, mouseY);
+       }
+}
+
+void FortyCanvas::SetCursorStyle(int x, int y)
+{
+       if (m_game->HaveYouWon())
+       {
+               if (wxMessageBox("Do you wish to play again?",
+                       "Well Done, You have won!", wxYES_NO | wxICON_QUESTION) == wxYES)
+               {
+                       m_game->Deal();
+
+                       wxClientDC dc(this); 
+                       PrepareDC(dc);
+                       dc.SetFont(* m_font);
+                       m_game->Redraw(dc);
+               }
+               else
+               {
+                       // user cancelled the dialog - exit the app
+                       ((wxFrame*)GetParent())->Close(TRUE);
+               }
+       }
+
+       // Only set cursor to a hand if 'helping hand' is enabled and
+       // the card under the cursor can go somewhere 
+       if (m_game->CanYouGo(x, y) && m_helpingHand)
+       {
+               SetCursor(* m_handCursor);
+       }
+       else
+       {
+               SetCursor(* m_arrowCursor);
+       }
+
+}
+
+void FortyCanvas::NewGame()
+{
+       m_game->Deal();
+       Refresh();
+}
+
+void FortyCanvas::Undo()
+{
+       wxClientDC dc(this); 
+       PrepareDC(dc);
+       dc.SetFont(* m_font);
+       m_game->Undo(dc);
+}
+
+void FortyCanvas::Redo()
+{
+       wxClientDC dc(this); 
+       PrepareDC(dc);
+       dc.SetFont(* m_font);
+       m_game->Redo(dc);
+}
diff --git a/demos/forty/canvas.h b/demos/forty/canvas.h
new file mode 100644 (file)
index 0000000..60abf5f
--- /dev/null
@@ -0,0 +1,56 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        canvas.h
+// Purpose:     Forty Thieves patience game
+// Author:      Chris Breeze
+// Modified by:
+// Created:     21/07/97
+// RCS-ID:      $Id$
+// Copyright:   (c) 1993-1998 Chris Breeze
+// Licence:    wxWindows licence
+//---------------------------------------------------------------------------
+// Last modified: 22nd July 1998 - ported to wxWindows 2.0
+/////////////////////////////////////////////////////////////////////////////
+#ifndef _CANVAS_H_
+#define _CANVAS_H_
+
+class Card;
+class Game;
+class ScoreFile;
+class PlayerSelectionDialog;
+
+class FortyCanvas: public wxScrolledWindow
+{
+public:
+       FortyCanvas(wxWindow* parent, int x, int y, int w, int h);
+       virtual ~FortyCanvas();
+
+       virtual void OnDraw(wxDC& dc);
+       bool OnCloseCanvas();
+       void OnMouseEvent(wxMouseEvent& event);
+       void SetCursorStyle(int x, int y);
+
+       void NewGame();
+       void Undo();
+       void Redo();
+
+       ScoreFile* GetScoreFile() const                 { return m_scoreFile; }
+       void UpdateScores();
+       void EnableHelpingHand(bool enable)             { m_helpingHand = enable; }
+       void EnableRightButtonUndo(bool enable) { m_rightBtnUndo = enable; }
+
+       DECLARE_EVENT_TABLE()
+
+private:
+       wxFont*         m_font;
+       Game*           m_game;
+       ScoreFile*      m_scoreFile;
+       wxCursor*       m_arrowCursor;
+       wxCursor*       m_handCursor;
+       bool            m_helpingHand;
+       bool            m_rightBtnUndo;
+       wxString        m_player;
+       PlayerSelectionDialog* m_playerDialog;
+       bool            m_leftBtnDown;
+};
+
+#endif
diff --git a/demos/forty/card.cpp b/demos/forty/card.cpp
new file mode 100644 (file)
index 0000000..b74fcee
--- /dev/null
@@ -0,0 +1,358 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        card.cpp
+// Purpose:     Forty Thieves patience game
+// Author:      Chris Breeze
+// Modified by:
+// Created:     21/07/97
+// RCS-ID:      $Id$
+// Copyright:   (c) 1993-1998 Chris Breeze
+// Licence:    wxWindows licence
+//---------------------------------------------------------------------------
+// Last modified: 22nd July 1998 - ported to wxWindows 2.0
+/////////////////////////////////////////////////////////////////////////////
+//+-------------------------------------------------------------+
+//| Description
+//|    A class for drawing playing cards.
+//|    Currently assumes that the card symbols have been
+//|    loaded into hbmap_symbols and the pictures for the
+//|    Jack, Queen and King have been loaded into
+//|    hbmap_pictures.
+//+-------------------------------------------------------------+
+
+#ifdef __GNUG__
+#pragma implementation
+#pragma interface
+#endif
+
+// For compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include "forty.h"
+#include "card.h"
+
+#if defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXMAC__)
+#include "pictures.xpm"
+#include "symbols.xbm"
+#endif
+
+wxBitmap* Card::m_pictureBmap = 0;
+wxBitmap* Card::m_symbolBmap = 0;
+
+
+//+-------------------------------------------------------------+
+//| Card::Card()                                                                                               |
+//+-------------------------------------------------------------+
+//| Description:                                                                                               |
+//|    Constructor for a playing card.                                                         |
+//|    Checks that the value is in the range 1..52 and then            |
+//|    initialises the suit, colour, pipValue and wayUp.                       |
+//+-------------------------------------------------------------+
+Card::Card(int value, WayUp way_up) :
+       m_wayUp(way_up)
+{
+       if (!m_symbolBmap)
+       {
+#ifdef __WXMSW__
+               m_symbolBmap = new wxBitmap("CardSymbols", wxBITMAP_TYPE_BMP_RESOURCE);
+#else
+               m_symbolBmap = new wxBitmap(Symbols_bits, Symbols_width, Symbols_height);
+#endif
+               if (!m_symbolBmap->Ok())
+               {
+                       ::wxMessageBox("Failed to load bitmap CardSymbols", "Error");
+               }
+       }
+       if (!m_pictureBmap)
+       {
+#ifdef __WXMSW__
+               m_pictureBmap = new wxBitmap("CardPictures", wxBITMAP_TYPE_BMP_RESOURCE);
+#else
+               m_pictureBmap = new wxBitmap(Pictures);
+#endif
+               if (!m_pictureBmap->Ok())
+               {
+                       ::wxMessageBox("Failed to load bitmap CardPictures", "Error");
+               }
+       }
+
+    if (value >= 1 && value <= PackSize)
+    {
+               switch ((value - 1) / 13)
+               {
+               case 0:
+                       m_suit = clubs;
+                       m_colour = black;
+                       break;
+               case 1:
+                       m_suit = diamonds;
+                       m_colour = red;
+                       break;
+               case 2:
+                       m_suit = hearts;
+                       m_colour = red;
+                       break;
+               case 3:
+                       m_suit = spades;
+                       m_colour = black;
+                       break;
+               }
+               m_pipValue = 1 + (value - 1) % 13;
+               m_status = TRUE;
+    }
+    else
+    {
+        m_status = FALSE;
+    }
+} // Card::Card()
+
+
+//+-------------------------------------------------------------+
+//| Card::~Card()                                                                                              |
+//+-------------------------------------------------------------+
+//| Description:                                                                                               |
+//|    Destructor - nothing to do at present.                                          |
+//+-------------------------------------------------------------+
+Card::~Card()
+{
+}
+
+
+//+-------------------------------------------------------------+
+//| Card::Erase()                                                                                              |
+//+-------------------------------------------------------------+
+//| Description:                                                                                               |
+//|    Erase the card at (x, y) by drawing a rectangle in the          |
+//|    background colour.                                                                                      |
+//+-------------------------------------------------------------+
+void Card::Erase(wxDC& dc, int x, int y)
+{
+       wxPen* pen = wxThePenList->FindOrCreatePen(
+                                               FortyApp::BackgroundColour(),
+                                               1,
+                                               wxSOLID
+                                               );
+       dc.SetPen(* pen);
+       dc.SetBrush(FortyApp::BackgroundBrush());
+       dc.DrawRectangle(x, y, CardWidth, CardHeight);
+} // Card::Erase()
+
+
+//+-------------------------------------------------------------+
+//| Card::Draw()                                                                                               |
+//+-------------------------------------------------------------+
+//| Description:                                                                                               |
+//|    Draw the card at (x, y).                                                                        |
+//|    If the card is facedown draw the back of the card.                      |
+//|    If the card is faceup draw the front of the card.                       |
+//|    Cards are not held in bitmaps, instead they are drawn           |
+//|    from their constituent parts when required.                                     |
+//|    hbmap_symbols contains large and small suit symbols and         |
+//|    pip values. These are copied to the appropriate part of         |
+//|    the card. Picture cards use the pictures defined in                     |
+//|    hbmap_pictures. Note that only one picture is defined           |
+//|    for the Jack, Queen and King, unlike a real pack where          |
+//|    each suit is different.                                                                         |
+//|                                                                                                                            |
+//| WARNING:                                                                                                   |
+//|    The locations of these symbols is 'hard-wired' into the         |
+//|    code. Editing the bitmaps or the numbers below will                     |
+//|    result in the wrong symbols being displayed.                            |
+//+-------------------------------------------------------------+
+void Card::Draw(wxDC& dc, int x, int y)
+{
+       wxBrush backgroundBrush( dc.GetBackground() );
+       dc.SetBrush(* wxWHITE_BRUSH);
+       dc.SetPen(* wxBLACK_PEN);
+       dc.DrawRoundedRectangle(x, y, CardWidth, CardHeight, 4);
+       if (m_wayUp == facedown)
+       {
+               dc.SetBackground(* wxRED_BRUSH);
+               dc.SetBackgroundMode(wxSOLID);
+               wxBrush* brush = wxTheBrushList->FindOrCreateBrush(
+                                                       "BLACK", wxCROSSDIAG_HATCH
+                                                       );
+               dc.SetBrush(* brush);
+
+               dc.DrawRoundedRectangle(
+                               x + 4, y + 4,
+                               CardWidth - 8, CardHeight - 8,
+                               2
+                               );
+       }
+       else
+       {
+               wxMemoryDC memoryDC;
+               memoryDC.SelectObject(* m_symbolBmap);
+
+//             dc.SetBackgroundMode(wxTRANSPARENT);
+
+               dc.SetTextBackground(*wxWHITE);
+               switch (m_suit)
+               {
+               case spades:
+               case clubs:
+                       dc.SetTextForeground(*wxBLACK);
+                       break;
+               case diamonds:
+               case hearts:
+                       dc.SetTextForeground(*wxRED);
+                       break;
+               }
+                       // Draw the value
+               dc.Blit(x + 3, y + 3, 6, 7,
+                               &memoryDC, 6 * (m_pipValue - 1), 36, wxCOPY);
+               dc.Blit(x + CardWidth - 9, y + CardHeight - 11, 6, 7,
+                               &memoryDC, 6 * (m_pipValue - 1), 43, wxCOPY);
+
+                       // Draw the pips
+               dc.Blit(x + 11, y + 3, 7, 7,
+                               &memoryDC, 7 * m_suit, 0, wxCOPY);
+               dc.Blit(x + CardWidth - 17, y + CardHeight - 11, 7, 7,
+                               &memoryDC, 7 * m_suit, 7, wxCOPY);
+
+               switch (m_pipValue)
+               {
+               case 1:
+                       dc.Blit(x - 5 + CardWidth / 2, y - 5 + CardHeight / 2, 11, 11,
+                          &memoryDC, 11 * m_suit, 14, wxCOPY);
+                       break;
+
+               case 3:
+                       dc.Blit(x - 5 + CardWidth / 2, y - 5 + CardHeight / 2, 11, 11,
+                          &memoryDC, 11 * m_suit, 14, wxCOPY);
+               case 2:
+                       dc.Blit(x - 5 + CardWidth / 2,
+                               y - 5 + CardHeight / 4, 11, 11,
+                               &memoryDC, 11 * m_suit, 14, wxCOPY);
+                       dc.Blit(x - 5 + CardWidth / 2,
+                               y - 5 + 3 * CardHeight / 4, 11, 11,
+                               &memoryDC, 11 * m_suit, 25, wxCOPY);
+                       break;
+
+               case 5:
+                       dc.Blit(x - 5 + CardWidth / 2, y - 5 + CardHeight / 2, 11, 11,
+                          &memoryDC, 11 * m_suit, 14, wxCOPY);
+               case 4:
+                       dc.Blit(x - 5 +  CardWidth / 4,
+                               y - 5 + CardHeight / 4, 11, 11,
+                               &memoryDC, 11 * m_suit, 14, wxCOPY);
+                       dc.Blit(x - 5 + CardWidth / 4,
+                               y - 5 + 3 * CardHeight / 4, 11, 11,
+                               &memoryDC, 11 * m_suit, 25, wxCOPY);
+                       dc.Blit(x - 5 + 3 * CardWidth / 4,
+                               y - 5 + CardHeight / 4, 11, 11,
+                               &memoryDC, 11 * m_suit, 14, wxCOPY);
+                       dc.Blit(x - 5 + 3 * CardWidth / 4,
+                               y - 5 + 3 * CardHeight / 4, 11, 11,
+                               &memoryDC, 11 * m_suit, 25, wxCOPY);
+                       break;
+
+               case 8:
+                       dc.Blit(x - 5 + 5 * CardWidth / 10,
+                               y - 5 + 5 * CardHeight / 8, 11, 11,
+                               &memoryDC, 11 * m_suit, 25, wxCOPY);
+               case 7:
+                       dc.Blit(x - 5 + 5 * CardWidth / 10,
+                               y - 5 + 3 * CardHeight / 8, 11, 11,
+                               &memoryDC, 11 * m_suit, 14, wxCOPY);
+               case 6:
+                       dc.Blit(x - 5 + CardWidth / 4,
+                               y - 5 + CardHeight / 4, 11, 11,
+                               &memoryDC, 11 * m_suit, 14, wxCOPY);
+                       dc.Blit(x - 5 + CardWidth / 4,
+                               y - 5 + CardHeight / 2, 11, 11,
+                               &memoryDC, 11 * m_suit, 14, wxCOPY);
+                       dc.Blit(x - 5 + CardWidth / 4,
+                               y - 5 + 3 * CardHeight / 4, 11, 11,
+                               &memoryDC, 11 * m_suit, 25, wxCOPY);
+                       dc.Blit(x - 5 + 3 * CardWidth / 4,
+                               y - 5 + CardHeight / 4, 11, 11,
+                               &memoryDC, 11 * m_suit, 14, wxCOPY);
+                       dc.Blit(x - 5 + 3 * CardWidth / 4,
+                               y - 5 + CardHeight / 2, 11, 11,
+                               &memoryDC, 11 * m_suit, 14, wxCOPY);
+                       dc.Blit(x - 5 + 3 * CardWidth / 4,
+                               y - 5 + 3 * CardHeight / 4, 11, 11,
+                               &memoryDC, 11 * m_suit, 25, wxCOPY);
+                       break;
+
+               case 10:
+                       dc.Blit(x - 5 + CardWidth / 2,
+                               y - 5 + 2 * CardHeight / 3, 11, 11,
+                               &memoryDC, 11 * m_suit, 25, wxCOPY);
+               case 9:
+                       dc.Blit(x - 5 + CardWidth / 4,
+                               y - 6 + CardHeight / 4, 11, 11,
+                               &memoryDC, 11 * m_suit, 14, wxCOPY);
+                       dc.Blit(x - 5 + CardWidth / 4,
+                               y - 6 + 5 * CardHeight / 12, 11, 11,
+                               &memoryDC, 11 * m_suit, 14, wxCOPY);
+                       dc.Blit(x - 5 + CardWidth / 4,
+                               y - 5 + 7 * CardHeight / 12, 11, 11,
+                               &memoryDC, 11 * m_suit, 25, wxCOPY);
+                       dc.Blit(x - 5 + CardWidth / 4,
+                               y - 5 + 3 * CardHeight / 4, 11, 11,
+                               &memoryDC, 11 * m_suit, 25, wxCOPY);
+
+                       dc.Blit(x - 5 + 3 * CardWidth / 4,
+                               y - 6 + CardHeight / 4, 11, 11,
+                               &memoryDC, 11 * m_suit, 14, wxCOPY);
+                       dc.Blit(x - 5 + 3 * CardWidth / 4,
+                               y - 6 + 5 * CardHeight / 12, 11, 11,
+                               &memoryDC, 11 * m_suit, 14, wxCOPY);
+                       dc.Blit(x - 5 + 3 * CardWidth / 4,
+                               y - 5 + 7 * CardHeight / 12, 11, 11,
+                               &memoryDC, 11 * m_suit, 25, wxCOPY);
+                       dc.Blit(x - 5 + 3 * CardWidth / 4,
+                               y - 5 + 3 * CardHeight / 4, 11, 11,
+                               &memoryDC, 11 * m_suit, 25, wxCOPY);
+                       dc.Blit(x - 5 + CardWidth / 2,
+                               y - 5 + CardHeight / 3, 11, 11,
+                               &memoryDC, 11 * m_suit, 14, wxCOPY);
+                       break;
+               case 11:
+               case 12:
+               case 13:
+                       memoryDC.SelectObject(* m_pictureBmap);
+                       dc.Blit(x + 5, y - 5 + CardHeight / 4, 40, 45,
+                               &memoryDC, 40 * (m_pipValue - 11), 0, wxCOPY);
+                       memoryDC.SelectObject(* m_symbolBmap);
+                       dc.Blit(x + 32, y - 3 + CardHeight / 4, 11, 11,
+                               &memoryDC, 11 * m_suit, 14, wxCOPY);
+                       dc.Blit(x + 7, y + 27 + CardHeight / 4, 11, 11,
+                               &memoryDC, 11 * m_suit, 25, wxCOPY);
+                       break;
+               }
+
+       }
+       dc.SetBackground( backgroundBrush );
+} // Card:Draw()
+
+
+//+-------------------------------------------------------------+
+//| Card::DrawNullCard()                                                                               |
+//+-------------------------------------------------------------+
+//| Description:                                                                                               |
+//|    Draws the outline of a card at (x, y).                                          |
+//|    Used to draw place holders for empty piles of cards.            |
+//+-------------------------------------------------------------+
+void Card::DrawNullCard(wxDC& dc, int x, int y)
+{
+       wxPen* pen = wxThePenList->FindOrCreatePen(FortyApp::TextColour(), 1, wxSOLID);
+       dc.SetBrush(FortyApp::BackgroundBrush());
+       dc.SetPen(*pen);
+       dc.DrawRoundedRectangle(x, y, CardWidth, CardHeight, 4);
+} // Card::DrawNullCard()
+
+
diff --git a/demos/forty/card.h b/demos/forty/card.h
new file mode 100644 (file)
index 0000000..b93ac93
--- /dev/null
@@ -0,0 +1,65 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        card.h
+// Purpose:     Forty Thieves patience game
+// Author:      Chris Breeze
+// Modified by:
+// Created:     21/07/97
+// RCS-ID:      $Id$
+// Copyright:   (c) 1993-1998 Chris Breeze
+// Licence:    wxWindows licence
+//---------------------------------------------------------------------------
+// Last modified: 22nd July 1998 - ported to wxWindows 2.0
+/////////////////////////////////////////////////////////////////////////////
+//+-------------------------------------------------------------+
+//| Description:                                                                                               |
+//|    A class for drawing playing cards.                                                      |
+//|    InitCards() must be called before using the Card class,         |
+//|    otherwise the card bitmaps will not be loaded.                          |
+//|    CloseCards() must be called before terminating the                      |
+//|    program so that the bitmaps are deleted and the memory          |
+//|    given back to Windows.                                                                          |
+//+-------------------------------------------------------------+
+#ifndef _CARD_H_
+#define _CARD_H_
+
+       // Constants
+const int PackSize = 52;
+const int CardWidth = 50;
+const int CardHeight = 70;
+
+       // Data types
+enum Suit { clubs = 0, diamonds = 1, hearts = 2, spades = 3 };
+enum SuitColour { red = 0, black = 1 };
+enum WayUp { faceup, facedown };
+
+
+//--------------------------------//
+// A class defining a single card //
+//--------------------------------//
+class Card {
+public:
+       Card(int value, WayUp way_up = facedown);
+       virtual ~Card();
+
+       void            Draw(wxDC& pDC, int x, int y);
+       static void DrawNullCard(wxDC& pDC, int x, int y);      // Draw card place-holder
+       void            Erase(wxDC& pDC, int x, int y);
+
+       void            TurnCard(WayUp way_up = faceup) { m_wayUp = way_up; }
+       WayUp           GetWayUp() const { return m_wayUp; }
+       int                     GetPipValue() const { return m_pipValue; }
+       Suit            GetSuit() const { return m_suit; }
+       SuitColour      GetColour() const { return m_colour; }
+
+private:
+       Suit            m_suit;
+       int                     m_pipValue;     // in the range 1 (Ace) to 13 (King)
+       SuitColour      m_colour;       // red or black
+       bool            m_status;
+       WayUp           m_wayUp;
+
+       static wxBitmap*        m_symbolBmap;
+       static wxBitmap*        m_pictureBmap;
+};
+
+#endif // _CARD_H_
diff --git a/demos/forty/cards.ico b/demos/forty/cards.ico
new file mode 100644 (file)
index 0000000..35c8379
Binary files /dev/null and b/demos/forty/cards.ico differ
diff --git a/demos/forty/forty.cpp b/demos/forty/forty.cpp
new file mode 100644 (file)
index 0000000..bfdb920
--- /dev/null
@@ -0,0 +1,271 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        forty.cpp
+// Purpose:     Forty Thieves patience game
+// Author:      Chris Breeze
+// Modified by:
+// Created:     21/07/97
+// RCS-ID:      $Id$
+// Copyright:   (c) 1993-1998 Chris Breeze
+// Licence:    wxWindows licence
+//---------------------------------------------------------------------------
+// Last modified: 22nd July 1998 - ported to wxWindows 2.0
+/////////////////////////////////////////////////////////////////////////////
+
+#ifdef __GNUG__
+#pragma implementation
+#pragma interface
+#endif
+
+// For compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+
+#include "canvas.h"
+#include "forty.h"
+#include "scoredg.h"
+#ifdef wx_x
+#include "cards.xbm"
+#endif
+
+class FortyFrame: public wxFrame
+{
+public:
+       FortyFrame(wxFrame* frame, char* title, int x, int y, int w, int h);
+       virtual ~FortyFrame();
+
+       void OnCloseWindow(wxCloseEvent& event);
+
+       // Menu callbacks
+       void NewGame(wxCommandEvent& event);
+       void Exit(wxCommandEvent& event);
+       void About(wxCommandEvent& event);
+       void Undo(wxCommandEvent& event);
+       void Redo(wxCommandEvent& event);
+       void Scores(wxCommandEvent& event);
+       void ToggleRightButtonUndo(wxCommandEvent& event);
+       void ToggleHelpingHand(wxCommandEvent& event);
+
+       DECLARE_EVENT_TABLE()
+
+private:
+       enum MenuCommands { NEW_GAME = 10, SCORES, EXIT,
+                                               UNDO, REDO,
+                                               RIGHT_BUTTON_UNDO, HELPING_HAND,
+                                               ABOUT };
+
+       wxMenuBar*              m_menuBar;
+       FortyCanvas*    m_canvas;
+};
+
+BEGIN_EVENT_TABLE(FortyFrame, wxFrame)
+       EVT_MENU(NEW_GAME, FortyFrame::NewGame)
+       EVT_MENU(EXIT, FortyFrame::Exit)
+       EVT_MENU(ABOUT, FortyFrame::About)
+       EVT_MENU(UNDO, FortyFrame::Undo)
+       EVT_MENU(REDO, FortyFrame::Redo)
+       EVT_MENU(SCORES, FortyFrame::Scores)
+       EVT_MENU(RIGHT_BUTTON_UNDO, FortyFrame::ToggleRightButtonUndo)
+       EVT_MENU(HELPING_HAND, FortyFrame::ToggleHelpingHand)
+    EVT_CLOSE(FortyFrame::OnCloseWindow)
+END_EVENT_TABLE()
+
+// Create a new application object
+IMPLEMENT_APP  (FortyApp)
+
+wxColour* FortyApp::m_backgroundColour = 0;
+wxColour* FortyApp::m_textColour = 0;
+wxBrush*  FortyApp::m_backgroundBrush = 0;
+
+bool FortyApp::OnInit()
+{
+       FortyFrame* frame = new FortyFrame(
+                       0,
+                       "Forty Thieves",
+                       -1, -1, 668, 510
+                       );
+
+       // Show the frame
+       frame->Show(TRUE);
+
+       return TRUE;
+}
+
+const wxColour& FortyApp::BackgroundColour()
+{
+       if (!m_backgroundColour)
+       {
+               m_backgroundColour = new wxColour(0, 128, 0);
+       }
+
+       return *m_backgroundColour;
+}
+
+const wxBrush& FortyApp::BackgroundBrush()
+{
+       if (!m_backgroundBrush)
+       {
+               m_backgroundBrush = new wxBrush(BackgroundColour(), wxSOLID);
+       }
+
+       return *m_backgroundBrush;
+}
+
+const wxColour& FortyApp::TextColour()
+{
+       if (!m_textColour)
+       {
+               m_textColour = new wxColour("BLACK");
+       }
+
+       return *m_textColour;
+}
+
+// My frame constructor
+FortyFrame::FortyFrame(wxFrame* frame, char* title, int x, int y, int w, int h):
+       wxFrame(frame, -1, title, wxPoint(x, y), wxSize(w, h))
+{
+#ifdef __WXMAC__
+       // we need this in order to allow the about menu relocation, since ABOUT is not the default id of the about menu 
+       wxApp::s_macAboutMenuItemId = ABOUT ;
+#endif
+       // set the icon
+#ifdef __WXMSW__
+       SetIcon(wxIcon("CardsIcon"));
+#else
+#ifdef GTK_TBD
+       SetIcon(wxIcon(Cards_bits, Cards_width, Cards_height));
+#endif
+#endif
+
+       // Make a menu bar
+       wxMenu* gameMenu = new wxMenu;
+       gameMenu->Append(NEW_GAME, "&New", "Start a new game");
+       gameMenu->Append(SCORES, "&Scores...", "Displays scores");
+       gameMenu->Append(EXIT, "E&xit", "Exits Forty Thieves");
+
+       wxMenu* editMenu = new wxMenu;
+       editMenu->Append(UNDO, "&Undo", "Undo the last move");
+       editMenu->Append(REDO, "&Redo", "Redo a move that has been undone");
+
+       wxMenu* optionsMenu = new wxMenu;
+       optionsMenu->Append(RIGHT_BUTTON_UNDO,
+                       "&Right button undo",
+                       "Enables/disables right mouse button undo and redo",
+                       TRUE
+                       );
+       optionsMenu->Append(HELPING_HAND,
+                       "&Helping hand",
+                       "Enables/disables hand cursor when a card can be moved",
+                       TRUE
+                       );
+       optionsMenu->Check(HELPING_HAND, TRUE);
+       optionsMenu->Check(RIGHT_BUTTON_UNDO, TRUE);
+
+       wxMenu* helpMenu = new wxMenu;
+       helpMenu->Append(ABOUT, "&About", "Displays program version information");
+
+       m_menuBar = new wxMenuBar;
+       m_menuBar->Append(gameMenu,    "&Game");
+       m_menuBar->Append(editMenu,    "&Edit");
+       m_menuBar->Append(optionsMenu, "&Options");
+       m_menuBar->Append(helpMenu,    "&Help");
+
+       SetMenuBar(m_menuBar);
+
+       m_canvas = new FortyCanvas(this, 0, 0, 400, 400);
+       wxLayoutConstraints* constr = new wxLayoutConstraints;
+       constr->left.SameAs(this, wxLeft);
+       constr->top.SameAs(this, wxTop);
+       constr->right.SameAs(this, wxRight);
+       constr->height.SameAs(this, wxHeight);
+       m_canvas->SetConstraints(constr);
+
+       CreateStatusBar();
+}
+
+FortyFrame::~FortyFrame()
+{
+}
+
+void FortyFrame::OnCloseWindow(wxCloseEvent& event)
+{
+    if (m_canvas->OnCloseCanvas() )
+    {
+        this->Destroy();
+    }
+    else
+        event.Veto();
+}
+
+void
+FortyFrame::NewGame(wxCommandEvent&)
+{
+       m_canvas->NewGame();
+}
+
+void
+FortyFrame::Exit(wxCommandEvent&)
+{
+#ifdef __WXGTK__
+       // wxGTK doesn't call OnClose() so we do it here
+//     if (OnClose())
+#endif
+       Close(TRUE);
+}
+
+void
+FortyFrame::About(wxCommandEvent&)
+{
+       wxMessageBox(
+               "Forty Thieves\n\n"
+               "A freeware program using the wxWindows\n"
+               "portable C++ GUI toolkit.\n"
+               "http://web.ukonline.co.uk/julian.smart/wxwin\n"
+               "http://www.freiburg.linux.de/~wxxt\n\n"
+               "Author: Chris Breeze (c) 1992-1998\n"
+               "email: chris.breeze@iname.com",
+               "About Forty Thieves",
+               wxOK, this
+               );
+}
+
+void
+FortyFrame::Undo(wxCommandEvent&)
+{
+       m_canvas->Undo();
+}
+
+void
+FortyFrame::Redo(wxCommandEvent&)
+{
+       m_canvas->Redo();
+}
+
+void
+FortyFrame::Scores(wxCommandEvent&)
+{
+       m_canvas->UpdateScores();
+       ScoreDialog scores(this, m_canvas->GetScoreFile());
+       scores.Display();
+}
+
+void
+FortyFrame::ToggleRightButtonUndo(wxCommandEvent& event)
+{
+       bool checked = m_menuBar->IsChecked(event.GetId());
+       m_canvas->EnableRightButtonUndo(checked);
+}
+
+void
+FortyFrame::ToggleHelpingHand(wxCommandEvent& event)
+{
+       bool checked = m_menuBar->IsChecked(event.GetId());
+       m_canvas->EnableHelpingHand(checked);
+}
diff --git a/demos/forty/forty.def b/demos/forty/forty.def
new file mode 100644 (file)
index 0000000..a096488
--- /dev/null
@@ -0,0 +1,8 @@
+NAME         Forty
+DESCRIPTION  'Forty Thieves'
+EXETYPE      WINDOWS
+STUB         'WINSTUB.EXE'
+CODE         PRELOAD MOVEABLE DISCARDABLE
+DATA         PRELOAD MOVEABLE MULTIPLE
+HEAPSIZE     4048
+STACKSIZE    16000
diff --git a/demos/forty/forty.h b/demos/forty/forty.h
new file mode 100644 (file)
index 0000000..1fbf644
--- /dev/null
@@ -0,0 +1,31 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        forty.h
+// Purpose:     Forty Thieves patience game
+// Author:      Chris Breeze
+// Modified by:
+// Created:     21/07/97
+// RCS-ID:      $Id$
+// Copyright:   (c) 1993-1998 Chris Breeze
+// Licence:    wxWindows licence
+//---------------------------------------------------------------------------
+// Last modified: 22nd July 1998 - ported to wxWindows 2.0
+/////////////////////////////////////////////////////////////////////////////
+#ifndef _FORTY_H_
+#define _FORTY_H_
+
+class FortyApp: public wxApp
+{
+public:
+       bool OnInit();
+
+       static const wxColour& BackgroundColour();
+       static const wxColour& TextColour();
+       static const wxBrush&  BackgroundBrush();
+
+private:
+       static wxColour* m_backgroundColour;
+       static wxColour* m_textColour;
+       static wxBrush*  m_backgroundBrush;
+};
+
+#endif
diff --git a/demos/forty/forty.rc b/demos/forty/forty.rc
new file mode 100644 (file)
index 0000000..911ea25
--- /dev/null
@@ -0,0 +1,6 @@
+#include "wx/msw/wx.rc"
+
+CardsIcon    ICON   "cards.ico"
+CardPictures BITMAP "pictures.bmp"
+CardSymbols  BITMAP "symbols.bmp"
+
diff --git a/demos/forty/game.cpp b/demos/forty/game.cpp
new file mode 100644 (file)
index 0000000..4ac5994
--- /dev/null
@@ -0,0 +1,944 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        game.cpp
+// Purpose:     Forty Thieves patience game
+// Author:      Chris Breeze
+// Modified by:
+// Created:     21/07/97
+// RCS-ID:      $Id$
+// Copyright:   (c) 1993-1998 Chris Breeze
+// Licence:    wxWindows licence
+//---------------------------------------------------------------------------
+// Last modified: 22nd July 1998 - ported to wxWindows 2.0
+/////////////////////////////////////////////////////////////////////////////
+
+#ifdef __GNUG__
+#pragma implementation
+#pragma interface
+#endif
+
+// For compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <time.h>
+#include <string.h>
+#include "forty.h"
+#include "game.h"
+
+Game::Game(int wins, int games, int score) :
+       m_inPlay(FALSE),
+       m_moveIndex(0),
+       m_redoIndex(0),
+       m_bmap(0),
+       m_bmapCard(0)
+{
+    int i;
+
+    m_pack = new Pack(2, 2 + 4 * (CardHeight + 2));
+    srand(time(0));
+
+    for (i = 0; i < 5; i++) m_pack->Shuffle();
+
+    m_discard = new Discard(2, 2 + 5 * (CardHeight + 2));
+
+    for (i = 0; i < 8; i++)
+    {
+               m_foundations[i] = new Foundation(2 + (i / 4) * (CardWidth + 2),
+                                       2 + (i % 4) * (CardHeight + 2));
+    }
+
+    for (i = 0; i < 10; i++)
+    {
+       m_bases[i] = new Base(8 + (i + 2) * (CardWidth + 2), 2);
+    }
+    Deal();
+    m_srcPile = 0;
+    m_liftedCard = 0;
+
+       // copy the input parameters for future reference
+    m_numWins = wins;
+    m_numGames = games;
+    m_totalScore = score;
+    m_currentScore = 0;
+}
+
+
+// Make sure we delete all objects created by the game object
+Game::~Game()
+{
+    int i;
+
+    delete m_pack;
+    delete m_discard;
+    for (i = 0; i < 8; i++)
+    {
+               delete m_foundations[i];
+    }
+    for (i = 0; i < 10; i++)
+    {
+               delete m_bases[i];
+    }
+       delete m_bmap;
+       delete m_bmapCard;
+}
+
+/*
+Set the score for a new player.
+NB: call Deal() first if the new player is to start
+a new game
+*/
+void Game::NewPlayer(int wins, int games, int score)
+{
+    m_numWins = wins;
+    m_numGames = games;
+    m_totalScore = score;
+    m_currentScore = 0;
+}
+
+// Undo the last move
+void Game::Undo(wxDC& dc)
+{
+    if (m_moveIndex > 0)
+    {
+               m_moveIndex--;
+               Card* card = m_moves[m_moveIndex].dest->RemoveTopCard(dc);
+               m_moves[m_moveIndex].src->AddCard(dc, card);
+               DisplayScore(dc);
+    }
+}
+
+// Redo the last move
+void Game::Redo(wxDC& dc)
+{
+    if (m_moveIndex < m_redoIndex)
+    {
+               Card* card = m_moves[m_moveIndex].src->RemoveTopCard(dc);
+               if (m_moves[m_moveIndex].src == m_pack)
+               {
+                       m_pack->Redraw(dc);
+                       card->TurnCard(faceup);
+               }
+               m_moves[m_moveIndex].dest->AddCard(dc, card);
+               DisplayScore(dc);
+               m_moveIndex++;
+    }
+}
+
+void Game::DoMove(wxDC& dc, Pile* src, Pile* dest)
+{
+    if (m_moveIndex < MaxMoves)
+    {
+               if (src == dest)
+               {
+                       wxMessageBox("Game::DoMove() src == dest", "Debug message",
+                                  wxOK | wxICON_EXCLAMATION);
+               }
+               m_moves[m_moveIndex].src = src;
+               m_moves[m_moveIndex].dest = dest;
+               m_moveIndex++;
+
+               // when we do a move any moves in redo buffer are discarded
+               m_redoIndex = m_moveIndex;
+    }
+    else
+    {
+               wxMessageBox("Game::DoMove() Undo buffer full", "Debug message",
+                          wxOK | wxICON_EXCLAMATION);
+    }
+
+    if (!m_inPlay)
+       {
+               m_inPlay = TRUE;
+               m_numGames++;
+       }
+    DisplayScore(dc);
+}
+
+
+void Game::DisplayScore(wxDC& dc)
+{
+    wxColour bgColour = FortyApp::BackgroundColour();
+       wxPen* pen = wxThePenList->FindOrCreatePen(bgColour, 1, wxSOLID);
+    dc.SetTextBackground(bgColour);
+    dc.SetTextForeground(FortyApp::TextColour());
+       dc.SetBrush(FortyApp::BackgroundBrush());
+       dc.SetPen(* pen);
+
+       // count the number of cards in foundations
+    m_currentScore = 0;
+    for (int i = 0; i < 8; i++)
+    {
+       m_currentScore += m_foundations[i]->GetNumCards();
+    }
+
+    int x, y;
+    m_pack->GetTopCardPos(x, y);
+    x += 12 * CardWidth - 105;
+
+       int w, h;
+       {
+               long width, height;
+               dc.GetTextExtent("Average score:m_x", &width, &height);
+               w = width;
+               h = height;
+       }
+       dc.DrawRectangle(x + w, y, 20, 4 * h);
+
+    char str[80];
+    sprintf(str, "%d", m_currentScore);
+    dc.DrawText("Score:", x, y);
+    dc.DrawText(str, x + w, y);
+    y += h;
+
+    sprintf(str, "%d", m_numGames);
+    dc.DrawText("Games played:", x, y);
+    dc.DrawText(str, x + w, y);
+    y += h;
+
+    sprintf(str, "%d", m_numWins);
+    dc.DrawText("Games won:", x, y);
+    dc.DrawText(str, x + w, y);
+    y += h;
+
+    int average = 0;
+       if (m_numGames > 0)
+       {
+               average = (2 * (m_currentScore + m_totalScore) + m_numGames ) / (2 * m_numGames);
+       }
+    sprintf(str, "%d", average);
+    dc.DrawText("Average score:", x, y);
+    dc.DrawText(str, x + w, y);
+}
+
+
+// Shuffle the m_pack and deal the cards
+void Game::Deal()
+{
+    int i, j;
+    Card* card;
+
+       // Reset all the piles, the undo buffer and shuffle the m_pack
+    m_moveIndex = 0;
+    m_pack->ResetPile();
+    for (i = 0; i < 5; i++)
+       {
+               m_pack->Shuffle();
+       }
+    m_discard->ResetPile();
+    for (i = 0; i < 10; i++)
+       {
+               m_bases[i]->ResetPile();
+       }
+    for (i = 0; i <  8; i++)
+       {
+               m_foundations[i]->ResetPile();
+       }
+
+       // Deal the initial 40 cards onto the bases
+    for (i = 0; i < 10; i++)
+    {
+               for (j = 1; j <= 4; j++)
+               {
+                       card = m_pack->RemoveTopCard();
+                       card->TurnCard(faceup);
+                       m_bases[i]->AddCard(card);
+               }
+    }
+
+    if (m_inPlay)
+       {
+               // player has started the game and then redealt
+               // and so we must add the score for this game to the total score
+               m_totalScore += m_currentScore;
+       }
+    m_currentScore = 0;
+    m_inPlay = FALSE;
+}
+
+
+// Redraw the m_pack, discard pile, the bases and the foundations
+void Game::Redraw(wxDC& dc)
+{
+       int i;
+       m_pack->Redraw(dc);
+       m_discard->Redraw(dc);
+       for (i = 0; i < 8; i++)
+       {
+               m_foundations[i]->Redraw(dc);
+       }
+       for (i = 0; i < 10; i++)
+       {
+               m_bases[i]->Redraw(dc);
+       }
+       DisplayScore(dc);
+
+       if (m_bmap == 0)
+       {
+               m_bmap = new wxBitmap(CardWidth, CardHeight);
+               m_bmapCard = new wxBitmap(CardWidth, CardHeight);
+
+               // Initialise the card bitmap to the background colour
+               wxMemoryDC memoryDC;
+               memoryDC.SelectObject(*m_bmapCard);
+               memoryDC.SetBrush(FortyApp::BackgroundBrush());
+               memoryDC.DrawRectangle(0, 0, CardWidth, CardHeight);
+               memoryDC.SelectObject(*m_bmap);
+               memoryDC.DrawRectangle(0, 0, CardWidth, CardHeight);
+               memoryDC.SelectObject(wxNullBitmap);
+       }
+}
+
+
+// Test to see if the point (x, y) is over the top card of one of the piles
+// Returns pointer to the pile, or 0 if (x, y) is not over a pile
+// or the pile is empty
+Pile* Game::WhichPile(int x, int y)
+{
+       if (m_pack->GetCard(x, y) &&
+               m_pack->GetCard(x, y) == m_pack->GetTopCard())
+       {
+               return m_pack;
+       }
+
+       if (m_discard->GetCard(x, y) &&
+               m_discard->GetCard(x, y) == m_discard->GetTopCard())
+       {
+               return m_discard;
+       }
+
+       int i;
+       for (i = 0; i < 8; i++)
+       {
+               if (m_foundations[i]->GetCard(x, y) &&
+                       m_foundations[i]->GetCard(x, y) == m_foundations[i]->GetTopCard())
+               {
+                       return m_foundations[i];
+               }
+       }
+
+       for (i = 0; i < 10; i++)
+       {
+               if (m_bases[i]->GetCard(x, y) &&
+                       m_bases[i]->GetCard(x, y) == m_bases[i]->GetTopCard())
+               {
+                       return m_bases[i];
+               }
+       }
+       return 0;
+}
+
+
+// Left button is pressed - if cursor is over the m_pack then deal a card
+// otherwise if it is over a card pick it up ready to be dragged - see MouseMove()
+bool Game::LButtonDown(wxDC& dc, int x, int y)
+{
+    m_srcPile = WhichPile(x, y);
+    if (m_srcPile == m_pack)
+    {
+               Card* card = m_pack->RemoveTopCard();
+               if (card)
+               {
+                       m_pack->Redraw(dc);
+                       card->TurnCard(faceup);
+                       m_discard->AddCard(dc, card);
+                       DoMove(dc, m_pack, m_discard);
+               }
+        m_srcPile = 0;
+    }
+    else if (m_srcPile)
+    {
+               m_srcPile->GetTopCardPos(m_xPos, m_yPos);
+               m_xOffset = m_xPos - x;
+               m_yOffset = m_yPos - y;
+
+                       // Copy the area under the card
+                       // Initialise the card bitmap to the background colour
+               {
+                       wxMemoryDC memoryDC;
+                       memoryDC.SelectObject(*m_bmap);
+                       m_liftedCard = m_srcPile->RemoveTopCard(memoryDC, m_xPos, m_yPos);
+               }
+
+                       // Draw the card in card bitmap ready for blitting onto
+                       // the screen
+               {
+                       wxMemoryDC memoryDC;
+                       memoryDC.SelectObject(*m_bmapCard);
+                       m_liftedCard->Draw(memoryDC, 0, 0);
+               }
+    }
+    return m_srcPile != 0;
+}
+
+// Called when the left button is double clicked
+// If a card is under the pointer and it can move elsewhere then move it.
+// Move onto a foundation as first choice, a populated base as second and
+// an empty base as third choice.
+// NB Cards in the m_pack cannot be moved in this way - they aren't in play
+// yet
+void Game::LButtonDblClk(wxDC& dc, int x, int y)
+{
+    Pile* pile = WhichPile(x, y);
+    if (!pile) return;
+
+       // Double click on m_pack is the same as left button down
+    if (pile == m_pack)
+    {
+               LButtonDown(dc, x, y);
+    }
+    else
+    {
+               Card* card = pile->GetTopCard();
+
+               if (card)
+               {
+                       int i;
+
+                       // if the card is an ace then try to place it next
+                       // to an ace of the same suit
+                       if (card->GetPipValue() == 1)
+                       {
+                               for(i = 0; i < 4; i++)
+                               {
+                                       Card* m_topCard;
+                                       if ((m_topCard = m_foundations[i]->GetTopCard()))
+                    {
+                                               if (m_topCard->GetSuit() == card->GetSuit() &&
+                            m_foundations[i + 4] != pile &&
+                                                       m_foundations[i + 4]->GetTopCard() == 0)
+                                               {
+                                                       pile->RemoveTopCard(dc);
+                                                       m_foundations[i + 4]->AddCard(dc, card);
+                                                       DoMove(dc, pile, m_foundations[i + 4]);
+                                                       return;
+                                               }
+                    }
+                               }
+                       }
+
+                       // try to place the card on a foundation
+                       for(i = 0; i < 8; i++)
+                       {
+                               if (m_foundations[i]->AcceptCard(card) && m_foundations[i] != pile)
+                               {
+                                       pile->RemoveTopCard(dc);
+                                       m_foundations[i]->AddCard(dc, card);
+                                       DoMove(dc, pile, m_foundations[i]);
+                                       return;
+                               }
+            }
+                       // try to place the card on a populated base
+                       for(i = 0; i < 10; i++)
+                       {
+                               if (m_bases[i]->AcceptCard(card) &&
+                                       m_bases[i] != pile &&
+                                       m_bases[i]->GetTopCard())
+                               {
+                                       pile->RemoveTopCard(dc);
+                                       m_bases[i]->AddCard(dc, card);
+                                       DoMove(dc, pile, m_bases[i]);
+                                       return;
+                               }
+            }
+                       // try to place the card on any base
+                       for(i = 0; i < 10; i++)
+                       {
+                               if (m_bases[i]->AcceptCard(card) && m_bases[i] != pile)
+                               {
+                                       pile->RemoveTopCard(dc);
+                                       m_bases[i]->AddCard(dc, card);
+                                       DoMove(dc, pile, m_bases[i]);
+                                       return;
+                               }
+            }
+               }
+    }
+}
+
+
+// Test to see whether the game has been won:
+// i.e. m_pack, discard and bases are empty
+bool Game::HaveYouWon()
+{
+    if (m_pack->GetTopCard()) return FALSE;
+    if (m_discard->GetTopCard()) return FALSE;
+    for(int i = 0; i < 10; i++)
+    {
+       if (m_bases[i]->GetTopCard()) return FALSE;
+    }
+    m_numWins++;
+    m_totalScore += m_currentScore;
+    m_currentScore = 0;
+    return TRUE;
+}
+
+
+// See whether the card under the cursor can be moved somewhere else
+// Returns TRUE if it can be moved, FALSE otherwise
+bool Game::CanYouGo(int x, int y)
+{
+    Pile* pile = WhichPile(x, y);
+    if (pile && pile != m_pack)
+    {
+       Card* card = pile->GetTopCard();
+
+       if (card)
+       {
+           int i;
+           for(i = 0; i < 8; i++)
+           {
+               if (m_foundations[i]->AcceptCard(card) && m_foundations[i] != pile)
+               {
+                    return TRUE;
+               }
+            }
+           for(i = 0; i < 10; i++)
+           {
+               if (m_bases[i]->GetTopCard() &&
+                   m_bases[i]->AcceptCard(card) &&
+                   m_bases[i] != pile)
+               {
+                   return TRUE;
+               }
+            }
+       }
+    }
+    return FALSE;
+}
+
+
+// Called when the left button is released after dragging a card
+// Scan the piles to see if this card overlaps a pile and can be added
+// to the pile. If the card overlaps more than one pile on which it can be placed
+// then put it on the nearest pile.
+void Game::LButtonUp(wxDC& dc, int x, int y)
+{
+    if (m_srcPile)
+    {
+               // work out the position of the dragged card
+               x += m_xOffset;
+        y += m_yOffset;
+
+               Pile* nearestPile = 0;
+               int distance = (CardHeight + CardWidth) * (CardHeight + CardWidth);
+
+               // find the nearest pile which will accept the card
+               int i;
+               for (i = 0; i < 8; i++)
+               {
+                       if (DropCard(x, y, m_foundations[i], m_liftedCard))
+                       {
+                               if (m_foundations[i]->CalcDistance(x, y) < distance)
+                               {
+                                       nearestPile = m_foundations[i];
+                    distance = nearestPile->CalcDistance(x, y);
+                }
+            }
+               }
+               for (i = 0; i < 10; i++)
+               {
+                       if (DropCard(x, y, m_bases[i], m_liftedCard))
+                       {
+                               if (m_bases[i]->CalcDistance(x, y) < distance)
+                {
+                                       nearestPile = m_bases[i];
+                    distance = nearestPile->CalcDistance(x, y);
+                }
+            }
+               }
+
+               // Restore the area under the card
+               wxMemoryDC memoryDC;
+               memoryDC.SelectObject(*m_bmap);
+               dc.Blit(m_xPos, m_yPos, CardWidth, CardHeight,
+                          &memoryDC, 0, 0, wxCOPY);
+
+               // Draw the card in its new position
+               if (nearestPile)
+               {
+                       // Add to new pile
+                       nearestPile->AddCard(dc, m_liftedCard);
+                       if (nearestPile != m_srcPile)
+                       {
+                               DoMove(dc, m_srcPile, nearestPile);
+                       }
+               }
+        else
+        {
+                       // Return card to src pile
+                       m_srcPile->AddCard(dc, m_liftedCard);
+               }
+               m_srcPile = 0;
+               m_liftedCard = 0;
+    }
+}
+
+
+
+
+bool Game::DropCard(int x, int y, Pile* pile, Card* card)
+{
+    bool retval = FALSE;
+    if (pile->Overlap(x, y))
+    {
+       if (pile->AcceptCard(card))
+       {
+           retval = TRUE;
+        }
+    }
+    return retval;
+}
+
+
+void Game::MouseMove(wxDC& dc, int mx, int my)
+{
+    if (m_liftedCard)
+    {
+               wxMemoryDC memoryDC;
+               memoryDC.SelectObject(*m_bmap);
+
+               int dx = mx + m_xOffset - m_xPos;
+               int dy = my + m_yOffset - m_yPos;
+
+               if (abs(dx) >= CardWidth || abs(dy) >= CardHeight)
+        {
+                       // Restore the area under the card
+                       dc.Blit(m_xPos, m_yPos, CardWidth, CardHeight,
+                          &memoryDC, 0, 0, wxCOPY);
+
+                       // Copy the area under the card in the new position
+                       memoryDC.Blit(0, 0, CardWidth, CardHeight,
+                          &dc, m_xPos + dx, m_yPos + dy, wxCOPY);
+               }
+               else if (dx >= 0)
+               {
+                       // dx >= 0
+                       dc.Blit(m_xPos, m_yPos, dx, CardHeight, &memoryDC, 0, 0, wxCOPY);
+                       if (dy >= 0)
+                       {
+                                       // dy >= 0
+                               dc.Blit(m_xPos + dx, m_yPos, CardWidth - dx, dy, &memoryDC, dx, 0, wxCOPY);
+                               memoryDC.Blit(0, 0, CardWidth - dx, CardHeight - dy,
+                                          &memoryDC, dx, dy, wxCOPY);
+                               memoryDC.Blit(0, CardHeight - dy, CardWidth - dx, dy,
+                                          &dc, m_xPos + dx, m_yPos + CardHeight, wxCOPY);
+                       }
+                       else
+                       {
+                               // dy < 0
+                               dc.Blit(m_xPos + dx, m_yPos + dy + CardHeight, CardWidth - dx, -dy,
+                                          &memoryDC, dx, CardHeight + dy, wxCOPY);
+                               memoryDC.Blit(0, -dy, CardWidth - dx, CardHeight + dy,
+                                          &memoryDC, dx, 0, wxCOPY);
+                               memoryDC.Blit(0, 0, CardWidth - dx, -dy,
+                                          &dc, m_xPos + dx, m_yPos + dy, wxCOPY);
+                       }
+                       memoryDC.Blit(CardWidth - dx, 0, dx, CardHeight,
+                          &dc, m_xPos + CardWidth, m_yPos + dy, wxCOPY);
+               }
+               else
+               {
+                       // dx < 0
+                       dc.Blit(m_xPos + CardWidth + dx, m_yPos, -dx, CardHeight,
+                          &memoryDC, CardWidth + dx, 0, wxCOPY);
+                       if (dy >= 0)
+                       {
+                               dc.Blit(m_xPos, m_yPos, CardWidth + dx, dy, &memoryDC, 0, 0, wxCOPY);
+                               memoryDC.Blit(-dx, 0, CardWidth + dx, CardHeight - dy,
+                                          &memoryDC, 0, dy, wxCOPY);
+                               memoryDC.Blit(-dx, CardHeight - dy, CardWidth + dx, dy,
+                                          &dc, m_xPos, m_yPos + CardHeight, wxCOPY);
+                       }
+                       else
+                       {
+                                       // dy < 0
+                               dc.Blit(m_xPos, m_yPos + CardHeight + dy, CardWidth + dx, -dy,
+                                          &memoryDC, 0, CardHeight + dy, wxCOPY);
+                               memoryDC.Blit(-dx, -dy, CardWidth + dx, CardHeight + dy,
+                                          &memoryDC, 0, 0, wxCOPY);
+                               memoryDC.Blit(-dx, 0, CardWidth + dx, -dy,
+                                          &dc, m_xPos, m_yPos + dy, wxCOPY);
+                       }
+                       memoryDC.Blit(0, 0, -dx, CardHeight,
+                          &dc, m_xPos + dx, m_yPos + dy, wxCOPY);
+               }
+               m_xPos += dx;
+               m_yPos += dy;
+
+                       // draw the card in its new position
+               memoryDC.SelectObject(*m_bmapCard);
+               dc.Blit(m_xPos, m_yPos, CardWidth, CardHeight,
+                          &memoryDC, 0, 0, wxCOPY);
+    }
+}
+
+
+
+//----------------------------------------------//
+// The Pack class: holds the two decks of cards //
+//----------------------------------------------//
+Pack::Pack(int x, int y) : Pile(x, y, 0, 0)
+{
+    for (m_topCard = 0; m_topCard < NumCards; m_topCard++)
+    {
+       m_cards[m_topCard] = new Card(1 + m_topCard / 2, facedown);
+    }
+    m_topCard = NumCards - 1;
+}
+
+
+void Pack::Shuffle()
+{
+    Card* temp[NumCards];
+    int i;
+
+       // Don't try to shuffle an empty m_pack!
+    if (m_topCard < 0) return;
+
+       // Copy the cards into a temporary array. Start by clearing
+       // the array and then copy the card into a random position.
+        // If the position is occupied then find the next lower position.
+    for (i = 0; i <= m_topCard; i++)
+    {
+               temp[i] = 0;
+    }
+    for (i = 0; i <= m_topCard; i++)
+    {
+       int pos = rand() % (m_topCard + 1);
+       while (temp[pos])
+       {
+           pos--;
+           if (pos < 0) pos = m_topCard;
+       }
+       m_cards[i]->TurnCard(facedown);
+       temp[pos] = m_cards[i];
+        m_cards[i] = 0;
+    }
+
+       // Copy each card back into the m_pack in a random
+       // position. If position is occupied then find nearest
+        // unoccupied position after the random position.
+    for (i = 0; i <= m_topCard; i++)
+    {
+       int pos = rand() % (m_topCard + 1);
+       while (m_cards[pos])
+       {
+           pos++;
+            if (pos > m_topCard) pos = 0;
+       }
+        m_cards[pos] = temp[i];
+    }
+}
+
+void Pack::Redraw(wxDC& dc)
+{
+    Pile::Redraw(dc);
+
+    char str[10];
+    sprintf(str, "%d  ", m_topCard + 1);
+
+       dc.SetTextBackground(FortyApp::BackgroundColour());
+       dc.SetTextForeground(FortyApp::TextColour());
+    dc.DrawText(str, m_x + CardWidth + 5, m_y + CardHeight / 2);
+
+}
+
+void Pack::AddCard(Card* card)
+{
+    if (card == m_cards[m_topCard + 1])
+    {
+               m_topCard++;
+    }
+    else
+    {
+               wxMessageBox("Pack::AddCard() Undo error", "Forty Thieves: Warning",
+                  wxOK | wxICON_EXCLAMATION);
+    }
+    card->TurnCard(facedown);
+}
+
+
+Pack::~Pack()
+{
+    for (m_topCard = 0; m_topCard < NumCards; m_topCard++)
+    {
+       delete m_cards[m_topCard];
+    }
+};
+
+
+//------------------------------------------------------//
+// The Base class: holds the initial pile of four cards //
+//------------------------------------------------------//
+Base::Base(int x, int y) : Pile(x, y, 0, 12)
+{
+    m_topCard = -1;
+}
+
+
+bool Base::AcceptCard(Card* card)
+{
+    bool retval = FALSE;
+
+    if (m_topCard >= 0)
+    {
+       if (m_cards[m_topCard]->GetSuit() == card->GetSuit() &&
+           m_cards[m_topCard]->GetPipValue() - 1 == card->GetPipValue())
+       {
+            retval = TRUE;
+        }
+    }
+    else
+    {
+               // pile is empty - ACCEPT
+        retval = TRUE;
+    }
+    return retval;
+}
+
+Base::~Base()
+{
+// nothing special at the moment
+};
+
+
+//----------------------------------------------------------------//
+// The Foundation class: holds the cards built up from the ace... //
+//----------------------------------------------------------------//
+Foundation::Foundation(int x, int y) : Pile(x, y, 0, 0)
+{
+    m_topCard = -1;
+}
+
+bool Foundation::AcceptCard(Card* card)
+{
+    bool retval = FALSE;
+
+    if (m_topCard >= 0)
+    {
+       if (m_cards[m_topCard]->GetSuit() == card->GetSuit() &&
+           m_cards[m_topCard]->GetPipValue() + 1 == card->GetPipValue())
+       {
+            retval = TRUE;
+        }
+    }
+    else if (card->GetPipValue() == 1)
+    {
+       // It's an ace and the pile is empty - ACCEPT
+        retval = TRUE;
+    }
+    return retval;
+}
+
+Foundation::~Foundation()
+{
+// nothing special at the moment
+};
+
+
+//----------------------------------------------------//
+// The Discard class: holds cards dealt from the m_pack //
+//----------------------------------------------------//
+Discard::Discard(int x, int y) : Pile(x, y, 19, 0)
+{
+    m_topCard = -1;
+}
+
+void Discard::Redraw(wxDC& dc)
+{
+    if (m_topCard >= 0)
+    {
+       if (m_dx == 0 && m_dy == 0)
+       {
+            m_cards[m_topCard]->Draw(dc, m_x, m_y);
+       }
+       else
+       {
+           int x = m_x;
+           int y = m_y;
+           for (int i = 0; i <= m_topCard; i++)
+           {
+               m_cards[i]->Draw(dc, x, y);
+               x += m_dx;
+               y += m_dy;
+               if (i == 31)
+               {
+                   x = m_x;
+                    y = m_y + CardHeight / 3;
+                }
+            }
+        }
+    }
+    else
+    {
+               Card::DrawNullCard(dc, m_x, m_y);
+    }
+}
+
+
+void Discard::GetTopCardPos(int& x, int& y)
+{
+    if (m_topCard < 0)
+    {
+       x = m_x;
+       y = m_y;
+    }
+    else if (m_topCard > 31)
+    {
+       x = m_x + m_dx * (m_topCard - 32);
+       y = m_y + CardHeight / 3;
+    }
+    else
+    {
+       x = m_x + m_dx * m_topCard;
+       y = m_y;
+    }
+}
+
+
+Card* Discard::RemoveTopCard(wxDC& dc, int m_xOffset, int m_yOffset)
+{
+    Card* card;
+
+    if (m_topCard <= 31)
+    {
+               card = Pile::RemoveTopCard(dc, m_xOffset, m_yOffset);
+    }
+    else
+    {
+       int topX, topY, x, y;
+       GetTopCardPos(topX, topY);
+               card = Pile::RemoveTopCard();
+               card->Erase(dc, topX - m_xOffset, topY - m_yOffset);
+               GetTopCardPos(x, y);
+               dc.SetClippingRegion(topX - m_xOffset, topY - m_yOffset,
+                                        CardWidth, CardHeight);
+
+               for (int i = m_topCard - 31; i <= m_topCard - 31 + CardWidth / m_dx; i++)
+               {
+                       m_cards[i]->Draw(dc, m_x - m_xOffset + i * m_dx, m_y - m_yOffset); 
+               }
+               if (m_topCard > 31)
+               {
+                       m_cards[m_topCard]->Draw(dc, topX - m_xOffset - m_dx, topY - m_yOffset);
+               }
+               dc.DestroyClippingRegion();
+    }
+
+    return card;
+}
+
+
+Discard::~Discard()
+{
+// nothing special at the moment
+};
diff --git a/demos/forty/game.h b/demos/forty/game.h
new file mode 100644 (file)
index 0000000..2360d15
--- /dev/null
@@ -0,0 +1,135 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        game.h
+// Purpose:     Forty Thieves patience game
+// Author:      Chris Breeze
+// Modified by:
+// Created:     21/07/97
+// RCS-ID:      $Id$
+// Copyright:   (c) 1993-1998 Chris Breeze
+// Licence:    wxWindows licence
+//---------------------------------------------------------------------------
+// Last modified: 22nd July 1998 - ported to wxWindows 2.0
+/////////////////////////////////////////////////////////////////////////////
+#ifndef _GAME_H_
+#define _GAME_H_
+#include "card.h"
+#include "pile.h"
+
+const int MaxMoves = 800;
+
+
+//---------------------------------------//
+// A class which holds the pack of cards //
+//---------------------------------------//
+class Pack : public Pile {
+public:
+       Pack(int x, int y);
+       ~Pack();
+       void Redraw(wxDC& dc);
+       void ResetPile() { m_topCard = NumCards - 1; }
+       void Shuffle();
+       void AddCard(Card* card);               // Add card
+       void AddCard(wxDC& dc, Card* card) { AddCard(card); Redraw(dc); }
+};
+
+
+//----------------------------------------------------------//
+// A class which holds a base i.e. the initial 10 x 4 cards //
+//----------------------------------------------------------//
+class Base : public Pile {
+public:
+       Base(int x, int y);
+       ~Base();
+       bool AcceptCard(Card* card);
+};
+
+
+//----------------------------------------------------//
+// A class which holds a foundation i.e. Ace, 2, 3... //
+//----------------------------------------------------//
+class Foundation : public Pile {
+public:
+       Foundation(int x, int y);
+       ~Foundation();
+       bool AcceptCard(Card* card);
+};
+
+
+//--------------------------------------//
+// A class which holds the discard pile //
+//--------------------------------------//
+class Discard : public Pile {
+public:
+       Discard(int x, int y);
+       ~Discard();
+       void Redraw(wxDC& dc);
+       void GetTopCardPos(int& x, int& y);
+       Card* RemoveTopCard(wxDC& dc, int m_xOffset, int m_yOffset);
+};
+
+
+class Game {
+public:
+       Game(int wins, int games, int score);
+       virtual ~Game();
+
+       void NewPlayer(int wins, int games, int score);
+       void Deal();            // Shuffle and deal a new game
+       bool CanYouGo(int x, int y);    // can card under (x,y) go somewhere?
+       bool HaveYouWon();              // have you won the game?
+
+       void Undo(wxDC& dc);            // Undo the last go
+       void Redo(wxDC& dc);            // Redo the last go
+
+       void Redraw(wxDC& dc);
+       void DisplayScore(wxDC& dc);
+       bool LButtonDown(wxDC& dc, int mx, int my);     //
+       void LButtonUp(wxDC& dc, int mx, int my);
+       void LButtonDblClk(wxDC& dc, int mx, int my);
+       void MouseMove(wxDC& dc, int mx, int my);
+
+       int GetNumWins() const  { return m_numWins; }
+       int GetNumGames() const { return m_numGames; }
+       int GetScore() const    { return m_currentScore + m_totalScore; }
+
+       bool InPlay() const             { return m_inPlay; }
+
+private:
+       bool DropCard(int x, int y, Pile* pile, Card* card);
+                       //  can the card at (x, y) be dropped on the pile?
+       Pile* WhichPile(int x, int y);  // which pile is (x, y) over?
+       void DoMove(wxDC& dc, Pile* src, Pile* dest);
+
+       bool m_inPlay;          // flag indicating that the game has started
+
+       // undo buffer
+       struct {
+               Pile* src;
+               Pile* dest;
+       } m_moves[MaxMoves];
+       int m_moveIndex;        // current position in undo/redo buffer
+       int m_redoIndex;        // max move index available for redo
+
+       // the various piles of cards
+       Pack*           m_pack;         
+       Discard*        m_discard;
+       Base*           m_bases[10];
+       Foundation*     m_foundations[8];
+
+       // variables to do with dragging cards
+       Pile*           m_srcPile;
+       Card*           m_liftedCard;
+       int m_xPos, m_yPos;             // current coords of card being dragged
+       int m_xOffset, m_yOffset;       // card/mouse offset when dragging a card
+
+       wxBitmap* m_bmap;
+       wxBitmap* m_bmapCard;
+
+       // variables to do with scoring
+       int m_numGames;         
+       int m_numWins;
+       int m_totalScore;
+       int m_currentScore;
+};
+
+#endif // _GAME_H_
diff --git a/demos/forty/make_cw.mcp b/demos/forty/make_cw.mcp
new file mode 100644 (file)
index 0000000..cc1070d
Binary files /dev/null and b/demos/forty/make_cw.mcp differ
diff --git a/demos/forty/makefile.b32 b/demos/forty/makefile.b32
new file mode 100644 (file)
index 0000000..5586d65
--- /dev/null
@@ -0,0 +1,16 @@
+#
+# File:                makefile.b32
+# Author:      Julian Smart
+# Created:     1999
+# Updated:     
+# Copyright:
+#
+# Makefile : Builds sample for 32-bit BC++
+
+WXDIR = $(WXWIN)
+
+TARGET=forty
+OBJECTS = $(TARGET).obj canvas.obj card.obj game.obj pile.obj playerdg.obj scoredg.obj scorefil.obj
+
+!include $(WXDIR)\src\makeprog.b32
+
diff --git a/demos/forty/makefile.bcc b/demos/forty/makefile.bcc
new file mode 100644 (file)
index 0000000..53fdb7b
--- /dev/null
@@ -0,0 +1,19 @@
+#
+# File:                makefile.bcc
+# Author:      Julian Smart
+# Created:     1998
+# Updated:     
+#
+# Builds a BC++ 16-bit sample
+
+!if "$(WXWIN)" == ""
+!error You must define the WXWIN variable in autoexec.bat, e.g. WXWIN=c:\wx
+!endif
+
+WXDIR = $(WXWIN)
+
+TARGET=forty
+OBJECTS=$(TARGET).obj canvas.obj card.obj game.obj pile.obj playerdg.obj scoredg.obj scorefil.obj
+
+!include $(WXDIR)\src\makeprog.bcc
+
diff --git a/demos/forty/makefile.dos b/demos/forty/makefile.dos
new file mode 100644 (file)
index 0000000..150d0b9
--- /dev/null
@@ -0,0 +1,17 @@
+#
+# File:                makefile.dos
+# Author:      Julian Smart
+# Created:     1998
+# Updated:     
+#
+# Makefile : Builds 16-bit sample, VC++ 1.5
+# Use FINAL=1 argument to nmake to build final version with no debugging
+# info
+
+WXDIR = $(WXWIN)
+
+TARGET=forty
+OBJECTS = $(TARGET).obj canvas.obj card.obj game.obj pile.obj playerdg.obj scoredg.obj scorefil.obj
+
+!include $(WXDIR)\src\makeprog.msc
+
diff --git a/demos/forty/makefile.g95 b/demos/forty/makefile.g95
new file mode 100644 (file)
index 0000000..7f750c2
--- /dev/null
@@ -0,0 +1,16 @@
+#
+# File:         makefile.g95
+# Author:       Julian Smart
+# Created:      1999
+# Updated:
+# Copyright:    (c) Julian Smart, 1999
+#
+# Makefile for wxWindows sample (Cygwin/Mingw32).
+
+WXDIR = ../..
+
+TARGET=forty
+OBJECTS = $(TARGET).o canvas.o card.o game.o pile.o playerdg.o scoredg.o scorefil.o
+
+include $(WXDIR)/src/makeprog.g95
+
diff --git a/demos/forty/makefile.unx b/demos/forty/makefile.unx
new file mode 100644 (file)
index 0000000..0a689e8
--- /dev/null
@@ -0,0 +1,35 @@
+#
+# File:                Makefile for samples
+# Author:      Robert Roebling
+# Created:     1999
+# Updated:     
+# Copyright:   (c) 1998 Robert Roebling
+#
+# This makefile requires a Unix version of wxWindows
+# to be installed on your system. This is most often
+# done typing "make install" when using the complete
+# sources of wxWindows or by installing the two
+# RPM packages wxGTK.XXX.rpm and wxGTK-devel.XXX.rpm
+# under Linux.
+#
+
+CC = g++
+
+PROGRAM = forty
+
+OBJECTS = $(PROGRAM).o canvas.o card.o game.o pile.o playerdg.o scoredg.o scorefil.o
+
+# implementation
+
+.SUFFIXES:     .o .cpp
+
+.cpp.o :
+       $(CC) -c `wx-config --cflags` -o $@ $<
+
+all:    $(PROGRAM)
+
+$(PROGRAM):    $(OBJECTS)
+       $(CC) -o $(PROGRAM) $(OBJECTS) `wx-config --libs`
+
+clean: 
+       rm -f *.o $(PROGRAM)
diff --git a/demos/forty/makefile.vc b/demos/forty/makefile.vc
new file mode 100644 (file)
index 0000000..7c809b7
--- /dev/null
@@ -0,0 +1,18 @@
+#
+# File:                makefile.vc
+# Author:      Julian Smart
+# Created:     1999
+# Updated:     
+# Copyright:   (c) Julian Smart
+#
+# Makefile : Builds sample (VC++, WIN32)
+# Use FINAL=1 argument to nmake to build final version with no debug info.
+
+# Set WXDIR for your system
+WXDIR = $(WXWIN)
+
+PROGRAM=forty
+OBJECTS = $(PROGRAM).obj card.obj canvas.obj game.obj pile.obj playerdg.obj scoredg.obj scorefil.obj
+
+!include $(WXDIR)\src\makeprog.vc
+
diff --git a/demos/forty/makefile.wat b/demos/forty/makefile.wat
new file mode 100644 (file)
index 0000000..9db1dca
--- /dev/null
@@ -0,0 +1,15 @@
+#
+# Makefile for WATCOM
+#
+# Created by Julian Smart, January 1999
+# 
+#
+
+WXDIR = $(%WXWIN)
+
+PROGRAM = forty
+OBJECTS = $(PROGRAM).obj canvas.obj card.obj game.obj pile.obj playerdg.obj scoredg.obj scorefil.obj
+
+!include $(WXDIR)\src\makeprog.wat
+
+
diff --git a/demos/forty/pictures.bmp b/demos/forty/pictures.bmp
new file mode 100644 (file)
index 0000000..d8c3345
Binary files /dev/null and b/demos/forty/pictures.bmp differ
diff --git a/demos/forty/pictures.xpm b/demos/forty/pictures.xpm
new file mode 100644 (file)
index 0000000..3184957
--- /dev/null
@@ -0,0 +1,60 @@
+/* XPM */
+static char *Pictures[] = {
+/* width height num_colors chars_per_pixel */
+"   120    45        8            1",
+/* colors */
+". c #000000",
+"# c #c0c0c0",
+"a c #808080",
+"b c #ff0000",
+"c c #ffff00",
+"d c #0000ff",
+"e c #00ffff",
+"f c #ffffff",
+/* pixels */
+"........................................................................................................................",
+".fff.fffffff.bb.bb.bb.b.fffffffffffffff..fffffffffff..f..bbc.cc..ffffffffffffff..fff.ffffff.bbccccbcccccbb.ffffffffffff.",
+".ff.c.fffffff.bbbbbbbb.ffffffffffffffff..fff.ffffff..f.ff.bbc..c.ffffffffffffff..ff.a.ffffff.bbccbbbcccbb.fffffffffffff.",
+".f.cbc.fffffff........fffffffffffffffff..ff.b.fffff.f.ffff.bb..c..fffffffffffff..f.#af.ffffff.bbbbbbbbbb.ffffffffffffff.",
+".f.cbc.ffffff.fff.c.c.fffffffffffffffff..ff.b.fffff..f.ff.f.bbc.c.fffffffffffff..f.#af.ffffff............ffffffffffffff.",
+".ff.c.fffffff.f..f.c.c.ffffffffffffffff..fff.ffffff.f..ff..f.bb..ffffffffffffff..f.#af.ffffff.a..f.fff.f.ffffffffffffff.",
+".f.cbc.ffffff.f.ff.c.c.ffffffffffffffff..ff.c.fffff.fff.ffff..b.fffffffffffffff..f.#af.ffffff.a.f..fff..f.fffffffffffff.",
+".f.cbc.fffff.fffff.c.c.ffffffffffffffff..ff.c.fffff.fff.ffff....fffffffffffffff..f.#af.ffffff.a.ffff.ffff.fffffffffffff.",
+".ff.c.fffff.ffffff.c.c.ffffffffffffffff..ff.c.fffff.fff..fff.b..fffffffffffffff..f.#af.ffffff.a.fffff.fff.fffffffffffff.",
+".f.cbc.ffff..###ff.c.c.ffffffffffffffff..ff.c.fffff.ffffffff..b.fffffffffffffff..f.#af.ffffff.a.ffff..fff.fffffffffffff.",
+".f.cbc.ffffff...ff.c.c.ffffffffffffffff..fff.ffffff.ffbbbbff.f...ffffffffffffff..f.#af.fff..f.a..ffffffff.fffffffffffff.",
+".ff....ffffff.ffff.c.c.ffffffffffffffff..ff....fffff.ffffff.f.f...fffffffffffff..f.#af.fff....a...f....f..fffffffffffff.",
+".f.ffff.fffff.fffff.c.c.fffffffffffffff..f.ffff.ffff..ffff.f.f.f..fffffffffffff..f.#af.ffff.aaa.a..f.f.f...ffffffffffff.",
+".f....ff.f.................ffffffffffff..f....ff.f.................ffffffffffff..f.#af.fff...................ffffffffff.",
+".ff.fff....eddddddddddddddd.....fffffff..f.fffff...ffffffffff.cdbb......fffffff..f.#af.....c.cc..bbbbbb..c......fffffff.",
+".ff....bbbd.dbcbbbbbbbbbcbdedbbb....fff..f....f.bc.fdddddddf.cdbb.d..f.....ffff..f.#af..cbbcc.cc..bbbb..c......b....fff.",
+"...bbbb...deedbbcbbcbbcbbbd.dbb.bbbb.....f.fff.fbbc.fffffff.cdbb.d..f..dd.c..ff..........cbbcc.cc......c.....bbbdfff....",
+".bb....c.ccdeedbbbcccbbbbdedbb.bbb..cc...ff...c.fbbc.fdddf.cdbb.d..f..dd.cccd.f...ffff...dcbbcc.cc....cc...ddbbbdfddddf.",
+"...cc.c....bd.dbcbbcbbcbbd.db.bb..cbc.b..ff.dccc.bbc.ffff.cdbb.dd..ff...cdcdfd.........f.dcbbacc.cccccc..fdcbdbbdffddff.",
+"..c....bbbbbdeddddddddddddedbb..cccc.bb..f..fdcdc.bbc.ff.cdbb.dddd..ff.cccdffdc...ffff.f.dcbbcacc.c...c.fdccccdbdffddff.",
+"...bb.bb....bbbbbbbbbbbbbbbb..ccbbc.bb....ffdfdccc.bbc..cdbb..........cccdfdfbc........f.dcbbccacc.ccb.fdddbdbdbddffffd.",
+".bbb.b..ccc.d.d.d.d.dd.d.d.d.cccbb.bb.b..cbdfffdccc.fdfdfdfdfdfdfdfd.cccdfffbbc...ffff.f.dcbbacca.bcdcc.caddddcddff..ff.",
+".bb.bb.ccbcd.d.d.d.ff.d.d.d.dcbcc.bb.bb..cbbddddcdc.dbdbdbdbdbdbdbdb.cdcddddbbc.........ddcddaacc.cdddc.ccaddcdd........",
+".b.bb.bbccc.d.d.d.dd.d.d.d.d.ccc.bb.bbb..cbbfffdccc.fdfdfdfdfdfdfdfd.cccdfffdbc..ff..ffddcddddaac.ccdcb.accbbcd.f.ffff..",
+"..bb.cbbcc..bbbbbbbbbbbbbbbb....b..bb....cbfdfdccc..........bbdc..cbb.cccdfdff...dffffddcdbdbddaac.bcc.ccacbbcd.f.......",
+".bb.cccc..bbdeddddddddddddedbbbbb....c...cdffdccc.ff..dddd.bbdc.ff.cbb.cdcdff.f..ffddffdbdccccdfa.c...c.ccabbcd.f.ffff..",
+".b.cbc..bb.bd.dbbcbbcbbcbd.db....c.cc.....dfdcdc...ff..dd.bbdc.ffff.cbb.cccd.ff..ffddffdbbdbcdff..cccccc.ccbbcd.f.......",
+"..cc..bbb.bbdedbbbbcccbbbdeedcc.c....bb..f.dccc.dd..f..d.bbdc.fdddf.cbbf.c...ff..fddddfdbbbddf...cc....cc.cbbcd...ffff..",
+"....bbbb.bbd.dbbbcbbcbbcbbdeed...bbbb....ff..c.dd..f..d.bbdc.fffffff.cbbf.fff.f.....fffdbbb......c......cc.cbbc.........",
+".fff....bbbdedbcbbbbbbbbbcbd.dbbb....ff..ffff.....f..d.bbdc.fdddddddf.cb.f....f..fff....bb......c..bbbb..cc.cbbc..fa#.f.",
+".fffffff.....ddddddddddddddde....fff.ff..fffffff......bbdc.ffffffffff...fffff.f..fffffff.......c..bbbbbb..cc......fa#.f.",
+".ffffffffffff.................f.ff....f..ffffffffffff.................f.ff....f..ffffffffff...................fff.fa#.f.",
+".fffffffffffffff.c.c.fffff.fffff.ffff.f..fffffffffffff..f.f.f.ffff..ffff.ffff.f..ffffffffffff...f.f.f..a.aaa.ffff.fa#.f.",
+".ffffffffffffffff.c.c.ffff.ffffff....ff..fffffffffffff...f.f.ffffff.fffff....ff..fffffffffffff..f....f...a....fff.fa#.f.",
+".ffffffffffffffff.c.c.ff...ffffff.cbc.f..ffffffffffffff...f.ffbbbbff.ffffff.fff..fffffffffffff.ffffffff..a.f..fff.fa#.f.",
+".ffffffffffffffff.c.c.ff###..ffff.cbc.f..fffffffffffffff.b..ffffffff.fffff.c.ff..fffffffffffff.fff..ffff.a.ffffff.fa#.f.",
+".ffffffffffffffff.c.c.ffffff.fffff.c.ff..fffffffffffffff..b.fff..fff.fffff.c.ff..fffffffffffff.fff.fffff.a.ffffff.fa#.f.",
+".ffffffffffffffff.c.c.fffff.fffff.cbc.f..fffffffffffffff....ffff.fff.fffff.c.ff..fffffffffffff.ffff.ffff.a.ffffff.fa#.f.",
+".ffffffffffffffff.c.c.ff.f.ffffff.cbc.f..fffffffffffffff.b..ffff.fff.fffff.c.ff..fffffffffffff.f..fff..f.a.ffffff.fa#.f.",
+".ffffffffffffffff.c.c.f..f.fffffff.c.ff..ffffffffffffff..bb.f..ff..f.ffffff.fff..ffffffffffffff.f.fff.ff.a.ffffff.fa#.f.",
+".fffffffffffffffff.c.c.fff.ffffff.cbc.f..fffffffffffff.c.cbb.f.ff.f..fffff.b.ff..ffffffffffffff............ffffff.fa#.f.",
+".fffffffffffffffff........fffffff.cbc.f..fffffffffffff..c..bb.ffff.f.fffff.b.ff..ffffffffffffff.bbbbbbbbbb.ffffff.fa#.f.",
+".ffffffffffffffff.bbbbbbbb.fffffff.c.ff..ffffffffffffff.c..cbb.ff.f..ffffff.fff..fffffffffffff.bbcccbbbccbb.ffffff.a.ff.",
+".fffffffffffffff.b.bb.bb.bb.fffffff.fff..ffffffffffffff..cc.cbb..f..fffffffffff..ffffffffffff.bbcccccbccccbb.ffffff.fff.",
+"........................................................................................................................"
+};
diff --git a/demos/forty/pile.cpp b/demos/forty/pile.cpp
new file mode 100644 (file)
index 0000000..d92c1d8
--- /dev/null
@@ -0,0 +1,305 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        pile.cpp
+// Purpose:     Forty Thieves patience game
+// Author:      Chris Breeze
+// Modified by:
+// Created:     21/07/97
+// RCS-ID:      $Id$
+// Copyright:   (c) 1993-1998 Chris Breeze
+// Licence:    wxWindows licence
+//---------------------------------------------------------------------------
+// Last modified: 22nd July 1998 - ported to wxWindows 2.0
+/////////////////////////////////////////////////////////////////////////////
+//+-------------------------------------------------------------+
+//| Description:                                                                                               |
+//|    The base class for holding piles of playing cards.                      |
+//+-------------------------------------------------------------+
+
+#ifdef __GNUG__
+#pragma implementation
+#pragma interface
+#endif
+
+// For compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <time.h>
+#include <string.h>
+#include "card.h"
+#include "pile.h"
+
+#include "wx/app.h"
+
+//+-------------------------------------------------------------+
+//| Pile::Pile()                                                                                               |
+//+-------------------------------------------------------------+
+//| Description:                                                                                               |
+//|    Initialise the pile to be empty of cards.                                       |
+//+-------------------------------------------------------------+
+Pile::Pile(int x, int y, int dx, int dy)
+{
+    m_x = x;
+    m_y = y;
+    m_dx = dx;
+    m_dy = dy;
+    for (m_topCard = 0; m_topCard < NumCards; m_topCard++)
+    {
+       m_cards[m_topCard] = 0;
+    }
+    m_topCard = -1;    // i.e. empty
+}
+
+
+//+-------------------------------------------------------------+
+//| Pile::Redraw()                                                                                             |
+//+-------------------------------------------------------------+
+//| Description:                                                                                               |
+//|    Redraw the pile on the screen. If the pile is empty                     |
+//|    just draw a NULL card as a place holder for the pile.           |
+//|    Otherwise draw the pile from the bottom up, starting            |
+//|    at the origin of the pile, shifting each subsequent                     |
+//|    card by the pile's x and y offsets.                                                     |
+//+-------------------------------------------------------------+
+void Pile::Redraw(wxDC& dc )
+{
+   wxWindow *frame = wxTheApp->GetTopWindow();
+   wxWindow *canvas = (wxWindow *) NULL;
+   if (frame)
+   {
+     wxNode *node = frame->GetChildren().First();
+     if (node) canvas = (wxWindow*)node->Data();
+   }
+
+       if (m_topCard >= 0)
+       {
+               if (m_dx == 0 && m_dy == 0)
+               {
+                       if ((canvas) && (canvas->IsExposed(m_x,m_y,60,200))) 
+                         m_cards[m_topCard]->Draw(dc, m_x, m_y);
+               }
+               else
+               {
+                       int x = m_x;
+                       int y = m_y;
+                       for (int i = 0; i <= m_topCard; i++)
+                       {
+                             if ((canvas) && (canvas->IsExposed(x,y,60,200))) 
+                               m_cards[i]->Draw(dc, x, y);
+                             x += m_dx;
+                             y += m_dy;
+                       }
+               }
+       }
+       else
+       {
+            if ((canvas) && (canvas->IsExposed(m_x,m_y,60,200))) 
+               Card::DrawNullCard(dc, m_x, m_y);
+       }
+}
+
+
+//+-------------------------------------------------------------+
+//| Pile::GetTopCard()                                         |
+//+-------------------------------------------------------------+
+//| Description:                                                                                               |
+//|    Return a pointer to the top card in the pile or NULL            |
+//|    if the pile is empty.                                                                           |
+//| NB:        Gets a copy of the card without removing it from the    |
+//|    pile.                                                                                                           |
+//+-------------------------------------------------------------+
+Card* Pile::GetTopCard()
+{
+    Card* card = 0;
+
+    if (m_topCard >= 0)
+    {
+       card = m_cards[m_topCard];
+    }
+    return card;
+}
+
+
+//+-------------------------------------------------------------+
+//| Pile::RemoveTopCard()                                       |
+//+-------------------------------------------------------------+
+//| Description:                                                                                               |
+//|    If the pile is not empty, remove the top card from the          |
+//|    pile and return the pointer to the removed card.                        |
+//|    If the pile is empty return a NULL pointer.                                     |
+//+-------------------------------------------------------------+
+Card* Pile::RemoveTopCard()
+{
+    Card* card = 0;
+
+    if (m_topCard >= 0)
+    {
+               card = m_cards[m_topCard--];
+    }
+    return card;
+}
+
+
+//+-------------------------------------------------------------+
+//| Pile::RemoveTopCard()                                       |
+//+-------------------------------------------------------------+
+//| Description:                                                                                               |
+//|    As RemoveTopCard() but also redraw the top of the pile          |
+//|    after the card has been removed.                                                        |
+//| NB:        the offset allows for the redrawn area to be in a               |
+//|    bitmap ready for 'dragging' cards acrosss the screen.           |
+//+-------------------------------------------------------------+
+Card* Pile::RemoveTopCard(wxDC& dc, int xOffset, int yOffset)
+{
+       int topX, topY, x, y;
+
+       GetTopCardPos(topX, topY);
+       Card* card = RemoveTopCard();
+
+       if (card)
+       {
+               card->Erase(dc, topX - xOffset, topY - yOffset);
+               GetTopCardPos(x, y);
+               if (m_topCard < 0)
+               {
+                       Card::DrawNullCard(dc, x - xOffset, y - yOffset);
+               }
+               else
+               {
+                       m_cards[m_topCard]->Draw(dc, x - xOffset, y - yOffset);
+               }
+       }
+
+       return card;
+}
+
+
+void Pile::GetTopCardPos(int& x, int& y)
+{
+       if (m_topCard < 0)
+       {
+               x = m_x;
+               y = m_y;
+       }
+       else
+       {
+               x = m_x + m_dx * m_topCard;
+               y = m_y + m_dy * m_topCard;
+       }
+}
+
+void Pile::AddCard(Card* card)
+{
+    if (m_topCard < -1) m_topCard = -1;
+
+    m_cards[++m_topCard] = card;
+}
+
+void Pile::AddCard(wxDC& dc, Card* card)
+{
+    AddCard(card);
+    int x, y;
+    GetTopCardPos(x, y);
+    card->Draw(dc, x, y);
+}
+
+// Can the card leave this pile.
+// If it is a member of the pile then the answer is yes.
+// Derived classes may override this behaviour to incorporate
+// the rules of the game
+bool Pile::CanCardLeave(Card* card)
+{
+    for (int i = 0; i <= m_topCard; i++)
+    {
+       if (card == m_cards[i]) return TRUE;
+    }
+    return FALSE;
+}
+
+// Calculate how far x, y is from top card in the pile
+// Returns the square of the distance
+int Pile::CalcDistance(int x, int y)
+{
+    int cx, cy;
+    GetTopCardPos(cx, cy);
+    return ((cx - x) * (cx - x) + (cy - y) * (cy - y));
+}
+
+
+// Return the card at x, y. Check the top card first, then
+// work down the pile. If a card is found then return a pointer
+// to the card, otherwise return NULL
+Card* Pile::GetCard(int x, int y)
+{
+       int cardX;
+       int cardY;
+       GetTopCardPos(cardX, cardY);
+
+       for (int i = m_topCard; i >= 0; i--)
+       {
+               if (x >= cardX && x <= cardX + CardWidth &&
+                       y >= cardY && y <= cardY + CardHeight)
+               {
+                       return m_cards[i];
+               }
+               cardX -= m_dx;
+               cardY -= m_dy;
+       }
+       return 0;
+}
+
+
+// Return the position of the given card. If it is not a member of this pile
+// return the origin of the pile.
+void Pile::GetCardPos(Card* card, int& x, int& y)
+{
+       x = m_x;
+       y = m_y;
+
+       for (int i = 0; i <= m_topCard; i++)
+       {
+               if (card == m_cards[i])
+               {
+                       return;
+               }
+               x += m_dx;
+               y += m_dy;
+       }
+
+       // card not found in pile, return origin of pile
+       x = m_x;
+       y = m_y;
+}
+
+
+bool Pile::Overlap(int x, int y)
+{
+    int cardX;
+    int cardY;
+    GetTopCardPos(cardX, cardY);
+
+    if (x >= cardX - CardWidth  && x <= cardX + CardWidth &&
+       y >= cardY - CardHeight && y <= cardY + CardHeight)
+    {
+           return TRUE;
+    }
+    return FALSE;
+}
+
+
+Pile::~Pile()
+{
+// nothing special at the moment
+}
diff --git a/demos/forty/pile.h b/demos/forty/pile.h
new file mode 100644 (file)
index 0000000..49eb8c9
--- /dev/null
@@ -0,0 +1,80 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        pile.h
+// Purpose:     Forty Thieves patience game
+// Author:      Chris Breeze
+// Modified by:
+// Created:     21/07/97
+// RCS-ID:      $Id$
+// Copyright:   (c) 1993-1998 Chris Breeze
+// Licence:    wxWindows licence
+//---------------------------------------------------------------------------
+// Last modified: 22nd July 1998 - ported to wxWindows 2.0
+/////////////////////////////////////////////////////////////////////////////
+//+-------------------------------------------------------------+
+//| Description:                                                                                               |
+//|    The base class for holding piles of playing cards.                      |
+//|    This is the basic building block for card games. A pile         |
+//|    has a position on the screen and an offset for each                     |
+//|    card placed on it e.g. a pack has no offset, but the            |
+//|    discard pile may be fanned out across the screen.                       |
+//|                                                                                                                            |
+//|    The pile knows how to draw itself, though this may be           |
+//|    overridden if the default layout needs to be changed.           |
+//|    One or more cards can be removed from the top of a pile,        |
+//|    and single cards can be added to the top of a pile.             |
+//|    Functions are provided which redraw the screen when                     |
+//|    cards are added or removed.                                                                     |
+//|                                                                                                                            |
+//|    Cards know which way up they are and how to draw                        |
+//|    themselves. Piles are lists of cards. Piles know which          |
+//|    cards they contain and where they are to be drawn.                      |
+//+-------------------------------------------------------------+
+#ifndef _PILE_H_
+#define _PILE_H_
+#include "card.h"
+
+const int NumCards = 2 * PackSize;
+
+
+//----------------------------------------------------------------//
+// A class defining a pile of cards with a position on the screen //
+//----------------------------------------------------------------//
+class Pile {
+public:
+       Pile(int x, int y, int dx = 0, int dy = 0);
+       virtual ~Pile();
+
+       // General functions
+       virtual void ResetPile() { m_topCard = -1; }
+       virtual void Redraw(wxDC& pDC);
+
+       // Card query functions
+       virtual Card* GetCard(int x, int y);    // Get pointer to card at x, y
+       Card* GetTopCard();                     // Get pointer to top card
+       virtual void GetCardPos(Card* card, int& x, int& y);
+       // Get position of a card
+       virtual void GetTopCardPos(int& x, int& y);
+       // Get position of the top card
+       int GetNumCards() { return m_topCard + 1; }     // Number of cards in pile
+       bool Overlap(int x, int y);     // does card at x,y overlap the pile?
+       int CalcDistance(int x, int y); // calculates the square of the distance
+                                                                       // of a card at (x,y) from the top of the pile
+
+       // Functions removing one or more cards from the top of a pile
+       virtual bool CanCardLeave(Card* card);
+       Card* RemoveTopCard();
+       virtual Card* RemoveTopCard(wxDC& pDC, int xOffset = 0, int yOffset = 0);
+
+       // Functions to add a card to the top of a pile
+       virtual bool AcceptCard(Card*) { return FALSE; }
+       virtual void AddCard(Card* card);       // Add card to top of pile
+       virtual void AddCard(wxDC& pDC, Card* card);    // Add card + redraw it
+
+protected:
+       int   m_x, m_y;                         // Position of the pile on the screen
+       int   m_dx, m_dy;                       // Offset when drawing the pile
+       Card* m_cards[NumCards];        // Array of cards in this pile
+       int   m_topCard;                                // Array index of the top card
+};
+
+#endif // _PILE_H_
diff --git a/demos/forty/playerdg.cpp b/demos/forty/playerdg.cpp
new file mode 100644 (file)
index 0000000..fa3ea03
--- /dev/null
@@ -0,0 +1,188 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        playerdg.cpp
+// Purpose:     Forty Thieves patience game
+// Author:      Chris Breeze
+// Modified by:
+// Created:     21/07/97
+// RCS-ID:      $Id$
+// Copyright:   (c) 1993-1998 Chris Breeze
+// Licence:    wxWindows licence
+//---------------------------------------------------------------------------
+// Last modified: 22nd July 1998 - ported to wxWindows 2.0
+/////////////////////////////////////////////////////////////////////////////
+
+#ifdef __GNUG__
+#pragma implementation
+#pragma interface
+#endif
+
+// For compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+
+#include "scorefil.h"
+#include "playerdg.h"
+
+const int ID_LISTBOX = 101;
+
+BEGIN_EVENT_TABLE(PlayerSelectionDialog, wxDialog)
+       EVT_SIZE(PlayerSelectionDialog::OnSize)
+       EVT_BUTTON(wxID_OK, PlayerSelectionDialog::ButtonCallback)
+       EVT_BUTTON(wxID_CANCEL, PlayerSelectionDialog::ButtonCallback)
+       EVT_LISTBOX(ID_LISTBOX, PlayerSelectionDialog::SelectCallback)
+    EVT_CLOSE(PlayerSelectionDialog::OnCloseWindow)
+END_EVENT_TABLE()
+
+PlayerSelectionDialog::PlayerSelectionDialog(
+                                                       wxWindow* parent,
+                                                       ScoreFile* file
+                                                       ) :
+       wxDialog(parent, -1, "Player Selection",
+                       wxDefaultPosition, wxSize(320, 200),
+                       wxDIALOG_MODAL | wxDEFAULT_DIALOG_STYLE),
+       m_scoreFile(file)
+{
+       // enable constraints
+       SetAutoLayout (TRUE);
+
+       wxStaticText* msg = new wxStaticText(this, -1, "Please select a name from the list");
+
+       wxListBox* list = new wxListBox(
+                                               this, ID_LISTBOX,
+                                               wxDefaultPosition, wxDefaultSize,
+                                               0, 0,
+                                               wxLB_SINGLE
+                                               );
+    
+       wxArrayString players;
+       m_scoreFile->GetPlayerList(players);
+       for (unsigned int i = 0; i < players.Count(); i++)
+       {
+               list->Append(players[i]);
+       }
+
+       m_textField = new wxTextCtrl(this, -1, "", wxDefaultPosition, wxDefaultSize, 0);
+
+       m_OK = new wxButton(this, wxID_OK, "OK");
+       m_cancel = new wxButton(this, wxID_CANCEL, "Cancel");
+
+       wxLayoutConstraints* layout;
+
+       // Constrain the msg at the top of the window
+       layout = new wxLayoutConstraints;
+       layout->left.SameAs             (this,  wxLeft,         10);
+       layout->top.SameAs              (this,  wxTop,  10);
+       layout->height.AsIs();
+       layout->width.AsIs();
+       msg->SetConstraints(layout);
+
+       // Constrain the OK button
+       layout = new wxLayoutConstraints;
+       layout->left.SameAs             (this,  wxLeft,         10);
+       layout->bottom.SameAs   (this,   wxBottom,      10);
+       layout->height.AsIs();
+       layout->width.AsIs();
+       m_OK->SetConstraints(layout);
+
+       // Constrain the OK button
+       layout = new wxLayoutConstraints;
+       layout->left.RightOf    (m_OK,  10);
+       layout->bottom.SameAs   (this,  wxBottom,       10);
+       layout->height.AsIs();
+       layout->width.AsIs();
+       m_cancel->SetConstraints(layout);
+
+       // Constrain the Name text entry field
+       layout = new wxLayoutConstraints;
+       layout->left.SameAs             (this,  wxLeft,         10);
+       layout->right.SameAs    (this,  wxRight,        10);
+       layout->bottom.SameAs   (m_OK,  wxTop,          10);
+       layout->height.AsIs();
+       m_textField->SetConstraints(layout);
+
+       // Constrain the list of players
+       layout = new wxLayoutConstraints;
+       layout->left.SameAs             (this,  wxLeft,         10);
+       layout->right.SameAs    (this,  wxRight,        10);
+       layout->top.Below               (msg,   10);
+       layout->bottom.SameAs   (m_textField,   wxTop,  10);
+       list->SetConstraints(layout);
+
+       wxString prevPlayer = m_scoreFile->GetPreviousPlayer();
+       if (prevPlayer.Length() > 0)
+       {
+               list->SetStringSelection(prevPlayer);
+               m_textField->SetValue(prevPlayer);
+       }
+
+       Layout();
+}
+
+PlayerSelectionDialog::~PlayerSelectionDialog()
+{
+}
+
+void PlayerSelectionDialog::OnSize(wxSizeEvent& WXUNUSED(event))
+{
+       Layout();
+}
+
+const wxString& PlayerSelectionDialog::GetPlayersName()
+{
+/*
+       m_player = "";
+       Show(TRUE);
+*/
+       return m_player;
+}
+
+void PlayerSelectionDialog::OnCloseWindow(wxCloseEvent& event)
+{
+       m_player = "";
+    EndModal(wxID_CANCEL);
+}
+
+void PlayerSelectionDialog::SelectCallback(wxCommandEvent& event)
+{
+       if (event.GetEventType() == wxEVT_COMMAND_LISTBOX_SELECTED)
+       {
+//         if (event.IsSelection())
+               m_textField->SetValue(event.GetString());
+       }
+}
+
+void PlayerSelectionDialog::ButtonCallback(wxCommandEvent& event)
+{
+       if (event.GetId() == wxID_OK)
+       {
+               wxString name = m_textField->GetValue();
+               if (!name.IsNull() && name.Length() > 0)
+               {
+                       if (name.Contains('@'))
+                       {
+                               wxMessageBox("Names should not contain the '@' character", "Forty Thieves");
+                       }
+                       else
+                       {
+                               m_player = name;
+                               EndModal(wxID_OK);
+                       }
+               }
+               else
+               {
+                       wxMessageBox("Please enter your name", "Forty Thieves");
+               }
+       }
+       else
+       {
+               m_player = "";
+               EndModal(wxID_CANCEL);
+       }
+}
diff --git a/demos/forty/playerdg.h b/demos/forty/playerdg.h
new file mode 100644 (file)
index 0000000..70d9cfb
--- /dev/null
@@ -0,0 +1,41 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        playerdg.h
+// Purpose:     Forty Thieves patience game
+// Author:      Chris Breeze
+// Modified by:
+// Created:     21/07/97
+// RCS-ID:      $Id$
+// Copyright:   (c) 1993-1998 Chris Breeze
+// Licence:    wxWindows licence
+//---------------------------------------------------------------------------
+// Last modified: 22nd July 1998 - ported to wxWindows 2.0
+/////////////////////////////////////////////////////////////////////////////
+#ifndef _PLAYERDG_H_
+#define _PLAYERDG_H_
+
+class PlayerSelectionDialog : public wxDialog
+{
+public:
+       PlayerSelectionDialog(wxWindow* parent, ScoreFile* file);
+       virtual ~PlayerSelectionDialog();
+
+       const wxString& GetPlayersName();
+       void ButtonCallback(wxCommandEvent& event);
+       void SelectCallback(wxCommandEvent& event);
+       void OnSize(wxSizeEvent& event);
+
+       DECLARE_EVENT_TABLE()
+
+protected:
+       friend void SelectCallback(wxListBox&, wxCommandEvent&);
+       void OnCloseWindow(wxCloseEvent& event);
+
+private:
+       ScoreFile*      m_scoreFile;
+       wxString        m_player;
+       wxButton*       m_OK;
+       wxButton*       m_cancel;
+       wxTextCtrl*     m_textField;
+};
+
+#endif
diff --git a/demos/forty/readme.txt b/demos/forty/readme.txt
new file mode 100644 (file)
index 0000000..e8a2be7
--- /dev/null
@@ -0,0 +1,86 @@
+Forty Thieves is a patience game played with two full packs of
+cards. At the start of the game forty cards are dealt on the
+eight 'bases' along the top of the window. The object of the
+game is to place all the cards onto the eight 'foundations'. The
+foundations are built starting with the ace and adding cards of
+the same suit up to the king. Cards are dealt from the pack and
+placed on the discard pile. Cards may be moved from the discard
+pile or one of the bases to a base or a foundation. Only one
+card can be moved at a time. Cards can only be placed on a base
+if the top card of the base is of the same suit and is one
+higher in pip value or the base is empty e.g. the eight of
+spades can only be placed on top of the nine of spades.
+
+When the mouse cursor is over a card which can be moved it
+changes to the 'hand' cursor. The card can then be moved by
+double clicking the left button.
+
+The mouse cursor also changes to a hand when a card is dragged
+by placing the cursor over the card and holding down the left
+button. This feature can be enabled and disabled by selecting
+the 'Helping hand' option from the Edit menu.
+
+The 'foundations' are the eight piles of cards down the left
+side of the window. When the game starts these piles are empty.
+The object of the game is to place all the cards on the
+foundations. An ace can be placed on any empty foundation. Other
+cards can only be placed on a foundation if the top card is of
+the same suit and is one lower in pip value e.g. the three of
+clubs can be placed on the four of clubs.
+
+The 'bases' are the ten piles of cards along the top of the
+window. At the start of the game four cards are dealt face up on
+each of the bases. A card can be added to a base if the base is
+empty or if the top card is of the same suit and is one higher
+in pip value e.g. the queen of hearts can be placed on the king
+of hearts The top card of a base can be moved onto another base
+or a foundation.
+
+Cards can be only moved one at a time. The top card of the pack
+can be dealt onto discard pile by placing the mouse cursor over
+the pack and pressing the left button. The number of cards
+remaining is displayed to the right of the pack.
+
+Cards can be moved from the discard pile or the bases either by
+'double-clicking' or by dragging. If the left button is
+double-clicked when the mouse cursor is over a card and it can
+move to another pile, it will do so. This is a quick way of
+moving cards when their destination is unambiguous.
+
+A card can be dragged by placing the mouse cursor over the card
+and holding down the left button. The card will follow the mouse
+cursor until the left button is released. If the card is over a
+pile on which it can be placed it will be added to that pile,
+otherwise it will be returned to the pile from which it was
+dragged.
+
+One point is scored for every card that is placed on a
+foundation. Since there are two packs of 52 cards the maximum
+score is 104. A record is kept of the number of games played,
+the number of games won, the current score and the average
+score. This information is displayed at bottom right of the
+window and is stored on disk between games. A game is deemed to
+have started if the cards have been dealt and any card has been
+moved. If the game is abandoned before it is finished (i.e. by
+starting a new game or closing window) it counts as a lost game.
+New players can be added by selecting the 'Player' option from
+the Game menu. A summary of players' scores can be displayed by
+selecting the 'Scores...' option from the Game menu.
+
+All moves are recorded and can be undone. To undo a move select
+the undo menu item from the Edit menu. A quicker way of undoing
+is to press the right mouse button (it doesn't matter where the
+mouse cursor is). Right button undo can be enabled and disabled
+by selecting the 'Right button undo' option from the Edit menu.
+Pressing the right mouse button with the control key pressed
+re-does a previously undone move.
+
+An empty base or two is very useful as it gives the opportunity
+to unscramble other bases. Try not to build onto kings which
+obscure valuable cards as it will be difficult to get to them
+later. The undo facility is very useful for going back and using
+'hindsight'.
+
+Don't be put off if you can't win every game. I reckon winning 1
+in 10 is pretty good (winning 1 in 3 is excellent).
+
diff --git a/demos/forty/scoredg.cpp b/demos/forty/scoredg.cpp
new file mode 100644 (file)
index 0000000..136fff7
--- /dev/null
@@ -0,0 +1,192 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        scoredg.cpp
+// Purpose:     Forty Thieves patience game
+// Author:      Chris Breeze
+// Modified by:
+// Created:     21/07/97
+// RCS-ID:      $Id$
+// Copyright:   (c) 1993-1998 Chris Breeze
+// Licence:    wxWindows licence
+//---------------------------------------------------------------------------
+// Last modified: 22nd July 1998 - ported to wxWindows 2.0
+/////////////////////////////////////////////////////////////////////////////
+
+#ifdef __GNUG__
+#pragma implementation
+#pragma interface
+#endif
+
+// For compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+
+#if wxUSE_IOSTREAMH
+#if defined(__WXMSW__) && !defined(__GNUWIN32__) && !defined(__MWERKS__)
+#include <strstrea.h>
+#else
+#include <strstream.h>
+#endif
+#else
+#include <strstream>
+using namespace std;
+#endif
+#include "scorefil.h"
+#include "scoredg.h"
+
+class ScoreCanvas : public wxScrolledWindow
+{
+public:
+       ScoreCanvas(wxWindow* parent, ScoreFile* scoreFile);
+       virtual ~ScoreCanvas();
+
+       void OnDraw(wxDC& dc);
+
+private:
+       wxFont*         m_font;
+       wxString        m_text;
+};
+
+
+ScoreCanvas::ScoreCanvas(wxWindow* parent, ScoreFile* scoreFile) :
+       wxScrolledWindow(parent)
+{
+#ifdef __WXGTK__
+       m_font = wxTheFontList->FindOrCreateFont(12, wxROMAN, wxNORMAL, wxNORMAL);
+#else
+       m_font = wxTheFontList->FindOrCreateFont(10, wxSWISS, wxNORMAL, wxNORMAL);
+#endif
+
+        wxArrayString players;
+       scoreFile->GetPlayerList( players);
+
+       ostrstream os;
+
+       os << "Player\tWins\tGames\tScore\n";
+       for (unsigned int i = 0; i < players.Count(); i++)
+       {
+               int wins, games, score;
+               scoreFile->ReadPlayersScore(players[i], wins, games, score);
+               int average = 0;
+               if (games > 0)
+               {
+                       average = (2 * score + games) / (2 * games);
+               }
+
+               os << players[i] << '\t' 
+                  << wins  << '\t'
+                  << games << '\t'
+                  << average << '\n';
+       }
+       os << '\0';
+       char* str = os.str();
+       m_text = str;
+       delete str;
+}
+
+ScoreCanvas::~ScoreCanvas()
+{
+}
+
+void ScoreCanvas::OnDraw(wxDC& dc)
+{
+       dc.SetFont(* m_font);
+
+       const char* str = m_text;
+       unsigned int tab = 0;
+       unsigned int tabstops[] = { 5, 100, 150, 200 };
+
+       // get the line spacing for the current font
+       int lineSpacing;
+       {
+               long w, h;
+               dc.GetTextExtent("Testing", &w, &h);
+               lineSpacing = (int)h;
+       }
+
+       int y = 0;
+       while (*str)
+       {
+               char text[256];
+               char* dest = text;
+               
+               while (*str && *str >= ' ') *dest++ = *str++;
+               *dest = '\0';
+
+               dc.DrawText(text, tabstops[tab], y);
+
+               if (*str == '\t')
+               {
+                       if (tab < sizeof(tabstops) / sizeof(tabstops[0]) - 1)
+                       {
+                               tab++;
+                       }
+               }
+               else if (*str == '\n')
+               {
+                       tab = 0;
+                       y += lineSpacing;
+               }
+               if (*str) str++;
+       }
+}
+
+BEGIN_EVENT_TABLE(ScoreDialog, wxDialog)
+    EVT_CLOSE(ScoreDialog::OnCloseWindow)
+END_EVENT_TABLE()
+
+ScoreDialog::ScoreDialog(
+                                                       wxWindow* parent,
+                                                       ScoreFile* file
+                                                       ) :
+       wxDialog(parent, -1, "Scores",
+                       wxDefaultPosition, wxSize(310, 200),
+                       wxDIALOG_MODAL | wxDEFAULT_DIALOG_STYLE),
+       m_scoreFile(file)
+{
+       // enable constraints
+       SetAutoLayout (TRUE);
+
+       ScoreCanvas* list = new ScoreCanvas(this, m_scoreFile);
+       m_OK = new wxButton(this, wxID_OK, "OK");
+
+       wxLayoutConstraints* layout;
+
+       // Constrain the OK button
+       layout = new wxLayoutConstraints;
+       layout->left.SameAs             (this,  wxLeft,         10);
+       layout->bottom.SameAs   (this,   wxBottom,      10);
+       layout->height.AsIs();
+       layout->width.AsIs();
+       m_OK->SetConstraints(layout);
+
+       // Constrain the list of players
+       layout = new wxLayoutConstraints;
+       layout->left.SameAs             (this,  wxLeft,         10);
+       layout->right.SameAs    (this,  wxRight,        10);
+       layout->top.SameAs              (this,  wxTop,          10);
+       layout->bottom.SameAs   (m_OK,  wxTop,          10);
+       list->SetConstraints(layout);
+
+       Layout();
+}
+
+ScoreDialog::~ScoreDialog()
+{
+}
+
+void ScoreDialog::Display()
+{
+       Show(TRUE);
+}
+
+void ScoreDialog::OnCloseWindow(wxCloseEvent& event)
+{
+    EndModal(wxID_OK);
+}
diff --git a/demos/forty/scoredg.h b/demos/forty/scoredg.h
new file mode 100644 (file)
index 0000000..8ce7a72
--- /dev/null
@@ -0,0 +1,34 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        scoredg.h
+// Purpose:     Forty Thieves patience game
+// Author:      Chris Breeze
+// Modified by:
+// Created:     21/07/97
+// RCS-ID:      $Id$
+// Copyright:   (c) 1993-1998 Chris Breeze
+// Licence:    wxWindows licence
+//---------------------------------------------------------------------------
+// Last modified: 22nd July 1998 - ported to wxWindows 2.0
+/////////////////////////////////////////////////////////////////////////////
+#ifndef _SCOREDG_H_
+#define _SCOREDG_H_
+
+class ScoreDialog : public wxDialog
+{
+public:
+       ScoreDialog(wxWindow* parent, ScoreFile* file);
+       virtual ~ScoreDialog();
+
+       void Display();
+
+protected:
+       void OnCloseWindow(wxCloseEvent& event);
+
+private:
+       ScoreFile*      m_scoreFile;
+       wxButton*       m_OK;
+
+DECLARE_EVENT_TABLE()
+};
+
+#endif
diff --git a/demos/forty/scorefil.cpp b/demos/forty/scorefil.cpp
new file mode 100644 (file)
index 0000000..cb871ef
--- /dev/null
@@ -0,0 +1,183 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        scorefil.cpp
+// Purpose:     Forty Thieves patience game
+// Author:      Chris Breeze
+// Modified by:
+// Created:     21/07/97
+// RCS-ID:      $Id$
+// Copyright:   (c) 1993-1998 Chris Breeze
+// Licence:    wxWindows licence
+//---------------------------------------------------------------------------
+// Last modified: 14th May 1998 - ported to wxWindows 2.0
+/////////////////////////////////////////////////////////////////////////////
+
+#ifdef __GNUG__
+#pragma implementation
+#pragma interface
+#endif
+
+// For compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+
+#ifdef __WXGTK__
+#include <unistd.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#endif
+#include "wx/textfile.h"
+#include "wx/config.h"
+#include "wx/fileconf.h"
+
+#include "scorefil.h"
+
+
+ScoreFile::ScoreFile(const char* appName)
+{
+#if 0
+       wxString filename;
+       m_configFilename << "/usr/local/share/" << appName << ".scores";
+       if (access(m_configFilename, F_OK) == 0)
+       {
+               if (access(m_configFilename, R_OK | W_OK) != 0)
+               {
+                       // file is not r/w - use local file instead
+                       m_configFilename = wxFileConfig::GetLocalFileName(appName);
+               }
+       }
+       else
+       {
+               int fd = creat(m_configFilename, 0666);
+
+               if (fd < 0)
+               {
+                       // failed to create file - use local file instead
+                       m_configFilename = wxFileConfig::GetLocalFileName(appName);
+               }
+               else
+               {
+                       // ensure created file has rw-rw-rw permissions
+                       close(fd);
+               }
+       }
+#endif
+
+       m_config = new wxConfig(appName, "wxWindows", appName, "", wxCONFIG_USE_LOCAL_FILE);  // only local
+}
+
+ScoreFile::~ScoreFile()
+{
+       delete m_config;
+#ifdef __WXGTK__
+       // ensure score file has rw-rw-rw permissions
+       // (wxFileConfig sets them to rw-------)
+       chmod(m_configFilename, 0666);
+#endif
+}
+
+
+void ScoreFile::GetPlayerList( wxArrayString &list )
+{
+       m_config->SetPath("/Players");
+       int length = m_config->GetNumberOfGroups();
+
+       if (length <= 0) return;
+
+       wxString player;
+       long index, i = 0;
+       if (m_config->GetFirstGroup(player, index))
+       {
+            list.Add( player );
+            i++;
+               while (m_config->GetNextGroup(player, index))
+               {
+                 list.Add( player );
+                 i++;
+               }
+       }
+}
+
+
+// Calculate an encrypted check number to prevent tampering with
+// score file
+long ScoreFile::CalcCheck(const char* name, int p1, int p2, int p3)
+{
+    long check = 0;
+    while (*name)
+       {
+               check = (check << 1) ^ (long)*name++;
+               check = ((check >> 23) ^ check) & 0xFFFFFF;
+       }
+       check = (check << 1) ^ (long)p1;
+       check = ((check >> 23) ^ check) & 0xFFFFFF;
+       check = (check << 1) ^ (long)p2;
+       check = ((check >> 23) ^ check) & 0xFFFFFF;
+       check = (check << 1) ^ (long)p3;
+       check = ((check >> 23) ^ check) & 0xFFFFFF;
+    return check;
+}
+
+wxString ScoreFile::GetPreviousPlayer() const
+{
+       wxString result;
+       m_config->SetPath("/General");
+       m_config->Read("LastPlayer", &result);
+       return result;
+}
+
+void ScoreFile::ReadPlayersScore(
+                                               const char* player,
+                                               int& wins,
+                                               int& games,
+                                               int& score)
+{
+       long check;
+       long myWins, myGames, myScore;
+
+       games = wins = score = 0;
+
+       m_config->SetPath("/Players");
+       m_config->SetPath(player);
+       if (m_config->Read("Score", &myScore, 0L) &&
+               m_config->Read("Games", &myGames, 0L) &&
+               m_config->Read("Wins",  &myWins, 0L) &&
+               m_config->Read("Check", &check, 0L))
+       {
+           if (check != CalcCheck(player, myGames, myWins, myScore))
+               {
+                       wxMessageBox("Score file corrupted", "Warning",
+                                               wxOK | wxICON_EXCLAMATION);
+               }
+               else
+               {
+                       games = myGames;
+                       wins = myWins;
+                       score = myScore;
+               }
+       }
+       WritePlayersScore(player, wins, games, score);
+}
+
+
+void ScoreFile::WritePlayersScore(const char* player, int wins, int games, int score)
+{
+    if (player)
+       {
+               m_config->SetPath("/General");
+               m_config->Write("LastPlayer", wxString(player)); // Without wxString tmp, thinks it's bool in VC++
+
+               m_config->SetPath("/Players");
+               m_config->SetPath(player);
+               m_config->Write("Score", (long)score);
+               m_config->Write("Games", (long)games);
+               m_config->Write("Wins", (long)wins);
+               m_config->Write("Check", CalcCheck(player, games, wins, score));
+       }
+}
diff --git a/demos/forty/scorefil.h b/demos/forty/scorefil.h
new file mode 100644 (file)
index 0000000..1e89904
--- /dev/null
@@ -0,0 +1,37 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        scorefil.h
+// Purpose:     Forty Thieves patience game
+// Author:      Chris Breeze
+// Modified by:
+// Created:     21/07/97
+// RCS-ID:      $Id$
+// Copyright:   (c) 1993-1998 Chris Breeze
+// Licence:    wxWindows licence
+//---------------------------------------------------------------------------
+// Last modified: 22nd July 1998 - ported to wxWindows 2.0
+/////////////////////////////////////////////////////////////////////////////
+#ifndef _SCOREFILE_H_
+#define _SCOREFILE_H_
+
+#include <wx/config.h>
+
+class wxConfig;
+
+class ScoreFile {
+public:
+       ScoreFile(const char* appName);
+       virtual ~ScoreFile();
+
+       void GetPlayerList( wxArrayString &list );
+       wxString GetPreviousPlayer() const;
+
+       void ReadPlayersScore(const char* player, int& wins, int& games, int &score);
+       void WritePlayersScore(const char* player, int wins, int games, int score);
+
+private:
+       long CalcCheck(const char* name, int p1, int p2, int p3);
+       wxString            m_configFilename;
+       wxConfig*           m_config;
+};
+
+#endif
diff --git a/demos/forty/symbols.bmp b/demos/forty/symbols.bmp
new file mode 100644 (file)
index 0000000..59f466c
Binary files /dev/null and b/demos/forty/symbols.bmp differ
diff --git a/demos/forty/symbols.xbm b/demos/forty/symbols.xbm
new file mode 100644 (file)
index 0000000..5dee698
--- /dev/null
@@ -0,0 +1,37 @@
+#define Symbols_width 79
+#define Symbols_height 50
+static char Symbols_bits[] = {
+ 0x08,0x84,0x0d,0x01,0x00,0x00,0x00,0x00,0x00,0x80,0x1c,0xce,0x9f,0x03,0x00,
+ 0x00,0x00,0x00,0x00,0x80,0x2a,0xdf,0xdf,0x07,0x00,0x00,0x00,0x00,0x00,0x80,
+ 0xff,0xff,0xff,0x0f,0x00,0x00,0x00,0x00,0x00,0x80,0x2a,0x9f,0xcf,0x07,0x00,
+ 0x00,0x00,0x00,0x00,0x80,0x08,0x0e,0x07,0x01,0x00,0x00,0x00,0x00,0x00,0x80,
+ 0x1c,0x04,0x82,0x03,0x00,0x00,0x00,0x00,0x00,0x80,0x1c,0x04,0x82,0x03,0x00,
+ 0x00,0x00,0x00,0x00,0x80,0x08,0x0e,0x07,0x01,0x00,0x00,0x00,0x00,0x00,0x80,
+ 0x2a,0x9f,0xcf,0x07,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0xff,0xff,0x0f,0x00,
+ 0x00,0x00,0x00,0x00,0x80,0x2a,0xdf,0xdf,0x07,0x00,0x00,0x00,0x00,0x00,0x80,
+ 0x1c,0xce,0x9f,0x03,0x00,0x00,0x00,0x00,0x00,0x80,0x08,0x84,0x0d,0x01,0x00,
+ 0x00,0x00,0x00,0x00,0x80,0x70,0x00,0x01,0x63,0x40,0x00,0x00,0x00,0x00,0x80,
+ 0xf8,0x80,0x83,0xf7,0xe0,0x00,0x00,0x00,0x00,0x80,0xf8,0x80,0xc3,0xff,0xf1,
+ 0x01,0x00,0x00,0x00,0x80,0x70,0xc0,0xc7,0xff,0xf9,0x03,0x00,0x00,0x00,0x80,
+ 0x26,0xe3,0xcf,0xff,0xfd,0x07,0x00,0x00,0x00,0x80,0xaf,0xf7,0xdf,0xff,0xff,
+ 0x0f,0x00,0x00,0x00,0x80,0xff,0xe7,0x8f,0xff,0xfe,0x0f,0x00,0x00,0x00,0x80,
+ 0xaf,0xc7,0x07,0x7f,0x5e,0x0f,0x00,0x00,0x00,0x80,0x26,0x83,0x03,0x3e,0x4c,
+ 0x06,0x00,0x00,0x00,0x80,0x70,0x80,0x03,0x1c,0xe0,0x00,0x00,0x00,0x00,0x80,
+ 0xfc,0x01,0x01,0x08,0xf8,0x03,0x00,0x00,0x00,0x80,0xfc,0x01,0x01,0x08,0xf8,
+ 0x03,0x00,0x00,0x00,0x80,0x70,0x80,0x03,0x1c,0xe0,0x00,0x00,0x00,0x00,0x80,
+ 0x26,0x83,0x03,0x3e,0x4c,0x06,0x00,0x00,0x00,0x80,0xaf,0xc7,0x07,0x7f,0x5e,
+ 0x0f,0x00,0x00,0x00,0x80,0xff,0xe7,0x8f,0xff,0xfe,0x0f,0x00,0x00,0x00,0x80,
+ 0xaf,0xf7,0xdf,0xff,0xff,0x0f,0x00,0x00,0x00,0x80,0x26,0xe3,0xcf,0xff,0xfd,
+ 0x07,0x00,0x00,0x00,0x80,0x70,0xc0,0xc7,0xff,0xf9,0x03,0x00,0x00,0x00,0x80,
+ 0xf8,0x80,0xc3,0xff,0xf1,0x01,0x00,0x00,0x00,0x80,0xf8,0x80,0x83,0xf7,0xe0,
+ 0x00,0x00,0x00,0x00,0x80,0x70,0x00,0x01,0x63,0x40,0x00,0x00,0x00,0x00,0x80,
+ 0x0c,0xe7,0x43,0x3e,0xe7,0x73,0x5c,0xe6,0x73,0xa2,0x92,0x08,0x61,0x82,0x00,
+ 0x8a,0x62,0x09,0x89,0x92,0x21,0x88,0x50,0x9e,0x00,0x89,0x62,0x09,0x89,0x8a,
+ 0x21,0xc6,0x49,0xa0,0x87,0x70,0x7c,0x09,0x89,0x86,0x3f,0x01,0xfa,0xa0,0x88,
+ 0x88,0x60,0x09,0xa9,0x8a,0xa1,0x20,0x42,0xa2,0x88,0x88,0x50,0x29,0x49,0x92,
+ 0xa1,0xcf,0x41,0x1c,0x87,0x70,0x48,0xc6,0xb0,0xa2,0xa1,0xcf,0x11,0x1c,0x87,
+ 0x70,0x88,0x89,0x69,0xa2,0x21,0x28,0x12,0xa2,0x88,0x88,0x44,0x4a,0x92,0xa4,
+ 0x3f,0x24,0xf8,0x82,0x88,0x88,0x42,0x4a,0xa8,0xa8,0x21,0xc3,0x91,0x82,0x8f,
+ 0x70,0x5e,0x4a,0x88,0xb0,0xa1,0x80,0x50,0x3c,0x48,0x88,0x62,0x4a,0x88,0xa8,
+ 0x92,0x48,0x30,0x20,0x28,0x88,0x62,0x4a,0x88,0xa4,0x0c,0xe7,0x13,0x3e,0xe7,
+ 0x73,0x9c,0xe9,0x73,0xa2};
diff --git a/demos/forty/symbols.xpm b/demos/forty/symbols.xpm
new file mode 100644 (file)
index 0000000..e5a2b25
--- /dev/null
@@ -0,0 +1,60 @@
+/* XPM */
+static char *symbols[] = {
+/* width height num_colors chars_per_pixel */
+"    79    50        3            1",
+/* colors */
+". c #ffffff",
+"* c #ff0000",
+"# c #000000",
+/* pixels */
+"...#......*....**.**....#......................................................",
+"..###....***..*******..###.....................................................",
+".#.#.#..*****.*******.#####....................................................",
+"#######**************#######...................................................",
+".#.#.#..*****..*****..#####....................................................",
+"...#.....***....***.....#......................................................",
+"..###.....*......*.....###.....................................................",
+"..###.....*......*.....###.....................................................",
+"...#.....***....***.....#......................................................",
+".#.#.#..*****..*****..#####....................................................",
+"#######**************#######...................................................",
+".#.#.#..*****.*******.#####....................................................",
+"..###....***..*******..###.....................................................",
+"...#......*....**.**....#......................................................",
+"....###.........*.......**...**.......#........................................",
+"...#####.......***.....****.****.....###.......................................",
+"...#####.......***....***********...#####......................................",
+"....###.......*****...***********..#######.....................................",
+".##..#..##...*******..***********.#########....................................",
+"####.#.####.*********.***********###########...................................",
+"###########..*******...*********.###########...................................",
+"####.#.####...*****.....*******..####.#.####...................................",
+".##..#..##.....***.......*****....##..#..##....................................",
+"....###........***........***........###.......................................",
+"..#######.......*..........*.......#######.....................................",
+"..#######.......*..........*.......#######.....................................",
+"....###........***........***........###.......................................",
+".##..#..##.....***.......*****....##..#..##....................................",
+"####.#.####...*****.....*******..####.#.####...................................",
+"###########..*******...*********.###########...................................",
+"####.#.####.*********.***********###########...................................",
+".##..#..##...*******..***********.#########....................................",
+"....###.......*****...***********..#######.....................................",
+"...#####.......***....***********...#####......................................",
+"...#####.......***.....****.****.....###.......................................",
+"....###.........*.......**...**.......#........................................",
+"..##....###..#####....#..#####..###..#####..###...###.#..##..#####..###..#...#.",
+".#..#..#...#....#....##..#.....#.........#.#...#.#...##.#..#....#..#...#.#..#..",
+"#....#.....#...#....#.#..####..#........#..#...#.#...##.#..#....#..#...#.#.#...",
+"#....#...##...###..#..#......#.####....#....###...#####.#..#....#..#...#.##....",
+"######..#........#.#####.....#.#...#...#...#...#.....##.#..#....#..#.#.#.#.#...",
+"#....#.#.....#...#....#..#...#.#...#...#...#...#....#.#.#..#.#..#..#..#..#..#..",
+"#....#.#####..###.....#...###...###....#....###....#..#..##...##....##.#.#...#.",
+"#....#.#####..###...#.....###...###....#....###....#...##..#...##..#.##..#...#.",
+"#....#.....#.#...#..#....#...#.#...#...#...#...#..#...#..#.#..#..#..#..#..#..#.",
+"######....#..#.....#####.#.....#...#...#...#...#.#....#..#.#..#....#.#.#...#.#.",
+"#....#..##....###...#..#.#.....#####...#....###..####.#..#.#..#....#...#....##.",
+"#....#.#.......#....#.#...####.....#..#....#...#.#...##..#.#..#....#...#...#.#.",
+".#..#..#...#..#.....##.......#.....#.#.....#...#.#...##..#.#..#....#...#..#..#.",
+"..##....###..#####..#....#####..###..#####..###...###..##..#.#####..###..#...#."
+};
diff --git a/demos/fractal/.cvsignore b/demos/fractal/.cvsignore
new file mode 100644 (file)
index 0000000..8b13789
--- /dev/null
@@ -0,0 +1 @@
+
diff --git a/demos/fractal/Makefile.in b/demos/fractal/Makefile.in
new file mode 100644 (file)
index 0000000..28486d1
--- /dev/null
@@ -0,0 +1,21 @@
+#
+# File:                Makefile.in
+# Author:      Julian Smart
+# Created:     1998
+# Updated:     
+# Copyright:   (c) 1998 Julian Smart
+#
+# "%W% %G%"
+#
+# Makefile for fractal example (UNIX).
+
+top_srcdir = @top_srcdir@
+top_builddir = ../..
+program_dir = samples/fractal
+
+PROGRAM=fractal
+
+OBJECTS=$(PROGRAM).o
+
+include ../../src/makeprog.env
+
diff --git a/demos/fractal/fractal.cpp b/demos/fractal/fractal.cpp
new file mode 100644 (file)
index 0000000..fe84a6a
--- /dev/null
@@ -0,0 +1,251 @@
+///////////////////////////////////////////////////////////////////////////////
+// Name:        fractal.cpp
+// Purpose:     demo of wxConfig and related classes
+// Author:      Andrew Davison
+// Modified by:
+// Created:     05.04.94
+// RCS-ID:      $Id$
+// Copyright:   (c) 1994 Andrew Davison
+// Licence:     wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+
+/*
+Date: Tue, 5 Apr 1994 12:01:18 +1000
+From: Andrew Davison <andrewd@au.com.sfe>
+To: wxwin-users@ed.aiai
+Subject: Fractal mountains
+
+Hi,
+
+This is a quick port of a fractal mountain generator originally
+done for MS-Windows. On a Sun the colours look a little washed
+out and there is not as much snow or high mountains (maybe the
+random number generators fault). The viewing plane is not
+quite right as the original code used SetViewportOrg() which there
+doesn't seem to be an equivalent of under wxWindows, and my quick
+hack doesn't fix. 
+*/
+
+#ifdef __GNUG__
+#pragma implementation
+#pragma interface
+#endif
+
+#include "wx/wxprec.h"
+
+#ifndef  WX_PRECOMP
+  #include "wx/wx.h"
+#endif //precompiled headers
+
+#include <stdlib.h>
+#include <math.h>
+#include <time.h>
+
+#define Random(x) (rand() % x)
+#define Randomize() (srand((unsigned int)time(NULL)))
+
+static int detail = 9;         // CHANGE THIS... 7,8,9 etc
+
+static bool running = FALSE;                                
+static wxMenuBar *menuBar = NULL;
+
+// Define a new application type
+class MyApp: public wxApp
+{ public:
+       bool OnInit();
+};
+
+IMPLEMENT_APP(MyApp)
+
+// Define a new frame type
+class MyFrame: public wxFrame
+{
+public:
+       MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size);
+
+       void OnCloseWindow(wxCloseEvent& event);
+    void OnExit(wxCommandEvent& event);
+DECLARE_EVENT_TABLE()
+};
+
+// Define a new canvas which can receive some events
+class MyCanvas: public wxWindow
+{
+public:
+       MyCanvas(wxFrame *frame);
+       void Draw(wxDC& dc);
+
+private:
+       void OnPaint(wxPaintEvent& event);
+       void Fractal(wxDC& dc, int X1, int Y1, int X2, int Y2, int Z1, int Z2, int Z3, int Z4, int Iteration, double Std, double Ratio);
+       wxPen SnowPen, MtnPen, GreenPen;
+       wxBrush WaterBrush;
+       int Sealevel;
+
+DECLARE_EVENT_TABLE()
+};
+
+// `Main program' equivalent, creating windows and returning main app frame
+bool MyApp::OnInit()
+{
+  // Create the main frame window
+  MyFrame *frame = new MyFrame(NULL, "Fractal Mountains for wxWindows", wxPoint(-1, -1), wxSize(640, 480));
+
+  // Make a menubar
+  wxMenu *file_menu = new wxMenu;
+  file_menu->Append(wxID_EXIT, "E&xit");
+  menuBar = new wxMenuBar;
+  menuBar->Append(file_menu, "&File");
+  frame->SetMenuBar(menuBar);
+
+  int width, height;
+  frame->GetClientSize(&width, &height);
+
+  (void) new MyCanvas(frame);
+
+  // Show the frame
+  frame->Show(TRUE);
+
+  return TRUE;
+}
+
+BEGIN_EVENT_TABLE(MyFrame, wxFrame)
+  EVT_CLOSE(MyFrame::OnCloseWindow)
+  EVT_MENU(wxID_EXIT, MyFrame::OnExit)
+END_EVENT_TABLE()
+
+// My frame constructor
+MyFrame::MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size):
+  wxFrame(frame, -1, title, pos, size)
+{
+}
+
+// Intercept menu commands
+void MyFrame::OnExit(wxCommandEvent& event)
+{
+    this->Destroy();
+}
+
+void MyFrame::OnCloseWindow(wxCloseEvent& event)
+{
+    static bool destroyed = FALSE;
+    if (destroyed)
+        return;
+
+    this->Destroy();
+
+    destroyed = TRUE;
+}
+
+BEGIN_EVENT_TABLE(MyCanvas, wxWindow)
+  EVT_PAINT(MyCanvas::OnPaint)
+END_EVENT_TABLE()
+
+// Define a constructor for my canvas
+MyCanvas::MyCanvas(wxFrame *frame):
+ wxWindow(frame, -1)
+{
+    wxColour wxCol1(255,255,255);
+    SnowPen = wxPen(wxCol1, 2, wxSOLID);
+
+    wxColour wxCol2(128,0,0);
+    MtnPen = wxPen(wxCol2, 1, wxSOLID);
+
+    wxColour wxCol3(0,128,0);
+    GreenPen = wxPen(wxCol3, 1, wxSOLID);
+
+    wxColour wxCol4(0,0,128);
+    WaterBrush = wxBrush(wxCol4, wxSOLID);
+}
+
+void MyCanvas::OnPaint(wxPaintEvent& event)
+{
+    wxPaintDC dc(this);
+       Draw(dc);
+}
+
+void MyCanvas::Draw(wxDC& dc)
+{
+    if (running) return;
+        
+    running = TRUE;
+    menuBar->EnableTop(0, FALSE);
+
+       Randomize();
+
+       int Left, Top, Right, Bottom;
+       GetClientSize(&Right, &Bottom);
+
+       Right *= 3; Right /= 4;
+       Bottom *= 3; Bottom /= 4;
+       Left = 0;
+       Top = Bottom/8;
+
+       wxPoint Water[4];
+       Water[0].x = Left;                          Water[0].y = Top;
+       Water[1].x = Right;                             Water[1].y = Top;
+       Water[2].x = Right+Bottom/2;    Water[2].y = Bottom;
+       Water[3].x = Bottom/2;                  Water[3].y = Bottom;
+
+       dc.SetBrush(WaterBrush);
+       dc.DrawPolygon(4, Water);
+
+       double H = 0.75;
+       double Scale = Bottom;
+       double Ratio = 1.0 / pow(2.0, H);
+       double Std = Scale * Ratio;
+       Sealevel = Random(18) - 8;
+
+       Fractal(dc, Left, Top, Right, Bottom, 0, 0, 0, 0, detail, Std, Ratio);
+
+    menuBar->EnableTop(0, TRUE);
+    running = FALSE;
+}
+
+void MyCanvas::Fractal(wxDC& dc, int X1, int Y1, int X2, int Y2, int Z1, int Z2, int Z3, int Z4, int Iteration, double Std, double Ratio)
+{
+       int Xmid = (X1 + X2) / 2;
+       int Ymid = (Y1 + Y2) / 2;
+       int Z23 = (Z2 + Z3) / 2;
+       int Z41 = (Z4 + Z1) / 2;
+       int Newz = (int)((Z1 + Z2 + Z3 + Z4) / 4 + (double)(Random(17) - 8) / 8.0 * Std);
+
+       if (--Iteration)
+       {
+               int Z12 = (Z1 + Z2) / 2;
+               int Z34 = (Z3 + Z4) / 2;
+               double Stdmid = Std * Ratio;
+
+               Fractal(dc, Xmid, Y1, X2, Ymid, Z12, Z2, Z23, Newz, Iteration, Stdmid, Ratio);
+               Fractal(dc, X1, Y1, Xmid, Ymid, Z1, Z12, Newz, Z41, Iteration, Stdmid, Ratio);
+               Fractal(dc, Xmid, Ymid, X2, Y2, Newz, Z23, Z3, Z34, Iteration, Stdmid, Ratio);
+               Fractal(dc, X1, Ymid, Xmid, Y2, Z41, Newz, Z34, Z4, Iteration, Stdmid, Ratio);
+       }
+       else
+       {
+               if (Newz <= Sealevel)
+               {
+                       wxPoint P[4];
+                       P[0].x = Y1 / 2 + X1;   P[0].y = Y1 + Z1;
+                       P[1].x = Y1 / 2 + X2;   P[1].y = Y1 + Z2;
+                       P[2].x = Y2 / 2 + X2;   P[2].y = Y2 + Z3;
+                       P[3].x = Y2 / 2 + X1;   P[3].y = Y2 + Z4;
+
+                       dc.SetPen(* wxBLACK_PEN);
+                       dc.SetBrush(* wxBLACK_BRUSH);
+
+                       dc.DrawPolygon(4, P);
+
+                       if (Z1 >= -(60+Random(25)))
+                               dc.SetPen(GreenPen);
+                       else if (Z1 >= -(100+Random(25)))
+                               dc.SetPen(MtnPen);
+                       else
+                               dc.SetPen(SnowPen);
+
+                       dc.DrawLine(Ymid/2+X2, Ymid+Z23, Ymid/2+X1, Ymid+Z41);
+               }
+       }
+}
+
diff --git a/demos/fractal/fractal.def b/demos/fractal/fractal.def
new file mode 100644 (file)
index 0000000..822abf6
--- /dev/null
@@ -0,0 +1,9 @@
+NAME         Fractal
+DESCRIPTION  'Fractal'
+EXETYPE      WINDOWS
+STUB         'WINSTUB.EXE'
+CODE         PRELOAD MOVEABLE DISCARDABLE
+DATA         PRELOAD MOVEABLE MULTIPLE
+HEAPSIZE     1024
+STACKSIZE    16192
+
diff --git a/demos/fractal/fractal.rc b/demos/fractal/fractal.rc
new file mode 100644 (file)
index 0000000..e3b11b0
--- /dev/null
@@ -0,0 +1,4 @@
+wxSTD_FRAME ICON "mondrian.ico"
+
+#include "wx/msw/wx.rc"
+
diff --git a/demos/fractal/makefile.b32 b/demos/fractal/makefile.b32
new file mode 100644 (file)
index 0000000..6000f39
--- /dev/null
@@ -0,0 +1,16 @@
+#
+# File:                makefile.b32
+# Author:      Julian Smart
+# Created:     1999
+# Updated:     
+# Copyright:
+#
+# Makefile : Builds sample for 32-bit BC++
+
+WXDIR = $(WXWIN)
+
+TARGET=fractal
+OBJECTS = $(TARGET).obj
+
+!include $(WXDIR)\src\makeprog.b32
+
diff --git a/demos/fractal/makefile.bcc b/demos/fractal/makefile.bcc
new file mode 100644 (file)
index 0000000..6b4aacd
--- /dev/null
@@ -0,0 +1,19 @@
+#
+# File:                makefile.bcc
+# Author:      Julian Smart
+# Created:     1998
+# Updated:     
+#
+# Builds a BC++ 16-bit sample
+
+!if "$(WXWIN)" == ""
+!error You must define the WXWIN variable in autoexec.bat, e.g. WXWIN=c:\wx
+!endif
+
+WXDIR = $(WXWIN)
+
+TARGET=fractal
+OBJECTS=$(TARGET).obj
+
+!include $(WXDIR)\src\makeprog.bcc
+
diff --git a/demos/fractal/makefile.dos b/demos/fractal/makefile.dos
new file mode 100644 (file)
index 0000000..9bb114e
--- /dev/null
@@ -0,0 +1,17 @@
+#
+# File:                makefile.dos
+# Author:      Julian Smart
+# Created:     1998
+# Updated:     
+#
+# Makefile : Builds 16-bit sample, VC++ 1.5
+# Use FINAL=1 argument to nmake to build final version with no debugging
+# info
+
+WXDIR = $(WXWIN)
+
+TARGET=fractal
+OBJECTS=$(TARGET).obj
+
+!include $(WXDIR)\src\makeprog.msc
+
diff --git a/demos/fractal/makefile.g95 b/demos/fractal/makefile.g95
new file mode 100644 (file)
index 0000000..09d3d1f
--- /dev/null
@@ -0,0 +1,16 @@
+#
+# File:         makefile.g95
+# Author:       Julian Smart
+# Created:      1999
+# Updated:
+# Copyright:    (c) Julian Smart, 1999
+#
+# Makefile for wxWindows sample (Cygwin/Mingw32).
+
+WXDIR = ../..
+
+TARGET=fractal
+OBJECTS = $(TARGET).o
+
+include $(WXDIR)/src/makeprog.g95
+
diff --git a/demos/fractal/makefile.unx b/demos/fractal/makefile.unx
new file mode 100644 (file)
index 0000000..e23e9c3
--- /dev/null
@@ -0,0 +1,35 @@
+#
+# File:                Makefile for samples
+# Author:      Robert Roebling
+# Created:     1999
+# Updated:     
+# Copyright:   (c) 1998 Robert Roebling
+#
+# This makefile requires a Unix version of wxWindows
+# to be installed on your system. This is most often
+# done typing "make install" when using the complete
+# sources of wxWindows or by installing the two
+# RPM packages wxGTK.XXX.rpm and wxGTK-devel.XXX.rpm
+# under Linux.
+#
+
+CC = gcc
+
+PROGRAM = fractal
+
+OBJECTS = $(PROGRAM).o
+
+# implementation
+
+.SUFFIXES:     .o .cpp
+
+.cpp.o :
+       $(CC) -c `wx-config --cflags` -o $@ $<
+
+all:    $(PROGRAM)
+
+$(PROGRAM):    $(OBJECTS)
+       $(CC) -o $(PROGRAM) $(OBJECTS) `wx-config --libs`
+
+clean: 
+       rm -f *.o $(PROGRAM)
diff --git a/demos/fractal/makefile.vc b/demos/fractal/makefile.vc
new file mode 100644 (file)
index 0000000..3023708
--- /dev/null
@@ -0,0 +1,18 @@
+#
+# File:                makefile.vc
+# Author:      Julian Smart
+# Created:     1999
+# Updated:     
+# Copyright:   (c) Julian Smart
+#
+# Makefile : Builds sample (VC++, WIN32)
+# Use FINAL=1 argument to nmake to build final version with no debug info.
+
+# Set WXDIR for your system
+WXDIR = $(WXWIN)
+
+PROGRAM=fractal
+OBJECTS = $(PROGRAM).obj
+
+!include $(WXDIR)\src\makeprog.vc
+
diff --git a/demos/fractal/makefile.wat b/demos/fractal/makefile.wat
new file mode 100644 (file)
index 0000000..d48fab6
--- /dev/null
@@ -0,0 +1,15 @@
+#
+# Makefile for WATCOM
+#
+# Created by Julian Smart, January 1999
+# 
+#
+
+WXDIR = $(%WXWIN)
+
+PROGRAM = fractal
+OBJECTS = $(PROGRAM).obj
+
+!include $(WXDIR)\src\makeprog.wat
+
+
diff --git a/demos/fractal/mondrian.ico b/demos/fractal/mondrian.ico
new file mode 100644 (file)
index 0000000..2310c5d
Binary files /dev/null and b/demos/fractal/mondrian.ico differ
diff --git a/demos/life/Makefile.in b/demos/life/Makefile.in
new file mode 100644 (file)
index 0000000..5e9184b
--- /dev/null
@@ -0,0 +1,22 @@
+#
+# File:                makefile.unx
+# Author:      Julian Smart
+# Created:     1998
+# Updated:     
+# Copyright:   (c) 1998 Julian Smart
+#
+# "%W% %G%"
+#
+# Makefile for toolbar example (UNIX).
+
+top_srcdir = @top_srcdir@
+top_builddir = ../..
+program_dir = samples/life
+
+PROGRAM=life
+
+OBJECTS=$(PROGRAM).o
+
+include ../../src/makeprog.env
+
+
diff --git a/demos/life/bitmaps/play.bmp b/demos/life/bitmaps/play.bmp
new file mode 100644 (file)
index 0000000..41f9449
Binary files /dev/null and b/demos/life/bitmaps/play.bmp differ
diff --git a/demos/life/bitmaps/play.xpm b/demos/life/bitmaps/play.xpm
new file mode 100644 (file)
index 0000000..26d6d51
--- /dev/null
@@ -0,0 +1,23 @@
+/* XPM */\r
+static char *play_xpm[] = {\r
+/* columns rows colors chars-per-pixel */\r
+"16 16 2 1",\r
+"  c None",\r
+". c Black",\r
+/* pixels */\r
+"                ",\r
+"                ",\r
+"                ",\r
+"    .           ",\r
+"    ...         ",\r
+"    .....       ",\r
+"    .......     ",\r
+"    .........   ",\r
+"    .......     ",\r
+"    .....       ",\r
+"    ...         ",\r
+"    .           ",\r
+"                ",\r
+"                ",\r
+"                "\r
+};\r
diff --git a/demos/life/bitmaps/reset.bmp b/demos/life/bitmaps/reset.bmp
new file mode 100644 (file)
index 0000000..41ea143
Binary files /dev/null and b/demos/life/bitmaps/reset.bmp differ
diff --git a/demos/life/bitmaps/reset.xpm b/demos/life/bitmaps/reset.xpm
new file mode 100644 (file)
index 0000000..b9ebd02
--- /dev/null
@@ -0,0 +1,24 @@
+/* XPM */\r
+static char *reset_xpm[] = {\r
+/* columns rows colors chars-per-pixel */\r
+"16 16 2 1",\r
+"  c None",\r
+". c Black",\r
+/* pixels */\r
+"                ",\r
+"                ",\r
+"                ",\r
+"   ..      ..   ",\r
+"   ...    ...   ",\r
+"    ...  ...    ",\r
+"     ......     ",\r
+"      ....      ",\r
+"      ....      ",\r
+"     ......     ",\r
+"    ...  ...    ",\r
+"   ...    ...   ",\r
+"   ..      ..   ",\r
+"                ",\r
+"                ",\r
+"                "\r
+};\r
diff --git a/demos/life/bitmaps/stop.bmp b/demos/life/bitmaps/stop.bmp
new file mode 100644 (file)
index 0000000..a0941ea
Binary files /dev/null and b/demos/life/bitmaps/stop.bmp differ
diff --git a/demos/life/bitmaps/stop.xpm b/demos/life/bitmaps/stop.xpm
new file mode 100644 (file)
index 0000000..cf7fd0b
--- /dev/null
@@ -0,0 +1,24 @@
+/* XPM */\r
+static char *stop_xpm[] = {\r
+/* columns rows colors chars-per-pixel */\r
+"16 16 2 1",\r
+"  c None",\r
+". c Black",\r
+/* pixels */\r
+"                ",\r
+"                ",\r
+"                ",\r
+"    ........    ",\r
+"    ........    ",\r
+"    ........    ",\r
+"    ........    ",\r
+"    ........    ",\r
+"    ........    ",\r
+"    ........    ",\r
+"    ........    ",\r
+"    ........    ",\r
+"                ",\r
+"                ",\r
+"                ",\r
+"                "\r
+};\r
diff --git a/demos/life/life.cpp b/demos/life/life.cpp
new file mode 100644 (file)
index 0000000..e14ab1b
--- /dev/null
@@ -0,0 +1,1182 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        life.cpp
+// Purpose:     The game of life, created by J. H. Conway
+// Author:      Guillermo Rodriguez Garcia, <guille@iies.es>
+// Modified by:
+// Created:     Jan/2000
+// RCS-ID:      $Id$
+// Copyright:   (c) 2000, Guillermo Rodriguez Garcia
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// ==========================================================================
+// declarations
+// ==========================================================================
+
+// minimum and maximum table size, in each dimension
+#define LIFE_MIN 20
+#define LIFE_MAX 200
+
+// some shortcuts
+#define ADD_TOOL(a, b, c, d) \
+    toolBar->AddTool(a, b, wxNullBitmap, FALSE, -1, -1, (wxObject *)0, c, d)
+
+#define GET_FRAME() \
+    ((LifeFrame *) wxGetApp().GetTopWindow())
+
+// --------------------------------------------------------------------------
+// headers
+// --------------------------------------------------------------------------
+
+#ifdef __GNUG__
+    #pragma implementation "life.cpp"
+    #pragma interface "life.cpp"
+#endif
+
+// for compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+    #pragma hdrstop
+#endif
+
+// for all others, include the necessary headers
+#ifndef WX_PRECOMP
+    #include "wx/wx.h"
+#endif
+
+#include "wx/statline.h"
+#include "wx/spinctrl.h"
+
+// --------------------------------------------------------------------------
+// resources
+// --------------------------------------------------------------------------
+
+#if defined(__WXGTK__) || defined(__WXMOTIF__)
+    // the application icon
+    #include "mondrian.xpm"
+
+    // bitmap buttons for the toolbar
+    #include "bitmaps/reset.xpm"
+    #include "bitmaps/play.xpm"
+    #include "bitmaps/stop.xpm"
+#endif
+
+// --------------------------------------------------------------------------
+// classes
+// --------------------------------------------------------------------------
+
+class Life;
+class LifeShape;
+class LifeCanvas;
+class LifeTimer;
+class LifeFrame;
+class LifeApp;
+class LifeNewGameDialog;
+class LifeSamplesDialog;
+
+// --------------------------------------------------------------------------
+// non-GUI classes
+// --------------------------------------------------------------------------
+
+// Life
+class Life
+{
+public:
+    // ctors and dtors
+    Life(int width, int height);
+    ~Life();
+    void Create(int width, int height);
+    void Destroy();
+
+    // accessors
+    inline int  GetWidth()  const { return m_width; };
+    inline int  GetHeight() const { return m_height; };
+    inline bool IsAlive(int x, int y) const;
+    inline bool HasChanged(int x, int y) const;
+
+    // flags
+    void SetBorderWrap(bool on);
+
+    // game logic
+    void Clear();
+    void SetCell(int x, int y, bool alive = TRUE);
+    void SetShape(LifeShape &shape);
+    bool NextTic();
+
+private:
+    enum CellFlags {
+        CELL_DEAD    = 0x0000,  // is dead
+        CELL_ALIVE   = 0x0001,  // is alive
+        CELL_MARK    = 0x0002,  // will change / has changed
+    };
+    typedef int Cell;
+
+    int GetNeighbors(int x, int y) const;
+    inline void SetCell(int x, int y, Cell status);
+
+    int   m_width;
+    int   m_height;
+    Cell *m_cells;
+    bool  m_wrap;
+};
+
+// LifeShape
+class LifeShape
+{
+public:
+    LifeShape::LifeShape(wxString name,
+                         wxString desc,
+                         int width, int height, char *data,
+                         int fieldWidth = 20, int fieldHeight = 20,
+                         bool wrap = TRUE)
+    {
+        m_name        = name;
+        m_desc        = desc;
+        m_width       = width;
+        m_height      = height;
+        m_data        = data;
+        m_fieldWidth  = fieldWidth;
+        m_fieldHeight = fieldHeight;
+        m_wrap        = wrap;
+    }
+
+    wxString  m_name;
+    wxString  m_desc;
+    int       m_width;
+    int       m_height;
+    char     *m_data;
+    int       m_fieldWidth;
+    int       m_fieldHeight;
+    bool      m_wrap;
+};
+
+// --------------------------------------------------------------------------
+// GUI classes
+// --------------------------------------------------------------------------
+
+// Life canvas
+class LifeCanvas : public wxScrolledWindow
+{
+public:
+    // ctor and dtor
+    LifeCanvas(wxWindow* parent, Life* life, bool interactive = TRUE);
+    ~LifeCanvas();
+
+    // member functions
+    void Reset();
+    void DrawEverything(bool force = FALSE);
+    void DrawCell(int i, int j);
+    void DrawCell(int i, int j, wxDC &dc);
+    inline int CellToCoord(int i) const { return (i * m_cellsize); };
+    inline int CoordToCell(int x) const { return ((x >= 0)? (x / m_cellsize) : -1); };
+
+    // event handlers
+    void OnPaint(wxPaintEvent& event);
+    void OnMouse(wxMouseEvent& event);
+    void OnSize(wxSizeEvent& event);
+
+private:
+    // any class wishing to process wxWindows events must use this macro
+    DECLARE_EVENT_TABLE()
+
+    enum MouseStatus {
+        MOUSE_NOACTION,
+        MOUSE_DRAWING,
+        MOUSE_ERASING
+    };
+
+    Life        *m_life;
+    wxBitmap    *m_bmp;
+    int          m_height;
+    int          m_width;
+    int          m_cellsize;
+    wxCoord      m_xoffset;
+    wxCoord      m_yoffset;
+    MouseStatus  m_status;
+    bool         m_interactive;
+};
+
+// Life timer
+class LifeTimer : public wxTimer
+{
+public:
+    void Notify();
+};
+
+// Life main frame
+class LifeFrame : public wxFrame
+{
+public:
+    // ctor and dtor
+    LifeFrame();
+    ~LifeFrame();
+
+    // member functions
+    void UpdateInfoText();
+
+    // event handlers
+    void OnMenu(wxCommandEvent& event);
+    void OnNewGame(wxCommandEvent& event);
+    void OnSamples(wxCommandEvent& event);
+    void OnStart();
+    void OnStop();
+    void OnTimer();
+    void OnSlider(wxScrollEvent& event);
+
+private:
+    // any class wishing to process wxWindows events must use this macro
+    DECLARE_EVENT_TABLE()
+
+    Life         *m_life;
+    LifeTimer    *m_timer;
+    LifeCanvas   *m_canvas;
+    wxStaticText *m_text;
+    bool          m_running;
+    long          m_interval;
+    long          m_tics;
+};
+
+// Life new game dialog
+class LifeNewGameDialog : public wxDialog
+{
+public:
+    // ctor
+    LifeNewGameDialog(wxWindow *parent, int *w, int *h);
+
+    // event handlers
+    void OnOK(wxCommandEvent& event);
+
+private:
+    // any class wishing to process wxWindows events must use this macro
+    DECLARE_EVENT_TABLE();
+
+    int        *m_w;
+    int        *m_h;
+    wxSpinCtrl *m_spinctrlw;
+    wxSpinCtrl *m_spinctrlh;
+};
+
+// Life sample configurations dialog
+class LifeSamplesDialog : public wxDialog
+{
+public:
+    // ctor and dtor
+    LifeSamplesDialog(wxWindow *parent);
+    ~LifeSamplesDialog();
+
+    // members
+    int GetValue();
+
+    // event handlers
+    void OnListBox(wxCommandEvent &event);
+
+private:
+    // any class wishing to process wxWindows events must use this macro
+    DECLARE_EVENT_TABLE();
+
+    int         m_value;
+    wxListBox  *m_list;
+    wxTextCtrl *m_text;
+    LifeCanvas *m_canvas;
+    Life       *m_life;
+};
+
+// Life app
+class LifeApp : public wxApp
+{
+public:
+    virtual bool OnInit();
+};
+
+// --------------------------------------------------------------------------
+// constants
+// --------------------------------------------------------------------------
+
+// IDs for the controls and the menu commands
+enum
+{
+    // menu items and toolbar buttons
+    ID_NEWGAME = 1001,
+    ID_SAMPLES,
+    ID_ABOUT,
+    ID_EXIT,
+    ID_CLEAR,
+    ID_START,
+    ID_STEP,
+    ID_STOP,
+    ID_WRAP,
+
+    // speed selection slider
+    ID_SLIDER,
+
+    // listbox in samples dialog
+    ID_LISTBOX
+};
+
+
+// built-in sample games
+#include "samples.inc"
+
+// --------------------------------------------------------------------------
+// event tables and other macros for wxWindows
+// --------------------------------------------------------------------------
+
+// Event tables
+BEGIN_EVENT_TABLE(LifeFrame, wxFrame)
+    EVT_MENU           (ID_NEWGAME, LifeFrame::OnNewGame)
+    EVT_MENU           (ID_SAMPLES, LifeFrame::OnSamples)
+    EVT_MENU           (ID_ABOUT,   LifeFrame::OnMenu)
+    EVT_MENU           (ID_EXIT,    LifeFrame::OnMenu)
+    EVT_MENU           (ID_CLEAR,   LifeFrame::OnMenu)
+    EVT_MENU           (ID_START,   LifeFrame::OnMenu)
+    EVT_MENU           (ID_STEP,    LifeFrame::OnMenu)
+    EVT_MENU           (ID_STOP,    LifeFrame::OnMenu)
+    EVT_MENU           (ID_WRAP,    LifeFrame::OnMenu)
+    EVT_COMMAND_SCROLL (ID_SLIDER,  LifeFrame::OnSlider)
+END_EVENT_TABLE()
+
+BEGIN_EVENT_TABLE(LifeCanvas, wxScrolledWindow)
+    EVT_PAINT          (            LifeCanvas::OnPaint)
+    EVT_SIZE           (            LifeCanvas::OnSize)
+    EVT_MOUSE_EVENTS   (            LifeCanvas::OnMouse)
+END_EVENT_TABLE()
+
+BEGIN_EVENT_TABLE(LifeNewGameDialog, wxDialog)
+    EVT_BUTTON         (wxID_OK,    LifeNewGameDialog::OnOK)
+END_EVENT_TABLE()
+
+BEGIN_EVENT_TABLE(LifeSamplesDialog, wxDialog)
+    EVT_LISTBOX        (ID_LISTBOX, LifeSamplesDialog::OnListBox)
+END_EVENT_TABLE()
+
+
+// Create a new application object
+IMPLEMENT_APP(LifeApp)
+
+// ==========================================================================
+// implementation
+// ==========================================================================
+
+// --------------------------------------------------------------------------
+// LifeApp
+// --------------------------------------------------------------------------
+
+// `Main program' equivalent: the program execution "starts" here
+bool LifeApp::OnInit()
+{
+    // create the main application window
+    LifeFrame *frame = new LifeFrame();
+
+    // show it and tell the application that it's our main window
+    frame->Show(TRUE);
+    SetTopWindow(frame);
+
+    // enter the main message loop and run the app
+    return TRUE;
+}
+
+// --------------------------------------------------------------------------
+// LifeFrame
+// --------------------------------------------------------------------------
+
+// frame constructor
+LifeFrame::LifeFrame() : wxFrame((wxFrame *)0, -1, _("Life!"), wxPoint(50, 50))
+{
+    // frame icon
+    SetIcon(wxICON(mondrian));
+
+    // menu bar
+    wxMenu *menuFile = new wxMenu("", wxMENU_TEAROFF);
+    wxMenu *menuGame = new wxMenu("", wxMENU_TEAROFF);
+
+    menuFile->Append(ID_NEWGAME, _("New game..."), _("Start a new game"));
+    menuFile->Append(ID_SAMPLES, _("Sample game..."), _("Select a sample configuration"));
+    menuFile->AppendSeparator();
+    menuFile->Append(ID_ABOUT, _("&About...\tCtrl-A"), _("Show about dialog"));
+    menuFile->AppendSeparator();
+    menuFile->Append(ID_EXIT, _("E&xit\tAlt-X"), _("Quit this program"));
+
+    menuGame->Append(ID_CLEAR, _("&Clear\tCtrl-C"), _("Clear game field"));
+    menuGame->Append(ID_START, _("&Start\tCtrl-S"), _("Start"));
+    menuGame->Append(ID_STEP, _("&Next\tCtrl-N"), _("Single step"));
+    menuGame->Append(ID_STOP, _("S&top\tCtrl-T"), _("Stop"));
+    menuGame->Enable(ID_STOP, FALSE);
+    menuGame->AppendSeparator();
+    menuGame->Append(ID_WRAP, _("&Wraparound\tCtrl-W"), _("Wrap around borders"), TRUE);
+    menuGame->Check (ID_WRAP, TRUE);
+
+
+    wxMenuBar *menuBar = new wxMenuBar();
+    menuBar->Append(menuFile, _("&File"));
+    menuBar->Append(menuGame, _("&Game"));
+    SetMenuBar(menuBar);
+
+    // tool bar
+    wxBitmap tbBitmaps[3];
+
+    tbBitmaps[0] = wxBITMAP(reset);
+    tbBitmaps[1] = wxBITMAP(play);
+    tbBitmaps[2] = wxBITMAP(stop);
+
+    wxToolBar *toolBar = CreateToolBar();
+    toolBar->SetMargins(5, 5);
+    toolBar->SetToolBitmapSize(wxSize(16, 16));
+    ADD_TOOL(ID_CLEAR, tbBitmaps[0], _("Clear"), _("Clear game board"));
+    ADD_TOOL(ID_START, tbBitmaps[1], _("Start"), _("Start"));
+    ADD_TOOL(ID_STOP , tbBitmaps[2], _("Stop"),  _("Stop"));
+    toolBar->EnableTool(ID_STOP, FALSE);
+    toolBar->Realize();
+
+    // status bar
+    CreateStatusBar(2);
+    SetStatusText(_("Welcome to Life!"));
+
+    // panel
+    wxPanel *panel = new wxPanel(this, -1);
+
+    // game
+    m_life     = new Life(20, 20);
+    m_canvas   = new LifeCanvas(panel, m_life);
+    m_timer    = new LifeTimer();
+    m_interval = 500;
+    m_tics     = 0;
+    m_text     = new wxStaticText(panel, -1, "");
+    UpdateInfoText();
+
+    // slider
+    wxSlider *slider = new wxSlider(panel, ID_SLIDER, 5, 1, 10,
+        wxDefaultPosition, wxSize(200, -1), wxSL_HORIZONTAL | wxSL_AUTOTICKS);
+
+    // component layout
+    wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
+    sizer->Add(new wxStaticLine(panel, -1), 0, wxGROW | wxCENTRE);
+    sizer->Add(m_canvas, 1, wxGROW | wxCENTRE | wxALL, 5);
+    sizer->Add(new wxStaticLine(panel, -1), 0, wxGROW | wxCENTRE);
+    sizer->Add(m_text, 0, wxCENTRE | wxTOP, 5);
+    sizer->Add(slider, 0, wxCENTRE | wxALL, 5);
+    panel->SetSizer(sizer);
+    panel->SetAutoLayout(TRUE);
+    sizer->Fit(this);
+    sizer->SetSizeHints(this);
+}
+
+LifeFrame::~LifeFrame()
+{
+    delete m_timer;
+    delete m_life;
+}
+
+void LifeFrame::UpdateInfoText()
+{
+    wxString msg;
+
+    msg.Printf(_("Generation: %u,  Interval: %u ms"), m_tics, m_interval);
+    m_text->SetLabel(msg);
+}
+
+// event handlers
+void LifeFrame::OnMenu(wxCommandEvent& event)
+{
+    switch (event.GetId())
+    {
+        case ID_START   : OnStart(); break;
+        case ID_STEP    : OnTimer(); break;
+        case ID_STOP    : OnStop(); break;
+        case ID_WRAP    :
+        {
+            bool checked = GetMenuBar()->GetMenu(1)->IsChecked(ID_WRAP);
+            m_life->SetBorderWrap(checked);
+            break;
+        }
+        case ID_CLEAR   : 
+        {
+            OnStop();
+            m_life->Clear();
+            m_canvas->DrawEverything(TRUE);
+            m_canvas->Refresh(FALSE);
+            m_tics = 0;
+            UpdateInfoText();
+            break;
+        }
+        case ID_ABOUT :
+        {
+            wxMessageBox(
+                _("This is the about dialog of the Life! sample.\n"
+                  "(c) 2000 Guillermo Rodriguez Garcia"),
+                _("About Life!"),
+                wxOK | wxICON_INFORMATION,
+                this);
+            break;
+        }
+        case ID_EXIT :
+        {
+            // TRUE is to force the frame to close
+            Close(TRUE);
+            break;
+        }
+    }
+}
+
+void LifeFrame::OnNewGame(wxCommandEvent& WXUNUSED(event))
+{
+    int w = m_life->GetWidth();
+    int h = m_life->GetHeight();
+
+    // stop if it was running
+    OnStop();
+
+    // dialog box
+    LifeNewGameDialog dialog(this, &w, &h);
+
+    // new game?
+    if (dialog.ShowModal() == wxID_OK)
+    {
+        // check dimensions
+        if (w >= LIFE_MIN && w <= LIFE_MAX &&
+            h >= LIFE_MIN && h <= LIFE_MAX)
+        {
+            // resize game field
+            m_life->Destroy();
+            m_life->Create(w, h);
+            
+            // tell the canvas
+            m_canvas->Reset();
+            m_canvas->Refresh();
+            m_tics = 0;
+            UpdateInfoText();
+        }
+        else
+        {
+            wxString msg;
+            msg.Printf(_("Both dimensions must be within %u and %u.\n"),
+                LIFE_MIN, LIFE_MAX);
+            wxMessageBox(msg, _("Error!"), wxOK | wxICON_EXCLAMATION, this);
+        }
+    }
+}
+
+void LifeFrame::OnSamples(wxCommandEvent& WXUNUSED(event))
+{
+    // stop if it was running
+    OnStop();
+
+    // dialog box
+    LifeSamplesDialog dialog(this);
+
+    // new game?
+    if (dialog.ShowModal() == wxID_OK)
+    {
+        int result = dialog.GetValue();
+
+        if (result == -1)
+            return;
+
+        int gw   = g_shapes[result].m_fieldWidth;
+        int gh   = g_shapes[result].m_fieldHeight;
+        int wrap = g_shapes[result].m_wrap;
+
+        // set wraparound (don't ask the user)
+        m_life->SetBorderWrap(wrap);
+        GetMenuBar()->GetMenu(1)->Check(ID_WRAP, wrap);
+
+        // need to resize the game field?
+        if (gw > m_life->GetWidth() || gh > m_life->GetHeight())
+        {
+            wxString s;
+            s.Printf(_("Your game field is too small for this configuration.\n"
+                       "It is recommended to resize it to %u x %u. Proceed?\n"),
+                       gw, gh);
+
+            if (wxMessageBox(s, _("Question"), wxYES_NO | wxICON_QUESTION, this) == wxYES)
+            {
+                m_life->Destroy();
+                m_life->Create(gw, gh);
+            }
+        }
+
+        // put the shape
+        m_life->SetShape(g_shapes[result]);
+
+        // tell the canvas about the change
+        m_canvas->Reset();
+        m_canvas->Refresh();
+        m_tics = 0;
+        UpdateInfoText();
+    }
+}
+
+void LifeFrame::OnStart()
+{
+    if (!m_running)
+    {
+        GetToolBar()->EnableTool(ID_START, FALSE);
+        GetToolBar()->EnableTool(ID_STOP,  TRUE);
+        GetMenuBar()->GetMenu(1)->Enable(ID_START, FALSE);
+        GetMenuBar()->GetMenu(1)->Enable(ID_STEP,  FALSE);
+        GetMenuBar()->GetMenu(1)->Enable(ID_STOP,  TRUE);
+
+        m_timer->Start(m_interval);
+        m_running = TRUE;
+    }
+}
+
+void LifeFrame::OnStop()
+{
+    if (m_running)
+    {
+        GetToolBar()->EnableTool(ID_START, TRUE);
+        GetToolBar()->EnableTool(ID_STOP,  FALSE);
+        GetMenuBar()->GetMenu(1)->Enable(ID_START, TRUE);
+        GetMenuBar()->GetMenu(1)->Enable(ID_STEP,  TRUE);
+        GetMenuBar()->GetMenu(1)->Enable(ID_STOP,  FALSE);
+        
+        m_timer->Stop();
+        m_running = FALSE;
+    }
+}
+
+void LifeFrame::OnTimer()
+{
+    if (m_life->NextTic())
+        m_tics++;
+    else
+        OnStop();
+
+    UpdateInfoText();
+    m_canvas->DrawEverything();
+    m_canvas->Refresh(FALSE);
+}
+
+void LifeFrame::OnSlider(wxScrollEvent& event)
+{
+    m_interval = event.GetPosition() * 100;
+
+    // restart timer if running, to set the new interval
+    if (m_running)
+    {
+        m_timer->Stop();
+        m_timer->Start(m_interval);
+    }
+
+    UpdateInfoText();
+}
+
+// --------------------------------------------------------------------------
+// LifeTimer
+// --------------------------------------------------------------------------
+
+void LifeTimer::Notify()
+{
+    GET_FRAME()->OnTimer();
+};
+
+// --------------------------------------------------------------------------
+// LifeCanvas
+// --------------------------------------------------------------------------
+
+// canvas constructor
+LifeCanvas::LifeCanvas(wxWindow *parent, Life *life, bool interactive)
+          : wxScrolledWindow(parent, -1, wxPoint(0, 0), wxSize(100, 100))
+{
+    m_life        = life;
+    m_interactive = interactive;
+    m_cellsize    = 8;
+    m_bmp         = NULL;
+    Reset();
+}
+
+LifeCanvas::~LifeCanvas()
+{
+    delete m_bmp;
+}
+
+void LifeCanvas::Reset()
+{
+    if (m_bmp)
+        delete m_bmp;
+
+    m_status   = MOUSE_NOACTION;
+    m_width    = CellToCoord(m_life->GetWidth()) + 1;
+    m_height   = CellToCoord(m_life->GetHeight()) + 1;
+    m_bmp      = new wxBitmap(m_width, m_height);
+    wxCoord w  = GetClientSize().GetX();
+    wxCoord h  = GetClientSize().GetY();
+    m_xoffset  = (w > m_width)?  ((w - m_width) / 2)  : 0;
+    m_yoffset  = (h > m_height)? ((h - m_height) / 2) : 0;
+
+    // redraw everything
+    DrawEverything(TRUE);
+    SetScrollbars(10, 10, (m_width + 9) / 10, (m_height + 9) / 10);
+}
+
+void LifeCanvas::DrawEverything(bool force)
+{
+    wxMemoryDC dc;
+
+    dc.SelectObject(*m_bmp);
+    dc.BeginDrawing();
+
+    // draw cells
+    for (int j = 0; j < m_life->GetHeight(); j++)
+        for (int i = 0; i < m_life->GetWidth(); i++)
+            if (force || m_life->HasChanged(i, j))
+                DrawCell(i, j, dc);
+
+    // bounding rectangle (always drawn - better than clipping region)
+    dc.SetPen(*wxBLACK_PEN);
+    dc.SetBrush(*wxTRANSPARENT_BRUSH);
+    dc.DrawRectangle(0, 0, m_width, m_height);
+
+    dc.EndDrawing();
+    dc.SelectObject(wxNullBitmap);
+}
+
+void LifeCanvas::DrawCell(int i, int j)
+{
+    wxMemoryDC dc;
+
+    dc.SelectObject(*m_bmp);
+    dc.BeginDrawing();
+
+    dc.SetClippingRegion(1, 1, m_width - 2, m_height - 2);
+    DrawCell(i, j, dc);
+
+    dc.EndDrawing();
+    dc.SelectObject(wxNullBitmap);
+}
+
+void LifeCanvas::DrawCell(int i, int j, wxDC &dc)
+{
+    if (m_life->IsAlive(i, j))
+    {
+        dc.SetPen(*wxBLACK_PEN);
+        dc.SetBrush(*wxBLACK_BRUSH);
+        dc.DrawRectangle(CellToCoord(i),
+                         CellToCoord(j),
+                         m_cellsize,
+                         m_cellsize);
+    }
+    else
+    {
+        dc.SetPen(*wxLIGHT_GREY_PEN);
+        dc.SetBrush(*wxTRANSPARENT_BRUSH);
+        dc.DrawRectangle(CellToCoord(i),
+                         CellToCoord(j),
+                         m_cellsize,
+                         m_cellsize);
+        dc.SetPen(*wxWHITE_PEN);
+        dc.SetBrush(*wxWHITE_BRUSH);
+        dc.DrawRectangle(CellToCoord(i) + 1,
+                         CellToCoord(j) + 1,
+                         m_cellsize - 1,
+                         m_cellsize - 1);
+    }
+}
+
+// event handlers
+void LifeCanvas::OnPaint(wxPaintEvent& event)
+{
+    wxPaintDC dc(this);
+    wxMemoryDC memdc;
+
+    wxRegionIterator upd(GetUpdateRegion());
+    wxCoord x, y, w, h, xx, yy;
+
+    dc.BeginDrawing();
+    memdc.SelectObject(*m_bmp);
+
+    while(upd)
+    {
+        x = upd.GetX();
+        y = upd.GetY();
+        w = upd.GetW();
+        h = upd.GetH();
+        CalcUnscrolledPosition(x, y, &xx, &yy);
+
+        dc.Blit(x, y, w, h, &memdc, xx - m_xoffset, yy - m_yoffset);
+        upd++;
+    }
+
+    memdc.SelectObject(wxNullBitmap);
+    dc.EndDrawing();
+}
+
+void LifeCanvas::OnMouse(wxMouseEvent& event)
+{
+    if (!m_interactive)
+        return;
+
+    int x, y, xx, yy, i, j;
+
+    // which cell are we pointing at?
+    x = event.GetX();
+    y = event.GetY();
+    CalcUnscrolledPosition(x, y, &xx, &yy);
+    i = CoordToCell( xx - m_xoffset );
+    j = CoordToCell( yy - m_yoffset );
+
+    // adjust x, y to point to the upper left corner of the cell
+    CalcScrolledPosition( CellToCoord(i) + m_xoffset,
+                          CellToCoord(j) + m_yoffset,
+                          &x, &y );
+
+    // set cursor shape and statusbar text
+    if (i < 0 || i >= m_life->GetWidth() ||
+        j < 0 || j >= m_life->GetHeight())
+    {
+        GET_FRAME()->SetStatusText(wxEmptyString, 1);
+        SetCursor(*wxSTANDARD_CURSOR);
+    }
+    else
+    {
+        wxString msg;
+        msg.Printf(_("Cell: (%u, %u)"), i, j);
+        GET_FRAME()->SetStatusText(msg, 1);
+        SetCursor(*wxCROSS_CURSOR);
+    }
+
+    // button pressed?
+    if (!event.LeftIsDown())
+    {
+        m_status = MOUSE_NOACTION;
+    }
+    else if (i >= 0 && i < m_life->GetWidth() &&
+             j >= 0 && j < m_life->GetHeight())
+    {
+        bool alive = m_life->IsAlive(i, j);
+
+        // if just pressed, update status
+        if (m_status == MOUSE_NOACTION)
+            m_status = (alive? MOUSE_ERASING : MOUSE_DRAWING);
+
+        // toggle cell and refresh if needed
+        if (((m_status == MOUSE_ERASING) && alive) ||
+            ((m_status == MOUSE_DRAWING) && !alive))
+        {
+            wxRect rect(x, y, m_cellsize + 1, m_cellsize + 1);
+            m_life->SetCell(i, j, !alive);
+            DrawCell(i, j);
+            Refresh(FALSE, &rect);
+        }
+    }
+}
+
+void LifeCanvas::OnSize(wxSizeEvent& event)
+{
+    wxCoord w = event.GetSize().GetX();
+    wxCoord h = event.GetSize().GetY();
+    m_xoffset = (w > m_width)?  ((w - m_width) / 2)  : 0;
+    m_yoffset = (h > m_height)? ((h - m_height) / 2) : 0;
+
+    // allow default processing
+    event.Skip();
+}
+
+// --------------------------------------------------------------------------
+// LifeNewGameDialog
+// --------------------------------------------------------------------------
+
+LifeNewGameDialog::LifeNewGameDialog(wxWindow *parent, int *w, int *h)
+                 : wxDialog(parent, -1,
+                            _("New game"),
+                            wxDefaultPosition,
+                            wxDefaultSize,
+                            wxDEFAULT_DIALOG_STYLE | wxDIALOG_MODAL)
+{
+    m_w = w;
+    m_h = h;
+
+    // spin ctrls
+    m_spinctrlw = new wxSpinCtrl( this, -1 );
+    m_spinctrlw->SetValue(*m_w);
+    m_spinctrlw->SetRange(LIFE_MIN, LIFE_MAX);
+
+    m_spinctrlh = new wxSpinCtrl( this, -1 );
+    m_spinctrlh->SetValue(*m_h);
+    m_spinctrlh->SetRange(LIFE_MIN, LIFE_MAX);
+
+    // component layout
+    wxBoxSizer *inputsizer1 = new wxBoxSizer( wxHORIZONTAL );
+    inputsizer1->Add( new wxStaticText(this, -1, _("Width")), 1, wxCENTRE | wxLEFT, 20);
+    inputsizer1->Add( m_spinctrlw, 2, wxCENTRE | wxLEFT | wxRIGHT, 20 );
+
+    wxBoxSizer *inputsizer2 = new wxBoxSizer( wxHORIZONTAL );
+    inputsizer2->Add( new wxStaticText(this, -1, _("Height")), 1, wxCENTRE | wxLEFT, 20);
+    inputsizer2->Add( m_spinctrlh, 2, wxCENTRE | wxLEFT | wxRIGHT, 20 );
+
+    wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
+    topsizer->Add( CreateTextSizer(_("Enter board dimensions")), 0, wxALL, 10 );
+    topsizer->Add( new wxStaticLine(this, -1), 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 10);
+    topsizer->Add( inputsizer1, 1, wxGROW | wxLEFT | wxRIGHT, 5 );
+    topsizer->Add( inputsizer2, 1, wxGROW | wxLEFT | wxRIGHT, 5 );
+    topsizer->Add( new wxStaticLine(this, -1), 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 10);
+    topsizer->Add( CreateButtonSizer(wxOK | wxCANCEL), 0, wxCENTRE | wxALL, 10);
+
+    // activate
+    SetSizer(topsizer);
+    SetAutoLayout(TRUE);
+    topsizer->SetSizeHints(this);
+    topsizer->Fit(this);
+    Centre(wxBOTH);
+}
+
+void LifeNewGameDialog::OnOK(wxCommandEvent& WXUNUSED(event))
+{
+    *m_w = m_spinctrlw->GetValue();
+    *m_h = m_spinctrlh->GetValue();
+
+    EndModal(wxID_OK);
+}
+
+// --------------------------------------------------------------------------
+// LifeSamplesDialog
+// --------------------------------------------------------------------------
+
+LifeSamplesDialog::LifeSamplesDialog(wxWindow *parent)
+                 : wxDialog(parent, -1,
+                            _("Sample games"),
+                            wxDefaultPosition,
+                            wxDefaultSize,
+                            wxDEFAULT_DIALOG_STYLE | wxDIALOG_MODAL)
+{
+    m_value = 0;
+   
+    // create and populate the list of available samples
+    m_list = new wxListBox( this, ID_LISTBOX,
+        wxDefaultPosition,
+        wxDefaultSize,
+        0, NULL,
+        wxLB_SINGLE | wxLB_NEEDED_SB | wxLB_HSCROLL );
+
+    for (unsigned i = 0; i < (sizeof(g_shapes) / sizeof(LifeShape)); i++)
+        m_list->Append(g_shapes[i].m_name);
+
+    // descriptions
+    wxStaticBox *statbox = new wxStaticBox( this, -1, _("Description"));
+    m_life   = new Life( 16, 16 );
+    m_life->SetShape(g_shapes[0]);
+    m_canvas = new LifeCanvas( this, m_life, FALSE );
+    m_text   = new wxTextCtrl( this, -1,
+        g_shapes[0].m_desc,
+        wxDefaultPosition,
+        wxSize(300, 60),
+        wxTE_MULTILINE | wxTE_READONLY);
+
+    // layout components
+    wxStaticBoxSizer *sizer1 = new wxStaticBoxSizer( statbox, wxVERTICAL );
+    sizer1->Add( m_canvas, 2, wxGROW | wxCENTRE | wxALL, 5);
+    sizer1->Add( m_text, 1, wxGROW | wxCENTRE | wxALL, 5 );
+
+    wxBoxSizer *sizer2 = new wxBoxSizer( wxHORIZONTAL );
+    sizer2->Add( m_list, 0, wxGROW | wxCENTRE | wxALL, 5 );
+    sizer2->Add( sizer1, 1, wxGROW | wxCENTRE | wxALL, 5 );
+
+    wxBoxSizer *sizer3 = new wxBoxSizer( wxVERTICAL );
+    sizer3->Add( CreateTextSizer(_("Select one configuration")), 0, wxALL, 10 );
+    sizer3->Add( new wxStaticLine(this, -1), 0, wxGROW | wxLEFT | wxRIGHT, 10 );
+    sizer3->Add( sizer2, 1, wxGROW | wxCENTRE | wxALL, 5 );
+    sizer3->Add( new wxStaticLine(this, -1), 0, wxGROW | wxLEFT | wxRIGHT, 10 );
+    sizer3->Add( CreateButtonSizer(wxOK | wxCANCEL), 0, wxCENTRE | wxALL, 10 );
+
+    // activate
+    SetSizer(sizer3);
+    SetAutoLayout(TRUE);
+    sizer3->SetSizeHints(this);
+    sizer3->Fit(this);
+    Centre(wxBOTH);
+}
+
+LifeSamplesDialog::~LifeSamplesDialog()
+{
+    m_canvas->Destroy();
+    delete m_life;
+}
+
+int LifeSamplesDialog::GetValue()
+{
+    return m_value;
+}
+
+void LifeSamplesDialog::OnListBox(wxCommandEvent& event)
+{
+    if (event.GetSelection() != -1)
+    {
+        m_value = m_list->GetSelection();
+        m_text->SetValue(g_shapes[ event.GetSelection() ].m_desc);
+        m_life->SetShape(g_shapes[ event.GetSelection() ]);
+
+        m_canvas->DrawEverything(TRUE);     // force redraw everything
+        m_canvas->Refresh(FALSE);           // do not erase background
+    }
+}
+
+// --------------------------------------------------------------------------
+// Life
+// --------------------------------------------------------------------------
+
+Life::Life(int width, int height)
+{            
+    m_wrap   = TRUE;
+    m_cells  = NULL;
+    Create(width, height);
+}
+
+Life::~Life()
+{
+    Destroy();
+}
+
+void Life::Create(int width, int height)
+{
+    wxASSERT(width > 0 && height > 0);
+
+    m_width  = width;
+    m_height = height;
+    m_cells  = new Cell[m_width * m_height];
+    Clear();
+}
+
+void Life::Destroy()
+{
+    delete[] m_cells;
+}
+
+void Life::Clear()
+{
+    for (int i = 0; i < m_width * m_height; i++)
+        m_cells[i] = CELL_DEAD;
+}
+
+bool Life::IsAlive(int x, int y) const
+{
+    wxASSERT(x >= 0 && y >= 0 && x < m_width && y < m_height);
+
+    return (m_cells[y * m_width + x] & CELL_ALIVE);
+}
+
+bool Life::HasChanged(int x, int y) const
+{
+    wxASSERT(x >= 0 && y >= 0 && x < m_width && y < m_height);
+
+    return (m_cells[y * m_width + x] & CELL_MARK) != 0;
+}
+
+void Life::SetBorderWrap(bool on)
+{
+    m_wrap = on;
+}
+
+void Life::SetCell(int x, int y, bool alive)
+{
+    wxASSERT(x >= 0 && y >= 0 && x < m_width && y < m_height);
+
+    m_cells[y * m_width + x] = (alive? CELL_ALIVE : CELL_DEAD);
+}
+
+void Life::SetShape(LifeShape& shape)
+{
+    wxASSERT((m_width >= shape.m_width) && (m_height >= shape.m_height));
+
+    int x0  = (m_width - shape.m_width) / 2;
+    int y0  = (m_height - shape.m_height) / 2;
+    char *p = shape.m_data;
+
+    Clear();
+    for (int j = y0; j < y0 + shape.m_height; j++)
+        for (int i = x0; i < x0 + shape.m_width; i++)
+            SetCell(i, j, *(p++) == '*');
+}
+
+bool Life::NextTic()
+{
+    long changed = 0;
+    int  i, j;
+
+    /* 1st pass. Find and mark deaths and births for this generation.
+     *
+     * Rules:
+     *   An organism with <= 1 neighbors will die due to isolation.
+     *   An organism with >= 4 neighbors will die due to starvation.
+     *   New organisms are born in cells with exactly 3 neighbors.
+     */
+    for (j = 0; j < m_height; j++)
+        for (i = 0; i < m_width; i++)
+        {
+            int neighbors = GetNeighbors(i, j);
+            bool alive    = IsAlive(i, j);
+
+            /* Set CELL_MARK if this cell must change, clear it
+             * otherwise. We cannot toggle the CELL_ALIVE bit yet
+             * because all deaths and births are simultaneous (it
+             * would affect neighbouring cells).
+             */
+            if ((!alive && neighbors == 3) ||
+                (alive && (neighbors <= 1 || neighbors >= 4)))
+                m_cells[j * m_width + i] |= CELL_MARK;
+            else
+                m_cells[j * m_width + i] &= ~CELL_MARK;
+        }
+
+    /* 2nd pass. Stabilize.
+     */
+    for (j = 0; j < m_height; j++)
+        for (i = 0; i < m_width; i++)
+        {
+            /* Toggle CELL_ALIVE for those cells marked in the
+             * previous pass. Do not clear the CELL_MARK bit yet;
+             * it is useful to know which cells have changed and
+             * thus must be updated in the screen.
+             */
+            if (m_cells[j * m_width + i] & CELL_MARK)
+            {
+                m_cells[j * m_width + i] ^= CELL_ALIVE;
+                changed++;
+            }
+        }
+
+    return (changed != 0);
+}
+
+int Life::GetNeighbors(int x, int y) const
+{
+    wxASSERT(x >= 0 && y >= 0 && x < m_width && y < m_height);
+
+    int neighbors = 0;
+
+    int i0 = (x)? (x - 1) : 0;
+    int j0 = (y)? (y - 1) : 0;
+    int i1 = (x < (m_width - 1))? (x + 1) : (m_width - 1);
+    int j1 = (y < (m_height - 1))? (y + 1) : (m_height - 1);
+
+    if (m_wrap && ( !x || !y || x == (m_width - 1) || y == (m_height - 1)))
+    {
+        // this is an outer cell and wraparound is on
+        for (int j = y - 1; j <= y + 1; j++)
+            for (int i = x - 1; i <= x + 1; i++)
+                if (IsAlive( ((i < 0)? (i + m_width ) : (i % m_width)),
+                             ((j < 0)? (j + m_height) : (j % m_height)) ))
+                     neighbors++;
+    }
+    else
+    {
+        // this is an inner cell, or wraparound is off
+        for (int j = j0; j <= j1; j++)
+            for (int i = i0; i <= i1; i++)
+                if (IsAlive(i, j))
+                     neighbors++;
+    }
+
+    // do not count ourselves
+    if (IsAlive(x, y)) neighbors--;
+
+    return neighbors;
+}
+
+void Life::SetCell(int x, int y, Cell status)
+{
+    wxASSERT(x >= 0 && y >= 0 && x < m_width && y < m_height);
+
+    m_cells[y * m_width + x] = status;
+}
+
diff --git a/demos/life/life.def b/demos/life/life.def
new file mode 100644 (file)
index 0000000..5f7709f
--- /dev/null
@@ -0,0 +1,7 @@
+NAME         Life
+DESCRIPTION  'Life! wxWindows application'
+EXETYPE      WINDOWS
+CODE         PRELOAD MOVEABLE DISCARDABLE
+DATA         PRELOAD MOVEABLE MULTIPLE
+HEAPSIZE     4048
+STACKSIZE    16000
diff --git a/demos/life/life.rc b/demos/life/life.rc
new file mode 100644 (file)
index 0000000..96782b2
--- /dev/null
@@ -0,0 +1,6 @@
+mondrian ICON "mondrian.ico"
+#include "wx/msw/wx.rc"
+
+reset BITMAP "bitmaps/reset.bmp"
+play  BITMAP "bitmaps/play.bmp"
+stop  BITMAP "bitmaps/stop.bmp"
diff --git a/demos/life/makefile.b32 b/demos/life/makefile.b32
new file mode 100644 (file)
index 0000000..22869de
--- /dev/null
@@ -0,0 +1,16 @@
+#
+# File:                makefile.b32
+# Author:      Julian Smart
+# Created:     1999
+# Updated:     
+# Copyright:
+#
+# Makefile : Builds sample for 32-bit BC++
+
+WXDIR = $(WXWIN)
+
+TARGET=life
+OBJECTS = $(TARGET).obj
+
+!include $(WXDIR)\src\makeprog.b32
+
diff --git a/demos/life/makefile.bcc b/demos/life/makefile.bcc
new file mode 100644 (file)
index 0000000..2b70fcf
--- /dev/null
@@ -0,0 +1,19 @@
+#
+# File:                makefile.bcc
+# Author:      Julian Smart
+# Created:     1998
+# Updated:     
+#
+# Builds a BC++ 16-bit sample
+
+!if "$(WXWIN)" == ""
+!error You must define the WXWIN variable in autoexec.bat, e.g. WXWIN=c:\wx
+!endif
+
+WXDIR = $(WXWIN)
+
+TARGET=life
+OBJECTS=$(TARGET).obj
+
+!include $(WXDIR)\src\makeprog.bcc
+
diff --git a/demos/life/makefile.dos b/demos/life/makefile.dos
new file mode 100644 (file)
index 0000000..6d66090
--- /dev/null
@@ -0,0 +1,17 @@
+#
+# File:                makefile.dos
+# Author:      Julian Smart
+# Created:     1998
+# Updated:     
+#
+# Makefile : Builds 16-bit sample, VC++ 1.5
+# Use FINAL=1 argument to nmake to build final version with no debugging
+# info
+
+WXDIR = $(WXWIN)
+
+TARGET=life
+OBJECTS = $(TARGET).obj
+
+!include $(WXDIR)\src\makeprog.msc
+
diff --git a/demos/life/makefile.g95 b/demos/life/makefile.g95
new file mode 100644 (file)
index 0000000..9091712
--- /dev/null
@@ -0,0 +1,16 @@
+#
+# File:         makefile.g95
+# Author:       Julian Smart
+# Created:      1999
+# Updated:
+# Copyright:    (c) Julian Smart, 1999
+#
+# Makefile for wxWindows sample (Cygwin/Mingw32).
+
+WXDIR = ../..
+
+TARGET=life
+OBJECTS = $(TARGET).o
+
+include $(WXDIR)/src/makeprog.g95
+
diff --git a/demos/life/makefile.unx b/demos/life/makefile.unx
new file mode 100644 (file)
index 0000000..c903648
--- /dev/null
@@ -0,0 +1,35 @@
+#
+# File:                Makefile for samples
+# Author:      Robert Roebling
+# Created:     1999
+# Updated:     
+# Copyright:   (c) 1998 Robert Roebling
+#
+# This makefile requires a Unix version of wxWindows
+# to be installed on your system. This is most often
+# done typing "make install" when using the complete
+# sources of wxWindows or by installing the two
+# RPM packages wxGTK.XXX.rpm and wxGTK-devel.XXX.rpm
+# under Linux.
+#
+
+CC = gcc
+
+PROGRAM = life
+
+OBJECTS = $(PROGRAM).o
+
+# implementation
+
+.SUFFIXES:     .o .cpp
+
+.cpp.o :
+       $(CC) -c `wx-config --cflags` -o $@ $<
+
+all:    $(PROGRAM)
+
+$(PROGRAM):    $(OBJECTS)
+       $(CC) -o $(PROGRAM) $(OBJECTS) `wx-config --libs`
+
+clean: 
+       rm -f *.o $(PROGRAM)
diff --git a/demos/life/makefile.vc b/demos/life/makefile.vc
new file mode 100644 (file)
index 0000000..2e9f094
--- /dev/null
@@ -0,0 +1,18 @@
+#
+# File:                makefile.vc
+# Author:      Julian Smart
+# Created:     1999
+# Updated:     
+# Copyright:   (c) Julian Smart
+#
+# Makefile : Builds sample (VC++, WIN32)
+# Use FINAL=1 argument to nmake to build final version with no debug info.
+
+# Set WXDIR for your system
+WXDIR = $(WXWIN)
+
+PROGRAM=life
+OBJECTS = $(PROGRAM).obj
+
+!include $(WXDIR)\src\makeprog.vc
+
diff --git a/demos/life/makefile.wat b/demos/life/makefile.wat
new file mode 100644 (file)
index 0000000..b959230
--- /dev/null
@@ -0,0 +1,15 @@
+#
+# Makefile for WATCOM
+#
+# Created by Julian Smart, January 1999
+# 
+#
+
+WXDIR = $(%WXWIN)
+
+PROGRAM = life
+OBJECTS = $(PROGRAM).obj
+
+!include $(WXDIR)\src\makeprog.wat
+
+
diff --git a/demos/life/mondrian.ico b/demos/life/mondrian.ico
new file mode 100644 (file)
index 0000000..2310c5d
Binary files /dev/null and b/demos/life/mondrian.ico differ
diff --git a/demos/life/mondrian.xpm b/demos/life/mondrian.xpm
new file mode 100644 (file)
index 0000000..409f27a
--- /dev/null
@@ -0,0 +1,44 @@
+/* XPM */
+static char *mondrian_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"32 32 6 1",
+"  c Black",
+". c Blue",
+"X c #00bf00",
+"o c Red",
+"O c Yellow",
+"+ c Gray100",
+/* pixels */
+"                                ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+"                                ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++      ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++                    ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+"                                "
+};
diff --git a/demos/life/samples.inc b/demos/life/samples.inc
new file mode 100644 (file)
index 0000000..d218418
--- /dev/null
@@ -0,0 +1,157 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        samples.inc
+// Purpose:     Sample configurations for Life!
+// Author:      Guillermo Rodriguez Garcia, <guille@iies.es>
+// Modified by:
+// Created:     Jan/2000
+// RCS-ID:      $Id$
+// Copyright:   (c) 2000, Guillermo Rodriguez Garcia
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// --------------------------------------------------------------------------
+// sample configurations
+// --------------------------------------------------------------------------
+
+/* Format:
+ *
+ * Name,
+ * Description,
+ * Width, Height,
+ * Data,                        ('*' = alive, '.' = dead)
+ * Field width, Field height,   (optional, defaults to 20 x 20)
+ * Wraparound                   (optional, defaults to TRUE)
+ * 
+ */
+
+LifeShape g_shapes[] =
+{
+    LifeShape( _("Glider"),
+               _("The glider is the first of a series of life forms, known "
+                 "as spaceships or fishes, which can travel along the game "
+                 "field retaining their original shape."),
+               3, 3,
+               ".*."
+               "..*"
+               "***"),
+    LifeShape( _("Heavyweight spaceship"),
+               _("The glider is just the smaller of the spaceships; this "
+                 "one, known as the heavyweight spaceship or 'big fish', "
+                 "is the largest spaceship which can travel alone without "
+                 "destroying itself. Larger ones can only travel safely "
+                 "if they are supported by smaller spaceships."),
+               7, 4,
+               ".....*."
+               "......*"
+               "*.....*"
+               ".******"),
+    LifeShape( _("Eater"),
+               _("An eater is any still life that can repair itself from "
+                 "some attacks. This one (bottom right), also known as "
+                 "'fishhook', eats gliders and fishes (spaceships) provided "
+                 "that they approach in a certain angle."),
+               10, 10,
+               ".*........"
+               "..*......."
+               "***......."
+               ".........."
+               ".........."
+               ".........."
+               "......**.."
+               "......*.*."
+               "........*."
+               "........**" ),
+    LifeShape( _("Dice shaker"),
+               _("Oscillators have been extensively explored in Life!. "
+                 "The dice shaker turns around each seven tics; thus, it "
+                 "is an oscillator with a period of fourteen."),
+               7, 6,
+               ".**.**."
+               ".**.**."
+               "..*.*.."
+               "*.*.*.*"
+               "*.*.*.*"
+               "**...**" ),
+    LifeShape( _("Hertz oscillator"),
+               _("The Hertz oscillator is a good example of a set of life "
+                 "patterns known as 'billiard tables'. A billiard table is "
+                 "an oscillator which is built inside a stable border. In "
+                 "particular, this one has a period of eight."),
+               14, 11,
+               ".....**......."
+               ".....**......."
+               ".............."
+               "**...****...**"
+               "*.*.*....*.*.*"
+               "..*.**...*.*.."
+               "*.*.*....*.*.*"
+               "**...****...**"
+               ".............."
+               ".......**....."
+               ".......**....." ),
+    LifeShape( _("Phoenix"),
+               _("A phoenix is a pattern whose cells all die in every "
+                 "generation, and yet lives forever. For example, this is "
+                 "a phoenix with period two."),
+               8, 8,
+               "....*..."
+               "..*.*..."
+               "......*."
+               "**......"
+               "......**"
+               ".*......"
+               "...*.*.."
+               "...*...." ),
+    LifeShape( _("R-pentomino"),
+               _("The R-pentomino is a methuselah - a life form which "
+                 "lives for hundreds of generations without stabilizing "
+                 "or dying. In particular, the R-Pentomino requires more "
+                 "than one thousand tics to reach a stable (periodic) "
+                 "state."),
+               3, 3,
+               ".**"
+               "**."
+               ".*.",
+               80, 80, FALSE ),
+    LifeShape( _("Thunderbird"),
+               _("The thunderbird is another popular methuselah, which "
+                 "doesn't stabilize until the 243th generation. Note that "
+                 "because the initial configuration is symmetrical with "
+                 "respect to the vertical axis, all generations must be "
+                 "symmetrical as well."),
+               3, 5,
+               "***"
+               "..."
+               ".*."
+               ".*."
+               ".*.",
+               60, 60, FALSE ),
+    LifeShape( _("Accorn"),
+               _("Probably the most popular methuselah, the accorn lives "
+                 "for 5206 (!) generations. To see it in action, a very "
+                 "large game field is needed."),
+               7, 3,
+               ".*....."
+               "...*..."
+               "**..***",
+               150, 150, FALSE ),
+    LifeShape( _("Galaxy"),
+               _("One from my personal collection. It is really beautiful "
+                 "to see this configuration expand and shrink periodically "
+                 "for hundreds of tics before reaching a stable state."),
+               13, 13,
+               "...***......."
+               "......*......"
+               "......*......"
+               "......*.....*"
+               ".....***....*"
+               "....*   *...*"
+               ".****   ****."
+               "*...*   *...."
+               "*....***....."
+               "*.....*......"
+               "......*......"
+               "......*......"
+               ".......***...",
+               80, 80, FALSE )
+};
diff --git a/demos/poem/.cvsignore b/demos/poem/.cvsignore
new file mode 100644 (file)
index 0000000..8b13789
--- /dev/null
@@ -0,0 +1 @@
+
diff --git a/demos/poem/Makefile.in b/demos/poem/Makefile.in
new file mode 100644 (file)
index 0000000..eed4736
--- /dev/null
@@ -0,0 +1,23 @@
+#
+# File:                makefile.unx
+# Author:      Julian Smart
+# Created:     1998
+# Updated:     
+# Copyright:   (c) 1998 Julian Smart
+#
+# "%W% %G%"
+#
+# Makefile for wxPoem example (UNIX).
+
+top_srcdir = @top_srcdir@
+top_builddir = ../..
+program_dir = samples/wxpoem
+
+DATAFILES = wxpoem.txt wxpoem.dat
+
+PROGRAM=wxpoem
+
+OBJECTS=$(PROGRAM).o
+
+include ../../src/makeprog.env
+
diff --git a/demos/poem/corner1.ico b/demos/poem/corner1.ico
new file mode 100644 (file)
index 0000000..35de002
Binary files /dev/null and b/demos/poem/corner1.ico differ
diff --git a/demos/poem/corner1.xpm b/demos/poem/corner1.xpm
new file mode 100644 (file)
index 0000000..97037e0
--- /dev/null
@@ -0,0 +1,42 @@
+/* XPM */
+static char * corner1_xpm[] = {
+/* width height ncolors chars_per_pixel */
+"32 32 4 1",
+/* colors */
+"      s None  c None",
+".     c #000000",
+"+     c #808080",
+"@     c #c0c0c0",
+/* pixels */
+"............................    ",
+"...++..++++++++++++++++++....   ",
+".+..++...@@@@@@@+++++++++++...  ",
+".@+..+++...@@@@@@@@@@++++++++.. ",
+".@++..@+++...@@@@@@@@@@@@+++++. ",
+"..@++..@++++...@@@@@@@@@@@@+++..",
+"..@@++..@@++++...@@@@@@@@@@@+++.",
+".+.@@++..@@@++++...@@@@@@@@@@++.",
+".+.@@+++..@@@@++++...@@@@@@@@@+.",
+".++.@@+++..@@@@@+++++...@@@@@@..",
+".++..@@+++..@@@@@@+++++...@@@.. ",
+".@++.@@@+++..@@@@@@@+++++...... ",
+".@++..@@@+++..@@@@@@@@+++++...  ",
+".@+++.@@@++++..@@@@@@@@@+++++.. ",
+".@@++..@@@++++..@@@@@@@@@+++++. ",
+".@@+++.@@@@++++..@@@@@@@@@@+++..",
+".@@@++..@@@@++++..@@@@@@@@@@+++.",
+".@@@+++.@@@@@++++..@@@@@@@@@@++.",
+".@@@@++..@@@@@++++..@@@@@@@@@@+.",
+".@@@@+++..@@@@+++++..@@@@@@@@@+.",
+".@@@@++++.@@@@@+++++..@@@@@@@@. ",
+".@@@@@+++..@@@@@+++++..@@@@@@@. ",
+".@@@@@++++.@@@@@@+++++..@@@@@.  ",
+".@@@@@@+++..@@@@@@+++++..@@..   ",
+".@@@@@@++++.@@@@@@++++++...     ",
+".@@@@@@@+++..@@@@@@++++++.      ",
+".@@@@@@@++++..@@@@@@+++++.      ",
+".@@@@@@@@++++.@@@@@@@+++.       ",
+"..@@@@@@@++++..@@@@@++++.       ",
+" ..@@@@@++++++.@@@@+++..        ",
+"   ..++++++++....+++..          ",
+"     ........   ....            "};
diff --git a/demos/poem/corner2.ico b/demos/poem/corner2.ico
new file mode 100644 (file)
index 0000000..a1d58d8
Binary files /dev/null and b/demos/poem/corner2.ico differ
diff --git a/demos/poem/corner2.xpm b/demos/poem/corner2.xpm
new file mode 100644 (file)
index 0000000..ba1b120
--- /dev/null
@@ -0,0 +1,42 @@
+/* XPM */
+static char * corner2_xpm[] = {
+/* width height ncolors chars_per_pixel */
+"32 32 4 1",
+/* colors */
+"      s None  c None",
+".     c #000000",
+"+     c #c0c0c0",
+"@     c #808080",
+/* pixels */
+"    ............................",
+"   ....++++++++++++++++++..++...",
+"  ...+++++++++++@@@@@@@...++..+.",
+" ..++++++++@@@@@@@@@@...+++..+@.",
+" .+++++@@@@@@@@@@@@...+++@..++@.",
+"..+++@@@@@@@@@@@@...++++@..++@..",
+".+++@@@@@@@@@@@...++++@@..++@@..",
+".++@@@@@@@@@@...++++@@@..++@@.+.",
+".+@@@@@@@@@...++++@@@@..+++@@.+.",
+"..@@@@@@...+++++@@@@@..+++@@.++.",
+" ..@@@...+++++@@@@@@..+++@@..++.",
+" ......+++++@@@@@@@..+++@@@.++@.",
+"  ...+++++@@@@@@@@..+++@@@..++@.",
+" ..+++++@@@@@@@@@..++++@@@.+++@.",
+" .+++++@@@@@@@@@..++++@@@..++@@.",
+"..+++@@@@@@@@@@..++++@@@@.+++@@.",
+".+++@@@@@@@@@@..++++@@@@..++@@@.",
+".++@@@@@@@@@@..++++@@@@@.+++@@@.",
+".+@@@@@@@@@@..++++@@@@@..++@@@@.",
+".+@@@@@@@@@..+++++@@@@..+++@@@@.",
+" .@@@@@@@@..+++++@@@@@.++++@@@@.",
+" .@@@@@@@..+++++@@@@@..+++@@@@@.",
+"  .@@@@@..+++++@@@@@@.++++@@@@@.",
+"   ..@@..+++++@@@@@@..+++@@@@@@.",
+"     ...++++++@@@@@@.++++@@@@@@.",
+"      .++++++@@@@@@..+++@@@@@@@.",
+"      .+++++@@@@@@..++++@@@@@@@.",
+"       .+++@@@@@@@.++++@@@@@@@@.",
+"       .++++@@@@@..++++@@@@@@@..",
+"        ..+++@@@@.++++++@@@@@.. ",
+"          ..+++....++++++++..   ",
+"            ....   ........     "};
diff --git a/demos/poem/corner3.ico b/demos/poem/corner3.ico
new file mode 100644 (file)
index 0000000..201fb98
Binary files /dev/null and b/demos/poem/corner3.ico differ
diff --git a/demos/poem/corner3.xpm b/demos/poem/corner3.xpm
new file mode 100644 (file)
index 0000000..14c0446
--- /dev/null
@@ -0,0 +1,42 @@
+/* XPM */
+static char * corner3_xpm[] = {
+/* width height ncolors chars_per_pixel */
+"32 32 4 1",
+/* colors */
+"      s None  c None",
+".     c #000000",
+"+     c #c0c0c0",
+"@     c #808080",
+/* pixels */
+"     ........   ....            ",
+"   ..++++++++....+++..          ",
+" ..@@@@@++++++.@@@@+++..        ",
+"..@@@@@@@++++..@@@@@++++.       ",
+".@@@@@@@@++++.@@@@@@@+++.       ",
+".@@@@@@@++++..@@@@@@+++++.      ",
+".@@@@@@@+++..@@@@@@++++++.      ",
+".@@@@@@++++.@@@@@@++++++...     ",
+".@@@@@@+++..@@@@@@+++++..@@..   ",
+".@@@@@++++.@@@@@@+++++..@@@@@.  ",
+".@@@@@+++..@@@@@+++++..@@@@@@@. ",
+".@@@@++++.@@@@@+++++..@@@@@@@@. ",
+".@@@@+++..@@@@+++++..@@@@@@@@@+.",
+".@@@@++..@@@@@++++..@@@@@@@@@@+.",
+".@@@+++.@@@@@++++..@@@@@@@@@@++.",
+".@@@++..@@@@++++..@@@@@@@@@@+++.",
+".@@+++.@@@@++++..@@@@@@@@@@+++..",
+".@@++..@@@++++..@@@@@@@@@+++++. ",
+".@+++.@@@++++..@@@@@@@@@+++++.. ",
+".@++..@@@+++..@@@@@@@@+++++...  ",
+".@++.@@@+++..@@@@@@@+++++...... ",
+".++..@@+++..@@@@@@+++++...@@@.. ",
+".++.@@+++..@@@@@+++++...@@@@@@..",
+".+.@@+++..@@@@++++...@@@@@@@@@+.",
+".+.@@++..@@@++++...@@@@@@@@@@++.",
+"..@@++..@@++++...@@@@@@@@@@@+++.",
+"..@++..@++++...@@@@@@@@@@@@+++..",
+".@++..@+++...@@@@@@@@@@@@+++++. ",
+".@+..+++...@@@@@@@@@@++++++++.. ",
+".+..++...@@@@@@@+++++++++++...  ",
+"...++..++++++++++++++++++....   ",
+"............................    "};
diff --git a/demos/poem/corner4.ico b/demos/poem/corner4.ico
new file mode 100644 (file)
index 0000000..4af6753
Binary files /dev/null and b/demos/poem/corner4.ico differ
diff --git a/demos/poem/corner4.xpm b/demos/poem/corner4.xpm
new file mode 100644 (file)
index 0000000..f84a27a
--- /dev/null
@@ -0,0 +1,42 @@
+/* XPM */
+static char * corner4_xpm[] = {
+/* width height ncolors chars_per_pixel */
+"32 32 4 1",
+/* colors */
+"      s None  c None",
+".     c #000000",
+"+     c #c0c0c0",
+"@     c #808080",
+/* pixels */
+"            ....   ........     ",
+"          ..+++....++++++++..   ",
+"        ..+++@@@@.++++++@@@@@.. ",
+"       .++++@@@@@..++++@@@@@@@..",
+"       .+++@@@@@@@.++++@@@@@@@@.",
+"      .+++++@@@@@@..++++@@@@@@@.",
+"      .++++++@@@@@@..+++@@@@@@@.",
+"     ...++++++@@@@@@.++++@@@@@@.",
+"   ..@@..+++++@@@@@@..+++@@@@@@.",
+"  .@@@@@..+++++@@@@@@.++++@@@@@.",
+" .@@@@@@@..+++++@@@@@..+++@@@@@.",
+" .@@@@@@@@..+++++@@@@@.++++@@@@.",
+".+@@@@@@@@@..+++++@@@@..+++@@@@.",
+".+@@@@@@@@@@..++++@@@@@..++@@@@.",
+".++@@@@@@@@@@..++++@@@@@.+++@@@.",
+".+++@@@@@@@@@@..++++@@@@..++@@@.",
+"..+++@@@@@@@@@@..++++@@@@.+++@@.",
+" .+++++@@@@@@@@@..++++@@@..++@@.",
+" ..+++++@@@@@@@@@..++++@@@.+++@.",
+"  ...+++++@@@@@@@@..+++@@@..++@.",
+" ......+++++@@@@@@@..+++@@@.++@.",
+" ..@@@...+++++@@@@@@..+++@@..++.",
+"..@@@@@@...+++++@@@@@..+++@@.++.",
+".+@@@@@@@@@...++++@@@@..+++@@.+.",
+".++@@@@@@@@@@...++++@@@..++@@.+.",
+".+++@@@@@@@@@@@...++++@@..++@@..",
+"..+++@@@@@@@@@@@@...++++@..++@..",
+" .+++++@@@@@@@@@@@@...+++@..++@.",
+" ..++++++++@@@@@@@@@@...+++..+@.",
+"  ...+++++++++++@@@@@@@...++..+.",
+"   ....++++++++++++++++++..++...",
+"    ............................"};
diff --git a/demos/poem/makefile.b32 b/demos/poem/makefile.b32
new file mode 100644 (file)
index 0000000..b8eacd8
--- /dev/null
@@ -0,0 +1,16 @@
+#
+# File:                makefile.b32
+# Author:      Julian Smart
+# Created:     1999
+# Updated:     
+# Copyright:
+#
+# Makefile : Builds sample for 32-bit BC++
+
+WXDIR = $(WXWIN)
+
+TARGET=wxpoem
+OBJECTS = $(TARGET).obj
+
+!include $(WXDIR)\src\makeprog.b32
+
diff --git a/demos/poem/makefile.bcc b/demos/poem/makefile.bcc
new file mode 100644 (file)
index 0000000..2637044
--- /dev/null
@@ -0,0 +1,19 @@
+#
+# File:                makefile.bcc
+# Author:      Julian Smart
+# Created:     1998
+# Updated:     
+#
+# Builds a BC++ 16-bit sample
+
+!if "$(WXWIN)" == ""
+!error You must define the WXWIN variable in autoexec.bat, e.g. WXWIN=c:\wx
+!endif
+
+WXDIR = $(WXWIN)
+
+TARGET=wxpoem
+OBJECTS=$(TARGET).obj
+
+!include $(WXDIR)\src\makeprog.bcc
+
diff --git a/demos/poem/makefile.dos b/demos/poem/makefile.dos
new file mode 100644 (file)
index 0000000..84d5daa
--- /dev/null
@@ -0,0 +1,17 @@
+#
+# File:                makefile.dos
+# Author:      Julian Smart
+# Created:     1998
+# Updated:     
+#
+# Makefile : Builds 16-bit sample, VC++ 1.5
+# Use FINAL=1 argument to nmake to build final version with no debugging
+# info
+
+WXDIR = $(WXWIN)
+
+TARGET=wxpoem
+OBJECTS = $(TARGET).obj
+
+!include $(WXDIR)\src\makeprog.msc
+
diff --git a/demos/poem/makefile.g95 b/demos/poem/makefile.g95
new file mode 100644 (file)
index 0000000..45cd3e4
--- /dev/null
@@ -0,0 +1,16 @@
+#
+# File:         makefile.g95
+# Author:       Julian Smart
+# Created:      1999
+# Updated:
+# Copyright:    (c) Julian Smart, 1999
+#
+# Makefile for wxWindows sample (Cygwin/Mingw32).
+
+WXDIR = ../..
+
+TARGET=wxpoem
+OBJECTS = $(TARGET).o
+
+include $(WXDIR)/src/makeprog.g95
+
diff --git a/demos/poem/makefile.vc b/demos/poem/makefile.vc
new file mode 100644 (file)
index 0000000..8bf4582
--- /dev/null
@@ -0,0 +1,18 @@
+#
+# File:                makefile.vc
+# Author:      Julian Smart
+# Created:     1999
+# Updated:     
+# Copyright:   (c) Julian Smart
+#
+# Makefile : Builds sample (VC++, WIN32)
+# Use FINAL=1 argument to nmake to build final version with no debug info.
+
+# Set WXDIR for your system
+WXDIR = $(WXWIN)
+
+PROGRAM=wxpoem
+OBJECTS = $(PROGRAM).obj
+
+!include $(WXDIR)\src\makeprog.vc
+
diff --git a/demos/poem/makefile.wat b/demos/poem/makefile.wat
new file mode 100644 (file)
index 0000000..b07d6af
--- /dev/null
@@ -0,0 +1,15 @@
+#
+# Makefile for WATCOM
+#
+# Created by Julian Smart, January 1999
+# 
+#
+
+WXDIR = $(%WXWIN)
+
+PROGRAM = wxpoem
+OBJECTS = $(PROGRAM).obj
+
+!include $(WXDIR)\src\makeprog.wat
+
+
diff --git a/demos/poem/wxpoem.cpp b/demos/poem/wxpoem.cpp
new file mode 100644 (file)
index 0000000..2a2d89c
--- /dev/null
@@ -0,0 +1,1147 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        wxpoem.cpp
+// Purpose:     A small C++ program which displays a random poem on
+//              execution. It also allows search for poems containing a
+//              string.
+//              It requires winpoem.dat and creates winpoem.idx.
+//              Original version (WinPoem) written in 1994.
+//              This has not been rewritten in a long time so
+//              beware, inelegant code!
+// Author:      Julian Smart
+// Created:     12/12/98
+// RCS-ID:      $Id$
+// Copyright:   (c) 1998 Julian Smart
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifdef __GNUG__
+#pragma implementation "wxpoem.h"
+#endif
+
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+
+#include "wx/help.h"
+
+#include "wxpoem.h"
+
+#if defined(__WXGTK__) || defined(__WXMOTIF__)
+#include "corner1.xpm"
+#include "corner2.xpm"
+#include "corner3.xpm"
+#include "corner4.xpm"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+#ifdef __WINDOWS__
+#include <windows.h>
+#ifdef DrawText
+#undef DrawText
+#endif
+#endif
+
+#define         buf_size 10000
+#define         DEFAULT_POETRY_DAT "wxpoem"
+#define         DEFAULT_POETRY_IND "wxpoem"
+#define         DEFAULT_CHAR_HEIGHT 18
+#define         DEFAULT_FONT "Swiss"
+#define         DEFAULT_X_POS 0
+#define         DEFAULT_Y_POS 0
+#define         BORDER_SIZE 30
+#define         THIN_LINE_BORDER 10
+#define         THICK_LINE_BORDER 16
+#define         THICK_LINE_WIDTH 2
+#define         SHADOW_OFFSET 1
+#define         X_SIZE 30
+#define         Y_SIZE 20
+
+static char     *poem_buffer;          // Storage for each poem
+static char     line[150];                      // Storage for a line
+static char     title[150];                     // Remember the title
+static char     *search_string = NULL;          // The search string
+static int      pages[30];                      // For multipage poems -
+                                                // store the start of each page
+static long     last_poem_start = 0;            // Start of last found poem
+static long     last_find = -1;                 // Point in file of last found
+                                                // search string
+static bool     search_ok = FALSE;              // Search was successful
+static bool     same_search = FALSE;            // Searching on same string
+
+static long     poem_index[600];                     // Index of poem starts
+static long     nitems = 0;                     // Number of poems
+static int      char_height = DEFAULT_CHAR_HEIGHT; // Actual height
+static int      index_ptr = -1;                 // Pointer into index
+static int      poem_height, poem_width;        // Size of poem
+static int      XPos;                           // Startup X position
+static int      YPos;                           // Startup Y position
+static int      pointSize = 12;                 // Font size
+
+static char     *index_filename = NULL;            // Index filename
+static char     *data_filename = NULL;             // Data filename
+static char     error_buf[300];                 // Error message buffer
+static bool     loaded_ok = FALSE;              // Poem loaded ok
+static bool     index_ok = FALSE;               // Index loaded ok
+
+static bool     paging = FALSE;                 // Are we paging?
+static int      current_page = 0;               // Currently viewed page
+
+wxIcon          *Corner1 = NULL;
+wxIcon          *Corner2 = NULL;
+wxIcon          *Corner3 = NULL;
+wxIcon          *Corner4 = NULL;
+
+// Fonts
+wxFont          *NormalFont = NULL;
+wxFont          *BoldFont = NULL;
+wxFont          *ItalicFont = NULL;
+
+// Pens
+wxPen           *GreyPen = NULL;
+wxPen           *DarkGreyPen = NULL;
+wxPen           *WhitePen = NULL;
+
+// Backing bitmap
+wxBitmap        *backingBitmap = NULL;
+
+void            PoetryError(char *, char *caption="wxPoem Error");
+void            PoetryNotify(char *Msg, char *caption="wxPoem");
+void            TryLoadIndex();
+bool            LoadPoem(char *, long);
+int             GetIndex();
+int             LoadIndex(char *);
+bool            Compile(void);
+void            WritePreferences();
+void            ReadPreferences();
+void            FindMax(int *max_thing, int thing);
+void            CreateFonts();
+#ifdef __WXMSW__
+void            CopyToClipboard(HWND, char *);
+#endif
+
+wxMenu    *popupMenu = NULL;
+
+#if wxUSE_HELP
+    wxHelpController *HelpController = NULL;
+#endif // wxUSE_HELP
+
+IMPLEMENT_APP(MyApp)
+
+MainWindow *TheMainWindow = NULL;
+
+// Create the fonts
+void CreateFonts()
+{
+  NormalFont = wxTheFontList->FindOrCreateFont(pointSize, wxSWISS, wxNORMAL, wxNORMAL);
+  BoldFont =   wxTheFontList->FindOrCreateFont(pointSize, wxSWISS, wxNORMAL, wxBOLD);
+  ItalicFont = wxTheFontList->FindOrCreateFont(pointSize, wxSWISS, wxITALIC, wxNORMAL);
+}
+
+BEGIN_EVENT_TABLE(MainWindow, wxFrame)
+    EVT_CLOSE(MainWindow::OnCloseWindow)
+    EVT_CHAR(MainWindow::OnChar)
+    EVT_MENU(-1, MainWindow::OnPopup)
+END_EVENT_TABLE()
+
+MainWindow::MainWindow(wxFrame *frame, wxWindowID id, const wxString& title,
+   const wxPoint& pos, const wxSize& size, long style):
+  wxFrame(frame, id, title, pos, size, style)
+{
+}
+
+MainWindow::~MainWindow()
+{
+  // Note: this must be done before the main window/canvas are destroyed
+  // or we get an error (no parent window for menu item button)
+  delete popupMenu;
+  popupMenu = NULL;
+}
+
+// Read the poetry buffer, either for finding the size
+// or for writing to a bitmap (not to the window directly,
+// since that displays messily)
+// If DrawIt is true, we draw, otherwise we just determine the
+// size the window should be.
+void MainWindow::ScanBuffer(wxDC *dc, bool DrawIt, int *max_x, int *max_y)
+{
+    int i = pages[current_page];
+    int ch = -1;
+    int x = 10;
+    int y = 0;
+    int j;
+    char *line_ptr;
+    int curr_width = 0;
+    bool page_break = FALSE;
+
+    int width = 0;
+    int height = 0;
+
+    if (DrawIt)
+    {
+      y = (*max_y - poem_height)/2;
+      width = *max_x;
+      height = *max_y;
+    }
+
+    if (DrawIt && wxColourDisplay())
+    {
+      dc->SetBrush(*wxLIGHT_GREY_BRUSH);
+      dc->SetPen(*GreyPen);
+      dc->DrawRectangle(0, 0, width, height);
+      dc->SetBackgroundMode(wxTRANSPARENT);
+    }
+
+    // See what ACTUAL char height is
+    dc->SetFont(* NormalFont);
+    long xx;
+    long yy;
+    dc->GetTextExtent("X", &xx, &yy);
+    char_height = (int)yy;
+
+    if (current_page == 0)
+      title[0] = 0;
+    else if (title[0] != 0)
+    {
+       dc->SetFont(* BoldFont);
+       dc->GetTextExtent(title, &xx, &yy);
+       FindMax(&curr_width, (int)xx);
+
+       if (DrawIt)
+       {
+         x = (width - xx)/2;
+         dc->SetFont(* BoldFont);
+
+         // Change text to BLACK!
+         dc->SetTextForeground(* wxBLACK);
+         dc->DrawText(title, x, y);
+         // Change text to WHITE!
+         dc->SetTextForeground(* wxWHITE);
+         dc->DrawText(title, x-SHADOW_OFFSET, y-SHADOW_OFFSET);
+       }
+       y += char_height;
+       y += char_height;
+    }
+
+    while (ch != 0 && !page_break)
+    {
+        j = 0;
+#ifdef __WXMSW__
+        while (((ch = poem_buffer[i]) != 13) && (ch != 0))
+#else
+        while (((ch = poem_buffer[i]) != 10) && (ch != 0))
+#endif
+        {
+            line[j] = ch;
+            j ++;
+            i ++;
+        }
+
+#ifdef __WXMSW__
+        if (ch == 13)
+#else
+        if (ch == 10)
+#endif
+        {
+            ch = -1;
+            i ++;
+#ifdef __WXMSW__
+            // Add another to skip the linefeed
+            i ++;
+#endif
+            // If a single newline on its own, put a space in
+            if (j == 0)
+            {
+              line[j] = ' ';
+              j ++;
+              line[j] = 0;
+            }
+        }
+
+        if (j > 0)
+        {
+          line[j] = 0;
+          if (line[0] == '@')
+          {
+            switch (line[1])
+            {
+              case 'P':
+                paging = TRUE;
+                page_break = TRUE;
+                break;
+
+              case 'T':
+                dc->SetFont(* BoldFont);
+                line_ptr = line+3;
+
+                strcpy(title, line_ptr);
+                strcat(title, " (cont'd)");
+
+                dc->GetTextExtent(line_ptr, &xx, &yy);
+                FindMax(&curr_width, (int)xx);
+
+                if (DrawIt)
+                {
+                  x = (width - xx)/2;
+                  dc->SetFont(* BoldFont);
+
+                  // Change text to BLACK!
+                  dc->SetTextForeground(* wxBLACK);
+                  dc->DrawText(line_ptr, x, y);
+
+                  // Change text to WHITE!
+                  dc->SetTextForeground(* wxWHITE);
+                  dc->DrawText(line_ptr, x-SHADOW_OFFSET, y-SHADOW_OFFSET);
+                  dc->SetTextForeground(* wxWHITE);
+                }
+                break;
+
+              case 'A':
+                line_ptr = line+3;
+                dc->SetFont(* ItalicFont);
+
+                dc->GetTextExtent(line_ptr, &xx, &yy);
+                FindMax(&curr_width, (int)xx);
+
+                if (DrawIt)
+                {
+                  x = (width - xx)/2;
+                  dc->SetTextForeground(* wxBLACK);
+                  dc->DrawText(line_ptr, x, y);
+                }
+                break;
+
+              // Default: just ignore this line
+              default:
+                y -= char_height;
+            }
+           }
+           else
+           {
+              dc->SetFont(* NormalFont);
+
+              dc->GetTextExtent(line, &xx, &yy);
+              FindMax(&curr_width, (int)xx);
+
+              if (DrawIt)
+              {
+                int x = (int)((width - xx)/2.0);
+                dc->SetFont(* NormalFont);
+                dc->SetTextForeground(* wxBLACK);
+                dc->DrawText(line, x, y);
+              }
+           }
+        }
+        y += char_height;
+    }
+
+    // Write (cont'd)
+    if (page_break)
+    {
+       char *cont = "(cont'd)";
+
+       dc->SetFont(* NormalFont);
+
+       dc->GetTextExtent(cont, &xx, &yy);
+       FindMax(&curr_width, (int)xx);
+       if (DrawIt)
+       {
+         int x = (int)((width - xx)/2.0);
+         dc->SetFont(* NormalFont);
+         dc->SetTextForeground(* wxBLACK);
+         dc->DrawText(cont, x, y);
+       }
+       y += 2*char_height;
+    }
+
+    *max_x = (int)curr_width;
+    *max_y = (int)(y-char_height);
+
+    if (page_break)
+      pages[current_page+1] = i;
+    else
+      paging = FALSE;
+
+    if (DrawIt)
+    {
+      // Draw dark grey thick border
+      if (wxColourDisplay())
+      {
+        dc->SetBrush(*wxGREY_BRUSH);
+        dc->SetPen(*wxGREY_PEN);
+
+        // Left side
+        dc->DrawRectangle(0, 0, THIN_LINE_BORDER, height);
+        // Top side
+        dc->DrawRectangle(THIN_LINE_BORDER, 0, width-THIN_LINE_BORDER, THIN_LINE_BORDER);
+        // Right side
+        dc->DrawRectangle(width-THIN_LINE_BORDER, THIN_LINE_BORDER, width, height-THIN_LINE_BORDER);
+        // Bottom side
+        dc->DrawRectangle(THIN_LINE_BORDER, height-THIN_LINE_BORDER, width-THIN_LINE_BORDER, height);
+      }
+      // Draw border
+      // Have grey background, plus 3-d border -
+      // One black rectangle.
+      // Inside this, left and top sides - dark grey. Bottom and right -
+      // white.
+
+      // Change pen to black
+      dc->SetPen(*wxBLACK_PEN);
+      dc->DrawLine(THIN_LINE_BORDER, THIN_LINE_BORDER, width-THIN_LINE_BORDER, THIN_LINE_BORDER);
+      dc->DrawLine(width-THIN_LINE_BORDER, THIN_LINE_BORDER, width-THIN_LINE_BORDER, height-THIN_LINE_BORDER);
+      dc->DrawLine(width-THIN_LINE_BORDER, height-THIN_LINE_BORDER, THIN_LINE_BORDER, height-THIN_LINE_BORDER);
+      dc->DrawLine(THIN_LINE_BORDER, height-THIN_LINE_BORDER, THIN_LINE_BORDER, THIN_LINE_BORDER);
+
+      // Right and bottom white lines - 'grey' (black!) if
+      // we're running on a mono display.
+      if (wxColourDisplay())
+        dc->SetPen(*WhitePen);
+      else
+        dc->SetPen(*DarkGreyPen);
+
+      dc->DrawLine(width-THICK_LINE_BORDER, THICK_LINE_BORDER,
+                   width-THICK_LINE_BORDER, height-THICK_LINE_BORDER);
+      dc->DrawLine(width-THICK_LINE_BORDER, height-THICK_LINE_BORDER,
+                   THICK_LINE_BORDER, height-THICK_LINE_BORDER);
+
+      // Left and top grey lines
+      dc->SetPen(*DarkGreyPen);
+      dc->DrawLine(THICK_LINE_BORDER, height-THICK_LINE_BORDER,
+                   THICK_LINE_BORDER, THICK_LINE_BORDER);
+      dc->DrawLine(THICK_LINE_BORDER, THICK_LINE_BORDER,
+                   width-THICK_LINE_BORDER, THICK_LINE_BORDER);
+
+//#ifdef __WXMSW__
+      // Draw icons
+      dc->DrawIcon(* Corner1, 0, 0);
+      dc->DrawIcon(* Corner2, int(width-32), 0);
+
+      int y2 = height - 32;
+      int x2 = (width-32);
+      dc->DrawIcon(* Corner3, 0, y2);
+      dc->DrawIcon(* Corner4, x2, y2);
+//#endif
+    }
+}
+
+// Get an index (randomly generated) and load the poem
+void MainWindow::GetIndexLoadPoem(void)
+{
+    if (index_ok)
+      index_ptr = GetIndex();
+
+    if (index_ptr > -1)
+      loaded_ok = LoadPoem(data_filename, -1);
+}
+
+// Find the size of the poem and resize the window accordingly
+void MainWindow::Resize(void)
+{
+    wxClientDC dc(canvas);
+
+    // Get the poem size
+    ScanBuffer(& dc, FALSE, &poem_width, &poem_height);
+    int x = poem_width + (2*BORDER_SIZE);
+    int y = poem_height + (2*BORDER_SIZE);
+
+    SetClientSize(x, y);
+
+    // In case client size isn't what we set it to...
+    int xx, yy;
+    GetClientSize(&xx, &yy);
+
+    wxMemoryDC memDC;
+    if (backingBitmap) delete backingBitmap;
+    backingBitmap = new wxBitmap(x, yy);
+    memDC.SelectObject(* backingBitmap);
+
+    memDC.Clear();
+    TheMainWindow->ScanBuffer(&memDC, TRUE, &xx, &yy);
+}
+
+// Which is more?
+void FindMax(int *max_thing, int thing)
+{
+  if (thing > *max_thing)
+    *max_thing = thing;
+}
+
+// Next page/poem
+void MainWindow::NextPage(void)
+{
+  if (paging)
+    current_page ++;
+  else
+  {
+    current_page = 0;
+    GetIndexLoadPoem();
+  }
+  Resize();
+}
+
+// Previous page
+void MainWindow::PreviousPage(void)
+{
+  if (current_page > 0)
+  {
+    current_page --;
+    Resize();
+  }
+}
+
+// Search for a string
+void MainWindow::Search(bool ask)
+{
+  long position;
+
+  if (ask || !search_string)
+  {
+    wxString s = wxGetTextFromUser("Enter search string", "Search", (const char*) search_string);
+    if (s != "")
+    {
+      if (search_string) delete[] search_string;
+      search_string = copystring(s);
+      search_ok = TRUE;
+    } else search_ok = FALSE;
+  }
+  else
+  {
+    same_search = TRUE;
+    search_ok = TRUE;
+  }
+
+  if (search_string && search_ok)
+  {
+    position = DoSearch();
+    if (position > -1)
+    {
+       loaded_ok = LoadPoem(data_filename, position);
+       Resize();
+    }
+    else
+    {
+      last_poem_start = 0;
+      PoetryNotify("Search string not found.");
+    }
+  }
+}
+
+// Copy a string to the clipboard
+#ifdef __WXMSW__
+void CopyToClipboard(HWND handle, char *s)
+{
+  int length = strlen(s);
+  HANDLE hGlobalMemory = GlobalAlloc(GHND, (DWORD) length + 1);
+  if (hGlobalMemory)
+  {
+#ifdef __WINDOWS_386__
+    LPSTR lpGlobalMemory = MK_FP32(GlobalLock(hGlobalMemory));
+#else
+    LPSTR lpGlobalMemory = (LPSTR)GlobalLock(hGlobalMemory);
+#endif
+    int i, j = 0;
+    for (i = 0; i < length; i ++)
+    {
+      if (s[i] == '@')
+      {
+        i++;
+        switch (s[i])
+        {
+          case 'P':
+            break;
+          case 'T':
+          case 'A':
+          default:
+            i ++;
+            break;
+        }
+      }
+      else
+      {
+        lpGlobalMemory[j] = s[i];
+        j ++;
+      }
+    }
+
+    GlobalUnlock(hGlobalMemory);
+    OpenClipboard(handle);
+    EmptyClipboard();
+    SetClipboardData(CF_TEXT, hGlobalMemory);
+    CloseClipboard();
+  }
+}
+#endif
+
+bool MyApp::OnInit()
+{
+  poem_buffer = new char[buf_size];
+
+  GreyPen = new wxPen("LIGHT GREY", THICK_LINE_WIDTH, wxSOLID);
+  DarkGreyPen = new wxPen("GREY", THICK_LINE_WIDTH, wxSOLID);
+  WhitePen = new wxPen("WHITE", THICK_LINE_WIDTH, wxSOLID);
+
+#if wxUSE_HELP
+  HelpController = new wxHelpController();
+  HelpController->Initialize("wxpoem");
+#endif // wxUSE_HELP
+
+  CreateFonts();
+
+  ReadPreferences();
+
+  // Seed the random number generator
+  time_t current_time;
+
+  (void)time(&current_time);
+  srand((unsigned int)current_time);
+
+//    randomize();
+  pages[0] = 0;
+
+  TheMainWindow = new MainWindow(NULL, 500, "wxPoem", wxPoint(XPos, YPos), wxSize(100, 100), wxCAPTION|wxMINIMIZE_BOX|wxSYSTEM_MENU);
+
+#ifdef wx_x
+  TheMainWindow->SetIcon(Icon("wxpoem"));
+#endif
+
+  TheMainWindow->canvas = new MyCanvas(TheMainWindow, 501, wxDefaultPosition, wxDefaultSize);
+
+  popupMenu = new wxMenu;
+  popupMenu->Append(POEM_NEXT, "Next poem/page");
+  popupMenu->Append(POEM_PREVIOUS, "Previous page");
+  popupMenu->AppendSeparator();
+  popupMenu->Append(POEM_SEARCH, "Search");
+  popupMenu->Append(POEM_NEXT_MATCH, "Next match");
+  popupMenu->Append(POEM_COPY, "Copy to clipboard");
+  popupMenu->Append(POEM_MINIMIZE, "Minimize");
+  popupMenu->AppendSeparator();
+  popupMenu->Append(POEM_BIGGER_TEXT, "Bigger text");
+  popupMenu->Append(POEM_SMALLER_TEXT, "Smaller text");
+  popupMenu->AppendSeparator();
+  popupMenu->Append(POEM_ABOUT, "About wxPoem");
+  popupMenu->AppendSeparator();
+  popupMenu->Append(POEM_EXIT, "Exit");
+
+  if (argc > 1)
+  {
+    index_filename = copystring(argv[1]);
+    data_filename = copystring(argv[1]);
+  }
+  else
+  {
+    index_filename = DEFAULT_POETRY_IND;
+    data_filename = DEFAULT_POETRY_DAT;
+  }
+  TryLoadIndex();
+
+#ifdef __WXMSW__
+  Corner1 = new wxIcon("icon_1");
+  Corner2 = new wxIcon("icon_2");
+  Corner3 = new wxIcon("icon_3");
+  Corner4 = new wxIcon("icon_4");
+#endif
+#if defined(__WXGTK__) || defined(__WXMOTIF__)
+  Corner1 = new wxIcon( corner1_xpm );
+  Corner2 = new wxIcon( corner2_xpm );
+  Corner3 = new wxIcon( corner3_xpm );
+  Corner4 = new wxIcon( corner4_xpm );
+#endif
+
+  TheMainWindow->GetIndexLoadPoem();
+  TheMainWindow->Resize();
+  TheMainWindow->Show(TRUE);
+
+  return TRUE;
+}
+
+int MyApp::OnExit()
+{
+  if (backingBitmap)
+    delete backingBitmap;
+#if wxUSE_HELP
+  delete HelpController;
+#endif // wxUSE_HELP
+  delete GreyPen;
+  delete DarkGreyPen;
+  delete WhitePen;
+
+  delete Corner1;
+  delete Corner2;
+  delete Corner3;
+  delete Corner4;
+
+  delete NormalFont;
+  delete BoldFont;
+  delete ItalicFont;
+  delete poem_buffer;
+
+  return 0;
+}
+
+void MainWindow::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
+{
+  WritePreferences();
+  this->Destroy();
+}
+
+void MainWindow::OnChar(wxKeyEvent& event)
+{
+    canvas->OnChar(event);
+}
+
+BEGIN_EVENT_TABLE(MyCanvas, wxWindow)
+    EVT_MOUSE_EVENTS(MyCanvas::OnMouseEvent)
+    EVT_CHAR(MyCanvas::OnChar)
+    EVT_PAINT(MyCanvas::OnPaint)
+END_EVENT_TABLE()
+
+// Define a constructor for my canvas
+MyCanvas::MyCanvas(wxFrame *frame, wxWindowID id, const wxPoint& pos, const wxSize& size):
+ wxWindow(frame, id, pos, size)
+{
+}
+
+// Define the repainting behaviour
+void MyCanvas::OnPaint(wxPaintEvent& WXUNUSED(event))
+{
+    wxPaintDC dc(this);
+
+    if (backingBitmap)
+    {
+        int xx, yy;
+        TheMainWindow->GetClientSize(&xx, &yy);
+
+        wxMemoryDC memDC;
+        memDC.SelectObject(* backingBitmap);
+        dc.Blit(0, 0, backingBitmap->GetWidth(), backingBitmap->GetHeight(), &memDC, 0, 0);
+  }
+}
+
+void MyCanvas::OnMouseEvent(wxMouseEvent& event)
+{
+  static int startPosX, startPosY, startFrameX, startFrameY;
+
+  long x, y;
+  event.GetPosition(&x, &y);
+
+  if (event.RightDown())
+  {
+    // Versions from wxWin 1.67 are probably OK
+    PopupMenu(popupMenu, (int)x, (int)y );
+  }
+  else if (event.LeftDown())
+  {
+    this->CaptureMouse();
+    int x1 = (int)x;
+    int y1 = (int)y;
+    ClientToScreen(&x1, &y1);
+    startPosX = x1;
+    startPosY = y1;
+    GetParent()->GetPosition(&startFrameX, &startFrameY);
+  }
+  else if (event.LeftUp())
+    this->ReleaseMouse();
+  else if (event.Dragging() && event.LeftIsDown())
+  {
+    int x1 = (int)x;
+    int y1 = (int)y;
+    ClientToScreen(&x1, &y1);
+
+    int dX = x1 - startPosX;
+    int dY = y1 - startPosY;
+    GetParent()->Move(startFrameX + dX, startFrameY + dY);
+  }
+}
+
+// Process characters
+void MyCanvas::OnChar(wxKeyEvent& event)
+{
+  switch (event.KeyCode())
+  {
+    case 'n':
+    case 'N':
+      // Next match
+      TheMainWindow->Search(FALSE);
+      break;
+    case 's':
+    case 'S':
+      // New search
+      TheMainWindow->Search(TRUE);
+      break;
+    case WXK_SPACE:
+      // Another poem
+      TheMainWindow->NextPage();
+      break;
+    case 27:
+      TheMainWindow->Close(TRUE);
+    default:
+       break;
+   }
+ }
+
+// Load index file
+int LoadIndex(char *file_name)
+{
+    long data;
+    FILE *index_file;
+
+    int i = 0;
+    char buf[100];
+
+    if (file_name)
+      sprintf(buf, "%s.idx", file_name);
+    if (! (file_name && (index_file = fopen(buf, "r"))))
+      return 0;
+    else
+    {
+      fscanf(index_file, "%ld", &nitems);
+
+      for (i = 0; i < nitems; i++)
+      {
+        fscanf(index_file, "%ld", &data);
+        poem_index[i] = data;
+      }
+      fclose(index_file);
+
+      return 1;
+    }
+}
+
+// Get index
+int GetIndex()
+{
+    int indexn = 0;
+
+    indexn = (int)(rand() % nitems);
+
+    if ((indexn < 0) || (indexn > nitems))
+    { PoetryError("No such poem!");
+      return -1;
+    }
+    else
+      return indexn;
+}
+
+// Read preferences
+void ReadPreferences()
+{
+  wxGetResource("wxPoem", "FontSize", &pointSize);
+  wxGetResource("wxPoem", "X", &XPos);
+  wxGetResource("wxPoem", "Y", &YPos);
+}
+
+// Write preferences to disk
+void WritePreferences()
+{
+#ifdef __WXMSW__
+  TheMainWindow->GetPosition(&XPos, &YPos);
+  wxWriteResource("wxPoem", "FontSize", pointSize);
+  wxWriteResource("wxPoem", "X", XPos);
+  wxWriteResource("wxPoem", "Y", YPos);
+#endif
+}
+
+// Load a poem from given file, at given point in file.
+// If position is > -1, use this for the position in the
+// file, otherwise use index[index_ptr] to find the correct position.
+bool LoadPoem(char *file_name, long position)
+{
+    int ch = 0;
+    int i = 0;
+//    int j = 0;
+//    int indexn = 0;
+    char buf[100];
+    long data;
+    FILE *data_file;
+
+    paging = FALSE;
+    current_page = 0;
+
+    if (file_name)
+      sprintf(buf, "%s.dat", file_name);
+
+    if (! (file_name && (data_file = fopen(buf, "r"))))
+    {
+      sprintf(error_buf, "Data file %s not found.", buf);
+      PoetryError(error_buf);
+      return FALSE;
+    }
+    else
+    {
+      if (position > -1)
+        data = position;
+      else
+        data = poem_index[index_ptr];
+
+      fseek(data_file, data, SEEK_SET);
+
+      ch = 0;
+      i = 0;
+      while ((ch != EOF) && (ch != '#'))
+      {
+        ch = getc(data_file);
+        // Add a linefeed so it will copy to the clipboard ok
+        if (ch == 10)
+        {
+          poem_buffer[i] = 13;
+          i++;
+        }
+
+        poem_buffer[i] = ch;
+        i ++;
+
+        if (i == buf_size)
+        {
+           sprintf(error_buf, "%s", "Poetry buffer exceeded.");
+           PoetryError(error_buf);
+           return FALSE;
+        }
+      }
+      fclose(data_file);
+      poem_buffer[i-1] = 0;
+      return TRUE;
+  }
+}
+
+// Do the search
+long MainWindow::DoSearch(void)
+{
+    if (!search_string)
+      return FALSE;
+
+    FILE *file;
+    long i = 0;
+    int ch = 0;
+    char buf[100];
+    long find_start;
+    long previous_poem_start;
+
+    bool found = FALSE;
+    int search_length = strlen(search_string);
+
+    if (same_search)
+    {
+      find_start = last_find + 1;
+      previous_poem_start = last_poem_start;
+    }
+    else
+    {
+      find_start = 0;
+      last_poem_start = 0;
+      previous_poem_start = -1;
+    }
+
+    if (data_filename)
+      sprintf(buf, "%s.dat", data_filename);
+
+    if (! (data_filename && (file = fopen(buf, "r"))))
+    {
+      sprintf(error_buf, "Poetry data file %s not found\n", buf);
+      PoetryError(error_buf);
+      return FALSE;
+    }
+
+    fseek(file, find_start, SEEK_SET);
+
+    while ((ch != EOF) && !found)
+    {
+        ch = getc(file);
+        ch |= 0x0020;   // Make lower case
+
+        // Only match if we're looking at a different poem
+        // (no point in displaying the same poem again)
+        if ((ch == search_string[i]) && (last_poem_start != previous_poem_start))
+        {
+          if (i == 0)
+            last_find = ftell(file);
+          if (i == search_length-1)
+            found = TRUE;
+          i ++;
+        }
+        else
+          i = 0;
+
+        if (ch == '#')
+        {
+            ch = getc(file);
+              last_poem_start = ftell(file);
+        }
+    }
+    fclose(file);
+    if (ch == EOF)
+      last_find = -1;
+
+    if (found)
+    {
+      return last_poem_start;
+    }
+    else
+      return -1;
+}
+
+// Set up poetry filenames, preferences, load the index
+// Load index (or compile it if none found)
+void TryLoadIndex()
+{
+  index_ok = LoadIndex(index_filename);
+  if (!index_ok || (nitems == 0))
+  {
+      PoetryError("Index file not found; will compile new one", "wxPoem");
+      index_ok = Compile();
+  }
+}
+
+// Error message
+void PoetryError(char *msg, char *caption)
+{
+  wxMessageBox(msg, caption, wxOK|wxICON_EXCLAMATION);
+}
+
+// Notification (change icon to something appropriate!)
+void PoetryNotify(char *Msg, char *caption)
+{
+  wxMessageBox(Msg, caption, wxOK | wxICON_INFORMATION);
+}
+
+// Build up and save an index into the poetry data file, for
+// rapid random access
+bool Compile(void)
+{
+    FILE *file;
+    long i = 0;
+    int j;
+    int ch = 0;
+    char buf[100];
+
+    if (data_filename)
+      sprintf(buf, "%s.dat", data_filename);
+
+    if (! (data_filename && (file = fopen(buf, "r"))))
+    {
+      sprintf(error_buf, "Poetry data file %s not found\n", buf);
+      PoetryError(error_buf);
+      return FALSE;
+    }
+
+    nitems = 0;
+
+    // Do first one (?)
+    poem_index[nitems] = 0;
+    nitems ++;
+
+    // Do rest
+    while (ch != EOF)
+    {
+        ch = getc(file);
+        i ++;
+        if (ch == '#')
+        {
+            ch = getc(file);
+            long data;
+            data = ftell(file);
+            poem_index[nitems] = data;
+            nitems ++;
+        }
+    }
+    fclose(file);
+
+    if (index_filename)
+      sprintf(buf, "%s.idx", index_filename);
+    if (! (data_filename && (file = fopen(buf, "w"))))
+    {
+      sprintf(error_buf, "Poetry index file %s cannot be created\n", buf);
+      PoetryError(error_buf);
+      return FALSE;
+    }
+
+    fprintf(file, "%ld\n\n", nitems);
+    for (j = 0; j < nitems; j++)
+      fprintf(file, "%ld\n", poem_index[j]);
+
+    fclose(file);
+    PoetryNotify("Poetry index compiled.");
+    return TRUE;
+}
+
+void MainWindow::OnPopup(wxCommandEvent& event)
+{
+  switch (event.GetId())
+  {
+     case POEM_NEXT:
+       // Another poem/page
+       TheMainWindow->NextPage();
+       break;
+     case POEM_PREVIOUS:
+       // Previous page
+       TheMainWindow->PreviousPage();
+       break;
+     case POEM_SEARCH:
+       // Search - with dialog
+       TheMainWindow->Search(TRUE);
+       break;
+     case POEM_NEXT_MATCH:
+       // Search - without dialog (next match)
+       TheMainWindow->Search(FALSE);
+       break;
+     case POEM_MINIMIZE:
+       TheMainWindow->Iconize(TRUE);
+       break;
+#ifdef __WXMSW__
+     case POEM_COPY:
+       // Copy current poem to the clipboard
+       CopyToClipboard((HWND) TheMainWindow->GetHWND(), poem_buffer);
+       break;
+#endif
+     case POEM_COMPILE:
+       // Compile index
+       Compile();
+       break;
+     case POEM_BIGGER_TEXT:
+     {
+       pointSize ++;
+       CreateFonts();
+       TheMainWindow->Resize();
+       break;
+     }
+     case POEM_SMALLER_TEXT:
+     {
+       if (pointSize > 2)
+       {
+         pointSize --;
+         CreateFonts();
+         TheMainWindow->Resize();
+       }
+       break;
+     }
+     case POEM_HELP_CONTENTS:
+     {
+#if wxUSE_HELP
+       HelpController->LoadFile("wxpoem");
+       HelpController->DisplayContents();
+#endif // wxUSE_HELP
+       break;
+     }
+     case POEM_ABOUT:
+     {
+       (void)wxMessageBox("wxPoem Version 1.1\nJulian Smart (c) 1995",
+                          "About wxPoem", wxOK, TheMainWindow);
+       break;
+     }
+     case POEM_EXIT:
+       // Exit
+       TheMainWindow->Close(TRUE);
+       break;
+     default:
+       break;
+  }
+}
diff --git a/demos/poem/wxpoem.dat b/demos/poem/wxpoem.dat
new file mode 100644 (file)
index 0000000..c03e494
--- /dev/null
@@ -0,0 +1,2532 @@
+@T A Thunderstorm in Town
+
+She wore a new "terra-cotta" dress,
+And we stayed, because of the pelting storm,
+Within the hansom's dry recess,
+Though the horse had stopped; yea, motionless
+We sat on, snug and warm.
+
+Then the downpour ceased, to my sharp sad pain
+And the glass that had screened our forms before
+Flew up, and out she sprang to her door:
+I should have kissed her if the rain
+Had lasted a minute more.
+
+@A Thomas Hardy
+#
+They say my verse is sad: no wonder;
+Its narrow measure spans
+Tears of eternity, and sorrow,
+Not mine, but man's.
+
+This is for all ill-treated fellows
+Unborn and unbegot,
+For them to read when they're in trouble
+And I am not.
+
+@A A. E. Housman
+#
+@T On a Day's Stint
+
+And long ere dinner-time I have
+Full eight close pages wrote.
+What, Duty, hast thou now to crave?
+Well done, Sir Walter Scott!
+
+@A Sir Walter Scott
+#
+@T The Choir Boy
+
+And when he sang in choruses
+His voice o'ertopped the rest,
+Which is very inartistic,
+But the public like that best.
+
+@A Anonymous
+#
+@T For Johnny
+
+Do not despair
+For Johnny-head-air;
+He sleeps as sound
+As Johnny underground.
+
+Fetch out no shroud
+For Johnny-in-the-cloud;
+And keep your tears
+For him in after years.
+
+Better by far
+For Johnny-the-bright-star,
+To keep your head,
+And see his children fed.
+
+@A John Pudney
+#
+@T Cock-Crow
+
+Out of the wood of thoughts that grows by night
+To be cut down by the sharp axe of light, -
+Out of the night, two cocks together crow,
+Cleaving the darkness with a silver blow:
+And bright before my eyes twin trumpeters stand,
+Heralds of splendour, one at either hand,
+Each facing each as in a coat of arms:
+The milkers lace their boots up at the farms.
+
+@A Edward Thomas
+#
+@T After Long Silence
+
+Speech after long silence; it is right,
+All other lovers being estranged or dead,
+Unfriendly lamplight hid under its shade,
+The curtains drawn upon unfriendly night,
+That we descant and yet again descant
+Upon the supreme theme of Art and Song:
+Bodily decrepitude is wisdom; young
+We loved each other and were ignorant.
+
+@A W. B. Yeats
+#
+@T Clouds
+
+Down the blue night the unending columns press
+In noiseless tumult, break and wave and flow,
+Now tread the far South, or lift rounds of snow
+Up to the white moon's hidden loveliness.
+Some pause in their grave wandering comradeless,
+And turn with profound gesture vague and slow,
+As who would pray good for the world, but know
+Their benediction empty as they bless.
+
+They say that the Dead die not, but remain
+Near to the rich heirs of their grief and mirth.
+I think they ride the calm mid-heaven, as these,
+In wise majestic melancholy train,
+And watch the moon, and the still-raging seas,
+And men coming and going on the earth.
+
+@A Rupert Brooke
+#
+@T If I should ever by Chance
+
+If I should ever by chance grow rich
+I'll buy Codham, Cockridden, and Childerditch,
+Roses, Pyrgo, and Lapwater,
+And let them all to my elder daughter.
+The rent I shall ask of her will be only
+Each year's violets, white and lonely,
+The first primroses and orchises -
+She must find them before I do, that is.
+But if she finds a blossom on furze
+Without rent they shall all for ever be hers,
+Codham, Cockridden, and Childerditch,
+Roses, Pyrgo, and Lapwater, -
+I shall give them all to my elder daughter.
+
+@A Edward Thomas
+#
+@T Adlestrop
+
+Yes, I remember Adlestrop -
+The name, because one afternoon
+Of heat the express-train drew up there
+Unwontedly.  It was late June.
+
+The steam hissed.  Someone cleared his throat.
+No one left and no one came
+On the bare platform.  What I saw
+Was Adlestrop - only the name
+
+And willows, willow-herb, and grass,
+And meadowsweet, and haycocks dry,
+No whit less still and lonely fair
+Than the high cloudlets in the sky.
+
+And for that minute a blackbird sang
+Close by, and round him, mistier,
+Farther and farther, all the birds
+Of Oxfordshire and Gloucestershire.
+
+@A Edward Thomas
+#
+@T Tall Nettles
+
+Tall nettles cover up, as they have done
+These many springs, the rusty harrow, the plough
+Long worn out, and the roller made of stone:
+Only the elm butt tops the nettles now.
+
+This corner of the farmyard I like most:
+As well as any bloom upon a flower
+I like the dust on the nettles, never lost
+Except to prove the sweetness of a shower.
+
+@A Edward Thomas
+#
+@T The Cherry Trees
+
+The cherry trees bend over and are shedding
+On the old road where all that passed are dead,
+Their petals, strewing the grass as for a wedding
+This early May morn when there is none to wed.
+
+@A Edward Thomas
+#
+@T What will they do?
+
+What will they do when I am gone? It is plain
+That they will do without me as the rain
+Can do without the flowers and the grass
+That profit by it and must perish without.
+I have but seen them in the loud street pass;
+And I was naught to them. I turned about
+To see them disappearing carelessly.
+But what if I in them as they in me
+Nourished what has great value and no price?
+Almost I thought that rain thirsts for a draught
+Which only in the blossom's chalice lies,
+Until that one turned back and lightly laughed.
+
+@A Edward Thomas
+#
+@T The Lane
+
+Some day, I think, there will be people enough
+In Froxfield to pick all the blackberries
+Out of the hedges of Green Lane, the straight
+Broad lane where now September hides herself
+In bracken and blackberry, harebell and dwarf gorse.
+Today, where yesterday a hundred sheep
+Were nibbling, halcyon bells shake to the sway
+Of waters that no vessel ever sailed...
+It is a kind of spring: the chaffinch tries
+His song. For heat it is like summer too.
+This might be winter's quiet. While the glint
+Of hollies dark in the swollen hedges lasts -
+One mile - and those bells ring, little I know
+Or heed if time be still the same, until
+The lane ends and once more all is the same.
+
+@A Edward Thomas
+#
+@T In Memoriam (Easter, 1915)
+
+The flowers left thick at nightfall in the wood
+This Eastertide call into mind the men,
+Now far from home, who, with their sweethearts, should
+Have gathered them and will do never again.
+
+@A Edward Thomas
+#
+@T Failure
+
+Because God put His adamantine fate
+Between my sullen heart and its desire,
+I swore that I would burst the Iron Gate,
+Rise up, and curse Him on His throne of fire.
+Earth shuddered at my crown of blasphemy,
+But Love was as a flame about my feet;
+Proud up the Golden Stair I strode; and beat
+Thrice on the Gate, and entered with a cry -
+
+All the great courts were quiet in the sun,
+And full of vacant echoes: moss had grown
+Over the glassy pavement, and begun
+To creep within the dusty council-halls.
+An idle wind blew round an empty throne
+And stirred the heavy curtains on the walls.
+
+@A Rupert Brooke
+#
+@T Sonnet
+
+I said I splendidly loved you; it's not true.
+Such long swift tides stir not a land-locked sea.
+On gods or fools the high risk falls - on you -
+The clean clear bitter-sweet that's not for me.
+Love soars from earth to ecstasies unwist.
+Love is flung Lucifer-like from Heaven to Hell.
+But - there are wanderers in the middle mist,
+Who cry for shadows, clutch, and cannot tell
+Whether they love at all, or, loving, whom:
+An old song's lady, a fool in fancy dress,
+Or phantoms, or their own face on the gloom;
+For love of Love, or from heart's loneliness.
+Pleasure's not theirs, nor pain. They doubt, and sigh,
+And do not love at all. Of these am I.
+
+@A Rupert Brooke
+#
+@T The Hill
+
+Breathless, we flung us on the windy hill,
+Laughed in the sun, and kissed the lovely grass.
+You said, `Through glory and ecstasy we pass;
+Wind, sun, and earth remain, the birds sing still,
+When we are old, are old...'  `And when we die
+All's over that is ours; and life burns on
+Through other lovers, other lips,' said I,
+`Heart of my heart, our heaven is now, is won!'
+
+`We are Earth's best, that learnt her lesson here.
+Life is our cry. We have kept the faith!' we said;
+`We shall go down with unreluctant tread
+Rose-crowned into the darkness!' ...Proud we were,
+And laughed, that had such brave true things to say,
+- And then you suddenly cried, and turned away.
+
+@A Rupert Brooke
+#
+@T Song
+
+All suddenly the wind comes soft,
+And Spring is here again;
+And the hawthorn quickens with buds of green,
+And my heart with buds of pain.
+
+My heart all Winter lay so numb,
+The earth so dead and frore,
+That I never thought the Spring would come,
+Or my heart wake any more.
+
+But Winter's broken and earth has woken.
+And the small birds cry again;
+And the hawthorn hedge puts forth its buds,
+And my heart puts forth its pain.
+
+@A Rupert Brooke
+#
+@T The Way that Lovers Use
+
+The way that lovers use is this:
+They bow, catch hands, with never a word,
+And their lips meet, and they do kiss,
+- So I have heard.
+
+They queerly find some healing so,
+And strange attainment in the touch;
+There is a secret lovers know,
+- I have read as much.
+
+And theirs is no longer joy nor smart,
+Changing or ending, night or day;
+But mouth to mouth, and heart on heart,
+- So lovers say.
+
+@A Rupert Brooke
+#
+@T Song
+
+The way of love was thus.
+He was born one winter's morn
+With hands delicious,
+And it was well with us.
+
+Love came our quiet way,
+Lit pride in us, and died in us,
+All in a winter's day.
+There is no more to say.
+
+@A Rupert Brooke
+#
+@T Sonnet Reversed
+
+Hand trembling towards hand; the amazing lights
+Of heart and eye. They stood on supreme heights.
+
+Ah, the delirious weeks of honeymoon!
+Soon they returned, and after strange adventures,
+Settled at Balham by the end of June.
+Their money was in Can. Pasc. B. Debentures,
+And in Antofagastas. Still he went
+Cityward daily; still she did abide
+At home. And both were really quite content
+With work and social pleasures. Then they died.
+They left three children (besides George, who drank):
+The eldest Jane, who married Mr Bell,
+William, the head-clerk in the County Bank,
+And Henry, a stock-broker, doing well.
+
+@A Rupert Brooke
+#
+@T A White Rose
+
+The red rose whispers of passion,
+And the white rose breathes of love;
+O, the red rose is a falcon,
+And the white rose is a dove.
+
+But I send you a cream-white rosebud
+With a flush on its petal tips;
+For the love that is purest and sweetest
+Has a kiss of desire on the lips.
+
+@A John Boyle O'Reilly
+#
+@T Urceus Exit
+
+I intended an Ode,
+And it turn'd to a Sonnet.
+It began 'a la mode',
+I intended an Ode;
+But Rose cross'd the road
+In her latest new bonnet;
+I intended an Ode;
+And it turn'd to a Sonnet.
+
+@A Austin Dobson
+#
+@T Pippa's Song
+
+The year's at the spring,
+And day's at the morn;
+Morning's at seven;
+The hill-side's dew-pearl'd;
+The lark's on the wing;
+The snail's on the thorn;
+God's in His heaven -
+All's right with the world!
+
+@A Robert Browning
+#
+@T Song
+
+She is not fair to outward view
+As many maidens be,
+Her loveliness I never knew
+Until she smiled on me;
+O, then I saw her eye was bright,
+A well of love, a spring of light!
+
+But now her looks are coy and cold,
+To mine they ne'er reply,
+And yet I cease not to behold
+The love-light in her eye:
+Her very frowns are fairer far
+Than smiles of other maidens are.
+
+@A Hartley Coleridge
+#
+@T Rondeau
+
+Jenny kiss'd me when we met,
+Jumping from the chair she sat in;
+Time, you thief, who love to get
+Sweets into your list, put that in!
+Say I'm weary, say I'm sad,
+Say that health and wealth have miss'd me,
+Say I'm growing old, but add,
+Jenny kiss'd me.
+
+@A J. H. Leigh Hunt
+#
+@T A Drinking Song
+
+Bacchus must now his power resign -
+I am the only God of Wine!
+It is not fit the wretch should be
+In competition set with me,
+Who can drink ten times more than he.
+
+Make a new world, ye powers divine!
+Stock'd with nothing else but Wine:
+Let Wine its only product be,
+Let Wine be earth, and air, and sea -
+And let that Wine be all for me!
+
+@A Henry Carey
+#
+I never had a piece of toast
+Particularly long and wide,
+But fell upon the sanded floor
+And always on the buttered side.
+
+@A James Payn
+#
+@T Summer Evening
+
+The frog, half fearful, jumps across the path,
+And little mouse that leaves its hole at eve
+Nimbles with timid dread beneath the swath;
+My rustling steps awhile their joys deceive,
+Till past - and then the cricket sings more strong,
+And grasshoppers in merry mood still wear
+The short night weary with their fretting song.
+Up from behind the mole-hill jumps the hare,
+Cheat of his chosen bed, and from the bank
+The yellowhammer flutters in short fears
+From off its nest hid in the grasses rank,
+And drops again when no more noise it hears.
+Thus nature's human link and endless thrall,
+Proud man, still seems the enemy of all.
+
+@A John Clare
+#
+@T Diamond Cut Diamond
+
+Two cats
+One up a tree
+One under the tree
+The cat up a tree is he
+The cat under the tree is she
+The tree is witch elm, just incidentally.
+He takes no notice  of she, she takes no notice of he.
+He stares at the woolly clouds passing, she stares at the tree.
+There's been a lot written about cats, by Old Possum, Yeats and
+Company
+But not Alfred de Musset or Lord Tennyson or Poe or anybody
+Wrote about one cat under, and one cat up, a tree.
+God knows why this should be left for me
+Except I like cats as cats be
+Especially one cat up
+And one cat under
+A witch elm
+Tree.
+
+@A Ewart Milne
+#
+@T Time and Love
+
+When I have seen by Time's fell hand defaced
+The rich proud cost of out-worn buried age;
+When sometime lofty towers I see down-razed,
+And brass eternal slave to mortal rage;
+
+When I have seen the hungry ocean gain
+Advantage on the kingdom of the shore,
+And the firm soil win of the watery main,
+Increasing store with loss, and loss with store;
+
+When I have seen such interchange of state,
+Or state itself confounded to decay,
+Ruin hath taught me thus to ruminate -
+That Time will come and take my Love away:
+
+- This thought is as a death, which cannot choose
+But weep to have that which it fears to lose.
+
+@A William Shakespeare
+#
+Under the greenwood tree
+Who loves to lie with me,
+And turn his merry note
+Unto the sweet bird's throat -
+Come hither, come hither, come hither !
+Here shall he see
+No enemy
+But winter and rough weather.
+
+Who doth ambition shun
+And loves to live i' the sun,
+Seeking the food he eats
+And pleased with what he gets -
+Come hither, come hither, come hither!
+Here shall he see
+No enemy
+But winter and rough weather.
+
+@A William Shakespeare
+#
+@T Absence
+
+Being your slave, what should I do but tend
+Upon the hours and times of your desire?
+I have no precious time at all to spend
+Nor services to do, till you require:
+
+Nor dare I chide the world-without-end hour
+Whilst I, my sovereign, watch the clock for you,
+Nor think the bitterness of absence sour
+When you have bid your servant once adieu:
+
+Nor dare I question with my jealous thought
+Where you may be, or your affairs suppose,
+But like a sad slave, stay and think of nought
+Save, where you are, how happy you make those;-
+
+So true a fool is love, that in your will,
+Though you do anything, he thinks no ill.
+
+@A William Shakespeare
+#
+To me, fair Friend, you never can be old,
+For as you were when first your eye I eyed
+Such seems your beauty still. Three winters cold
+Have from the forests shook three summers' pride;
+Three beauteous springs to yellow autumn turn'd
+In process of the seasons have I seen,
+Three April perfumes in three hot Junes burn'd,
+Since first I saw you fresh, which yet are green.
+
+Ah! yet doth beauty, like a dial-hand,
+Steal from his figure, and no pace perceived;
+So your sweet hue, which methinks still doth stand,
+Hath motion, and mine eye may be deceived:
+
+For fear of which, hear this, thou age unbred,-
+Ere you were born, was beauty's summer dead.
+
+@A William Shakespeare
+#
+@T To His Love
+
+Shall I compare thee to a summer's day?
+Thou art more lovely and more temperate:
+Rough winds do shake the darling buds of May,
+And summer's lease hath all too short a date:
+
+Sometime too hot the eye of heaven shines,
+And often is his gold complexion dimm'd:
+And every fair from fair sometime declines,
+By chance, or nature's changing course, untrimm'd.
+
+But thy eternal summer shall not fade
+Nor lose possession of that fair thou owest;
+Nor shall death brag thou wanderest in his shade,
+When in eternal lines to time thou growest:
+
+So long as men can breathe, or eyes can see,
+So long lives this, and this gives life to thee.
+
+@A William Shakespeare
+#
+@T Carpe Diem
+
+O Mistress, where are you roaming?
+O stay and hear! your true-love's coming
+That can sing both high and low;
+Trip no further, pretty sweeting,
+Journey's end in lovers' meeting -
+Every wise man's son doth know.
+
+What is love? 'tis not hereafter;
+Present mirth hath present laughter;
+What's to come is still unsure;
+In delay there lies no plenty,-
+Then come kiss me, Sweet-and-twenty,
+Youth's a stuff will not endure.
+
+@A William Shakespeare
+#
+@T A Sea Dirge
+
+Full fathom five thy father lies:
+Of his bones are coral made;
+Those are peals that were his eyes;
+Nothing of him that doth fade
+But doth suffer a sea-change
+Into something rich and strange.
+Sea-nymphs hourly ring his knell;
+Hark! now I hear them,-
+Ding, dong, bell.
+
+@A William Shakespeare
+#
+@T On the Tombs in Westminster Abbey
+
+Mortality, behold and fear,
+What a change of flesh is here!
+Think how many royal bones
+Sleep within these heaps of stones;
+Here they lie, had realms and lands,
+Who now want strength to stir their hands,
+Where from their pulpits seal'd with dust
+They preach, `In greatness is no trust.'
+Here's an acre sown indeed
+With the richest royallest seed
+That the earth did e'er suck in
+Since the first man died for sin:
+Here the bones of birth have cried
+`Though gods they were, as men they died!'
+Here are sands, ignoble things,
+Dropt from the ruin'd sides of kings:
+Here's a world of pomp and state
+Buried in dust, once dead by fate.
+
+@A F. Beaumont
+#
+@T The Terror of Death
+
+When I have fears that I may cease to be
+Before my pen has glean'd my teeming brain,
+Before high-piled books, in charact'ry
+Hold like rich garners the full-ripen'd grain;
+
+When I behold, upon the night's starr'd face,
+Huge cloudy symbols of a high romance,
+And think that I may never live to trace
+Their shadows, with the magic hand of chance;
+
+And when I feel, fair creature of an hour!
+That I shall never look upon thee more,
+Never have relish in the fairy power
+Of unreflecting love - then on the shore
+
+Of the wide world I stand alone, and think
+Till love and fame to nothingness do sink.
+
+@A J. Keats
+#
+@T Young and Old
+
+When all the world is young, lad,
+And all the trees are green;
+And every goose a swan, lad,
+And every lass a queen;
+Then hey for boot and horse, lad,
+And round the world away;
+Young blood must have its course, lad,
+And every dog his day.
+
+When all the world is old, lad,
+And all the trees are brown;
+And all the sport is stale, lad,
+And all the wheels run down;
+Creep home, and take your place there,
+The spent and maimed among:
+God grant you find one face there,
+You loved when all was young.
+
+@A C. Kingsley
+#
+@T Pied Beauty
+
+Glory be to God for dappled things-
+For skies of couple-colour as a brindled cow;
+For rose-moles all in stipple upon trout that swim;
+Fresh-firecoal chestnut-falls; finches' wings;
+Landscape plotted and pieced - fold, fallow, and plough;
+And all trades, their gear and tackle and trim.
+
+All things counter, original, spare, strange;
+Whatever is fickle, freckled (who knows how?)
+With swift, slow; sweet, sour; adazzle, dim;
+He fathers-forth whose beauty is past change:
+Praise Him.
+
+@A Gerard Manley-Hopkins
+#
+@T The Lake Isle of Innisfree
+
+I will arise, and go to Innisfree,
+And a small cabin build there, of clay and wattles made;
+Nine bean rows will I have there, a hive for the hiney bee,
+And live alone in the bee-loud glade.
+
+And I shall have some peace there, for peace comes dropping slow,
+Dropping from the veils of the morning to where the cricket sings;
+There midnight's all a-glimmer, and noon a purple glow,
+And evening full of the linnet's wings.
+
+I will arise and go now, for always night and day
+I hear lake water lapping with low sounds by the shores;
+While I stand on the roadway, or on the pavements gray,
+I hear it in the deep heart's core.
+
+@A W.B. Yeats
+#
+@T The Soldier
+
+If I should die, think only this of me:
+That there's some corner of a foreign field
+That is for ever England. There shall be
+In that rich earth a richer dust concealed;
+A dust whom England bore, shaped, made aware,
+Gave, once, her flowers to love, her ways to roam,
+Washed by the rivers, blest by suns of home.
+
+And think, this heart, all evil shed away,
+A pulse in the eternal mind, no less
+Gives somewhere back the thoughts by England given;
+Her sights and sounds; dreams happy as her day;
+And laughter, learnt of friends; and gentleness,
+In hearts at peace, under an English heaven.
+
+@A Rupert Brooke
+#
+@T Towers
+
+Protected from the gales, we,
+By the line of trees along the bank
+From storms that batter Fife
+And life here through the changing seasons -
+Unchanging, a lonely beauty,
+No reason to look to the rush
+Beyond the rustle of the bushes.
+But through the curtain of our trees,
+The distant towers like castle turrets
+Gleam by day and shine by night,
+Holding, choking
+Invisible souls within the shearing concrete height.
+
+@A Julian Smart
+#
+@T Break of Day
+
+Tis true, 'tis day; what though it be?
+O wilt thou therefore rise from me?
+Why should we rise, because 'tis light?
+Did we lie down, because 'twas night?
+Love which in spite of darkness brought us hither,
+Should in despite of light keep us together.
+
+Light hath no tongue, but is all eye;
+If it could speak as well as spy,
+This were the worst, that it could say,
+That being well, I fain would stay,
+And that I loved my heart and honour so,
+That I would not from him, that had them, go.
+
+Must business thee from hence remove?
+Oh, that's the worst disease of love,
+The poor, the foul, the false, love can
+Admit. but not the busied man.
+He which hath business, and makes love, doth do
+Such wrong, as when a married man doth woo.
+
+@A John Donne
+#
+@T The Computation
+
+For the first twenty years, since yesterday,
+I scarce believed, thou could'st be gone away,
+For forty more, I fed on favours past,
+And forty on hopes, that thou would'st, they might last.
+Tears drowned one hundred, and sighs blew out two,
+A thousand, I did neither think, nor do,
+Or not divide, all being one thought of you;
+Or in a thousand more, forget that too.
+Yet call not this long life; but think that I
+Am, by being dead, immortal; can ghosts die?
+
+@A John Dunne
+#
+@T A Red, Red Rose
+
+O, my love's like a red, red rose,
+That's newly sprung in June.
+O, my love's like the melodie,
+That's sweetly play'd in tune.
+
+As fair art thou, my bonnie lass,
+So deep in love am I,
+And I will love thee still, my Dear,
+Till a' the seas gang dry.
+
+Till a' the seas gang dry, my Dear,
+And the rocks melt wi' the sun!
+O, I will love thee still, my Dear,
+While the sands o' life shall run.
+
+And fare thee weel, my only Love,
+And fare thee weel a while!
+And I will come again, my Love,
+Tho' it were ten thousand mile!
+
+@A Robert Burns
+#
+@T On Charles II
+
+Here lies our sovereign Lord the King,
+Whose word no man relies on,
+Who never said a foolish thing
+Nor ever did a wise one.
+
+@A Earl of Rochester
+#
+@T The Four Georges
+
+George the First was always reckoned
+Vile - but viler George the Second;
+And what mortal ever heard
+Any good of George the Third?
+When from earth the Fourth descended,
+God be praised, the Georges ended!
+
+@A W.S. Landor
+#
+@T Frederick, Prince of Wales
+
+Here lies Fred,
+Who was alive, and is dead,
+Had it been his father,
+I had much rather.
+Had it been his brother,
+Still better than another.
+Had it been his sister,
+No one would have missed her.
+Had it been the whole generation,
+Still better for the nation.
+But since 'tis only Fred,
+Who was alive, and is dead,
+There's no more to be said.
+
+@A W.M. Thackeray
+#
+@T On an Old Woman
+
+Mycilla dyes her locks, 'tis said,
+But 'tis a foul aspersion;
+She buys them black, they therefore need
+No subsequent immersion.
+
+@A W. Cowper
+#
+@T An Epitaph on Sir John Vanbrugh (Architect)
+
+Under this stone, reader, survey
+Dead Sir John Vanbrugh's house of clay.
+Lie heavy on him, earth! for he
+Laid many heavy loads on thee.
+
+@A A. Evans
+#
+@T True Joy in Possession
+
+To have a thing is little,
+If you're not allowed to show it,
+And to know a thing is nothing
+Unless others know you know it.
+
+@A Lord Neaves
+#
+@T To His Mistress Going To Bed
+
+Come, Madam, come, all rest my powers defy,
+Until I labour, I in labour lie.
+The foe oft-times having the foe in sight,
+Is tired with standing though he never fight.
+Off with that girdle, like heaven's zone glistering,
+But a far fairer world encompassing.
+Unpin that spangled breastplate which you wear,
+That th'eyes of busy fools may be stopt there.
+Unlace yourself, for that harmonious chime
+Tells me from you, that now it is bed time.
+Off with that happy busk, which I envy,
+That still can be, and still can stand so nigh.
+Your gown going off, such beauteous state reveals,
+As when from flowry meads the hill's shadow steals.
+@P
+Off with that wiry coronet and show
+The hairy diadem which on you doth grow:
+Now off with those shoes, and then safely tread
+In this love's hallowed temple, this soft bed.
+In such white robes, heaven's angels used to be
+Received by men; thou angel bring'st with thee
+A heaven like Mahomet's Paradise; and though
+Ill spirits walk in white, we easily know,
+By this these angels from an evil sprite,
+Those set our hairs, but these our flesh upright.
+
+Licence my roving hands, and let them go,
+Before, behind, between, above, below.
+O my America! my new-found-land,
+My kingdom, safeliest when with one man manned,
+My mine of precious stones, My empery,
+How blest am I in this discovering thee!
+To enter in these bonds, is to be free;
+Then where my hand is set, my seal shall be.
+@P
+Full nakedness! All joys are due to thee,
+As souls unbodied, bodies unclothed must be,
+To taste whole joys.  Gems which you women use
+Are like Atlanta's balls, cast in men's views,
+That when a fool's eye lighteth on a gem,
+His earthly soul may covet theirs, not them.
+Like pictures, or like books' gay coverings made
+For lay-men, are all women this arrayed;
+Themselves are mystic books, which only we
+(Whom their imputed grace will dignify)
+Must see revealed. Then since that I may know,
+As liberally, as to a midwife, show
+Thyself: cast all, yea, this white linen hence,
+There is no penance due to innocence.
+
+To teach thee, I am naked first; why then
+What needst thou have more covering than a man.
+
+@A John Donne
+#
+@T Cheltenham Waters
+
+Here lie I and my four daughters,
+Killed by drinking Cheltenham waters.
+Had we but stuck to Epsom salts,
+We wouldn't have been in these here vaults.
+
+@A Anonymous
+#
+@T Hypocrisy
+
+Hypocrisy will serve as well
+To propagate a church as zeal;
+As persecution and promotion
+Do equally advance devotion:
+So round white stones will serve, they say,
+As well as eggs to make hens lay.
+
+@A Samuel Butler
+#
+@T The Microbe
+
+The Microbe is so very small
+You cannot make him out at all,
+But many sanguine people hope
+To see him through a microscope.
+His jointed tongue that lies beneath
+A hundred curious rows of teeth;
+His seven tufted tails with lots
+Of lovely pink and purple spots,
+On each of which a pattern stands,
+Composed of forty separate bands;
+His eyebrows of a tender green;
+All of these have never yet been seen -
+But Scientists, who ought to know,
+Assures us that they must be so...
+Oh! let us never, never doubt
+What nobody is sure about!
+
+@A Hilaire Belloc
+#
+@T Slug
+
+Slugs, soft upon damp carpets of rich food,
+Make sullen love with bubbles and with sighs,
+Silvery flaccid.  They consider lewd
+The use of eyes.
+
+@A John Pudney
+#
+@T The Doctor Prescribes
+
+A lady lately, that was fully sped
+Of all the pleasures of the marriage-bed
+Ask'd a physician, whether were more fit
+For Venus' sports, the morning or the night?
+The good old man made answer, as 'twas meet,
+The morn more wholesome, but the night more sweet.
+Nay then, i'faith, quoth she, since we have leisure,
+We'll to't each morn for health, each night for pleasure.
+
+@A Anonymous
+#
+@T On Mary Ann
+
+Mary Ann has gone to rest,
+Safe at last on Abraham's breast,
+Which may be nuts for Mary Ann,
+But is certainly rough on Abraham.
+
+@A Anonymous
+#
+@T Misfortunes never come Singly
+
+Making toast at the fireside,
+Nurse fell in the grate and died;
+And what makes it ten times worse,
+All the toast was burnt with nurse.
+
+@A Harry Graham
+#
+@T Tender Heartedness
+
+Billy, in one of his nice new sashes,
+Fell in the fire and was burnt to ashes;
+Now, although the room grows chilly,
+I haven't the heart to poke poor Billy.
+
+@A Harry Graham
+#
+@T Miss Twye
+
+Miss Twye was soaping her breasts in her bath
+When she heard behind her a meaning laugh
+And to her amazement she discovered
+A wicked man in the bathroom cupboard.
+
+@A Gavin Ewart
+#
+@T The Old Loony of Lyme
+
+There was an old loony of Lyme,
+Whose candour was simply sublime;
+When they asked, 'Are you there?'
+'Yes,' he said, 'but take care,
+For I'm never "all there" at a time.'
+
+@A Anonymous
+#
+@T The Young Lady from Wantage
+
+There was a young lady from Wantage
+Of whom the town clerk took advantage.
+Said the borough surveyor:
+'Indeed you must pay `er.
+You've totally altered her frontage.'
+
+@A Anonymous
+#
+@T The Modern Hiawatha
+
+When he killed the Mudjokivis
+Of the skin he made him mittens,
+Made them with the fur side inside,
+Made them with the skin side outside,
+He, to get the warm side inside,
+Put the inside skin side outside;
+He, to get the cold side outside,
+Put the warm side fur side inside.
+That's why he put fur side inside,
+Why he put the skin side outside,
+Why he turned them inside outside.
+
+@A Anonymous
+#
+@T Is it a Month
+
+Is it a month since I and you
+In the starlight of Glen Dubh
+Stretched beneath a hazel bough
+Kissed from ear and throat to brow,
+Since your fingers, neck, and chin
+Made the bars that fence me in,
+Till Paradise seemed but a wreck
+Near your bosom, brow and neck
+And stars grew wilder, growing wise,
+In the splendour of your eyes!
+Since the weasel wandered near
+Whilst we kissed from ear to ear
+And the wet and withered leaves
+Blew about your cap and sleeves,
+Till the moon sank tired through the ledge
+Of the wet and windy hedge?
+And we took the starry lane
+Back to Dublin town again.
+
+@A J. M. Synge
+@A (1871-1909)
+#
+@T The Lark in the Clear Air
+
+Dear thoughts are in my mind,
+And my soul soars enchanted,
+As I hear the sweet lark sing
+In the clear air of the day.
+For a tender beaming smile
+To my hope has been granted,
+And tomorrow she shall hear
+All my fond heart would say.
+
+I shall tell her all my love,
+All my soul's adoration;
+And I think she will hear me
+And will not say me nay.
+It is this that fills my soul
+With its joyous elation,
+As I hear the sweet lark sing
+In the clear air of the day.
+
+@A Samuel Ferguson
+@A (1810-1886)
+#
+@T The Self-Unseeing
+
+Here is the ancient floor,
+Footworn and hollowed and thin,
+Here was the former door
+Where the dead feet walked in.
+
+She sat here in her chair,
+Smiling into the fire;
+He who played stood there,
+Bowing it higher and higher.
+
+Childlike, I danced in a dream;
+Blessings emblazoned that day;
+Everything glowed with a gleam;
+Yet we were looking away!
+
+@A Thomas Hardy
+#
+@T Cean Dubh Deelish (Darling Black Head)
+
+Put your head, darling, darling, darling,
+Your darling black head my heart above;
+O mouth of honey, with thyme for fragrance,
+Who, with heart in breast, could deny you love?
+
+O many and many a young girl for me is pining,
+Letting her locks of gold to the cold wind free,
+For me, the foremost of our gay young fellows;
+But I'd leave a hundred, pure love, for thee!
+
+Put your head, darling, darling, darling,
+Your darling black head my heart above;
+O mouth of honey, with thyme for fragrance,
+Who, with heart in breast, could deny you love?
+
+@A Samuel Ferguson
+@A (1810-1886)
+#
+@T From 'The Amores'
+
+Ring of mine, made to encircle my pretty mistress's finger,
+Valuable only in terms of the giver's love,
+Go, and good welcome! May she receive you with pleasure,
+Slip you over her knuckle there and then.
+May you fit her as well as she fits me, rub snugly
+Around her finger, precisely the right size!
+Lucky ring to be handled by my mistress!  I'm developing
+A miserable jealousy of my own gift.
+But suppose I could be the ring, transformed in an instant
+By some famous magician's art -
+Then, when I felt like running my hand down Corinna's
+Dress, and exploring her breasts, I'd work
+Myself off her finger (tight squeeze or not) and by crafty
+Cunning drop into her cleavage.  Let's say
+She was writing a private letter - I'd have to seal it,
+@P
+And a dry stone sticks on wax:
+She's moisten me with her tongue. Pure bliss - provided
+I didn't have to endorse any hostile remarks
+Against myself. If she wanted to put me away in her
+Jewel-box, I'd cling tighter, refuse to budge.
+(Don't worry, my sweet, I'd never cause you discomfort,
+or burden
+Your slender finger with an unwelcome weight.)
+Wear me whenever you take a hot shower, don't worry
+If water runs under your gem -
+Though I fancy the sight of you naked would arise my
+passions, leave me
+A ring of visibly virile parts...
+Pure wishful thinking! On your way, then, little present,
+And show her you come with all my love.
+
+@A Ovid
+@A (BC 43-AD 17)
+#
+@T After an Interval
+
+After an interval, reading, here in the midnight,
+With the great stars looking on -- all the starts of Orion looking,
+And the silent Pleiades -- and the duo looking of Saturn and ruddy Mars;
+Pondering, reading my own songs, after a long interval,
+(sorrow and death familiar now)
+Ere Closing the book, what pride! what joy! to find them
+Standing so well the test of death and night,
+And the duo of Saturn and Mars!
+
+@A Walt Whitman
+#
+@T A Last Poem
+
+A last poem, and a last, and yet another --
+O, when can I give over?
+Must I drive the pen until the blood bursts from my nails
+And my breath fails and I shake with fever?
+Shall I never hear her whisper softly,
+"But this is one written by you only,
+And for me only; therefore, love, have done"?
+
+@A Robert Graves
+#
+I have no pain, dear Mother, now,
+But, oh, I am so dry;
+So connect me to a brewery,
+And leave me there to die.
+
+@A Anonymous
+#
+@T Found Poem (from the Hound of the Baskervilles)
+
+I stooped, panting, and pressed my pistol
+To the dreaful, shimmering head,
+But it was useless to press the trigger,
+The giant hound was dead.
+
+@A A. Conan Doyle
+#
+@T Passing through the Carron Iron Works
+
+We cam na here to view your warks,
+In hopes to be mair wise,
+But only, lest we gang to Hell,
+It may be nae surprise.
+
+@A Robert Burns
+#
+@T Imitation of Pope: A Compliment to the Ladies
+
+Wondrous the Gods, more wondrous are the Men,
+More Wondrous Wondrous still the Cock & Hen,
+More Wondrous still the Table, Stool & Chair;
+But Ah! More wondrous still the Charming Fair.
+
+@A William Blake
+#
+@T Upon the Nipples of Julia's Breast
+
+Have ye beheld (with much delight)
+A red rose peeping through a white?
+Or else a cherry (double grac'd)
+Within a lily? Centre plac'd?
+Or ever mark'd the pretty beam,
+A strawberry shows half drown'd in cream?
+Or seen rich rubies blushing through
+A pure smooth pearl, and orient too?
+So like to this, nay all the rest,
+Is each neat niplet of her breast.
+
+@A Robert Herrick
+#
+@T Life
+
+When I consider life, 'tis all a cheat;
+Yet, fooled with hope, men favour the deceit;
+Trust on, and think tomorrow will repay:
+Tomorrow's falser than the former day;
+Lies worse; and while it says, we shall be blessed
+With some new joys, cut off what we possessed.
+Strange cozenage! None would live past years again,
+Yet all hope pleasure in what yet remain;
+And from the dregs of life think to receive
+What the first sprightly running could not give.
+
+@A John Dryden
+#
+@T To a Yellow Hammer
+
+Poor yellow-breasted little thing,
+I would thou had'st been on the wing,
+'Ere 'twas my fate on thee to bring
+Thy death so soon;
+Thou'lt never more be heard to sing
+In joyful tune.
+
+Too late I saw thee 'mongst the dust,
+Gambling so gay in simple trust,
+I knew that with my wheel I must
+Thy life destroy;
+How cruel quick my rubber crushed
+Thee in thy joy.
+
+@A Anonymous
+#
+@T Wrecked
+
+A girl, a wheel,
+A shock, a squeal,
+A header, a thump,
+A girl in a lump,
+A bloomer all torn,
+A maiden forlorn.
+
+@A Annymous
+#
+@T Gather ye Rosebuds
+
+Gather ye rosebuds while ye may,
+Old Time is still a-flying;
+And this same flower that smiles today
+Tomorrow will be dying.
+
+The glorious lamp of heaven, the Sun,
+The higher he's a-getting,
+The sooner will his race be run,
+And nearer he's to setting.
+
+That age is best, which is the first,
+When youth and blood are warmer
+But being spent, the worse, and worst
+Times still succeed the former.
+
+Then be not coy, but use your time,
+And while you may, go marry;
+For having lost but once your prime,
+You may for ever tarry.
+
+@A Robert Herrick
+#
+@T My Love's a Match
+
+My love's a match in beauty
+For every flower that blows,
+Her little ear's a lily,
+Her velvet cheek a rose;
+Her locks like gilly gowans
+Hang golden to her knww.
+If I were King of Ireland,
+My Queen she'd surely be.
+
+Her eyes are fond forget-me-nots,
+And no such snow is seen
+Upon the heaving hawthorn bush
+As crests her bodice green.
+The thrushes when she's talking
+Sit listening on the tree.
+If I were King of Ireland,
+My Queen she'd surely be.
+
+@A Alfred P. Graves
+#
+@T In a Gondola
+
+The moth's kiss, first!
+Kiss me as if you made believe
+You were not sure, this eve,
+How my face, your flower, had pursed
+Its petals up; so, here and there
+You brush it, till I grow aware
+Who wants me, and wide ope I burst.
+
+The bee's kiss, now!
+Kiss me as if you enter'd gay
+My heart at some noonday,
+A bud that dares not disallow
+The claim, so all is render'd up,
+And passively its shatter'd cup
+Over your head to sleep I bow.
+
+@A Robert Browning
+#
+@T To his Coy Mistress
+
+Had we but worlds enough, and time,
+This coyness, Lady, were no crime.
+We would sit down and think which way
+To walk and pass our long love's day.
+Thou by the Indian Ganges' side
+Shouldst rubies find: I by the tide
+Of Humber would complain. I would
+Love you ten years before the Flood,
+And you should, if you please, refuse
+Till the conversion of the Jews.
+My vegetable love should grow
+Vaster than empires, and more slow;
+An hundred years should go to praise
+Thine eyes and on thy forehead gaze;
+Two hundred to adore each breast,
+But thirty thousand to the rest;
+An age at least to every part,
+And the last age should show your heart.
+For, Lady, you deserve this state,
+Nor would I love at a lower rate.
+@P
+But at my back I always hear
+Time's winged chariot hurrying near;
+And yonder all before us lie
+Deserts of vast eternity.
+Thy beauty shall no more be found,
+Nor, in thy marble vault, shall sound
+My echoing song: then worms shall try
+That long preserved virginity,
+And your quaint honour turn to dust,
+And into ashes all my lust:
+The grave's a fine and private place,
+But none, I think, do there embrace.
+@P
+Now therefore, while the youthful hue
+Sits on thy skin like morning dew,
+And while thy willing soul transpires
+At every port with instant fires,
+Now let us sport us while we may,
+And now, like amorous birds of prey,
+Rather at once our time devour
+Than languish in his slow-chapt power.
+Let us roll all our strength and all
+Our sweetness up into one ball,
+And tear our pleasures with rough strife
+Through the iron gates of life:
+Thus, though we cannot make our sun
+Stand still, yet we will make him run.
+
+@A Andrew Marvell
+#
+@T Destiny
+
+Somewhere there waiteth in this world of ours
+For one lone soul another lonely soul,
+Each choosing each through all the weary hours
+And meeting strangely at one sudden goal.
+Then blend they, like green leaves with golden flowers,
+Into one beautiful and perfect whole;
+And life's long night is ended, and the way
+Lies open onward to eternal day.
+
+@A Edwin Arnold
+#
+@T A Stolen Kiss
+
+Now gentle sleep hath closed up those eyes
+Which, waking, kept my boldest thoughts in awe;
+And free access unto that sweet lip lies,
+From whence I long the rosy breath to draw.
+
+Methinks no wrong it were, if I should steal
+From those two melting rubies one poor kiss;
+None sees the theft that would the theft reveal,
+Nor rob I her of aught that she can miss;
+
+Nay, should I twenty kisses take away,
+There would be little sign I would do so;
+Why then should I this robbery delay?
+O, she may wake, and therewith angry grow!
+
+Well, if she do, I'll back restore that one,
+And twenty hundred thousand more for loan.
+
+@A George Wither
+#
+@T How do I love thee?
+
+How do I love thee? Let me count the ways.
+I love thee to the depth and breadth and height
+My soul can reach, when feeling out of sight
+For the ends of Being and ideal Grace.
+I love thee to the level of every day's
+Most quiet need, by sun and candlelight.
+I love thee freely, as men strive for Right;
+I love thee purely, as they turn from Praise.
+I love thee with the passion put to use
+In my old griefs, and with my childhood's faith.
+I love thee with a love I seemed to lose
+With my lost saints, -- I love thee with the breath,
+Smiles, tears, of all my life! -- and, if God choose,
+I shall but love thee better after death.
+
+@A Elizabeth Barrett Browning
+#
+@T Old Man
+
+Old Man, or Lad's-love, -- in the name there's nothing
+To one that knows not Lad's-love, or Old Man,
+The hoar-green feathery herb, almost a tree,
+Growing with rosemary and lavendar.
+Even to one that knows it well, the names
+Hald decorate, half perplex, the thing it is:
+At least, what that is clings not to the names
+In spite of time.  And yet I like the names.
+
+The herb itself I like not, but for certain
+I love it, as some day the child will love it
+Who plucks a feather from the door-side bush
+Whenever she goes in or out of the house.
+Often she waits there, snipping the tips and shrivelling
+The shreds at last on to the path, perhaps
+@P
+Thinking, perhaps of nothing, till she sniffs
+Her finger and runs off. The bush is still
+But half as tall as she, though it is as old;
+So well she clips it. Not a word she says;
+And I can only wonder hwo much hereafter
+She will remember, with that bitter scent,
+Of garden rows, and ancient damson-trees
+Topping a hedge, a bent path to a door,
+A low thick bush beside the door, and me
+Forbidding her to pick.
+
+As for myself,
+Where first I met the bitter scent is lost.
+I, too, often shrivel the grey shreds,
+Sniff them and think and sniff again and try
+Once more to think what it is I am remembering,
+Always in vain. I cannot like the scent,
+Yet I would rather give up others more sweet,
+With no meaning, that this bitter one.
+@P
+I have mislaid the key. I sniff the spray
+And think of nothing; I see and I hear nothing;
+Yet seem, too, to be listening, lying in wait
+For what I should, yet never can, remember:
+No garden appears, no path, no hoar-green bush
+Of Lad's-love, or Old Man, no child beside,
+Neither father nor mother, nor any playmate;
+Only an avenue, dark and nameless, without end.
+
+@A Edward Thomas
+#
+@T The Manor Farm
+
+The rock-like mud unfroze a little and rills
+Ran and sparkled down each side of the road
+Under the catkins wagging in the hedge.
+But earth would have her sleep out, spite of the sun;
+Nor did I value that thin gilding beam
+More than a pretty February thing
+Till I came down to the old Manor Farm,
+And church and yet-tree opposite, in age
+Its equal and in size. Small church, great yew,
+And farmhouse slept in a Sunday silentness.
+The air raised not a straw. The steep farm roof,
+With tiles duskily glowing, entertained
+The midday sun; and up and down the roof
+White pigeons nestled. There was no sound but one.
+Three cart-horses were looking over a gate
+Drowsily through their forelocks, swiching their tails
+Against a fly, a solitary fly.
+@P
+The Winter's cheek flushed as if he had drained
+Spring, Summer, and Autumn at a draught
+And smiled quietly. But 'twas not Winter --
+Rather a season of bliss unchangeable
+Awakened from farm and church where it had lain
+Safe under tile and thatch for ages since
+This England, Old already, was called Merry.
+
+@A Edward Thomas
+#
+@T The Unknown Bird
+
+Three lovely notes he whistled, too soft to be heard
+If others sang; but others never sang
+In the great beech-wood all that May and June.
+No one saw him: I alone could hear him
+Though many listened. Was it but four years
+Ago? or five? He never came again.
+Oftenest when I heard him I was alone,
+Nor could I ever make another hear.
+La-la-la! he called, seeming far-off --
+As if a cock crowed past the edge of the world,
+As if the bird or I were in a dream.
+Yet that he travelled through the trees and soometimes
+Neared me, was plain, though somehow distant still
+He sounded. All the proof is -- I told men
+What I had heard.
+@P
+I never knew a voice,
+Man, beast, or bird, better than this. I told
+The naturalists; but neither had they heard
+Anything like the notes that did so haunt me
+I had them clear by heart and have them still.
+Four years, or five, have made no difference. Then
+As now that La-la-la! was bodiless sweet:
+Sad more than joyful it was, if I must say
+'Twas sad only with joy too, too far off
+For me to taste it. But I cannot tell
+If truly never anything but fair
+The days were when he sang, as now they seem.
+This surely I know, that I who listened then,
+Happy sometimes, sometimes suffering
+A heavy body and a heavy heart,
+Now straightaway, if I think of it, become
+Light as that bird wandering beyond my shore.
+
+@A Edward Thomas
+#
+@T First known when lost
+
+I never had noticed it until
+'Twas gone, -- the narrow copse
+Where now the woodman lops
+The last of the willows with his bill.
+
+It was not more than a hedge o'ergrown.
+One meadow's breadth away
+I passed it day by day.
+Now the soil is bare as a bone,
+
+And black betwixt two meadows green,
+Though fresh-cut faggot ends
+Of hazel make some amends
+With a gleam as if flowers they had been.
+
+Strange it could have hidden so near!
+And now I see as I look
+That the small winding brook,
+A tributary's tributary rises there.
+
+@A Edward Thomas
+#
+@T The Owl
+
+Downhill I came, hungry, and yet not starved;
+Cold, yet had heat within me that was proof
+Against the North wind: tired, yet so that rest
+Had seemed the sweetest thing under a roof.
+
+Then at the inn I had food, fire, and rest,
+Knowing how hungry, cold and tired was I.
+All of the night was quite barred out except
+An owl's cry, a most melancholy cry
+
+Shaken out long and clear upon the hill,
+No merry note, nor cause of merriment,
+But one telling me plain what I escaped
+And others could not, that night, as in I went.
+
+And salted was my food, and my repose,
+Salted and sobered, too, by the bird's voice
+Speaking for all who lay under the stars,
+Soldiers and poor, unable to rejoice.
+
+@A Edward Thomas
+#
+@T But these things also
+
+But these things also are Spring's --
+On banks by the roadside the grass
+Long-dead that is greyer now
+Than all the Winter it was;
+
+The shell of a little snail bleached
+In the grass; chip of flint, and mite
+Of chalk; and the small bird's dung
+In splashes of purest white:
+
+All the white things a man mistakes
+For earliest violets
+Who seeks through Winter's ruins
+Something to pay Winter's debts,
+
+While the North blows, and starling flocks
+By chattering on and on
+Keeep their spirits up in the mist,
+And Spring's here, Winter's not gone.
+
+@A Edward Thomas
+#
+@T The New House
+
+Now first, as I shut the door,
+I was alone
+In the new house; and the wind
+Began to moan.
+
+Old at once was the house,
+And I was old;
+My ears were teased with the dread
+Of what was foretold,
+
+Nights of storm, days of mist, without end;
+Sad days when the sun
+Shone in vain: old griefs, and griefs
+Not yet begun.
+
+All was foretold me; naught
+Could I foresee;
+But I learnt how the wind would sound
+After these things should be.
+
+@A Edward Thomas
+#
+@T Lovers
+
+The two men in the road were taken aback.
+The lovers came out shading their eyes from the sun,
+And never was white so white, or black so black,
+As her cheeks and hair. 'There are more things than one
+A man might turn into a wood for, Jack,'
+Said George; Jack whispered: 'He has not got a gun.
+It's a bit too much of a good thing, I say.
+They are going the other road, look. And see her run.' --
+She ran -- 'What a thing it is, this picking may.'
+
+@A Edward Thomas
+#
+@T Melancholy
+
+The rain and wind, the rain and wind, raved endlessly.
+On me the Summer storm, and fever, and melancholy
+Wrought magic, so that if I feared the solitude
+Far more I feared all company: too sharp, too rude,
+Had been the wisest or the dearest human voice.
+What I desired I knew not, but whate'er my choice
+Vain it must be, I knew. Yet naught did my despair
+But sweeten the strange sweetness, while through the wild air
+All day long I heard a distant cuckoo calling
+And, soft as dulcimers, sounds of near water falling,
+And, softer, and remote as if in history,
+Rumours of what had touched my friends, my foes, or me.
+
+@A Edward Thomas
+#
+@T The Glory
+
+The glory of the beauty of the morning, --
+The cuckoo crying over the untouched dew;
+The blackbird that has found it, and the dove
+That tempts me on to something sweeter than love;
+White clouds ranged even and fair as new-mown hay;
+The heat, the stir, the sublime vancancy
+Of sky meadow and forest and my own heart: --
+The glory invites me, yet it leaves me scorning
+All I can ever do, all I can be,
+Beside the lovely of motion, shape, and hue,
+The happiness I fancy fit to dwell
+In beauty's presence. Shall I now this day
+@P
+Begin to seek as far as heaven, as hell,
+Wisdom or strength to match this beauty, start
+And tread the pale dust pitted with small dark drops,
+In hope to find whatever it is I seek,
+Hearkening to short-lived happy-seeming things
+That we know naught of, in the hazel copse?
+Or must I be content with discontent
+As larks and swallows are perhaps with wings?
+And shall I ask at the day's end once more
+What beauty is, and what I can have meant
+By happiness? And shall I let all go,
+Glad, weary, or both? Or shall I perhaps know
+That I was happy oft and oft before,
+Awhile forgetting how I am fast pent,
+How dreary-swift, with naught to travel to,
+Is Time? I cannot bite the day to the core.
+
+@A Edward Thomas
+#
+@T The Brook
+
+Seated by a brook, watching a child
+Chiefly that paddled, I was this beguiled.
+Mellow the blackbird sang and sharp the thrush
+Not far off in the oak and hazel brush,
+Unseen. There was a scent like honeycomb
+From mugwort dull. And down upon the dome
+Of the stone the card-horse kicks against so oft
+A butterfly alighted. From aloft
+He took the heat of the sun, and from below,
+On the hot stone he perched contented so,
+As if never a cart would pass again
+That way; as if I were the last of men
+And he the first of insects to have earth
+And sun together and to know their worth.
+@P
+I was divided between him and the gleam,
+The motion, and the voices, of the stream,
+The waters running frizzled over gravel,
+Thaat never vanish and for ever travel.
+A grey flycatcher silent on a fence
+And I sat as if we had been there since
+The horseman and the horse lying beneath
+The fir-tree-covered barrow on the heath,
+The horseman and the horse with silver shoes,
+Galloped the downs last. All that I could lose
+I lost. And then the child's voice raised the dead.
+'No one's been here before' was what she said
+And what I felt, yet never should have found
+A word for, while I gathered sight and sound.
+
+@A Edward Thomas
+#
+@T This is no case of petty right or wrong
+
+This is no case of petty right or wrong
+That politicians or philosphers
+Can judge. I hate not Germans, nor grow hot
+With love of Englishmen, to please newspapers.
+Beside my hate for one fat patriot
+My hatred of the Kaiser is love true :--
+A kind of god he is, banging a gong.
+But I have not to choose between the two,
+Or between justice and injustice. Dinned
+With war and argument I read no more
+Than in the storm smoking along the wind
+Athwart the wood. Two witches' cauldrons roar.
+@P
+From one the weather shall rise clear and gay;
+Out of the other an England beautiful
+And like her mother that died yesterday.
+Little I know or care if, being dull,
+I shall miss something that historians
+Can rake out of the ashes when perchance
+The phoenix broods serene above their ken.
+But with the best and meanest Englishmen
+I am one in crying, God save England, lest
+We lose what never slaves and cattle blessed.
+The ages made here that made us from the dust:
+She is all we know and live by, and we trust
+She is good and must endure, loving her so:
+And as we love ourselves we hate her foe.
+
+@A Edward Thomas
+#
+@T Helen
+
+And you, Helen, what should I give you?
+So many things I would give you
+Had I an infinite great store
+Offered me and I stood before
+To choose. I would give you youth,
+All kinds of lovelines and truth,
+A clear eye as good as mine,
+Lands, waters, flowers, wine,
+As many children as your heart
+Might wish for, a far better art
+Than mine can be, all you have lost
+Upon the travelling waters tossed,
+Or given to me. If I could choose
+Freely in that great treasure-house
+Anything from any shelf,
+I would give you back yourself,
+And power to discriminate
+What you want and want it not too late,
+Many fair days free from care
+And heart to enjoy both foul and fair,
+And myself, too, if I could find
+Where it lay hidden and it proved kind.
+
+@A Edward Thomas
+#
+@T Bob's Lane
+
+Women he liked, did shovel-bearded Bob,
+Old Farmer Hayward of the Heath, but he
+Loved horses. He himself was like a cob,
+And leather-coloured. Also he loved a tree.
+
+For the life in them he loved most living things,
+But a tree chiefly. All along the lane
+He planted elms where now the stormcock sings
+That travellers hear from the slow-climbing train.
+
+Till then the track had never had a name
+For all its thicket and the nightingales
+That should have earned it. No one was to blame.
+To name a thing beloved man sometimes fails.
+
+Many years since, Bob Hayward died, and now
+None passes there because the mist and the rain
+Out of the elms have turned the lane to slough
+And gloom, the name alone survives, Bob's Lane.
+
+@A Edward Thomas
+#
+@T The Poetry of Dress
+
+A sweet disorder in the dress
+Kindles in clothes a wantonness :--
+A lawn about the shoulders thrown
+Into a fine distraction, --
+An erring lace, which here and there
+Enthrals the crimson stomacher --
+A cuff neglectful, and thereby
+Ribbands to flow confusedly, --
+A winning wave, deserving note,
+In the tempestuous petticoat, --
+A careless shoe-string, in whose tie
+I see a wild civility, --
+Do more bewitch me, than when art
+Is too precise in evry part.
+
+@A R. Herrick
+#
+@T The Poetry of Dress
+
+When as in silks my Julia goes
+Then, then (methinks) how sweetly flows
+That liquefaction of her clothes.
+
+Next, when I cast mine eyes and see
+That brave vibration each way free;
+O how that glittering taketh me!
+
+@A R. Herrick
+#
+My Love in her attire doth show her wit,
+It doth so well become her:
+For every season she hath dressings fit,
+For Winter, Spring and Summer.
+No beauty she doth miss
+When all her robes are on:
+But Beauty's self she is
+When all her robes are gone.
+
+@A Anonymous
+#
+@T On a Girdle
+
+That which her slender waist confined
+Shall now my joyful temples bind:
+No monarch but would give his crown
+His arms might do what this has done.
+
+It was my Heaven's extremest sphere,
+The pale which held that lovely deer:
+My joy, my grief, my hope, my love
+Did all within this circle move.
+
+A narrow compass! and yet there
+Dwelt all that's good, and all that's fair:
+Give me but what this ribband bound,
+Take all the rest the Sun goes round.
+
+@A E. Waller
+#
+@T The Lost Love
+
+She dwelt among the untrodden ways
+Beside the springs of Dove;
+A maid whom there were none to praise,
+And very few to love:
+
+A violet by a mossy stone
+Half hidden from the eye!
+-- Fair as a star, when only one
+Is shining in the sky.
+
+She lived unknown, and few could know
+When Lucy ceased to be;
+But she is in her grave, and oh,
+The difference to me!
+
+@A W. Wordsworth
+#
+I strove with none, for none was worth my strife;
+Nature I loved, and next to Nature, Art;
+I warmed both hands before the fire of life
+It sinks, and I am ready to depart.
+
+@A W. S. Landor
+#
+@T The Miller's Daughter
+
+It is the miller's daughter,
+And she is grown so dear, so dear,
+That I would be the jewel
+That trembles in her ear:
+For his in ringlets day and night,
+I'd touch her neck so warm and white.
+
+And I would be the girdle
+About her dainty waist,
+And her heart would beat against me
+In sorrow and in rest:
+And I should know if it beat right,
+I'd clasp it round so close and tight.
+
+And I would be the necklace,
+And all day long to fall and rise
+Upon her balmy bosom,
+With her laughter or her sighs,
+And I would lie so light, so light,
+I scarce should be unclasp'd at night.
+
+@A Lord Tennyson
+#
+@T Sea-fever
+
+I must down to the seas again, to the lonely sea and the sky,
+And all I ask is a tall ship and a star to steer her by,
+And the wheel's kick and the wind's song and the white sail's shaking,
+And a grey mist on the sea's face and a grey dawn breaking.
+
+I must down to the seas again, for the call of the running tide
+Is a wild call and a clear call that may not be denied;
+And all I ask is a windy day with the white clouds flying,
+And the flung spray and the blown spume, and the sea-gulls crying.
+
+I must down to the seas again, to the vagrant gypsy life,
+To the gull's way and the whale's way where the wind's like a whetted knife;
+And all I ask is a merry yarn from a laughing fellow-rover,
+And a quiet sleep and a sweet dream when the long trick's over.
+
+@A John Masefield
+#
+@T The Drum
+
+I hate that drum's discordant sound,
+Parading round, and round, and round:
+To thoughtless youth it pleasure yields,
+And lures from cities and from fields,
+To sell their liberty for charms
+Of tawdry lace, and glittering arms;
+And when Ambition's voice commands,
+To march, and fight, and fall, in foreign lands.
+
+I hate that drum's discordant sound,
+Parading round, and round, and round:
+To me it talks of ravag'd plains,
+And burning towns, and ruin'd swains,
+And mangled limbs, and dying groans,
+And widows' tears, and orphans' moans;
+And all that Misery's hand bestows,
+To fill the catalogue of human woes.
+
+@A John Scott
+@A (1730-83)
+#
+@T Everlasting Mercy
+
+Near Bullen Bank, on Gloucester road
+Thy everlasting mercy showed
+The ploughman patient on the hill, forever there,
+Forever still
+Ploughing the hill with steady yoke,
+The pine trees lightning-struck and broke.
+
+I've marked the May Hill ploughman stay
+There on his hill day after day
+Driving his team against the sky
+While men and women live and die
+And now and then he seems to stoop
+To clear the coulter with the scoop
+Or touch an ox, to haw or gee,
+While Severn's stream goes out to sea.
+@P
+Near Bullen Bank, on Gloucester road
+Thy everlasting mercy showed
+The ploughman patient on the hill, forever there,
+Forever still
+The sea with all her ships and sails,
+And that great smokey port in Wales,
+And Gloucester tower bright in the sun,
+All know that patient wandering one.
+
+@A John Masefield
+
+Johnny Coppin's haunting arrangement of this available from
+Red Sky Records, 'English Morning' RSKC 107
+#
+@T Dawn
+(From the train between Bologna and Milan, Second Class)
+
+Opposite me two Germans snore and sweat.
+Through sullen swirling gloom we jolt and roar.
+We have been here for ever: even yet
+A dim watch tells two hours, two aeons, more.
+The windows are tight-shut and slimy-wet
+With a night's foetor. There are two hours more;
+Two hours to dawn and Milan; two hours yet.
+Opposite me two Germans sweat and snore...
+
+One of them wakes, and spits, and sleeps again.
+The darkness shivers. A wan light through the rain
+Strikes on our faces, drawn and white. Somewhere
+A new day sprawls; and, inside, the foul air
+Is chill, and damp, and fouler than before...
+Opposite me two Germans sweat and snore.
+
+@A Rupert Brooke
+#
+@T The Voice
+
+Safe in the magic of my woods
+I lay, and watched the dying light.
+Faint in the pale high solitudes,
+And washed with rain and veiled by night,
+
+Silver and blue and green were showing.
+And the dark woods grew darker still;
+And birds were hushed; and peace was growing;
+And quietness crept up the hill;
+
+And no wind was blowing...
+
+And I knew
+That this was the hour of knowing,
+And the night and the woods and you
+Were one together, and I should find
+Soon in the silence the hidden key
+Of all that had hurt and puzzled me --
+Why you were you, and the night was kind,
+And the woods were part of the heart of me.
+@P
+And there I waited breathlessly,
+Alone; and slowly the holy three,
+The three that I loved, together grew
+One, in the hour of knowing,
+Night, and the woods, and you --
+
+And suddenly
+There was an uproar in my woods,
+The noise of a fool in mock distress,
+Crashing and laughing and blindly going,
+Of ignorant feet and a swishing dress,
+And a Voice profaning the solitudes.
+@P
+The spell was broken, the key denied me,
+And at length your flat clear voice beside me
+Mouthed cheerful clear flat platitudes.
+
+You came and quacked beside me in the wood.
+You said, 'The view from here is very good!'
+You said, 'It's nice to be alone a bit!'
+And, 'How the days are drawing out!' you said.
+You said, 'The sunset's pretty, isn't it?'
+
+*              *             *
+
+By God! I wish -- I wish that you were dead!
+
+@A Rupert Brooke
+#
+@T On a Tired Housewife
+
+Here lies a poor woman who was always tired,
+She lived in a house where help wasn't hired;
+Her last words on earth were: 'Dear friends, I am going
+To where there's no cooking, or washing, or sewing,
+For everything there is exact to my wishes,
+For where they don't eat there's no washing of dishes.
+I'll be where loud anthems will always be ringing,
+But having no voice I'll be quit of the singing.
+Don't mourn for me now, don't mourn for me never,
+I am going to do nothing for ever and ever.'
+
+@A Anonymous
+#
+@T On Johnny Cole
+
+Here lies Johnny Cole
+Who died, on my soul,
+After eating a plentiful dinner;
+While chewing his crust,
+He was turned into dust,
+With his crimes undigested - poor sinner.
+
+@A Anonymous
+#
+@T On a Wag in Mauchline
+
+Lament him, Mauchline husbands a',
+He often did assist ye;
+For had ye staid whole weeks awa',
+Your wives they ne'er had missed ye.
+
+Ye Mauchline bairns, as on ye pass,
+To schools in bands thegither,
+Oh, tread ye lightly on his grass,
+Perhaps he was your father.
+
+@A Robert Burns
+#
+@T Willie's Epitaph
+
+Little Willie from his mirror
+Licked the mercury right off,
+Thinking, in his childish error,
+It would cure the whooping cough.
+At the funeral his mother
+Smartly turned to Mrs Brown:
+''Twas a chilly day for Willie
+When the mercury went down.'
+
+@A Anonymous
+#
+@T On Mary Ann Lowder
+
+Here lies the body of Mary Ann Lowder,
+She burst while drinking a seidlitz powder.
+Called from this world to her heavenly rest,
+She should have waited till it effervesced.
+
+@A Anonymous
+#
+@T On Miss Arabella Young
+
+Here lies, returned to clay,
+Miss Arabella Young,
+Who on the first day of May
+Began to hold her tongue.
+
+@A Anonymous
+#
+@T From The Westminster Drollery, 1671
+
+I saw a peacock with a fiery tail
+I saw a blazing comet drop down hail
+I saw a cloud wrapped with ivy round
+I saw an oak creep upon the ground
+I saw a pismire swallow up a whale
+I saw the sea brimful of ale
+I saw a Venice glass full fifteen feet deep
+I saw a well full of men's tears that weep
+I saw red eyes all of a flaming fire
+I saw a house bigger than the moon and higher
+I saw the sun at twelve o'clock at night
+I saw the man that saw this wondrous sight.
+
+@A Anonymous
+#
+@T Epigram
+
+Engraved on the collar which I gave to his
+Royal Highness Frederick Prince of Wales:
+
+I am his Highness' dog at Kew
+Pray tell me, sir, whose dog are you?
+
+@A Alexander Pope
+#
+@T A Man of Words
+
+A man of words and not of deeds,
+Is like a garden full of weeds;
+And when the weeds begin to grow,
+It's like a garden full of snow;
+And when the snow begins to fall,
+It's like a bird upon the wall;
+And when the bird away does fly,
+It's like an eagle in the sky;
+And when the skye begins to roar,
+It's like a lion at the door;
+And when the door begins to crack,
+It's like a stick across your back;
+And when your back begins to smart,
+It's like a penknife in your heart;
+And when your heart begins to bleed,
+You're dead, and dead, and dead indeed.
+
+@A Anonymous
+#
+@T The Voice of the Lobster
+
+''Tis the voice of the Lobster; I heard him declare,
+"You have baked me too brown, I must sugar my hair."
+As a duck with its eyelids, so he with his nose
+Trims his belt and his buttons, and turns out his toes.
+When the sands are all dry, he is gay as a lark,
+And will talk in contemptuous tones of the Shark:
+But, when the tide rises and sharks are around,
+His voice has a timid and tremuous sound.
+
+'I passed by his garden, and marked, with one eye,
+How the Owl and the Panther were sharing a pie:
+The Panther took pie-crust, and gravy, and meat,
+While the Owl had the dish as its share of the treat.
+When the pie was all finished, the Owl, as a boon,
+Was kindly permitted to pocket the spoon:
+While the Panther received knife and fork with a growl,
+And concluded the banquet by --'
+
+@A Lewis Carroll
+#
+@T Lines by a Humanitarian
+
+Be lenient with lobsters, and ever kind to crabs,
+And be not disrespectful to cuttle-fish or dabs;
+Chase not the Cochin-China, chaff not the ox obese,
+And babble not of feather-beds in company with geese.
+Be tender with the tadpole, and let the limpet thrive,
+Be merciful to mussels, don't skin your eels alive;
+When talking to a turtle don't mention calipee --
+Be always kind to animals wherever you may be.
+
+@A Anonymous
+#
+@T The Common Cormorant
+
+The common cormorant or shag
+Lays eggs inside a paper bag.
+The reason you will see no doubt
+It is to keep the lightning out.
+But what these unobservant birds
+Have never noticed is that herds
+Of wandering bears may come with buns
+And steal the bags to hold the crumbs.
+
+@A Anonymous
+#
+@T Imitation of Chaucer
+
+Women ben full of Ragerie,
+Yet swinken not sans secresie
+Thilke Moral shall ye understand,
+From Schoole-boy's Tale of fayre Irelond:
+Which to the Fennes hath him betake,
+To filch the gray Ducke fro the Lake.
+Right then, there passen by the Way
+His Aunt, and eke her Daughters tway.
+Ducke in his Trowses hath he hent,
+Not to be spied of Ladies gent.
+'But ho! our Nephew,' (crieth one)
+'Ho,' quoth another, 'Cozen John';
+And stoppen, and laugh, and callen out, --
+This sely Clerk full low doth lout:
+@P
+They asken that, and talken this,
+'Lo here is Coz, and here is Miss.'
+But, as he glozeth with Speeches soote,
+The Ducke sore tickleth his Erse-root:
+Fore-piece and buttons all-to-brest,
+Forth thrust a white neck, and red crest.
+'Te-he,' cry'd Ladies; Clerke nought spake:
+Miss star'd; and gray Ducke crieth Quake.
+'O Moder, Moder' (quoth the daughter)
+'Be thilke same thing Maids longen a'ter?
+'Better is to pyne on coals and chalke,
+'Then trust on Mon, whose yerde can talke.'
+
+@A Alexander Pope
+#
+@T Sonnet
+
+Live with me, and be my love,
+And we will all the pleasures prove
+That hills and valleys, dales and fields,
+And all the craggy mountains yields.
+
+There will we sit upon the rocks,
+And see the shepherds feed their flocks,
+By shallow rivers, by whose falls
+Melodious birds sing madrigals.
+
+There will I make thee a bed of roses,
+With a thousand fragrant posies,
+A cap of flowers, and a kirtle
+Embroider'd all with leaves of myrtle.
+@P
+A belt of straw and ivy buds,
+With coral clasps and amber studs;
+And if these pleasures may thee move,
+Then live with me and be my love.
+
+LOVE'S ANSWER
+
+If that the world and love were young,
+And truth in every shepherd's tongue,
+These pretty pleasures might me move
+To live with thee and be thy love.
+
+@A William Shakespeare
+#
+@T O No, John!
+
+On yonder hill there stands a creature;
+Who she is I do not know.
+I'll go and court her for her beauty,
+She must answer yes or no.
+O no, John! No, John! No, John! No!
+
+On her bosom are bunches of posies,
+On her breast where flowers grow;
+If I should chance to touch that posy,
+She must answer yes or no.
+O no, John! No, John! No, John! No!
+
+Madam I am come for to court you,
+If your favour I can gain;
+If you will but entertain me,
+Perhaps then I might come again.
+O no, John! No, John! No, John! No!
+
+My husband was a Spanish captain,
+Went to sea a month ago;
+The very last time we kissed and parted,
+Bid me always answer no.
+O no, John! No, John! No, John! No!
+@P
+Madam in your face is beauty,
+In your bosom flowers grow;
+In your bedroom there is pleasure,
+Shall I view it, yes or no?
+O no, John! No, John! No, John! No!
+
+Madam shall I tie your garter,
+Tie it a little above your knee;
+If my hands should slip a little farther,
+Would you think it amiss of me?
+O no, John! No, John! No, John! No!
+
+My love and I went to bed together,
+There we lay till cocks did crow;
+Unclose your arms my dearest jewel,
+Unclose your arms and let me go.
+O no, John! No, John! No, John! No!
+
+@A Old English Folk Song
+#
+@T Unfortunate
+
+Heart, you are as restless as a paper scrap
+That's tossed down dusty pavements by the wind;
+Saying, 'She is most wise, patient and kind.
+Between the small hands folded in her lap
+Surely a shamed head may bow down at length,
+And find forgiveness where the shadows stir
+About her lips, and wisdom in her strength,
+Peace in her peace. Come to her, come to her!' . . .
+
+She will not care. She'll smile to see me come,
+So that I think all Heaven in flower to fold me.
+She'll give me all I ask, kiss me and hold me,
+And open wide upon that holy air
+The gates of peace, and take my tiredness home,
+Kinder than God. But, heart, she will not care.
+
+@A Rupert Brooke
+#
+@T The Busy Heart
+
+Now that we've done our best and worst, and parted,
+I would fill my mind with thoughts that will not rend.
+(O heart, I do not dare go empty-hearted)
+I'll think of Love in books, Love without end;
+Women with child, content; and old men sleeping;
+And wet strong ploughlands, scarred for certain grain;
+And babes that weep, and so forget their weeping;
+And the young heavens, forgetful after rain;
+And evening hush, broken by homing wings;
+And Song's nobility, and Wisdom holy,
+That live, we dead. I would think of a thousand things,
+Lovely and durable, and taste them slowly,
+One after one, like tasting a sweet food.
+I have need to busy my heart with quietude.
+
+@A Rupert Brooke
+#
+@T Love
+
+Love is a breach in the walls, a broken gate,
+Where that comes in that shall not go again;
+Love sells the proud heart's citadel to Fate.
+They have known shame, who love unloved. Even then
+When two mouths, thirsty each for each, find slaking,
+And agony's forgot, and hushed the crying
+Of credulous hearts, in heaven -- such are but taking
+Their own poor dreams within their arms, and lying
+Each in his lonely night, each with a ghost.
+Some share that night. But they know, love grows colder,
+Grows false and dull, that was sweet lies at most.
+Astonishment is no more in hand or shoulder,
+But darkens, and dies out from kiss to kiss.
+All this love; and all love is but this.
+
+@A Rupert Brooke
+#
+@T One Day
+
+Today I have been happy. All the day
+I held the memory of you, and wove
+Its laughter with the dancing light o' the spray,
+And sowed the sky with tiny clouds of love,
+And sent you following the white waves of sea,
+And crowned your head with fancies, nothing worth,
+Stray buds from that old dust of misery,
+Being glad with a new foolish quiet mirth.
+
+So lightly I played with those dark memories,
+Just as a child, beneath the summer skies,
+Plays hour by hour with a strange shining stone,
+For which (he knows not) towns were fire of old,
+And love has been betrayed, and murder done,
+And great kings turned to a little bitter mould.
+
+@A Rupert Brooke
+#
+@T Doubts
+
+When she sleeps, her soul, I know,
+Goes a wanderer on the air,
+Wings where I may never go,
+Leaves her lying, still and fair,
+Waiting, empty, laid aside,
+Like a dress upon a chair...
+This I know, and yet I know
+Doubts that will not be denied.
+
+For if the soul be not in place,
+What has laid trouble in her face?
+And, sits there nothing ware and wise
+Behind the curtains of her eyes,
+What is it, in the self's eclipse,
+Shadows, soft and passingly,
+About the corners of her lips,
+The smile that is essential she?
+
+And if the spirit be not there,
+Why is fragrance in the hair?
+
+@A Rupert Brooke
diff --git a/demos/poem/wxpoem.def b/demos/poem/wxpoem.def
new file mode 100644 (file)
index 0000000..4cdca34
--- /dev/null
@@ -0,0 +1,9 @@
+NAME         WXPOEM
+DESCRIPTION  'WXPOEM'
+EXETYPE      WINDOWS
+STUB         'WINSTUB.EXE'
+CODE         PRELOAD MOVEABLE DISCARDABLE
+DATA         PRELOAD MOVEABLE MULTIPLE
+HEAPSIZE     1024
+STACKSIZE    8192
+
diff --git a/demos/poem/wxpoem.h b/demos/poem/wxpoem.h
new file mode 100644 (file)
index 0000000..2f65c22
--- /dev/null
@@ -0,0 +1,92 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        wxpoem.h
+// Purpose:     A small C++ program which displays a random poem on
+//              execution. It also allows search for poems containing a
+//              string.
+//              It requires winpoem.dat and creates winpoem.idx.
+//              Original version (WinPoem) written in 1994.
+//              This has not been rewritten in a long time so
+//              beware, inelegant code!
+// Author:      Julian Smart
+// Created:     12/12/98
+// RCS-ID:      $Id$
+// Copyright:   (c) 1998 Julian Smart
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifdef __GNUG__
+#pragma interface "wxpoem.h"
+#endif
+
+// Define a new application
+class MyApp: public wxApp
+{
+  public:
+    bool OnInit();
+    int OnExit();
+};
+
+DECLARE_APP(MyApp)
+
+// Define a new canvas which can receive some events
+class MyCanvas: public wxWindow
+{
+  public:
+    MyCanvas(wxFrame *frame, wxWindowID id, const wxPoint& pos, const wxSize& size);
+
+    void OnPaint(wxPaintEvent& event);
+    void OnMouseEvent(wxMouseEvent& event);
+    void OnChar(wxKeyEvent& event);
+
+    DECLARE_EVENT_TABLE()
+};
+
+// Define a new frame
+class MainWindow: public wxFrame
+{
+  public:
+    MyCanvas *canvas;
+    MainWindow(wxFrame *frame, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style);
+    ~MainWindow();
+
+    void OnCloseWindow(wxCloseEvent& event);
+    void OnChar(wxKeyEvent& event);
+    void OnPopup(wxCommandEvent& event);
+
+    // Display next page or poem
+    void NextPage(void);
+
+    // Display previous page
+    void PreviousPage(void);
+
+    // User search
+    void Search(bool);
+
+    // Look in file for string
+    long DoSearch(void);
+
+    // Do the actual drawing of text (or just calculate size needed)
+    void ScanBuffer(wxDC *dc, bool DrawIt, int *max_x, int *max_y);
+
+    // Load the poem
+    void GetIndexLoadPoem(void);
+    void Resize(void);
+
+DECLARE_EVENT_TABLE()
+};
+
+// Menu items
+#define         POEM_NEXT       100
+#define         POEM_PREVIOUS   101
+#define         POEM_COPY       102
+#define         POEM_SEARCH     103
+#define         POEM_NEXT_MATCH 104
+#define         POEM_ABOUT      105
+#define         POEM_EXIT       106
+#define         POEM_COMPILE    107
+#define         POEM_HELP_CONTENTS 108
+#define         POEM_BIGGER_TEXT 109
+#define         POEM_SMALLER_TEXT 110
+#define         POEM_MINIMIZE   111
+
+
diff --git a/demos/poem/wxpoem.ico b/demos/poem/wxpoem.ico
new file mode 100644 (file)
index 0000000..f3b425d
Binary files /dev/null and b/demos/poem/wxpoem.ico differ
diff --git a/demos/poem/wxpoem.idx b/demos/poem/wxpoem.idx
new file mode 100644 (file)
index 0000000..0004670
--- /dev/null
@@ -0,0 +1,137 @@
+135
+
+0
+432
+678
+849
+1000
+1289
+1676
+2036
+2695
+3247
+3839
+4214
+4444
+5002
+5705
+5943
+6559
+7236
+7935
+8387
+8826
+9065
+9712
+10030
+10251
+10488
+10879
+11165
+11541
+11679
+12341
+12952
+13601
+14037
+14685
+15355
+16023
+16480
+16789
+17472
+18104
+18634
+19160
+19828
+20450
+20892
+21651
+22144
+22697
+22863
+23105
+23495
+23659
+23858
+24027
+26188
+26375
+26605
+27170
+27341
+27752
+27912
+28100
+28298
+28493
+28705
+28919
+29336
+29969
+30491
+30876
+31495
+32918
+33373
+33703
+33830
+34045
+34223
+34477
+34889
+35367
+35760
+35898
+36461
+36950
+37417
+39079
+39455
+40104
+40787
+42555
+43641
+45010
+45571
+46287
+46870
+47331
+47808
+48457
+49704
+50924
+52070
+52830
+53582
+54076
+54328
+54590
+55064
+55453
+55643
+56256
+57048
+57698
+58621
+59337
+60780
+61314
+61518
+61825
+62104
+62315
+62462
+62980
+63167
+63748
+64581
+65034
+65343
+66368
+67140
+68358
+69033
+69732
+70434
+71096
diff --git a/demos/poem/wxpoem.rc b/demos/poem/wxpoem.rc
new file mode 100644 (file)
index 0000000..8fdb7de
--- /dev/null
@@ -0,0 +1,11 @@
+aaaa ICON "wxpoem.ico"
+wxpoem ICON "wxpoem.ico"
+wxSTD_FRAME ICON "wxpoem.ico"
+
+icon_1 ICON "corner1.ico"
+icon_2 ICON "corner2.ico"
+icon_3 ICON "corner3.ico"
+icon_4 ICON "corner4.ico"
+
+#include "wx/msw/wx.rc"
+
diff --git a/demos/poem/wxpoem.txt b/demos/poem/wxpoem.txt
new file mode 100644 (file)
index 0000000..4f17b5d
--- /dev/null
@@ -0,0 +1,121 @@
+wxPoem 1.0
+----------
+
+by Julian Smart
+---------------
+
+Fancy a little intellectual stimulation after long hours spent staring
+at spreadsheets or reports?  Does your brain long for something a little
+more fulfilling than Tetris or fiddling with the WIN.INI file?  Then you
+could go out and buy a poetry book... or alternatively, if you just
+can't drag yourself away from the screen, click on the wxPoem icon.
+
+wxPoem is a simple Windows application which picks poems from a file at
+random, or finds poems according to a string criterion, and formats them
+nicely in a window.  A displayed poem can be copied to the Windows clipboard
+ready for inclusion in that more imaginative report...
+
+It's small, it's free and it's totally harmless, so far as I know.
+No responsibility accepted, though, for any problems it might cause with
+your setup.
+
+wxPoem was converted to use the wxWindows toolkit, from the original
+WinPoem which received a favourable review from Windows Shareware 500.
+
+Since it now uses wxWindows, wxPoem may be compiled on a variety
+of platforms such as X (XView or Motif), Windows and NT.
+
+Files
+-----
+
+The main data file is winpoem.dat, and an index file winpoem.idx is
+supplied or can be (re)built by deleting winpoem.idx and rerunning
+wxPoem. Source code is also provided in source.zip, but wxWindows is
+required to build it. The original WinPoem is much leaner (40K
+instead of 400K!) and can be compiled under Windows without wxWindows.
+
+Installation
+------------
+
+  Windows
+  =======
+
+    Copy ctl3dv2.dll to windows\system, and delete the original
+    ctl3dv2.dll or wxPoem will not run.
+
+    wxPoem can be put in the Startup folder in the Program Manager, so that
+    a random poem will pop up every time Windows is run.
+
+  UNIX
+  ====
+
+    wxPoem comes in Open Look and Motif versions for the Sun, and a
+    Linux Open Look version. For other platforms, you will need to
+    recompile the source.
+
+
+Use
+---
+
+Simply run the program, and a random poem will be displayed.
+You can optionally give a filename on the command line, without a suffix
+(e.g. winpoem).
+
+The simplest way of operating wxPoem is to keep pressing the space bar
+for new poems (or pages for multi-page poems).
+
+Clicking the right mouse button (or selecting the wxPoem Options menu
+item from the system menu) gives a choice of the following facilities:
+Next poem/page   (Page down)   Display next poem (or next page)
+Previous page    (Page up)     Display previous page (multi-line poems only)
+Search           (S)           Allows user to enter a search string
+Next match       (N)           Gives next search match
+Copy to clipboard              Allows poems to be pasted into other applications
+Bigger text                    Increases text size
+Smaller text                   Decreases text size
+About wxPoem                   About wxPoem
+Exit             (Esc)         Quit wxPoem
+
+When wxPoem is closed, the font, text height and window position are
+remembered (stored in WIN.INI) for next time. Under X, the values
+are not written (since they are stored in .Xdefaults), so you may
+want to edit the following resources by hand:
+
+wxPoem.X         ; X position
+wxPoem.Y         ; Y position
+wxPoem.FontSize  ; Font size in points (default 12)
+
+The data file
+-------------
+
+The winpoem.dat file contains poems separated by a #, with optional
+@ codes denoting title (@T) author (@A) and page break (@P).  Any
+unrecognized codes will cause the rest of the line to be ignored, so
+the user can add lines (e.g. @S for subject) which will be searched on but
+not displayed.
+
+The data file contains a mixture of 20th century and earlier poetry,
+subject to copyright constraints.  Apologies if any copyrights have
+inadvertently been infringed, though I have tried to avoid it.
+
+Implementation
+--------------
+
+The original WinPoem program was my `Windows learning application', i.e.
+a vehicle for getting stuck into Windows programming, whilst (possibly)
+affording others a modicum of amusement. Therefore the code is pretty
+ugly. So don't look if you're squeamish!
+
+License
+-------
+
+Copyright Julian Smart, released into the public domain, October 1994.
+
+Julian Smart
+Artificial Intelligence Applications Institute
+University of Edinburgh
+80 South Bridge
+Einburgh
+EH1 1HN
+
+J.Smart@ed.ac.uk
diff --git a/demos/poem/wxpoem.xpm b/demos/poem/wxpoem.xpm
new file mode 100644 (file)
index 0000000..73ca05b
--- /dev/null
@@ -0,0 +1,47 @@
+/* XPM */
+static char * wxpoem_xpm[] = {
+/* width height ncolors chars_per_pixel */
+"32 32 9 1",
+/* colors */
+"      s None  c None",
+".     c #800000",
+"+     c #008000",
+"@     c #808000",
+"#     c #c0c0c0",
+"$     c #ff0000",
+"%     c #00ff00",
+"&     c #ffff00",
+"*     c #0000ff",
+/* pixels */
+"                    ****        ",
+"             ********&&*        ",
+"      ******&&&&&&&&&&&&***     ",
+"  *****&&&&&&&&&&&&&&&&&&&*     ",
+"  ****************************  ",
+"  *&&&&&&&&&&&&&&&&&&&&&&&&&&*  ",
+"  *&************************&*  ",
+"  *&************************&*  ",
+"  *&************************&*  ",
+"  *&*&&&@*@&@*@&&*@&@&@*@&@*&*  ",
+"  *&*&**&*&*&*&***&*&*&*&***&*  ",
+"  *&*&&&@*&*&*&&**&*&*&*&&@*&*  ",
+"  *&*&****&*&*&***&*&*&***&*&*  ",
+"  *&*&****&*&*&***&***&***&*&*  ",
+"  *&*&****@&@*@&&*&***&*@&@*&*  ",
+"  *&************************&*  ",
+"  *&************************&*  ",
+"  *&************************&*  ",
+"  *&*****$$$****************&*  ",
+"  *&***...$$$$**************&*  ",
+"  *&***$$....$**************&*  ",
+"  *&****$$$$..******%++*****&*  ",
+"  *&****$$$$$.%%**+%+%%*****&*  ",
+"  *&******$$$**%%*%+%%+*****&*  ",
+"  *&*************%+%%%******&*  ",
+"  *&**************%%%*******&*  ",
+"  *&****************%%%*****&*  ",
+"  *&******************%%****&*  ",
+"  *&&&&&&&&&&&&&&&&&&&&%%&&&&*  ",
+"  ***********************%%***  ",
+"                          %%    ",
+"                          #%%   "};
diff --git a/samples/bombs/.cvsignore b/samples/bombs/.cvsignore
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/samples/bombs/Makefile.in b/samples/bombs/Makefile.in
deleted file mode 100644 (file)
index 90ec3d1..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-#
-# File:                Makefile.in
-# Author:      Julian Smart
-# Created:     1998
-# Updated:     
-# Copyright:   (c) 1998 Julian Smart
-#
-# "%W% %G%"
-#
-# Makefile for bombs example (UNIX).
-
-top_srcdir = @top_srcdir@
-top_builddir = ../..
-program_dir = samples/bombs
-
-PROGRAM=bombs
-
-OBJECTS = bombs.o bombs1.o game.o
-
-include ../../src/makeprog.env
-
diff --git a/samples/bombs/bombs.bmp b/samples/bombs/bombs.bmp
deleted file mode 100644 (file)
index 0fffb1f..0000000
Binary files a/samples/bombs/bombs.bmp and /dev/null differ
diff --git a/samples/bombs/bombs.cpp b/samples/bombs/bombs.cpp
deleted file mode 100644 (file)
index cdf7b85..0000000
+++ /dev/null
@@ -1,252 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// Name:        bombs.cpp
-// Purpose:     Bombs game
-// Author:      P. Foggia 1996
-// Modified by:
-// Created:     1996
-// RCS-ID:      $Id$
-// Copyright:   (c) 1996 P. Foggia
-// Licence:     wxWindows licence
-///////////////////////////////////////////////////////////////////////////////
-
-#ifdef __GNUG__
-#pragma implementation
-#endif
-
-#include "wx/wxprec.h"
-
-#ifndef  WX_PRECOMP
-  #include "wx/wx.h"
-#endif //precompiled headers
-
-#include "bombs.h"
-
-#include <time.h>
-#include <stdlib.h>
-
-#if defined(__WXGTK__) || defined(__WXMOTIF__)
-#include "bombs.xpm"
-#endif
-
-IMPLEMENT_APP(AppClass)
-
-// Called to initialize the program
-bool AppClass::OnInit()
-{
-  srand((unsigned)time(NULL));
-
-  // Initialize all the top-level window members to NULL.
-  BombsFrame = NULL;
-  level=IDM_EASY;
-
-  BombsFrame = 
-    new BombsFrameClass(NULL, "wxBombs", wxPoint(155, 165), wxSize(300, 300), wxMINIMIZE_BOX | wxSYSTEM_MENU | wxCAPTION);
-
-  int xmax=BombsFrame->BombsCanvas->field_width*BombsFrame->BombsCanvas->x_cell*X_UNIT;
-  int ymax=BombsFrame->BombsCanvas->field_height*BombsFrame->BombsCanvas->y_cell*Y_UNIT;
-  BombsFrame->SetClientSize(xmax, ymax);
-
-  return TRUE;
-}
-
-BEGIN_EVENT_TABLE(BombsFrameClass, wxFrame)
-    EVT_MENU(IDM_EASY, BombsFrameClass::OnEasy)
-    EVT_MENU(IDM_MEDIUM, BombsFrameClass::OnMedium)
-    EVT_MENU(IDM_DIFFICULT, BombsFrameClass::OnDifficult)
-    EVT_MENU(IDM_EXIT, BombsFrameClass::OnExit)
-    EVT_MENU(IDM_ABOUT, BombsFrameClass::OnAbout)
-    EVT_MENU(IDM_RESTART, BombsFrameClass::OnRestart)
-    EVT_CLOSE(BombsFrameClass::OnCloseWindow)
-END_EVENT_TABLE()
-
-BombsFrameClass::BombsFrameClass(wxFrame *parent, const wxString& title, const wxPoint& pos, const wxSize& size, long style):
-  wxFrame(parent, -1, title, pos, size, style)
-{
-  // Initialize child subwindow members.
-  BombsCanvas = NULL;
-
-  SetIcon(wxICON(bombs));
-
-  CreateStatusBar();
-  
-  // Create a menu bar for the frame
-  wxMenuBar *menuBar1 = new wxMenuBar;
-  wxMenu *menu1 = new wxMenu;
-  menu1->Append(IDM_EXIT, "E&xit"); // , "Quit the program");
-  menu1->AppendSeparator();
-  menu1->Append(IDM_ABOUT, "&About..."); // , "Infos on wxBombs");
-  menuBar1->Append(menu1, "&File");
-  wxMenu *menu2 = new wxMenu;
-  menu2->Append(IDM_RESTART, "&Restart"); // , "Clear the play field");
-  menu2->AppendSeparator();
-  menu2->Append(IDM_EASY, "&Easy", wxEmptyString, TRUE); // "10x10 play field", TRUE);
-  menu2->Append(IDM_MEDIUM, "&Medium", wxEmptyString, TRUE); // "15x15 play field", TRUE);
-  menu2->Append(IDM_DIFFICULT, "&Difficult", wxEmptyString, TRUE); // "25x20 play field", TRUE);
-  menuBar1->Append(menu2, "&Game");
-  SetMenuBar(menuBar1);
-  menuBar=menuBar1;
-  menuBar->Check(wxGetApp().level, TRUE);
-
-  // Create child subwindows.
-  BombsCanvas = new BombsCanvasClass(this);
-
-  // Ensure the subwindows get resized o.k.
-//  OnSize(width, height);
-
-  // Centre frame on the screen.
-  Centre(wxBOTH);
-
-  // Show the frame.
-  Show(TRUE);
-}
-
-BombsFrameClass::~BombsFrameClass(void)
-{
-}
-
-void BombsFrameClass::OnCloseWindow(wxCloseEvent& event)
-{
-  this->Destroy();
-}
-
-void BombsFrameClass::OnExit(wxCommandEvent& event)
-{
-    this->Destroy();
-}
-
-void BombsFrameClass::OnRestart(wxCommandEvent& event)
-{
-    BombsCanvas->UpdateFieldSize();
-    int xmax=BombsCanvas->field_width*BombsCanvas->x_cell*X_UNIT;
-    int ymax=BombsCanvas->field_height*BombsCanvas->y_cell*Y_UNIT;
-    wxGetApp().BombsFrame->SetClientSize(xmax, ymax);
-}
-
-void BombsFrameClass::OnAbout(wxCommandEvent& event)
-{
-    wxMessageBox("wxBombs (c) 1996 by P. Foggia\n<foggia@amalfi.dis.unina.it>", "About wxBombs");
-}
-
-void BombsFrameClass::OnEasy(wxCommandEvent& event)
-{
-    menuBar->Check(wxGetApp().level, FALSE);
-    wxGetApp().level=IDM_EASY;
-    menuBar->Check(wxGetApp().level, TRUE);
-}
-
-void BombsFrameClass::OnMedium(wxCommandEvent& event)
-{
-    menuBar->Check(wxGetApp().level, FALSE);
-    wxGetApp().level=IDM_MEDIUM;
-    menuBar->Check(wxGetApp().level, TRUE);
-}
-
-void BombsFrameClass::OnDifficult(wxCommandEvent& event)
-{
-    menuBar->Check(wxGetApp().level, FALSE);
-    wxGetApp().level=IDM_DIFFICULT;
-    menuBar->Check(wxGetApp().level, TRUE);
-}
-
-BEGIN_EVENT_TABLE(BombsCanvasClass, wxWindow)
-    EVT_PAINT(BombsCanvasClass::OnPaint)
-    EVT_MOUSE_EVENTS(BombsCanvasClass::OnEvent)
-END_EVENT_TABLE()
-
-BombsCanvasClass::BombsCanvasClass(wxFrame *parent, const wxPoint& pos, const wxSize& size, long style):
-  wxWindow(parent, -1, pos, size, style)
-{ 
-  int sx, sy;
-  wxClientDC dc(this);
-  wxFont font= BOMBS_FONT;
-  dc.SetFont(font);
-
-  long chw, chh;
-  char buf[]="M";
-
-  dc.GetTextExtent(buf, &chw, &chh);
-  dc.SetFont(wxNullFont);
-
-  dc.SetMapMode(wxMM_METRIC);
-
-  int xcm = dc.LogicalToDeviceX(10.0);
-  int ycm = dc.LogicalToDeviceY(10.0);
-    // To have a square cell, there must be :
-    //    sx*ycm == sy*xcm
-  if (chw*ycm < chh*xcm)
-    { sy=chh;
-      sx=chh*xcm/ycm;
-    }
-  else
-    { sx=chw;
-      sy=chw*ycm/xcm;
-    }
-  x_cell = (sx+3+X_UNIT)/X_UNIT;
-  y_cell = (sy+3+Y_UNIT)/Y_UNIT;
-  dc.SetMapMode(wxMM_TEXT);
-  bmp=NULL;
-  UpdateFieldSize();
-}
-
-BombsCanvasClass::~BombsCanvasClass(void)
-{
-  if (bmp)
-    delete bmp;
-}
-
-// Called when canvas needs to be repainted.
-void BombsCanvasClass::OnPaint(wxPaintEvent& event)
-{
-  wxPaintDC dc(this);
-
-  // Insert your drawing code here.
-  if (!bmp)
-    { bmp=new wxBitmap(field_width*x_cell*X_UNIT+1,
-                       field_height*y_cell*Y_UNIT+1);
-      if (bmp)
-        { wxMemoryDC memDC;
-          memDC.SelectObject(* bmp);
-          DrawField(&memDC, 0, 0, field_width-1, field_height-1);
-          memDC.SelectObject(wxNullBitmap);
-        }
-    }
-  if (bmp)
-    { wxMemoryDC memDC;
-      memDC.SelectObject(* bmp);
-      dc.Blit(0, 0, field_width*x_cell*X_UNIT+1,
-                          field_height*y_cell*Y_UNIT+1,
-                    &memDC, 0, 0, wxCOPY);
-      memDC.SelectObject(wxNullBitmap);
-    }
-  else
-    DrawField(& dc, 0, 0, field_width-1, field_height-1);
-}
-
-// Updates the field size depending on wxGetApp().level and
-// redraws the canvas
-void BombsCanvasClass::UpdateFieldSize()
-  { field_width=20;
-    field_height=20;
-
-    switch(wxGetApp().level)
-      { case IDM_EASY:
-          field_width=10;
-          field_height=10;
-          break;
-        case IDM_MEDIUM:
-          field_width=15;
-          field_height=15;
-          break;
-        case IDM_DIFFICULT:
-          field_width=25;
-          field_height=20;
-          break;
-      }
-    wxGetApp().Game.Init(field_width, field_height);
-
-    if (bmp)
-      delete bmp;
-    bmp=NULL;
-    
-    wxWindow::Refresh();
-  }
diff --git a/samples/bombs/bombs.def b/samples/bombs/bombs.def
deleted file mode 100644 (file)
index a0dc764..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-; bombs
-; Generated by wxBuilder
-;
-NAME          bombsapp
-DESCRIPTION   'A wxWindows application'
-;
-EXETYPE      WINDOWS
-STUB         'WINSTUB.EXE'
-;
-CODE         PRELOAD MOVEABLE DISCARDABLE
-DATA         PRELOAD MOVEABLE MULTIPLE
-;
-HEAPSIZE     1024
-STACKSIZE    8192
diff --git a/samples/bombs/bombs.h b/samples/bombs/bombs.h
deleted file mode 100644 (file)
index 9684aca..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// Name:        bombs.h
-// Purpose:     Bombs game
-// Author:      P. Foggia 1996
-// Modified by:
-// Created:     1996
-// RCS-ID:      $Id$
-// Copyright:   (c) 1996 P. Foggia
-// Licence:     wxWindows licence
-///////////////////////////////////////////////////////////////////////////////
-
-#ifndef _INC_BOMBS_H
-#define _INC_BOMBS_H
-
-#include "game.h"
-
-/*
- * Forward declarations of all top-level window classes.
- */
-class  BombsFrameClass;
-class  AboutFrameClass;
-
-/*
- * Class representing the entire Application
- */
-class AppClass: public wxApp
-{
- public:
-  BombsFrameClass *BombsFrame;
-  int level;
-  BombsGame Game;
-
-  bool OnInit();
-};
-
-DECLARE_APP(AppClass)
-
-class BombsCanvasClass;
-
-class BombsFrameClass: public wxFrame
-{
- private:
- protected:
- public:
-  // Subwindows for reference within the program.
-  BombsCanvasClass *BombsCanvas;
-  wxMenuBar *menuBar;
-
-  // Constructor and destructor
-  BombsFrameClass(wxFrame *parent, const wxString& title, const wxPoint& pos, const wxSize& size, long style);
-  ~BombsFrameClass(void);
-
- void OnCloseWindow(wxCloseEvent& event);
- void OnExit(wxCommandEvent& event);
- void OnRestart(wxCommandEvent& event);
- void OnAbout(wxCommandEvent& event);
- void OnEasy(wxCommandEvent& event);
- void OnMedium(wxCommandEvent& event);
- void OnDifficult(wxCommandEvent& event);
-
-DECLARE_EVENT_TABLE()
-};
-
-/* Menu identifiers
- */
-// File
-#define BOMBSFRAMECLASS_FILE 1
-// E&xit
-#define IDM_EXIT 2
-// About...
-#define IDM_ABOUT 3
-// Game
-#define BOMBSFRAMECLASS_GAME 4
-// &Restart
-#define IDM_RESTART 5
-// &Easy
-#define IDM_EASY 6
-// &Medium
-#define IDM_MEDIUM 7
-// &Difficult
-#define IDM_DIFFICULT 8
-
-class BombsCanvasClass: public wxWindow
-{
- private:
- protected:
- public:
-   int field_width, field_height;
-   int x_cell, y_cell;
-   wxBitmap *bmp;
-  // Constructor and destructor
-  BombsCanvasClass(wxFrame *parent, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0);
-  ~BombsCanvasClass(void);
-
- void OnPaint(wxPaintEvent& event);
- void DrawField(wxDC *, int xc1, int yc1, int xc2, int yc2);
- void Refresh(int xc1, int yc1, int xc2, int yc2);
- void OnEvent(wxMouseEvent& event);
- void UpdateFieldSize();
-
-DECLARE_EVENT_TABLE()
-};
-
-/* Menu identifiers
- */
-
-/* The following sizes should probably be redefined */
-/* dimensions of a scroll unit, in pixels */
-#define X_UNIT 4
-#define Y_UNIT 4
-
-/* the dimensions of a cell, in scroll units are in
- * BombsCanvasClass::x_cell and y_cell
- */
-
-#define BOMBS_FONT wxFont(14, wxROMAN, wxNORMAL, wxNORMAL)
-
-#endif /* mutual exclusion */
-
diff --git a/samples/bombs/bombs.ico b/samples/bombs/bombs.ico
deleted file mode 100644 (file)
index 249893a..0000000
Binary files a/samples/bombs/bombs.ico and /dev/null differ
diff --git a/samples/bombs/bombs.rc b/samples/bombs/bombs.rc
deleted file mode 100644 (file)
index 9b852cc..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-bombs ICON "bombs.ico"
-
-#include "wx/msw/wx.rc"
diff --git a/samples/bombs/bombs.xpm b/samples/bombs/bombs.xpm
deleted file mode 100644 (file)
index 9708aea..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/* XPM */
-static char *bombs_xpm[] = {
-/* columns rows colors chars-per-pixel */
-"32 32 6 1",
-"  c Black",
-". c Blue",
-"X c #00bf00",
-"o c Red",
-"O c Yellow",
-"+ c Gray100",
-/* pixels */
-"                                ",
-" oooooo +++++++++++++++++++++++ ",
-" oooooo +++++++++++++++++++++++ ",
-" oooooo +++++++++++++++++++++++ ",
-" oooooo +++++++++++++++++++++++ ",
-" oooooo +++++++++++++++++++++++ ",
-" oooooo +++++++++++++++++++++++ ",
-" oooooo +++++++++++++++++++++++ ",
-"                                ",
-" ++++++ ++++++++++++++++++ .... ",
-" ++++++ ++++++++++++++++++ .... ",
-" ++++++ ++++++++++++++++++ .... ",
-" ++++++ ++++++++++++++++++ .... ",
-" ++++++ ++++++++++++++++++ .... ",
-" ++++++ ++++++++++++++++++      ",
-" ++++++ ++++++++++++++++++ ++++ ",
-" ++++++ ++++++++++++++++++ ++++ ",
-" ++++++ ++++++++++++++++++ ++++ ",
-" ++++++ ++++++++++++++++++ ++++ ",
-" ++++++ ++++++++++++++++++ ++++ ",
-" ++++++ ++++++++++++++++++ ++++ ",
-" ++++++ ++++++++++++++++++ ++++ ",
-" ++++++ ++++++++++++++++++ ++++ ",
-" ++++++ ++++++++++++++++++ ++++ ",
-" ++++++                    ++++ ",
-" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
-" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
-" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
-" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
-" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
-" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
-"                                "
-};
diff --git a/samples/bombs/bombs1.cpp b/samples/bombs/bombs1.cpp
deleted file mode 100644 (file)
index 0b77417..0000000
+++ /dev/null
@@ -1,204 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// Name:        bombs1.cpp
-// Purpose:     Bombs game
-// Author:      P. Foggia 1996
-// Modified by:
-// Created:     1996
-// RCS-ID:      $Id$
-// Copyright:   (c) 1996 P. Foggia
-// Licence:     wxWindows licence
-///////////////////////////////////////////////////////////////////////////////
-
-/*
- * implementation of the methods DrawField and OnEvent of the
- * class BombsCanvas
- */
-
-#ifdef __GNUG__
-#pragma implementation
-#endif
-
-#include "wx/wxprec.h"
-
-#ifndef  WX_PRECOMP
-  #include "wx/wx.h"
-#endif //precompiled headers
-
-#include "bombs.h"
-
-/*--------  BombCanvasClass::DrawField(dc, xc1, yc1, xc2, yc2)  -------*/
-/* Draws the field on the device context dc                            */
-/* xc1,yc1 etc. are the (inclusive) limits of the area to be drawn,    */
-/* expressed in cells.                                                 */
-/*---------------------------------------------------------------------*/
-void BombsCanvasClass::DrawField(wxDC *dc, int xc1, int yc1, int xc2, int yc2)
-{ int x,y,xmax,ymax;
-  char buf[2];
-  long chw, chh;
-
-  wxColour *wxBlack = wxTheColourDatabase->FindColour("BLACK");
-  wxColour *wxWhite = wxTheColourDatabase->FindColour("WHITE");
-  wxColour *wxRed = wxTheColourDatabase->FindColour("RED");
-  wxColour *wxBlue = wxTheColourDatabase->FindColour("BLUE");
-  wxColour *wxGrey = wxTheColourDatabase->FindColour("LIGHT GREY");
-  wxColour *wxGreen = wxTheColourDatabase->FindColour("GREEN");
-
-  wxPen *blackPen = wxThePenList->FindOrCreatePen(*wxBlack, 1, wxSOLID);
-  wxPen *redPen = wxThePenList->FindOrCreatePen(*wxRed, 1, wxSOLID);
-  wxPen *bluePen = wxThePenList->FindOrCreatePen(*wxBlue, 1, wxSOLID);
-  wxBrush *whiteBrush = wxTheBrushList->FindOrCreateBrush(*wxWhite, wxSOLID);
-  wxBrush *greyBrush = wxTheBrushList->FindOrCreateBrush(*wxGrey, wxSOLID);
-  wxBrush *redBrush = wxTheBrushList->FindOrCreateBrush(*wxRed, wxSOLID);
-
-  xmax=field_width*x_cell*X_UNIT;
-  ymax=field_height*y_cell*Y_UNIT;
-
-
-  dc->SetPen(* blackPen);
-  for(x=xc1; x<=xc2; x++)
-    dc->DrawLine(x*x_cell*X_UNIT, 0, x*x_cell*X_UNIT, ymax);
-  for(y=xc1; y<=yc2; y++)
-    dc->DrawLine(0, y*y_cell*Y_UNIT, xmax, y*y_cell*Y_UNIT);
-
-
-  wxFont font= BOMBS_FONT;
-  dc->SetFont(font); 
-
-  buf[1]='\0';
-  for(x=xc1; x<=xc2; x++)
-    for(y=yc1; y<=yc2; y++)
-      { if (wxGetApp().Game.IsMarked(x,y))
-          { dc->SetPen(* blackPen);
-            dc->SetBrush(* greyBrush);
-            dc->DrawRectangle( x*x_cell*X_UNIT, y*y_cell*Y_UNIT,
-                               x_cell*X_UNIT+1, y_cell*Y_UNIT+1);
-            *buf='M';
-            if (!wxGetApp().Game.IsHidden(x,y) && wxGetApp().Game.IsBomb(x,y))
-              dc->SetTextForeground(*wxBlue);
-            else
-              dc->SetTextForeground(*wxRed);
-            dc->SetTextBackground(*wxGrey);
-            dc->GetTextExtent(buf, &chw, &chh);
-            dc->DrawText( buf,
-                  x*x_cell*X_UNIT + (x_cell*X_UNIT-chw)/2,
-                  y*y_cell*Y_UNIT + (y_cell*Y_UNIT-chh)/2
-                );
-            if (!wxGetApp().Game.IsHidden(x,y) && wxGetApp().Game.IsBomb(x,y))
-              { dc->SetPen(*redPen);
-                dc->DrawLine(x*x_cell*X_UNIT, y*y_cell*Y_UNIT,
-                             (x+1)*x_cell*X_UNIT, (y+1)*y_cell*Y_UNIT);
-                dc->DrawLine(x*x_cell*X_UNIT, (y+1)*y_cell*Y_UNIT,
-                             (x+1)*x_cell*X_UNIT, y*y_cell*Y_UNIT);
-              }
-          }
-        else if (wxGetApp().Game.IsHidden(x,y))
-          { dc->SetPen(*blackPen);
-            dc->SetBrush(*greyBrush);
-            dc->DrawRectangle( x*x_cell*X_UNIT, y*y_cell*Y_UNIT,
-                               x_cell*X_UNIT+1, y_cell*Y_UNIT+1);
-          }
-        else if (wxGetApp().Game.IsBomb(x,y))
-          { dc->SetPen(* blackPen);
-            dc->SetBrush(* redBrush);
-            dc->DrawRectangle( x*x_cell*X_UNIT, y*y_cell*Y_UNIT,
-                               x_cell*X_UNIT+1, y_cell*Y_UNIT+1);
-            *buf='B';
-            dc->SetTextForeground(* wxBlack);
-            dc->SetTextBackground(* wxRed);
-            dc->GetTextExtent(buf, &chw, &chh);
-            dc->DrawText( buf,
-                  x*x_cell*X_UNIT + (x_cell*X_UNIT-chw)/2,
-                  y*y_cell*Y_UNIT + (y_cell*Y_UNIT-chh)/2
-                );
-            if (wxGetApp().Game.IsExploded(x,y))
-              { dc->SetPen(* bluePen);
-                dc->DrawLine(x*x_cell*X_UNIT, y*y_cell*Y_UNIT,
-                             (x+1)*x_cell*X_UNIT, (y+1)*y_cell*Y_UNIT);
-                dc->DrawLine(x*x_cell*X_UNIT, (y+1)*y_cell*Y_UNIT,
-                             (x+1)*x_cell*X_UNIT, y*y_cell*Y_UNIT);
-              }
-          }
-        else   // Display a digit
-          { dc->SetPen(* blackPen);
-            dc->SetBrush(* whiteBrush);
-            dc->DrawRectangle( x*x_cell*X_UNIT, y*y_cell*Y_UNIT,
-                               x_cell*X_UNIT+1, y_cell*Y_UNIT+1);
-            *buf = (wxGetApp().Game.Get(x,y) & BG_MASK) + '0';
-            dc->GetTextExtent(buf, &chw, &chh);
-            switch(*buf)
-              { case '0': dc->SetTextForeground(* wxGreen); break;
-                case '1': dc->SetTextForeground(* wxBlue); break;
-                default:  dc->SetTextForeground(* wxBlack); break;
-              }
-            dc->SetTextBackground(* wxWhite);
-            dc->DrawText( buf,
-                  x*x_cell*X_UNIT + (x_cell*X_UNIT-chw)/2,
-                  y*y_cell*Y_UNIT + (y_cell*Y_UNIT-chh)/2
-                );
-          }
-      }
-  dc->SetFont(wxNullFont);
-
-  if (wxGetApp().BombsFrame)
-    { char buf[80];
-      sprintf(buf, "%d bombs  %d remaining cells",
-              wxGetApp().Game.GetBombs(), wxGetApp().Game.GetRemainingCells());
-      wxGetApp().BombsFrame->SetStatusText(buf, 0);
-    }
-}
-
-/*--------  BombCanvasClass::Refresh(xc1, yc1, xc2, yc2)  -------------*/
-/* Refreshes the field image                                           */
-/* xc1,yc1 etc. are the (inclusive) limits of the area to be drawn,    */
-/* expressed in cells.                                                 */
-/*---------------------------------------------------------------------*/
-void BombsCanvasClass::Refresh(int xc1, int yc1, int xc2, int yc2)
-  {
-    wxClientDC dc(this);
-    DrawField(& dc, xc1, yc1, xc2, yc2);
-    if (bmp)
-      { wxMemoryDC memDC;
-        memDC.SelectObject(* bmp);
-        DrawField(&memDC, xc1, yc1, xc2, yc2);
-        memDC.SelectObject(wxNullBitmap);
-      }
-  }
-
-// Called when the canvas receives a mouse event.
-void BombsCanvasClass::OnEvent(wxMouseEvent& event)
-{
-  wxCoord fx, fy;
-  event.GetPosition(&fx, &fy);
-  int x = fx/(x_cell*X_UNIT);
-  int y = fy/(y_cell*Y_UNIT);
-  if (x<field_width && y<field_height)
-    { if ( (event.RightDown() || (event.LeftDown() && event.ShiftDown()))
-           && (wxGetApp().Game.IsHidden(x,y)
-               || wxGetApp().Game.GetRemainingCells()==0))
-        { wxGetApp().Game.Mark(x,y);
-          Refresh(x, y, x, y);
-          return;
-        }
-      else if (event.LeftDown() && wxGetApp().Game.IsHidden(x,y)
-               && !wxGetApp().Game.IsMarked(x,y))
-        { wxGetApp().Game.Unhide(x,y);
-          Refresh(x, y, x, y);
-          if (wxGetApp().Game.IsBomb(x,y) || wxGetApp().Game.GetRemainingCells()==0)
-            { wxBell();
-              if (!wxGetApp().Game.IsBomb(x,y))
-                { wxMessageBox("Nice! You found all the bombs!", "wxWin Bombs",
-                             wxOK|wxCENTRE, wxGetApp().BombsFrame);
-                }
-              else // x,y is a bomb
-                { wxGetApp().Game.Explode(x, y);
-                }
-              for(x=0; x<field_width; x++)
-                for(y=0; y<field_height; y++)
-                  wxGetApp().Game.Unhide(x,y);
-              Refresh(0, 0, field_width-1, field_height-1);
-            }
-          return;
-        }
-    }
-}
-
diff --git a/samples/bombs/descrip.mms b/samples/bombs/descrip.mms
deleted file mode 100644 (file)
index 2d2cdaa..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-#*****************************************************************************
-#                                                                            *
-# Make file for VMS                                                          *
-# Author : J.Jansen (joukj@hrem.stm.tudelft.nl)                              *
-# Date : 10 November 1999                                                     *
-#                                                                            *
-#*****************************************************************************
-.first
-       define wx [--.include.wx]
-
-.ifdef __WXMOTIF__
-CXX_DEFINE = /define=(__WXMOTIF__=1)
-.else
-CXX_DEFINE =
-.endif
-
-.suffixes : .cpp
-
-.cpp.obj :
-       cxx $(CXXFLAGS)$(CXX_DEFINE) $(MMS$TARGET_NAME).cpp
-
-all :
-       $(MMS)$(MMSQUALIFIERS) game.exe
-
-game.exe : game.obj bombs1.obj bombs.obj
-.ifdef __WXMOTIF__
-       cxxlink game,bombs1,bombs,[--.lib]vms/opt
-.endif
-
-game.obj : game.cpp
-bombs1.obj : bombs1.cpp
-bombs.obj : bombs.cpp
diff --git a/samples/bombs/game.cpp b/samples/bombs/game.cpp
deleted file mode 100644 (file)
index d49b6a4..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// Name:        bombs1.cpp
-// Purpose:     Implementation of the class BombsGame
-// Author:      P. Foggia 1996
-// Modified by:
-// Created:     1996
-// RCS-ID:      $Id$
-// Copyright:   (c) 1996 P. Foggia
-// Licence:     wxWindows licence
-///////////////////////////////////////////////////////////////////////////////
-
-#ifdef __GNUG__
-#pragma implementation
-#endif
-
-#include "wx/wxprec.h"
-
-#ifndef  WX_PRECOMP
-  #include "wx/wx.h"
-#endif //precompiled headers
-
-#include "game.h"
-#include <stdlib.h>
-#include <limits.h>
-
-#define PROB 0.2
-
-#ifndef RAND_MAX
-#define RAND_MAX INT_MAX
-#endif
-
-
-/*--------------------  BombsGame::~BombsGame()  ---------------------*/
-/*--------------------------------------------------------------------*/
-BombsGame::~BombsGame()
-  { if (field)
-      free(field);
-  }
-
-/*------------------  int BombsGame::Init(width,height)  -------------------*/
-/* Initialize the play field.   Returns 0 on failure                        */
-/*--------------------------------------------------------------------------*/
-int BombsGame::Init(int aWidth, int aHeight)
-  { int x, y;
-    int xx, yy;
-
-    if (field)
-      free(field);
-    field=(short *)malloc(aWidth*aHeight*sizeof(short));
-    if (!field)
-      { width=height=0;
-        return 0;
-      }
-    width=aWidth;
-    height=aHeight;
-
-    for(x=0; x<width; x++)
-      for(y=0; y<height; y++)
-        { field[x+y*width] = ((float)rand()/RAND_MAX <PROB)?
-                             BG_HIDDEN | BG_BOMB :
-                             BG_HIDDEN;
-        }
-
-    bombs=0;
-    for(x=0; x<width; x++)
-      for(y=0; y<height; y++)
-        if (field[x+y*width] & BG_BOMB)
-          { bombs++;
-            for(xx=x-1; xx<=x+1; xx++)
-              if (xx>=0 && xx<width)
-                for(yy=y-1; yy<=y+1; yy++)
-                  if (yy>=0 && yy<height && (yy!=y || xx!=x))
-                    field[xx+yy*width]++;
-          }
-    normal_cells=height*width-bombs;
-    return 1;
-  }
-
-/*----------------------  BombsGame::Mark(x,y)  -------------------------*/
-/* Marks/unmarks a cell                                                  */
-/*-----------------------------------------------------------------------*/
-void BombsGame::Mark(int x, int y)
-  {
-      field[x+y*width] ^= BG_MARKED;
-  }
-
-/*-------------------  BombsGame::Unhide(x,y)  ------------------------*/
-/* Unhides a cell                                                      */
-/*---------------------------------------------------------------------*/
-void BombsGame::Unhide(int x, int y)
-  { if (!IsHidden(x,y))
-      return;
-    field[x+y*width] &= ~BG_HIDDEN;
-    if (!IsBomb(x,y))
-      normal_cells--;
-  }
-
-/*-------------------  BombsGame::Explode(x,y)  ------------------------*/
-/* Makes a cell exploded                                                */
-/*----------------------------------------------------------------------*/
-void BombsGame::Explode(int x, int y)
-  {
-    field[x+y*width] |= BG_EXPLODED;
-  }
-
diff --git a/samples/bombs/game.h b/samples/bombs/game.h
deleted file mode 100644 (file)
index ad16000..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-//---------------------------------------------------------------
-// game.h
-// Definition of the class BombsGame, containing the data for a
-// playfield
-//---------------------------------------------------------------
-#ifndef GAME_H
-#define GAME_H
-
-#define BG_HIDDEN   0x100
-#define BG_BOMB     0x200
-#define BG_MARKED   0x400
-#define BG_EXPLODED 0x800
-#define BG_MASK     0x0FF
-
-
-#include <stddef.h>
-
-class BombsGame
-  { protected:
-      int width,height;
-      short *field;
-      int bombs,normal_cells;
-    public:
-      BombsGame() { width=height=0; field=NULL; };
-      ~BombsGame();
-      int Init(int width, int height);
-      int GetWidth() { return width; };
-      int GetHeight() { return height; };
-      int Get(int x, int y) { return field[x+y*width]; };
-      void Mark(int x, int y);
-      void Unhide(int x, int y);
-      void Explode(int x, int y);
-      int IsHidden(int x, int y) { return Get(x,y) & BG_HIDDEN; };
-      int IsMarked(int x, int y) { return Get(x,y) & BG_MARKED; };
-      int IsBomb(int x, int y) { return Get(x,y) & BG_BOMB; };
-      int IsExploded(int x, int y) { return Get(x,y) & BG_EXPLODED; };
-      int GetBombs() { return bombs; };
-      int GetRemainingCells() { return normal_cells; };
-  };
-
-#endif /* def GAME_H */
-
diff --git a/samples/bombs/makefile.b32 b/samples/bombs/makefile.b32
deleted file mode 100644 (file)
index 563f61f..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# File:                makefile.b32
-# Author:      Julian Smart
-# Created:     1999
-# Updated:     
-# Copyright:
-#
-# Makefile : Builds sample for 32-bit BC++
-
-WXDIR = $(WXWIN)
-
-TARGET=bombs
-OBJECTS = $(TARGET).obj bombs1.obj game.obj
-
-!include $(WXDIR)\src\makeprog.b32
-
diff --git a/samples/bombs/makefile.bcc b/samples/bombs/makefile.bcc
deleted file mode 100644 (file)
index 38896fc..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# File:                makefile.bcc
-# Author:      Julian Smart
-# Created:     1998
-# Updated:     
-#
-# Builds a BC++ 16-bit sample
-
-!if "$(WXWIN)" == ""
-!error You must define the WXWIN variable in autoexec.bat, e.g. WXWIN=c:\wx
-!endif
-
-WXDIR = $(WXWIN)
-
-TARGET=bombs
-OBJECTS=$(TARGET).obj bombs1.obj game.obj
-
-!include $(WXDIR)\src\makeprog.bcc
-
diff --git a/samples/bombs/makefile.dos b/samples/bombs/makefile.dos
deleted file mode 100644 (file)
index 8af1fd0..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# File:                makefile.dos
-# Author:      Julian Smart
-# Created:     1998
-# Updated:     
-#
-# Makefile : Builds 16-bit sample, VC++ 1.5
-# Use FINAL=1 argument to nmake to build final version with no debugging
-# info
-
-WXDIR = $(WXWIN)
-
-TARGET=bombs
-OBJECTS = $(TARGET).obj bombs1.obj game.obj
-
-!include $(WXDIR)\src\makeprog.msc
-
diff --git a/samples/bombs/makefile.g95 b/samples/bombs/makefile.g95
deleted file mode 100644 (file)
index 43119df..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# File:         makefile.g95
-# Author:       Julian Smart
-# Created:      1999
-# Updated:
-# Copyright:    (c) Julian Smart, 1999
-#
-# Makefile for wxWindows sample (Cygwin/Mingw32).
-
-WXDIR = ../..
-
-TARGET=bombs
-OBJECTS = $(TARGET).o bombs1.o game.o
-
-include $(WXDIR)/src/makeprog.g95
-
diff --git a/samples/bombs/makefile.unx b/samples/bombs/makefile.unx
deleted file mode 100644 (file)
index 9b4f82a..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-#
-# File:                Makefile for samples
-# Author:      Robert Roebling
-# Created:     1999
-# Updated:     
-# Copyright:   (c) 1998 Robert Roebling
-#
-# This makefile requires a Unix version of wxWindows
-# to be installed on your system. This is most often
-# done typing "make install" when using the complete
-# sources of wxWindows or by installing the two
-# RPM packages wxGTK.XXX.rpm and wxGTK-devel.XXX.rpm
-# under Linux.
-#
-
-CC = gcc
-
-PROGRAM = bombs
-
-OBJECTS = $(PROGRAM).o game.o bombs1.o
-
-# implementation
-
-.SUFFIXES:     .o .cpp
-
-.cpp.o :
-       $(CC) -c `wx-config --cflags` -o $@ $<
-
-all:    $(PROGRAM)
-
-$(PROGRAM):    $(OBJECTS)
-       $(CC) -o $(PROGRAM) $(OBJECTS) `wx-config --libs`
-
-clean: 
-       rm -f *.o $(PROGRAM)
diff --git a/samples/bombs/makefile.vc b/samples/bombs/makefile.vc
deleted file mode 100644 (file)
index 06a647f..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# File:                makefile.vc
-# Author:      Julian Smart
-# Created:     1999
-# Updated:     
-# Copyright:   (c) Julian Smart
-#
-# Makefile : Builds sample (VC++, WIN32)
-# Use FINAL=1 argument to nmake to build final version with no debug info.
-
-# Set WXDIR for your system
-WXDIR = $(WXWIN)
-
-PROGRAM=bombs
-OBJECTS = $(PROGRAM).obj bombs1.obj game.obj
-
-!include $(WXDIR)\src\makeprog.vc
-
diff --git a/samples/bombs/makefile.wat b/samples/bombs/makefile.wat
deleted file mode 100644 (file)
index 08562fa..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#
-# Makefile for WATCOM
-#
-# Created by Julian Smart, January 1999
-# 
-#
-
-WXDIR = $(%WXWIN)
-
-PROGRAM = bombs
-OBJECTS = $(PROGRAM).obj bombs1.obj game.obj
-
-!include $(WXDIR)\src\makeprog.wat
-
-
diff --git a/samples/bombs/readme.txt b/samples/bombs/readme.txt
deleted file mode 100644 (file)
index 4e6e8da..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-                    wxWin Bombs
-                 by Pasquale Foggia
-
-1. The aim of the program
-wxWin Bombs is the wxWin implementation of the minesweeper game you find
-under MSWindows 3.1+. Later the rules of the game will be explained for
-the lucky ones of you that have never used Windows.
-
-2. Installation
-If you are reading this file, I suppose you have succesfully unpacked the
-files in a directory of your hard disk :-). You should already have
-installed wxWin on your system.
-Now you have to modify makefile.bcc
-(if a Windows user) or makefile.unx (if you use a real OS) setting the 
-proper values for the directories. Finally, you have to run:
-  make -f makefile.bcc
-for Windows (nmake if you use a MicroSoft compiler), or:
-  make -f makefile.unx xview
-for Unix+xview and
-  make -f makefile.unx motif
-for Unix+motif
-
-If you are lucky, you will find the bombs executable, ready to be run.
-
-3. Test
-Bombs has been tested under the following platforms:
-  PC + MSWindos 3.1 + wxWin 1.60 + Borland C 3.1
-  Sun SPARCstation 20 + SunOS + xview + wxWin 1.63 + gcc 2.3.3
-and all seems to work fine.
-
-4. The author
-This program has been developed by Pasquale Foggia, a PhD student 
-in Computer Engineering at the "Federico II" University of Naples, Italy.
-You can contacting him using the following address:
-  foggia@amalfi.dis.unina.it
-
-5. Disclaimer
-This program is freeware. You can do everything you want with it, including
-copying and modifying, without the need of a permission from the author.
-On the other hand, this program is provided AS IS, with NO KIND OF WARRANTY.
-The author will be in NO CASE responsible for damages directly or indirectly 
-caused by this program. Use it AT YOUR OWN RISK, or don't use it at all. 
-
-6. The rules of the game
-Your aim is to discover all the bombs in a mined field. If you click with
-the left mouse button on a cell containing a bomb, your game ends. 
-Otherwise, the number of bombs in the 8 neighbour cells will be displayed. 
-When you have clicked all the cells without a bomb, you win.
-You can also use the right button (or left button+shift) to mark a cell
-you think hides a bomb, in order to not click it accidentally.
-
-7. Concluding remarks
-I hope someone of you will enjoy this program. However, I enjoyed writing
-it (thanks to Julian Smart and all the other wxWin developers).   
-In the near future I plan to implement under wxWin the great 'empire'
-(is there someone that still remember it?), IMHO one of the most addictive
-strategy games. If someone is interested, please contact me by e-mail.
-I beg you pardon for my approximative english.
-
-                                               Pasquale Foggia
-                                               foggia@amalfi.dis.unina.it
-
-
-------
-A note from Julian Smart: Many thanks to Pasquale for the contribution.
-I've taken the liberty of making a few changes.
-
-1) I've made the status line have a single field so that you
-can see the 'cells remaining' message properly.
-
-2) I've changed the title from "wxWin Bombs" (which, as a statement,
-is an unfortunate reflection of the reality of earlier versions of
-wxWindows :-)) to wxBombs.
-
-3) Added SetClientData to resize the window on Restart; eliminated
-scrollbars; made the frame unresizeable.
-
-4) Added makefile.dos for VC++ 1.x, makefile.wat for Watcom C++.
\ No newline at end of file
diff --git a/samples/dde/.cvsignore b/samples/dde/.cvsignore
deleted file mode 100644 (file)
index f5eaa1a..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-Makefile.in
-
diff --git a/samples/dde/client.cpp b/samples/dde/client.cpp
deleted file mode 100644 (file)
index 616ef99..0000000
+++ /dev/null
@@ -1,220 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name:        client.cpp
-// Purpose:     DDE sample: client
-// Author:      Julian Smart
-// Modified by:
-// Created:     25/01/99
-// RCS-ID:      $Id$
-// Copyright:   (c) Julian Smart
-// Licence:     wxWindows licence
-/////////////////////////////////////////////////////////////////////////////
-
-// For compilers that support precompilation, includes "wx.h".
-#include "wx/wxprec.h"
-
-#ifdef __BORLANDC__
-#pragma hdrstop
-#endif
-
-#ifndef WX_PRECOMP
-#include "wx/wx.h"
-#endif
-
-// Settings common to both executables: determines whether
-// we're using TCP/IP or real DDE.
-
-#include "ddesetup.h"
-
-#if defined(__WXGTK__) || defined(__WXMOTIF__)
-#include "mondrian.xpm"
-#endif
-
-#include "client.h"
-
-MyFrame *frame = NULL;
-
-IMPLEMENT_APP(MyApp)
-
-char ipc_buffer[4000];
-wxListBox *the_list = NULL;
-
-MyConnection *the_connection = NULL;
-MyClient *my_client ;
-
-// The `main program' equivalent, creating the windows and returning the
-// main frame
-bool MyApp::OnInit()
-{
-  // Create the main frame window
-  frame = new MyFrame(NULL, "Client", wxPoint(400, 0), wxSize(400, 300));
-
-  // Give it an icon
-  frame->SetIcon(wxICON(mondrian));
-
-  // Make a menubar
-  wxMenu *file_menu = new wxMenu;
-
-  file_menu->Append(CLIENT_EXECUTE, "Execute");
-  file_menu->Append(CLIENT_REQUEST, "Request");
-  file_menu->Append(CLIENT_POKE, "Poke");
-  file_menu->Append(CLIENT_QUIT, "Quit");
-
-  wxMenuBar *menu_bar = new wxMenuBar;
-
-  menu_bar->Append(file_menu, "File");
-
-  // Associate the menu bar with the frame
-  frame->SetMenuBar(menu_bar);
-
-  // Make a panel
-  frame->panel = new wxPanel(frame, -1, wxPoint(0, 0), wxSize(400, 250));
-  the_list = new wxListBox(frame->panel, CLIENT_LISTBOX, wxPoint(5, 5), wxSize(150, 120));
-  the_list->Append("Apple");
-  the_list->Append("Pear");
-  the_list->Append("Orange");
-  the_list->Append("Banana");
-  the_list->Append("Fruit");
-
-  frame->panel->Fit();
-  frame->Fit();
-
-  wxString server = "4242";
-
-#if wxUSE_DDE_FOR_SAMPLE
-  wxString hostName = wxGetHostName();
-#else
-  wxString hostName = "localhost";
-#endif
-
-  if (argc > 1)
-    server = argv[1];
-  if (argc > 2)
-    hostName = argv[2];
-
-  // Create a new client
-  my_client = new MyClient;
-  the_connection = (MyConnection *)my_client->MakeConnection(hostName, server, "IPC TEST");
-
-  if (!the_connection)
-  {
-    wxMessageBox("Failed to make connection to server", "Client Demo Error");
-#ifdef __WXMSW__
-//    extern void wxPrintDDEError();
-//    wxPrintDDEError();
-#endif
-    return FALSE;
-  }
-  if (!the_connection->StartAdvise("Item"))
-    wxMessageBox("StartAdvise failed", "Client Demo Error");
-
-  frame->Show(TRUE);
-
-  return TRUE;
-}
-
-int MyApp::OnExit()
-{
-    if (my_client)
-      delete my_client ;
-
-    return 0;
-}
-
-BEGIN_EVENT_TABLE(MyFrame, wxFrame)
-    EVT_MENU(CLIENT_QUIT, MyFrame::OnExit)
-    EVT_MENU(CLIENT_EXECUTE, MyFrame::OnExecute)
-    EVT_MENU(CLIENT_POKE, MyFrame::OnPoke)
-    EVT_MENU(CLIENT_REQUEST, MyFrame::OnRequest)
-    EVT_CLOSE(MyFrame::OnCloseWindow)
-END_EVENT_TABLE()
-
-// Define my frame constructor
-MyFrame::MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size):
-  wxFrame(frame, -1, title, pos, size)
-{
-    panel = NULL;
-}
-
-void MyFrame::OnExecute(wxCommandEvent& event)
-{
-      if (the_connection)
-        if (!the_connection->Execute("Hello from the client!"))
-          wxMessageBox("Execute failed", "Client Demo Error");
-}
-
-void MyFrame::OnPoke(wxCommandEvent& event)
-{
-      if (the_connection)
-        if (!the_connection->Poke("An item", "Some data to poke at the server!"))
-          wxMessageBox("Poke failed", "Client Demo Error");
-}
-
-void MyFrame::OnRequest(wxCommandEvent& event)
-{
-      if (the_connection)
-      {
-        char *data = the_connection->Request("An item");
-        if (data)
-          wxMessageBox(data, "Client: Request", wxOK);
-        else
-          wxMessageBox("Request failed", "Client Demo Error");
-      }
-}
-
-void MyFrame::OnExit(wxCommandEvent& event)
-{
-  if (the_connection)
-    the_connection->Disconnect();
-
-  this->Destroy();
-}
-
-// Define the behaviour for the frame closing
-void MyFrame::OnCloseWindow(wxCloseEvent& event)
-{
-  if (the_connection)
-  {
-    the_connection->Disconnect();
-  }
-  this->Destroy();
-}
-
-MyClient::MyClient(void)
-{
-}
-
-wxConnectionBase *MyClient::OnMakeConnection(void)
-{
-  return new MyConnection;
-}
-
-MyConnection::MyConnection(void):wxConnection(ipc_buffer, 3999)
-{
-}
-
-MyConnection::~MyConnection(void)
-{
-  the_connection = NULL;
-}
-
-bool MyConnection::OnAdvise(const wxString& topic, const wxString& item, char *data, int size, wxIPCFormat format)
-{
-  if (the_list)
-  {
-    int n = the_list->FindString(data);
-    if (n > -1)
-      the_list->SetSelection(n);
-  }
-  return TRUE;
-}
-
-bool MyConnection::OnDisconnect()
-{
-    frame->Destroy();
-
-    the_connection = NULL;
-    delete this;
-
-    return TRUE;
-}
-
diff --git a/samples/dde/client.def b/samples/dde/client.def
deleted file mode 100644 (file)
index 786b7d6..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-NAME         Client
-DESCRIPTION  'Client'
-EXETYPE      WINDOWS
-STUB         'WINSTUB.EXE'
-CODE         PRELOAD MOVEABLE DISCARDABLE
-DATA         PRELOAD MOVEABLE MULTIPLE
-HEAPSIZE     1024
-STACKSIZE    8192
diff --git a/samples/dde/client.g95 b/samples/dde/client.g95
deleted file mode 100644 (file)
index 260c61c..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# File:         makefile.g95
-# Author:       Julian Smart
-# Created:      1999
-# Updated:
-# Copyright:    (c) Julian Smart, 1999
-#
-# Makefile for wxWindows sample (Cygwin/Mingw32).
-
-WXDIR = ../..
-
-TARGET=client
-OBJECTS = $(TARGET).o
-
-include $(WXDIR)/src/makeprog.g95
-
diff --git a/samples/dde/client.h b/samples/dde/client.h
deleted file mode 100644 (file)
index 8017a29..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name:        client.h
-// Purpose:     DDE sample: client
-// Author:      Julian Smart
-// Modified by:
-// Created:     25/01/99
-// RCS-ID:      $Id$
-// Copyright:   (c) Julian Smart
-// Licence:     wxWindows licence
-/////////////////////////////////////////////////////////////////////////////
-
-// Define a new application
-class MyApp: public wxApp
-{
-  public:
-    bool OnInit();
-    int OnExit();
-};
-
-// Define a new frame
-class MyFrame: public wxFrame
-{
-  public:
-    wxPanel *panel;
-
-    MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size);
-    void OnCloseWindow(wxCloseEvent& event);
-    void OnExit(wxCommandEvent& event);
-    void OnExecute(wxCommandEvent& event);
-    void OnPoke(wxCommandEvent& event);
-    void OnRequest(wxCommandEvent& event);
-DECLARE_EVENT_TABLE()
-};
-
-class MyConnection: public wxConnection
-{
- public:
-  MyConnection();
-  ~MyConnection();
-  bool OnAdvise(const wxString& topic, const wxString& item, char *data, int size, wxIPCFormat format);
-  bool OnDisconnect();
-};
-
-class MyClient: public wxClient
-{
- public:
-  MyClient();
-  wxConnectionBase *OnMakeConnection();
-};
-
-#define CLIENT_QUIT     wxID_EXIT
-#define CLIENT_EXECUTE  2
-#define CLIENT_REQUEST  3
-#define CLIENT_POKE     4
-#define CLIENT_LISTBOX  200
diff --git a/samples/dde/client.rc b/samples/dde/client.rc
deleted file mode 100644 (file)
index 74b8e3f..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-mondrian ICON "mondrian.ico"
-#include "wx/msw/wx.rc"
diff --git a/samples/dde/client.vc b/samples/dde/client.vc
deleted file mode 100644 (file)
index f525240..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-#
-# File:                makefile.vc
-# Author:      Julian Smart
-# Created:     1999
-# Updated:     
-# Copyright:   (c) Julian Smart
-#
-# Makefile : Builds sample (VC++, WIN32)
-# Use FINAL=1 argument to nmake to build final version with no debug info.
-
-# Set WXDIR for your system
-WXDIR = $(WXWIN)
-
-PROGRAM=client
-OBJECTS = $(PROGRAM).obj
-
-!include $(WXDIR)\src\makeprog.vc
-
-client.obj: ddesetup.h
-
diff --git a/samples/dde/client.wat b/samples/dde/client.wat
deleted file mode 100644 (file)
index 789db64..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#
-# Makefile for WATCOM
-#
-# Created by Julian Smart, January 1999
-# 
-#
-
-WXDIR = $(%WXWIN)
-
-PROGRAM = client
-OBJECTS = $(PROGRAM).obj
-
-!include $(WXDIR)\src\makeprog.wat
-
-
diff --git a/samples/dde/ddesetup.h b/samples/dde/ddesetup.h
deleted file mode 100644 (file)
index caf3839..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name:        ddesetup.h
-// Purpose:     DDE sample settings
-// Author:      Julian Smart
-// Modified by:
-// Created:     25/01/99
-// RCS-ID:      $Id$
-// Copyright:   (c) Julian Smart
-// Licence:     wxWindows licence
-/////////////////////////////////////////////////////////////////////////////
-
-/*
- * Adjust this before compiling, to switch between real DDE and TCP/IP
- * implementations.
- */
-
-// If 1, use real DDE. If 0, use TCP/IP
-
-#ifdef __WXMSW__
-#define wxUSE_DDE_FOR_SAMPLE 1
-#else
-#define wxUSE_DDE_FOR_SAMPLE 0
-#endif
-
-#if wxUSE_DDE_FOR_SAMPLE
-
-#define wxConnection    wxDDEConnection
-#define wxServer        wxDDEServer
-#define wxClient        wxDDEClient
-
-#include <wx/dde.h>
-
-#else
-
-#define wxConnection    wxTCPConnection
-#define wxServer        wxTCPServer
-#define wxClient        wxTCPClient
-
-#include <wx/sckipc.h>
-
-#endif
-
diff --git a/samples/dde/makefile.b32 b/samples/dde/makefile.b32
deleted file mode 100644 (file)
index 94a0ed2..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-#
-# File:                makefile.b32
-# Author:      Guilhem Lavaux
-# Created:     1998
-# Updated:     
-# Copyright:   (c) Guilhem Lavaux
-#
-# "%W% %G%"
-#
-# Makefile : Builds 32-bit wxSocket sample under BC++
-
-WXDIR = $(WXWIN)
-
-ZLIB = $(WXDIR)\lib\zlib.lib
-
-!include $(WXDIR)\src\makeb32.env
-
-WXLIBDIR = $(WXDIR)\lib
-WXINC = $(WXDIR)\include\msw
-WXLIB = $(WXLIBDIR)\wx32.lib
-LIBS=$(WXLIB) $(ZLIB) cw32 import32 ole2w32
-
-!if "$(FINAL)" == "0"
-LINKFLAGS=/v /Tpe /L$(WXLIBDIR);$(BCCDIR)\lib
-OPT = -Od
-DEBUG_FLAGS= -v
-!else
-LINKFLAGS=/Tpe /L$(WXLIBDIR);$(BCCDIR)\lib
-OPT = -Od
-DEBUG_FLAGS =
-!endif
-CPPFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG)
-
-.$(SRCSUFF).obj:
-       bcc32 $(CPPFLAGS) -c {$< }
-
-.c.obj:
-       bcc32 $(CPPFLAGS) -P- -c {$< }
-
-CLIENT_TARGET=client
-SERVER_TARGET=server
-CLIENT_OBJECTS=client.obj
-SERVER_OBJECTS=server.obj
-
-all:    $(CLIENT_TARGET).exe $(SERVER_TARGET).exe
-
-$(CLIENT_TARGET).exe:   $(CLIENT_OBJECTS) $(CLIENT_TARGET).res
-  tlink32 $(LINKFLAGS) @&&!
-  c0w32.obj $(CLIENT_OBJECTS)
-  $(CLIENT_TARGET)
-  nul
-  $(LIBS)
-  $(CLIENT_TARGET).def
-  $(CLIENT_TARGET).res
-!
-
-client.obj:     client.cpp
-
-$(CLIENT_TARGET).res :      $(CLIENT_TARGET).rc $(WXDIR)\include\wx\msw\wx.rc
-    brc32 -r /i$(BCCDIR)\include /i$(WXDIR)\include $(CLIENT_TARGET)
-
-$(SERVER_TARGET).exe:   $(SERVER_OBJECTS) $(SERVER_TARGET).res
-  tlink32 $(LINKFLAGS) @&&!
-  c0w32.obj $(SERVER_OBJECTS)
-  $(SERVER_TARGET)
-  nul
-  $(LIBS)
-  $(SERVER_TARGET).def
-  $(SERVER_TARGET).res
-!
-
-server.obj:     server.cpp
-
-$(SERVER_TARGET).res:   $(SERVER_TARGET).rc $(WXDIR)\include\wx\msw\wx.rc
-    brc32 -r /i$(BCCDIR)\include /i$(WXDIR)\include $(SERVER_TARGET)
-
-clean:
-        -erase *.obj
-        -erase *.exe
-        -erase *.res
-        -erase *.map
-        -erase *.rws
diff --git a/samples/dde/makefile.dos b/samples/dde/makefile.dos
deleted file mode 100644 (file)
index 2a42833..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# File:                makefile.dos
-# Author:      Julian Smart
-# Created:     1998
-# Updated:     
-#
-# Makefile : Builds 16-bit sample, VC++ 1.5
-# Use FINAL=1 argument to nmake to build final version with no debugging
-# info
-
-WXDIR = $(WXWIN)
-
-TARGET=client
-OBJECTS = $(TARGET).obj
-
-# TODO: server
-
-!include $(WXDIR)\src\makeprog.msc
-
diff --git a/samples/dde/makefile.g95 b/samples/dde/makefile.g95
deleted file mode 100644 (file)
index 40343dd..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# File:                makefile.g95
-# Author:      Julian Smart
-# Created:     1993
-# Updated:     
-# Copyright:   (c) 1993, AIAI, University of Edinburgh
-#
-# "%W% %G%"
-#
-# Makefile for server/client example (UNIX).
-
-all:
-       make -f client.g95 all
-       make -f server.g95 all
-
-clean:
-       make -f client.g95 clean
-       make -f server.g95 clean
-
diff --git a/samples/dde/makefile.vc b/samples/dde/makefile.vc
deleted file mode 100644 (file)
index 3864d7d..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-#
-# File:                makefile.vc
-# Author:      Julian Smart
-# Created:     1999
-# Updated:     
-# Copyright:   (c) Julian Smart
-#
-# Makefile : Builds sample (VC++, WIN32)
-# Use FINAL=1 argument to nmake to build final version with no debug info.
-
-!include $(WXWIN)/src/makevc.env
-
-all:
-    nmake -f server.vc FINAL=$(FINAL)
-    nmake -f client.vc FINAL=$(FINAL)
-
-clean:
-    nmake -f server.vc clean
-    nmake -f client.vc clean
-
diff --git a/samples/dde/mondrian.ico b/samples/dde/mondrian.ico
deleted file mode 100644 (file)
index 2310c5d..0000000
Binary files a/samples/dde/mondrian.ico and /dev/null differ
diff --git a/samples/dde/mondrian.xpm b/samples/dde/mondrian.xpm
deleted file mode 100644 (file)
index 409f27a..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/* XPM */
-static char *mondrian_xpm[] = {
-/* columns rows colors chars-per-pixel */
-"32 32 6 1",
-"  c Black",
-". c Blue",
-"X c #00bf00",
-"o c Red",
-"O c Yellow",
-"+ c Gray100",
-/* pixels */
-"                                ",
-" oooooo +++++++++++++++++++++++ ",
-" oooooo +++++++++++++++++++++++ ",
-" oooooo +++++++++++++++++++++++ ",
-" oooooo +++++++++++++++++++++++ ",
-" oooooo +++++++++++++++++++++++ ",
-" oooooo +++++++++++++++++++++++ ",
-" oooooo +++++++++++++++++++++++ ",
-"                                ",
-" ++++++ ++++++++++++++++++ .... ",
-" ++++++ ++++++++++++++++++ .... ",
-" ++++++ ++++++++++++++++++ .... ",
-" ++++++ ++++++++++++++++++ .... ",
-" ++++++ ++++++++++++++++++ .... ",
-" ++++++ ++++++++++++++++++      ",
-" ++++++ ++++++++++++++++++ ++++ ",
-" ++++++ ++++++++++++++++++ ++++ ",
-" ++++++ ++++++++++++++++++ ++++ ",
-" ++++++ ++++++++++++++++++ ++++ ",
-" ++++++ ++++++++++++++++++ ++++ ",
-" ++++++ ++++++++++++++++++ ++++ ",
-" ++++++ ++++++++++++++++++ ++++ ",
-" ++++++ ++++++++++++++++++ ++++ ",
-" ++++++ ++++++++++++++++++ ++++ ",
-" ++++++                    ++++ ",
-" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
-" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
-" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
-" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
-" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
-" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
-"                                "
-};
diff --git a/samples/dde/server.cpp b/samples/dde/server.cpp
deleted file mode 100644 (file)
index 3dfb365..0000000
+++ /dev/null
@@ -1,198 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name:        server.cpp
-// Purpose:     DDE sample: server
-// Author:      Julian Smart
-// Modified by:
-// Created:     25/01/99
-// RCS-ID:      $Id$
-// Copyright:   (c) Julian Smart
-// Licence:     wxWindows licence
-/////////////////////////////////////////////////////////////////////////////
-
-// For compilers that support precompilation, includes "wx.h".
-#include "wx/wxprec.h"
-
-#ifdef __BORLANDC__
-#pragma hdrstop
-#endif
-
-#ifndef WX_PRECOMP
-#include "wx/wx.h"
-#endif
-
-// Settings common to both executables: determines whether
-// we're using TCP/IP or real DDE.
-
-#include "ddesetup.h"
-
-#if defined(__WXGTK__) || defined(__WXMOTIF__)
-#include "mondrian.xpm"
-#endif
-
-#include "server.h"
-
-MyFrame *frame = NULL;
-
-IMPLEMENT_APP(MyApp)
-
-char ipc_buffer[4000];
-MyConnection *the_connection = NULL;
-MyServer *my_server ;
-
-bool MyApp::OnInit()
-{
-  // Create the main frame window
-  frame = new MyFrame(NULL, "Server", wxDefaultPosition, wxSize(400, 500));
-
-  frame->CreateStatusBar();
-
-  // Give it an icon
-  frame->SetIcon(wxICON(mondrian));
-
-  // Make a menubar
-  wxMenu *file_menu = new wxMenu;
-
-  file_menu->Append(SERVER_QUIT, "&Exit");
-
-  wxMenuBar *menu_bar = new wxMenuBar;
-
-  menu_bar->Append(file_menu, "&File");
-
-  // Associate the menu bar with the frame
-  frame->SetMenuBar(menu_bar);
-
-  // Make a panel
-  frame->panel = new wxPanel(frame, 0, 0, 400, 250);
-  wxListBox *list = new wxListBox(frame->panel, SERVER_LISTBOX,
-                                  wxPoint(5, 5), wxSize(150, 120));
-  list->Append("Apple");
-  list->Append("Pear");
-  list->Append("Orange");
-  list->Append("Banana");
-  list->Append("Fruit");
-
-  frame->panel->Fit();
-  frame->Fit();
-
-  wxString server_name = "4242";
-  if (argc > 1)
-    server_name = argv[1];
-
-  // Create a new server
-  my_server = new MyServer;
-  my_server->Create(server_name);
-  frame->Show(TRUE);
-
-  return TRUE;
-}
-
-BEGIN_EVENT_TABLE(MyFrame, wxFrame)
-    EVT_MENU(SERVER_QUIT, MyFrame::OnExit)
-    EVT_CLOSE(MyFrame::OnCloseWindow)
-    EVT_LISTBOX(SERVER_LISTBOX, MyFrame::OnListBoxClick)
-END_EVENT_TABLE()
-
-// Define my frame constructor
-MyFrame::MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size):
-  wxFrame(frame, -1, title, pos, size)
-{
-  panel = NULL;
-}
-
-void MyFrame::OnExit(wxCommandEvent& event)
-{
-    if (my_server)
-        delete my_server;
-    this->Destroy();
-}
-
-// Set the client process's listbox to this item
-void MyFrame::OnListBoxClick(wxCommandEvent& event)
-{
-    wxListBox* listBox = (wxListBox*) panel->FindWindow(SERVER_LISTBOX);
-    if (listBox)
-    {
-        wxString value = listBox->GetStringSelection();
-        if (the_connection)
-        {
-            the_connection->Advise("Item", (char*) (const char*) value);
-        }
-    }
-}
-
-void MyFrame::OnCloseWindow(wxCloseEvent& event)
-{
-    if (my_server)
-        delete my_server;
-    this->Destroy();
-}
-
-BEGIN_EVENT_TABLE(IPCDialogBox, wxDialog)
-    EVT_BUTTON(SERVER_QUIT_BUTTON, IPCDialogBox::OnQuit)
-END_EVENT_TABLE()
-
-IPCDialogBox::IPCDialogBox(wxFrame *parent, const wxString& title,
-                         const wxPoint& pos, const wxSize& size, MyConnection *the_connection):
-                     wxDialog(parent, -1, title, pos, size)
-{
-  connection = the_connection;
-  (void)new wxButton(this, SERVER_QUIT_BUTTON, "Quit this connection", wxPoint(5, 5));
-  Fit();
-}
-
-void IPCDialogBox::OnQuit(wxCommandEvent& event)
-{
-  connection->Disconnect();
-  delete connection;
-}
-
-wxConnectionBase *MyServer::OnAcceptConnection(const wxString& topic)
-{
-  if (strcmp(topic, "STDIO") != 0 && strcmp(topic, "IPC TEST") == 0)
-    return new MyConnection(ipc_buffer, 4000);
-  else
-    return NULL;
-}
-
-MyConnection::MyConnection(char *buf, int size):wxConnection(buf, size)
-{
-  dialog = new IPCDialogBox(frame, "Connection", wxPoint(100, 100), wxSize(500, 500), this);
-  dialog->Show(TRUE);
-  the_connection = this;
-}
-
-MyConnection::~MyConnection(void)
-{
-  if (the_connection)
-  {
-    dialog->Destroy();
-    the_connection = NULL;
-  }
-}
-
-bool MyConnection::OnExecute(const wxString& topic, char *data, int size, wxIPCFormat format)
-{
-  char buf[300];
-  sprintf(buf, "Execute command: %s", data);
-  frame->SetStatusText(buf);
-  return TRUE;
-}
-
-bool MyConnection::OnPoke(const wxString& topic, const wxString& item, char *data, int size, wxIPCFormat format)
-{
-  char buf[300];
-  sprintf(buf, "Poke command: %s", data);
-  frame->SetStatusText(buf);
-  return TRUE;
-}
-
-char *MyConnection::OnRequest(const wxString& topic, const wxString& item, int *size, wxIPCFormat format)
-{
-  return "Here, have your data, client!";
-}
-
-bool MyConnection::OnStartAdvise(const wxString& topic, const wxString& item)
-{
-  return TRUE;
-}
-
diff --git a/samples/dde/server.def b/samples/dde/server.def
deleted file mode 100644 (file)
index 21027a5..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-NAME         Server
-DESCRIPTION  'Server'
-EXETYPE      WINDOWS
-STUB         'WINSTUB.EXE'
-CODE         PRELOAD MOVEABLE DISCARDABLE
-DATA         PRELOAD MOVEABLE MULTIPLE
-HEAPSIZE     4096
-STACKSIZE    8192
diff --git a/samples/dde/server.g95 b/samples/dde/server.g95
deleted file mode 100644 (file)
index 48e622c..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# File:         makefile.g95
-# Author:       Julian Smart
-# Created:      1999
-# Updated:
-# Copyright:    (c) Julian Smart, 1999
-#
-# Makefile for wxWindows sample (Cygwin/Mingw32).
-
-WXDIR = ../..
-
-TARGET=server
-OBJECTS = $(TARGET).o
-
-include $(WXDIR)/src/makeprog.g95
-
diff --git a/samples/dde/server.h b/samples/dde/server.h
deleted file mode 100644 (file)
index 81aa316..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name:        server.h
-// Purpose:     DDE sample: server
-// Author:      Julian Smart
-// Modified by:
-// Created:     25/01/99
-// RCS-ID:      $Id$
-// Copyright:   (c) Julian Smart
-// Licence:     wxWindows licence
-/////////////////////////////////////////////////////////////////////////////
-
-// Define a new application
-class MyApp: public wxApp
-{
-  public:
-    bool OnInit();
-};
-
-DECLARE_APP(MyApp)
-
-// Define a new frame
-class MyFrame: public wxFrame
-{
-  public:
-    wxPanel *panel;
-
-    MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size);
-
-    void OnCloseWindow(wxCloseEvent& event);
-    void OnExit(wxCommandEvent& event);
-    void OnListBoxClick(wxCommandEvent& event);
-DECLARE_EVENT_TABLE()
-};
-
-class IPCDialogBox;
-class MyConnection: public wxConnection
-{
- public:
-  IPCDialogBox *dialog;
-
-  MyConnection(char *buf, int size);
-  ~MyConnection();
-
-  bool OnExecute(const wxString& topic, char *data, int size, wxIPCFormat format);
-  char *OnRequest(const wxString& topic, const wxString& item, int *size, wxIPCFormat format);
-  bool OnPoke(const wxString& topic, const wxString& item, char *data, int size, wxIPCFormat format);
-  bool OnStartAdvise(const wxString& topic, const wxString& item);
-};
-
-class MyServer: public wxServer
-{
-public:
-    wxConnectionBase *OnAcceptConnection(const wxString& topic);
-};
-
-class IPCDialogBox: public wxDialog
-{
-public:
-    MyConnection *connection;
-    IPCDialogBox(wxFrame *parent, const wxString& title,
-                         const wxPoint& pos, const wxSize& size, MyConnection *the_connection);
-
-    void OnQuit(wxCommandEvent& event);
-
-DECLARE_EVENT_TABLE()
-};
-
-#define SERVER_QUIT         wxID_EXIT
-#define SERVER_LISTBOX      500
-#define SERVER_QUIT_BUTTON  501
diff --git a/samples/dde/server.rc b/samples/dde/server.rc
deleted file mode 100644 (file)
index 7655c62..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-mondrian ICON "mondrian.ico"
-#include "wx/msw/wx.rc"
-
diff --git a/samples/dde/server.vc b/samples/dde/server.vc
deleted file mode 100644 (file)
index 6167edf..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-#
-# File:                makefile.vc
-# Author:      Julian Smart
-# Created:     1999
-# Updated:     
-# Copyright:   (c) Julian Smart
-#
-# Makefile : Builds sample (VC++, WIN32)
-# Use FINAL=1 argument to nmake to build final version with no debug info.
-
-# Set WXDIR for your system
-WXDIR = $(WXWIN)
-
-PROGRAM=server
-OBJECTS = $(PROGRAM).obj
-
-!include $(WXDIR)\src\makeprog.vc
-
-server.obj: ddesetup.h
-
diff --git a/samples/dde/server.wat b/samples/dde/server.wat
deleted file mode 100644 (file)
index 2acfdf1..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#
-# Makefile for WATCOM
-#
-# Created by Julian Smart, January 1999
-# 
-#
-
-WXDIR = $(%WXWIN)
-
-PROGRAM = server
-OBJECTS = $(PROGRAM).obj
-
-!include $(WXDIR)\src\makeprog.wat
-
-
diff --git a/samples/dialup/Makefile.in b/samples/dialup/Makefile.in
new file mode 100644 (file)
index 0000000..f003eec
--- /dev/null
@@ -0,0 +1,21 @@
+#
+# File:                makefile.unx
+# Author:      Julian Smart
+# Created:     1998
+# Updated:     
+# Copyright:   (c) 1998 Julian Smart
+#
+# "%W% %G%"
+#
+# Makefile for nettest example (UNIX).
+
+top_srcdir = @top_srcdir@
+top_builddir = ../..
+program_dir = samples/nettest
+
+PROGRAM=nettest
+
+OBJECTS=$(PROGRAM).o
+
+include ../../src/makeprog.env
+
diff --git a/samples/dialup/makefile.b32 b/samples/dialup/makefile.b32
new file mode 100644 (file)
index 0000000..791b8b2
--- /dev/null
@@ -0,0 +1,16 @@
+#
+# File:                makefile.b32
+# Author:      Julian Smart
+# Created:     1999
+# Updated:     
+# Copyright:
+#
+# Makefile : Builds sample for 32-bit BC++
+
+WXDIR = $(WXWIN)
+
+TARGET=nettest
+OBJECTS = $(TARGET).obj
+
+!include $(WXDIR)\src\makeprog.b32
+
diff --git a/samples/dialup/makefile.bcc b/samples/dialup/makefile.bcc
new file mode 100644 (file)
index 0000000..03a220e
--- /dev/null
@@ -0,0 +1,19 @@
+#
+# File:                makefile.bcc
+# Author:      Julian Smart
+# Created:     1998
+# Updated:     
+#
+# Builds a BC++ 16-bit sample
+
+!if "$(WXWIN)" == ""
+!error You must define the WXWIN variable in autoexec.bat, e.g. WXWIN=c:\wx
+!endif
+
+WXDIR = $(WXWIN)
+
+TARGET=nettest
+OBJECTS=$(TARGET).obj
+
+!include $(WXDIR)\src\makeprog.bcc
+
diff --git a/samples/dialup/makefile.dos b/samples/dialup/makefile.dos
new file mode 100644 (file)
index 0000000..3162377
--- /dev/null
@@ -0,0 +1,17 @@
+#
+# File:                makefile.dos
+# Author:      Julian Smart
+# Created:     1998
+# Updated:     
+#
+# Makefile : Builds 16-bit sample, VC++ 1.5
+# Use FINAL=1 argument to nmake to build final version with no debugging
+# info
+
+WXDIR = $(WXWIN)
+
+TARGET=nettest
+OBJECTS=$(TARGET).obj
+
+!include $(WXDIR)\src\makeprog.msc
+
diff --git a/samples/dialup/makefile.g95 b/samples/dialup/makefile.g95
new file mode 100644 (file)
index 0000000..9b0d993
--- /dev/null
@@ -0,0 +1,16 @@
+#
+# File:         makefile.g95
+# Author:       Julian Smart
+# Created:      1999
+# Updated:
+# Copyright:    (c) Julian Smart, 1999
+#
+# Makefile for wxWindows sample (Cygwin/Mingw32).
+
+WXDIR = ../..
+
+TARGET=nettest
+OBJECTS = $(TARGET).o
+
+include $(WXDIR)\src\makeprog.g95
+
diff --git a/samples/dialup/makefile.unx b/samples/dialup/makefile.unx
new file mode 100644 (file)
index 0000000..f890694
--- /dev/null
@@ -0,0 +1,35 @@
+#
+# File:                Makefile for samples
+# Author:      Robert Roebling
+# Created:     1999
+# Updated:     
+# Copyright:   (c) 1998 Robert Roebling
+#
+# This makefile requires a Unix version of wxWindows
+# to be installed on your system. This is most often
+# done typing "make install" when using the complete
+# sources of wxWindows or by installing the two
+# RPM packages wxGTK.XXX.rpm and wxGTK-devel.XXX.rpm
+# under Linux.
+#
+
+CC = gcc
+
+PROGRAM = nettest
+
+OBJECTS = $(PROGRAM).o
+
+# implementation
+
+.SUFFIXES:     .o .cpp
+
+.cpp.o :
+       $(CC) -c `wx-config --cflags` -o $@ $<
+
+all:    $(PROGRAM)
+
+$(PROGRAM):    $(OBJECTS)
+       $(CC) -o $(PROGRAM) $(OBJECTS) `wx-config --libs`
+
+clean: 
+       rm -f *.o $(PROGRAM)
diff --git a/samples/dialup/makefile.vc b/samples/dialup/makefile.vc
new file mode 100644 (file)
index 0000000..189d1a4
--- /dev/null
@@ -0,0 +1,18 @@
+#
+# File:                makefile.vc
+# Author:      Julian Smart
+# Created:     1999
+# Updated:     
+# Copyright:   (c) Julian Smart
+#
+# Makefile : Builds sample (VC++, WIN32)
+# Use FINAL=1 argument to nmake to build final version with no debug info.
+
+# Set WXDIR for your system
+WXDIR = $(WXWIN)
+
+PROGRAM=nettest
+OBJECTS = $(PROGRAM).obj
+
+!include $(WXDIR)\src\makeprog.vc
+
diff --git a/samples/dialup/nettest.cpp b/samples/dialup/nettest.cpp
new file mode 100644 (file)
index 0000000..5c3a6e2
--- /dev/null
@@ -0,0 +1,336 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        net.cpp
+// Purpose:     wxWindows sample demonstrating network-related functions
+// Author:      Vadim Zeitlin
+// Modified by:
+// Created:     07.07.99
+// RCS-ID:      $Id$
+// Copyright:   (c) Vadim Zeitlin
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#ifdef __GNUG__
+    #pragma implementation "nettest.cpp"
+    #pragma interface "nettest.cpp"
+#endif
+
+// For compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+    #pragma hdrstop
+#endif
+
+// for all others, include the necessary headers (this file is usually all you
+// need because it includes almost all "standard" wxWindows headers
+#ifndef WX_PRECOMP
+    #include "wx/wx.h"
+#endif
+
+#include "wx/dialup.h"
+
+// ----------------------------------------------------------------------------
+// private classes
+// ----------------------------------------------------------------------------
+
+// Define a new application type, each program should derive a class from wxApp
+class MyApp : public wxApp
+{
+public:
+    // override base class virtuals
+    // ----------------------------
+
+    // this one is called on application startup and is a good place for the app
+    // initialization (doing it here and not in the ctor allows to have an error
+    // return: if OnInit() returns false, the application terminates)
+    virtual bool OnInit();
+
+    // called before the application termination
+    virtual int OnExit();
+
+    // event handlers
+    void OnConnected(wxDialUpEvent& event);
+
+    // accessor to dial up manager
+    wxDialUpManager *GetDialer() const { return m_dial; }
+
+private:
+    wxDialUpManager *m_dial;
+
+    DECLARE_EVENT_TABLE();
+};
+
+// Define a new frame type: this is going to be our main frame
+class MyFrame : public wxFrame
+{
+public:
+    // ctor(s)
+    MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
+
+    // event handlers (these functions should _not_ be virtual)
+    void OnQuit(wxCommandEvent& event);
+    void OnAbout(wxCommandEvent& event);
+    void OnHangUp(wxCommandEvent& event);
+    void OnDial(wxCommandEvent& event);
+    void OnEnumISPs(wxCommandEvent& event);
+    void OnCheck(wxCommandEvent& event);
+    void OnUpdateUI(wxUpdateUIEvent& event);
+
+    void OnIdle(wxIdleEvent& event);
+
+private:
+    // any class wishing to process wxWindows events must use this macro
+    DECLARE_EVENT_TABLE()
+};
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+// IDs for the controls and the menu commands
+enum
+{
+    // menu items
+    NetTest_Quit = 1,
+    NetTest_About,
+    NetTest_HangUp,
+    NetTest_Dial,
+    NetTest_EnumISP,
+    NetTest_Check,
+    NetTest_Max
+};
+
+// ----------------------------------------------------------------------------
+// event tables and other macros for wxWindows
+// ----------------------------------------------------------------------------
+
+BEGIN_EVENT_TABLE(MyApp, wxApp)
+    EVT_DIALUP_CONNECTED(MyApp::OnConnected)
+    EVT_DIALUP_DISCONNECTED(MyApp::OnConnected)
+END_EVENT_TABLE()
+
+// the event tables connect the wxWindows events with the functions (event
+// handlers) which process them. It can be also done at run-time, but for the
+// simple menu events like this the static method is much simpler.
+BEGIN_EVENT_TABLE(MyFrame, wxFrame)
+    EVT_MENU(NetTest_Quit,  MyFrame::OnQuit)
+    EVT_MENU(NetTest_About, MyFrame::OnAbout)
+    EVT_MENU(NetTest_HangUp, MyFrame::OnHangUp)
+    EVT_MENU(NetTest_Dial, MyFrame::OnDial)
+    EVT_MENU(NetTest_EnumISP, MyFrame::OnEnumISPs)
+    EVT_MENU(NetTest_Check, MyFrame::OnCheck)
+
+    EVT_UPDATE_UI(NetTest_Dial, MyFrame::OnUpdateUI)
+
+    EVT_IDLE(MyFrame::OnIdle)
+END_EVENT_TABLE()
+
+// Create a new application object: this macro will allow wxWindows to create
+// the application object during program execution (it's better than using a
+// static object for many reasons) and also declares the accessor function
+// wxGetApp() which will return the reference of the right type (i.e. MyApp and
+// not wxApp)
+IMPLEMENT_APP(MyApp)
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// the application class
+// ----------------------------------------------------------------------------
+
+// `Main program' equivalent: the program execution "starts" here
+bool MyApp::OnInit()
+{
+    // Create the main application window
+    MyFrame *frame = new MyFrame("Dial-up wxWindows demo",
+                                 wxPoint(50, 50), wxSize(450, 340));
+
+    // Show it and tell the application that it's our main window
+    frame->Show(TRUE);
+    SetTopWindow(frame);
+
+    // Init dial up manager
+    m_dial = wxDialUpManager::Create();
+
+    if ( !m_dial->IsOk() )
+    {
+        wxLogError("The sample can't run on this system.");
+
+        wxLog::GetActiveTarget()->Flush();
+
+        // do it here, OnExit() won't be called
+        delete m_dial;
+
+        return FALSE;
+    }
+
+    frame->SetStatusText(GetDialer()->IsAlwaysOnline() ? "LAN" : "No LAN", 2);
+
+    return TRUE;
+}
+
+int MyApp::OnExit()
+{
+    delete m_dial;
+
+    // exit code is 0, everything is ok
+    return 0;
+}
+
+void MyApp::OnConnected(wxDialUpEvent& event)
+{
+    const char *msg;
+    if ( event.IsOwnEvent() )
+    {
+        msg = event.IsConnectedEvent() ? "Successfully connected"
+                                       : "Dialing failed";
+
+        wxLogStatus("");
+    }
+    else
+    {
+        msg = event.IsConnectedEvent() ? "Just connected!"
+                                       : "Disconnected";
+    }
+
+    wxLogMessage(msg);
+}
+
+// ----------------------------------------------------------------------------
+// main frame
+// ----------------------------------------------------------------------------
+
+// frame constructor
+MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
+       : wxFrame((wxFrame *)NULL, -1, title, pos, size)
+{
+    // create a menu bar
+    wxMenu *menuFile = new wxMenu;
+
+    menuFile->Append(NetTest_Dial, "&Dial\tCtrl-D", "Dial default ISP");
+    menuFile->Append(NetTest_HangUp, "&HangUp\tCtrl-H", "Hang up modem");
+    menuFile->AppendSeparator();
+    menuFile->Append(NetTest_EnumISP, "&Enumerate ISPs...\tCtrl-E");
+    menuFile->Append(NetTest_Check, "&Check connection status...\tCtrl-C");
+    menuFile->AppendSeparator();
+    menuFile->Append(NetTest_About, "&About...\tCtrl-A", "Show about dialog");
+    menuFile->AppendSeparator();
+    menuFile->Append(NetTest_Quit, "E&xit\tAlt-X", "Quit this program");
+
+    // now append the freshly created menu to the menu bar...
+    wxMenuBar *menuBar = new wxMenuBar;
+    menuBar->Append(menuFile, "&File");
+
+    // ... and attach this menu bar to the frame
+    SetMenuBar(menuBar);
+
+    // create status bar and fill the LAN field
+    CreateStatusBar(3);
+    static const int widths[3] = { -1, 100, 60 };
+    SetStatusWidths(3, widths);
+}
+
+
+// event handlers
+
+void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
+{
+    // TRUE is to force the frame to close
+    Close(TRUE);
+}
+
+void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
+{
+    wxString msg;
+    msg.Printf(_T("This is the network functions test sample.\n"
+                  "© 1999 Vadim Zeitlin"));
+
+    wxMessageBox(msg, _T("About NetTest"), wxOK | wxICON_INFORMATION, this);
+}
+
+void MyFrame::OnHangUp(wxCommandEvent& WXUNUSED(event))
+{
+    if ( wxGetApp().GetDialer()->HangUp() )
+    {
+        wxLogStatus(this, "Connection was succesfully terminated.");
+    }
+    else
+    {
+        wxLogStatus(this, "Failed to hang up.");
+    }
+}
+
+void MyFrame::OnDial(wxCommandEvent& WXUNUSED(event))
+{
+    wxLogStatus(this, "Preparing to dial...");
+    wxYield();
+    wxBeginBusyCursor();
+
+    if ( wxGetApp().GetDialer()->Dial() )
+    {
+        wxLogStatus(this, "Dialing...");
+    }
+    else
+    {
+        wxLogStatus(this, "Dialing attempt failed.");
+    }
+
+    wxEndBusyCursor();
+}
+
+void MyFrame::OnCheck(wxCommandEvent& WXUNUSED(event))
+{
+   if(wxGetApp().GetDialer()->IsOnline())
+      wxLogMessage("Network is online.");
+   else
+      wxLogMessage("Network is offline.");
+}
+
+void MyFrame::OnEnumISPs(wxCommandEvent& WXUNUSED(event))
+{
+    wxArrayString names;
+    size_t nCount = wxGetApp().GetDialer()->GetISPNames(names);
+    if ( nCount == 0 )
+    {
+        wxLogWarning("No ISPs found.");
+    }
+    else
+    {
+        wxString msg = "Known ISPs:\n";
+        for ( size_t n = 0; n < nCount; n++ )
+        {
+            msg << names[n] << '\n';
+        }
+
+        wxLogMessage(msg);
+    }
+}
+
+void MyFrame::OnUpdateUI(wxUpdateUIEvent& event)
+{
+    // disable this item while dialing
+    event.Enable( !wxGetApp().GetDialer()->IsDialing() );
+}
+
+void MyFrame::OnIdle(wxIdleEvent& WXUNUSED(event))
+{
+    static int s_isOnline = -1; // not TRUE nor FALSE
+
+    bool isOnline = wxGetApp().GetDialer()->IsOnline();
+    if ( s_isOnline != (int)isOnline )
+    {
+        s_isOnline = isOnline;
+
+        SetStatusText(isOnline ? "Online" : "Offline", 1);
+    }
+}
diff --git a/samples/dialup/nettest.def b/samples/dialup/nettest.def
new file mode 100644 (file)
index 0000000..b41de47
--- /dev/null
@@ -0,0 +1,7 @@
+NAME         Nettest
+DESCRIPTION  'Nettest wxWindows application'
+EXETYPE      WINDOWS
+CODE         PRELOAD MOVEABLE DISCARDABLE
+DATA         PRELOAD MOVEABLE MULTIPLE
+HEAPSIZE     4048
+STACKSIZE    16000
diff --git a/samples/dialup/nettest.rc b/samples/dialup/nettest.rc
new file mode 100644 (file)
index 0000000..82bdf07
--- /dev/null
@@ -0,0 +1,2 @@
+#include "wx/msw/wx.rc"
+
diff --git a/samples/forty/.cvsignore b/samples/forty/.cvsignore
deleted file mode 100644 (file)
index 8b13789..0000000
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/samples/forty/Makefile.in b/samples/forty/Makefile.in
deleted file mode 100644 (file)
index 9398b93..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-#
-# File:                Makefile.in
-# Author:      Julian Smart
-# Created:     1998
-# Updated:     
-# Copyright:   (c) 1998 Julian Smart
-#
-# "%W% %G%"
-#
-# Makefile for forty example (UNIX).
-
-top_srcdir = @top_srcdir@
-top_builddir = ../..
-program_dir = samples/forty
-
-PROGRAM=forty
-
-OBJECTS=$(PROGRAM).o canvas.o card.o game.o pile.o playerdg.o scoredg.o scorefil.o
-
-include ../../src/makeprog.env
-
diff --git a/samples/forty/canvas.cpp b/samples/forty/canvas.cpp
deleted file mode 100644 (file)
index 384d2be..0000000
+++ /dev/null
@@ -1,253 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name:        canvas.cpp
-// Purpose:     Forty Thieves patience game
-// Author:      Chris Breeze
-// Modified by:
-// Created:     21/07/97
-// RCS-ID:      $Id$
-// Copyright:   (c) 1993-1998 Chris Breeze
-// Licence:    wxWindows licence
-//---------------------------------------------------------------------------
-// Last modified: 22nd July 1998 - ported to wxWindows 2.0
-/////////////////////////////////////////////////////////////////////////////
-
-#ifdef __GNUG__
-#pragma implementation
-#pragma interface
-#endif
-
-// For compilers that support precompilation, includes "wx/wx.h".
-#include "wx/wxprec.h"
-
-#ifdef __BORLANDC__
-#pragma hdrstop
-#endif
-
-#ifndef WX_PRECOMP
-#include "wx/wx.h"
-#endif
-
-#include "forty.h"
-#include "card.h"
-#include "game.h"
-#include "scorefil.h"
-#include "playerdg.h"
-#include "canvas.h"
-
-BEGIN_EVENT_TABLE(FortyCanvas, wxScrolledWindow)
-    EVT_MOUSE_EVENTS(FortyCanvas::OnMouseEvent)
-END_EVENT_TABLE()
-
-FortyCanvas::FortyCanvas(wxWindow* parent, int x, int y, int w, int h) :
-       wxScrolledWindow(parent, -1, wxPoint(x, y), wxSize(w, h)),
-       m_helpingHand(TRUE),
-       m_rightBtnUndo(TRUE),
-       m_playerDialog(0),
-       m_leftBtnDown(FALSE)
-{
-#ifdef __WXGTK__
-       m_font = wxTheFontList->FindOrCreateFont(12, wxROMAN, wxNORMAL, wxNORMAL);
-#else
-       m_font = wxTheFontList->FindOrCreateFont(10, wxSWISS, wxNORMAL, wxNORMAL);
-#endif
-       SetBackgroundColour(FortyApp::BackgroundColour());
-
-       m_handCursor = new wxCursor(wxCURSOR_HAND);
-       m_arrowCursor = new wxCursor(wxCURSOR_ARROW);
-
-       wxString name = wxTheApp->GetAppName();
-       if (name.Length() <= 0) name = "forty";
-       m_scoreFile = new ScoreFile(name);
-       m_game = new Game(0, 0, 0);
-       m_game->Deal();
-}
-
-
-FortyCanvas::~FortyCanvas()
-{
-       UpdateScores();
-       delete m_game;
-       delete m_scoreFile;
-}
-
-
-/*
-Write the current player's score back to the score file
-*/
-void FortyCanvas::UpdateScores()
-{
-       if (m_player.Length() > 0 && m_scoreFile && m_game)
-       {
-               m_scoreFile->WritePlayersScore(
-                               m_player,
-                               m_game->GetNumWins(),
-                               m_game->GetNumGames(),
-                               m_game->GetScore()
-                               );
-       }
-}
-
-
-void FortyCanvas::OnDraw(wxDC& dc)
-{
-       dc.SetFont(* m_font);
-       m_game->Redraw(dc);
-
-       // if player name not set (and selection dialog is not displayed)
-       // then ask the player for their name
-       if (m_player.Length() == 0 && !m_playerDialog)
-       {
-               m_playerDialog = new PlayerSelectionDialog(this, m_scoreFile);
-               m_playerDialog->ShowModal();
-               m_player = m_playerDialog->GetPlayersName();
-               if (m_player.Length() > 0)
-               {
-                       // user entered a name - lookup their score
-                       int wins, games, score;
-                       m_scoreFile->ReadPlayersScore(m_player, wins, games, score);
-                       m_game->NewPlayer(wins, games, score);
-                       m_game->DisplayScore(dc);
-                       m_playerDialog->Destroy();
-                       m_playerDialog = 0;
-                       Refresh();
-               }
-               else
-               {
-                       // user cancelled the dialog - exit the app
-                       ((wxFrame*)GetParent())->Close(TRUE);
-               }
-       }
-}
-
-/*
-Called when the main frame is closed
-*/
-bool FortyCanvas::OnCloseCanvas()
-{
-       if (m_game->InPlay() &&
-               wxMessageBox("Are you sure you want to\nabandon the current game?",
-                       "Warning", wxYES_NO | wxICON_QUESTION) == wxNO)
-       {
-        return FALSE;
-       }
-       return TRUE;
-}
-
-void FortyCanvas::OnMouseEvent(wxMouseEvent& event)
-{
-       int mouseX = (int)event.GetX();
-       int mouseY = (int)event.GetY();
-
-       wxClientDC dc(this); 
-       PrepareDC(dc);
-       dc.SetFont(* m_font);
-
-       if (event.LeftDClick())
-       {
-               if (m_leftBtnDown)
-               {
-                       m_leftBtnDown = FALSE;
-                       ReleaseMouse();
-                       m_game->LButtonUp(dc, mouseX, mouseY);
-               }
-               m_game->LButtonDblClk(dc, mouseX, mouseY);
-       }
-       else if (event.LeftDown())
-       {
-               if (!m_leftBtnDown)
-               {
-                       m_leftBtnDown = TRUE;
-                       CaptureMouse();
-                       m_game->LButtonDown(dc, mouseX, mouseY);
-               }
-       }
-       else if (event.LeftUp())
-       {
-               if (m_leftBtnDown)
-               {
-                       m_leftBtnDown = FALSE;
-                       ReleaseMouse();
-                       m_game->LButtonUp(dc, mouseX, mouseY);
-               }
-       }
-       else if (event.RightDown() && !event.LeftIsDown())
-       {
-               // only allow right button undo if m_rightBtnUndo is TRUE
-               if (m_rightBtnUndo)
-               {
-                       if (event.ControlDown() || event.ShiftDown())
-                       {
-                               m_game->Redo(dc);
-                       }
-                       else
-                       {
-                               m_game->Undo(dc);
-                       }
-               }
-       }
-       else if (event.Dragging())
-       {
-               m_game->MouseMove(dc, mouseX, mouseY);
-       }
-
-       if (!event.LeftIsDown())
-       {
-               SetCursorStyle(mouseX, mouseY);
-       }
-}
-
-void FortyCanvas::SetCursorStyle(int x, int y)
-{
-       if (m_game->HaveYouWon())
-       {
-               if (wxMessageBox("Do you wish to play again?",
-                       "Well Done, You have won!", wxYES_NO | wxICON_QUESTION) == wxYES)
-               {
-                       m_game->Deal();
-
-                       wxClientDC dc(this); 
-                       PrepareDC(dc);
-                       dc.SetFont(* m_font);
-                       m_game->Redraw(dc);
-               }
-               else
-               {
-                       // user cancelled the dialog - exit the app
-                       ((wxFrame*)GetParent())->Close(TRUE);
-               }
-       }
-
-       // Only set cursor to a hand if 'helping hand' is enabled and
-       // the card under the cursor can go somewhere 
-       if (m_game->CanYouGo(x, y) && m_helpingHand)
-       {
-               SetCursor(* m_handCursor);
-       }
-       else
-       {
-               SetCursor(* m_arrowCursor);
-       }
-
-}
-
-void FortyCanvas::NewGame()
-{
-       m_game->Deal();
-       Refresh();
-}
-
-void FortyCanvas::Undo()
-{
-       wxClientDC dc(this); 
-       PrepareDC(dc);
-       dc.SetFont(* m_font);
-       m_game->Undo(dc);
-}
-
-void FortyCanvas::Redo()
-{
-       wxClientDC dc(this); 
-       PrepareDC(dc);
-       dc.SetFont(* m_font);
-       m_game->Redo(dc);
-}
diff --git a/samples/forty/canvas.h b/samples/forty/canvas.h
deleted file mode 100644 (file)
index 60abf5f..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name:        canvas.h
-// Purpose:     Forty Thieves patience game
-// Author:      Chris Breeze
-// Modified by:
-// Created:     21/07/97
-// RCS-ID:      $Id$
-// Copyright:   (c) 1993-1998 Chris Breeze
-// Licence:    wxWindows licence
-//---------------------------------------------------------------------------
-// Last modified: 22nd July 1998 - ported to wxWindows 2.0
-/////////////////////////////////////////////////////////////////////////////
-#ifndef _CANVAS_H_
-#define _CANVAS_H_
-
-class Card;
-class Game;
-class ScoreFile;
-class PlayerSelectionDialog;
-
-class FortyCanvas: public wxScrolledWindow
-{
-public:
-       FortyCanvas(wxWindow* parent, int x, int y, int w, int h);
-       virtual ~FortyCanvas();
-
-       virtual void OnDraw(wxDC& dc);
-       bool OnCloseCanvas();
-       void OnMouseEvent(wxMouseEvent& event);
-       void SetCursorStyle(int x, int y);
-
-       void NewGame();
-       void Undo();
-       void Redo();
-
-       ScoreFile* GetScoreFile() const                 { return m_scoreFile; }
-       void UpdateScores();
-       void EnableHelpingHand(bool enable)             { m_helpingHand = enable; }
-       void EnableRightButtonUndo(bool enable) { m_rightBtnUndo = enable; }
-
-       DECLARE_EVENT_TABLE()
-
-private:
-       wxFont*         m_font;
-       Game*           m_game;
-       ScoreFile*      m_scoreFile;
-       wxCursor*       m_arrowCursor;
-       wxCursor*       m_handCursor;
-       bool            m_helpingHand;
-       bool            m_rightBtnUndo;
-       wxString        m_player;
-       PlayerSelectionDialog* m_playerDialog;
-       bool            m_leftBtnDown;
-};
-
-#endif
diff --git a/samples/forty/card.cpp b/samples/forty/card.cpp
deleted file mode 100644 (file)
index b74fcee..0000000
+++ /dev/null
@@ -1,358 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name:        card.cpp
-// Purpose:     Forty Thieves patience game
-// Author:      Chris Breeze
-// Modified by:
-// Created:     21/07/97
-// RCS-ID:      $Id$
-// Copyright:   (c) 1993-1998 Chris Breeze
-// Licence:    wxWindows licence
-//---------------------------------------------------------------------------
-// Last modified: 22nd July 1998 - ported to wxWindows 2.0
-/////////////////////////////////////////////////////////////////////////////
-//+-------------------------------------------------------------+
-//| Description
-//|    A class for drawing playing cards.
-//|    Currently assumes that the card symbols have been
-//|    loaded into hbmap_symbols and the pictures for the
-//|    Jack, Queen and King have been loaded into
-//|    hbmap_pictures.
-//+-------------------------------------------------------------+
-
-#ifdef __GNUG__
-#pragma implementation
-#pragma interface
-#endif
-
-// For compilers that support precompilation, includes "wx/wx.h".
-#include "wx/wxprec.h"
-
-#ifdef __BORLANDC__
-#pragma hdrstop
-#endif
-
-#ifndef WX_PRECOMP
-#include "wx/wx.h"
-#endif
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include "forty.h"
-#include "card.h"
-
-#if defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXMAC__)
-#include "pictures.xpm"
-#include "symbols.xbm"
-#endif
-
-wxBitmap* Card::m_pictureBmap = 0;
-wxBitmap* Card::m_symbolBmap = 0;
-
-
-//+-------------------------------------------------------------+
-//| Card::Card()                                                                                               |
-//+-------------------------------------------------------------+
-//| Description:                                                                                               |
-//|    Constructor for a playing card.                                                         |
-//|    Checks that the value is in the range 1..52 and then            |
-//|    initialises the suit, colour, pipValue and wayUp.                       |
-//+-------------------------------------------------------------+
-Card::Card(int value, WayUp way_up) :
-       m_wayUp(way_up)
-{
-       if (!m_symbolBmap)
-       {
-#ifdef __WXMSW__
-               m_symbolBmap = new wxBitmap("CardSymbols", wxBITMAP_TYPE_BMP_RESOURCE);
-#else
-               m_symbolBmap = new wxBitmap(Symbols_bits, Symbols_width, Symbols_height);
-#endif
-               if (!m_symbolBmap->Ok())
-               {
-                       ::wxMessageBox("Failed to load bitmap CardSymbols", "Error");
-               }
-       }
-       if (!m_pictureBmap)
-       {
-#ifdef __WXMSW__
-               m_pictureBmap = new wxBitmap("CardPictures", wxBITMAP_TYPE_BMP_RESOURCE);
-#else
-               m_pictureBmap = new wxBitmap(Pictures);
-#endif
-               if (!m_pictureBmap->Ok())
-               {
-                       ::wxMessageBox("Failed to load bitmap CardPictures", "Error");
-               }
-       }
-
-    if (value >= 1 && value <= PackSize)
-    {
-               switch ((value - 1) / 13)
-               {
-               case 0:
-                       m_suit = clubs;
-                       m_colour = black;
-                       break;
-               case 1:
-                       m_suit = diamonds;
-                       m_colour = red;
-                       break;
-               case 2:
-                       m_suit = hearts;
-                       m_colour = red;
-                       break;
-               case 3:
-                       m_suit = spades;
-                       m_colour = black;
-                       break;
-               }
-               m_pipValue = 1 + (value - 1) % 13;
-               m_status = TRUE;
-    }
-    else
-    {
-        m_status = FALSE;
-    }
-} // Card::Card()
-
-
-//+-------------------------------------------------------------+
-//| Card::~Card()                                                                                              |
-//+-------------------------------------------------------------+
-//| Description:                                                                                               |
-//|    Destructor - nothing to do at present.                                          |
-//+-------------------------------------------------------------+
-Card::~Card()
-{
-}
-
-
-//+-------------------------------------------------------------+
-//| Card::Erase()                                                                                              |
-//+-------------------------------------------------------------+
-//| Description:                                                                                               |
-//|    Erase the card at (x, y) by drawing a rectangle in the          |
-//|    background colour.                                                                                      |
-//+-------------------------------------------------------------+
-void Card::Erase(wxDC& dc, int x, int y)
-{
-       wxPen* pen = wxThePenList->FindOrCreatePen(
-                                               FortyApp::BackgroundColour(),
-                                               1,
-                                               wxSOLID
-                                               );
-       dc.SetPen(* pen);
-       dc.SetBrush(FortyApp::BackgroundBrush());
-       dc.DrawRectangle(x, y, CardWidth, CardHeight);
-} // Card::Erase()
-
-
-//+-------------------------------------------------------------+
-//| Card::Draw()                                                                                               |
-//+-------------------------------------------------------------+
-//| Description:                                                                                               |
-//|    Draw the card at (x, y).                                                                        |
-//|    If the card is facedown draw the back of the card.                      |
-//|    If the card is faceup draw the front of the card.                       |
-//|    Cards are not held in bitmaps, instead they are drawn           |
-//|    from their constituent parts when required.                                     |
-//|    hbmap_symbols contains large and small suit symbols and         |
-//|    pip values. These are copied to the appropriate part of         |
-//|    the card. Picture cards use the pictures defined in                     |
-//|    hbmap_pictures. Note that only one picture is defined           |
-//|    for the Jack, Queen and King, unlike a real pack where          |
-//|    each suit is different.                                                                         |
-//|                                                                                                                            |
-//| WARNING:                                                                                                   |
-//|    The locations of these symbols is 'hard-wired' into the         |
-//|    code. Editing the bitmaps or the numbers below will                     |
-//|    result in the wrong symbols being displayed.                            |
-//+-------------------------------------------------------------+
-void Card::Draw(wxDC& dc, int x, int y)
-{
-       wxBrush backgroundBrush( dc.GetBackground() );
-       dc.SetBrush(* wxWHITE_BRUSH);
-       dc.SetPen(* wxBLACK_PEN);
-       dc.DrawRoundedRectangle(x, y, CardWidth, CardHeight, 4);
-       if (m_wayUp == facedown)
-       {
-               dc.SetBackground(* wxRED_BRUSH);
-               dc.SetBackgroundMode(wxSOLID);
-               wxBrush* brush = wxTheBrushList->FindOrCreateBrush(
-                                                       "BLACK", wxCROSSDIAG_HATCH
-                                                       );
-               dc.SetBrush(* brush);
-
-               dc.DrawRoundedRectangle(
-                               x + 4, y + 4,
-                               CardWidth - 8, CardHeight - 8,
-                               2
-                               );
-       }
-       else
-       {
-               wxMemoryDC memoryDC;
-               memoryDC.SelectObject(* m_symbolBmap);
-
-//             dc.SetBackgroundMode(wxTRANSPARENT);
-
-               dc.SetTextBackground(*wxWHITE);
-               switch (m_suit)
-               {
-               case spades:
-               case clubs:
-                       dc.SetTextForeground(*wxBLACK);
-                       break;
-               case diamonds:
-               case hearts:
-                       dc.SetTextForeground(*wxRED);
-                       break;
-               }
-                       // Draw the value
-               dc.Blit(x + 3, y + 3, 6, 7,
-                               &memoryDC, 6 * (m_pipValue - 1), 36, wxCOPY);
-               dc.Blit(x + CardWidth - 9, y + CardHeight - 11, 6, 7,
-                               &memoryDC, 6 * (m_pipValue - 1), 43, wxCOPY);
-
-                       // Draw the pips
-               dc.Blit(x + 11, y + 3, 7, 7,
-                               &memoryDC, 7 * m_suit, 0, wxCOPY);
-               dc.Blit(x + CardWidth - 17, y + CardHeight - 11, 7, 7,
-                               &memoryDC, 7 * m_suit, 7, wxCOPY);
-
-               switch (m_pipValue)
-               {
-               case 1:
-                       dc.Blit(x - 5 + CardWidth / 2, y - 5 + CardHeight / 2, 11, 11,
-                          &memoryDC, 11 * m_suit, 14, wxCOPY);
-                       break;
-
-               case 3:
-                       dc.Blit(x - 5 + CardWidth / 2, y - 5 + CardHeight / 2, 11, 11,
-                          &memoryDC, 11 * m_suit, 14, wxCOPY);
-               case 2:
-                       dc.Blit(x - 5 + CardWidth / 2,
-                               y - 5 + CardHeight / 4, 11, 11,
-                               &memoryDC, 11 * m_suit, 14, wxCOPY);
-                       dc.Blit(x - 5 + CardWidth / 2,
-                               y - 5 + 3 * CardHeight / 4, 11, 11,
-                               &memoryDC, 11 * m_suit, 25, wxCOPY);
-                       break;
-
-               case 5:
-                       dc.Blit(x - 5 + CardWidth / 2, y - 5 + CardHeight / 2, 11, 11,
-                          &memoryDC, 11 * m_suit, 14, wxCOPY);
-               case 4:
-                       dc.Blit(x - 5 +  CardWidth / 4,
-                               y - 5 + CardHeight / 4, 11, 11,
-                               &memoryDC, 11 * m_suit, 14, wxCOPY);
-                       dc.Blit(x - 5 + CardWidth / 4,
-                               y - 5 + 3 * CardHeight / 4, 11, 11,
-                               &memoryDC, 11 * m_suit, 25, wxCOPY);
-                       dc.Blit(x - 5 + 3 * CardWidth / 4,
-                               y - 5 + CardHeight / 4, 11, 11,
-                               &memoryDC, 11 * m_suit, 14, wxCOPY);
-                       dc.Blit(x - 5 + 3 * CardWidth / 4,
-                               y - 5 + 3 * CardHeight / 4, 11, 11,
-                               &memoryDC, 11 * m_suit, 25, wxCOPY);
-                       break;
-
-               case 8:
-                       dc.Blit(x - 5 + 5 * CardWidth / 10,
-                               y - 5 + 5 * CardHeight / 8, 11, 11,
-                               &memoryDC, 11 * m_suit, 25, wxCOPY);
-               case 7:
-                       dc.Blit(x - 5 + 5 * CardWidth / 10,
-                               y - 5 + 3 * CardHeight / 8, 11, 11,
-                               &memoryDC, 11 * m_suit, 14, wxCOPY);
-               case 6:
-                       dc.Blit(x - 5 + CardWidth / 4,
-                               y - 5 + CardHeight / 4, 11, 11,
-                               &memoryDC, 11 * m_suit, 14, wxCOPY);
-                       dc.Blit(x - 5 + CardWidth / 4,
-                               y - 5 + CardHeight / 2, 11, 11,
-                               &memoryDC, 11 * m_suit, 14, wxCOPY);
-                       dc.Blit(x - 5 + CardWidth / 4,
-                               y - 5 + 3 * CardHeight / 4, 11, 11,
-                               &memoryDC, 11 * m_suit, 25, wxCOPY);
-                       dc.Blit(x - 5 + 3 * CardWidth / 4,
-                               y - 5 + CardHeight / 4, 11, 11,
-                               &memoryDC, 11 * m_suit, 14, wxCOPY);
-                       dc.Blit(x - 5 + 3 * CardWidth / 4,
-                               y - 5 + CardHeight / 2, 11, 11,
-                               &memoryDC, 11 * m_suit, 14, wxCOPY);
-                       dc.Blit(x - 5 + 3 * CardWidth / 4,
-                               y - 5 + 3 * CardHeight / 4, 11, 11,
-                               &memoryDC, 11 * m_suit, 25, wxCOPY);
-                       break;
-
-               case 10:
-                       dc.Blit(x - 5 + CardWidth / 2,
-                               y - 5 + 2 * CardHeight / 3, 11, 11,
-                               &memoryDC, 11 * m_suit, 25, wxCOPY);
-               case 9:
-                       dc.Blit(x - 5 + CardWidth / 4,
-                               y - 6 + CardHeight / 4, 11, 11,
-                               &memoryDC, 11 * m_suit, 14, wxCOPY);
-                       dc.Blit(x - 5 + CardWidth / 4,
-                               y - 6 + 5 * CardHeight / 12, 11, 11,
-                               &memoryDC, 11 * m_suit, 14, wxCOPY);
-                       dc.Blit(x - 5 + CardWidth / 4,
-                               y - 5 + 7 * CardHeight / 12, 11, 11,
-                               &memoryDC, 11 * m_suit, 25, wxCOPY);
-                       dc.Blit(x - 5 + CardWidth / 4,
-                               y - 5 + 3 * CardHeight / 4, 11, 11,
-                               &memoryDC, 11 * m_suit, 25, wxCOPY);
-
-                       dc.Blit(x - 5 + 3 * CardWidth / 4,
-                               y - 6 + CardHeight / 4, 11, 11,
-                               &memoryDC, 11 * m_suit, 14, wxCOPY);
-                       dc.Blit(x - 5 + 3 * CardWidth / 4,
-                               y - 6 + 5 * CardHeight / 12, 11, 11,
-                               &memoryDC, 11 * m_suit, 14, wxCOPY);
-                       dc.Blit(x - 5 + 3 * CardWidth / 4,
-                               y - 5 + 7 * CardHeight / 12, 11, 11,
-                               &memoryDC, 11 * m_suit, 25, wxCOPY);
-                       dc.Blit(x - 5 + 3 * CardWidth / 4,
-                               y - 5 + 3 * CardHeight / 4, 11, 11,
-                               &memoryDC, 11 * m_suit, 25, wxCOPY);
-                       dc.Blit(x - 5 + CardWidth / 2,
-                               y - 5 + CardHeight / 3, 11, 11,
-                               &memoryDC, 11 * m_suit, 14, wxCOPY);
-                       break;
-               case 11:
-               case 12:
-               case 13:
-                       memoryDC.SelectObject(* m_pictureBmap);
-                       dc.Blit(x + 5, y - 5 + CardHeight / 4, 40, 45,
-                               &memoryDC, 40 * (m_pipValue - 11), 0, wxCOPY);
-                       memoryDC.SelectObject(* m_symbolBmap);
-                       dc.Blit(x + 32, y - 3 + CardHeight / 4, 11, 11,
-                               &memoryDC, 11 * m_suit, 14, wxCOPY);
-                       dc.Blit(x + 7, y + 27 + CardHeight / 4, 11, 11,
-                               &memoryDC, 11 * m_suit, 25, wxCOPY);
-                       break;
-               }
-
-       }
-       dc.SetBackground( backgroundBrush );
-} // Card:Draw()
-
-
-//+-------------------------------------------------------------+
-//| Card::DrawNullCard()                                                                               |
-//+-------------------------------------------------------------+
-//| Description:                                                                                               |
-//|    Draws the outline of a card at (x, y).                                          |
-//|    Used to draw place holders for empty piles of cards.            |
-//+-------------------------------------------------------------+
-void Card::DrawNullCard(wxDC& dc, int x, int y)
-{
-       wxPen* pen = wxThePenList->FindOrCreatePen(FortyApp::TextColour(), 1, wxSOLID);
-       dc.SetBrush(FortyApp::BackgroundBrush());
-       dc.SetPen(*pen);
-       dc.DrawRoundedRectangle(x, y, CardWidth, CardHeight, 4);
-} // Card::DrawNullCard()
-
-
diff --git a/samples/forty/card.h b/samples/forty/card.h
deleted file mode 100644 (file)
index b93ac93..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name:        card.h
-// Purpose:     Forty Thieves patience game
-// Author:      Chris Breeze
-// Modified by:
-// Created:     21/07/97
-// RCS-ID:      $Id$
-// Copyright:   (c) 1993-1998 Chris Breeze
-// Licence:    wxWindows licence
-//---------------------------------------------------------------------------
-// Last modified: 22nd July 1998 - ported to wxWindows 2.0
-/////////////////////////////////////////////////////////////////////////////
-//+-------------------------------------------------------------+
-//| Description:                                                                                               |
-//|    A class for drawing playing cards.                                                      |
-//|    InitCards() must be called before using the Card class,         |
-//|    otherwise the card bitmaps will not be loaded.                          |
-//|    CloseCards() must be called before terminating the                      |
-//|    program so that the bitmaps are deleted and the memory          |
-//|    given back to Windows.                                                                          |
-//+-------------------------------------------------------------+
-#ifndef _CARD_H_
-#define _CARD_H_
-
-       // Constants
-const int PackSize = 52;
-const int CardWidth = 50;
-const int CardHeight = 70;
-
-       // Data types
-enum Suit { clubs = 0, diamonds = 1, hearts = 2, spades = 3 };
-enum SuitColour { red = 0, black = 1 };
-enum WayUp { faceup, facedown };
-
-
-//--------------------------------//
-// A class defining a single card //
-//--------------------------------//
-class Card {
-public:
-       Card(int value, WayUp way_up = facedown);
-       virtual ~Card();
-
-       void            Draw(wxDC& pDC, int x, int y);
-       static void DrawNullCard(wxDC& pDC, int x, int y);      // Draw card place-holder
-       void            Erase(wxDC& pDC, int x, int y);
-
-       void            TurnCard(WayUp way_up = faceup) { m_wayUp = way_up; }
-       WayUp           GetWayUp() const { return m_wayUp; }
-       int                     GetPipValue() const { return m_pipValue; }
-       Suit            GetSuit() const { return m_suit; }
-       SuitColour      GetColour() const { return m_colour; }
-
-private:
-       Suit            m_suit;
-       int                     m_pipValue;     // in the range 1 (Ace) to 13 (King)
-       SuitColour      m_colour;       // red or black
-       bool            m_status;
-       WayUp           m_wayUp;
-
-       static wxBitmap*        m_symbolBmap;
-       static wxBitmap*        m_pictureBmap;
-};
-
-#endif // _CARD_H_
diff --git a/samples/forty/cards.ico b/samples/forty/cards.ico
deleted file mode 100644 (file)
index 35c8379..0000000
Binary files a/samples/forty/cards.ico and /dev/null differ
diff --git a/samples/forty/forty.cpp b/samples/forty/forty.cpp
deleted file mode 100644 (file)
index bfdb920..0000000
+++ /dev/null
@@ -1,271 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name:        forty.cpp
-// Purpose:     Forty Thieves patience game
-// Author:      Chris Breeze
-// Modified by:
-// Created:     21/07/97
-// RCS-ID:      $Id$
-// Copyright:   (c) 1993-1998 Chris Breeze
-// Licence:    wxWindows licence
-//---------------------------------------------------------------------------
-// Last modified: 22nd July 1998 - ported to wxWindows 2.0
-/////////////////////////////////////////////////////////////////////////////
-
-#ifdef __GNUG__
-#pragma implementation
-#pragma interface
-#endif
-
-// For compilers that support precompilation, includes "wx/wx.h".
-#include "wx/wxprec.h"
-
-#ifdef __BORLANDC__
-#pragma hdrstop
-#endif
-
-#ifndef WX_PRECOMP
-#include "wx/wx.h"
-#endif
-
-#include "canvas.h"
-#include "forty.h"
-#include "scoredg.h"
-#ifdef wx_x
-#include "cards.xbm"
-#endif
-
-class FortyFrame: public wxFrame
-{
-public:
-       FortyFrame(wxFrame* frame, char* title, int x, int y, int w, int h);
-       virtual ~FortyFrame();
-
-       void OnCloseWindow(wxCloseEvent& event);
-
-       // Menu callbacks
-       void NewGame(wxCommandEvent& event);
-       void Exit(wxCommandEvent& event);
-       void About(wxCommandEvent& event);
-       void Undo(wxCommandEvent& event);
-       void Redo(wxCommandEvent& event);
-       void Scores(wxCommandEvent& event);
-       void ToggleRightButtonUndo(wxCommandEvent& event);
-       void ToggleHelpingHand(wxCommandEvent& event);
-
-       DECLARE_EVENT_TABLE()
-
-private:
-       enum MenuCommands { NEW_GAME = 10, SCORES, EXIT,
-                                               UNDO, REDO,
-                                               RIGHT_BUTTON_UNDO, HELPING_HAND,
-                                               ABOUT };
-
-       wxMenuBar*              m_menuBar;
-       FortyCanvas*    m_canvas;
-};
-
-BEGIN_EVENT_TABLE(FortyFrame, wxFrame)
-       EVT_MENU(NEW_GAME, FortyFrame::NewGame)
-       EVT_MENU(EXIT, FortyFrame::Exit)
-       EVT_MENU(ABOUT, FortyFrame::About)
-       EVT_MENU(UNDO, FortyFrame::Undo)
-       EVT_MENU(REDO, FortyFrame::Redo)
-       EVT_MENU(SCORES, FortyFrame::Scores)
-       EVT_MENU(RIGHT_BUTTON_UNDO, FortyFrame::ToggleRightButtonUndo)
-       EVT_MENU(HELPING_HAND, FortyFrame::ToggleHelpingHand)
-    EVT_CLOSE(FortyFrame::OnCloseWindow)
-END_EVENT_TABLE()
-
-// Create a new application object
-IMPLEMENT_APP  (FortyApp)
-
-wxColour* FortyApp::m_backgroundColour = 0;
-wxColour* FortyApp::m_textColour = 0;
-wxBrush*  FortyApp::m_backgroundBrush = 0;
-
-bool FortyApp::OnInit()
-{
-       FortyFrame* frame = new FortyFrame(
-                       0,
-                       "Forty Thieves",
-                       -1, -1, 668, 510
-                       );
-
-       // Show the frame
-       frame->Show(TRUE);
-
-       return TRUE;
-}
-
-const wxColour& FortyApp::BackgroundColour()
-{
-       if (!m_backgroundColour)
-       {
-               m_backgroundColour = new wxColour(0, 128, 0);
-       }
-
-       return *m_backgroundColour;
-}
-
-const wxBrush& FortyApp::BackgroundBrush()
-{
-       if (!m_backgroundBrush)
-       {
-               m_backgroundBrush = new wxBrush(BackgroundColour(), wxSOLID);
-       }
-
-       return *m_backgroundBrush;
-}
-
-const wxColour& FortyApp::TextColour()
-{
-       if (!m_textColour)
-       {
-               m_textColour = new wxColour("BLACK");
-       }
-
-       return *m_textColour;
-}
-
-// My frame constructor
-FortyFrame::FortyFrame(wxFrame* frame, char* title, int x, int y, int w, int h):
-       wxFrame(frame, -1, title, wxPoint(x, y), wxSize(w, h))
-{
-#ifdef __WXMAC__
-       // we need this in order to allow the about menu relocation, since ABOUT is not the default id of the about menu 
-       wxApp::s_macAboutMenuItemId = ABOUT ;
-#endif
-       // set the icon
-#ifdef __WXMSW__
-       SetIcon(wxIcon("CardsIcon"));
-#else
-#ifdef GTK_TBD
-       SetIcon(wxIcon(Cards_bits, Cards_width, Cards_height));
-#endif
-#endif
-
-       // Make a menu bar
-       wxMenu* gameMenu = new wxMenu;
-       gameMenu->Append(NEW_GAME, "&New", "Start a new game");
-       gameMenu->Append(SCORES, "&Scores...", "Displays scores");
-       gameMenu->Append(EXIT, "E&xit", "Exits Forty Thieves");
-
-       wxMenu* editMenu = new wxMenu;
-       editMenu->Append(UNDO, "&Undo", "Undo the last move");
-       editMenu->Append(REDO, "&Redo", "Redo a move that has been undone");
-
-       wxMenu* optionsMenu = new wxMenu;
-       optionsMenu->Append(RIGHT_BUTTON_UNDO,
-                       "&Right button undo",
-                       "Enables/disables right mouse button undo and redo",
-                       TRUE
-                       );
-       optionsMenu->Append(HELPING_HAND,
-                       "&Helping hand",
-                       "Enables/disables hand cursor when a card can be moved",
-                       TRUE
-                       );
-       optionsMenu->Check(HELPING_HAND, TRUE);
-       optionsMenu->Check(RIGHT_BUTTON_UNDO, TRUE);
-
-       wxMenu* helpMenu = new wxMenu;
-       helpMenu->Append(ABOUT, "&About", "Displays program version information");
-
-       m_menuBar = new wxMenuBar;
-       m_menuBar->Append(gameMenu,    "&Game");
-       m_menuBar->Append(editMenu,    "&Edit");
-       m_menuBar->Append(optionsMenu, "&Options");
-       m_menuBar->Append(helpMenu,    "&Help");
-
-       SetMenuBar(m_menuBar);
-
-       m_canvas = new FortyCanvas(this, 0, 0, 400, 400);
-       wxLayoutConstraints* constr = new wxLayoutConstraints;
-       constr->left.SameAs(this, wxLeft);
-       constr->top.SameAs(this, wxTop);
-       constr->right.SameAs(this, wxRight);
-       constr->height.SameAs(this, wxHeight);
-       m_canvas->SetConstraints(constr);
-
-       CreateStatusBar();
-}
-
-FortyFrame::~FortyFrame()
-{
-}
-
-void FortyFrame::OnCloseWindow(wxCloseEvent& event)
-{
-    if (m_canvas->OnCloseCanvas() )
-    {
-        this->Destroy();
-    }
-    else
-        event.Veto();
-}
-
-void
-FortyFrame::NewGame(wxCommandEvent&)
-{
-       m_canvas->NewGame();
-}
-
-void
-FortyFrame::Exit(wxCommandEvent&)
-{
-#ifdef __WXGTK__
-       // wxGTK doesn't call OnClose() so we do it here
-//     if (OnClose())
-#endif
-       Close(TRUE);
-}
-
-void
-FortyFrame::About(wxCommandEvent&)
-{
-       wxMessageBox(
-               "Forty Thieves\n\n"
-               "A freeware program using the wxWindows\n"
-               "portable C++ GUI toolkit.\n"
-               "http://web.ukonline.co.uk/julian.smart/wxwin\n"
-               "http://www.freiburg.linux.de/~wxxt\n\n"
-               "Author: Chris Breeze (c) 1992-1998\n"
-               "email: chris.breeze@iname.com",
-               "About Forty Thieves",
-               wxOK, this
-               );
-}
-
-void
-FortyFrame::Undo(wxCommandEvent&)
-{
-       m_canvas->Undo();
-}
-
-void
-FortyFrame::Redo(wxCommandEvent&)
-{
-       m_canvas->Redo();
-}
-
-void
-FortyFrame::Scores(wxCommandEvent&)
-{
-       m_canvas->UpdateScores();
-       ScoreDialog scores(this, m_canvas->GetScoreFile());
-       scores.Display();
-}
-
-void
-FortyFrame::ToggleRightButtonUndo(wxCommandEvent& event)
-{
-       bool checked = m_menuBar->IsChecked(event.GetId());
-       m_canvas->EnableRightButtonUndo(checked);
-}
-
-void
-FortyFrame::ToggleHelpingHand(wxCommandEvent& event)
-{
-       bool checked = m_menuBar->IsChecked(event.GetId());
-       m_canvas->EnableHelpingHand(checked);
-}
diff --git a/samples/forty/forty.def b/samples/forty/forty.def
deleted file mode 100644 (file)
index a096488..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-NAME         Forty
-DESCRIPTION  'Forty Thieves'
-EXETYPE      WINDOWS
-STUB         'WINSTUB.EXE'
-CODE         PRELOAD MOVEABLE DISCARDABLE
-DATA         PRELOAD MOVEABLE MULTIPLE
-HEAPSIZE     4048
-STACKSIZE    16000
diff --git a/samples/forty/forty.h b/samples/forty/forty.h
deleted file mode 100644 (file)
index 1fbf644..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name:        forty.h
-// Purpose:     Forty Thieves patience game
-// Author:      Chris Breeze
-// Modified by:
-// Created:     21/07/97
-// RCS-ID:      $Id$
-// Copyright:   (c) 1993-1998 Chris Breeze
-// Licence:    wxWindows licence
-//---------------------------------------------------------------------------
-// Last modified: 22nd July 1998 - ported to wxWindows 2.0
-/////////////////////////////////////////////////////////////////////////////
-#ifndef _FORTY_H_
-#define _FORTY_H_
-
-class FortyApp: public wxApp
-{
-public:
-       bool OnInit();
-
-       static const wxColour& BackgroundColour();
-       static const wxColour& TextColour();
-       static const wxBrush&  BackgroundBrush();
-
-private:
-       static wxColour* m_backgroundColour;
-       static wxColour* m_textColour;
-       static wxBrush*  m_backgroundBrush;
-};
-
-#endif
diff --git a/samples/forty/forty.rc b/samples/forty/forty.rc
deleted file mode 100644 (file)
index 911ea25..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "wx/msw/wx.rc"
-
-CardsIcon    ICON   "cards.ico"
-CardPictures BITMAP "pictures.bmp"
-CardSymbols  BITMAP "symbols.bmp"
-
diff --git a/samples/forty/game.cpp b/samples/forty/game.cpp
deleted file mode 100644 (file)
index 4ac5994..0000000
+++ /dev/null
@@ -1,944 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name:        game.cpp
-// Purpose:     Forty Thieves patience game
-// Author:      Chris Breeze
-// Modified by:
-// Created:     21/07/97
-// RCS-ID:      $Id$
-// Copyright:   (c) 1993-1998 Chris Breeze
-// Licence:    wxWindows licence
-//---------------------------------------------------------------------------
-// Last modified: 22nd July 1998 - ported to wxWindows 2.0
-/////////////////////////////////////////////////////////////////////////////
-
-#ifdef __GNUG__
-#pragma implementation
-#pragma interface
-#endif
-
-// For compilers that support precompilation, includes "wx/wx.h".
-#include "wx/wxprec.h"
-
-#ifdef __BORLANDC__
-#pragma hdrstop
-#endif
-
-#ifndef WX_PRECOMP
-#include "wx/wx.h"
-#endif
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <time.h>
-#include <string.h>
-#include "forty.h"
-#include "game.h"
-
-Game::Game(int wins, int games, int score) :
-       m_inPlay(FALSE),
-       m_moveIndex(0),
-       m_redoIndex(0),
-       m_bmap(0),
-       m_bmapCard(0)
-{
-    int i;
-
-    m_pack = new Pack(2, 2 + 4 * (CardHeight + 2));
-    srand(time(0));
-
-    for (i = 0; i < 5; i++) m_pack->Shuffle();
-
-    m_discard = new Discard(2, 2 + 5 * (CardHeight + 2));
-
-    for (i = 0; i < 8; i++)
-    {
-               m_foundations[i] = new Foundation(2 + (i / 4) * (CardWidth + 2),
-                                       2 + (i % 4) * (CardHeight + 2));
-    }
-
-    for (i = 0; i < 10; i++)
-    {
-       m_bases[i] = new Base(8 + (i + 2) * (CardWidth + 2), 2);
-    }
-    Deal();
-    m_srcPile = 0;
-    m_liftedCard = 0;
-
-       // copy the input parameters for future reference
-    m_numWins = wins;
-    m_numGames = games;
-    m_totalScore = score;
-    m_currentScore = 0;
-}
-
-
-// Make sure we delete all objects created by the game object
-Game::~Game()
-{
-    int i;
-
-    delete m_pack;
-    delete m_discard;
-    for (i = 0; i < 8; i++)
-    {
-               delete m_foundations[i];
-    }
-    for (i = 0; i < 10; i++)
-    {
-               delete m_bases[i];
-    }
-       delete m_bmap;
-       delete m_bmapCard;
-}
-
-/*
-Set the score for a new player.
-NB: call Deal() first if the new player is to start
-a new game
-*/
-void Game::NewPlayer(int wins, int games, int score)
-{
-    m_numWins = wins;
-    m_numGames = games;
-    m_totalScore = score;
-    m_currentScore = 0;
-}
-
-// Undo the last move
-void Game::Undo(wxDC& dc)
-{
-    if (m_moveIndex > 0)
-    {
-               m_moveIndex--;
-               Card* card = m_moves[m_moveIndex].dest->RemoveTopCard(dc);
-               m_moves[m_moveIndex].src->AddCard(dc, card);
-               DisplayScore(dc);
-    }
-}
-
-// Redo the last move
-void Game::Redo(wxDC& dc)
-{
-    if (m_moveIndex < m_redoIndex)
-    {
-               Card* card = m_moves[m_moveIndex].src->RemoveTopCard(dc);
-               if (m_moves[m_moveIndex].src == m_pack)
-               {
-                       m_pack->Redraw(dc);
-                       card->TurnCard(faceup);
-               }
-               m_moves[m_moveIndex].dest->AddCard(dc, card);
-               DisplayScore(dc);
-               m_moveIndex++;
-    }
-}
-
-void Game::DoMove(wxDC& dc, Pile* src, Pile* dest)
-{
-    if (m_moveIndex < MaxMoves)
-    {
-               if (src == dest)
-               {
-                       wxMessageBox("Game::DoMove() src == dest", "Debug message",
-                                  wxOK | wxICON_EXCLAMATION);
-               }
-               m_moves[m_moveIndex].src = src;
-               m_moves[m_moveIndex].dest = dest;
-               m_moveIndex++;
-
-               // when we do a move any moves in redo buffer are discarded
-               m_redoIndex = m_moveIndex;
-    }
-    else
-    {
-               wxMessageBox("Game::DoMove() Undo buffer full", "Debug message",
-                          wxOK | wxICON_EXCLAMATION);
-    }
-
-    if (!m_inPlay)
-       {
-               m_inPlay = TRUE;
-               m_numGames++;
-       }
-    DisplayScore(dc);
-}
-
-
-void Game::DisplayScore(wxDC& dc)
-{
-    wxColour bgColour = FortyApp::BackgroundColour();
-       wxPen* pen = wxThePenList->FindOrCreatePen(bgColour, 1, wxSOLID);
-    dc.SetTextBackground(bgColour);
-    dc.SetTextForeground(FortyApp::TextColour());
-       dc.SetBrush(FortyApp::BackgroundBrush());
-       dc.SetPen(* pen);
-
-       // count the number of cards in foundations
-    m_currentScore = 0;
-    for (int i = 0; i < 8; i++)
-    {
-       m_currentScore += m_foundations[i]->GetNumCards();
-    }
-
-    int x, y;
-    m_pack->GetTopCardPos(x, y);
-    x += 12 * CardWidth - 105;
-
-       int w, h;
-       {
-               long width, height;
-               dc.GetTextExtent("Average score:m_x", &width, &height);
-               w = width;
-               h = height;
-       }
-       dc.DrawRectangle(x + w, y, 20, 4 * h);
-
-    char str[80];
-    sprintf(str, "%d", m_currentScore);
-    dc.DrawText("Score:", x, y);
-    dc.DrawText(str, x + w, y);
-    y += h;
-
-    sprintf(str, "%d", m_numGames);
-    dc.DrawText("Games played:", x, y);
-    dc.DrawText(str, x + w, y);
-    y += h;
-
-    sprintf(str, "%d", m_numWins);
-    dc.DrawText("Games won:", x, y);
-    dc.DrawText(str, x + w, y);
-    y += h;
-
-    int average = 0;
-       if (m_numGames > 0)
-       {
-               average = (2 * (m_currentScore + m_totalScore) + m_numGames ) / (2 * m_numGames);
-       }
-    sprintf(str, "%d", average);
-    dc.DrawText("Average score:", x, y);
-    dc.DrawText(str, x + w, y);
-}
-
-
-// Shuffle the m_pack and deal the cards
-void Game::Deal()
-{
-    int i, j;
-    Card* card;
-
-       // Reset all the piles, the undo buffer and shuffle the m_pack
-    m_moveIndex = 0;
-    m_pack->ResetPile();
-    for (i = 0; i < 5; i++)
-       {
-               m_pack->Shuffle();
-       }
-    m_discard->ResetPile();
-    for (i = 0; i < 10; i++)
-       {
-               m_bases[i]->ResetPile();
-       }
-    for (i = 0; i <  8; i++)
-       {
-               m_foundations[i]->ResetPile();
-       }
-
-       // Deal the initial 40 cards onto the bases
-    for (i = 0; i < 10; i++)
-    {
-               for (j = 1; j <= 4; j++)
-               {
-                       card = m_pack->RemoveTopCard();
-                       card->TurnCard(faceup);
-                       m_bases[i]->AddCard(card);
-               }
-    }
-
-    if (m_inPlay)
-       {
-               // player has started the game and then redealt
-               // and so we must add the score for this game to the total score
-               m_totalScore += m_currentScore;
-       }
-    m_currentScore = 0;
-    m_inPlay = FALSE;
-}
-
-
-// Redraw the m_pack, discard pile, the bases and the foundations
-void Game::Redraw(wxDC& dc)
-{
-       int i;
-       m_pack->Redraw(dc);
-       m_discard->Redraw(dc);
-       for (i = 0; i < 8; i++)
-       {
-               m_foundations[i]->Redraw(dc);
-       }
-       for (i = 0; i < 10; i++)
-       {
-               m_bases[i]->Redraw(dc);
-       }
-       DisplayScore(dc);
-
-       if (m_bmap == 0)
-       {
-               m_bmap = new wxBitmap(CardWidth, CardHeight);
-               m_bmapCard = new wxBitmap(CardWidth, CardHeight);
-
-               // Initialise the card bitmap to the background colour
-               wxMemoryDC memoryDC;
-               memoryDC.SelectObject(*m_bmapCard);
-               memoryDC.SetBrush(FortyApp::BackgroundBrush());
-               memoryDC.DrawRectangle(0, 0, CardWidth, CardHeight);
-               memoryDC.SelectObject(*m_bmap);
-               memoryDC.DrawRectangle(0, 0, CardWidth, CardHeight);
-               memoryDC.SelectObject(wxNullBitmap);
-       }
-}
-
-
-// Test to see if the point (x, y) is over the top card of one of the piles
-// Returns pointer to the pile, or 0 if (x, y) is not over a pile
-// or the pile is empty
-Pile* Game::WhichPile(int x, int y)
-{
-       if (m_pack->GetCard(x, y) &&
-               m_pack->GetCard(x, y) == m_pack->GetTopCard())
-       {
-               return m_pack;
-       }
-
-       if (m_discard->GetCard(x, y) &&
-               m_discard->GetCard(x, y) == m_discard->GetTopCard())
-       {
-               return m_discard;
-       }
-
-       int i;
-       for (i = 0; i < 8; i++)
-       {
-               if (m_foundations[i]->GetCard(x, y) &&
-                       m_foundations[i]->GetCard(x, y) == m_foundations[i]->GetTopCard())
-               {
-                       return m_foundations[i];
-               }
-       }
-
-       for (i = 0; i < 10; i++)
-       {
-               if (m_bases[i]->GetCard(x, y) &&
-                       m_bases[i]->GetCard(x, y) == m_bases[i]->GetTopCard())
-               {
-                       return m_bases[i];
-               }
-       }
-       return 0;
-}
-
-
-// Left button is pressed - if cursor is over the m_pack then deal a card
-// otherwise if it is over a card pick it up ready to be dragged - see MouseMove()
-bool Game::LButtonDown(wxDC& dc, int x, int y)
-{
-    m_srcPile = WhichPile(x, y);
-    if (m_srcPile == m_pack)
-    {
-               Card* card = m_pack->RemoveTopCard();
-               if (card)
-               {
-                       m_pack->Redraw(dc);
-                       card->TurnCard(faceup);
-                       m_discard->AddCard(dc, card);
-                       DoMove(dc, m_pack, m_discard);
-               }
-        m_srcPile = 0;
-    }
-    else if (m_srcPile)
-    {
-               m_srcPile->GetTopCardPos(m_xPos, m_yPos);
-               m_xOffset = m_xPos - x;
-               m_yOffset = m_yPos - y;
-
-                       // Copy the area under the card
-                       // Initialise the card bitmap to the background colour
-               {
-                       wxMemoryDC memoryDC;
-                       memoryDC.SelectObject(*m_bmap);
-                       m_liftedCard = m_srcPile->RemoveTopCard(memoryDC, m_xPos, m_yPos);
-               }
-
-                       // Draw the card in card bitmap ready for blitting onto
-                       // the screen
-               {
-                       wxMemoryDC memoryDC;
-                       memoryDC.SelectObject(*m_bmapCard);
-                       m_liftedCard->Draw(memoryDC, 0, 0);
-               }
-    }
-    return m_srcPile != 0;
-}
-
-// Called when the left button is double clicked
-// If a card is under the pointer and it can move elsewhere then move it.
-// Move onto a foundation as first choice, a populated base as second and
-// an empty base as third choice.
-// NB Cards in the m_pack cannot be moved in this way - they aren't in play
-// yet
-void Game::LButtonDblClk(wxDC& dc, int x, int y)
-{
-    Pile* pile = WhichPile(x, y);
-    if (!pile) return;
-
-       // Double click on m_pack is the same as left button down
-    if (pile == m_pack)
-    {
-               LButtonDown(dc, x, y);
-    }
-    else
-    {
-               Card* card = pile->GetTopCard();
-
-               if (card)
-               {
-                       int i;
-
-                       // if the card is an ace then try to place it next
-                       // to an ace of the same suit
-                       if (card->GetPipValue() == 1)
-                       {
-                               for(i = 0; i < 4; i++)
-                               {
-                                       Card* m_topCard;
-                                       if ((m_topCard = m_foundations[i]->GetTopCard()))
-                    {
-                                               if (m_topCard->GetSuit() == card->GetSuit() &&
-                            m_foundations[i + 4] != pile &&
-                                                       m_foundations[i + 4]->GetTopCard() == 0)
-                                               {
-                                                       pile->RemoveTopCard(dc);
-                                                       m_foundations[i + 4]->AddCard(dc, card);
-                                                       DoMove(dc, pile, m_foundations[i + 4]);
-                                                       return;
-                                               }
-                    }
-                               }
-                       }
-
-                       // try to place the card on a foundation
-                       for(i = 0; i < 8; i++)
-                       {
-                               if (m_foundations[i]->AcceptCard(card) && m_foundations[i] != pile)
-                               {
-                                       pile->RemoveTopCard(dc);
-                                       m_foundations[i]->AddCard(dc, card);
-                                       DoMove(dc, pile, m_foundations[i]);
-                                       return;
-                               }
-            }
-                       // try to place the card on a populated base
-                       for(i = 0; i < 10; i++)
-                       {
-                               if (m_bases[i]->AcceptCard(card) &&
-                                       m_bases[i] != pile &&
-                                       m_bases[i]->GetTopCard())
-                               {
-                                       pile->RemoveTopCard(dc);
-                                       m_bases[i]->AddCard(dc, card);
-                                       DoMove(dc, pile, m_bases[i]);
-                                       return;
-                               }
-            }
-                       // try to place the card on any base
-                       for(i = 0; i < 10; i++)
-                       {
-                               if (m_bases[i]->AcceptCard(card) && m_bases[i] != pile)
-                               {
-                                       pile->RemoveTopCard(dc);
-                                       m_bases[i]->AddCard(dc, card);
-                                       DoMove(dc, pile, m_bases[i]);
-                                       return;
-                               }
-            }
-               }
-    }
-}
-
-
-// Test to see whether the game has been won:
-// i.e. m_pack, discard and bases are empty
-bool Game::HaveYouWon()
-{
-    if (m_pack->GetTopCard()) return FALSE;
-    if (m_discard->GetTopCard()) return FALSE;
-    for(int i = 0; i < 10; i++)
-    {
-       if (m_bases[i]->GetTopCard()) return FALSE;
-    }
-    m_numWins++;
-    m_totalScore += m_currentScore;
-    m_currentScore = 0;
-    return TRUE;
-}
-
-
-// See whether the card under the cursor can be moved somewhere else
-// Returns TRUE if it can be moved, FALSE otherwise
-bool Game::CanYouGo(int x, int y)
-{
-    Pile* pile = WhichPile(x, y);
-    if (pile && pile != m_pack)
-    {
-       Card* card = pile->GetTopCard();
-
-       if (card)
-       {
-           int i;
-           for(i = 0; i < 8; i++)
-           {
-               if (m_foundations[i]->AcceptCard(card) && m_foundations[i] != pile)
-               {
-                    return TRUE;
-               }
-            }
-           for(i = 0; i < 10; i++)
-           {
-               if (m_bases[i]->GetTopCard() &&
-                   m_bases[i]->AcceptCard(card) &&
-                   m_bases[i] != pile)
-               {
-                   return TRUE;
-               }
-            }
-       }
-    }
-    return FALSE;
-}
-
-
-// Called when the left button is released after dragging a card
-// Scan the piles to see if this card overlaps a pile and can be added
-// to the pile. If the card overlaps more than one pile on which it can be placed
-// then put it on the nearest pile.
-void Game::LButtonUp(wxDC& dc, int x, int y)
-{
-    if (m_srcPile)
-    {
-               // work out the position of the dragged card
-               x += m_xOffset;
-        y += m_yOffset;
-
-               Pile* nearestPile = 0;
-               int distance = (CardHeight + CardWidth) * (CardHeight + CardWidth);
-
-               // find the nearest pile which will accept the card
-               int i;
-               for (i = 0; i < 8; i++)
-               {
-                       if (DropCard(x, y, m_foundations[i], m_liftedCard))
-                       {
-                               if (m_foundations[i]->CalcDistance(x, y) < distance)
-                               {
-                                       nearestPile = m_foundations[i];
-                    distance = nearestPile->CalcDistance(x, y);
-                }
-            }
-               }
-               for (i = 0; i < 10; i++)
-               {
-                       if (DropCard(x, y, m_bases[i], m_liftedCard))
-                       {
-                               if (m_bases[i]->CalcDistance(x, y) < distance)
-                {
-                                       nearestPile = m_bases[i];
-                    distance = nearestPile->CalcDistance(x, y);
-                }
-            }
-               }
-
-               // Restore the area under the card
-               wxMemoryDC memoryDC;
-               memoryDC.SelectObject(*m_bmap);
-               dc.Blit(m_xPos, m_yPos, CardWidth, CardHeight,
-                          &memoryDC, 0, 0, wxCOPY);
-
-               // Draw the card in its new position
-               if (nearestPile)
-               {
-                       // Add to new pile
-                       nearestPile->AddCard(dc, m_liftedCard);
-                       if (nearestPile != m_srcPile)
-                       {
-                               DoMove(dc, m_srcPile, nearestPile);
-                       }
-               }
-        else
-        {
-                       // Return card to src pile
-                       m_srcPile->AddCard(dc, m_liftedCard);
-               }
-               m_srcPile = 0;
-               m_liftedCard = 0;
-    }
-}
-
-
-
-
-bool Game::DropCard(int x, int y, Pile* pile, Card* card)
-{
-    bool retval = FALSE;
-    if (pile->Overlap(x, y))
-    {
-       if (pile->AcceptCard(card))
-       {
-           retval = TRUE;
-        }
-    }
-    return retval;
-}
-
-
-void Game::MouseMove(wxDC& dc, int mx, int my)
-{
-    if (m_liftedCard)
-    {
-               wxMemoryDC memoryDC;
-               memoryDC.SelectObject(*m_bmap);
-
-               int dx = mx + m_xOffset - m_xPos;
-               int dy = my + m_yOffset - m_yPos;
-
-               if (abs(dx) >= CardWidth || abs(dy) >= CardHeight)
-        {
-                       // Restore the area under the card
-                       dc.Blit(m_xPos, m_yPos, CardWidth, CardHeight,
-                          &memoryDC, 0, 0, wxCOPY);
-
-                       // Copy the area under the card in the new position
-                       memoryDC.Blit(0, 0, CardWidth, CardHeight,
-                          &dc, m_xPos + dx, m_yPos + dy, wxCOPY);
-               }
-               else if (dx >= 0)
-               {
-                       // dx >= 0
-                       dc.Blit(m_xPos, m_yPos, dx, CardHeight, &memoryDC, 0, 0, wxCOPY);
-                       if (dy >= 0)
-                       {
-                                       // dy >= 0
-                               dc.Blit(m_xPos + dx, m_yPos, CardWidth - dx, dy, &memoryDC, dx, 0, wxCOPY);
-                               memoryDC.Blit(0, 0, CardWidth - dx, CardHeight - dy,
-                                          &memoryDC, dx, dy, wxCOPY);
-                               memoryDC.Blit(0, CardHeight - dy, CardWidth - dx, dy,
-                                          &dc, m_xPos + dx, m_yPos + CardHeight, wxCOPY);
-                       }
-                       else
-                       {
-                               // dy < 0
-                               dc.Blit(m_xPos + dx, m_yPos + dy + CardHeight, CardWidth - dx, -dy,
-                                          &memoryDC, dx, CardHeight + dy, wxCOPY);
-                               memoryDC.Blit(0, -dy, CardWidth - dx, CardHeight + dy,
-                                          &memoryDC, dx, 0, wxCOPY);
-                               memoryDC.Blit(0, 0, CardWidth - dx, -dy,
-                                          &dc, m_xPos + dx, m_yPos + dy, wxCOPY);
-                       }
-                       memoryDC.Blit(CardWidth - dx, 0, dx, CardHeight,
-                          &dc, m_xPos + CardWidth, m_yPos + dy, wxCOPY);
-               }
-               else
-               {
-                       // dx < 0
-                       dc.Blit(m_xPos + CardWidth + dx, m_yPos, -dx, CardHeight,
-                          &memoryDC, CardWidth + dx, 0, wxCOPY);
-                       if (dy >= 0)
-                       {
-                               dc.Blit(m_xPos, m_yPos, CardWidth + dx, dy, &memoryDC, 0, 0, wxCOPY);
-                               memoryDC.Blit(-dx, 0, CardWidth + dx, CardHeight - dy,
-                                          &memoryDC, 0, dy, wxCOPY);
-                               memoryDC.Blit(-dx, CardHeight - dy, CardWidth + dx, dy,
-                                          &dc, m_xPos, m_yPos + CardHeight, wxCOPY);
-                       }
-                       else
-                       {
-                                       // dy < 0
-                               dc.Blit(m_xPos, m_yPos + CardHeight + dy, CardWidth + dx, -dy,
-                                          &memoryDC, 0, CardHeight + dy, wxCOPY);
-                               memoryDC.Blit(-dx, -dy, CardWidth + dx, CardHeight + dy,
-                                          &memoryDC, 0, 0, wxCOPY);
-                               memoryDC.Blit(-dx, 0, CardWidth + dx, -dy,
-                                          &dc, m_xPos, m_yPos + dy, wxCOPY);
-                       }
-                       memoryDC.Blit(0, 0, -dx, CardHeight,
-                          &dc, m_xPos + dx, m_yPos + dy, wxCOPY);
-               }
-               m_xPos += dx;
-               m_yPos += dy;
-
-                       // draw the card in its new position
-               memoryDC.SelectObject(*m_bmapCard);
-               dc.Blit(m_xPos, m_yPos, CardWidth, CardHeight,
-                          &memoryDC, 0, 0, wxCOPY);
-    }
-}
-
-
-
-//----------------------------------------------//
-// The Pack class: holds the two decks of cards //
-//----------------------------------------------//
-Pack::Pack(int x, int y) : Pile(x, y, 0, 0)
-{
-    for (m_topCard = 0; m_topCard < NumCards; m_topCard++)
-    {
-       m_cards[m_topCard] = new Card(1 + m_topCard / 2, facedown);
-    }
-    m_topCard = NumCards - 1;
-}
-
-
-void Pack::Shuffle()
-{
-    Card* temp[NumCards];
-    int i;
-
-       // Don't try to shuffle an empty m_pack!
-    if (m_topCard < 0) return;
-
-       // Copy the cards into a temporary array. Start by clearing
-       // the array and then copy the card into a random position.
-        // If the position is occupied then find the next lower position.
-    for (i = 0; i <= m_topCard; i++)
-    {
-               temp[i] = 0;
-    }
-    for (i = 0; i <= m_topCard; i++)
-    {
-       int pos = rand() % (m_topCard + 1);
-       while (temp[pos])
-       {
-           pos--;
-           if (pos < 0) pos = m_topCard;
-       }
-       m_cards[i]->TurnCard(facedown);
-       temp[pos] = m_cards[i];
-        m_cards[i] = 0;
-    }
-
-       // Copy each card back into the m_pack in a random
-       // position. If position is occupied then find nearest
-        // unoccupied position after the random position.
-    for (i = 0; i <= m_topCard; i++)
-    {
-       int pos = rand() % (m_topCard + 1);
-       while (m_cards[pos])
-       {
-           pos++;
-            if (pos > m_topCard) pos = 0;
-       }
-        m_cards[pos] = temp[i];
-    }
-}
-
-void Pack::Redraw(wxDC& dc)
-{
-    Pile::Redraw(dc);
-
-    char str[10];
-    sprintf(str, "%d  ", m_topCard + 1);
-
-       dc.SetTextBackground(FortyApp::BackgroundColour());
-       dc.SetTextForeground(FortyApp::TextColour());
-    dc.DrawText(str, m_x + CardWidth + 5, m_y + CardHeight / 2);
-
-}
-
-void Pack::AddCard(Card* card)
-{
-    if (card == m_cards[m_topCard + 1])
-    {
-               m_topCard++;
-    }
-    else
-    {
-               wxMessageBox("Pack::AddCard() Undo error", "Forty Thieves: Warning",
-                  wxOK | wxICON_EXCLAMATION);
-    }
-    card->TurnCard(facedown);
-}
-
-
-Pack::~Pack()
-{
-    for (m_topCard = 0; m_topCard < NumCards; m_topCard++)
-    {
-       delete m_cards[m_topCard];
-    }
-};
-
-
-//------------------------------------------------------//
-// The Base class: holds the initial pile of four cards //
-//------------------------------------------------------//
-Base::Base(int x, int y) : Pile(x, y, 0, 12)
-{
-    m_topCard = -1;
-}
-
-
-bool Base::AcceptCard(Card* card)
-{
-    bool retval = FALSE;
-
-    if (m_topCard >= 0)
-    {
-       if (m_cards[m_topCard]->GetSuit() == card->GetSuit() &&
-           m_cards[m_topCard]->GetPipValue() - 1 == card->GetPipValue())
-       {
-            retval = TRUE;
-        }
-    }
-    else
-    {
-               // pile is empty - ACCEPT
-        retval = TRUE;
-    }
-    return retval;
-}
-
-Base::~Base()
-{
-// nothing special at the moment
-};
-
-
-//----------------------------------------------------------------//
-// The Foundation class: holds the cards built up from the ace... //
-//----------------------------------------------------------------//
-Foundation::Foundation(int x, int y) : Pile(x, y, 0, 0)
-{
-    m_topCard = -1;
-}
-
-bool Foundation::AcceptCard(Card* card)
-{
-    bool retval = FALSE;
-
-    if (m_topCard >= 0)
-    {
-       if (m_cards[m_topCard]->GetSuit() == card->GetSuit() &&
-           m_cards[m_topCard]->GetPipValue() + 1 == card->GetPipValue())
-       {
-            retval = TRUE;
-        }
-    }
-    else if (card->GetPipValue() == 1)
-    {
-       // It's an ace and the pile is empty - ACCEPT
-        retval = TRUE;
-    }
-    return retval;
-}
-
-Foundation::~Foundation()
-{
-// nothing special at the moment
-};
-
-
-//----------------------------------------------------//
-// The Discard class: holds cards dealt from the m_pack //
-//----------------------------------------------------//
-Discard::Discard(int x, int y) : Pile(x, y, 19, 0)
-{
-    m_topCard = -1;
-}
-
-void Discard::Redraw(wxDC& dc)
-{
-    if (m_topCard >= 0)
-    {
-       if (m_dx == 0 && m_dy == 0)
-       {
-            m_cards[m_topCard]->Draw(dc, m_x, m_y);
-       }
-       else
-       {
-           int x = m_x;
-           int y = m_y;
-           for (int i = 0; i <= m_topCard; i++)
-           {
-               m_cards[i]->Draw(dc, x, y);
-               x += m_dx;
-               y += m_dy;
-               if (i == 31)
-               {
-                   x = m_x;
-                    y = m_y + CardHeight / 3;
-                }
-            }
-        }
-    }
-    else
-    {
-               Card::DrawNullCard(dc, m_x, m_y);
-    }
-}
-
-
-void Discard::GetTopCardPos(int& x, int& y)
-{
-    if (m_topCard < 0)
-    {
-       x = m_x;
-       y = m_y;
-    }
-    else if (m_topCard > 31)
-    {
-       x = m_x + m_dx * (m_topCard - 32);
-       y = m_y + CardHeight / 3;
-    }
-    else
-    {
-       x = m_x + m_dx * m_topCard;
-       y = m_y;
-    }
-}
-
-
-Card* Discard::RemoveTopCard(wxDC& dc, int m_xOffset, int m_yOffset)
-{
-    Card* card;
-
-    if (m_topCard <= 31)
-    {
-               card = Pile::RemoveTopCard(dc, m_xOffset, m_yOffset);
-    }
-    else
-    {
-       int topX, topY, x, y;
-       GetTopCardPos(topX, topY);
-               card = Pile::RemoveTopCard();
-               card->Erase(dc, topX - m_xOffset, topY - m_yOffset);
-               GetTopCardPos(x, y);
-               dc.SetClippingRegion(topX - m_xOffset, topY - m_yOffset,
-                                        CardWidth, CardHeight);
-
-               for (int i = m_topCard - 31; i <= m_topCard - 31 + CardWidth / m_dx; i++)
-               {
-                       m_cards[i]->Draw(dc, m_x - m_xOffset + i * m_dx, m_y - m_yOffset); 
-               }
-               if (m_topCard > 31)
-               {
-                       m_cards[m_topCard]->Draw(dc, topX - m_xOffset - m_dx, topY - m_yOffset);
-               }
-               dc.DestroyClippingRegion();
-    }
-
-    return card;
-}
-
-
-Discard::~Discard()
-{
-// nothing special at the moment
-};
diff --git a/samples/forty/game.h b/samples/forty/game.h
deleted file mode 100644 (file)
index 2360d15..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name:        game.h
-// Purpose:     Forty Thieves patience game
-// Author:      Chris Breeze
-// Modified by:
-// Created:     21/07/97
-// RCS-ID:      $Id$
-// Copyright:   (c) 1993-1998 Chris Breeze
-// Licence:    wxWindows licence
-//---------------------------------------------------------------------------
-// Last modified: 22nd July 1998 - ported to wxWindows 2.0
-/////////////////////////////////////////////////////////////////////////////
-#ifndef _GAME_H_
-#define _GAME_H_
-#include "card.h"
-#include "pile.h"
-
-const int MaxMoves = 800;
-
-
-//---------------------------------------//
-// A class which holds the pack of cards //
-//---------------------------------------//
-class Pack : public Pile {
-public:
-       Pack(int x, int y);
-       ~Pack();
-       void Redraw(wxDC& dc);
-       void ResetPile() { m_topCard = NumCards - 1; }
-       void Shuffle();
-       void AddCard(Card* card);               // Add card
-       void AddCard(wxDC& dc, Card* card) { AddCard(card); Redraw(dc); }
-};
-
-
-//----------------------------------------------------------//
-// A class which holds a base i.e. the initial 10 x 4 cards //
-//----------------------------------------------------------//
-class Base : public Pile {
-public:
-       Base(int x, int y);
-       ~Base();
-       bool AcceptCard(Card* card);
-};
-
-
-//----------------------------------------------------//
-// A class which holds a foundation i.e. Ace, 2, 3... //
-//----------------------------------------------------//
-class Foundation : public Pile {
-public:
-       Foundation(int x, int y);
-       ~Foundation();
-       bool AcceptCard(Card* card);
-};
-
-
-//--------------------------------------//
-// A class which holds the discard pile //
-//--------------------------------------//
-class Discard : public Pile {
-public:
-       Discard(int x, int y);
-       ~Discard();
-       void Redraw(wxDC& dc);
-       void GetTopCardPos(int& x, int& y);
-       Card* RemoveTopCard(wxDC& dc, int m_xOffset, int m_yOffset);
-};
-
-
-class Game {
-public:
-       Game(int wins, int games, int score);
-       virtual ~Game();
-
-       void NewPlayer(int wins, int games, int score);
-       void Deal();            // Shuffle and deal a new game
-       bool CanYouGo(int x, int y);    // can card under (x,y) go somewhere?
-       bool HaveYouWon();              // have you won the game?
-
-       void Undo(wxDC& dc);            // Undo the last go
-       void Redo(wxDC& dc);            // Redo the last go
-
-       void Redraw(wxDC& dc);
-       void DisplayScore(wxDC& dc);
-       bool LButtonDown(wxDC& dc, int mx, int my);     //
-       void LButtonUp(wxDC& dc, int mx, int my);
-       void LButtonDblClk(wxDC& dc, int mx, int my);
-       void MouseMove(wxDC& dc, int mx, int my);
-
-       int GetNumWins() const  { return m_numWins; }
-       int GetNumGames() const { return m_numGames; }
-       int GetScore() const    { return m_currentScore + m_totalScore; }
-
-       bool InPlay() const             { return m_inPlay; }
-
-private:
-       bool DropCard(int x, int y, Pile* pile, Card* card);
-                       //  can the card at (x, y) be dropped on the pile?
-       Pile* WhichPile(int x, int y);  // which pile is (x, y) over?
-       void DoMove(wxDC& dc, Pile* src, Pile* dest);
-
-       bool m_inPlay;          // flag indicating that the game has started
-
-       // undo buffer
-       struct {
-               Pile* src;
-               Pile* dest;
-       } m_moves[MaxMoves];
-       int m_moveIndex;        // current position in undo/redo buffer
-       int m_redoIndex;        // max move index available for redo
-
-       // the various piles of cards
-       Pack*           m_pack;         
-       Discard*        m_discard;
-       Base*           m_bases[10];
-       Foundation*     m_foundations[8];
-
-       // variables to do with dragging cards
-       Pile*           m_srcPile;
-       Card*           m_liftedCard;
-       int m_xPos, m_yPos;             // current coords of card being dragged
-       int m_xOffset, m_yOffset;       // card/mouse offset when dragging a card
-
-       wxBitmap* m_bmap;
-       wxBitmap* m_bmapCard;
-
-       // variables to do with scoring
-       int m_numGames;         
-       int m_numWins;
-       int m_totalScore;
-       int m_currentScore;
-};
-
-#endif // _GAME_H_
diff --git a/samples/forty/make_cw.mcp b/samples/forty/make_cw.mcp
deleted file mode 100644 (file)
index a5f441d..0000000
Binary files a/samples/forty/make_cw.mcp and /dev/null differ
diff --git a/samples/forty/makefile.b32 b/samples/forty/makefile.b32
deleted file mode 100644 (file)
index 5586d65..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# File:                makefile.b32
-# Author:      Julian Smart
-# Created:     1999
-# Updated:     
-# Copyright:
-#
-# Makefile : Builds sample for 32-bit BC++
-
-WXDIR = $(WXWIN)
-
-TARGET=forty
-OBJECTS = $(TARGET).obj canvas.obj card.obj game.obj pile.obj playerdg.obj scoredg.obj scorefil.obj
-
-!include $(WXDIR)\src\makeprog.b32
-
diff --git a/samples/forty/makefile.bcc b/samples/forty/makefile.bcc
deleted file mode 100644 (file)
index 53fdb7b..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# File:                makefile.bcc
-# Author:      Julian Smart
-# Created:     1998
-# Updated:     
-#
-# Builds a BC++ 16-bit sample
-
-!if "$(WXWIN)" == ""
-!error You must define the WXWIN variable in autoexec.bat, e.g. WXWIN=c:\wx
-!endif
-
-WXDIR = $(WXWIN)
-
-TARGET=forty
-OBJECTS=$(TARGET).obj canvas.obj card.obj game.obj pile.obj playerdg.obj scoredg.obj scorefil.obj
-
-!include $(WXDIR)\src\makeprog.bcc
-
diff --git a/samples/forty/makefile.dos b/samples/forty/makefile.dos
deleted file mode 100644 (file)
index 150d0b9..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# File:                makefile.dos
-# Author:      Julian Smart
-# Created:     1998
-# Updated:     
-#
-# Makefile : Builds 16-bit sample, VC++ 1.5
-# Use FINAL=1 argument to nmake to build final version with no debugging
-# info
-
-WXDIR = $(WXWIN)
-
-TARGET=forty
-OBJECTS = $(TARGET).obj canvas.obj card.obj game.obj pile.obj playerdg.obj scoredg.obj scorefil.obj
-
-!include $(WXDIR)\src\makeprog.msc
-
diff --git a/samples/forty/makefile.g95 b/samples/forty/makefile.g95
deleted file mode 100644 (file)
index 7f750c2..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# File:         makefile.g95
-# Author:       Julian Smart
-# Created:      1999
-# Updated:
-# Copyright:    (c) Julian Smart, 1999
-#
-# Makefile for wxWindows sample (Cygwin/Mingw32).
-
-WXDIR = ../..
-
-TARGET=forty
-OBJECTS = $(TARGET).o canvas.o card.o game.o pile.o playerdg.o scoredg.o scorefil.o
-
-include $(WXDIR)/src/makeprog.g95
-
diff --git a/samples/forty/makefile.unx b/samples/forty/makefile.unx
deleted file mode 100644 (file)
index 0a689e8..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-#
-# File:                Makefile for samples
-# Author:      Robert Roebling
-# Created:     1999
-# Updated:     
-# Copyright:   (c) 1998 Robert Roebling
-#
-# This makefile requires a Unix version of wxWindows
-# to be installed on your system. This is most often
-# done typing "make install" when using the complete
-# sources of wxWindows or by installing the two
-# RPM packages wxGTK.XXX.rpm and wxGTK-devel.XXX.rpm
-# under Linux.
-#
-
-CC = g++
-
-PROGRAM = forty
-
-OBJECTS = $(PROGRAM).o canvas.o card.o game.o pile.o playerdg.o scoredg.o scorefil.o
-
-# implementation
-
-.SUFFIXES:     .o .cpp
-
-.cpp.o :
-       $(CC) -c `wx-config --cflags` -o $@ $<
-
-all:    $(PROGRAM)
-
-$(PROGRAM):    $(OBJECTS)
-       $(CC) -o $(PROGRAM) $(OBJECTS) `wx-config --libs`
-
-clean: 
-       rm -f *.o $(PROGRAM)
diff --git a/samples/forty/makefile.vc b/samples/forty/makefile.vc
deleted file mode 100644 (file)
index 7c809b7..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# File:                makefile.vc
-# Author:      Julian Smart
-# Created:     1999
-# Updated:     
-# Copyright:   (c) Julian Smart
-#
-# Makefile : Builds sample (VC++, WIN32)
-# Use FINAL=1 argument to nmake to build final version with no debug info.
-
-# Set WXDIR for your system
-WXDIR = $(WXWIN)
-
-PROGRAM=forty
-OBJECTS = $(PROGRAM).obj card.obj canvas.obj game.obj pile.obj playerdg.obj scoredg.obj scorefil.obj
-
-!include $(WXDIR)\src\makeprog.vc
-
diff --git a/samples/forty/makefile.wat b/samples/forty/makefile.wat
deleted file mode 100644 (file)
index 9db1dca..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#
-# Makefile for WATCOM
-#
-# Created by Julian Smart, January 1999
-# 
-#
-
-WXDIR = $(%WXWIN)
-
-PROGRAM = forty
-OBJECTS = $(PROGRAM).obj canvas.obj card.obj game.obj pile.obj playerdg.obj scoredg.obj scorefil.obj
-
-!include $(WXDIR)\src\makeprog.wat
-
-
diff --git a/samples/forty/pictures.bmp b/samples/forty/pictures.bmp
deleted file mode 100644 (file)
index d8c3345..0000000
Binary files a/samples/forty/pictures.bmp and /dev/null differ
diff --git a/samples/forty/pictures.xpm b/samples/forty/pictures.xpm
deleted file mode 100644 (file)
index 3184957..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/* XPM */
-static char *Pictures[] = {
-/* width height num_colors chars_per_pixel */
-"   120    45        8            1",
-/* colors */
-". c #000000",
-"# c #c0c0c0",
-"a c #808080",
-"b c #ff0000",
-"c c #ffff00",
-"d c #0000ff",
-"e c #00ffff",
-"f c #ffffff",
-/* pixels */
-"........................................................................................................................",
-".fff.fffffff.bb.bb.bb.b.fffffffffffffff..fffffffffff..f..bbc.cc..ffffffffffffff..fff.ffffff.bbccccbcccccbb.ffffffffffff.",
-".ff.c.fffffff.bbbbbbbb.ffffffffffffffff..fff.ffffff..f.ff.bbc..c.ffffffffffffff..ff.a.ffffff.bbccbbbcccbb.fffffffffffff.",
-".f.cbc.fffffff........fffffffffffffffff..ff.b.fffff.f.ffff.bb..c..fffffffffffff..f.#af.ffffff.bbbbbbbbbb.ffffffffffffff.",
-".f.cbc.ffffff.fff.c.c.fffffffffffffffff..ff.b.fffff..f.ff.f.bbc.c.fffffffffffff..f.#af.ffffff............ffffffffffffff.",
-".ff.c.fffffff.f..f.c.c.ffffffffffffffff..fff.ffffff.f..ff..f.bb..ffffffffffffff..f.#af.ffffff.a..f.fff.f.ffffffffffffff.",
-".f.cbc.ffffff.f.ff.c.c.ffffffffffffffff..ff.c.fffff.fff.ffff..b.fffffffffffffff..f.#af.ffffff.a.f..fff..f.fffffffffffff.",
-".f.cbc.fffff.fffff.c.c.ffffffffffffffff..ff.c.fffff.fff.ffff....fffffffffffffff..f.#af.ffffff.a.ffff.ffff.fffffffffffff.",
-".ff.c.fffff.ffffff.c.c.ffffffffffffffff..ff.c.fffff.fff..fff.b..fffffffffffffff..f.#af.ffffff.a.fffff.fff.fffffffffffff.",
-".f.cbc.ffff..###ff.c.c.ffffffffffffffff..ff.c.fffff.ffffffff..b.fffffffffffffff..f.#af.ffffff.a.ffff..fff.fffffffffffff.",
-".f.cbc.ffffff...ff.c.c.ffffffffffffffff..fff.ffffff.ffbbbbff.f...ffffffffffffff..f.#af.fff..f.a..ffffffff.fffffffffffff.",
-".ff....ffffff.ffff.c.c.ffffffffffffffff..ff....fffff.ffffff.f.f...fffffffffffff..f.#af.fff....a...f....f..fffffffffffff.",
-".f.ffff.fffff.fffff.c.c.fffffffffffffff..f.ffff.ffff..ffff.f.f.f..fffffffffffff..f.#af.ffff.aaa.a..f.f.f...ffffffffffff.",
-".f....ff.f.................ffffffffffff..f....ff.f.................ffffffffffff..f.#af.fff...................ffffffffff.",
-".ff.fff....eddddddddddddddd.....fffffff..f.fffff...ffffffffff.cdbb......fffffff..f.#af.....c.cc..bbbbbb..c......fffffff.",
-".ff....bbbd.dbcbbbbbbbbbcbdedbbb....fff..f....f.bc.fdddddddf.cdbb.d..f.....ffff..f.#af..cbbcc.cc..bbbb..c......b....fff.",
-"...bbbb...deedbbcbbcbbcbbbd.dbb.bbbb.....f.fff.fbbc.fffffff.cdbb.d..f..dd.c..ff..........cbbcc.cc......c.....bbbdfff....",
-".bb....c.ccdeedbbbcccbbbbdedbb.bbb..cc...ff...c.fbbc.fdddf.cdbb.d..f..dd.cccd.f...ffff...dcbbcc.cc....cc...ddbbbdfddddf.",
-"...cc.c....bd.dbcbbcbbcbbd.db.bb..cbc.b..ff.dccc.bbc.ffff.cdbb.dd..ff...cdcdfd.........f.dcbbacc.cccccc..fdcbdbbdffddff.",
-"..c....bbbbbdeddddddddddddedbb..cccc.bb..f..fdcdc.bbc.ff.cdbb.dddd..ff.cccdffdc...ffff.f.dcbbcacc.c...c.fdccccdbdffddff.",
-"...bb.bb....bbbbbbbbbbbbbbbb..ccbbc.bb....ffdfdccc.bbc..cdbb..........cccdfdfbc........f.dcbbccacc.ccb.fdddbdbdbddffffd.",
-".bbb.b..ccc.d.d.d.d.dd.d.d.d.cccbb.bb.b..cbdfffdccc.fdfdfdfdfdfdfdfd.cccdfffbbc...ffff.f.dcbbacca.bcdcc.caddddcddff..ff.",
-".bb.bb.ccbcd.d.d.d.ff.d.d.d.dcbcc.bb.bb..cbbddddcdc.dbdbdbdbdbdbdbdb.cdcddddbbc.........ddcddaacc.cdddc.ccaddcdd........",
-".b.bb.bbccc.d.d.d.dd.d.d.d.d.ccc.bb.bbb..cbbfffdccc.fdfdfdfdfdfdfdfd.cccdfffdbc..ff..ffddcddddaac.ccdcb.accbbcd.f.ffff..",
-"..bb.cbbcc..bbbbbbbbbbbbbbbb....b..bb....cbfdfdccc..........bbdc..cbb.cccdfdff...dffffddcdbdbddaac.bcc.ccacbbcd.f.......",
-".bb.cccc..bbdeddddddddddddedbbbbb....c...cdffdccc.ff..dddd.bbdc.ff.cbb.cdcdff.f..ffddffdbdccccdfa.c...c.ccabbcd.f.ffff..",
-".b.cbc..bb.bd.dbbcbbcbbcbd.db....c.cc.....dfdcdc...ff..dd.bbdc.ffff.cbb.cccd.ff..ffddffdbbdbcdff..cccccc.ccbbcd.f.......",
-"..cc..bbb.bbdedbbbbcccbbbdeedcc.c....bb..f.dccc.dd..f..d.bbdc.fdddf.cbbf.c...ff..fddddfdbbbddf...cc....cc.cbbcd...ffff..",
-"....bbbb.bbd.dbbbcbbcbbcbbdeed...bbbb....ff..c.dd..f..d.bbdc.fffffff.cbbf.fff.f.....fffdbbb......c......cc.cbbc.........",
-".fff....bbbdedbcbbbbbbbbbcbd.dbbb....ff..ffff.....f..d.bbdc.fdddddddf.cb.f....f..fff....bb......c..bbbb..cc.cbbc..fa#.f.",
-".fffffff.....ddddddddddddddde....fff.ff..fffffff......bbdc.ffffffffff...fffff.f..fffffff.......c..bbbbbb..cc......fa#.f.",
-".ffffffffffff.................f.ff....f..ffffffffffff.................f.ff....f..ffffffffff...................fff.fa#.f.",
-".fffffffffffffff.c.c.fffff.fffff.ffff.f..fffffffffffff..f.f.f.ffff..ffff.ffff.f..ffffffffffff...f.f.f..a.aaa.ffff.fa#.f.",
-".ffffffffffffffff.c.c.ffff.ffffff....ff..fffffffffffff...f.f.ffffff.fffff....ff..fffffffffffff..f....f...a....fff.fa#.f.",
-".ffffffffffffffff.c.c.ff...ffffff.cbc.f..ffffffffffffff...f.ffbbbbff.ffffff.fff..fffffffffffff.ffffffff..a.f..fff.fa#.f.",
-".ffffffffffffffff.c.c.ff###..ffff.cbc.f..fffffffffffffff.b..ffffffff.fffff.c.ff..fffffffffffff.fff..ffff.a.ffffff.fa#.f.",
-".ffffffffffffffff.c.c.ffffff.fffff.c.ff..fffffffffffffff..b.fff..fff.fffff.c.ff..fffffffffffff.fff.fffff.a.ffffff.fa#.f.",
-".ffffffffffffffff.c.c.fffff.fffff.cbc.f..fffffffffffffff....ffff.fff.fffff.c.ff..fffffffffffff.ffff.ffff.a.ffffff.fa#.f.",
-".ffffffffffffffff.c.c.ff.f.ffffff.cbc.f..fffffffffffffff.b..ffff.fff.fffff.c.ff..fffffffffffff.f..fff..f.a.ffffff.fa#.f.",
-".ffffffffffffffff.c.c.f..f.fffffff.c.ff..ffffffffffffff..bb.f..ff..f.ffffff.fff..ffffffffffffff.f.fff.ff.a.ffffff.fa#.f.",
-".fffffffffffffffff.c.c.fff.ffffff.cbc.f..fffffffffffff.c.cbb.f.ff.f..fffff.b.ff..ffffffffffffff............ffffff.fa#.f.",
-".fffffffffffffffff........fffffff.cbc.f..fffffffffffff..c..bb.ffff.f.fffff.b.ff..ffffffffffffff.bbbbbbbbbb.ffffff.fa#.f.",
-".ffffffffffffffff.bbbbbbbb.fffffff.c.ff..ffffffffffffff.c..cbb.ff.f..ffffff.fff..fffffffffffff.bbcccbbbccbb.ffffff.a.ff.",
-".fffffffffffffff.b.bb.bb.bb.fffffff.fff..ffffffffffffff..cc.cbb..f..fffffffffff..ffffffffffff.bbcccccbccccbb.ffffff.fff.",
-"........................................................................................................................"
-};
diff --git a/samples/forty/pile.cpp b/samples/forty/pile.cpp
deleted file mode 100644 (file)
index d92c1d8..0000000
+++ /dev/null
@@ -1,305 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name:        pile.cpp
-// Purpose:     Forty Thieves patience game
-// Author:      Chris Breeze
-// Modified by:
-// Created:     21/07/97
-// RCS-ID:      $Id$
-// Copyright:   (c) 1993-1998 Chris Breeze
-// Licence:    wxWindows licence
-//---------------------------------------------------------------------------
-// Last modified: 22nd July 1998 - ported to wxWindows 2.0
-/////////////////////////////////////////////////////////////////////////////
-//+-------------------------------------------------------------+
-//| Description:                                                                                               |
-//|    The base class for holding piles of playing cards.                      |
-//+-------------------------------------------------------------+
-
-#ifdef __GNUG__
-#pragma implementation
-#pragma interface
-#endif
-
-// For compilers that support precompilation, includes "wx/wx.h".
-#include "wx/wxprec.h"
-
-#ifdef __BORLANDC__
-#pragma hdrstop
-#endif
-
-#ifndef WX_PRECOMP
-#include "wx/wx.h"
-#endif
-#ifdef __GNUG__
-#pragma implementation
-#endif
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <time.h>
-#include <string.h>
-#include "card.h"
-#include "pile.h"
-
-#include "wx/app.h"
-
-//+-------------------------------------------------------------+
-//| Pile::Pile()                                                                                               |
-//+-------------------------------------------------------------+
-//| Description:                                                                                               |
-//|    Initialise the pile to be empty of cards.                                       |
-//+-------------------------------------------------------------+
-Pile::Pile(int x, int y, int dx, int dy)
-{
-    m_x = x;
-    m_y = y;
-    m_dx = dx;
-    m_dy = dy;
-    for (m_topCard = 0; m_topCard < NumCards; m_topCard++)
-    {
-       m_cards[m_topCard] = 0;
-    }
-    m_topCard = -1;    // i.e. empty
-}
-
-
-//+-------------------------------------------------------------+
-//| Pile::Redraw()                                                                                             |
-//+-------------------------------------------------------------+
-//| Description:                                                                                               |
-//|    Redraw the pile on the screen. If the pile is empty                     |
-//|    just draw a NULL card as a place holder for the pile.           |
-//|    Otherwise draw the pile from the bottom up, starting            |
-//|    at the origin of the pile, shifting each subsequent                     |
-//|    card by the pile's x and y offsets.                                                     |
-//+-------------------------------------------------------------+
-void Pile::Redraw(wxDC& dc )
-{
-   wxWindow *frame = wxTheApp->GetTopWindow();
-   wxWindow *canvas = (wxWindow *) NULL;
-   if (frame)
-   {
-     wxNode *node = frame->GetChildren().First();
-     if (node) canvas = (wxWindow*)node->Data();
-   }
-
-       if (m_topCard >= 0)
-       {
-               if (m_dx == 0 && m_dy == 0)
-               {
-                       if ((canvas) && (canvas->IsExposed(m_x,m_y,60,200))) 
-                         m_cards[m_topCard]->Draw(dc, m_x, m_y);
-               }
-               else
-               {
-                       int x = m_x;
-                       int y = m_y;
-                       for (int i = 0; i <= m_topCard; i++)
-                       {
-                             if ((canvas) && (canvas->IsExposed(x,y,60,200))) 
-                               m_cards[i]->Draw(dc, x, y);
-                             x += m_dx;
-                             y += m_dy;
-                       }
-               }
-       }
-       else
-       {
-            if ((canvas) && (canvas->IsExposed(m_x,m_y,60,200))) 
-               Card::DrawNullCard(dc, m_x, m_y);
-       }
-}
-
-
-//+-------------------------------------------------------------+
-//| Pile::GetTopCard()                                         |
-//+-------------------------------------------------------------+
-//| Description:                                                                                               |
-//|    Return a pointer to the top card in the pile or NULL            |
-//|    if the pile is empty.                                                                           |
-//| NB:        Gets a copy of the card without removing it from the    |
-//|    pile.                                                                                                           |
-//+-------------------------------------------------------------+
-Card* Pile::GetTopCard()
-{
-    Card* card = 0;
-
-    if (m_topCard >= 0)
-    {
-       card = m_cards[m_topCard];
-    }
-    return card;
-}
-
-
-//+-------------------------------------------------------------+
-//| Pile::RemoveTopCard()                                       |
-//+-------------------------------------------------------------+
-//| Description:                                                                                               |
-//|    If the pile is not empty, remove the top card from the          |
-//|    pile and return the pointer to the removed card.                        |
-//|    If the pile is empty return a NULL pointer.                                     |
-//+-------------------------------------------------------------+
-Card* Pile::RemoveTopCard()
-{
-    Card* card = 0;
-
-    if (m_topCard >= 0)
-    {
-               card = m_cards[m_topCard--];
-    }
-    return card;
-}
-
-
-//+-------------------------------------------------------------+
-//| Pile::RemoveTopCard()                                       |
-//+-------------------------------------------------------------+
-//| Description:                                                                                               |
-//|    As RemoveTopCard() but also redraw the top of the pile          |
-//|    after the card has been removed.                                                        |
-//| NB:        the offset allows for the redrawn area to be in a               |
-//|    bitmap ready for 'dragging' cards acrosss the screen.           |
-//+-------------------------------------------------------------+
-Card* Pile::RemoveTopCard(wxDC& dc, int xOffset, int yOffset)
-{
-       int topX, topY, x, y;
-
-       GetTopCardPos(topX, topY);
-       Card* card = RemoveTopCard();
-
-       if (card)
-       {
-               card->Erase(dc, topX - xOffset, topY - yOffset);
-               GetTopCardPos(x, y);
-               if (m_topCard < 0)
-               {
-                       Card::DrawNullCard(dc, x - xOffset, y - yOffset);
-               }
-               else
-               {
-                       m_cards[m_topCard]->Draw(dc, x - xOffset, y - yOffset);
-               }
-       }
-
-       return card;
-}
-
-
-void Pile::GetTopCardPos(int& x, int& y)
-{
-       if (m_topCard < 0)
-       {
-               x = m_x;
-               y = m_y;
-       }
-       else
-       {
-               x = m_x + m_dx * m_topCard;
-               y = m_y + m_dy * m_topCard;
-       }
-}
-
-void Pile::AddCard(Card* card)
-{
-    if (m_topCard < -1) m_topCard = -1;
-
-    m_cards[++m_topCard] = card;
-}
-
-void Pile::AddCard(wxDC& dc, Card* card)
-{
-    AddCard(card);
-    int x, y;
-    GetTopCardPos(x, y);
-    card->Draw(dc, x, y);
-}
-
-// Can the card leave this pile.
-// If it is a member of the pile then the answer is yes.
-// Derived classes may override this behaviour to incorporate
-// the rules of the game
-bool Pile::CanCardLeave(Card* card)
-{
-    for (int i = 0; i <= m_topCard; i++)
-    {
-       if (card == m_cards[i]) return TRUE;
-    }
-    return FALSE;
-}
-
-// Calculate how far x, y is from top card in the pile
-// Returns the square of the distance
-int Pile::CalcDistance(int x, int y)
-{
-    int cx, cy;
-    GetTopCardPos(cx, cy);
-    return ((cx - x) * (cx - x) + (cy - y) * (cy - y));
-}
-
-
-// Return the card at x, y. Check the top card first, then
-// work down the pile. If a card is found then return a pointer
-// to the card, otherwise return NULL
-Card* Pile::GetCard(int x, int y)
-{
-       int cardX;
-       int cardY;
-       GetTopCardPos(cardX, cardY);
-
-       for (int i = m_topCard; i >= 0; i--)
-       {
-               if (x >= cardX && x <= cardX + CardWidth &&
-                       y >= cardY && y <= cardY + CardHeight)
-               {
-                       return m_cards[i];
-               }
-               cardX -= m_dx;
-               cardY -= m_dy;
-       }
-       return 0;
-}
-
-
-// Return the position of the given card. If it is not a member of this pile
-// return the origin of the pile.
-void Pile::GetCardPos(Card* card, int& x, int& y)
-{
-       x = m_x;
-       y = m_y;
-
-       for (int i = 0; i <= m_topCard; i++)
-       {
-               if (card == m_cards[i])
-               {
-                       return;
-               }
-               x += m_dx;
-               y += m_dy;
-       }
-
-       // card not found in pile, return origin of pile
-       x = m_x;
-       y = m_y;
-}
-
-
-bool Pile::Overlap(int x, int y)
-{
-    int cardX;
-    int cardY;
-    GetTopCardPos(cardX, cardY);
-
-    if (x >= cardX - CardWidth  && x <= cardX + CardWidth &&
-       y >= cardY - CardHeight && y <= cardY + CardHeight)
-    {
-           return TRUE;
-    }
-    return FALSE;
-}
-
-
-Pile::~Pile()
-{
-// nothing special at the moment
-}
diff --git a/samples/forty/pile.h b/samples/forty/pile.h
deleted file mode 100644 (file)
index 49eb8c9..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name:        pile.h
-// Purpose:     Forty Thieves patience game
-// Author:      Chris Breeze
-// Modified by:
-// Created:     21/07/97
-// RCS-ID:      $Id$
-// Copyright:   (c) 1993-1998 Chris Breeze
-// Licence:    wxWindows licence
-//---------------------------------------------------------------------------
-// Last modified: 22nd July 1998 - ported to wxWindows 2.0
-/////////////////////////////////////////////////////////////////////////////
-//+-------------------------------------------------------------+
-//| Description:                                                                                               |
-//|    The base class for holding piles of playing cards.                      |
-//|    This is the basic building block for card games. A pile         |
-//|    has a position on the screen and an offset for each                     |
-//|    card placed on it e.g. a pack has no offset, but the            |
-//|    discard pile may be fanned out across the screen.                       |
-//|                                                                                                                            |
-//|    The pile knows how to draw itself, though this may be           |
-//|    overridden if the default layout needs to be changed.           |
-//|    One or more cards can be removed from the top of a pile,        |
-//|    and single cards can be added to the top of a pile.             |
-//|    Functions are provided which redraw the screen when                     |
-//|    cards are added or removed.                                                                     |
-//|                                                                                                                            |
-//|    Cards know which way up they are and how to draw                        |
-//|    themselves. Piles are lists of cards. Piles know which          |
-//|    cards they contain and where they are to be drawn.                      |
-//+-------------------------------------------------------------+
-#ifndef _PILE_H_
-#define _PILE_H_
-#include "card.h"
-
-const int NumCards = 2 * PackSize;
-
-
-//----------------------------------------------------------------//
-// A class defining a pile of cards with a position on the screen //
-//----------------------------------------------------------------//
-class Pile {
-public:
-       Pile(int x, int y, int dx = 0, int dy = 0);
-       virtual ~Pile();
-
-       // General functions
-       virtual void ResetPile() { m_topCard = -1; }
-       virtual void Redraw(wxDC& pDC);
-
-       // Card query functions
-       virtual Card* GetCard(int x, int y);    // Get pointer to card at x, y
-       Card* GetTopCard();                     // Get pointer to top card
-       virtual void GetCardPos(Card* card, int& x, int& y);
-       // Get position of a card
-       virtual void GetTopCardPos(int& x, int& y);
-       // Get position of the top card
-       int GetNumCards() { return m_topCard + 1; }     // Number of cards in pile
-       bool Overlap(int x, int y);     // does card at x,y overlap the pile?
-       int CalcDistance(int x, int y); // calculates the square of the distance
-                                                                       // of a card at (x,y) from the top of the pile
-
-       // Functions removing one or more cards from the top of a pile
-       virtual bool CanCardLeave(Card* card);
-       Card* RemoveTopCard();
-       virtual Card* RemoveTopCard(wxDC& pDC, int xOffset = 0, int yOffset = 0);
-
-       // Functions to add a card to the top of a pile
-       virtual bool AcceptCard(Card*) { return FALSE; }
-       virtual void AddCard(Card* card);       // Add card to top of pile
-       virtual void AddCard(wxDC& pDC, Card* card);    // Add card + redraw it
-
-protected:
-       int   m_x, m_y;                         // Position of the pile on the screen
-       int   m_dx, m_dy;                       // Offset when drawing the pile
-       Card* m_cards[NumCards];        // Array of cards in this pile
-       int   m_topCard;                                // Array index of the top card
-};
-
-#endif // _PILE_H_
diff --git a/samples/forty/playerdg.cpp b/samples/forty/playerdg.cpp
deleted file mode 100644 (file)
index fa3ea03..0000000
+++ /dev/null
@@ -1,188 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name:        playerdg.cpp
-// Purpose:     Forty Thieves patience game
-// Author:      Chris Breeze
-// Modified by:
-// Created:     21/07/97
-// RCS-ID:      $Id$
-// Copyright:   (c) 1993-1998 Chris Breeze
-// Licence:    wxWindows licence
-//---------------------------------------------------------------------------
-// Last modified: 22nd July 1998 - ported to wxWindows 2.0
-/////////////////////////////////////////////////////////////////////////////
-
-#ifdef __GNUG__
-#pragma implementation
-#pragma interface
-#endif
-
-// For compilers that support precompilation, includes "wx/wx.h".
-#include "wx/wxprec.h"
-
-#ifdef __BORLANDC__
-#pragma hdrstop
-#endif
-
-#ifndef WX_PRECOMP
-#include "wx/wx.h"
-#endif
-
-#include "scorefil.h"
-#include "playerdg.h"
-
-const int ID_LISTBOX = 101;
-
-BEGIN_EVENT_TABLE(PlayerSelectionDialog, wxDialog)
-       EVT_SIZE(PlayerSelectionDialog::OnSize)
-       EVT_BUTTON(wxID_OK, PlayerSelectionDialog::ButtonCallback)
-       EVT_BUTTON(wxID_CANCEL, PlayerSelectionDialog::ButtonCallback)
-       EVT_LISTBOX(ID_LISTBOX, PlayerSelectionDialog::SelectCallback)
-    EVT_CLOSE(PlayerSelectionDialog::OnCloseWindow)
-END_EVENT_TABLE()
-
-PlayerSelectionDialog::PlayerSelectionDialog(
-                                                       wxWindow* parent,
-                                                       ScoreFile* file
-                                                       ) :
-       wxDialog(parent, -1, "Player Selection",
-                       wxDefaultPosition, wxSize(320, 200),
-                       wxDIALOG_MODAL | wxDEFAULT_DIALOG_STYLE),
-       m_scoreFile(file)
-{
-       // enable constraints
-       SetAutoLayout (TRUE);
-
-       wxStaticText* msg = new wxStaticText(this, -1, "Please select a name from the list");
-
-       wxListBox* list = new wxListBox(
-                                               this, ID_LISTBOX,
-                                               wxDefaultPosition, wxDefaultSize,
-                                               0, 0,
-                                               wxLB_SINGLE
-                                               );
-    
-       wxArrayString players;
-       m_scoreFile->GetPlayerList(players);
-       for (unsigned int i = 0; i < players.Count(); i++)
-       {
-               list->Append(players[i]);
-       }
-
-       m_textField = new wxTextCtrl(this, -1, "", wxDefaultPosition, wxDefaultSize, 0);
-
-       m_OK = new wxButton(this, wxID_OK, "OK");
-       m_cancel = new wxButton(this, wxID_CANCEL, "Cancel");
-
-       wxLayoutConstraints* layout;
-
-       // Constrain the msg at the top of the window
-       layout = new wxLayoutConstraints;
-       layout->left.SameAs             (this,  wxLeft,         10);
-       layout->top.SameAs              (this,  wxTop,  10);
-       layout->height.AsIs();
-       layout->width.AsIs();
-       msg->SetConstraints(layout);
-
-       // Constrain the OK button
-       layout = new wxLayoutConstraints;
-       layout->left.SameAs             (this,  wxLeft,         10);
-       layout->bottom.SameAs   (this,   wxBottom,      10);
-       layout->height.AsIs();
-       layout->width.AsIs();
-       m_OK->SetConstraints(layout);
-
-       // Constrain the OK button
-       layout = new wxLayoutConstraints;
-       layout->left.RightOf    (m_OK,  10);
-       layout->bottom.SameAs   (this,  wxBottom,       10);
-       layout->height.AsIs();
-       layout->width.AsIs();
-       m_cancel->SetConstraints(layout);
-
-       // Constrain the Name text entry field
-       layout = new wxLayoutConstraints;
-       layout->left.SameAs             (this,  wxLeft,         10);
-       layout->right.SameAs    (this,  wxRight,        10);
-       layout->bottom.SameAs   (m_OK,  wxTop,          10);
-       layout->height.AsIs();
-       m_textField->SetConstraints(layout);
-
-       // Constrain the list of players
-       layout = new wxLayoutConstraints;
-       layout->left.SameAs             (this,  wxLeft,         10);
-       layout->right.SameAs    (this,  wxRight,        10);
-       layout->top.Below               (msg,   10);
-       layout->bottom.SameAs   (m_textField,   wxTop,  10);
-       list->SetConstraints(layout);
-
-       wxString prevPlayer = m_scoreFile->GetPreviousPlayer();
-       if (prevPlayer.Length() > 0)
-       {
-               list->SetStringSelection(prevPlayer);
-               m_textField->SetValue(prevPlayer);
-       }
-
-       Layout();
-}
-
-PlayerSelectionDialog::~PlayerSelectionDialog()
-{
-}
-
-void PlayerSelectionDialog::OnSize(wxSizeEvent& WXUNUSED(event))
-{
-       Layout();
-}
-
-const wxString& PlayerSelectionDialog::GetPlayersName()
-{
-/*
-       m_player = "";
-       Show(TRUE);
-*/
-       return m_player;
-}
-
-void PlayerSelectionDialog::OnCloseWindow(wxCloseEvent& event)
-{
-       m_player = "";
-    EndModal(wxID_CANCEL);
-}
-
-void PlayerSelectionDialog::SelectCallback(wxCommandEvent& event)
-{
-       if (event.GetEventType() == wxEVT_COMMAND_LISTBOX_SELECTED)
-       {
-//         if (event.IsSelection())
-               m_textField->SetValue(event.GetString());
-       }
-}
-
-void PlayerSelectionDialog::ButtonCallback(wxCommandEvent& event)
-{
-       if (event.GetId() == wxID_OK)
-       {
-               wxString name = m_textField->GetValue();
-               if (!name.IsNull() && name.Length() > 0)
-               {
-                       if (name.Contains('@'))
-                       {
-                               wxMessageBox("Names should not contain the '@' character", "Forty Thieves");
-                       }
-                       else
-                       {
-                               m_player = name;
-                               EndModal(wxID_OK);
-                       }
-               }
-               else
-               {
-                       wxMessageBox("Please enter your name", "Forty Thieves");
-               }
-       }
-       else
-       {
-               m_player = "";
-               EndModal(wxID_CANCEL);
-       }
-}
diff --git a/samples/forty/playerdg.h b/samples/forty/playerdg.h
deleted file mode 100644 (file)
index 70d9cfb..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name:        playerdg.h
-// Purpose:     Forty Thieves patience game
-// Author:      Chris Breeze
-// Modified by:
-// Created:     21/07/97
-// RCS-ID:      $Id$
-// Copyright:   (c) 1993-1998 Chris Breeze
-// Licence:    wxWindows licence
-//---------------------------------------------------------------------------
-// Last modified: 22nd July 1998 - ported to wxWindows 2.0
-/////////////////////////////////////////////////////////////////////////////
-#ifndef _PLAYERDG_H_
-#define _PLAYERDG_H_
-
-class PlayerSelectionDialog : public wxDialog
-{
-public:
-       PlayerSelectionDialog(wxWindow* parent, ScoreFile* file);
-       virtual ~PlayerSelectionDialog();
-
-       const wxString& GetPlayersName();
-       void ButtonCallback(wxCommandEvent& event);
-       void SelectCallback(wxCommandEvent& event);
-       void OnSize(wxSizeEvent& event);
-
-       DECLARE_EVENT_TABLE()
-
-protected:
-       friend void SelectCallback(wxListBox&, wxCommandEvent&);
-       void OnCloseWindow(wxCloseEvent& event);
-
-private:
-       ScoreFile*      m_scoreFile;
-       wxString        m_player;
-       wxButton*       m_OK;
-       wxButton*       m_cancel;
-       wxTextCtrl*     m_textField;
-};
-
-#endif
diff --git a/samples/forty/readme.txt b/samples/forty/readme.txt
deleted file mode 100644 (file)
index e8a2be7..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-Forty Thieves is a patience game played with two full packs of
-cards. At the start of the game forty cards are dealt on the
-eight 'bases' along the top of the window. The object of the
-game is to place all the cards onto the eight 'foundations'. The
-foundations are built starting with the ace and adding cards of
-the same suit up to the king. Cards are dealt from the pack and
-placed on the discard pile. Cards may be moved from the discard
-pile or one of the bases to a base or a foundation. Only one
-card can be moved at a time. Cards can only be placed on a base
-if the top card of the base is of the same suit and is one
-higher in pip value or the base is empty e.g. the eight of
-spades can only be placed on top of the nine of spades.
-
-When the mouse cursor is over a card which can be moved it
-changes to the 'hand' cursor. The card can then be moved by
-double clicking the left button.
-
-The mouse cursor also changes to a hand when a card is dragged
-by placing the cursor over the card and holding down the left
-button. This feature can be enabled and disabled by selecting
-the 'Helping hand' option from the Edit menu.
-
-The 'foundations' are the eight piles of cards down the left
-side of the window. When the game starts these piles are empty.
-The object of the game is to place all the cards on the
-foundations. An ace can be placed on any empty foundation. Other
-cards can only be placed on a foundation if the top card is of
-the same suit and is one lower in pip value e.g. the three of
-clubs can be placed on the four of clubs.
-
-The 'bases' are the ten piles of cards along the top of the
-window. At the start of the game four cards are dealt face up on
-each of the bases. A card can be added to a base if the base is
-empty or if the top card is of the same suit and is one higher
-in pip value e.g. the queen of hearts can be placed on the king
-of hearts The top card of a base can be moved onto another base
-or a foundation.
-
-Cards can be only moved one at a time. The top card of the pack
-can be dealt onto discard pile by placing the mouse cursor over
-the pack and pressing the left button. The number of cards
-remaining is displayed to the right of the pack.
-
-Cards can be moved from the discard pile or the bases either by
-'double-clicking' or by dragging. If the left button is
-double-clicked when the mouse cursor is over a card and it can
-move to another pile, it will do so. This is a quick way of
-moving cards when their destination is unambiguous.
-
-A card can be dragged by placing the mouse cursor over the card
-and holding down the left button. The card will follow the mouse
-cursor until the left button is released. If the card is over a
-pile on which it can be placed it will be added to that pile,
-otherwise it will be returned to the pile from which it was
-dragged.
-
-One point is scored for every card that is placed on a
-foundation. Since there are two packs of 52 cards the maximum
-score is 104. A record is kept of the number of games played,
-the number of games won, the current score and the average
-score. This information is displayed at bottom right of the
-window and is stored on disk between games. A game is deemed to
-have started if the cards have been dealt and any card has been
-moved. If the game is abandoned before it is finished (i.e. by
-starting a new game or closing window) it counts as a lost game.
-New players can be added by selecting the 'Player' option from
-the Game menu. A summary of players' scores can be displayed by
-selecting the 'Scores...' option from the Game menu.
-
-All moves are recorded and can be undone. To undo a move select
-the undo menu item from the Edit menu. A quicker way of undoing
-is to press the right mouse button (it doesn't matter where the
-mouse cursor is). Right button undo can be enabled and disabled
-by selecting the 'Right button undo' option from the Edit menu.
-Pressing the right mouse button with the control key pressed
-re-does a previously undone move.
-
-An empty base or two is very useful as it gives the opportunity
-to unscramble other bases. Try not to build onto kings which
-obscure valuable cards as it will be difficult to get to them
-later. The undo facility is very useful for going back and using
-'hindsight'.
-
-Don't be put off if you can't win every game. I reckon winning 1
-in 10 is pretty good (winning 1 in 3 is excellent).
-
diff --git a/samples/forty/scoredg.cpp b/samples/forty/scoredg.cpp
deleted file mode 100644 (file)
index 136fff7..0000000
+++ /dev/null
@@ -1,192 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name:        scoredg.cpp
-// Purpose:     Forty Thieves patience game
-// Author:      Chris Breeze
-// Modified by:
-// Created:     21/07/97
-// RCS-ID:      $Id$
-// Copyright:   (c) 1993-1998 Chris Breeze
-// Licence:    wxWindows licence
-//---------------------------------------------------------------------------
-// Last modified: 22nd July 1998 - ported to wxWindows 2.0
-/////////////////////////////////////////////////////////////////////////////
-
-#ifdef __GNUG__
-#pragma implementation
-#pragma interface
-#endif
-
-// For compilers that support precompilation, includes "wx/wx.h".
-#include "wx/wxprec.h"
-
-#ifdef __BORLANDC__
-#pragma hdrstop
-#endif
-
-#ifndef WX_PRECOMP
-#include "wx/wx.h"
-#endif
-
-#if wxUSE_IOSTREAMH
-#if defined(__WXMSW__) && !defined(__GNUWIN32__) && !defined(__MWERKS__)
-#include <strstrea.h>
-#else
-#include <strstream.h>
-#endif
-#else
-#include <strstream>
-using namespace std;
-#endif
-#include "scorefil.h"
-#include "scoredg.h"
-
-class ScoreCanvas : public wxScrolledWindow
-{
-public:
-       ScoreCanvas(wxWindow* parent, ScoreFile* scoreFile);
-       virtual ~ScoreCanvas();
-
-       void OnDraw(wxDC& dc);
-
-private:
-       wxFont*         m_font;
-       wxString        m_text;
-};
-
-
-ScoreCanvas::ScoreCanvas(wxWindow* parent, ScoreFile* scoreFile) :
-       wxScrolledWindow(parent)
-{
-#ifdef __WXGTK__
-       m_font = wxTheFontList->FindOrCreateFont(12, wxROMAN, wxNORMAL, wxNORMAL);
-#else
-       m_font = wxTheFontList->FindOrCreateFont(10, wxSWISS, wxNORMAL, wxNORMAL);
-#endif
-
-        wxArrayString players;
-       scoreFile->GetPlayerList( players);
-
-       ostrstream os;
-
-       os << "Player\tWins\tGames\tScore\n";
-       for (unsigned int i = 0; i < players.Count(); i++)
-       {
-               int wins, games, score;
-               scoreFile->ReadPlayersScore(players[i], wins, games, score);
-               int average = 0;
-               if (games > 0)
-               {
-                       average = (2 * score + games) / (2 * games);
-               }
-
-               os << players[i] << '\t' 
-                  << wins  << '\t'
-                  << games << '\t'
-                  << average << '\n';
-       }
-       os << '\0';
-       char* str = os.str();
-       m_text = str;
-       delete str;
-}
-
-ScoreCanvas::~ScoreCanvas()
-{
-}
-
-void ScoreCanvas::OnDraw(wxDC& dc)
-{
-       dc.SetFont(* m_font);
-
-       const char* str = m_text;
-       unsigned int tab = 0;
-       unsigned int tabstops[] = { 5, 100, 150, 200 };
-
-       // get the line spacing for the current font
-       int lineSpacing;
-       {
-               long w, h;
-               dc.GetTextExtent("Testing", &w, &h);
-               lineSpacing = (int)h;
-       }
-
-       int y = 0;
-       while (*str)
-       {
-               char text[256];
-               char* dest = text;
-               
-               while (*str && *str >= ' ') *dest++ = *str++;
-               *dest = '\0';
-
-               dc.DrawText(text, tabstops[tab], y);
-
-               if (*str == '\t')
-               {
-                       if (tab < sizeof(tabstops) / sizeof(tabstops[0]) - 1)
-                       {
-                               tab++;
-                       }
-               }
-               else if (*str == '\n')
-               {
-                       tab = 0;
-                       y += lineSpacing;
-               }
-               if (*str) str++;
-       }
-}
-
-BEGIN_EVENT_TABLE(ScoreDialog, wxDialog)
-    EVT_CLOSE(ScoreDialog::OnCloseWindow)
-END_EVENT_TABLE()
-
-ScoreDialog::ScoreDialog(
-                                                       wxWindow* parent,
-                                                       ScoreFile* file
-                                                       ) :
-       wxDialog(parent, -1, "Scores",
-                       wxDefaultPosition, wxSize(310, 200),
-                       wxDIALOG_MODAL | wxDEFAULT_DIALOG_STYLE),
-       m_scoreFile(file)
-{
-       // enable constraints
-       SetAutoLayout (TRUE);
-
-       ScoreCanvas* list = new ScoreCanvas(this, m_scoreFile);
-       m_OK = new wxButton(this, wxID_OK, "OK");
-
-       wxLayoutConstraints* layout;
-
-       // Constrain the OK button
-       layout = new wxLayoutConstraints;
-       layout->left.SameAs             (this,  wxLeft,         10);
-       layout->bottom.SameAs   (this,   wxBottom,      10);
-       layout->height.AsIs();
-       layout->width.AsIs();
-       m_OK->SetConstraints(layout);
-
-       // Constrain the list of players
-       layout = new wxLayoutConstraints;
-       layout->left.SameAs             (this,  wxLeft,         10);
-       layout->right.SameAs    (this,  wxRight,        10);
-       layout->top.SameAs              (this,  wxTop,          10);
-       layout->bottom.SameAs   (m_OK,  wxTop,          10);
-       list->SetConstraints(layout);
-
-       Layout();
-}
-
-ScoreDialog::~ScoreDialog()
-{
-}
-
-void ScoreDialog::Display()
-{
-       Show(TRUE);
-}
-
-void ScoreDialog::OnCloseWindow(wxCloseEvent& event)
-{
-    EndModal(wxID_OK);
-}
diff --git a/samples/forty/scoredg.h b/samples/forty/scoredg.h
deleted file mode 100644 (file)
index 8ce7a72..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name:        scoredg.h
-// Purpose:     Forty Thieves patience game
-// Author:      Chris Breeze
-// Modified by:
-// Created:     21/07/97
-// RCS-ID:      $Id$
-// Copyright:   (c) 1993-1998 Chris Breeze
-// Licence:    wxWindows licence
-//---------------------------------------------------------------------------
-// Last modified: 22nd July 1998 - ported to wxWindows 2.0
-/////////////////////////////////////////////////////////////////////////////
-#ifndef _SCOREDG_H_
-#define _SCOREDG_H_
-
-class ScoreDialog : public wxDialog
-{
-public:
-       ScoreDialog(wxWindow* parent, ScoreFile* file);
-       virtual ~ScoreDialog();
-
-       void Display();
-
-protected:
-       void OnCloseWindow(wxCloseEvent& event);
-
-private:
-       ScoreFile*      m_scoreFile;
-       wxButton*       m_OK;
-
-DECLARE_EVENT_TABLE()
-};
-
-#endif
diff --git a/samples/forty/scorefil.cpp b/samples/forty/scorefil.cpp
deleted file mode 100644 (file)
index cb871ef..0000000
+++ /dev/null
@@ -1,183 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name:        scorefil.cpp
-// Purpose:     Forty Thieves patience game
-// Author:      Chris Breeze
-// Modified by:
-// Created:     21/07/97
-// RCS-ID:      $Id$
-// Copyright:   (c) 1993-1998 Chris Breeze
-// Licence:    wxWindows licence
-//---------------------------------------------------------------------------
-// Last modified: 14th May 1998 - ported to wxWindows 2.0
-/////////////////////////////////////////////////////////////////////////////
-
-#ifdef __GNUG__
-#pragma implementation
-#pragma interface
-#endif
-
-// For compilers that support precompilation, includes "wx/wx.h".
-#include "wx/wxprec.h"
-
-#ifdef __BORLANDC__
-#pragma hdrstop
-#endif
-
-#ifndef WX_PRECOMP
-#include "wx/wx.h"
-#endif
-
-#ifdef __WXGTK__
-#include <unistd.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#endif
-#include "wx/textfile.h"
-#include "wx/config.h"
-#include "wx/fileconf.h"
-
-#include "scorefil.h"
-
-
-ScoreFile::ScoreFile(const char* appName)
-{
-#if 0
-       wxString filename;
-       m_configFilename << "/usr/local/share/" << appName << ".scores";
-       if (access(m_configFilename, F_OK) == 0)
-       {
-               if (access(m_configFilename, R_OK | W_OK) != 0)
-               {
-                       // file is not r/w - use local file instead
-                       m_configFilename = wxFileConfig::GetLocalFileName(appName);
-               }
-       }
-       else
-       {
-               int fd = creat(m_configFilename, 0666);
-
-               if (fd < 0)
-               {
-                       // failed to create file - use local file instead
-                       m_configFilename = wxFileConfig::GetLocalFileName(appName);
-               }
-               else
-               {
-                       // ensure created file has rw-rw-rw permissions
-                       close(fd);
-               }
-       }
-#endif
-
-       m_config = new wxConfig(appName, "wxWindows", appName, "", wxCONFIG_USE_LOCAL_FILE);  // only local
-}
-
-ScoreFile::~ScoreFile()
-{
-       delete m_config;
-#ifdef __WXGTK__
-       // ensure score file has rw-rw-rw permissions
-       // (wxFileConfig sets them to rw-------)
-       chmod(m_configFilename, 0666);
-#endif
-}
-
-
-void ScoreFile::GetPlayerList( wxArrayString &list )
-{
-       m_config->SetPath("/Players");
-       int length = m_config->GetNumberOfGroups();
-
-       if (length <= 0) return;
-
-       wxString player;
-       long index, i = 0;
-       if (m_config->GetFirstGroup(player, index))
-       {
-            list.Add( player );
-            i++;
-               while (m_config->GetNextGroup(player, index))
-               {
-                 list.Add( player );
-                 i++;
-               }
-       }
-}
-
-
-// Calculate an encrypted check number to prevent tampering with
-// score file
-long ScoreFile::CalcCheck(const char* name, int p1, int p2, int p3)
-{
-    long check = 0;
-    while (*name)
-       {
-               check = (check << 1) ^ (long)*name++;
-               check = ((check >> 23) ^ check) & 0xFFFFFF;
-       }
-       check = (check << 1) ^ (long)p1;
-       check = ((check >> 23) ^ check) & 0xFFFFFF;
-       check = (check << 1) ^ (long)p2;
-       check = ((check >> 23) ^ check) & 0xFFFFFF;
-       check = (check << 1) ^ (long)p3;
-       check = ((check >> 23) ^ check) & 0xFFFFFF;
-    return check;
-}
-
-wxString ScoreFile::GetPreviousPlayer() const
-{
-       wxString result;
-       m_config->SetPath("/General");
-       m_config->Read("LastPlayer", &result);
-       return result;
-}
-
-void ScoreFile::ReadPlayersScore(
-                                               const char* player,
-                                               int& wins,
-                                               int& games,
-                                               int& score)
-{
-       long check;
-       long myWins, myGames, myScore;
-
-       games = wins = score = 0;
-
-       m_config->SetPath("/Players");
-       m_config->SetPath(player);
-       if (m_config->Read("Score", &myScore, 0L) &&
-               m_config->Read("Games", &myGames, 0L) &&
-               m_config->Read("Wins",  &myWins, 0L) &&
-               m_config->Read("Check", &check, 0L))
-       {
-           if (check != CalcCheck(player, myGames, myWins, myScore))
-               {
-                       wxMessageBox("Score file corrupted", "Warning",
-                                               wxOK | wxICON_EXCLAMATION);
-               }
-               else
-               {
-                       games = myGames;
-                       wins = myWins;
-                       score = myScore;
-               }
-       }
-       WritePlayersScore(player, wins, games, score);
-}
-
-
-void ScoreFile::WritePlayersScore(const char* player, int wins, int games, int score)
-{
-    if (player)
-       {
-               m_config->SetPath("/General");
-               m_config->Write("LastPlayer", wxString(player)); // Without wxString tmp, thinks it's bool in VC++
-
-               m_config->SetPath("/Players");
-               m_config->SetPath(player);
-               m_config->Write("Score", (long)score);
-               m_config->Write("Games", (long)games);
-               m_config->Write("Wins", (long)wins);
-               m_config->Write("Check", CalcCheck(player, games, wins, score));
-       }
-}
diff --git a/samples/forty/scorefil.h b/samples/forty/scorefil.h
deleted file mode 100644 (file)
index 1e89904..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name:        scorefil.h
-// Purpose:     Forty Thieves patience game
-// Author:      Chris Breeze
-// Modified by:
-// Created:     21/07/97
-// RCS-ID:      $Id$
-// Copyright:   (c) 1993-1998 Chris Breeze
-// Licence:    wxWindows licence
-//---------------------------------------------------------------------------
-// Last modified: 22nd July 1998 - ported to wxWindows 2.0
-/////////////////////////////////////////////////////////////////////////////
-#ifndef _SCOREFILE_H_
-#define _SCOREFILE_H_
-
-#include <wx/config.h>
-
-class wxConfig;
-
-class ScoreFile {
-public:
-       ScoreFile(const char* appName);
-       virtual ~ScoreFile();
-
-       void GetPlayerList( wxArrayString &list );
-       wxString GetPreviousPlayer() const;
-
-       void ReadPlayersScore(const char* player, int& wins, int& games, int &score);
-       void WritePlayersScore(const char* player, int wins, int games, int score);
-
-private:
-       long CalcCheck(const char* name, int p1, int p2, int p3);
-       wxString            m_configFilename;
-       wxConfig*           m_config;
-};
-
-#endif
diff --git a/samples/forty/symbols.bmp b/samples/forty/symbols.bmp
deleted file mode 100644 (file)
index 59f466c..0000000
Binary files a/samples/forty/symbols.bmp and /dev/null differ
diff --git a/samples/forty/symbols.xbm b/samples/forty/symbols.xbm
deleted file mode 100644 (file)
index 5dee698..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-#define Symbols_width 79
-#define Symbols_height 50
-static char Symbols_bits[] = {
- 0x08,0x84,0x0d,0x01,0x00,0x00,0x00,0x00,0x00,0x80,0x1c,0xce,0x9f,0x03,0x00,
- 0x00,0x00,0x00,0x00,0x80,0x2a,0xdf,0xdf,0x07,0x00,0x00,0x00,0x00,0x00,0x80,
- 0xff,0xff,0xff,0x0f,0x00,0x00,0x00,0x00,0x00,0x80,0x2a,0x9f,0xcf,0x07,0x00,
- 0x00,0x00,0x00,0x00,0x80,0x08,0x0e,0x07,0x01,0x00,0x00,0x00,0x00,0x00,0x80,
- 0x1c,0x04,0x82,0x03,0x00,0x00,0x00,0x00,0x00,0x80,0x1c,0x04,0x82,0x03,0x00,
- 0x00,0x00,0x00,0x00,0x80,0x08,0x0e,0x07,0x01,0x00,0x00,0x00,0x00,0x00,0x80,
- 0x2a,0x9f,0xcf,0x07,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0xff,0xff,0x0f,0x00,
- 0x00,0x00,0x00,0x00,0x80,0x2a,0xdf,0xdf,0x07,0x00,0x00,0x00,0x00,0x00,0x80,
- 0x1c,0xce,0x9f,0x03,0x00,0x00,0x00,0x00,0x00,0x80,0x08,0x84,0x0d,0x01,0x00,
- 0x00,0x00,0x00,0x00,0x80,0x70,0x00,0x01,0x63,0x40,0x00,0x00,0x00,0x00,0x80,
- 0xf8,0x80,0x83,0xf7,0xe0,0x00,0x00,0x00,0x00,0x80,0xf8,0x80,0xc3,0xff,0xf1,
- 0x01,0x00,0x00,0x00,0x80,0x70,0xc0,0xc7,0xff,0xf9,0x03,0x00,0x00,0x00,0x80,
- 0x26,0xe3,0xcf,0xff,0xfd,0x07,0x00,0x00,0x00,0x80,0xaf,0xf7,0xdf,0xff,0xff,
- 0x0f,0x00,0x00,0x00,0x80,0xff,0xe7,0x8f,0xff,0xfe,0x0f,0x00,0x00,0x00,0x80,
- 0xaf,0xc7,0x07,0x7f,0x5e,0x0f,0x00,0x00,0x00,0x80,0x26,0x83,0x03,0x3e,0x4c,
- 0x06,0x00,0x00,0x00,0x80,0x70,0x80,0x03,0x1c,0xe0,0x00,0x00,0x00,0x00,0x80,
- 0xfc,0x01,0x01,0x08,0xf8,0x03,0x00,0x00,0x00,0x80,0xfc,0x01,0x01,0x08,0xf8,
- 0x03,0x00,0x00,0x00,0x80,0x70,0x80,0x03,0x1c,0xe0,0x00,0x00,0x00,0x00,0x80,
- 0x26,0x83,0x03,0x3e,0x4c,0x06,0x00,0x00,0x00,0x80,0xaf,0xc7,0x07,0x7f,0x5e,
- 0x0f,0x00,0x00,0x00,0x80,0xff,0xe7,0x8f,0xff,0xfe,0x0f,0x00,0x00,0x00,0x80,
- 0xaf,0xf7,0xdf,0xff,0xff,0x0f,0x00,0x00,0x00,0x80,0x26,0xe3,0xcf,0xff,0xfd,
- 0x07,0x00,0x00,0x00,0x80,0x70,0xc0,0xc7,0xff,0xf9,0x03,0x00,0x00,0x00,0x80,
- 0xf8,0x80,0xc3,0xff,0xf1,0x01,0x00,0x00,0x00,0x80,0xf8,0x80,0x83,0xf7,0xe0,
- 0x00,0x00,0x00,0x00,0x80,0x70,0x00,0x01,0x63,0x40,0x00,0x00,0x00,0x00,0x80,
- 0x0c,0xe7,0x43,0x3e,0xe7,0x73,0x5c,0xe6,0x73,0xa2,0x92,0x08,0x61,0x82,0x00,
- 0x8a,0x62,0x09,0x89,0x92,0x21,0x88,0x50,0x9e,0x00,0x89,0x62,0x09,0x89,0x8a,
- 0x21,0xc6,0x49,0xa0,0x87,0x70,0x7c,0x09,0x89,0x86,0x3f,0x01,0xfa,0xa0,0x88,
- 0x88,0x60,0x09,0xa9,0x8a,0xa1,0x20,0x42,0xa2,0x88,0x88,0x50,0x29,0x49,0x92,
- 0xa1,0xcf,0x41,0x1c,0x87,0x70,0x48,0xc6,0xb0,0xa2,0xa1,0xcf,0x11,0x1c,0x87,
- 0x70,0x88,0x89,0x69,0xa2,0x21,0x28,0x12,0xa2,0x88,0x88,0x44,0x4a,0x92,0xa4,
- 0x3f,0x24,0xf8,0x82,0x88,0x88,0x42,0x4a,0xa8,0xa8,0x21,0xc3,0x91,0x82,0x8f,
- 0x70,0x5e,0x4a,0x88,0xb0,0xa1,0x80,0x50,0x3c,0x48,0x88,0x62,0x4a,0x88,0xa8,
- 0x92,0x48,0x30,0x20,0x28,0x88,0x62,0x4a,0x88,0xa4,0x0c,0xe7,0x13,0x3e,0xe7,
- 0x73,0x9c,0xe9,0x73,0xa2};
diff --git a/samples/forty/symbols.xpm b/samples/forty/symbols.xpm
deleted file mode 100644 (file)
index e5a2b25..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/* XPM */
-static char *symbols[] = {
-/* width height num_colors chars_per_pixel */
-"    79    50        3            1",
-/* colors */
-". c #ffffff",
-"* c #ff0000",
-"# c #000000",
-/* pixels */
-"...#......*....**.**....#......................................................",
-"..###....***..*******..###.....................................................",
-".#.#.#..*****.*******.#####....................................................",
-"#######**************#######...................................................",
-".#.#.#..*****..*****..#####....................................................",
-"...#.....***....***.....#......................................................",
-"..###.....*......*.....###.....................................................",
-"..###.....*......*.....###.....................................................",
-"...#.....***....***.....#......................................................",
-".#.#.#..*****..*****..#####....................................................",
-"#######**************#######...................................................",
-".#.#.#..*****.*******.#####....................................................",
-"..###....***..*******..###.....................................................",
-"...#......*....**.**....#......................................................",
-"....###.........*.......**...**.......#........................................",
-"...#####.......***.....****.****.....###.......................................",
-"...#####.......***....***********...#####......................................",
-"....###.......*****...***********..#######.....................................",
-".##..#..##...*******..***********.#########....................................",
-"####.#.####.*********.***********###########...................................",
-"###########..*******...*********.###########...................................",
-"####.#.####...*****.....*******..####.#.####...................................",
-".##..#..##.....***.......*****....##..#..##....................................",
-"....###........***........***........###.......................................",
-"..#######.......*..........*.......#######.....................................",
-"..#######.......*..........*.......#######.....................................",
-"....###........***........***........###.......................................",
-".##..#..##.....***.......*****....##..#..##....................................",
-"####.#.####...*****.....*******..####.#.####...................................",
-"###########..*******...*********.###########...................................",
-"####.#.####.*********.***********###########...................................",
-".##..#..##...*******..***********.#########....................................",
-"....###.......*****...***********..#######.....................................",
-"...#####.......***....***********...#####......................................",
-"...#####.......***.....****.****.....###.......................................",
-"....###.........*.......**...**.......#........................................",
-"..##....###..#####....#..#####..###..#####..###...###.#..##..#####..###..#...#.",
-".#..#..#...#....#....##..#.....#.........#.#...#.#...##.#..#....#..#...#.#..#..",
-"#....#.....#...#....#.#..####..#........#..#...#.#...##.#..#....#..#...#.#.#...",
-"#....#...##...###..#..#......#.####....#....###...#####.#..#....#..#...#.##....",
-"######..#........#.#####.....#.#...#...#...#...#.....##.#..#....#..#.#.#.#.#...",
-"#....#.#.....#...#....#..#...#.#...#...#...#...#....#.#.#..#.#..#..#..#..#..#..",
-"#....#.#####..###.....#...###...###....#....###....#..#..##...##....##.#.#...#.",
-"#....#.#####..###...#.....###...###....#....###....#...##..#...##..#.##..#...#.",
-"#....#.....#.#...#..#....#...#.#...#...#...#...#..#...#..#.#..#..#..#..#..#..#.",
-"######....#..#.....#####.#.....#...#...#...#...#.#....#..#.#..#....#.#.#...#.#.",
-"#....#..##....###...#..#.#.....#####...#....###..####.#..#.#..#....#...#....##.",
-"#....#.#.......#....#.#...####.....#..#....#...#.#...##..#.#..#....#...#...#.#.",
-".#..#..#...#..#.....##.......#.....#.#.....#...#.#...##..#.#..#....#...#..#..#.",
-"..##....###..#####..#....#####..###..#####..###...###..##..#.#####..###..#...#."
-};
diff --git a/samples/fractal/.cvsignore b/samples/fractal/.cvsignore
deleted file mode 100644 (file)
index 8b13789..0000000
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/samples/fractal/Makefile.in b/samples/fractal/Makefile.in
deleted file mode 100644 (file)
index 28486d1..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-#
-# File:                Makefile.in
-# Author:      Julian Smart
-# Created:     1998
-# Updated:     
-# Copyright:   (c) 1998 Julian Smart
-#
-# "%W% %G%"
-#
-# Makefile for fractal example (UNIX).
-
-top_srcdir = @top_srcdir@
-top_builddir = ../..
-program_dir = samples/fractal
-
-PROGRAM=fractal
-
-OBJECTS=$(PROGRAM).o
-
-include ../../src/makeprog.env
-
diff --git a/samples/fractal/fractal.cpp b/samples/fractal/fractal.cpp
deleted file mode 100644 (file)
index fe84a6a..0000000
+++ /dev/null
@@ -1,251 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// Name:        fractal.cpp
-// Purpose:     demo of wxConfig and related classes
-// Author:      Andrew Davison
-// Modified by:
-// Created:     05.04.94
-// RCS-ID:      $Id$
-// Copyright:   (c) 1994 Andrew Davison
-// Licence:     wxWindows licence
-///////////////////////////////////////////////////////////////////////////////
-
-
-/*
-Date: Tue, 5 Apr 1994 12:01:18 +1000
-From: Andrew Davison <andrewd@au.com.sfe>
-To: wxwin-users@ed.aiai
-Subject: Fractal mountains
-
-Hi,
-
-This is a quick port of a fractal mountain generator originally
-done for MS-Windows. On a Sun the colours look a little washed
-out and there is not as much snow or high mountains (maybe the
-random number generators fault). The viewing plane is not
-quite right as the original code used SetViewportOrg() which there
-doesn't seem to be an equivalent of under wxWindows, and my quick
-hack doesn't fix. 
-*/
-
-#ifdef __GNUG__
-#pragma implementation
-#pragma interface
-#endif
-
-#include "wx/wxprec.h"
-
-#ifndef  WX_PRECOMP
-  #include "wx/wx.h"
-#endif //precompiled headers
-
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-
-#define Random(x) (rand() % x)
-#define Randomize() (srand((unsigned int)time(NULL)))
-
-static int detail = 9;         // CHANGE THIS... 7,8,9 etc
-
-static bool running = FALSE;                                
-static wxMenuBar *menuBar = NULL;
-
-// Define a new application type
-class MyApp: public wxApp
-{ public:
-       bool OnInit();
-};
-
-IMPLEMENT_APP(MyApp)
-
-// Define a new frame type
-class MyFrame: public wxFrame
-{
-public:
-       MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size);
-
-       void OnCloseWindow(wxCloseEvent& event);
-    void OnExit(wxCommandEvent& event);
-DECLARE_EVENT_TABLE()
-};
-
-// Define a new canvas which can receive some events
-class MyCanvas: public wxWindow
-{
-public:
-       MyCanvas(wxFrame *frame);
-       void Draw(wxDC& dc);
-
-private:
-       void OnPaint(wxPaintEvent& event);
-       void Fractal(wxDC& dc, int X1, int Y1, int X2, int Y2, int Z1, int Z2, int Z3, int Z4, int Iteration, double Std, double Ratio);
-       wxPen SnowPen, MtnPen, GreenPen;
-       wxBrush WaterBrush;
-       int Sealevel;
-
-DECLARE_EVENT_TABLE()
-};
-
-// `Main program' equivalent, creating windows and returning main app frame
-bool MyApp::OnInit()
-{
-  // Create the main frame window
-  MyFrame *frame = new MyFrame(NULL, "Fractal Mountains for wxWindows", wxPoint(-1, -1), wxSize(640, 480));
-
-  // Make a menubar
-  wxMenu *file_menu = new wxMenu;
-  file_menu->Append(wxID_EXIT, "E&xit");
-  menuBar = new wxMenuBar;
-  menuBar->Append(file_menu, "&File");
-  frame->SetMenuBar(menuBar);
-
-  int width, height;
-  frame->GetClientSize(&width, &height);
-
-  (void) new MyCanvas(frame);
-
-  // Show the frame
-  frame->Show(TRUE);
-
-  return TRUE;
-}
-
-BEGIN_EVENT_TABLE(MyFrame, wxFrame)
-  EVT_CLOSE(MyFrame::OnCloseWindow)
-  EVT_MENU(wxID_EXIT, MyFrame::OnExit)
-END_EVENT_TABLE()
-
-// My frame constructor
-MyFrame::MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size):
-  wxFrame(frame, -1, title, pos, size)
-{
-}
-
-// Intercept menu commands
-void MyFrame::OnExit(wxCommandEvent& event)
-{
-    this->Destroy();
-}
-
-void MyFrame::OnCloseWindow(wxCloseEvent& event)
-{
-    static bool destroyed = FALSE;
-    if (destroyed)
-        return;
-
-    this->Destroy();
-
-    destroyed = TRUE;
-}
-
-BEGIN_EVENT_TABLE(MyCanvas, wxWindow)
-  EVT_PAINT(MyCanvas::OnPaint)
-END_EVENT_TABLE()
-
-// Define a constructor for my canvas
-MyCanvas::MyCanvas(wxFrame *frame):
- wxWindow(frame, -1)
-{
-    wxColour wxCol1(255,255,255);
-    SnowPen = wxPen(wxCol1, 2, wxSOLID);
-
-    wxColour wxCol2(128,0,0);
-    MtnPen = wxPen(wxCol2, 1, wxSOLID);
-
-    wxColour wxCol3(0,128,0);
-    GreenPen = wxPen(wxCol3, 1, wxSOLID);
-
-    wxColour wxCol4(0,0,128);
-    WaterBrush = wxBrush(wxCol4, wxSOLID);
-}
-
-void MyCanvas::OnPaint(wxPaintEvent& event)
-{
-    wxPaintDC dc(this);
-       Draw(dc);
-}
-
-void MyCanvas::Draw(wxDC& dc)
-{
-    if (running) return;
-        
-    running = TRUE;
-    menuBar->EnableTop(0, FALSE);
-
-       Randomize();
-
-       int Left, Top, Right, Bottom;
-       GetClientSize(&Right, &Bottom);
-
-       Right *= 3; Right /= 4;
-       Bottom *= 3; Bottom /= 4;
-       Left = 0;
-       Top = Bottom/8;
-
-       wxPoint Water[4];
-       Water[0].x = Left;                          Water[0].y = Top;
-       Water[1].x = Right;                             Water[1].y = Top;
-       Water[2].x = Right+Bottom/2;    Water[2].y = Bottom;
-       Water[3].x = Bottom/2;                  Water[3].y = Bottom;
-
-       dc.SetBrush(WaterBrush);
-       dc.DrawPolygon(4, Water);
-
-       double H = 0.75;
-       double Scale = Bottom;
-       double Ratio = 1.0 / pow(2.0, H);
-       double Std = Scale * Ratio;
-       Sealevel = Random(18) - 8;
-
-       Fractal(dc, Left, Top, Right, Bottom, 0, 0, 0, 0, detail, Std, Ratio);
-
-    menuBar->EnableTop(0, TRUE);
-    running = FALSE;
-}
-
-void MyCanvas::Fractal(wxDC& dc, int X1, int Y1, int X2, int Y2, int Z1, int Z2, int Z3, int Z4, int Iteration, double Std, double Ratio)
-{
-       int Xmid = (X1 + X2) / 2;
-       int Ymid = (Y1 + Y2) / 2;
-       int Z23 = (Z2 + Z3) / 2;
-       int Z41 = (Z4 + Z1) / 2;
-       int Newz = (int)((Z1 + Z2 + Z3 + Z4) / 4 + (double)(Random(17) - 8) / 8.0 * Std);
-
-       if (--Iteration)
-       {
-               int Z12 = (Z1 + Z2) / 2;
-               int Z34 = (Z3 + Z4) / 2;
-               double Stdmid = Std * Ratio;
-
-               Fractal(dc, Xmid, Y1, X2, Ymid, Z12, Z2, Z23, Newz, Iteration, Stdmid, Ratio);
-               Fractal(dc, X1, Y1, Xmid, Ymid, Z1, Z12, Newz, Z41, Iteration, Stdmid, Ratio);
-               Fractal(dc, Xmid, Ymid, X2, Y2, Newz, Z23, Z3, Z34, Iteration, Stdmid, Ratio);
-               Fractal(dc, X1, Ymid, Xmid, Y2, Z41, Newz, Z34, Z4, Iteration, Stdmid, Ratio);
-       }
-       else
-       {
-               if (Newz <= Sealevel)
-               {
-                       wxPoint P[4];
-                       P[0].x = Y1 / 2 + X1;   P[0].y = Y1 + Z1;
-                       P[1].x = Y1 / 2 + X2;   P[1].y = Y1 + Z2;
-                       P[2].x = Y2 / 2 + X2;   P[2].y = Y2 + Z3;
-                       P[3].x = Y2 / 2 + X1;   P[3].y = Y2 + Z4;
-
-                       dc.SetPen(* wxBLACK_PEN);
-                       dc.SetBrush(* wxBLACK_BRUSH);
-
-                       dc.DrawPolygon(4, P);
-
-                       if (Z1 >= -(60+Random(25)))
-                               dc.SetPen(GreenPen);
-                       else if (Z1 >= -(100+Random(25)))
-                               dc.SetPen(MtnPen);
-                       else
-                               dc.SetPen(SnowPen);
-
-                       dc.DrawLine(Ymid/2+X2, Ymid+Z23, Ymid/2+X1, Ymid+Z41);
-               }
-       }
-}
-
diff --git a/samples/fractal/fractal.def b/samples/fractal/fractal.def
deleted file mode 100644 (file)
index 822abf6..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-NAME         Fractal
-DESCRIPTION  'Fractal'
-EXETYPE      WINDOWS
-STUB         'WINSTUB.EXE'
-CODE         PRELOAD MOVEABLE DISCARDABLE
-DATA         PRELOAD MOVEABLE MULTIPLE
-HEAPSIZE     1024
-STACKSIZE    16192
-
diff --git a/samples/fractal/fractal.rc b/samples/fractal/fractal.rc
deleted file mode 100644 (file)
index e3b11b0..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-wxSTD_FRAME ICON "mondrian.ico"
-
-#include "wx/msw/wx.rc"
-
diff --git a/samples/fractal/makefile.b32 b/samples/fractal/makefile.b32
deleted file mode 100644 (file)
index 6000f39..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# File:                makefile.b32
-# Author:      Julian Smart
-# Created:     1999
-# Updated:     
-# Copyright:
-#
-# Makefile : Builds sample for 32-bit BC++
-
-WXDIR = $(WXWIN)
-
-TARGET=fractal
-OBJECTS = $(TARGET).obj
-
-!include $(WXDIR)\src\makeprog.b32
-
diff --git a/samples/fractal/makefile.bcc b/samples/fractal/makefile.bcc
deleted file mode 100644 (file)
index 6b4aacd..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# File:                makefile.bcc
-# Author:      Julian Smart
-# Created:     1998
-# Updated:     
-#
-# Builds a BC++ 16-bit sample
-
-!if "$(WXWIN)" == ""
-!error You must define the WXWIN variable in autoexec.bat, e.g. WXWIN=c:\wx
-!endif
-
-WXDIR = $(WXWIN)
-
-TARGET=fractal
-OBJECTS=$(TARGET).obj
-
-!include $(WXDIR)\src\makeprog.bcc
-
diff --git a/samples/fractal/makefile.dos b/samples/fractal/makefile.dos
deleted file mode 100644 (file)
index 9bb114e..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# File:                makefile.dos
-# Author:      Julian Smart
-# Created:     1998
-# Updated:     
-#
-# Makefile : Builds 16-bit sample, VC++ 1.5
-# Use FINAL=1 argument to nmake to build final version with no debugging
-# info
-
-WXDIR = $(WXWIN)
-
-TARGET=fractal
-OBJECTS=$(TARGET).obj
-
-!include $(WXDIR)\src\makeprog.msc
-
diff --git a/samples/fractal/makefile.g95 b/samples/fractal/makefile.g95
deleted file mode 100644 (file)
index 09d3d1f..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# File:         makefile.g95
-# Author:       Julian Smart
-# Created:      1999
-# Updated:
-# Copyright:    (c) Julian Smart, 1999
-#
-# Makefile for wxWindows sample (Cygwin/Mingw32).
-
-WXDIR = ../..
-
-TARGET=fractal
-OBJECTS = $(TARGET).o
-
-include $(WXDIR)/src/makeprog.g95
-
diff --git a/samples/fractal/makefile.unx b/samples/fractal/makefile.unx
deleted file mode 100644 (file)
index e23e9c3..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-#
-# File:                Makefile for samples
-# Author:      Robert Roebling
-# Created:     1999
-# Updated:     
-# Copyright:   (c) 1998 Robert Roebling
-#
-# This makefile requires a Unix version of wxWindows
-# to be installed on your system. This is most often
-# done typing "make install" when using the complete
-# sources of wxWindows or by installing the two
-# RPM packages wxGTK.XXX.rpm and wxGTK-devel.XXX.rpm
-# under Linux.
-#
-
-CC = gcc
-
-PROGRAM = fractal
-
-OBJECTS = $(PROGRAM).o
-
-# implementation
-
-.SUFFIXES:     .o .cpp
-
-.cpp.o :
-       $(CC) -c `wx-config --cflags` -o $@ $<
-
-all:    $(PROGRAM)
-
-$(PROGRAM):    $(OBJECTS)
-       $(CC) -o $(PROGRAM) $(OBJECTS) `wx-config --libs`
-
-clean: 
-       rm -f *.o $(PROGRAM)
diff --git a/samples/fractal/makefile.vc b/samples/fractal/makefile.vc
deleted file mode 100644 (file)
index 3023708..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# File:                makefile.vc
-# Author:      Julian Smart
-# Created:     1999
-# Updated:     
-# Copyright:   (c) Julian Smart
-#
-# Makefile : Builds sample (VC++, WIN32)
-# Use FINAL=1 argument to nmake to build final version with no debug info.
-
-# Set WXDIR for your system
-WXDIR = $(WXWIN)
-
-PROGRAM=fractal
-OBJECTS = $(PROGRAM).obj
-
-!include $(WXDIR)\src\makeprog.vc
-
diff --git a/samples/fractal/makefile.wat b/samples/fractal/makefile.wat
deleted file mode 100644 (file)
index d48fab6..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#
-# Makefile for WATCOM
-#
-# Created by Julian Smart, January 1999
-# 
-#
-
-WXDIR = $(%WXWIN)
-
-PROGRAM = fractal
-OBJECTS = $(PROGRAM).obj
-
-!include $(WXDIR)\src\makeprog.wat
-
-
diff --git a/samples/fractal/mondrian.ico b/samples/fractal/mondrian.ico
deleted file mode 100644 (file)
index 2310c5d..0000000
Binary files a/samples/fractal/mondrian.ico and /dev/null differ
diff --git a/samples/ipc/.cvsignore b/samples/ipc/.cvsignore
new file mode 100644 (file)
index 0000000..f5eaa1a
--- /dev/null
@@ -0,0 +1,2 @@
+Makefile.in
+
diff --git a/samples/ipc/client.cpp b/samples/ipc/client.cpp
new file mode 100644 (file)
index 0000000..616ef99
--- /dev/null
@@ -0,0 +1,220 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        client.cpp
+// Purpose:     DDE sample: client
+// Author:      Julian Smart
+// Modified by:
+// Created:     25/01/99
+// RCS-ID:      $Id$
+// Copyright:   (c) Julian Smart
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+
+// Settings common to both executables: determines whether
+// we're using TCP/IP or real DDE.
+
+#include "ddesetup.h"
+
+#if defined(__WXGTK__) || defined(__WXMOTIF__)
+#include "mondrian.xpm"
+#endif
+
+#include "client.h"
+
+MyFrame *frame = NULL;
+
+IMPLEMENT_APP(MyApp)
+
+char ipc_buffer[4000];
+wxListBox *the_list = NULL;
+
+MyConnection *the_connection = NULL;
+MyClient *my_client ;
+
+// The `main program' equivalent, creating the windows and returning the
+// main frame
+bool MyApp::OnInit()
+{
+  // Create the main frame window
+  frame = new MyFrame(NULL, "Client", wxPoint(400, 0), wxSize(400, 300));
+
+  // Give it an icon
+  frame->SetIcon(wxICON(mondrian));
+
+  // Make a menubar
+  wxMenu *file_menu = new wxMenu;
+
+  file_menu->Append(CLIENT_EXECUTE, "Execute");
+  file_menu->Append(CLIENT_REQUEST, "Request");
+  file_menu->Append(CLIENT_POKE, "Poke");
+  file_menu->Append(CLIENT_QUIT, "Quit");
+
+  wxMenuBar *menu_bar = new wxMenuBar;
+
+  menu_bar->Append(file_menu, "File");
+
+  // Associate the menu bar with the frame
+  frame->SetMenuBar(menu_bar);
+
+  // Make a panel
+  frame->panel = new wxPanel(frame, -1, wxPoint(0, 0), wxSize(400, 250));
+  the_list = new wxListBox(frame->panel, CLIENT_LISTBOX, wxPoint(5, 5), wxSize(150, 120));
+  the_list->Append("Apple");
+  the_list->Append("Pear");
+  the_list->Append("Orange");
+  the_list->Append("Banana");
+  the_list->Append("Fruit");
+
+  frame->panel->Fit();
+  frame->Fit();
+
+  wxString server = "4242";
+
+#if wxUSE_DDE_FOR_SAMPLE
+  wxString hostName = wxGetHostName();
+#else
+  wxString hostName = "localhost";
+#endif
+
+  if (argc > 1)
+    server = argv[1];
+  if (argc > 2)
+    hostName = argv[2];
+
+  // Create a new client
+  my_client = new MyClient;
+  the_connection = (MyConnection *)my_client->MakeConnection(hostName, server, "IPC TEST");
+
+  if (!the_connection)
+  {
+    wxMessageBox("Failed to make connection to server", "Client Demo Error");
+#ifdef __WXMSW__
+//    extern void wxPrintDDEError();
+//    wxPrintDDEError();
+#endif
+    return FALSE;
+  }
+  if (!the_connection->StartAdvise("Item"))
+    wxMessageBox("StartAdvise failed", "Client Demo Error");
+
+  frame->Show(TRUE);
+
+  return TRUE;
+}
+
+int MyApp::OnExit()
+{
+    if (my_client)
+      delete my_client ;
+
+    return 0;
+}
+
+BEGIN_EVENT_TABLE(MyFrame, wxFrame)
+    EVT_MENU(CLIENT_QUIT, MyFrame::OnExit)
+    EVT_MENU(CLIENT_EXECUTE, MyFrame::OnExecute)
+    EVT_MENU(CLIENT_POKE, MyFrame::OnPoke)
+    EVT_MENU(CLIENT_REQUEST, MyFrame::OnRequest)
+    EVT_CLOSE(MyFrame::OnCloseWindow)
+END_EVENT_TABLE()
+
+// Define my frame constructor
+MyFrame::MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size):
+  wxFrame(frame, -1, title, pos, size)
+{
+    panel = NULL;
+}
+
+void MyFrame::OnExecute(wxCommandEvent& event)
+{
+      if (the_connection)
+        if (!the_connection->Execute("Hello from the client!"))
+          wxMessageBox("Execute failed", "Client Demo Error");
+}
+
+void MyFrame::OnPoke(wxCommandEvent& event)
+{
+      if (the_connection)
+        if (!the_connection->Poke("An item", "Some data to poke at the server!"))
+          wxMessageBox("Poke failed", "Client Demo Error");
+}
+
+void MyFrame::OnRequest(wxCommandEvent& event)
+{
+      if (the_connection)
+      {
+        char *data = the_connection->Request("An item");
+        if (data)
+          wxMessageBox(data, "Client: Request", wxOK);
+        else
+          wxMessageBox("Request failed", "Client Demo Error");
+      }
+}
+
+void MyFrame::OnExit(wxCommandEvent& event)
+{
+  if (the_connection)
+    the_connection->Disconnect();
+
+  this->Destroy();
+}
+
+// Define the behaviour for the frame closing
+void MyFrame::OnCloseWindow(wxCloseEvent& event)
+{
+  if (the_connection)
+  {
+    the_connection->Disconnect();
+  }
+  this->Destroy();
+}
+
+MyClient::MyClient(void)
+{
+}
+
+wxConnectionBase *MyClient::OnMakeConnection(void)
+{
+  return new MyConnection;
+}
+
+MyConnection::MyConnection(void):wxConnection(ipc_buffer, 3999)
+{
+}
+
+MyConnection::~MyConnection(void)
+{
+  the_connection = NULL;
+}
+
+bool MyConnection::OnAdvise(const wxString& topic, const wxString& item, char *data, int size, wxIPCFormat format)
+{
+  if (the_list)
+  {
+    int n = the_list->FindString(data);
+    if (n > -1)
+      the_list->SetSelection(n);
+  }
+  return TRUE;
+}
+
+bool MyConnection::OnDisconnect()
+{
+    frame->Destroy();
+
+    the_connection = NULL;
+    delete this;
+
+    return TRUE;
+}
+
diff --git a/samples/ipc/client.def b/samples/ipc/client.def
new file mode 100644 (file)
index 0000000..786b7d6
--- /dev/null
@@ -0,0 +1,8 @@
+NAME         Client
+DESCRIPTION  'Client'
+EXETYPE      WINDOWS
+STUB         'WINSTUB.EXE'
+CODE         PRELOAD MOVEABLE DISCARDABLE
+DATA         PRELOAD MOVEABLE MULTIPLE
+HEAPSIZE     1024
+STACKSIZE    8192
diff --git a/samples/ipc/client.g95 b/samples/ipc/client.g95
new file mode 100644 (file)
index 0000000..260c61c
--- /dev/null
@@ -0,0 +1,16 @@
+#
+# File:         makefile.g95
+# Author:       Julian Smart
+# Created:      1999
+# Updated:
+# Copyright:    (c) Julian Smart, 1999
+#
+# Makefile for wxWindows sample (Cygwin/Mingw32).
+
+WXDIR = ../..
+
+TARGET=client
+OBJECTS = $(TARGET).o
+
+include $(WXDIR)/src/makeprog.g95
+
diff --git a/samples/ipc/client.h b/samples/ipc/client.h
new file mode 100644 (file)
index 0000000..8017a29
--- /dev/null
@@ -0,0 +1,55 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        client.h
+// Purpose:     DDE sample: client
+// Author:      Julian Smart
+// Modified by:
+// Created:     25/01/99
+// RCS-ID:      $Id$
+// Copyright:   (c) Julian Smart
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// Define a new application
+class MyApp: public wxApp
+{
+  public:
+    bool OnInit();
+    int OnExit();
+};
+
+// Define a new frame
+class MyFrame: public wxFrame
+{
+  public:
+    wxPanel *panel;
+
+    MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size);
+    void OnCloseWindow(wxCloseEvent& event);
+    void OnExit(wxCommandEvent& event);
+    void OnExecute(wxCommandEvent& event);
+    void OnPoke(wxCommandEvent& event);
+    void OnRequest(wxCommandEvent& event);
+DECLARE_EVENT_TABLE()
+};
+
+class MyConnection: public wxConnection
+{
+ public:
+  MyConnection();
+  ~MyConnection();
+  bool OnAdvise(const wxString& topic, const wxString& item, char *data, int size, wxIPCFormat format);
+  bool OnDisconnect();
+};
+
+class MyClient: public wxClient
+{
+ public:
+  MyClient();
+  wxConnectionBase *OnMakeConnection();
+};
+
+#define CLIENT_QUIT     wxID_EXIT
+#define CLIENT_EXECUTE  2
+#define CLIENT_REQUEST  3
+#define CLIENT_POKE     4
+#define CLIENT_LISTBOX  200
diff --git a/samples/ipc/client.rc b/samples/ipc/client.rc
new file mode 100644 (file)
index 0000000..74b8e3f
--- /dev/null
@@ -0,0 +1,2 @@
+mondrian ICON "mondrian.ico"
+#include "wx/msw/wx.rc"
diff --git a/samples/ipc/client.vc b/samples/ipc/client.vc
new file mode 100644 (file)
index 0000000..f525240
--- /dev/null
@@ -0,0 +1,20 @@
+#
+# File:                makefile.vc
+# Author:      Julian Smart
+# Created:     1999
+# Updated:     
+# Copyright:   (c) Julian Smart
+#
+# Makefile : Builds sample (VC++, WIN32)
+# Use FINAL=1 argument to nmake to build final version with no debug info.
+
+# Set WXDIR for your system
+WXDIR = $(WXWIN)
+
+PROGRAM=client
+OBJECTS = $(PROGRAM).obj
+
+!include $(WXDIR)\src\makeprog.vc
+
+client.obj: ddesetup.h
+
diff --git a/samples/ipc/client.wat b/samples/ipc/client.wat
new file mode 100644 (file)
index 0000000..789db64
--- /dev/null
@@ -0,0 +1,15 @@
+#
+# Makefile for WATCOM
+#
+# Created by Julian Smart, January 1999
+# 
+#
+
+WXDIR = $(%WXWIN)
+
+PROGRAM = client
+OBJECTS = $(PROGRAM).obj
+
+!include $(WXDIR)\src\makeprog.wat
+
+
diff --git a/samples/ipc/ddesetup.h b/samples/ipc/ddesetup.h
new file mode 100644 (file)
index 0000000..caf3839
--- /dev/null
@@ -0,0 +1,42 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        ddesetup.h
+// Purpose:     DDE sample settings
+// Author:      Julian Smart
+// Modified by:
+// Created:     25/01/99
+// RCS-ID:      $Id$
+// Copyright:   (c) Julian Smart
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+/*
+ * Adjust this before compiling, to switch between real DDE and TCP/IP
+ * implementations.
+ */
+
+// If 1, use real DDE. If 0, use TCP/IP
+
+#ifdef __WXMSW__
+#define wxUSE_DDE_FOR_SAMPLE 1
+#else
+#define wxUSE_DDE_FOR_SAMPLE 0
+#endif
+
+#if wxUSE_DDE_FOR_SAMPLE
+
+#define wxConnection    wxDDEConnection
+#define wxServer        wxDDEServer
+#define wxClient        wxDDEClient
+
+#include <wx/dde.h>
+
+#else
+
+#define wxConnection    wxTCPConnection
+#define wxServer        wxTCPServer
+#define wxClient        wxTCPClient
+
+#include <wx/sckipc.h>
+
+#endif
+
diff --git a/samples/ipc/makefile.b32 b/samples/ipc/makefile.b32
new file mode 100644 (file)
index 0000000..94a0ed2
--- /dev/null
@@ -0,0 +1,82 @@
+#
+# File:                makefile.b32
+# Author:      Guilhem Lavaux
+# Created:     1998
+# Updated:     
+# Copyright:   (c) Guilhem Lavaux
+#
+# "%W% %G%"
+#
+# Makefile : Builds 32-bit wxSocket sample under BC++
+
+WXDIR = $(WXWIN)
+
+ZLIB = $(WXDIR)\lib\zlib.lib
+
+!include $(WXDIR)\src\makeb32.env
+
+WXLIBDIR = $(WXDIR)\lib
+WXINC = $(WXDIR)\include\msw
+WXLIB = $(WXLIBDIR)\wx32.lib
+LIBS=$(WXLIB) $(ZLIB) cw32 import32 ole2w32
+
+!if "$(FINAL)" == "0"
+LINKFLAGS=/v /Tpe /L$(WXLIBDIR);$(BCCDIR)\lib
+OPT = -Od
+DEBUG_FLAGS= -v
+!else
+LINKFLAGS=/Tpe /L$(WXLIBDIR);$(BCCDIR)\lib
+OPT = -Od
+DEBUG_FLAGS =
+!endif
+CPPFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG)
+
+.$(SRCSUFF).obj:
+       bcc32 $(CPPFLAGS) -c {$< }
+
+.c.obj:
+       bcc32 $(CPPFLAGS) -P- -c {$< }
+
+CLIENT_TARGET=client
+SERVER_TARGET=server
+CLIENT_OBJECTS=client.obj
+SERVER_OBJECTS=server.obj
+
+all:    $(CLIENT_TARGET).exe $(SERVER_TARGET).exe
+
+$(CLIENT_TARGET).exe:   $(CLIENT_OBJECTS) $(CLIENT_TARGET).res
+  tlink32 $(LINKFLAGS) @&&!
+  c0w32.obj $(CLIENT_OBJECTS)
+  $(CLIENT_TARGET)
+  nul
+  $(LIBS)
+  $(CLIENT_TARGET).def
+  $(CLIENT_TARGET).res
+!
+
+client.obj:     client.cpp
+
+$(CLIENT_TARGET).res :      $(CLIENT_TARGET).rc $(WXDIR)\include\wx\msw\wx.rc
+    brc32 -r /i$(BCCDIR)\include /i$(WXDIR)\include $(CLIENT_TARGET)
+
+$(SERVER_TARGET).exe:   $(SERVER_OBJECTS) $(SERVER_TARGET).res
+  tlink32 $(LINKFLAGS) @&&!
+  c0w32.obj $(SERVER_OBJECTS)
+  $(SERVER_TARGET)
+  nul
+  $(LIBS)
+  $(SERVER_TARGET).def
+  $(SERVER_TARGET).res
+!
+
+server.obj:     server.cpp
+
+$(SERVER_TARGET).res:   $(SERVER_TARGET).rc $(WXDIR)\include\wx\msw\wx.rc
+    brc32 -r /i$(BCCDIR)\include /i$(WXDIR)\include $(SERVER_TARGET)
+
+clean:
+        -erase *.obj
+        -erase *.exe
+        -erase *.res
+        -erase *.map
+        -erase *.rws
diff --git a/samples/ipc/makefile.dos b/samples/ipc/makefile.dos
new file mode 100644 (file)
index 0000000..2a42833
--- /dev/null
@@ -0,0 +1,19 @@
+#
+# File:                makefile.dos
+# Author:      Julian Smart
+# Created:     1998
+# Updated:     
+#
+# Makefile : Builds 16-bit sample, VC++ 1.5
+# Use FINAL=1 argument to nmake to build final version with no debugging
+# info
+
+WXDIR = $(WXWIN)
+
+TARGET=client
+OBJECTS = $(TARGET).obj
+
+# TODO: server
+
+!include $(WXDIR)\src\makeprog.msc
+
diff --git a/samples/ipc/makefile.g95 b/samples/ipc/makefile.g95
new file mode 100644 (file)
index 0000000..40343dd
--- /dev/null
@@ -0,0 +1,19 @@
+#
+# File:                makefile.g95
+# Author:      Julian Smart
+# Created:     1993
+# Updated:     
+# Copyright:   (c) 1993, AIAI, University of Edinburgh
+#
+# "%W% %G%"
+#
+# Makefile for server/client example (UNIX).
+
+all:
+       make -f client.g95 all
+       make -f server.g95 all
+
+clean:
+       make -f client.g95 clean
+       make -f server.g95 clean
+
diff --git a/samples/ipc/makefile.vc b/samples/ipc/makefile.vc
new file mode 100644 (file)
index 0000000..3864d7d
--- /dev/null
@@ -0,0 +1,20 @@
+#
+# File:                makefile.vc
+# Author:      Julian Smart
+# Created:     1999
+# Updated:     
+# Copyright:   (c) Julian Smart
+#
+# Makefile : Builds sample (VC++, WIN32)
+# Use FINAL=1 argument to nmake to build final version with no debug info.
+
+!include $(WXWIN)/src/makevc.env
+
+all:
+    nmake -f server.vc FINAL=$(FINAL)
+    nmake -f client.vc FINAL=$(FINAL)
+
+clean:
+    nmake -f server.vc clean
+    nmake -f client.vc clean
+
diff --git a/samples/ipc/mondrian.ico b/samples/ipc/mondrian.ico
new file mode 100644 (file)
index 0000000..2310c5d
Binary files /dev/null and b/samples/ipc/mondrian.ico differ
diff --git a/samples/ipc/mondrian.xpm b/samples/ipc/mondrian.xpm
new file mode 100644 (file)
index 0000000..409f27a
--- /dev/null
@@ -0,0 +1,44 @@
+/* XPM */
+static char *mondrian_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"32 32 6 1",
+"  c Black",
+". c Blue",
+"X c #00bf00",
+"o c Red",
+"O c Yellow",
+"+ c Gray100",
+/* pixels */
+"                                ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+"                                ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++      ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++                    ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+"                                "
+};
diff --git a/samples/ipc/server.cpp b/samples/ipc/server.cpp
new file mode 100644 (file)
index 0000000..3dfb365
--- /dev/null
@@ -0,0 +1,198 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        server.cpp
+// Purpose:     DDE sample: server
+// Author:      Julian Smart
+// Modified by:
+// Created:     25/01/99
+// RCS-ID:      $Id$
+// Copyright:   (c) Julian Smart
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+
+// Settings common to both executables: determines whether
+// we're using TCP/IP or real DDE.
+
+#include "ddesetup.h"
+
+#if defined(__WXGTK__) || defined(__WXMOTIF__)
+#include "mondrian.xpm"
+#endif
+
+#include "server.h"
+
+MyFrame *frame = NULL;
+
+IMPLEMENT_APP(MyApp)
+
+char ipc_buffer[4000];
+MyConnection *the_connection = NULL;
+MyServer *my_server ;
+
+bool MyApp::OnInit()
+{
+  // Create the main frame window
+  frame = new MyFrame(NULL, "Server", wxDefaultPosition, wxSize(400, 500));
+
+  frame->CreateStatusBar();
+
+  // Give it an icon
+  frame->SetIcon(wxICON(mondrian));
+
+  // Make a menubar
+  wxMenu *file_menu = new wxMenu;
+
+  file_menu->Append(SERVER_QUIT, "&Exit");
+
+  wxMenuBar *menu_bar = new wxMenuBar;
+
+  menu_bar->Append(file_menu, "&File");
+
+  // Associate the menu bar with the frame
+  frame->SetMenuBar(menu_bar);
+
+  // Make a panel
+  frame->panel = new wxPanel(frame, 0, 0, 400, 250);
+  wxListBox *list = new wxListBox(frame->panel, SERVER_LISTBOX,
+                                  wxPoint(5, 5), wxSize(150, 120));
+  list->Append("Apple");
+  list->Append("Pear");
+  list->Append("Orange");
+  list->Append("Banana");
+  list->Append("Fruit");
+
+  frame->panel->Fit();
+  frame->Fit();
+
+  wxString server_name = "4242";
+  if (argc > 1)
+    server_name = argv[1];
+
+  // Create a new server
+  my_server = new MyServer;
+  my_server->Create(server_name);
+  frame->Show(TRUE);
+
+  return TRUE;
+}
+
+BEGIN_EVENT_TABLE(MyFrame, wxFrame)
+    EVT_MENU(SERVER_QUIT, MyFrame::OnExit)
+    EVT_CLOSE(MyFrame::OnCloseWindow)
+    EVT_LISTBOX(SERVER_LISTBOX, MyFrame::OnListBoxClick)
+END_EVENT_TABLE()
+
+// Define my frame constructor
+MyFrame::MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size):
+  wxFrame(frame, -1, title, pos, size)
+{
+  panel = NULL;
+}
+
+void MyFrame::OnExit(wxCommandEvent& event)
+{
+    if (my_server)
+        delete my_server;
+    this->Destroy();
+}
+
+// Set the client process's listbox to this item
+void MyFrame::OnListBoxClick(wxCommandEvent& event)
+{
+    wxListBox* listBox = (wxListBox*) panel->FindWindow(SERVER_LISTBOX);
+    if (listBox)
+    {
+        wxString value = listBox->GetStringSelection();
+        if (the_connection)
+        {
+            the_connection->Advise("Item", (char*) (const char*) value);
+        }
+    }
+}
+
+void MyFrame::OnCloseWindow(wxCloseEvent& event)
+{
+    if (my_server)
+        delete my_server;
+    this->Destroy();
+}
+
+BEGIN_EVENT_TABLE(IPCDialogBox, wxDialog)
+    EVT_BUTTON(SERVER_QUIT_BUTTON, IPCDialogBox::OnQuit)
+END_EVENT_TABLE()
+
+IPCDialogBox::IPCDialogBox(wxFrame *parent, const wxString& title,
+                         const wxPoint& pos, const wxSize& size, MyConnection *the_connection):
+                     wxDialog(parent, -1, title, pos, size)
+{
+  connection = the_connection;
+  (void)new wxButton(this, SERVER_QUIT_BUTTON, "Quit this connection", wxPoint(5, 5));
+  Fit();
+}
+
+void IPCDialogBox::OnQuit(wxCommandEvent& event)
+{
+  connection->Disconnect();
+  delete connection;
+}
+
+wxConnectionBase *MyServer::OnAcceptConnection(const wxString& topic)
+{
+  if (strcmp(topic, "STDIO") != 0 && strcmp(topic, "IPC TEST") == 0)
+    return new MyConnection(ipc_buffer, 4000);
+  else
+    return NULL;
+}
+
+MyConnection::MyConnection(char *buf, int size):wxConnection(buf, size)
+{
+  dialog = new IPCDialogBox(frame, "Connection", wxPoint(100, 100), wxSize(500, 500), this);
+  dialog->Show(TRUE);
+  the_connection = this;
+}
+
+MyConnection::~MyConnection(void)
+{
+  if (the_connection)
+  {
+    dialog->Destroy();
+    the_connection = NULL;
+  }
+}
+
+bool MyConnection::OnExecute(const wxString& topic, char *data, int size, wxIPCFormat format)
+{
+  char buf[300];
+  sprintf(buf, "Execute command: %s", data);
+  frame->SetStatusText(buf);
+  return TRUE;
+}
+
+bool MyConnection::OnPoke(const wxString& topic, const wxString& item, char *data, int size, wxIPCFormat format)
+{
+  char buf[300];
+  sprintf(buf, "Poke command: %s", data);
+  frame->SetStatusText(buf);
+  return TRUE;
+}
+
+char *MyConnection::OnRequest(const wxString& topic, const wxString& item, int *size, wxIPCFormat format)
+{
+  return "Here, have your data, client!";
+}
+
+bool MyConnection::OnStartAdvise(const wxString& topic, const wxString& item)
+{
+  return TRUE;
+}
+
diff --git a/samples/ipc/server.def b/samples/ipc/server.def
new file mode 100644 (file)
index 0000000..21027a5
--- /dev/null
@@ -0,0 +1,8 @@
+NAME         Server
+DESCRIPTION  'Server'
+EXETYPE      WINDOWS
+STUB         'WINSTUB.EXE'
+CODE         PRELOAD MOVEABLE DISCARDABLE
+DATA         PRELOAD MOVEABLE MULTIPLE
+HEAPSIZE     4096
+STACKSIZE    8192
diff --git a/samples/ipc/server.g95 b/samples/ipc/server.g95
new file mode 100644 (file)
index 0000000..48e622c
--- /dev/null
@@ -0,0 +1,16 @@
+#
+# File:         makefile.g95
+# Author:       Julian Smart
+# Created:      1999
+# Updated:
+# Copyright:    (c) Julian Smart, 1999
+#
+# Makefile for wxWindows sample (Cygwin/Mingw32).
+
+WXDIR = ../..
+
+TARGET=server
+OBJECTS = $(TARGET).o
+
+include $(WXDIR)/src/makeprog.g95
+
diff --git a/samples/ipc/server.h b/samples/ipc/server.h
new file mode 100644 (file)
index 0000000..81aa316
--- /dev/null
@@ -0,0 +1,70 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        server.h
+// Purpose:     DDE sample: server
+// Author:      Julian Smart
+// Modified by:
+// Created:     25/01/99
+// RCS-ID:      $Id$
+// Copyright:   (c) Julian Smart
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// Define a new application
+class MyApp: public wxApp
+{
+  public:
+    bool OnInit();
+};
+
+DECLARE_APP(MyApp)
+
+// Define a new frame
+class MyFrame: public wxFrame
+{
+  public:
+    wxPanel *panel;
+
+    MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size);
+
+    void OnCloseWindow(wxCloseEvent& event);
+    void OnExit(wxCommandEvent& event);
+    void OnListBoxClick(wxCommandEvent& event);
+DECLARE_EVENT_TABLE()
+};
+
+class IPCDialogBox;
+class MyConnection: public wxConnection
+{
+ public:
+  IPCDialogBox *dialog;
+
+  MyConnection(char *buf, int size);
+  ~MyConnection();
+
+  bool OnExecute(const wxString& topic, char *data, int size, wxIPCFormat format);
+  char *OnRequest(const wxString& topic, const wxString& item, int *size, wxIPCFormat format);
+  bool OnPoke(const wxString& topic, const wxString& item, char *data, int size, wxIPCFormat format);
+  bool OnStartAdvise(const wxString& topic, const wxString& item);
+};
+
+class MyServer: public wxServer
+{
+public:
+    wxConnectionBase *OnAcceptConnection(const wxString& topic);
+};
+
+class IPCDialogBox: public wxDialog
+{
+public:
+    MyConnection *connection;
+    IPCDialogBox(wxFrame *parent, const wxString& title,
+                         const wxPoint& pos, const wxSize& size, MyConnection *the_connection);
+
+    void OnQuit(wxCommandEvent& event);
+
+DECLARE_EVENT_TABLE()
+};
+
+#define SERVER_QUIT         wxID_EXIT
+#define SERVER_LISTBOX      500
+#define SERVER_QUIT_BUTTON  501
diff --git a/samples/ipc/server.rc b/samples/ipc/server.rc
new file mode 100644 (file)
index 0000000..7655c62
--- /dev/null
@@ -0,0 +1,3 @@
+mondrian ICON "mondrian.ico"
+#include "wx/msw/wx.rc"
+
diff --git a/samples/ipc/server.vc b/samples/ipc/server.vc
new file mode 100644 (file)
index 0000000..6167edf
--- /dev/null
@@ -0,0 +1,20 @@
+#
+# File:                makefile.vc
+# Author:      Julian Smart
+# Created:     1999
+# Updated:     
+# Copyright:   (c) Julian Smart
+#
+# Makefile : Builds sample (VC++, WIN32)
+# Use FINAL=1 argument to nmake to build final version with no debug info.
+
+# Set WXDIR for your system
+WXDIR = $(WXWIN)
+
+PROGRAM=server
+OBJECTS = $(PROGRAM).obj
+
+!include $(WXDIR)\src\makeprog.vc
+
+server.obj: ddesetup.h
+
diff --git a/samples/ipc/server.wat b/samples/ipc/server.wat
new file mode 100644 (file)
index 0000000..2acfdf1
--- /dev/null
@@ -0,0 +1,15 @@
+#
+# Makefile for WATCOM
+#
+# Created by Julian Smart, January 1999
+# 
+#
+
+WXDIR = $(%WXWIN)
+
+PROGRAM = server
+OBJECTS = $(PROGRAM).obj
+
+!include $(WXDIR)\src\makeprog.wat
+
+
diff --git a/samples/life/Makefile.in b/samples/life/Makefile.in
deleted file mode 100644 (file)
index 5e9184b..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-# File:                makefile.unx
-# Author:      Julian Smart
-# Created:     1998
-# Updated:     
-# Copyright:   (c) 1998 Julian Smart
-#
-# "%W% %G%"
-#
-# Makefile for toolbar example (UNIX).
-
-top_srcdir = @top_srcdir@
-top_builddir = ../..
-program_dir = samples/life
-
-PROGRAM=life
-
-OBJECTS=$(PROGRAM).o
-
-include ../../src/makeprog.env
-
-
diff --git a/samples/life/bitmaps/play.bmp b/samples/life/bitmaps/play.bmp
deleted file mode 100644 (file)
index 41f9449..0000000
Binary files a/samples/life/bitmaps/play.bmp and /dev/null differ
diff --git a/samples/life/bitmaps/play.xpm b/samples/life/bitmaps/play.xpm
deleted file mode 100644 (file)
index 26d6d51..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/* XPM */\r
-static char *play_xpm[] = {\r
-/* columns rows colors chars-per-pixel */\r
-"16 16 2 1",\r
-"  c None",\r
-". c Black",\r
-/* pixels */\r
-"                ",\r
-"                ",\r
-"                ",\r
-"    .           ",\r
-"    ...         ",\r
-"    .....       ",\r
-"    .......     ",\r
-"    .........   ",\r
-"    .......     ",\r
-"    .....       ",\r
-"    ...         ",\r
-"    .           ",\r
-"                ",\r
-"                ",\r
-"                "\r
-};\r
diff --git a/samples/life/bitmaps/reset.bmp b/samples/life/bitmaps/reset.bmp
deleted file mode 100644 (file)
index 41ea143..0000000
Binary files a/samples/life/bitmaps/reset.bmp and /dev/null differ
diff --git a/samples/life/bitmaps/reset.xpm b/samples/life/bitmaps/reset.xpm
deleted file mode 100644 (file)
index b9ebd02..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/* XPM */\r
-static char *reset_xpm[] = {\r
-/* columns rows colors chars-per-pixel */\r
-"16 16 2 1",\r
-"  c None",\r
-". c Black",\r
-/* pixels */\r
-"                ",\r
-"                ",\r
-"                ",\r
-"   ..      ..   ",\r
-"   ...    ...   ",\r
-"    ...  ...    ",\r
-"     ......     ",\r
-"      ....      ",\r
-"      ....      ",\r
-"     ......     ",\r
-"    ...  ...    ",\r
-"   ...    ...   ",\r
-"   ..      ..   ",\r
-"                ",\r
-"                ",\r
-"                "\r
-};\r
diff --git a/samples/life/bitmaps/stop.bmp b/samples/life/bitmaps/stop.bmp
deleted file mode 100644 (file)
index a0941ea..0000000
Binary files a/samples/life/bitmaps/stop.bmp and /dev/null differ
diff --git a/samples/life/bitmaps/stop.xpm b/samples/life/bitmaps/stop.xpm
deleted file mode 100644 (file)
index cf7fd0b..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/* XPM */\r
-static char *stop_xpm[] = {\r
-/* columns rows colors chars-per-pixel */\r
-"16 16 2 1",\r
-"  c None",\r
-". c Black",\r
-/* pixels */\r
-"                ",\r
-"                ",\r
-"                ",\r
-"    ........    ",\r
-"    ........    ",\r
-"    ........    ",\r
-"    ........    ",\r
-"    ........    ",\r
-"    ........    ",\r
-"    ........    ",\r
-"    ........    ",\r
-"    ........    ",\r
-"                ",\r
-"                ",\r
-"                ",\r
-"                "\r
-};\r
diff --git a/samples/life/life.cpp b/samples/life/life.cpp
deleted file mode 100644 (file)
index e14ab1b..0000000
+++ /dev/null
@@ -1,1182 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name:        life.cpp
-// Purpose:     The game of life, created by J. H. Conway
-// Author:      Guillermo Rodriguez Garcia, <guille@iies.es>
-// Modified by:
-// Created:     Jan/2000
-// RCS-ID:      $Id$
-// Copyright:   (c) 2000, Guillermo Rodriguez Garcia
-// Licence:     wxWindows licence
-/////////////////////////////////////////////////////////////////////////////
-
-// ==========================================================================
-// declarations
-// ==========================================================================
-
-// minimum and maximum table size, in each dimension
-#define LIFE_MIN 20
-#define LIFE_MAX 200
-
-// some shortcuts
-#define ADD_TOOL(a, b, c, d) \
-    toolBar->AddTool(a, b, wxNullBitmap, FALSE, -1, -1, (wxObject *)0, c, d)
-
-#define GET_FRAME() \
-    ((LifeFrame *) wxGetApp().GetTopWindow())
-
-// --------------------------------------------------------------------------
-// headers
-// --------------------------------------------------------------------------
-
-#ifdef __GNUG__
-    #pragma implementation "life.cpp"
-    #pragma interface "life.cpp"
-#endif
-
-// for compilers that support precompilation, includes "wx/wx.h".
-#include "wx/wxprec.h"
-
-#ifdef __BORLANDC__
-    #pragma hdrstop
-#endif
-
-// for all others, include the necessary headers
-#ifndef WX_PRECOMP
-    #include "wx/wx.h"
-#endif
-
-#include "wx/statline.h"
-#include "wx/spinctrl.h"
-
-// --------------------------------------------------------------------------
-// resources
-// --------------------------------------------------------------------------
-
-#if defined(__WXGTK__) || defined(__WXMOTIF__)
-    // the application icon
-    #include "mondrian.xpm"
-
-    // bitmap buttons for the toolbar
-    #include "bitmaps/reset.xpm"
-    #include "bitmaps/play.xpm"
-    #include "bitmaps/stop.xpm"
-#endif
-
-// --------------------------------------------------------------------------
-// classes
-// --------------------------------------------------------------------------
-
-class Life;
-class LifeShape;
-class LifeCanvas;
-class LifeTimer;
-class LifeFrame;
-class LifeApp;
-class LifeNewGameDialog;
-class LifeSamplesDialog;
-
-// --------------------------------------------------------------------------
-// non-GUI classes
-// --------------------------------------------------------------------------
-
-// Life
-class Life
-{
-public:
-    // ctors and dtors
-    Life(int width, int height);
-    ~Life();
-    void Create(int width, int height);
-    void Destroy();
-
-    // accessors
-    inline int  GetWidth()  const { return m_width; };
-    inline int  GetHeight() const { return m_height; };
-    inline bool IsAlive(int x, int y) const;
-    inline bool HasChanged(int x, int y) const;
-
-    // flags
-    void SetBorderWrap(bool on);
-
-    // game logic
-    void Clear();
-    void SetCell(int x, int y, bool alive = TRUE);
-    void SetShape(LifeShape &shape);
-    bool NextTic();
-
-private:
-    enum CellFlags {
-        CELL_DEAD    = 0x0000,  // is dead
-        CELL_ALIVE   = 0x0001,  // is alive
-        CELL_MARK    = 0x0002,  // will change / has changed
-    };
-    typedef int Cell;
-
-    int GetNeighbors(int x, int y) const;
-    inline void SetCell(int x, int y, Cell status);
-
-    int   m_width;
-    int   m_height;
-    Cell *m_cells;
-    bool  m_wrap;
-};
-
-// LifeShape
-class LifeShape
-{
-public:
-    LifeShape::LifeShape(wxString name,
-                         wxString desc,
-                         int width, int height, char *data,
-                         int fieldWidth = 20, int fieldHeight = 20,
-                         bool wrap = TRUE)
-    {
-        m_name        = name;
-        m_desc        = desc;
-        m_width       = width;
-        m_height      = height;
-        m_data        = data;
-        m_fieldWidth  = fieldWidth;
-        m_fieldHeight = fieldHeight;
-        m_wrap        = wrap;
-    }
-
-    wxString  m_name;
-    wxString  m_desc;
-    int       m_width;
-    int       m_height;
-    char     *m_data;
-    int       m_fieldWidth;
-    int       m_fieldHeight;
-    bool      m_wrap;
-};
-
-// --------------------------------------------------------------------------
-// GUI classes
-// --------------------------------------------------------------------------
-
-// Life canvas
-class LifeCanvas : public wxScrolledWindow
-{
-public:
-    // ctor and dtor
-    LifeCanvas(wxWindow* parent, Life* life, bool interactive = TRUE);
-    ~LifeCanvas();
-
-    // member functions
-    void Reset();
-    void DrawEverything(bool force = FALSE);
-    void DrawCell(int i, int j);
-    void DrawCell(int i, int j, wxDC &dc);
-    inline int CellToCoord(int i) const { return (i * m_cellsize); };
-    inline int CoordToCell(int x) const { return ((x >= 0)? (x / m_cellsize) : -1); };
-
-    // event handlers
-    void OnPaint(wxPaintEvent& event);
-    void OnMouse(wxMouseEvent& event);
-    void OnSize(wxSizeEvent& event);
-
-private:
-    // any class wishing to process wxWindows events must use this macro
-    DECLARE_EVENT_TABLE()
-
-    enum MouseStatus {
-        MOUSE_NOACTION,
-        MOUSE_DRAWING,
-        MOUSE_ERASING
-    };
-
-    Life        *m_life;
-    wxBitmap    *m_bmp;
-    int          m_height;
-    int          m_width;
-    int          m_cellsize;
-    wxCoord      m_xoffset;
-    wxCoord      m_yoffset;
-    MouseStatus  m_status;
-    bool         m_interactive;
-};
-
-// Life timer
-class LifeTimer : public wxTimer
-{
-public:
-    void Notify();
-};
-
-// Life main frame
-class LifeFrame : public wxFrame
-{
-public:
-    // ctor and dtor
-    LifeFrame();
-    ~LifeFrame();
-
-    // member functions
-    void UpdateInfoText();
-
-    // event handlers
-    void OnMenu(wxCommandEvent& event);
-    void OnNewGame(wxCommandEvent& event);
-    void OnSamples(wxCommandEvent& event);
-    void OnStart();
-    void OnStop();
-    void OnTimer();
-    void OnSlider(wxScrollEvent& event);
-
-private:
-    // any class wishing to process wxWindows events must use this macro
-    DECLARE_EVENT_TABLE()
-
-    Life         *m_life;
-    LifeTimer    *m_timer;
-    LifeCanvas   *m_canvas;
-    wxStaticText *m_text;
-    bool          m_running;
-    long          m_interval;
-    long          m_tics;
-};
-
-// Life new game dialog
-class LifeNewGameDialog : public wxDialog
-{
-public:
-    // ctor
-    LifeNewGameDialog(wxWindow *parent, int *w, int *h);
-
-    // event handlers
-    void OnOK(wxCommandEvent& event);
-
-private:
-    // any class wishing to process wxWindows events must use this macro
-    DECLARE_EVENT_TABLE();
-
-    int        *m_w;
-    int        *m_h;
-    wxSpinCtrl *m_spinctrlw;
-    wxSpinCtrl *m_spinctrlh;
-};
-
-// Life sample configurations dialog
-class LifeSamplesDialog : public wxDialog
-{
-public:
-    // ctor and dtor
-    LifeSamplesDialog(wxWindow *parent);
-    ~LifeSamplesDialog();
-
-    // members
-    int GetValue();
-
-    // event handlers
-    void OnListBox(wxCommandEvent &event);
-
-private:
-    // any class wishing to process wxWindows events must use this macro
-    DECLARE_EVENT_TABLE();
-
-    int         m_value;
-    wxListBox  *m_list;
-    wxTextCtrl *m_text;
-    LifeCanvas *m_canvas;
-    Life       *m_life;
-};
-
-// Life app
-class LifeApp : public wxApp
-{
-public:
-    virtual bool OnInit();
-};
-
-// --------------------------------------------------------------------------
-// constants
-// --------------------------------------------------------------------------
-
-// IDs for the controls and the menu commands
-enum
-{
-    // menu items and toolbar buttons
-    ID_NEWGAME = 1001,
-    ID_SAMPLES,
-    ID_ABOUT,
-    ID_EXIT,
-    ID_CLEAR,
-    ID_START,
-    ID_STEP,
-    ID_STOP,
-    ID_WRAP,
-
-    // speed selection slider
-    ID_SLIDER,
-
-    // listbox in samples dialog
-    ID_LISTBOX
-};
-
-
-// built-in sample games
-#include "samples.inc"
-
-// --------------------------------------------------------------------------
-// event tables and other macros for wxWindows
-// --------------------------------------------------------------------------
-
-// Event tables
-BEGIN_EVENT_TABLE(LifeFrame, wxFrame)
-    EVT_MENU           (ID_NEWGAME, LifeFrame::OnNewGame)
-    EVT_MENU           (ID_SAMPLES, LifeFrame::OnSamples)
-    EVT_MENU           (ID_ABOUT,   LifeFrame::OnMenu)
-    EVT_MENU           (ID_EXIT,    LifeFrame::OnMenu)
-    EVT_MENU           (ID_CLEAR,   LifeFrame::OnMenu)
-    EVT_MENU           (ID_START,   LifeFrame::OnMenu)
-    EVT_MENU           (ID_STEP,    LifeFrame::OnMenu)
-    EVT_MENU           (ID_STOP,    LifeFrame::OnMenu)
-    EVT_MENU           (ID_WRAP,    LifeFrame::OnMenu)
-    EVT_COMMAND_SCROLL (ID_SLIDER,  LifeFrame::OnSlider)
-END_EVENT_TABLE()
-
-BEGIN_EVENT_TABLE(LifeCanvas, wxScrolledWindow)
-    EVT_PAINT          (            LifeCanvas::OnPaint)
-    EVT_SIZE           (            LifeCanvas::OnSize)
-    EVT_MOUSE_EVENTS   (            LifeCanvas::OnMouse)
-END_EVENT_TABLE()
-
-BEGIN_EVENT_TABLE(LifeNewGameDialog, wxDialog)
-    EVT_BUTTON         (wxID_OK,    LifeNewGameDialog::OnOK)
-END_EVENT_TABLE()
-
-BEGIN_EVENT_TABLE(LifeSamplesDialog, wxDialog)
-    EVT_LISTBOX        (ID_LISTBOX, LifeSamplesDialog::OnListBox)
-END_EVENT_TABLE()
-
-
-// Create a new application object
-IMPLEMENT_APP(LifeApp)
-
-// ==========================================================================
-// implementation
-// ==========================================================================
-
-// --------------------------------------------------------------------------
-// LifeApp
-// --------------------------------------------------------------------------
-
-// `Main program' equivalent: the program execution "starts" here
-bool LifeApp::OnInit()
-{
-    // create the main application window
-    LifeFrame *frame = new LifeFrame();
-
-    // show it and tell the application that it's our main window
-    frame->Show(TRUE);
-    SetTopWindow(frame);
-
-    // enter the main message loop and run the app
-    return TRUE;
-}
-
-// --------------------------------------------------------------------------
-// LifeFrame
-// --------------------------------------------------------------------------
-
-// frame constructor
-LifeFrame::LifeFrame() : wxFrame((wxFrame *)0, -1, _("Life!"), wxPoint(50, 50))
-{
-    // frame icon
-    SetIcon(wxICON(mondrian));
-
-    // menu bar
-    wxMenu *menuFile = new wxMenu("", wxMENU_TEAROFF);
-    wxMenu *menuGame = new wxMenu("", wxMENU_TEAROFF);
-
-    menuFile->Append(ID_NEWGAME, _("New game..."), _("Start a new game"));
-    menuFile->Append(ID_SAMPLES, _("Sample game..."), _("Select a sample configuration"));
-    menuFile->AppendSeparator();
-    menuFile->Append(ID_ABOUT, _("&About...\tCtrl-A"), _("Show about dialog"));
-    menuFile->AppendSeparator();
-    menuFile->Append(ID_EXIT, _("E&xit\tAlt-X"), _("Quit this program"));
-
-    menuGame->Append(ID_CLEAR, _("&Clear\tCtrl-C"), _("Clear game field"));
-    menuGame->Append(ID_START, _("&Start\tCtrl-S"), _("Start"));
-    menuGame->Append(ID_STEP, _("&Next\tCtrl-N"), _("Single step"));
-    menuGame->Append(ID_STOP, _("S&top\tCtrl-T"), _("Stop"));
-    menuGame->Enable(ID_STOP, FALSE);
-    menuGame->AppendSeparator();
-    menuGame->Append(ID_WRAP, _("&Wraparound\tCtrl-W"), _("Wrap around borders"), TRUE);
-    menuGame->Check (ID_WRAP, TRUE);
-
-
-    wxMenuBar *menuBar = new wxMenuBar();
-    menuBar->Append(menuFile, _("&File"));
-    menuBar->Append(menuGame, _("&Game"));
-    SetMenuBar(menuBar);
-
-    // tool bar
-    wxBitmap tbBitmaps[3];
-
-    tbBitmaps[0] = wxBITMAP(reset);
-    tbBitmaps[1] = wxBITMAP(play);
-    tbBitmaps[2] = wxBITMAP(stop);
-
-    wxToolBar *toolBar = CreateToolBar();
-    toolBar->SetMargins(5, 5);
-    toolBar->SetToolBitmapSize(wxSize(16, 16));
-    ADD_TOOL(ID_CLEAR, tbBitmaps[0], _("Clear"), _("Clear game board"));
-    ADD_TOOL(ID_START, tbBitmaps[1], _("Start"), _("Start"));
-    ADD_TOOL(ID_STOP , tbBitmaps[2], _("Stop"),  _("Stop"));
-    toolBar->EnableTool(ID_STOP, FALSE);
-    toolBar->Realize();
-
-    // status bar
-    CreateStatusBar(2);
-    SetStatusText(_("Welcome to Life!"));
-
-    // panel
-    wxPanel *panel = new wxPanel(this, -1);
-
-    // game
-    m_life     = new Life(20, 20);
-    m_canvas   = new LifeCanvas(panel, m_life);
-    m_timer    = new LifeTimer();
-    m_interval = 500;
-    m_tics     = 0;
-    m_text     = new wxStaticText(panel, -1, "");
-    UpdateInfoText();
-
-    // slider
-    wxSlider *slider = new wxSlider(panel, ID_SLIDER, 5, 1, 10,
-        wxDefaultPosition, wxSize(200, -1), wxSL_HORIZONTAL | wxSL_AUTOTICKS);
-
-    // component layout
-    wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
-    sizer->Add(new wxStaticLine(panel, -1), 0, wxGROW | wxCENTRE);
-    sizer->Add(m_canvas, 1, wxGROW | wxCENTRE | wxALL, 5);
-    sizer->Add(new wxStaticLine(panel, -1), 0, wxGROW | wxCENTRE);
-    sizer->Add(m_text, 0, wxCENTRE | wxTOP, 5);
-    sizer->Add(slider, 0, wxCENTRE | wxALL, 5);
-    panel->SetSizer(sizer);
-    panel->SetAutoLayout(TRUE);
-    sizer->Fit(this);
-    sizer->SetSizeHints(this);
-}
-
-LifeFrame::~LifeFrame()
-{
-    delete m_timer;
-    delete m_life;
-}
-
-void LifeFrame::UpdateInfoText()
-{
-    wxString msg;
-
-    msg.Printf(_("Generation: %u,  Interval: %u ms"), m_tics, m_interval);
-    m_text->SetLabel(msg);
-}
-
-// event handlers
-void LifeFrame::OnMenu(wxCommandEvent& event)
-{
-    switch (event.GetId())
-    {
-        case ID_START   : OnStart(); break;
-        case ID_STEP    : OnTimer(); break;
-        case ID_STOP    : OnStop(); break;
-        case ID_WRAP    :
-        {
-            bool checked = GetMenuBar()->GetMenu(1)->IsChecked(ID_WRAP);
-            m_life->SetBorderWrap(checked);
-            break;
-        }
-        case ID_CLEAR   : 
-        {
-            OnStop();
-            m_life->Clear();
-            m_canvas->DrawEverything(TRUE);
-            m_canvas->Refresh(FALSE);
-            m_tics = 0;
-            UpdateInfoText();
-            break;
-        }
-        case ID_ABOUT :
-        {
-            wxMessageBox(
-                _("This is the about dialog of the Life! sample.\n"
-                  "(c) 2000 Guillermo Rodriguez Garcia"),
-                _("About Life!"),
-                wxOK | wxICON_INFORMATION,
-                this);
-            break;
-        }
-        case ID_EXIT :
-        {
-            // TRUE is to force the frame to close
-            Close(TRUE);
-            break;
-        }
-    }
-}
-
-void LifeFrame::OnNewGame(wxCommandEvent& WXUNUSED(event))
-{
-    int w = m_life->GetWidth();
-    int h = m_life->GetHeight();
-
-    // stop if it was running
-    OnStop();
-
-    // dialog box
-    LifeNewGameDialog dialog(this, &w, &h);
-
-    // new game?
-    if (dialog.ShowModal() == wxID_OK)
-    {
-        // check dimensions
-        if (w >= LIFE_MIN && w <= LIFE_MAX &&
-            h >= LIFE_MIN && h <= LIFE_MAX)
-        {
-            // resize game field
-            m_life->Destroy();
-            m_life->Create(w, h);
-            
-            // tell the canvas
-            m_canvas->Reset();
-            m_canvas->Refresh();
-            m_tics = 0;
-            UpdateInfoText();
-        }
-        else
-        {
-            wxString msg;
-            msg.Printf(_("Both dimensions must be within %u and %u.\n"),
-                LIFE_MIN, LIFE_MAX);
-            wxMessageBox(msg, _("Error!"), wxOK | wxICON_EXCLAMATION, this);
-        }
-    }
-}
-
-void LifeFrame::OnSamples(wxCommandEvent& WXUNUSED(event))
-{
-    // stop if it was running
-    OnStop();
-
-    // dialog box
-    LifeSamplesDialog dialog(this);
-
-    // new game?
-    if (dialog.ShowModal() == wxID_OK)
-    {
-        int result = dialog.GetValue();
-
-        if (result == -1)
-            return;
-
-        int gw   = g_shapes[result].m_fieldWidth;
-        int gh   = g_shapes[result].m_fieldHeight;
-        int wrap = g_shapes[result].m_wrap;
-
-        // set wraparound (don't ask the user)
-        m_life->SetBorderWrap(wrap);
-        GetMenuBar()->GetMenu(1)->Check(ID_WRAP, wrap);
-
-        // need to resize the game field?
-        if (gw > m_life->GetWidth() || gh > m_life->GetHeight())
-        {
-            wxString s;
-            s.Printf(_("Your game field is too small for this configuration.\n"
-                       "It is recommended to resize it to %u x %u. Proceed?\n"),
-                       gw, gh);
-
-            if (wxMessageBox(s, _("Question"), wxYES_NO | wxICON_QUESTION, this) == wxYES)
-            {
-                m_life->Destroy();
-                m_life->Create(gw, gh);
-            }
-        }
-
-        // put the shape
-        m_life->SetShape(g_shapes[result]);
-
-        // tell the canvas about the change
-        m_canvas->Reset();
-        m_canvas->Refresh();
-        m_tics = 0;
-        UpdateInfoText();
-    }
-}
-
-void LifeFrame::OnStart()
-{
-    if (!m_running)
-    {
-        GetToolBar()->EnableTool(ID_START, FALSE);
-        GetToolBar()->EnableTool(ID_STOP,  TRUE);
-        GetMenuBar()->GetMenu(1)->Enable(ID_START, FALSE);
-        GetMenuBar()->GetMenu(1)->Enable(ID_STEP,  FALSE);
-        GetMenuBar()->GetMenu(1)->Enable(ID_STOP,  TRUE);
-
-        m_timer->Start(m_interval);
-        m_running = TRUE;
-    }
-}
-
-void LifeFrame::OnStop()
-{
-    if (m_running)
-    {
-        GetToolBar()->EnableTool(ID_START, TRUE);
-        GetToolBar()->EnableTool(ID_STOP,  FALSE);
-        GetMenuBar()->GetMenu(1)->Enable(ID_START, TRUE);
-        GetMenuBar()->GetMenu(1)->Enable(ID_STEP,  TRUE);
-        GetMenuBar()->GetMenu(1)->Enable(ID_STOP,  FALSE);
-        
-        m_timer->Stop();
-        m_running = FALSE;
-    }
-}
-
-void LifeFrame::OnTimer()
-{
-    if (m_life->NextTic())
-        m_tics++;
-    else
-        OnStop();
-
-    UpdateInfoText();
-    m_canvas->DrawEverything();
-    m_canvas->Refresh(FALSE);
-}
-
-void LifeFrame::OnSlider(wxScrollEvent& event)
-{
-    m_interval = event.GetPosition() * 100;
-
-    // restart timer if running, to set the new interval
-    if (m_running)
-    {
-        m_timer->Stop();
-        m_timer->Start(m_interval);
-    }
-
-    UpdateInfoText();
-}
-
-// --------------------------------------------------------------------------
-// LifeTimer
-// --------------------------------------------------------------------------
-
-void LifeTimer::Notify()
-{
-    GET_FRAME()->OnTimer();
-};
-
-// --------------------------------------------------------------------------
-// LifeCanvas
-// --------------------------------------------------------------------------
-
-// canvas constructor
-LifeCanvas::LifeCanvas(wxWindow *parent, Life *life, bool interactive)
-          : wxScrolledWindow(parent, -1, wxPoint(0, 0), wxSize(100, 100))
-{
-    m_life        = life;
-    m_interactive = interactive;
-    m_cellsize    = 8;
-    m_bmp         = NULL;
-    Reset();
-}
-
-LifeCanvas::~LifeCanvas()
-{
-    delete m_bmp;
-}
-
-void LifeCanvas::Reset()
-{
-    if (m_bmp)
-        delete m_bmp;
-
-    m_status   = MOUSE_NOACTION;
-    m_width    = CellToCoord(m_life->GetWidth()) + 1;
-    m_height   = CellToCoord(m_life->GetHeight()) + 1;
-    m_bmp      = new wxBitmap(m_width, m_height);
-    wxCoord w  = GetClientSize().GetX();
-    wxCoord h  = GetClientSize().GetY();
-    m_xoffset  = (w > m_width)?  ((w - m_width) / 2)  : 0;
-    m_yoffset  = (h > m_height)? ((h - m_height) / 2) : 0;
-
-    // redraw everything
-    DrawEverything(TRUE);
-    SetScrollbars(10, 10, (m_width + 9) / 10, (m_height + 9) / 10);
-}
-
-void LifeCanvas::DrawEverything(bool force)
-{
-    wxMemoryDC dc;
-
-    dc.SelectObject(*m_bmp);
-    dc.BeginDrawing();
-
-    // draw cells
-    for (int j = 0; j < m_life->GetHeight(); j++)
-        for (int i = 0; i < m_life->GetWidth(); i++)
-            if (force || m_life->HasChanged(i, j))
-                DrawCell(i, j, dc);
-
-    // bounding rectangle (always drawn - better than clipping region)
-    dc.SetPen(*wxBLACK_PEN);
-    dc.SetBrush(*wxTRANSPARENT_BRUSH);
-    dc.DrawRectangle(0, 0, m_width, m_height);
-
-    dc.EndDrawing();
-    dc.SelectObject(wxNullBitmap);
-}
-
-void LifeCanvas::DrawCell(int i, int j)
-{
-    wxMemoryDC dc;
-
-    dc.SelectObject(*m_bmp);
-    dc.BeginDrawing();
-
-    dc.SetClippingRegion(1, 1, m_width - 2, m_height - 2);
-    DrawCell(i, j, dc);
-
-    dc.EndDrawing();
-    dc.SelectObject(wxNullBitmap);
-}
-
-void LifeCanvas::DrawCell(int i, int j, wxDC &dc)
-{
-    if (m_life->IsAlive(i, j))
-    {
-        dc.SetPen(*wxBLACK_PEN);
-        dc.SetBrush(*wxBLACK_BRUSH);
-        dc.DrawRectangle(CellToCoord(i),
-                         CellToCoord(j),
-                         m_cellsize,
-                         m_cellsize);
-    }
-    else
-    {
-        dc.SetPen(*wxLIGHT_GREY_PEN);
-        dc.SetBrush(*wxTRANSPARENT_BRUSH);
-        dc.DrawRectangle(CellToCoord(i),
-                         CellToCoord(j),
-                         m_cellsize,
-                         m_cellsize);
-        dc.SetPen(*wxWHITE_PEN);
-        dc.SetBrush(*wxWHITE_BRUSH);
-        dc.DrawRectangle(CellToCoord(i) + 1,
-                         CellToCoord(j) + 1,
-                         m_cellsize - 1,
-                         m_cellsize - 1);
-    }
-}
-
-// event handlers
-void LifeCanvas::OnPaint(wxPaintEvent& event)
-{
-    wxPaintDC dc(this);
-    wxMemoryDC memdc;
-
-    wxRegionIterator upd(GetUpdateRegion());
-    wxCoord x, y, w, h, xx, yy;
-
-    dc.BeginDrawing();
-    memdc.SelectObject(*m_bmp);
-
-    while(upd)
-    {
-        x = upd.GetX();
-        y = upd.GetY();
-        w = upd.GetW();
-        h = upd.GetH();
-        CalcUnscrolledPosition(x, y, &xx, &yy);
-
-        dc.Blit(x, y, w, h, &memdc, xx - m_xoffset, yy - m_yoffset);
-        upd++;
-    }
-
-    memdc.SelectObject(wxNullBitmap);
-    dc.EndDrawing();
-}
-
-void LifeCanvas::OnMouse(wxMouseEvent& event)
-{
-    if (!m_interactive)
-        return;
-
-    int x, y, xx, yy, i, j;
-
-    // which cell are we pointing at?
-    x = event.GetX();
-    y = event.GetY();
-    CalcUnscrolledPosition(x, y, &xx, &yy);
-    i = CoordToCell( xx - m_xoffset );
-    j = CoordToCell( yy - m_yoffset );
-
-    // adjust x, y to point to the upper left corner of the cell
-    CalcScrolledPosition( CellToCoord(i) + m_xoffset,
-                          CellToCoord(j) + m_yoffset,
-                          &x, &y );
-
-    // set cursor shape and statusbar text
-    if (i < 0 || i >= m_life->GetWidth() ||
-        j < 0 || j >= m_life->GetHeight())
-    {
-        GET_FRAME()->SetStatusText(wxEmptyString, 1);
-        SetCursor(*wxSTANDARD_CURSOR);
-    }
-    else
-    {
-        wxString msg;
-        msg.Printf(_("Cell: (%u, %u)"), i, j);
-        GET_FRAME()->SetStatusText(msg, 1);
-        SetCursor(*wxCROSS_CURSOR);
-    }
-
-    // button pressed?
-    if (!event.LeftIsDown())
-    {
-        m_status = MOUSE_NOACTION;
-    }
-    else if (i >= 0 && i < m_life->GetWidth() &&
-             j >= 0 && j < m_life->GetHeight())
-    {
-        bool alive = m_life->IsAlive(i, j);
-
-        // if just pressed, update status
-        if (m_status == MOUSE_NOACTION)
-            m_status = (alive? MOUSE_ERASING : MOUSE_DRAWING);
-
-        // toggle cell and refresh if needed
-        if (((m_status == MOUSE_ERASING) && alive) ||
-            ((m_status == MOUSE_DRAWING) && !alive))
-        {
-            wxRect rect(x, y, m_cellsize + 1, m_cellsize + 1);
-            m_life->SetCell(i, j, !alive);
-            DrawCell(i, j);
-            Refresh(FALSE, &rect);
-        }
-    }
-}
-
-void LifeCanvas::OnSize(wxSizeEvent& event)
-{
-    wxCoord w = event.GetSize().GetX();
-    wxCoord h = event.GetSize().GetY();
-    m_xoffset = (w > m_width)?  ((w - m_width) / 2)  : 0;
-    m_yoffset = (h > m_height)? ((h - m_height) / 2) : 0;
-
-    // allow default processing
-    event.Skip();
-}
-
-// --------------------------------------------------------------------------
-// LifeNewGameDialog
-// --------------------------------------------------------------------------
-
-LifeNewGameDialog::LifeNewGameDialog(wxWindow *parent, int *w, int *h)
-                 : wxDialog(parent, -1,
-                            _("New game"),
-                            wxDefaultPosition,
-                            wxDefaultSize,
-                            wxDEFAULT_DIALOG_STYLE | wxDIALOG_MODAL)
-{
-    m_w = w;
-    m_h = h;
-
-    // spin ctrls
-    m_spinctrlw = new wxSpinCtrl( this, -1 );
-    m_spinctrlw->SetValue(*m_w);
-    m_spinctrlw->SetRange(LIFE_MIN, LIFE_MAX);
-
-    m_spinctrlh = new wxSpinCtrl( this, -1 );
-    m_spinctrlh->SetValue(*m_h);
-    m_spinctrlh->SetRange(LIFE_MIN, LIFE_MAX);
-
-    // component layout
-    wxBoxSizer *inputsizer1 = new wxBoxSizer( wxHORIZONTAL );
-    inputsizer1->Add( new wxStaticText(this, -1, _("Width")), 1, wxCENTRE | wxLEFT, 20);
-    inputsizer1->Add( m_spinctrlw, 2, wxCENTRE | wxLEFT | wxRIGHT, 20 );
-
-    wxBoxSizer *inputsizer2 = new wxBoxSizer( wxHORIZONTAL );
-    inputsizer2->Add( new wxStaticText(this, -1, _("Height")), 1, wxCENTRE | wxLEFT, 20);
-    inputsizer2->Add( m_spinctrlh, 2, wxCENTRE | wxLEFT | wxRIGHT, 20 );
-
-    wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
-    topsizer->Add( CreateTextSizer(_("Enter board dimensions")), 0, wxALL, 10 );
-    topsizer->Add( new wxStaticLine(this, -1), 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 10);
-    topsizer->Add( inputsizer1, 1, wxGROW | wxLEFT | wxRIGHT, 5 );
-    topsizer->Add( inputsizer2, 1, wxGROW | wxLEFT | wxRIGHT, 5 );
-    topsizer->Add( new wxStaticLine(this, -1), 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 10);
-    topsizer->Add( CreateButtonSizer(wxOK | wxCANCEL), 0, wxCENTRE | wxALL, 10);
-
-    // activate
-    SetSizer(topsizer);
-    SetAutoLayout(TRUE);
-    topsizer->SetSizeHints(this);
-    topsizer->Fit(this);
-    Centre(wxBOTH);
-}
-
-void LifeNewGameDialog::OnOK(wxCommandEvent& WXUNUSED(event))
-{
-    *m_w = m_spinctrlw->GetValue();
-    *m_h = m_spinctrlh->GetValue();
-
-    EndModal(wxID_OK);
-}
-
-// --------------------------------------------------------------------------
-// LifeSamplesDialog
-// --------------------------------------------------------------------------
-
-LifeSamplesDialog::LifeSamplesDialog(wxWindow *parent)
-                 : wxDialog(parent, -1,
-                            _("Sample games"),
-                            wxDefaultPosition,
-                            wxDefaultSize,
-                            wxDEFAULT_DIALOG_STYLE | wxDIALOG_MODAL)
-{
-    m_value = 0;
-   
-    // create and populate the list of available samples
-    m_list = new wxListBox( this, ID_LISTBOX,
-        wxDefaultPosition,
-        wxDefaultSize,
-        0, NULL,
-        wxLB_SINGLE | wxLB_NEEDED_SB | wxLB_HSCROLL );
-
-    for (unsigned i = 0; i < (sizeof(g_shapes) / sizeof(LifeShape)); i++)
-        m_list->Append(g_shapes[i].m_name);
-
-    // descriptions
-    wxStaticBox *statbox = new wxStaticBox( this, -1, _("Description"));
-    m_life   = new Life( 16, 16 );
-    m_life->SetShape(g_shapes[0]);
-    m_canvas = new LifeCanvas( this, m_life, FALSE );
-    m_text   = new wxTextCtrl( this, -1,
-        g_shapes[0].m_desc,
-        wxDefaultPosition,
-        wxSize(300, 60),
-        wxTE_MULTILINE | wxTE_READONLY);
-
-    // layout components
-    wxStaticBoxSizer *sizer1 = new wxStaticBoxSizer( statbox, wxVERTICAL );
-    sizer1->Add( m_canvas, 2, wxGROW | wxCENTRE | wxALL, 5);
-    sizer1->Add( m_text, 1, wxGROW | wxCENTRE | wxALL, 5 );
-
-    wxBoxSizer *sizer2 = new wxBoxSizer( wxHORIZONTAL );
-    sizer2->Add( m_list, 0, wxGROW | wxCENTRE | wxALL, 5 );
-    sizer2->Add( sizer1, 1, wxGROW | wxCENTRE | wxALL, 5 );
-
-    wxBoxSizer *sizer3 = new wxBoxSizer( wxVERTICAL );
-    sizer3->Add( CreateTextSizer(_("Select one configuration")), 0, wxALL, 10 );
-    sizer3->Add( new wxStaticLine(this, -1), 0, wxGROW | wxLEFT | wxRIGHT, 10 );
-    sizer3->Add( sizer2, 1, wxGROW | wxCENTRE | wxALL, 5 );
-    sizer3->Add( new wxStaticLine(this, -1), 0, wxGROW | wxLEFT | wxRIGHT, 10 );
-    sizer3->Add( CreateButtonSizer(wxOK | wxCANCEL), 0, wxCENTRE | wxALL, 10 );
-
-    // activate
-    SetSizer(sizer3);
-    SetAutoLayout(TRUE);
-    sizer3->SetSizeHints(this);
-    sizer3->Fit(this);
-    Centre(wxBOTH);
-}
-
-LifeSamplesDialog::~LifeSamplesDialog()
-{
-    m_canvas->Destroy();
-    delete m_life;
-}
-
-int LifeSamplesDialog::GetValue()
-{
-    return m_value;
-}
-
-void LifeSamplesDialog::OnListBox(wxCommandEvent& event)
-{
-    if (event.GetSelection() != -1)
-    {
-        m_value = m_list->GetSelection();
-        m_text->SetValue(g_shapes[ event.GetSelection() ].m_desc);
-        m_life->SetShape(g_shapes[ event.GetSelection() ]);
-
-        m_canvas->DrawEverything(TRUE);     // force redraw everything
-        m_canvas->Refresh(FALSE);           // do not erase background
-    }
-}
-
-// --------------------------------------------------------------------------
-// Life
-// --------------------------------------------------------------------------
-
-Life::Life(int width, int height)
-{            
-    m_wrap   = TRUE;
-    m_cells  = NULL;
-    Create(width, height);
-}
-
-Life::~Life()
-{
-    Destroy();
-}
-
-void Life::Create(int width, int height)
-{
-    wxASSERT(width > 0 && height > 0);
-
-    m_width  = width;
-    m_height = height;
-    m_cells  = new Cell[m_width * m_height];
-    Clear();
-}
-
-void Life::Destroy()
-{
-    delete[] m_cells;
-}
-
-void Life::Clear()
-{
-    for (int i = 0; i < m_width * m_height; i++)
-        m_cells[i] = CELL_DEAD;
-}
-
-bool Life::IsAlive(int x, int y) const
-{
-    wxASSERT(x >= 0 && y >= 0 && x < m_width && y < m_height);
-
-    return (m_cells[y * m_width + x] & CELL_ALIVE);
-}
-
-bool Life::HasChanged(int x, int y) const
-{
-    wxASSERT(x >= 0 && y >= 0 && x < m_width && y < m_height);
-
-    return (m_cells[y * m_width + x] & CELL_MARK) != 0;
-}
-
-void Life::SetBorderWrap(bool on)
-{
-    m_wrap = on;
-}
-
-void Life::SetCell(int x, int y, bool alive)
-{
-    wxASSERT(x >= 0 && y >= 0 && x < m_width && y < m_height);
-
-    m_cells[y * m_width + x] = (alive? CELL_ALIVE : CELL_DEAD);
-}
-
-void Life::SetShape(LifeShape& shape)
-{
-    wxASSERT((m_width >= shape.m_width) && (m_height >= shape.m_height));
-
-    int x0  = (m_width - shape.m_width) / 2;
-    int y0  = (m_height - shape.m_height) / 2;
-    char *p = shape.m_data;
-
-    Clear();
-    for (int j = y0; j < y0 + shape.m_height; j++)
-        for (int i = x0; i < x0 + shape.m_width; i++)
-            SetCell(i, j, *(p++) == '*');
-}
-
-bool Life::NextTic()
-{
-    long changed = 0;
-    int  i, j;
-
-    /* 1st pass. Find and mark deaths and births for this generation.
-     *
-     * Rules:
-     *   An organism with <= 1 neighbors will die due to isolation.
-     *   An organism with >= 4 neighbors will die due to starvation.
-     *   New organisms are born in cells with exactly 3 neighbors.
-     */
-    for (j = 0; j < m_height; j++)
-        for (i = 0; i < m_width; i++)
-        {
-            int neighbors = GetNeighbors(i, j);
-            bool alive    = IsAlive(i, j);
-
-            /* Set CELL_MARK if this cell must change, clear it
-             * otherwise. We cannot toggle the CELL_ALIVE bit yet
-             * because all deaths and births are simultaneous (it
-             * would affect neighbouring cells).
-             */
-            if ((!alive && neighbors == 3) ||
-                (alive && (neighbors <= 1 || neighbors >= 4)))
-                m_cells[j * m_width + i] |= CELL_MARK;
-            else
-                m_cells[j * m_width + i] &= ~CELL_MARK;
-        }
-
-    /* 2nd pass. Stabilize.
-     */
-    for (j = 0; j < m_height; j++)
-        for (i = 0; i < m_width; i++)
-        {
-            /* Toggle CELL_ALIVE for those cells marked in the
-             * previous pass. Do not clear the CELL_MARK bit yet;
-             * it is useful to know which cells have changed and
-             * thus must be updated in the screen.
-             */
-            if (m_cells[j * m_width + i] & CELL_MARK)
-            {
-                m_cells[j * m_width + i] ^= CELL_ALIVE;
-                changed++;
-            }
-        }
-
-    return (changed != 0);
-}
-
-int Life::GetNeighbors(int x, int y) const
-{
-    wxASSERT(x >= 0 && y >= 0 && x < m_width && y < m_height);
-
-    int neighbors = 0;
-
-    int i0 = (x)? (x - 1) : 0;
-    int j0 = (y)? (y - 1) : 0;
-    int i1 = (x < (m_width - 1))? (x + 1) : (m_width - 1);
-    int j1 = (y < (m_height - 1))? (y + 1) : (m_height - 1);
-
-    if (m_wrap && ( !x || !y || x == (m_width - 1) || y == (m_height - 1)))
-    {
-        // this is an outer cell and wraparound is on
-        for (int j = y - 1; j <= y + 1; j++)
-            for (int i = x - 1; i <= x + 1; i++)
-                if (IsAlive( ((i < 0)? (i + m_width ) : (i % m_width)),
-                             ((j < 0)? (j + m_height) : (j % m_height)) ))
-                     neighbors++;
-    }
-    else
-    {
-        // this is an inner cell, or wraparound is off
-        for (int j = j0; j <= j1; j++)
-            for (int i = i0; i <= i1; i++)
-                if (IsAlive(i, j))
-                     neighbors++;
-    }
-
-    // do not count ourselves
-    if (IsAlive(x, y)) neighbors--;
-
-    return neighbors;
-}
-
-void Life::SetCell(int x, int y, Cell status)
-{
-    wxASSERT(x >= 0 && y >= 0 && x < m_width && y < m_height);
-
-    m_cells[y * m_width + x] = status;
-}
-
diff --git a/samples/life/life.def b/samples/life/life.def
deleted file mode 100644 (file)
index 5f7709f..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-NAME         Life
-DESCRIPTION  'Life! wxWindows application'
-EXETYPE      WINDOWS
-CODE         PRELOAD MOVEABLE DISCARDABLE
-DATA         PRELOAD MOVEABLE MULTIPLE
-HEAPSIZE     4048
-STACKSIZE    16000
diff --git a/samples/life/life.rc b/samples/life/life.rc
deleted file mode 100644 (file)
index 96782b2..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-mondrian ICON "mondrian.ico"
-#include "wx/msw/wx.rc"
-
-reset BITMAP "bitmaps/reset.bmp"
-play  BITMAP "bitmaps/play.bmp"
-stop  BITMAP "bitmaps/stop.bmp"
diff --git a/samples/life/makefile.b32 b/samples/life/makefile.b32
deleted file mode 100644 (file)
index 22869de..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# File:                makefile.b32
-# Author:      Julian Smart
-# Created:     1999
-# Updated:     
-# Copyright:
-#
-# Makefile : Builds sample for 32-bit BC++
-
-WXDIR = $(WXWIN)
-
-TARGET=life
-OBJECTS = $(TARGET).obj
-
-!include $(WXDIR)\src\makeprog.b32
-
diff --git a/samples/life/makefile.bcc b/samples/life/makefile.bcc
deleted file mode 100644 (file)
index 2b70fcf..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# File:                makefile.bcc
-# Author:      Julian Smart
-# Created:     1998
-# Updated:     
-#
-# Builds a BC++ 16-bit sample
-
-!if "$(WXWIN)" == ""
-!error You must define the WXWIN variable in autoexec.bat, e.g. WXWIN=c:\wx
-!endif
-
-WXDIR = $(WXWIN)
-
-TARGET=life
-OBJECTS=$(TARGET).obj
-
-!include $(WXDIR)\src\makeprog.bcc
-
diff --git a/samples/life/makefile.dos b/samples/life/makefile.dos
deleted file mode 100644 (file)
index 6d66090..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# File:                makefile.dos
-# Author:      Julian Smart
-# Created:     1998
-# Updated:     
-#
-# Makefile : Builds 16-bit sample, VC++ 1.5
-# Use FINAL=1 argument to nmake to build final version with no debugging
-# info
-
-WXDIR = $(WXWIN)
-
-TARGET=life
-OBJECTS = $(TARGET).obj
-
-!include $(WXDIR)\src\makeprog.msc
-
diff --git a/samples/life/makefile.g95 b/samples/life/makefile.g95
deleted file mode 100644 (file)
index 9091712..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# File:         makefile.g95
-# Author:       Julian Smart
-# Created:      1999
-# Updated:
-# Copyright:    (c) Julian Smart, 1999
-#
-# Makefile for wxWindows sample (Cygwin/Mingw32).
-
-WXDIR = ../..
-
-TARGET=life
-OBJECTS = $(TARGET).o
-
-include $(WXDIR)/src/makeprog.g95
-
diff --git a/samples/life/makefile.unx b/samples/life/makefile.unx
deleted file mode 100644 (file)
index c903648..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-#
-# File:                Makefile for samples
-# Author:      Robert Roebling
-# Created:     1999
-# Updated:     
-# Copyright:   (c) 1998 Robert Roebling
-#
-# This makefile requires a Unix version of wxWindows
-# to be installed on your system. This is most often
-# done typing "make install" when using the complete
-# sources of wxWindows or by installing the two
-# RPM packages wxGTK.XXX.rpm and wxGTK-devel.XXX.rpm
-# under Linux.
-#
-
-CC = gcc
-
-PROGRAM = life
-
-OBJECTS = $(PROGRAM).o
-
-# implementation
-
-.SUFFIXES:     .o .cpp
-
-.cpp.o :
-       $(CC) -c `wx-config --cflags` -o $@ $<
-
-all:    $(PROGRAM)
-
-$(PROGRAM):    $(OBJECTS)
-       $(CC) -o $(PROGRAM) $(OBJECTS) `wx-config --libs`
-
-clean: 
-       rm -f *.o $(PROGRAM)
diff --git a/samples/life/makefile.vc b/samples/life/makefile.vc
deleted file mode 100644 (file)
index 2e9f094..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# File:                makefile.vc
-# Author:      Julian Smart
-# Created:     1999
-# Updated:     
-# Copyright:   (c) Julian Smart
-#
-# Makefile : Builds sample (VC++, WIN32)
-# Use FINAL=1 argument to nmake to build final version with no debug info.
-
-# Set WXDIR for your system
-WXDIR = $(WXWIN)
-
-PROGRAM=life
-OBJECTS = $(PROGRAM).obj
-
-!include $(WXDIR)\src\makeprog.vc
-
diff --git a/samples/life/makefile.wat b/samples/life/makefile.wat
deleted file mode 100644 (file)
index b959230..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#
-# Makefile for WATCOM
-#
-# Created by Julian Smart, January 1999
-# 
-#
-
-WXDIR = $(%WXWIN)
-
-PROGRAM = life
-OBJECTS = $(PROGRAM).obj
-
-!include $(WXDIR)\src\makeprog.wat
-
-
diff --git a/samples/life/mondrian.ico b/samples/life/mondrian.ico
deleted file mode 100644 (file)
index 2310c5d..0000000
Binary files a/samples/life/mondrian.ico and /dev/null differ
diff --git a/samples/life/mondrian.xpm b/samples/life/mondrian.xpm
deleted file mode 100644 (file)
index 409f27a..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/* XPM */
-static char *mondrian_xpm[] = {
-/* columns rows colors chars-per-pixel */
-"32 32 6 1",
-"  c Black",
-". c Blue",
-"X c #00bf00",
-"o c Red",
-"O c Yellow",
-"+ c Gray100",
-/* pixels */
-"                                ",
-" oooooo +++++++++++++++++++++++ ",
-" oooooo +++++++++++++++++++++++ ",
-" oooooo +++++++++++++++++++++++ ",
-" oooooo +++++++++++++++++++++++ ",
-" oooooo +++++++++++++++++++++++ ",
-" oooooo +++++++++++++++++++++++ ",
-" oooooo +++++++++++++++++++++++ ",
-"                                ",
-" ++++++ ++++++++++++++++++ .... ",
-" ++++++ ++++++++++++++++++ .... ",
-" ++++++ ++++++++++++++++++ .... ",
-" ++++++ ++++++++++++++++++ .... ",
-" ++++++ ++++++++++++++++++ .... ",
-" ++++++ ++++++++++++++++++      ",
-" ++++++ ++++++++++++++++++ ++++ ",
-" ++++++ ++++++++++++++++++ ++++ ",
-" ++++++ ++++++++++++++++++ ++++ ",
-" ++++++ ++++++++++++++++++ ++++ ",
-" ++++++ ++++++++++++++++++ ++++ ",
-" ++++++ ++++++++++++++++++ ++++ ",
-" ++++++ ++++++++++++++++++ ++++ ",
-" ++++++ ++++++++++++++++++ ++++ ",
-" ++++++ ++++++++++++++++++ ++++ ",
-" ++++++                    ++++ ",
-" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
-" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
-" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
-" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
-" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
-" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
-"                                "
-};
diff --git a/samples/life/samples.inc b/samples/life/samples.inc
deleted file mode 100644 (file)
index d218418..0000000
+++ /dev/null
@@ -1,157 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name:        samples.inc
-// Purpose:     Sample configurations for Life!
-// Author:      Guillermo Rodriguez Garcia, <guille@iies.es>
-// Modified by:
-// Created:     Jan/2000
-// RCS-ID:      $Id$
-// Copyright:   (c) 2000, Guillermo Rodriguez Garcia
-// Licence:     wxWindows licence
-/////////////////////////////////////////////////////////////////////////////
-
-// --------------------------------------------------------------------------
-// sample configurations
-// --------------------------------------------------------------------------
-
-/* Format:
- *
- * Name,
- * Description,
- * Width, Height,
- * Data,                        ('*' = alive, '.' = dead)
- * Field width, Field height,   (optional, defaults to 20 x 20)
- * Wraparound                   (optional, defaults to TRUE)
- * 
- */
-
-LifeShape g_shapes[] =
-{
-    LifeShape( _("Glider"),
-               _("The glider is the first of a series of life forms, known "
-                 "as spaceships or fishes, which can travel along the game "
-                 "field retaining their original shape."),
-               3, 3,
-               ".*."
-               "..*"
-               "***"),
-    LifeShape( _("Heavyweight spaceship"),
-               _("The glider is just the smaller of the spaceships; this "
-                 "one, known as the heavyweight spaceship or 'big fish', "
-                 "is the largest spaceship which can travel alone without "
-                 "destroying itself. Larger ones can only travel safely "
-                 "if they are supported by smaller spaceships."),
-               7, 4,
-               ".....*."
-               "......*"
-               "*.....*"
-               ".******"),
-    LifeShape( _("Eater"),
-               _("An eater is any still life that can repair itself from "
-                 "some attacks. This one (bottom right), also known as "
-                 "'fishhook', eats gliders and fishes (spaceships) provided "
-                 "that they approach in a certain angle."),
-               10, 10,
-               ".*........"
-               "..*......."
-               "***......."
-               ".........."
-               ".........."
-               ".........."
-               "......**.."
-               "......*.*."
-               "........*."
-               "........**" ),
-    LifeShape( _("Dice shaker"),
-               _("Oscillators have been extensively explored in Life!. "
-                 "The dice shaker turns around each seven tics; thus, it "
-                 "is an oscillator with a period of fourteen."),
-               7, 6,
-               ".**.**."
-               ".**.**."
-               "..*.*.."
-               "*.*.*.*"
-               "*.*.*.*"
-               "**...**" ),
-    LifeShape( _("Hertz oscillator"),
-               _("The Hertz oscillator is a good example of a set of life "
-                 "patterns known as 'billiard tables'. A billiard table is "
-                 "an oscillator which is built inside a stable border. In "
-                 "particular, this one has a period of eight."),
-               14, 11,
-               ".....**......."
-               ".....**......."
-               ".............."
-               "**...****...**"
-               "*.*.*....*.*.*"
-               "..*.**...*.*.."
-               "*.*.*....*.*.*"
-               "**...****...**"
-               ".............."
-               ".......**....."
-               ".......**....." ),
-    LifeShape( _("Phoenix"),
-               _("A phoenix is a pattern whose cells all die in every "
-                 "generation, and yet lives forever. For example, this is "
-                 "a phoenix with period two."),
-               8, 8,
-               "....*..."
-               "..*.*..."
-               "......*."
-               "**......"
-               "......**"
-               ".*......"
-               "...*.*.."
-               "...*...." ),
-    LifeShape( _("R-pentomino"),
-               _("The R-pentomino is a methuselah - a life form which "
-                 "lives for hundreds of generations without stabilizing "
-                 "or dying. In particular, the R-Pentomino requires more "
-                 "than one thousand tics to reach a stable (periodic) "
-                 "state."),
-               3, 3,
-               ".**"
-               "**."
-               ".*.",
-               80, 80, FALSE ),
-    LifeShape( _("Thunderbird"),
-               _("The thunderbird is another popular methuselah, which "
-                 "doesn't stabilize until the 243th generation. Note that "
-                 "because the initial configuration is symmetrical with "
-                 "respect to the vertical axis, all generations must be "
-                 "symmetrical as well."),
-               3, 5,
-               "***"
-               "..."
-               ".*."
-               ".*."
-               ".*.",
-               60, 60, FALSE ),
-    LifeShape( _("Accorn"),
-               _("Probably the most popular methuselah, the accorn lives "
-                 "for 5206 (!) generations. To see it in action, a very "
-                 "large game field is needed."),
-               7, 3,
-               ".*....."
-               "...*..."
-               "**..***",
-               150, 150, FALSE ),
-    LifeShape( _("Galaxy"),
-               _("One from my personal collection. It is really beautiful "
-                 "to see this configuration expand and shrink periodically "
-                 "for hundreds of tics before reaching a stable state."),
-               13, 13,
-               "...***......."
-               "......*......"
-               "......*......"
-               "......*.....*"
-               ".....***....*"
-               "....*   *...*"
-               ".****   ****."
-               "*...*   *...."
-               "*....***....."
-               "*.....*......"
-               "......*......"
-               "......*......"
-               ".......***...",
-               80, 80, FALSE )
-};
diff --git a/samples/nettest/Makefile.in b/samples/nettest/Makefile.in
deleted file mode 100644 (file)
index f003eec..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-#
-# File:                makefile.unx
-# Author:      Julian Smart
-# Created:     1998
-# Updated:     
-# Copyright:   (c) 1998 Julian Smart
-#
-# "%W% %G%"
-#
-# Makefile for nettest example (UNIX).
-
-top_srcdir = @top_srcdir@
-top_builddir = ../..
-program_dir = samples/nettest
-
-PROGRAM=nettest
-
-OBJECTS=$(PROGRAM).o
-
-include ../../src/makeprog.env
-
diff --git a/samples/nettest/makefile.b32 b/samples/nettest/makefile.b32
deleted file mode 100644 (file)
index 791b8b2..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# File:                makefile.b32
-# Author:      Julian Smart
-# Created:     1999
-# Updated:     
-# Copyright:
-#
-# Makefile : Builds sample for 32-bit BC++
-
-WXDIR = $(WXWIN)
-
-TARGET=nettest
-OBJECTS = $(TARGET).obj
-
-!include $(WXDIR)\src\makeprog.b32
-
diff --git a/samples/nettest/makefile.bcc b/samples/nettest/makefile.bcc
deleted file mode 100644 (file)
index 03a220e..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# File:                makefile.bcc
-# Author:      Julian Smart
-# Created:     1998
-# Updated:     
-#
-# Builds a BC++ 16-bit sample
-
-!if "$(WXWIN)" == ""
-!error You must define the WXWIN variable in autoexec.bat, e.g. WXWIN=c:\wx
-!endif
-
-WXDIR = $(WXWIN)
-
-TARGET=nettest
-OBJECTS=$(TARGET).obj
-
-!include $(WXDIR)\src\makeprog.bcc
-
diff --git a/samples/nettest/makefile.dos b/samples/nettest/makefile.dos
deleted file mode 100644 (file)
index 3162377..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# File:                makefile.dos
-# Author:      Julian Smart
-# Created:     1998
-# Updated:     
-#
-# Makefile : Builds 16-bit sample, VC++ 1.5
-# Use FINAL=1 argument to nmake to build final version with no debugging
-# info
-
-WXDIR = $(WXWIN)
-
-TARGET=nettest
-OBJECTS=$(TARGET).obj
-
-!include $(WXDIR)\src\makeprog.msc
-
diff --git a/samples/nettest/makefile.g95 b/samples/nettest/makefile.g95
deleted file mode 100644 (file)
index 9b0d993..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# File:         makefile.g95
-# Author:       Julian Smart
-# Created:      1999
-# Updated:
-# Copyright:    (c) Julian Smart, 1999
-#
-# Makefile for wxWindows sample (Cygwin/Mingw32).
-
-WXDIR = ../..
-
-TARGET=nettest
-OBJECTS = $(TARGET).o
-
-include $(WXDIR)\src\makeprog.g95
-
diff --git a/samples/nettest/makefile.unx b/samples/nettest/makefile.unx
deleted file mode 100644 (file)
index f890694..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-#
-# File:                Makefile for samples
-# Author:      Robert Roebling
-# Created:     1999
-# Updated:     
-# Copyright:   (c) 1998 Robert Roebling
-#
-# This makefile requires a Unix version of wxWindows
-# to be installed on your system. This is most often
-# done typing "make install" when using the complete
-# sources of wxWindows or by installing the two
-# RPM packages wxGTK.XXX.rpm and wxGTK-devel.XXX.rpm
-# under Linux.
-#
-
-CC = gcc
-
-PROGRAM = nettest
-
-OBJECTS = $(PROGRAM).o
-
-# implementation
-
-.SUFFIXES:     .o .cpp
-
-.cpp.o :
-       $(CC) -c `wx-config --cflags` -o $@ $<
-
-all:    $(PROGRAM)
-
-$(PROGRAM):    $(OBJECTS)
-       $(CC) -o $(PROGRAM) $(OBJECTS) `wx-config --libs`
-
-clean: 
-       rm -f *.o $(PROGRAM)
diff --git a/samples/nettest/makefile.vc b/samples/nettest/makefile.vc
deleted file mode 100644 (file)
index 189d1a4..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# File:                makefile.vc
-# Author:      Julian Smart
-# Created:     1999
-# Updated:     
-# Copyright:   (c) Julian Smart
-#
-# Makefile : Builds sample (VC++, WIN32)
-# Use FINAL=1 argument to nmake to build final version with no debug info.
-
-# Set WXDIR for your system
-WXDIR = $(WXWIN)
-
-PROGRAM=nettest
-OBJECTS = $(PROGRAM).obj
-
-!include $(WXDIR)\src\makeprog.vc
-
diff --git a/samples/nettest/nettest.cpp b/samples/nettest/nettest.cpp
deleted file mode 100644 (file)
index 5c3a6e2..0000000
+++ /dev/null
@@ -1,336 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name:        net.cpp
-// Purpose:     wxWindows sample demonstrating network-related functions
-// Author:      Vadim Zeitlin
-// Modified by:
-// Created:     07.07.99
-// RCS-ID:      $Id$
-// Copyright:   (c) Vadim Zeitlin
-// Licence:     wxWindows licence
-/////////////////////////////////////////////////////////////////////////////
-
-// ============================================================================
-// declarations
-// ============================================================================
-
-// ----------------------------------------------------------------------------
-// headers
-// ----------------------------------------------------------------------------
-
-#ifdef __GNUG__
-    #pragma implementation "nettest.cpp"
-    #pragma interface "nettest.cpp"
-#endif
-
-// For compilers that support precompilation, includes "wx/wx.h".
-#include "wx/wxprec.h"
-
-#ifdef __BORLANDC__
-    #pragma hdrstop
-#endif
-
-// for all others, include the necessary headers (this file is usually all you
-// need because it includes almost all "standard" wxWindows headers
-#ifndef WX_PRECOMP
-    #include "wx/wx.h"
-#endif
-
-#include "wx/dialup.h"
-
-// ----------------------------------------------------------------------------
-// private classes
-// ----------------------------------------------------------------------------
-
-// Define a new application type, each program should derive a class from wxApp
-class MyApp : public wxApp
-{
-public:
-    // override base class virtuals
-    // ----------------------------
-
-    // this one is called on application startup and is a good place for the app
-    // initialization (doing it here and not in the ctor allows to have an error
-    // return: if OnInit() returns false, the application terminates)
-    virtual bool OnInit();
-
-    // called before the application termination
-    virtual int OnExit();
-
-    // event handlers
-    void OnConnected(wxDialUpEvent& event);
-
-    // accessor to dial up manager
-    wxDialUpManager *GetDialer() const { return m_dial; }
-
-private:
-    wxDialUpManager *m_dial;
-
-    DECLARE_EVENT_TABLE();
-};
-
-// Define a new frame type: this is going to be our main frame
-class MyFrame : public wxFrame
-{
-public:
-    // ctor(s)
-    MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
-
-    // event handlers (these functions should _not_ be virtual)
-    void OnQuit(wxCommandEvent& event);
-    void OnAbout(wxCommandEvent& event);
-    void OnHangUp(wxCommandEvent& event);
-    void OnDial(wxCommandEvent& event);
-    void OnEnumISPs(wxCommandEvent& event);
-    void OnCheck(wxCommandEvent& event);
-    void OnUpdateUI(wxUpdateUIEvent& event);
-
-    void OnIdle(wxIdleEvent& event);
-
-private:
-    // any class wishing to process wxWindows events must use this macro
-    DECLARE_EVENT_TABLE()
-};
-
-// ----------------------------------------------------------------------------
-// constants
-// ----------------------------------------------------------------------------
-
-// IDs for the controls and the menu commands
-enum
-{
-    // menu items
-    NetTest_Quit = 1,
-    NetTest_About,
-    NetTest_HangUp,
-    NetTest_Dial,
-    NetTest_EnumISP,
-    NetTest_Check,
-    NetTest_Max
-};
-
-// ----------------------------------------------------------------------------
-// event tables and other macros for wxWindows
-// ----------------------------------------------------------------------------
-
-BEGIN_EVENT_TABLE(MyApp, wxApp)
-    EVT_DIALUP_CONNECTED(MyApp::OnConnected)
-    EVT_DIALUP_DISCONNECTED(MyApp::OnConnected)
-END_EVENT_TABLE()
-
-// the event tables connect the wxWindows events with the functions (event
-// handlers) which process them. It can be also done at run-time, but for the
-// simple menu events like this the static method is much simpler.
-BEGIN_EVENT_TABLE(MyFrame, wxFrame)
-    EVT_MENU(NetTest_Quit,  MyFrame::OnQuit)
-    EVT_MENU(NetTest_About, MyFrame::OnAbout)
-    EVT_MENU(NetTest_HangUp, MyFrame::OnHangUp)
-    EVT_MENU(NetTest_Dial, MyFrame::OnDial)
-    EVT_MENU(NetTest_EnumISP, MyFrame::OnEnumISPs)
-    EVT_MENU(NetTest_Check, MyFrame::OnCheck)
-
-    EVT_UPDATE_UI(NetTest_Dial, MyFrame::OnUpdateUI)
-
-    EVT_IDLE(MyFrame::OnIdle)
-END_EVENT_TABLE()
-
-// Create a new application object: this macro will allow wxWindows to create
-// the application object during program execution (it's better than using a
-// static object for many reasons) and also declares the accessor function
-// wxGetApp() which will return the reference of the right type (i.e. MyApp and
-// not wxApp)
-IMPLEMENT_APP(MyApp)
-
-// ============================================================================
-// implementation
-// ============================================================================
-
-// ----------------------------------------------------------------------------
-// the application class
-// ----------------------------------------------------------------------------
-
-// `Main program' equivalent: the program execution "starts" here
-bool MyApp::OnInit()
-{
-    // Create the main application window
-    MyFrame *frame = new MyFrame("Dial-up wxWindows demo",
-                                 wxPoint(50, 50), wxSize(450, 340));
-
-    // Show it and tell the application that it's our main window
-    frame->Show(TRUE);
-    SetTopWindow(frame);
-
-    // Init dial up manager
-    m_dial = wxDialUpManager::Create();
-
-    if ( !m_dial->IsOk() )
-    {
-        wxLogError("The sample can't run on this system.");
-
-        wxLog::GetActiveTarget()->Flush();
-
-        // do it here, OnExit() won't be called
-        delete m_dial;
-
-        return FALSE;
-    }
-
-    frame->SetStatusText(GetDialer()->IsAlwaysOnline() ? "LAN" : "No LAN", 2);
-
-    return TRUE;
-}
-
-int MyApp::OnExit()
-{
-    delete m_dial;
-
-    // exit code is 0, everything is ok
-    return 0;
-}
-
-void MyApp::OnConnected(wxDialUpEvent& event)
-{
-    const char *msg;
-    if ( event.IsOwnEvent() )
-    {
-        msg = event.IsConnectedEvent() ? "Successfully connected"
-                                       : "Dialing failed";
-
-        wxLogStatus("");
-    }
-    else
-    {
-        msg = event.IsConnectedEvent() ? "Just connected!"
-                                       : "Disconnected";
-    }
-
-    wxLogMessage(msg);
-}
-
-// ----------------------------------------------------------------------------
-// main frame
-// ----------------------------------------------------------------------------
-
-// frame constructor
-MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
-       : wxFrame((wxFrame *)NULL, -1, title, pos, size)
-{
-    // create a menu bar
-    wxMenu *menuFile = new wxMenu;
-
-    menuFile->Append(NetTest_Dial, "&Dial\tCtrl-D", "Dial default ISP");
-    menuFile->Append(NetTest_HangUp, "&HangUp\tCtrl-H", "Hang up modem");
-    menuFile->AppendSeparator();
-    menuFile->Append(NetTest_EnumISP, "&Enumerate ISPs...\tCtrl-E");
-    menuFile->Append(NetTest_Check, "&Check connection status...\tCtrl-C");
-    menuFile->AppendSeparator();
-    menuFile->Append(NetTest_About, "&About...\tCtrl-A", "Show about dialog");
-    menuFile->AppendSeparator();
-    menuFile->Append(NetTest_Quit, "E&xit\tAlt-X", "Quit this program");
-
-    // now append the freshly created menu to the menu bar...
-    wxMenuBar *menuBar = new wxMenuBar;
-    menuBar->Append(menuFile, "&File");
-
-    // ... and attach this menu bar to the frame
-    SetMenuBar(menuBar);
-
-    // create status bar and fill the LAN field
-    CreateStatusBar(3);
-    static const int widths[3] = { -1, 100, 60 };
-    SetStatusWidths(3, widths);
-}
-
-
-// event handlers
-
-void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
-{
-    // TRUE is to force the frame to close
-    Close(TRUE);
-}
-
-void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
-{
-    wxString msg;
-    msg.Printf(_T("This is the network functions test sample.\n"
-                  "© 1999 Vadim Zeitlin"));
-
-    wxMessageBox(msg, _T("About NetTest"), wxOK | wxICON_INFORMATION, this);
-}
-
-void MyFrame::OnHangUp(wxCommandEvent& WXUNUSED(event))
-{
-    if ( wxGetApp().GetDialer()->HangUp() )
-    {
-        wxLogStatus(this, "Connection was succesfully terminated.");
-    }
-    else
-    {
-        wxLogStatus(this, "Failed to hang up.");
-    }
-}
-
-void MyFrame::OnDial(wxCommandEvent& WXUNUSED(event))
-{
-    wxLogStatus(this, "Preparing to dial...");
-    wxYield();
-    wxBeginBusyCursor();
-
-    if ( wxGetApp().GetDialer()->Dial() )
-    {
-        wxLogStatus(this, "Dialing...");
-    }
-    else
-    {
-        wxLogStatus(this, "Dialing attempt failed.");
-    }
-
-    wxEndBusyCursor();
-}
-
-void MyFrame::OnCheck(wxCommandEvent& WXUNUSED(event))
-{
-   if(wxGetApp().GetDialer()->IsOnline())
-      wxLogMessage("Network is online.");
-   else
-      wxLogMessage("Network is offline.");
-}
-
-void MyFrame::OnEnumISPs(wxCommandEvent& WXUNUSED(event))
-{
-    wxArrayString names;
-    size_t nCount = wxGetApp().GetDialer()->GetISPNames(names);
-    if ( nCount == 0 )
-    {
-        wxLogWarning("No ISPs found.");
-    }
-    else
-    {
-        wxString msg = "Known ISPs:\n";
-        for ( size_t n = 0; n < nCount; n++ )
-        {
-            msg << names[n] << '\n';
-        }
-
-        wxLogMessage(msg);
-    }
-}
-
-void MyFrame::OnUpdateUI(wxUpdateUIEvent& event)
-{
-    // disable this item while dialing
-    event.Enable( !wxGetApp().GetDialer()->IsDialing() );
-}
-
-void MyFrame::OnIdle(wxIdleEvent& WXUNUSED(event))
-{
-    static int s_isOnline = -1; // not TRUE nor FALSE
-
-    bool isOnline = wxGetApp().GetDialer()->IsOnline();
-    if ( s_isOnline != (int)isOnline )
-    {
-        s_isOnline = isOnline;
-
-        SetStatusText(isOnline ? "Online" : "Offline", 1);
-    }
-}
diff --git a/samples/nettest/nettest.def b/samples/nettest/nettest.def
deleted file mode 100644 (file)
index b41de47..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-NAME         Nettest
-DESCRIPTION  'Nettest wxWindows application'
-EXETYPE      WINDOWS
-CODE         PRELOAD MOVEABLE DISCARDABLE
-DATA         PRELOAD MOVEABLE MULTIPLE
-HEAPSIZE     4048
-STACKSIZE    16000
diff --git a/samples/nettest/nettest.rc b/samples/nettest/nettest.rc
deleted file mode 100644 (file)
index 82bdf07..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "wx/msw/wx.rc"
-
diff --git a/samples/sockets/.cvsignore b/samples/sockets/.cvsignore
new file mode 100644 (file)
index 0000000..8b13789
--- /dev/null
@@ -0,0 +1 @@
+
diff --git a/samples/sockets/Makefile.in b/samples/sockets/Makefile.in
new file mode 100644 (file)
index 0000000..96af3cf
--- /dev/null
@@ -0,0 +1,36 @@
+#
+# File:                Makefile.in
+# Author:      Julian Smart
+# Created:     1998
+# Updated:     
+# Copyright:   (c) 1998 Julian Smart
+#
+# "%W% %G%"
+#
+# Makefile for wxsocket example (UNIX).
+
+top_srcdir = @top_srcdir@
+top_builddir = ../..
+program_dir = samples/wxsocket
+VPATH = :$(top_srcdir)/samples/wxsocket
+
+# Clears all default suffixes
+.SUFFIXES:     .o .cpp .c .cxx
+
+.cpp.o :
+       $(CC) -c $(CPPFLAGS) -o $@ $<
+
+# Set defaults from configure
+include ../../src/make.env
+
+all:   client server
+
+client:        client.o ../../lib/@WX_TARGET_LIBRARY@
+       $(CC) $(LDFLAGS) -o client client.o $(LDLIBS)
+
+server:        server.o ../../lib/@WX_TARGET_LIBRARY@
+       $(CC) $(LDFLAGS) -o server server.o $(LDLIBS)
+
+clean:
+       rm -f $(OBJECTS) $(PROGRAM) core
+
diff --git a/samples/sockets/client.cpp b/samples/sockets/client.cpp
new file mode 100644 (file)
index 0000000..2dba5c9
--- /dev/null
@@ -0,0 +1,446 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        client.cpp
+// Purpose:     Client for wxSocket demo
+// Author:      Guillermo Rodriguez Garcia <guille@iies.es>
+// Modified by:
+// Created:     1999/09/19
+// RCS-ID:      $Id$
+// Copyright:   (c) 1999 Guillermo Rodriguez Garcia
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// ==========================================================================
+// declarations
+// ==========================================================================
+
+// --------------------------------------------------------------------------
+// headers
+// --------------------------------------------------------------------------
+
+#ifdef __GNUG__
+#  pragma implementation "client.cpp"
+#  pragma interface "client.cpp"
+#endif
+
+// For compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#  pragma hdrstop
+#endif
+
+// for all others, include the necessary headers 
+#ifndef WX_PRECOMP
+#  include "wx/wx.h"
+#endif
+
+#  include "wx/socket.h"
+#  include "wx/url.h"
+#  include "wx/protocol/http.h"
+#  include "wx/progdlg.h"
+
+// --------------------------------------------------------------------------
+// resources
+// --------------------------------------------------------------------------
+
+// the application icon
+#if defined(__WXGTK__) || defined(__WXMOTIF__)
+#  include "mondrian.xpm"
+#endif
+
+// --------------------------------------------------------------------------
+// classes
+// --------------------------------------------------------------------------
+
+// Define a new application type
+class MyApp : public wxApp
+{
+public:
+  virtual bool OnInit();
+};
+
+// Define a new frame type: this is going to be our main frame
+class MyFrame : public wxFrame
+{
+public:
+  MyFrame();
+  ~MyFrame();
+
+  // event handlers (these functions should _not_ be virtual)
+  void OnQuit(wxCommandEvent& event);
+  void OnAbout(wxCommandEvent& event);
+  void OnOpenConnection(wxCommandEvent& event);
+  void OnTest1(wxCommandEvent& event);
+  void OnTest2(wxCommandEvent& event);
+  void OnTest3(wxCommandEvent& event);
+  void OnCloseConnection(wxCommandEvent& event);
+  void OnSocketEvent(wxSocketEvent& event);
+
+  // convenience functions
+  void UpdateStatusBar();
+
+private:
+  wxSocketClient *m_sock;
+  wxPanel        *m_panel;
+  wxTextCtrl     *m_text;
+  wxMenu         *m_menuFile;
+  wxMenu         *m_menuSocket;
+  wxMenuBar      *m_menuBar;
+  bool            m_busy;
+
+  // any class wishing to process wxWindows events must use this macro
+  DECLARE_EVENT_TABLE()
+};
+
+// --------------------------------------------------------------------------
+// constants
+// --------------------------------------------------------------------------
+
+// IDs for the controls and the menu commands
+enum
+{
+  // menu items
+  CLIENT_QUIT = 1000,
+  CLIENT_ABOUT,
+  CLIENT_OPEN,
+  CLIENT_TEST1,
+  CLIENT_TEST2,
+  CLIENT_TEST3,
+  CLIENT_CLOSE,
+
+  // id for socket
+  SOCKET_ID
+};
+
+// --------------------------------------------------------------------------
+// event tables and other macros for wxWindows
+// --------------------------------------------------------------------------
+
+BEGIN_EVENT_TABLE(MyFrame, wxFrame)
+  EVT_MENU(CLIENT_QUIT,  MyFrame::OnQuit)
+  EVT_MENU(CLIENT_ABOUT, MyFrame::OnAbout)
+  EVT_MENU(CLIENT_OPEN,  MyFrame::OnOpenConnection)
+  EVT_MENU(CLIENT_TEST1, MyFrame::OnTest1)
+  EVT_MENU(CLIENT_TEST2, MyFrame::OnTest2)
+  EVT_MENU(CLIENT_TEST3, MyFrame::OnTest3)
+  EVT_MENU(CLIENT_CLOSE, MyFrame::OnCloseConnection)
+  EVT_SOCKET(SOCKET_ID,  MyFrame::OnSocketEvent)
+END_EVENT_TABLE()
+
+IMPLEMENT_APP(MyApp)
+
+// ==========================================================================
+// implementation
+// ==========================================================================
+
+// --------------------------------------------------------------------------
+// the application class
+// --------------------------------------------------------------------------
+
+bool MyApp::OnInit()
+{
+  // Create the main application window
+  MyFrame *frame = new MyFrame();
+
+  // Show it and tell the application that it's our main window
+  frame->Show(TRUE);
+  SetTopWindow(frame);
+
+  // success
+  return TRUE;
+}
+
+// --------------------------------------------------------------------------
+// main frame
+// --------------------------------------------------------------------------
+
+// frame constructor
+MyFrame::MyFrame() : wxFrame((wxFrame *)NULL, -1,
+                             _T("wxSocket demo: Client"),
+                             wxDefaultPosition, wxSize(300, 200))
+{
+  // Give the frame an icon
+  SetIcon(wxICON(mondrian));
+
+  // Make menus
+  m_menuFile = new wxMenu();
+  m_menuFile->Append(CLIENT_ABOUT, _T("&About...\tCtrl-A"), _T("Show about dialog"));
+  m_menuFile->AppendSeparator();
+  m_menuFile->Append(CLIENT_QUIT, _T("E&xit\tAlt-X"), _T("Quit client"));
+
+  m_menuSocket = new wxMenu();
+  m_menuSocket->Append(CLIENT_OPEN, _T("&Open session"), _T("Connect to server"));
+  m_menuSocket->AppendSeparator();
+  m_menuSocket->Append(CLIENT_TEST1, _T("Test &1"), _T("Test basic functionality"));
+  m_menuSocket->Append(CLIENT_TEST2, _T("Test &2"), _T("Test ReadMsg and WriteMsg"));
+  m_menuSocket->Append(CLIENT_TEST3, _T("Test &3"), _T("Test large data transfer"));
+  m_menuSocket->AppendSeparator();
+  m_menuSocket->Append(CLIENT_CLOSE, _T("&Close session"), _T("Close connection"));
+
+  // Append menus to the menubar
+  m_menuBar = new wxMenuBar();
+  m_menuBar->Append(m_menuFile, _T("&File"));
+  m_menuBar->Append(m_menuSocket, _T("&Socket"));
+  SetMenuBar(m_menuBar);
+
+  // Status bar
+  CreateStatusBar(2);
+
+  // Make a panel with a textctrl in it
+  m_panel = new wxPanel(this, -1, wxPoint(0, 0), GetClientSize());
+  m_text  = new wxTextCtrl(m_panel, -1,
+                           _T("Welcome to wxSocket demo: Client\n")
+                           _T("Client ready\n\n"),
+                           wxPoint(0, 0), m_panel->GetClientSize(),
+                           wxTE_MULTILINE | wxTE_READONLY);
+
+  // Create the socket
+  m_sock = new wxSocketClient();
+  m_sock->SetEventHandler(*this, SOCKET_ID);
+  m_sock->SetNotify(wxSOCKET_CONNECTION_FLAG |
+                    wxSOCKET_INPUT_FLAG |
+                    wxSOCKET_LOST_FLAG);
+  m_sock->Notify(TRUE);
+
+  m_busy = FALSE;
+  UpdateStatusBar();
+}
+
+MyFrame::~MyFrame()
+{
+  delete m_sock;
+}
+
+// event handlers
+
+void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
+{
+  // TRUE is to force the frame to close
+  Close(TRUE);
+}
+
+void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
+{
+  wxMessageBox(_T("wxSocket demo: Client\n")
+               _T("(c) 1999 Guillermo Rodriguez Garcia\n"),
+               _T("About Client"),
+               wxOK | wxICON_INFORMATION, this);
+}
+
+void MyFrame::OnOpenConnection(wxCommandEvent& WXUNUSED(event))
+{
+  wxIPV4address addr;
+
+  m_menuSocket->Enable(CLIENT_OPEN, FALSE);
+  m_menuSocket->Enable(CLIENT_CLOSE, FALSE);
+
+  // Ask server address
+  wxString hostname = wxGetTextFromUser(
+    _T("Enter the address of the wxSocket demo server:"),
+    _T("Connect ..."),
+    _T("localhost"));
+
+  addr.Hostname(hostname);
+  addr.Service(3000);
+
+  // Non-blocking connect
+  m_text->AppendText(_T("Trying to connect (timeout = 10 sec) ...\n"));
+  m_sock->Connect(addr, FALSE);
+  m_sock->WaitOnConnect(10);
+
+  if (m_sock->IsConnected())
+    m_text->AppendText(_T("Succeeded ! Connection established\n"));
+  else
+  {
+    m_sock->Close();
+    m_text->AppendText(_T("Failed ! Unable to connect\n"));
+    wxMessageBox(_T("Can't connect to the specified host"), _T("Alert !"));
+  }
+  
+  UpdateStatusBar();
+}
+
+void MyFrame::OnTest1(wxCommandEvent& WXUNUSED(event))
+{
+  char *buf1, *buf2;
+  char len;
+
+  // Disable socket menu entries (exception: Close Session)
+  m_busy = TRUE;
+  UpdateStatusBar();
+
+  m_text->AppendText(_T("\n=== Test 1 begins ===\n"));
+
+  // Tell the server which test we are running
+  char c = 0xBE;
+  m_sock->Write(&c, 1);
+
+  // Send some data and read it back. We know the size of the
+  // buffer, so we can specify the exact number of bytes to be
+  // sent or received and use the WAITALL flag. Also, we have
+  // disabled menu entries which could interfere with the test,
+  // so we can safely avoid the BLOCK (formerly SPEED) flag.
+  //
+  // First we send a byte with the length of the string, then
+  // we send the string itself (do NOT try to send any integral
+  // value larger than a byte "as is" acrosss the network, or
+  // you might be in trouble! Ever heard about big and little
+  // endian computers?)
+  //
+  m_sock->SetFlags(wxSOCKET_WAITALL);
+
+  buf1 = _T("Test string (less than 127 chars!)");
+  len  = wxStrlen(buf1) + 1;
+  buf2 = new char[len];
+
+  m_text->AppendText(_T("Sending a test buffer to the server ..."));
+  m_sock->Write(&len, 1);
+  m_sock->Write(buf1, len);
+  m_text->AppendText(m_sock->Error() ? _T("failed !\n") : _T("done\n"));
+
+  m_text->AppendText(_T("Receiving the buffer back from server ..."));
+  m_sock->Read(buf2, len);
+  m_text->AppendText(m_sock->Error() ? _T("failed !\n") : _T("done\n"));
+
+  m_text->AppendText(_T("Comparing the two buffers ..."));
+  if (memcmp(buf1, buf2, len) != 0)
+  {
+    m_text->AppendText(_T("failed!\n"));
+    m_text->AppendText(_T("Test 1 failed !\n"));
+  }
+  else
+  {
+    m_text->AppendText(_T("done\n"));
+    m_text->AppendText(_T("Test 1 passed !\n"));
+  }
+  m_text->AppendText(_T("=== Test 1 ends ===\n"));
+
+  delete[] buf2;
+  m_busy = FALSE;
+  UpdateStatusBar();
+}
+
+void MyFrame::OnTest2(wxCommandEvent& WXUNUSED(event))
+{
+  char *msg1;
+  char *msg2;
+  size_t len;
+
+  // Disable socket menu entries (exception: Close Session)
+  m_busy = TRUE;
+  UpdateStatusBar();
+
+  m_text->AppendText(_T("\n=== Test 2 begins ===\n"));
+
+  // Tell the server which test we are running
+  char c = 0xCE;
+  m_sock->Write(&c, 1);
+
+  // Here we use ReadMsg and WriteMsg to send messages with
+  // a header with size information. Also, the reception is
+  // event triggered, so we test input events as well.
+  //
+  // We need to set no flags here (ReadMsg and WriteMsg are
+  // not affected by flags)
+  //
+  m_sock->SetFlags(wxSOCKET_WAITALL);
+
+  wxString s = wxGetTextFromUser(
+    _T("Enter an arbitrary string to send to the server:"),
+    _T("Test 2 ..."),
+    _T("Yes I like wxWindows!"));
+
+  msg1 = (char *)s.c_str();
+  len  = wxStrlen(msg1) + 1;
+  msg2 = (char *)malloc(len);
+
+  m_text->AppendText(_T("Sending the string with WriteMsg ..."));
+  m_sock->WriteMsg(msg1, len);
+  m_text->AppendText(m_sock->Error() ? _T("failed !\n") : _T("done\n"));
+  m_text->AppendText(_T("Waiting for an event (timeout = 2 sec)\n"));
+
+  // Wait until data available (will also return if the connection is lost)
+  m_sock->WaitForRead(2);
+
+  if (m_sock->IsData())
+  {
+    m_text->AppendText(_T("Reading the string back with ReadMsg ..."));
+    m_sock->ReadMsg(msg2, len);
+    m_text->AppendText(m_sock->Error() ? _T("failed !\n") : _T("done\n"));
+    m_text->AppendText(_T("Comparing the two buffers ..."));
+    if (memcmp(msg1, msg2, len) != 0)
+    {
+      m_text->AppendText(_T("failed!\n"));  
+      m_text->AppendText(_T("Test 2 failed !\n"));
+    }
+    else
+    {
+      m_text->AppendText(_T("done\n"));
+      m_text->AppendText(_T("Test 2 passed !\n"));
+    }
+  }
+  else
+    m_text->AppendText(_T("Timeout ! Test 2 failed.\n"));
+
+  m_text->AppendText(_T("=== Test 2 ends ===\n"));
+
+  free(msg2);
+  m_busy = FALSE;
+  UpdateStatusBar();
+}
+
+void MyFrame::OnTest3(wxCommandEvent& WXUNUSED(event))
+{
+  m_text->AppendText(_T("\n=== Test 3 begins ===\n"));
+  m_text->AppendText(_T("Test 3 not implemented\n"));
+  m_text->AppendText(_T("=== Test 3 ends ===\n"));
+}
+
+void MyFrame::OnCloseConnection(wxCommandEvent& WXUNUSED(event))
+{
+  m_sock->Close();
+  UpdateStatusBar();
+}
+
+void MyFrame::OnSocketEvent(wxSocketEvent& event)
+{
+  wxString s = _T("OnSocketEvent: ");
+
+  switch(event.SocketEvent())
+  {
+    case wxSOCKET_INPUT      : s.Append(_T("wxSOCKET_INPUT\n")); break;
+    case wxSOCKET_LOST       : s.Append(_T("wxSOCKET_LOST\n")); break;
+    case wxSOCKET_CONNECTION : s.Append(_T("wxSOCKET_CONNECTION\n")); break;
+    default                  : s.Append(_T("Unexpected event !\n")); break;
+  }
+
+  m_text->AppendText(s);
+  UpdateStatusBar();
+}
+
+// convenience functions
+
+void MyFrame::UpdateStatusBar()
+{
+  wxString s;
+
+  if (!m_sock->IsConnected())
+  {
+    s.Printf(_T("Not connected"));
+  }
+  else
+  {
+    wxIPV4address addr;
+
+    m_sock->GetPeer(addr);
+    s.Printf(_T("%s : %d"), (addr.Hostname()).c_str(), addr.Service());
+  }
+
+  SetStatusText(s, 1);
+
+  m_menuSocket->Enable(CLIENT_OPEN, !m_sock->IsConnected() && !m_busy);
+  m_menuSocket->Enable(CLIENT_TEST1, m_sock->IsConnected() && !m_busy);
+  m_menuSocket->Enable(CLIENT_TEST2, m_sock->IsConnected() && !m_busy);
+  m_menuSocket->Enable(CLIENT_TEST3, m_sock->IsConnected() && !m_busy);
+  m_menuSocket->Enable(CLIENT_CLOSE, m_sock->IsConnected());
+}
diff --git a/samples/sockets/client.def b/samples/sockets/client.def
new file mode 100644 (file)
index 0000000..786b7d6
--- /dev/null
@@ -0,0 +1,8 @@
+NAME         Client
+DESCRIPTION  'Client'
+EXETYPE      WINDOWS
+STUB         'WINSTUB.EXE'
+CODE         PRELOAD MOVEABLE DISCARDABLE
+DATA         PRELOAD MOVEABLE MULTIPLE
+HEAPSIZE     1024
+STACKSIZE    8192
diff --git a/samples/sockets/client.g95 b/samples/sockets/client.g95
new file mode 100644 (file)
index 0000000..260c61c
--- /dev/null
@@ -0,0 +1,16 @@
+#
+# File:         makefile.g95
+# Author:       Julian Smart
+# Created:      1999
+# Updated:
+# Copyright:    (c) Julian Smart, 1999
+#
+# Makefile for wxWindows sample (Cygwin/Mingw32).
+
+WXDIR = ../..
+
+TARGET=client
+OBJECTS = $(TARGET).o
+
+include $(WXDIR)/src/makeprog.g95
+
diff --git a/samples/sockets/client.rc b/samples/sockets/client.rc
new file mode 100644 (file)
index 0000000..f1579f6
--- /dev/null
@@ -0,0 +1,3 @@
+mondrian ICON mondrian.ico
+conn_icn ICON connect.ico
+#include "wx/msw/wx.rc"
diff --git a/samples/sockets/client.vc b/samples/sockets/client.vc
new file mode 100644 (file)
index 0000000..9cfde26
--- /dev/null
@@ -0,0 +1,18 @@
+#
+# File:                makefile.vc
+# Author:      Julian Smart
+# Created:     1999
+# Updated:     
+# Copyright:   (c) Julian Smart
+#
+# Makefile : Builds sample (VC++, WIN32)
+# Use FINAL=1 argument to nmake to build final version with no debug info.
+
+# Set WXDIR for your system
+WXDIR = $(WXWIN)
+
+PROGRAM=client
+OBJECTS = $(PROGRAM).obj
+
+!include $(WXDIR)\src\makeprog.vc
+
diff --git a/samples/sockets/client.wat b/samples/sockets/client.wat
new file mode 100644 (file)
index 0000000..789db64
--- /dev/null
@@ -0,0 +1,15 @@
+#
+# Makefile for WATCOM
+#
+# Created by Julian Smart, January 1999
+# 
+#
+
+WXDIR = $(%WXWIN)
+
+PROGRAM = client
+OBJECTS = $(PROGRAM).obj
+
+!include $(WXDIR)\src\makeprog.wat
+
+
diff --git a/samples/sockets/connect.ico b/samples/sockets/connect.ico
new file mode 100644 (file)
index 0000000..74f006f
Binary files /dev/null and b/samples/sockets/connect.ico differ
diff --git a/samples/sockets/makefile.b32 b/samples/sockets/makefile.b32
new file mode 100644 (file)
index 0000000..94a0ed2
--- /dev/null
@@ -0,0 +1,82 @@
+#
+# File:                makefile.b32
+# Author:      Guilhem Lavaux
+# Created:     1998
+# Updated:     
+# Copyright:   (c) Guilhem Lavaux
+#
+# "%W% %G%"
+#
+# Makefile : Builds 32-bit wxSocket sample under BC++
+
+WXDIR = $(WXWIN)
+
+ZLIB = $(WXDIR)\lib\zlib.lib
+
+!include $(WXDIR)\src\makeb32.env
+
+WXLIBDIR = $(WXDIR)\lib
+WXINC = $(WXDIR)\include\msw
+WXLIB = $(WXLIBDIR)\wx32.lib
+LIBS=$(WXLIB) $(ZLIB) cw32 import32 ole2w32
+
+!if "$(FINAL)" == "0"
+LINKFLAGS=/v /Tpe /L$(WXLIBDIR);$(BCCDIR)\lib
+OPT = -Od
+DEBUG_FLAGS= -v
+!else
+LINKFLAGS=/Tpe /L$(WXLIBDIR);$(BCCDIR)\lib
+OPT = -Od
+DEBUG_FLAGS =
+!endif
+CPPFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG)
+
+.$(SRCSUFF).obj:
+       bcc32 $(CPPFLAGS) -c {$< }
+
+.c.obj:
+       bcc32 $(CPPFLAGS) -P- -c {$< }
+
+CLIENT_TARGET=client
+SERVER_TARGET=server
+CLIENT_OBJECTS=client.obj
+SERVER_OBJECTS=server.obj
+
+all:    $(CLIENT_TARGET).exe $(SERVER_TARGET).exe
+
+$(CLIENT_TARGET).exe:   $(CLIENT_OBJECTS) $(CLIENT_TARGET).res
+  tlink32 $(LINKFLAGS) @&&!
+  c0w32.obj $(CLIENT_OBJECTS)
+  $(CLIENT_TARGET)
+  nul
+  $(LIBS)
+  $(CLIENT_TARGET).def
+  $(CLIENT_TARGET).res
+!
+
+client.obj:     client.cpp
+
+$(CLIENT_TARGET).res :      $(CLIENT_TARGET).rc $(WXDIR)\include\wx\msw\wx.rc
+    brc32 -r /i$(BCCDIR)\include /i$(WXDIR)\include $(CLIENT_TARGET)
+
+$(SERVER_TARGET).exe:   $(SERVER_OBJECTS) $(SERVER_TARGET).res
+  tlink32 $(LINKFLAGS) @&&!
+  c0w32.obj $(SERVER_OBJECTS)
+  $(SERVER_TARGET)
+  nul
+  $(LIBS)
+  $(SERVER_TARGET).def
+  $(SERVER_TARGET).res
+!
+
+server.obj:     server.cpp
+
+$(SERVER_TARGET).res:   $(SERVER_TARGET).rc $(WXDIR)\include\wx\msw\wx.rc
+    brc32 -r /i$(BCCDIR)\include /i$(WXDIR)\include $(SERVER_TARGET)
+
+clean:
+        -erase *.obj
+        -erase *.exe
+        -erase *.res
+        -erase *.map
+        -erase *.rws
diff --git a/samples/sockets/makefile.dos b/samples/sockets/makefile.dos
new file mode 100644 (file)
index 0000000..2a42833
--- /dev/null
@@ -0,0 +1,19 @@
+#
+# File:                makefile.dos
+# Author:      Julian Smart
+# Created:     1998
+# Updated:     
+#
+# Makefile : Builds 16-bit sample, VC++ 1.5
+# Use FINAL=1 argument to nmake to build final version with no debugging
+# info
+
+WXDIR = $(WXWIN)
+
+TARGET=client
+OBJECTS = $(TARGET).obj
+
+# TODO: server
+
+!include $(WXDIR)\src\makeprog.msc
+
diff --git a/samples/sockets/makefile.g95 b/samples/sockets/makefile.g95
new file mode 100644 (file)
index 0000000..4d1b598
--- /dev/null
@@ -0,0 +1,46 @@
+#
+# File:                makefile.unx
+# Author:      Julian Smart
+# Created:     1993
+# Updated:     
+# Copyright:   (c) 1993, AIAI, University of Edinburgh
+#
+# "%W% %G%"
+#
+# Makefile for server/client example (UNIX).
+
+WXDIR = ../..
+
+# All common UNIX compiler flags and options are now in
+# this central makefile.
+include $(WXDIR)/src/makeg95.env
+
+OBJECTS=$(OBJDIR)/server.$(OBJSUFF) $(OBJDIR)/server_resources.$(OBJSUFF)\
+ $(OBJDIR)/client.$(OBJSUFF) $(OBJDIR)/client_resources.$(OBJSUFF)
+
+all:   $(OBJDIR) server$(GUISUFFIX) client$(GUISUFFIX)
+
+
+$(OBJDIR):
+       mkdir $(OBJDIR)
+
+server$(GUISUFFIX): $(OBJDIR)/server.$(OBJSUFF) $(OBJDIR)/server_resources.$(OBJSUFF) $(WXLIB)
+       $(CC) $(LDFLAGS) -o server$(GUISUFFIX)$(EXESUFF) $(OBJDIR)/server.$(OBJSUFF) $(OBJDIR)/server_resources.$(OBJSUFF) $(LDLIBS)
+
+$(OBJDIR)/server.$(OBJSUFF):        server.$(SRCSUFF)
+       $(CC) -c $(CPPFLAGS) -o $@ server.$(SRCSUFF)
+
+client$(GUISUFFIX): $(OBJDIR)/client.$(OBJSUFF) $(OBJDIR)/client_resources.$(OBJSUFF) $(WXLIB)
+       $(CC) $(LDFLAGS) -o client$(GUISUFFIX)$(EXESUFF) $(OBJDIR)/client.$(OBJSUFF) $(OBJDIR)/client_resources.$(OBJSUFF) $(LDLIBS)
+
+$(OBJDIR)/client.$(OBJSUFF):        client.$(SRCSUFF)
+       $(CC) -c $(CPPFLAGS) -o $@ client.$(SRCSUFF)
+        
+$(OBJDIR)/server_resources.o:  server.rc
+       $(RESCOMP) -i server.rc -o $(OBJDIR)/server_resources.o $(RESFLAGS)
+
+$(OBJDIR)/client_resources.o:  client.rc
+       $(RESCOMP) -i client.rc -o $(OBJDIR)/client_resources.o $(RESFLAGS)
+
+clean:
+       rm -f $(OBJECTS) server$(GUISUFFIX).exe client$(GUISUFFIX).exe core *.rsc *.res
diff --git a/samples/sockets/makefile.vc b/samples/sockets/makefile.vc
new file mode 100644 (file)
index 0000000..3864d7d
--- /dev/null
@@ -0,0 +1,20 @@
+#
+# File:                makefile.vc
+# Author:      Julian Smart
+# Created:     1999
+# Updated:     
+# Copyright:   (c) Julian Smart
+#
+# Makefile : Builds sample (VC++, WIN32)
+# Use FINAL=1 argument to nmake to build final version with no debug info.
+
+!include $(WXWIN)/src/makevc.env
+
+all:
+    nmake -f server.vc FINAL=$(FINAL)
+    nmake -f client.vc FINAL=$(FINAL)
+
+clean:
+    nmake -f server.vc clean
+    nmake -f client.vc clean
+
diff --git a/samples/sockets/mondrian.ico b/samples/sockets/mondrian.ico
new file mode 100644 (file)
index 0000000..2310c5d
Binary files /dev/null and b/samples/sockets/mondrian.ico differ
diff --git a/samples/sockets/mondrian.xpm b/samples/sockets/mondrian.xpm
new file mode 100644 (file)
index 0000000..409f27a
--- /dev/null
@@ -0,0 +1,44 @@
+/* XPM */
+static char *mondrian_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"32 32 6 1",
+"  c Black",
+". c Blue",
+"X c #00bf00",
+"o c Red",
+"O c Yellow",
+"+ c Gray100",
+/* pixels */
+"                                ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+"                                ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++      ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++                    ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+"                                "
+};
diff --git a/samples/sockets/server.cpp b/samples/sockets/server.cpp
new file mode 100644 (file)
index 0000000..817c156
--- /dev/null
@@ -0,0 +1,382 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        server.cpp
+// Purpose:     Server for wxSocket demo
+// Author:      Guillermo Rodriguez Garcia <guille@iies.es>
+// Modified by:
+// Created:     1999/09/19
+// RCS-ID:      $Id$
+// Copyright:   (c) 1999 Guillermo Rodriguez Garcia
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// ==========================================================================
+// declarations
+// ==========================================================================
+
+// --------------------------------------------------------------------------
+// headers
+// --------------------------------------------------------------------------
+
+#ifdef __GNUG__
+#  pragma implementation "server.cpp"
+#  pragma interface "server.cpp"
+#endif
+
+// For compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#  pragma hdrstop
+#endif
+
+// for all others, include the necessary headers 
+#ifndef WX_PRECOMP
+#  include "wx/wx.h"
+#endif
+
+#include "wx/socket.h"
+
+// --------------------------------------------------------------------------
+// resources
+// --------------------------------------------------------------------------
+
+// the application icon
+#if defined(__WXGTK__) || defined(__WXMOTIF__)
+#  include "mondrian.xpm"
+#endif
+
+// --------------------------------------------------------------------------
+// classes
+// --------------------------------------------------------------------------
+
+// Define a new application type
+class MyApp : public wxApp
+{
+public:
+  virtual bool OnInit();
+};
+
+// Define a new frame type: this is going to be our main frame
+class MyFrame : public wxFrame
+{
+public:
+  MyFrame();
+  ~MyFrame();
+
+  // event handlers (these functions should _not_ be virtual)
+  void OnQuit(wxCommandEvent& event);
+  void OnAbout(wxCommandEvent& event);
+  void OnServerEvent(wxSocketEvent& event);
+  void OnSocketEvent(wxSocketEvent& event);
+
+  void Test1(wxSocketBase *sock);
+  void Test2(wxSocketBase *sock);
+  void Test3(wxSocketBase *sock);
+
+  // convenience functions
+  void UpdateStatusBar();
+
+private:
+  wxSocketServer *m_server;
+  wxPanel        *m_panel;
+  wxTextCtrl     *m_text;
+  wxMenu         *m_menuFile;
+  wxMenuBar      *m_menuBar;
+  bool            m_busy;
+  int             m_numClients;
+
+  // any class wishing to process wxWindows events must use this macro
+  DECLARE_EVENT_TABLE()
+};
+
+// --------------------------------------------------------------------------
+// constants
+// --------------------------------------------------------------------------
+
+// IDs for the controls and the menu commands
+enum
+{
+  // menu items
+  SERVER_QUIT = 1000,
+  SERVER_ABOUT,
+
+  // id for sockets
+  SERVER_ID,
+  SOCKET_ID
+};
+
+// --------------------------------------------------------------------------
+// event tables and other macros for wxWindows
+// --------------------------------------------------------------------------
+
+BEGIN_EVENT_TABLE(MyFrame, wxFrame)
+  EVT_MENU(SERVER_QUIT,  MyFrame::OnQuit)
+  EVT_MENU(SERVER_ABOUT, MyFrame::OnAbout)
+  EVT_SOCKET(SERVER_ID,  MyFrame::OnServerEvent)
+  EVT_SOCKET(SOCKET_ID,  MyFrame::OnSocketEvent)
+END_EVENT_TABLE()
+
+IMPLEMENT_APP(MyApp)
+
+
+// To append sockets for delayed deletion
+extern wxList wxPendingDelete;
+
+
+// ==========================================================================
+// implementation
+// ==========================================================================
+
+// --------------------------------------------------------------------------
+// the application class
+// --------------------------------------------------------------------------
+
+bool MyApp::OnInit()
+{
+  // Create the main application window
+  MyFrame *frame = new MyFrame();
+
+  // Show it and tell the application that it's our main window
+  frame->Show(TRUE);
+  SetTopWindow(frame);
+
+  // success
+  return TRUE;
+}
+
+// --------------------------------------------------------------------------
+// main frame
+// --------------------------------------------------------------------------
+
+// frame constructor
+MyFrame::MyFrame() : wxFrame((wxFrame *)NULL, -1,
+                             _T("wxSocket demo: Server"),
+                             wxDefaultPosition, wxSize(300, 200))
+{
+  // Give the frame an icon
+  SetIcon(wxICON(mondrian));
+
+  // Make menus
+  m_menuFile = new wxMenu();
+  m_menuFile->Append(SERVER_ABOUT, _T("&About...\tCtrl-A"), _T("Show about dialog"));
+  m_menuFile->AppendSeparator();
+  m_menuFile->Append(SERVER_QUIT, _T("E&xit\tAlt-X"), _T("Quit server"));
+
+  // Append menus to the menubar
+  m_menuBar = new wxMenuBar();
+  m_menuBar->Append(m_menuFile, _T("&File"));
+  SetMenuBar(m_menuBar);
+
+  // Status bar
+  CreateStatusBar(2);
+
+  // Make a panel with a textctrl in it
+  m_panel = new wxPanel(this, -1, wxPoint(0, 0), GetClientSize());
+  m_text  = new wxTextCtrl(m_panel, -1,
+                           _T("Welcome to wxSocket demo: Server\n"),
+                           wxPoint(0, 0), m_panel->GetClientSize(),
+                           wxTE_MULTILINE | wxTE_READONLY);
+
+  // Create the socket
+  wxIPV4address addr;
+  addr.Service(3000);
+  addr.LocalHost();
+
+  m_server = new wxSocketServer(addr);
+  m_server->SetEventHandler(*this, SERVER_ID);
+  m_server->SetNotify(wxSOCKET_CONNECTION_FLAG);
+  m_server->Notify(TRUE);
+
+  // We use Ok() here to see if the server is really listening
+  if (m_server->Ok())
+    m_text->AppendText(_T("Server listening.\n\n"));
+  else
+    m_text->AppendText(_T("Could not listen at the specified port !\n\n"));
+
+  m_busy = FALSE;
+  m_numClients = 0;
+  UpdateStatusBar();
+}
+
+MyFrame::~MyFrame()
+{
+  delete m_server;
+}
+
+// event handlers
+
+void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
+{
+  // TRUE is to force the frame to close
+  Close(TRUE);
+}
+
+void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
+{
+  wxMessageBox(_T("wxSocket demo: Server\n")
+               _T("(c) 1999 Guillermo Rodriguez Garcia\n"),
+               _T("About Server"),
+               wxOK | wxICON_INFORMATION, this);
+}
+
+void MyFrame::Test1(wxSocketBase *sock)
+{
+  unsigned char len;
+  char *buf;
+
+  m_text->AppendText(_T("Test 1 begins\n"));
+
+  // Receive data from socket and send it back. We will first
+  // get a byte with the buffer size, so we can specify the
+  // exact size and use the WAITALL flag. Also, we disabled
+  // input events so we won't have unwanted reentrance. This
+  // way we can avoid the infamous BLOCK (formerly SPEED) flag.
+  //
+  sock->SetFlags(wxSOCKET_WAITALL);
+
+  sock->Read((char *)&len, 1);
+
+  buf = (char *)malloc(len);
+  sock->Read(buf, len);
+  sock->Write(buf, len);
+  free(buf);
+
+  m_text->AppendText(_T("Test 1 ends\n"));
+}
+
+void MyFrame::Test2(wxSocketBase *sock)
+{
+#define MAX_MSG_SIZE 10000
+
+  wxString s;
+  char *buf = (char *)malloc(MAX_MSG_SIZE);
+  wxUint32 len;
+
+  m_text->AppendText(_T("Test 2 begins\n"));
+
+  // We don't need to set flags because ReadMsg and WriteMsg
+  // are not affected by them anyway.
+  //
+  len = sock->ReadMsg(buf, MAX_MSG_SIZE).LastCount();
+
+  s.Printf(_T("Client says: %s\n"), buf);
+  m_text->AppendText(s);
+
+  sock->WriteMsg(buf, len);
+  free(buf);
+
+  m_text->AppendText(_T("Test 2 ends\n"));
+
+#undef MAX_MSG_SIZE
+}
+
+void MyFrame::Test3(wxSocketBase *sock)
+{
+  m_text->AppendText(_T("Test 3 begins\n"));
+  m_text->AppendText(_T("(not implemented)\n"));
+  m_text->AppendText(_T("Test 3 ends\n"));
+}
+
+void MyFrame::OnServerEvent(wxSocketEvent& event)
+{
+  wxString s = _T("OnServerEvent: ");
+  wxSocketBase *sock;
+
+  switch(event.SocketEvent())
+  {
+    case wxSOCKET_CONNECTION : s.Append(_T("wxSOCKET_CONNECTION\n")); break;
+    default                  : s.Append(_T("Unexpected event !\n")); break;
+  }
+
+  m_text->AppendText(s);
+
+  // Accept new connection if there is one in the pending
+  // connections queue, else exit. We use Accept(FALSE) for
+  // non-blocking accept (although if we got here, there
+  // should ALWAYS be a pending connection).
+  //
+  sock = m_server->Accept(FALSE);
+
+  if (sock)
+  {
+    m_text->AppendText(_T("New client connection accepted\n"));
+  }
+  else
+  {
+    m_text->AppendText(_T("Error: couldn't accept a new connection"));
+    return;
+  }
+
+  sock->SetEventHandler(*this, SOCKET_ID);
+  sock->SetNotify(wxSOCKET_INPUT_FLAG | wxSOCKET_LOST_FLAG);
+  sock->Notify(TRUE);
+
+  m_numClients++;
+  UpdateStatusBar();
+}
+
+void MyFrame::OnSocketEvent(wxSocketEvent& event)
+{
+  wxSocketBase *sock = event.Socket();
+  wxString s = _T("OnSocketEvent: ");
+
+  // We first print a msg
+  switch(event.SocketEvent())
+  {
+    case wxSOCKET_INPUT: s.Append(_T("wxSOCKET_INPUT\n")); break;
+    case wxSOCKET_LOST:  s.Append(_T("wxSOCKET_LOST\n")); break;
+    default:             s.Append(_T("unexpected event !\n"));
+  }
+
+  m_text->AppendText(s);
+
+  // Now we process the event
+  switch(event.SocketEvent())
+  {
+    case wxSOCKET_INPUT:
+    {
+      // We disable input events, so that the test doesn't trigger
+      // wxSocketEvent again.
+      sock->SetNotify(wxSOCKET_LOST_FLAG);
+
+      // Which test are we going to run?
+      unsigned char c;
+      sock->Read((char *)&c ,1);
+
+      switch (c)
+      {
+        case 0xBE: Test1(sock); break;
+        case 0xCE: Test2(sock); break;
+        case 0xDE: Test3(sock); break;
+        default: s.Append(_T("Unknown test id received from client\n"));
+      }
+
+      // Enable input events again.
+      sock->SetNotify(wxSOCKET_LOST_FLAG | wxSOCKET_INPUT_FLAG);
+      break;
+    }
+    case wxSOCKET_LOST:
+    {
+      m_numClients--;
+
+      // We cannot delete the socket right now because we can
+      // be in the middle of a test or something. So we append
+      // it to the list of objects to be deleted.
+      m_text->AppendText(_T("Deleting socket.\n"));
+      wxPendingDelete.Append(sock);
+      break;
+    }
+    default: ;
+  }
+
+  UpdateStatusBar();
+}
+
+// convenience functions
+
+void MyFrame::UpdateStatusBar()
+{
+  wxString s;
+  s.Printf(_T("%d clients connected"), m_numClients);
+  SetStatusText(s, 1);
+}
diff --git a/samples/sockets/server.def b/samples/sockets/server.def
new file mode 100644 (file)
index 0000000..21027a5
--- /dev/null
@@ -0,0 +1,8 @@
+NAME         Server
+DESCRIPTION  'Server'
+EXETYPE      WINDOWS
+STUB         'WINSTUB.EXE'
+CODE         PRELOAD MOVEABLE DISCARDABLE
+DATA         PRELOAD MOVEABLE MULTIPLE
+HEAPSIZE     4096
+STACKSIZE    8192
diff --git a/samples/sockets/server.g95 b/samples/sockets/server.g95
new file mode 100644 (file)
index 0000000..48e622c
--- /dev/null
@@ -0,0 +1,16 @@
+#
+# File:         makefile.g95
+# Author:       Julian Smart
+# Created:      1999
+# Updated:
+# Copyright:    (c) Julian Smart, 1999
+#
+# Makefile for wxWindows sample (Cygwin/Mingw32).
+
+WXDIR = ../..
+
+TARGET=server
+OBJECTS = $(TARGET).o
+
+include $(WXDIR)/src/makeprog.g95
+
diff --git a/samples/sockets/server.rc b/samples/sockets/server.rc
new file mode 100644 (file)
index 0000000..b289ec6
--- /dev/null
@@ -0,0 +1,4 @@
+mondrian ICON "mondrian.ico"
+conn_icn ICON "connect.ico"
+#include "wx/msw/wx.rc"
+
diff --git a/samples/sockets/server.vc b/samples/sockets/server.vc
new file mode 100644 (file)
index 0000000..fdb3bce
--- /dev/null
@@ -0,0 +1,18 @@
+#
+# File:                makefile.vc
+# Author:      Julian Smart
+# Created:     1999
+# Updated:     
+# Copyright:   (c) Julian Smart
+#
+# Makefile : Builds sample (VC++, WIN32)
+# Use FINAL=1 argument to nmake to build final version with no debug info.
+
+# Set WXDIR for your system
+WXDIR = $(WXWIN)
+
+PROGRAM=server
+OBJECTS = $(PROGRAM).obj
+
+!include $(WXDIR)\src\makeprog.vc
+
diff --git a/samples/sockets/server.wat b/samples/sockets/server.wat
new file mode 100644 (file)
index 0000000..2acfdf1
--- /dev/null
@@ -0,0 +1,15 @@
+#
+# Makefile for WATCOM
+#
+# Created by Julian Smart, January 1999
+# 
+#
+
+WXDIR = $(%WXWIN)
+
+PROGRAM = server
+OBJECTS = $(PROGRAM).obj
+
+!include $(WXDIR)\src\makeprog.wat
+
+
diff --git a/samples/wxpoem/.cvsignore b/samples/wxpoem/.cvsignore
deleted file mode 100644 (file)
index 8b13789..0000000
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/samples/wxpoem/Makefile.in b/samples/wxpoem/Makefile.in
deleted file mode 100644 (file)
index eed4736..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# File:                makefile.unx
-# Author:      Julian Smart
-# Created:     1998
-# Updated:     
-# Copyright:   (c) 1998 Julian Smart
-#
-# "%W% %G%"
-#
-# Makefile for wxPoem example (UNIX).
-
-top_srcdir = @top_srcdir@
-top_builddir = ../..
-program_dir = samples/wxpoem
-
-DATAFILES = wxpoem.txt wxpoem.dat
-
-PROGRAM=wxpoem
-
-OBJECTS=$(PROGRAM).o
-
-include ../../src/makeprog.env
-
diff --git a/samples/wxpoem/corner1.ico b/samples/wxpoem/corner1.ico
deleted file mode 100644 (file)
index 35de002..0000000
Binary files a/samples/wxpoem/corner1.ico and /dev/null differ
diff --git a/samples/wxpoem/corner1.xpm b/samples/wxpoem/corner1.xpm
deleted file mode 100644 (file)
index 97037e0..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/* XPM */
-static char * corner1_xpm[] = {
-/* width height ncolors chars_per_pixel */
-"32 32 4 1",
-/* colors */
-"      s None  c None",
-".     c #000000",
-"+     c #808080",
-"@     c #c0c0c0",
-/* pixels */
-"............................    ",
-"...++..++++++++++++++++++....   ",
-".+..++...@@@@@@@+++++++++++...  ",
-".@+..+++...@@@@@@@@@@++++++++.. ",
-".@++..@+++...@@@@@@@@@@@@+++++. ",
-"..@++..@++++...@@@@@@@@@@@@+++..",
-"..@@++..@@++++...@@@@@@@@@@@+++.",
-".+.@@++..@@@++++...@@@@@@@@@@++.",
-".+.@@+++..@@@@++++...@@@@@@@@@+.",
-".++.@@+++..@@@@@+++++...@@@@@@..",
-".++..@@+++..@@@@@@+++++...@@@.. ",
-".@++.@@@+++..@@@@@@@+++++...... ",
-".@++..@@@+++..@@@@@@@@+++++...  ",
-".@+++.@@@++++..@@@@@@@@@+++++.. ",
-".@@++..@@@++++..@@@@@@@@@+++++. ",
-".@@+++.@@@@++++..@@@@@@@@@@+++..",
-".@@@++..@@@@++++..@@@@@@@@@@+++.",
-".@@@+++.@@@@@++++..@@@@@@@@@@++.",
-".@@@@++..@@@@@++++..@@@@@@@@@@+.",
-".@@@@+++..@@@@+++++..@@@@@@@@@+.",
-".@@@@++++.@@@@@+++++..@@@@@@@@. ",
-".@@@@@+++..@@@@@+++++..@@@@@@@. ",
-".@@@@@++++.@@@@@@+++++..@@@@@.  ",
-".@@@@@@+++..@@@@@@+++++..@@..   ",
-".@@@@@@++++.@@@@@@++++++...     ",
-".@@@@@@@+++..@@@@@@++++++.      ",
-".@@@@@@@++++..@@@@@@+++++.      ",
-".@@@@@@@@++++.@@@@@@@+++.       ",
-"..@@@@@@@++++..@@@@@++++.       ",
-" ..@@@@@++++++.@@@@+++..        ",
-"   ..++++++++....+++..          ",
-"     ........   ....            "};
diff --git a/samples/wxpoem/corner2.ico b/samples/wxpoem/corner2.ico
deleted file mode 100644 (file)
index a1d58d8..0000000
Binary files a/samples/wxpoem/corner2.ico and /dev/null differ
diff --git a/samples/wxpoem/corner2.xpm b/samples/wxpoem/corner2.xpm
deleted file mode 100644 (file)
index ba1b120..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/* XPM */
-static char * corner2_xpm[] = {
-/* width height ncolors chars_per_pixel */
-"32 32 4 1",
-/* colors */
-"      s None  c None",
-".     c #000000",
-"+     c #c0c0c0",
-"@     c #808080",
-/* pixels */
-"    ............................",
-"   ....++++++++++++++++++..++...",
-"  ...+++++++++++@@@@@@@...++..+.",
-" ..++++++++@@@@@@@@@@...+++..+@.",
-" .+++++@@@@@@@@@@@@...+++@..++@.",
-"..+++@@@@@@@@@@@@...++++@..++@..",
-".+++@@@@@@@@@@@...++++@@..++@@..",
-".++@@@@@@@@@@...++++@@@..++@@.+.",
-".+@@@@@@@@@...++++@@@@..+++@@.+.",
-"..@@@@@@...+++++@@@@@..+++@@.++.",
-" ..@@@...+++++@@@@@@..+++@@..++.",
-" ......+++++@@@@@@@..+++@@@.++@.",
-"  ...+++++@@@@@@@@..+++@@@..++@.",
-" ..+++++@@@@@@@@@..++++@@@.+++@.",
-" .+++++@@@@@@@@@..++++@@@..++@@.",
-"..+++@@@@@@@@@@..++++@@@@.+++@@.",
-".+++@@@@@@@@@@..++++@@@@..++@@@.",
-".++@@@@@@@@@@..++++@@@@@.+++@@@.",
-".+@@@@@@@@@@..++++@@@@@..++@@@@.",
-".+@@@@@@@@@..+++++@@@@..+++@@@@.",
-" .@@@@@@@@..+++++@@@@@.++++@@@@.",
-" .@@@@@@@..+++++@@@@@..+++@@@@@.",
-"  .@@@@@..+++++@@@@@@.++++@@@@@.",
-"   ..@@..+++++@@@@@@..+++@@@@@@.",
-"     ...++++++@@@@@@.++++@@@@@@.",
-"      .++++++@@@@@@..+++@@@@@@@.",
-"      .+++++@@@@@@..++++@@@@@@@.",
-"       .+++@@@@@@@.++++@@@@@@@@.",
-"       .++++@@@@@..++++@@@@@@@..",
-"        ..+++@@@@.++++++@@@@@.. ",
-"          ..+++....++++++++..   ",
-"            ....   ........     "};
diff --git a/samples/wxpoem/corner3.ico b/samples/wxpoem/corner3.ico
deleted file mode 100644 (file)
index 201fb98..0000000
Binary files a/samples/wxpoem/corner3.ico and /dev/null differ
diff --git a/samples/wxpoem/corner3.xpm b/samples/wxpoem/corner3.xpm
deleted file mode 100644 (file)
index 14c0446..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/* XPM */
-static char * corner3_xpm[] = {
-/* width height ncolors chars_per_pixel */
-"32 32 4 1",
-/* colors */
-"      s None  c None",
-".     c #000000",
-"+     c #c0c0c0",
-"@     c #808080",
-/* pixels */
-"     ........   ....            ",
-"   ..++++++++....+++..          ",
-" ..@@@@@++++++.@@@@+++..        ",
-"..@@@@@@@++++..@@@@@++++.       ",
-".@@@@@@@@++++.@@@@@@@+++.       ",
-".@@@@@@@++++..@@@@@@+++++.      ",
-".@@@@@@@+++..@@@@@@++++++.      ",
-".@@@@@@++++.@@@@@@++++++...     ",
-".@@@@@@+++..@@@@@@+++++..@@..   ",
-".@@@@@++++.@@@@@@+++++..@@@@@.  ",
-".@@@@@+++..@@@@@+++++..@@@@@@@. ",
-".@@@@++++.@@@@@+++++..@@@@@@@@. ",
-".@@@@+++..@@@@+++++..@@@@@@@@@+.",
-".@@@@++..@@@@@++++..@@@@@@@@@@+.",
-".@@@+++.@@@@@++++..@@@@@@@@@@++.",
-".@@@++..@@@@++++..@@@@@@@@@@+++.",
-".@@+++.@@@@++++..@@@@@@@@@@+++..",
-".@@++..@@@++++..@@@@@@@@@+++++. ",
-".@+++.@@@++++..@@@@@@@@@+++++.. ",
-".@++..@@@+++..@@@@@@@@+++++...  ",
-".@++.@@@+++..@@@@@@@+++++...... ",
-".++..@@+++..@@@@@@+++++...@@@.. ",
-".++.@@+++..@@@@@+++++...@@@@@@..",
-".+.@@+++..@@@@++++...@@@@@@@@@+.",
-".+.@@++..@@@++++...@@@@@@@@@@++.",
-"..@@++..@@++++...@@@@@@@@@@@+++.",
-"..@++..@++++...@@@@@@@@@@@@+++..",
-".@++..@+++...@@@@@@@@@@@@+++++. ",
-".@+..+++...@@@@@@@@@@++++++++.. ",
-".+..++...@@@@@@@+++++++++++...  ",
-"...++..++++++++++++++++++....   ",
-"............................    "};
diff --git a/samples/wxpoem/corner4.ico b/samples/wxpoem/corner4.ico
deleted file mode 100644 (file)
index 4af6753..0000000
Binary files a/samples/wxpoem/corner4.ico and /dev/null differ
diff --git a/samples/wxpoem/corner4.xpm b/samples/wxpoem/corner4.xpm
deleted file mode 100644 (file)
index f84a27a..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/* XPM */
-static char * corner4_xpm[] = {
-/* width height ncolors chars_per_pixel */
-"32 32 4 1",
-/* colors */
-"      s None  c None",
-".     c #000000",
-"+     c #c0c0c0",
-"@     c #808080",
-/* pixels */
-"            ....   ........     ",
-"          ..+++....++++++++..   ",
-"        ..+++@@@@.++++++@@@@@.. ",
-"       .++++@@@@@..++++@@@@@@@..",
-"       .+++@@@@@@@.++++@@@@@@@@.",
-"      .+++++@@@@@@..++++@@@@@@@.",
-"      .++++++@@@@@@..+++@@@@@@@.",
-"     ...++++++@@@@@@.++++@@@@@@.",
-"   ..@@..+++++@@@@@@..+++@@@@@@.",
-"  .@@@@@..+++++@@@@@@.++++@@@@@.",
-" .@@@@@@@..+++++@@@@@..+++@@@@@.",
-" .@@@@@@@@..+++++@@@@@.++++@@@@.",
-".+@@@@@@@@@..+++++@@@@..+++@@@@.",
-".+@@@@@@@@@@..++++@@@@@..++@@@@.",
-".++@@@@@@@@@@..++++@@@@@.+++@@@.",
-".+++@@@@@@@@@@..++++@@@@..++@@@.",
-"..+++@@@@@@@@@@..++++@@@@.+++@@.",
-" .+++++@@@@@@@@@..++++@@@..++@@.",
-" ..+++++@@@@@@@@@..++++@@@.+++@.",
-"  ...+++++@@@@@@@@..+++@@@..++@.",
-" ......+++++@@@@@@@..+++@@@.++@.",
-" ..@@@...+++++@@@@@@..+++@@..++.",
-"..@@@@@@...+++++@@@@@..+++@@.++.",
-".+@@@@@@@@@...++++@@@@..+++@@.+.",
-".++@@@@@@@@@@...++++@@@..++@@.+.",
-".+++@@@@@@@@@@@...++++@@..++@@..",
-"..+++@@@@@@@@@@@@...++++@..++@..",
-" .+++++@@@@@@@@@@@@...+++@..++@.",
-" ..++++++++@@@@@@@@@@...+++..+@.",
-"  ...+++++++++++@@@@@@@...++..+.",
-"   ....++++++++++++++++++..++...",
-"    ............................"};
diff --git a/samples/wxpoem/makefile.b32 b/samples/wxpoem/makefile.b32
deleted file mode 100644 (file)
index b8eacd8..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# File:                makefile.b32
-# Author:      Julian Smart
-# Created:     1999
-# Updated:     
-# Copyright:
-#
-# Makefile : Builds sample for 32-bit BC++
-
-WXDIR = $(WXWIN)
-
-TARGET=wxpoem
-OBJECTS = $(TARGET).obj
-
-!include $(WXDIR)\src\makeprog.b32
-
diff --git a/samples/wxpoem/makefile.bcc b/samples/wxpoem/makefile.bcc
deleted file mode 100644 (file)
index 2637044..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# File:                makefile.bcc
-# Author:      Julian Smart
-# Created:     1998
-# Updated:     
-#
-# Builds a BC++ 16-bit sample
-
-!if "$(WXWIN)" == ""
-!error You must define the WXWIN variable in autoexec.bat, e.g. WXWIN=c:\wx
-!endif
-
-WXDIR = $(WXWIN)
-
-TARGET=wxpoem
-OBJECTS=$(TARGET).obj
-
-!include $(WXDIR)\src\makeprog.bcc
-
diff --git a/samples/wxpoem/makefile.dos b/samples/wxpoem/makefile.dos
deleted file mode 100644 (file)
index 84d5daa..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# File:                makefile.dos
-# Author:      Julian Smart
-# Created:     1998
-# Updated:     
-#
-# Makefile : Builds 16-bit sample, VC++ 1.5
-# Use FINAL=1 argument to nmake to build final version with no debugging
-# info
-
-WXDIR = $(WXWIN)
-
-TARGET=wxpoem
-OBJECTS = $(TARGET).obj
-
-!include $(WXDIR)\src\makeprog.msc
-
diff --git a/samples/wxpoem/makefile.g95 b/samples/wxpoem/makefile.g95
deleted file mode 100644 (file)
index 45cd3e4..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# File:         makefile.g95
-# Author:       Julian Smart
-# Created:      1999
-# Updated:
-# Copyright:    (c) Julian Smart, 1999
-#
-# Makefile for wxWindows sample (Cygwin/Mingw32).
-
-WXDIR = ../..
-
-TARGET=wxpoem
-OBJECTS = $(TARGET).o
-
-include $(WXDIR)/src/makeprog.g95
-
diff --git a/samples/wxpoem/makefile.vc b/samples/wxpoem/makefile.vc
deleted file mode 100644 (file)
index 8bf4582..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# File:                makefile.vc
-# Author:      Julian Smart
-# Created:     1999
-# Updated:     
-# Copyright:   (c) Julian Smart
-#
-# Makefile : Builds sample (VC++, WIN32)
-# Use FINAL=1 argument to nmake to build final version with no debug info.
-
-# Set WXDIR for your system
-WXDIR = $(WXWIN)
-
-PROGRAM=wxpoem
-OBJECTS = $(PROGRAM).obj
-
-!include $(WXDIR)\src\makeprog.vc
-
diff --git a/samples/wxpoem/makefile.wat b/samples/wxpoem/makefile.wat
deleted file mode 100644 (file)
index b07d6af..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#
-# Makefile for WATCOM
-#
-# Created by Julian Smart, January 1999
-# 
-#
-
-WXDIR = $(%WXWIN)
-
-PROGRAM = wxpoem
-OBJECTS = $(PROGRAM).obj
-
-!include $(WXDIR)\src\makeprog.wat
-
-
diff --git a/samples/wxpoem/wxpoem.cpp b/samples/wxpoem/wxpoem.cpp
deleted file mode 100644 (file)
index 2a2d89c..0000000
+++ /dev/null
@@ -1,1147 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name:        wxpoem.cpp
-// Purpose:     A small C++ program which displays a random poem on
-//              execution. It also allows search for poems containing a
-//              string.
-//              It requires winpoem.dat and creates winpoem.idx.
-//              Original version (WinPoem) written in 1994.
-//              This has not been rewritten in a long time so
-//              beware, inelegant code!
-// Author:      Julian Smart
-// Created:     12/12/98
-// RCS-ID:      $Id$
-// Copyright:   (c) 1998 Julian Smart
-// Licence:     wxWindows licence
-/////////////////////////////////////////////////////////////////////////////
-
-#ifdef __GNUG__
-#pragma implementation "wxpoem.h"
-#endif
-
-// For compilers that support precompilation, includes "wx.h".
-#include "wx/wxprec.h"
-
-#ifdef __BORLANDC__
-#pragma hdrstop
-#endif
-
-#ifndef WX_PRECOMP
-#include "wx/wx.h"
-#endif
-
-#include "wx/help.h"
-
-#include "wxpoem.h"
-
-#if defined(__WXGTK__) || defined(__WXMOTIF__)
-#include "corner1.xpm"
-#include "corner2.xpm"
-#include "corner3.xpm"
-#include "corner4.xpm"
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-
-#ifdef __WINDOWS__
-#include <windows.h>
-#ifdef DrawText
-#undef DrawText
-#endif
-#endif
-
-#define         buf_size 10000
-#define         DEFAULT_POETRY_DAT "wxpoem"
-#define         DEFAULT_POETRY_IND "wxpoem"
-#define         DEFAULT_CHAR_HEIGHT 18
-#define         DEFAULT_FONT "Swiss"
-#define         DEFAULT_X_POS 0
-#define         DEFAULT_Y_POS 0
-#define         BORDER_SIZE 30
-#define         THIN_LINE_BORDER 10
-#define         THICK_LINE_BORDER 16
-#define         THICK_LINE_WIDTH 2
-#define         SHADOW_OFFSET 1
-#define         X_SIZE 30
-#define         Y_SIZE 20
-
-static char     *poem_buffer;          // Storage for each poem
-static char     line[150];                      // Storage for a line
-static char     title[150];                     // Remember the title
-static char     *search_string = NULL;          // The search string
-static int      pages[30];                      // For multipage poems -
-                                                // store the start of each page
-static long     last_poem_start = 0;            // Start of last found poem
-static long     last_find = -1;                 // Point in file of last found
-                                                // search string
-static bool     search_ok = FALSE;              // Search was successful
-static bool     same_search = FALSE;            // Searching on same string
-
-static long     poem_index[600];                     // Index of poem starts
-static long     nitems = 0;                     // Number of poems
-static int      char_height = DEFAULT_CHAR_HEIGHT; // Actual height
-static int      index_ptr = -1;                 // Pointer into index
-static int      poem_height, poem_width;        // Size of poem
-static int      XPos;                           // Startup X position
-static int      YPos;                           // Startup Y position
-static int      pointSize = 12;                 // Font size
-
-static char     *index_filename = NULL;            // Index filename
-static char     *data_filename = NULL;             // Data filename
-static char     error_buf[300];                 // Error message buffer
-static bool     loaded_ok = FALSE;              // Poem loaded ok
-static bool     index_ok = FALSE;               // Index loaded ok
-
-static bool     paging = FALSE;                 // Are we paging?
-static int      current_page = 0;               // Currently viewed page
-
-wxIcon          *Corner1 = NULL;
-wxIcon          *Corner2 = NULL;
-wxIcon          *Corner3 = NULL;
-wxIcon          *Corner4 = NULL;
-
-// Fonts
-wxFont          *NormalFont = NULL;
-wxFont          *BoldFont = NULL;
-wxFont          *ItalicFont = NULL;
-
-// Pens
-wxPen           *GreyPen = NULL;
-wxPen           *DarkGreyPen = NULL;
-wxPen           *WhitePen = NULL;
-
-// Backing bitmap
-wxBitmap        *backingBitmap = NULL;
-
-void            PoetryError(char *, char *caption="wxPoem Error");
-void            PoetryNotify(char *Msg, char *caption="wxPoem");
-void            TryLoadIndex();
-bool            LoadPoem(char *, long);
-int             GetIndex();
-int             LoadIndex(char *);
-bool            Compile(void);
-void            WritePreferences();
-void            ReadPreferences();
-void            FindMax(int *max_thing, int thing);
-void            CreateFonts();
-#ifdef __WXMSW__
-void            CopyToClipboard(HWND, char *);
-#endif
-
-wxMenu    *popupMenu = NULL;
-
-#if wxUSE_HELP
-    wxHelpController *HelpController = NULL;
-#endif // wxUSE_HELP
-
-IMPLEMENT_APP(MyApp)
-
-MainWindow *TheMainWindow = NULL;
-
-// Create the fonts
-void CreateFonts()
-{
-  NormalFont = wxTheFontList->FindOrCreateFont(pointSize, wxSWISS, wxNORMAL, wxNORMAL);
-  BoldFont =   wxTheFontList->FindOrCreateFont(pointSize, wxSWISS, wxNORMAL, wxBOLD);
-  ItalicFont = wxTheFontList->FindOrCreateFont(pointSize, wxSWISS, wxITALIC, wxNORMAL);
-}
-
-BEGIN_EVENT_TABLE(MainWindow, wxFrame)
-    EVT_CLOSE(MainWindow::OnCloseWindow)
-    EVT_CHAR(MainWindow::OnChar)
-    EVT_MENU(-1, MainWindow::OnPopup)
-END_EVENT_TABLE()
-
-MainWindow::MainWindow(wxFrame *frame, wxWindowID id, const wxString& title,
-   const wxPoint& pos, const wxSize& size, long style):
-  wxFrame(frame, id, title, pos, size, style)
-{
-}
-
-MainWindow::~MainWindow()
-{
-  // Note: this must be done before the main window/canvas are destroyed
-  // or we get an error (no parent window for menu item button)
-  delete popupMenu;
-  popupMenu = NULL;
-}
-
-// Read the poetry buffer, either for finding the size
-// or for writing to a bitmap (not to the window directly,
-// since that displays messily)
-// If DrawIt is true, we draw, otherwise we just determine the
-// size the window should be.
-void MainWindow::ScanBuffer(wxDC *dc, bool DrawIt, int *max_x, int *max_y)
-{
-    int i = pages[current_page];
-    int ch = -1;
-    int x = 10;
-    int y = 0;
-    int j;
-    char *line_ptr;
-    int curr_width = 0;
-    bool page_break = FALSE;
-
-    int width = 0;
-    int height = 0;
-
-    if (DrawIt)
-    {
-      y = (*max_y - poem_height)/2;
-      width = *max_x;
-      height = *max_y;
-    }
-
-    if (DrawIt && wxColourDisplay())
-    {
-      dc->SetBrush(*wxLIGHT_GREY_BRUSH);
-      dc->SetPen(*GreyPen);
-      dc->DrawRectangle(0, 0, width, height);
-      dc->SetBackgroundMode(wxTRANSPARENT);
-    }
-
-    // See what ACTUAL char height is
-    dc->SetFont(* NormalFont);
-    long xx;
-    long yy;
-    dc->GetTextExtent("X", &xx, &yy);
-    char_height = (int)yy;
-
-    if (current_page == 0)
-      title[0] = 0;
-    else if (title[0] != 0)
-    {
-       dc->SetFont(* BoldFont);
-       dc->GetTextExtent(title, &xx, &yy);
-       FindMax(&curr_width, (int)xx);
-
-       if (DrawIt)
-       {
-         x = (width - xx)/2;
-         dc->SetFont(* BoldFont);
-
-         // Change text to BLACK!
-         dc->SetTextForeground(* wxBLACK);
-         dc->DrawText(title, x, y);
-         // Change text to WHITE!
-         dc->SetTextForeground(* wxWHITE);
-         dc->DrawText(title, x-SHADOW_OFFSET, y-SHADOW_OFFSET);
-       }
-       y += char_height;
-       y += char_height;
-    }
-
-    while (ch != 0 && !page_break)
-    {
-        j = 0;
-#ifdef __WXMSW__
-        while (((ch = poem_buffer[i]) != 13) && (ch != 0))
-#else
-        while (((ch = poem_buffer[i]) != 10) && (ch != 0))
-#endif
-        {
-            line[j] = ch;
-            j ++;
-            i ++;
-        }
-
-#ifdef __WXMSW__
-        if (ch == 13)
-#else
-        if (ch == 10)
-#endif
-        {
-            ch = -1;
-            i ++;
-#ifdef __WXMSW__
-            // Add another to skip the linefeed
-            i ++;
-#endif
-            // If a single newline on its own, put a space in
-            if (j == 0)
-            {
-              line[j] = ' ';
-              j ++;
-              line[j] = 0;
-            }
-        }
-
-        if (j > 0)
-        {
-          line[j] = 0;
-          if (line[0] == '@')
-          {
-            switch (line[1])
-            {
-              case 'P':
-                paging = TRUE;
-                page_break = TRUE;
-                break;
-
-              case 'T':
-                dc->SetFont(* BoldFont);
-                line_ptr = line+3;
-
-                strcpy(title, line_ptr);
-                strcat(title, " (cont'd)");
-
-                dc->GetTextExtent(line_ptr, &xx, &yy);
-                FindMax(&curr_width, (int)xx);
-
-                if (DrawIt)
-                {
-                  x = (width - xx)/2;
-                  dc->SetFont(* BoldFont);
-
-                  // Change text to BLACK!
-                  dc->SetTextForeground(* wxBLACK);
-                  dc->DrawText(line_ptr, x, y);
-
-                  // Change text to WHITE!
-                  dc->SetTextForeground(* wxWHITE);
-                  dc->DrawText(line_ptr, x-SHADOW_OFFSET, y-SHADOW_OFFSET);
-                  dc->SetTextForeground(* wxWHITE);
-                }
-                break;
-
-              case 'A':
-                line_ptr = line+3;
-                dc->SetFont(* ItalicFont);
-
-                dc->GetTextExtent(line_ptr, &xx, &yy);
-                FindMax(&curr_width, (int)xx);
-
-                if (DrawIt)
-                {
-                  x = (width - xx)/2;
-                  dc->SetTextForeground(* wxBLACK);
-                  dc->DrawText(line_ptr, x, y);
-                }
-                break;
-
-              // Default: just ignore this line
-              default:
-                y -= char_height;
-            }
-           }
-           else
-           {
-              dc->SetFont(* NormalFont);
-
-              dc->GetTextExtent(line, &xx, &yy);
-              FindMax(&curr_width, (int)xx);
-
-              if (DrawIt)
-              {
-                int x = (int)((width - xx)/2.0);
-                dc->SetFont(* NormalFont);
-                dc->SetTextForeground(* wxBLACK);
-                dc->DrawText(line, x, y);
-              }
-           }
-        }
-        y += char_height;
-    }
-
-    // Write (cont'd)
-    if (page_break)
-    {
-       char *cont = "(cont'd)";
-
-       dc->SetFont(* NormalFont);
-
-       dc->GetTextExtent(cont, &xx, &yy);
-       FindMax(&curr_width, (int)xx);
-       if (DrawIt)
-       {
-         int x = (int)((width - xx)/2.0);
-         dc->SetFont(* NormalFont);
-         dc->SetTextForeground(* wxBLACK);
-         dc->DrawText(cont, x, y);
-       }
-       y += 2*char_height;
-    }
-
-    *max_x = (int)curr_width;
-    *max_y = (int)(y-char_height);
-
-    if (page_break)
-      pages[current_page+1] = i;
-    else
-      paging = FALSE;
-
-    if (DrawIt)
-    {
-      // Draw dark grey thick border
-      if (wxColourDisplay())
-      {
-        dc->SetBrush(*wxGREY_BRUSH);
-        dc->SetPen(*wxGREY_PEN);
-
-        // Left side
-        dc->DrawRectangle(0, 0, THIN_LINE_BORDER, height);
-        // Top side
-        dc->DrawRectangle(THIN_LINE_BORDER, 0, width-THIN_LINE_BORDER, THIN_LINE_BORDER);
-        // Right side
-        dc->DrawRectangle(width-THIN_LINE_BORDER, THIN_LINE_BORDER, width, height-THIN_LINE_BORDER);
-        // Bottom side
-        dc->DrawRectangle(THIN_LINE_BORDER, height-THIN_LINE_BORDER, width-THIN_LINE_BORDER, height);
-      }
-      // Draw border
-      // Have grey background, plus 3-d border -
-      // One black rectangle.
-      // Inside this, left and top sides - dark grey. Bottom and right -
-      // white.
-
-      // Change pen to black
-      dc->SetPen(*wxBLACK_PEN);
-      dc->DrawLine(THIN_LINE_BORDER, THIN_LINE_BORDER, width-THIN_LINE_BORDER, THIN_LINE_BORDER);
-      dc->DrawLine(width-THIN_LINE_BORDER, THIN_LINE_BORDER, width-THIN_LINE_BORDER, height-THIN_LINE_BORDER);
-      dc->DrawLine(width-THIN_LINE_BORDER, height-THIN_LINE_BORDER, THIN_LINE_BORDER, height-THIN_LINE_BORDER);
-      dc->DrawLine(THIN_LINE_BORDER, height-THIN_LINE_BORDER, THIN_LINE_BORDER, THIN_LINE_BORDER);
-
-      // Right and bottom white lines - 'grey' (black!) if
-      // we're running on a mono display.
-      if (wxColourDisplay())
-        dc->SetPen(*WhitePen);
-      else
-        dc->SetPen(*DarkGreyPen);
-
-      dc->DrawLine(width-THICK_LINE_BORDER, THICK_LINE_BORDER,
-                   width-THICK_LINE_BORDER, height-THICK_LINE_BORDER);
-      dc->DrawLine(width-THICK_LINE_BORDER, height-THICK_LINE_BORDER,
-                   THICK_LINE_BORDER, height-THICK_LINE_BORDER);
-
-      // Left and top grey lines
-      dc->SetPen(*DarkGreyPen);
-      dc->DrawLine(THICK_LINE_BORDER, height-THICK_LINE_BORDER,
-                   THICK_LINE_BORDER, THICK_LINE_BORDER);
-      dc->DrawLine(THICK_LINE_BORDER, THICK_LINE_BORDER,
-                   width-THICK_LINE_BORDER, THICK_LINE_BORDER);
-
-//#ifdef __WXMSW__
-      // Draw icons
-      dc->DrawIcon(* Corner1, 0, 0);
-      dc->DrawIcon(* Corner2, int(width-32), 0);
-
-      int y2 = height - 32;
-      int x2 = (width-32);
-      dc->DrawIcon(* Corner3, 0, y2);
-      dc->DrawIcon(* Corner4, x2, y2);
-//#endif
-    }
-}
-
-// Get an index (randomly generated) and load the poem
-void MainWindow::GetIndexLoadPoem(void)
-{
-    if (index_ok)
-      index_ptr = GetIndex();
-
-    if (index_ptr > -1)
-      loaded_ok = LoadPoem(data_filename, -1);
-}
-
-// Find the size of the poem and resize the window accordingly
-void MainWindow::Resize(void)
-{
-    wxClientDC dc(canvas);
-
-    // Get the poem size
-    ScanBuffer(& dc, FALSE, &poem_width, &poem_height);
-    int x = poem_width + (2*BORDER_SIZE);
-    int y = poem_height + (2*BORDER_SIZE);
-
-    SetClientSize(x, y);
-
-    // In case client size isn't what we set it to...
-    int xx, yy;
-    GetClientSize(&xx, &yy);
-
-    wxMemoryDC memDC;
-    if (backingBitmap) delete backingBitmap;
-    backingBitmap = new wxBitmap(x, yy);
-    memDC.SelectObject(* backingBitmap);
-
-    memDC.Clear();
-    TheMainWindow->ScanBuffer(&memDC, TRUE, &xx, &yy);
-}
-
-// Which is more?
-void FindMax(int *max_thing, int thing)
-{
-  if (thing > *max_thing)
-    *max_thing = thing;
-}
-
-// Next page/poem
-void MainWindow::NextPage(void)
-{
-  if (paging)
-    current_page ++;
-  else
-  {
-    current_page = 0;
-    GetIndexLoadPoem();
-  }
-  Resize();
-}
-
-// Previous page
-void MainWindow::PreviousPage(void)
-{
-  if (current_page > 0)
-  {
-    current_page --;
-    Resize();
-  }
-}
-
-// Search for a string
-void MainWindow::Search(bool ask)
-{
-  long position;
-
-  if (ask || !search_string)
-  {
-    wxString s = wxGetTextFromUser("Enter search string", "Search", (const char*) search_string);
-    if (s != "")
-    {
-      if (search_string) delete[] search_string;
-      search_string = copystring(s);
-      search_ok = TRUE;
-    } else search_ok = FALSE;
-  }
-  else
-  {
-    same_search = TRUE;
-    search_ok = TRUE;
-  }
-
-  if (search_string && search_ok)
-  {
-    position = DoSearch();
-    if (position > -1)
-    {
-       loaded_ok = LoadPoem(data_filename, position);
-       Resize();
-    }
-    else
-    {
-      last_poem_start = 0;
-      PoetryNotify("Search string not found.");
-    }
-  }
-}
-
-// Copy a string to the clipboard
-#ifdef __WXMSW__
-void CopyToClipboard(HWND handle, char *s)
-{
-  int length = strlen(s);
-  HANDLE hGlobalMemory = GlobalAlloc(GHND, (DWORD) length + 1);
-  if (hGlobalMemory)
-  {
-#ifdef __WINDOWS_386__
-    LPSTR lpGlobalMemory = MK_FP32(GlobalLock(hGlobalMemory));
-#else
-    LPSTR lpGlobalMemory = (LPSTR)GlobalLock(hGlobalMemory);
-#endif
-    int i, j = 0;
-    for (i = 0; i < length; i ++)
-    {
-      if (s[i] == '@')
-      {
-        i++;
-        switch (s[i])
-        {
-          case 'P':
-            break;
-          case 'T':
-          case 'A':
-          default:
-            i ++;
-            break;
-        }
-      }
-      else
-      {
-        lpGlobalMemory[j] = s[i];
-        j ++;
-      }
-    }
-
-    GlobalUnlock(hGlobalMemory);
-    OpenClipboard(handle);
-    EmptyClipboard();
-    SetClipboardData(CF_TEXT, hGlobalMemory);
-    CloseClipboard();
-  }
-}
-#endif
-
-bool MyApp::OnInit()
-{
-  poem_buffer = new char[buf_size];
-
-  GreyPen = new wxPen("LIGHT GREY", THICK_LINE_WIDTH, wxSOLID);
-  DarkGreyPen = new wxPen("GREY", THICK_LINE_WIDTH, wxSOLID);
-  WhitePen = new wxPen("WHITE", THICK_LINE_WIDTH, wxSOLID);
-
-#if wxUSE_HELP
-  HelpController = new wxHelpController();
-  HelpController->Initialize("wxpoem");
-#endif // wxUSE_HELP
-
-  CreateFonts();
-
-  ReadPreferences();
-
-  // Seed the random number generator
-  time_t current_time;
-
-  (void)time(&current_time);
-  srand((unsigned int)current_time);
-
-//    randomize();
-  pages[0] = 0;
-
-  TheMainWindow = new MainWindow(NULL, 500, "wxPoem", wxPoint(XPos, YPos), wxSize(100, 100), wxCAPTION|wxMINIMIZE_BOX|wxSYSTEM_MENU);
-
-#ifdef wx_x
-  TheMainWindow->SetIcon(Icon("wxpoem"));
-#endif
-
-  TheMainWindow->canvas = new MyCanvas(TheMainWindow, 501, wxDefaultPosition, wxDefaultSize);
-
-  popupMenu = new wxMenu;
-  popupMenu->Append(POEM_NEXT, "Next poem/page");
-  popupMenu->Append(POEM_PREVIOUS, "Previous page");
-  popupMenu->AppendSeparator();
-  popupMenu->Append(POEM_SEARCH, "Search");
-  popupMenu->Append(POEM_NEXT_MATCH, "Next match");
-  popupMenu->Append(POEM_COPY, "Copy to clipboard");
-  popupMenu->Append(POEM_MINIMIZE, "Minimize");
-  popupMenu->AppendSeparator();
-  popupMenu->Append(POEM_BIGGER_TEXT, "Bigger text");
-  popupMenu->Append(POEM_SMALLER_TEXT, "Smaller text");
-  popupMenu->AppendSeparator();
-  popupMenu->Append(POEM_ABOUT, "About wxPoem");
-  popupMenu->AppendSeparator();
-  popupMenu->Append(POEM_EXIT, "Exit");
-
-  if (argc > 1)
-  {
-    index_filename = copystring(argv[1]);
-    data_filename = copystring(argv[1]);
-  }
-  else
-  {
-    index_filename = DEFAULT_POETRY_IND;
-    data_filename = DEFAULT_POETRY_DAT;
-  }
-  TryLoadIndex();
-
-#ifdef __WXMSW__
-  Corner1 = new wxIcon("icon_1");
-  Corner2 = new wxIcon("icon_2");
-  Corner3 = new wxIcon("icon_3");
-  Corner4 = new wxIcon("icon_4");
-#endif
-#if defined(__WXGTK__) || defined(__WXMOTIF__)
-  Corner1 = new wxIcon( corner1_xpm );
-  Corner2 = new wxIcon( corner2_xpm );
-  Corner3 = new wxIcon( corner3_xpm );
-  Corner4 = new wxIcon( corner4_xpm );
-#endif
-
-  TheMainWindow->GetIndexLoadPoem();
-  TheMainWindow->Resize();
-  TheMainWindow->Show(TRUE);
-
-  return TRUE;
-}
-
-int MyApp::OnExit()
-{
-  if (backingBitmap)
-    delete backingBitmap;
-#if wxUSE_HELP
-  delete HelpController;
-#endif // wxUSE_HELP
-  delete GreyPen;
-  delete DarkGreyPen;
-  delete WhitePen;
-
-  delete Corner1;
-  delete Corner2;
-  delete Corner3;
-  delete Corner4;
-
-  delete NormalFont;
-  delete BoldFont;
-  delete ItalicFont;
-  delete poem_buffer;
-
-  return 0;
-}
-
-void MainWindow::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
-{
-  WritePreferences();
-  this->Destroy();
-}
-
-void MainWindow::OnChar(wxKeyEvent& event)
-{
-    canvas->OnChar(event);
-}
-
-BEGIN_EVENT_TABLE(MyCanvas, wxWindow)
-    EVT_MOUSE_EVENTS(MyCanvas::OnMouseEvent)
-    EVT_CHAR(MyCanvas::OnChar)
-    EVT_PAINT(MyCanvas::OnPaint)
-END_EVENT_TABLE()
-
-// Define a constructor for my canvas
-MyCanvas::MyCanvas(wxFrame *frame, wxWindowID id, const wxPoint& pos, const wxSize& size):
- wxWindow(frame, id, pos, size)
-{
-}
-
-// Define the repainting behaviour
-void MyCanvas::OnPaint(wxPaintEvent& WXUNUSED(event))
-{
-    wxPaintDC dc(this);
-
-    if (backingBitmap)
-    {
-        int xx, yy;
-        TheMainWindow->GetClientSize(&xx, &yy);
-
-        wxMemoryDC memDC;
-        memDC.SelectObject(* backingBitmap);
-        dc.Blit(0, 0, backingBitmap->GetWidth(), backingBitmap->GetHeight(), &memDC, 0, 0);
-  }
-}
-
-void MyCanvas::OnMouseEvent(wxMouseEvent& event)
-{
-  static int startPosX, startPosY, startFrameX, startFrameY;
-
-  long x, y;
-  event.GetPosition(&x, &y);
-
-  if (event.RightDown())
-  {
-    // Versions from wxWin 1.67 are probably OK
-    PopupMenu(popupMenu, (int)x, (int)y );
-  }
-  else if (event.LeftDown())
-  {
-    this->CaptureMouse();
-    int x1 = (int)x;
-    int y1 = (int)y;
-    ClientToScreen(&x1, &y1);
-    startPosX = x1;
-    startPosY = y1;
-    GetParent()->GetPosition(&startFrameX, &startFrameY);
-  }
-  else if (event.LeftUp())
-    this->ReleaseMouse();
-  else if (event.Dragging() && event.LeftIsDown())
-  {
-    int x1 = (int)x;
-    int y1 = (int)y;
-    ClientToScreen(&x1, &y1);
-
-    int dX = x1 - startPosX;
-    int dY = y1 - startPosY;
-    GetParent()->Move(startFrameX + dX, startFrameY + dY);
-  }
-}
-
-// Process characters
-void MyCanvas::OnChar(wxKeyEvent& event)
-{
-  switch (event.KeyCode())
-  {
-    case 'n':
-    case 'N':
-      // Next match
-      TheMainWindow->Search(FALSE);
-      break;
-    case 's':
-    case 'S':
-      // New search
-      TheMainWindow->Search(TRUE);
-      break;
-    case WXK_SPACE:
-      // Another poem
-      TheMainWindow->NextPage();
-      break;
-    case 27:
-      TheMainWindow->Close(TRUE);
-    default:
-       break;
-   }
- }
-
-// Load index file
-int LoadIndex(char *file_name)
-{
-    long data;
-    FILE *index_file;
-
-    int i = 0;
-    char buf[100];
-
-    if (file_name)
-      sprintf(buf, "%s.idx", file_name);
-    if (! (file_name && (index_file = fopen(buf, "r"))))
-      return 0;
-    else
-    {
-      fscanf(index_file, "%ld", &nitems);
-
-      for (i = 0; i < nitems; i++)
-      {
-        fscanf(index_file, "%ld", &data);
-        poem_index[i] = data;
-      }
-      fclose(index_file);
-
-      return 1;
-    }
-}
-
-// Get index
-int GetIndex()
-{
-    int indexn = 0;
-
-    indexn = (int)(rand() % nitems);
-
-    if ((indexn < 0) || (indexn > nitems))
-    { PoetryError("No such poem!");
-      return -1;
-    }
-    else
-      return indexn;
-}
-
-// Read preferences
-void ReadPreferences()
-{
-  wxGetResource("wxPoem", "FontSize", &pointSize);
-  wxGetResource("wxPoem", "X", &XPos);
-  wxGetResource("wxPoem", "Y", &YPos);
-}
-
-// Write preferences to disk
-void WritePreferences()
-{
-#ifdef __WXMSW__
-  TheMainWindow->GetPosition(&XPos, &YPos);
-  wxWriteResource("wxPoem", "FontSize", pointSize);
-  wxWriteResource("wxPoem", "X", XPos);
-  wxWriteResource("wxPoem", "Y", YPos);
-#endif
-}
-
-// Load a poem from given file, at given point in file.
-// If position is > -1, use this for the position in the
-// file, otherwise use index[index_ptr] to find the correct position.
-bool LoadPoem(char *file_name, long position)
-{
-    int ch = 0;
-    int i = 0;
-//    int j = 0;
-//    int indexn = 0;
-    char buf[100];
-    long data;
-    FILE *data_file;
-
-    paging = FALSE;
-    current_page = 0;
-
-    if (file_name)
-      sprintf(buf, "%s.dat", file_name);
-
-    if (! (file_name && (data_file = fopen(buf, "r"))))
-    {
-      sprintf(error_buf, "Data file %s not found.", buf);
-      PoetryError(error_buf);
-      return FALSE;
-    }
-    else
-    {
-      if (position > -1)
-        data = position;
-      else
-        data = poem_index[index_ptr];
-
-      fseek(data_file, data, SEEK_SET);
-
-      ch = 0;
-      i = 0;
-      while ((ch != EOF) && (ch != '#'))
-      {
-        ch = getc(data_file);
-        // Add a linefeed so it will copy to the clipboard ok
-        if (ch == 10)
-        {
-          poem_buffer[i] = 13;
-          i++;
-        }
-
-        poem_buffer[i] = ch;
-        i ++;
-
-        if (i == buf_size)
-        {
-           sprintf(error_buf, "%s", "Poetry buffer exceeded.");
-           PoetryError(error_buf);
-           return FALSE;
-        }
-      }
-      fclose(data_file);
-      poem_buffer[i-1] = 0;
-      return TRUE;
-  }
-}
-
-// Do the search
-long MainWindow::DoSearch(void)
-{
-    if (!search_string)
-      return FALSE;
-
-    FILE *file;
-    long i = 0;
-    int ch = 0;
-    char buf[100];
-    long find_start;
-    long previous_poem_start;
-
-    bool found = FALSE;
-    int search_length = strlen(search_string);
-
-    if (same_search)
-    {
-      find_start = last_find + 1;
-      previous_poem_start = last_poem_start;
-    }
-    else
-    {
-      find_start = 0;
-      last_poem_start = 0;
-      previous_poem_start = -1;
-    }
-
-    if (data_filename)
-      sprintf(buf, "%s.dat", data_filename);
-
-    if (! (data_filename && (file = fopen(buf, "r"))))
-    {
-      sprintf(error_buf, "Poetry data file %s not found\n", buf);
-      PoetryError(error_buf);
-      return FALSE;
-    }
-
-    fseek(file, find_start, SEEK_SET);
-
-    while ((ch != EOF) && !found)
-    {
-        ch = getc(file);
-        ch |= 0x0020;   // Make lower case
-
-        // Only match if we're looking at a different poem
-        // (no point in displaying the same poem again)
-        if ((ch == search_string[i]) && (last_poem_start != previous_poem_start))
-        {
-          if (i == 0)
-            last_find = ftell(file);
-          if (i == search_length-1)
-            found = TRUE;
-          i ++;
-        }
-        else
-          i = 0;
-
-        if (ch == '#')
-        {
-            ch = getc(file);
-              last_poem_start = ftell(file);
-        }
-    }
-    fclose(file);
-    if (ch == EOF)
-      last_find = -1;
-
-    if (found)
-    {
-      return last_poem_start;
-    }
-    else
-      return -1;
-}
-
-// Set up poetry filenames, preferences, load the index
-// Load index (or compile it if none found)
-void TryLoadIndex()
-{
-  index_ok = LoadIndex(index_filename);
-  if (!index_ok || (nitems == 0))
-  {
-      PoetryError("Index file not found; will compile new one", "wxPoem");
-      index_ok = Compile();
-  }
-}
-
-// Error message
-void PoetryError(char *msg, char *caption)
-{
-  wxMessageBox(msg, caption, wxOK|wxICON_EXCLAMATION);
-}
-
-// Notification (change icon to something appropriate!)
-void PoetryNotify(char *Msg, char *caption)
-{
-  wxMessageBox(Msg, caption, wxOK | wxICON_INFORMATION);
-}
-
-// Build up and save an index into the poetry data file, for
-// rapid random access
-bool Compile(void)
-{
-    FILE *file;
-    long i = 0;
-    int j;
-    int ch = 0;
-    char buf[100];
-
-    if (data_filename)
-      sprintf(buf, "%s.dat", data_filename);
-
-    if (! (data_filename && (file = fopen(buf, "r"))))
-    {
-      sprintf(error_buf, "Poetry data file %s not found\n", buf);
-      PoetryError(error_buf);
-      return FALSE;
-    }
-
-    nitems = 0;
-
-    // Do first one (?)
-    poem_index[nitems] = 0;
-    nitems ++;
-
-    // Do rest
-    while (ch != EOF)
-    {
-        ch = getc(file);
-        i ++;
-        if (ch == '#')
-        {
-            ch = getc(file);
-            long data;
-            data = ftell(file);
-            poem_index[nitems] = data;
-            nitems ++;
-        }
-    }
-    fclose(file);
-
-    if (index_filename)
-      sprintf(buf, "%s.idx", index_filename);
-    if (! (data_filename && (file = fopen(buf, "w"))))
-    {
-      sprintf(error_buf, "Poetry index file %s cannot be created\n", buf);
-      PoetryError(error_buf);
-      return FALSE;
-    }
-
-    fprintf(file, "%ld\n\n", nitems);
-    for (j = 0; j < nitems; j++)
-      fprintf(file, "%ld\n", poem_index[j]);
-
-    fclose(file);
-    PoetryNotify("Poetry index compiled.");
-    return TRUE;
-}
-
-void MainWindow::OnPopup(wxCommandEvent& event)
-{
-  switch (event.GetId())
-  {
-     case POEM_NEXT:
-       // Another poem/page
-       TheMainWindow->NextPage();
-       break;
-     case POEM_PREVIOUS:
-       // Previous page
-       TheMainWindow->PreviousPage();
-       break;
-     case POEM_SEARCH:
-       // Search - with dialog
-       TheMainWindow->Search(TRUE);
-       break;
-     case POEM_NEXT_MATCH:
-       // Search - without dialog (next match)
-       TheMainWindow->Search(FALSE);
-       break;
-     case POEM_MINIMIZE:
-       TheMainWindow->Iconize(TRUE);
-       break;
-#ifdef __WXMSW__
-     case POEM_COPY:
-       // Copy current poem to the clipboard
-       CopyToClipboard((HWND) TheMainWindow->GetHWND(), poem_buffer);
-       break;
-#endif
-     case POEM_COMPILE:
-       // Compile index
-       Compile();
-       break;
-     case POEM_BIGGER_TEXT:
-     {
-       pointSize ++;
-       CreateFonts();
-       TheMainWindow->Resize();
-       break;
-     }
-     case POEM_SMALLER_TEXT:
-     {
-       if (pointSize > 2)
-       {
-         pointSize --;
-         CreateFonts();
-         TheMainWindow->Resize();
-       }
-       break;
-     }
-     case POEM_HELP_CONTENTS:
-     {
-#if wxUSE_HELP
-       HelpController->LoadFile("wxpoem");
-       HelpController->DisplayContents();
-#endif // wxUSE_HELP
-       break;
-     }
-     case POEM_ABOUT:
-     {
-       (void)wxMessageBox("wxPoem Version 1.1\nJulian Smart (c) 1995",
-                          "About wxPoem", wxOK, TheMainWindow);
-       break;
-     }
-     case POEM_EXIT:
-       // Exit
-       TheMainWindow->Close(TRUE);
-       break;
-     default:
-       break;
-  }
-}
diff --git a/samples/wxpoem/wxpoem.dat b/samples/wxpoem/wxpoem.dat
deleted file mode 100644 (file)
index c03e494..0000000
+++ /dev/null
@@ -1,2532 +0,0 @@
-@T A Thunderstorm in Town
-
-She wore a new "terra-cotta" dress,
-And we stayed, because of the pelting storm,
-Within the hansom's dry recess,
-Though the horse had stopped; yea, motionless
-We sat on, snug and warm.
-
-Then the downpour ceased, to my sharp sad pain
-And the glass that had screened our forms before
-Flew up, and out she sprang to her door:
-I should have kissed her if the rain
-Had lasted a minute more.
-
-@A Thomas Hardy
-#
-They say my verse is sad: no wonder;
-Its narrow measure spans
-Tears of eternity, and sorrow,
-Not mine, but man's.
-
-This is for all ill-treated fellows
-Unborn and unbegot,
-For them to read when they're in trouble
-And I am not.
-
-@A A. E. Housman
-#
-@T On a Day's Stint
-
-And long ere dinner-time I have
-Full eight close pages wrote.
-What, Duty, hast thou now to crave?
-Well done, Sir Walter Scott!
-
-@A Sir Walter Scott
-#
-@T The Choir Boy
-
-And when he sang in choruses
-His voice o'ertopped the rest,
-Which is very inartistic,
-But the public like that best.
-
-@A Anonymous
-#
-@T For Johnny
-
-Do not despair
-For Johnny-head-air;
-He sleeps as sound
-As Johnny underground.
-
-Fetch out no shroud
-For Johnny-in-the-cloud;
-And keep your tears
-For him in after years.
-
-Better by far
-For Johnny-the-bright-star,
-To keep your head,
-And see his children fed.
-
-@A John Pudney
-#
-@T Cock-Crow
-
-Out of the wood of thoughts that grows by night
-To be cut down by the sharp axe of light, -
-Out of the night, two cocks together crow,
-Cleaving the darkness with a silver blow:
-And bright before my eyes twin trumpeters stand,
-Heralds of splendour, one at either hand,
-Each facing each as in a coat of arms:
-The milkers lace their boots up at the farms.
-
-@A Edward Thomas
-#
-@T After Long Silence
-
-Speech after long silence; it is right,
-All other lovers being estranged or dead,
-Unfriendly lamplight hid under its shade,
-The curtains drawn upon unfriendly night,
-That we descant and yet again descant
-Upon the supreme theme of Art and Song:
-Bodily decrepitude is wisdom; young
-We loved each other and were ignorant.
-
-@A W. B. Yeats
-#
-@T Clouds
-
-Down the blue night the unending columns press
-In noiseless tumult, break and wave and flow,
-Now tread the far South, or lift rounds of snow
-Up to the white moon's hidden loveliness.
-Some pause in their grave wandering comradeless,
-And turn with profound gesture vague and slow,
-As who would pray good for the world, but know
-Their benediction empty as they bless.
-
-They say that the Dead die not, but remain
-Near to the rich heirs of their grief and mirth.
-I think they ride the calm mid-heaven, as these,
-In wise majestic melancholy train,
-And watch the moon, and the still-raging seas,
-And men coming and going on the earth.
-
-@A Rupert Brooke
-#
-@T If I should ever by Chance
-
-If I should ever by chance grow rich
-I'll buy Codham, Cockridden, and Childerditch,
-Roses, Pyrgo, and Lapwater,
-And let them all to my elder daughter.
-The rent I shall ask of her will be only
-Each year's violets, white and lonely,
-The first primroses and orchises -
-She must find them before I do, that is.
-But if she finds a blossom on furze
-Without rent they shall all for ever be hers,
-Codham, Cockridden, and Childerditch,
-Roses, Pyrgo, and Lapwater, -
-I shall give them all to my elder daughter.
-
-@A Edward Thomas
-#
-@T Adlestrop
-
-Yes, I remember Adlestrop -
-The name, because one afternoon
-Of heat the express-train drew up there
-Unwontedly.  It was late June.
-
-The steam hissed.  Someone cleared his throat.
-No one left and no one came
-On the bare platform.  What I saw
-Was Adlestrop - only the name
-
-And willows, willow-herb, and grass,
-And meadowsweet, and haycocks dry,
-No whit less still and lonely fair
-Than the high cloudlets in the sky.
-
-And for that minute a blackbird sang
-Close by, and round him, mistier,
-Farther and farther, all the birds
-Of Oxfordshire and Gloucestershire.
-
-@A Edward Thomas
-#
-@T Tall Nettles
-
-Tall nettles cover up, as they have done
-These many springs, the rusty harrow, the plough
-Long worn out, and the roller made of stone:
-Only the elm butt tops the nettles now.
-
-This corner of the farmyard I like most:
-As well as any bloom upon a flower
-I like the dust on the nettles, never lost
-Except to prove the sweetness of a shower.
-
-@A Edward Thomas
-#
-@T The Cherry Trees
-
-The cherry trees bend over and are shedding
-On the old road where all that passed are dead,
-Their petals, strewing the grass as for a wedding
-This early May morn when there is none to wed.
-
-@A Edward Thomas
-#
-@T What will they do?
-
-What will they do when I am gone? It is plain
-That they will do without me as the rain
-Can do without the flowers and the grass
-That profit by it and must perish without.
-I have but seen them in the loud street pass;
-And I was naught to them. I turned about
-To see them disappearing carelessly.
-But what if I in them as they in me
-Nourished what has great value and no price?
-Almost I thought that rain thirsts for a draught
-Which only in the blossom's chalice lies,
-Until that one turned back and lightly laughed.
-
-@A Edward Thomas
-#
-@T The Lane
-
-Some day, I think, there will be people enough
-In Froxfield to pick all the blackberries
-Out of the hedges of Green Lane, the straight
-Broad lane where now September hides herself
-In bracken and blackberry, harebell and dwarf gorse.
-Today, where yesterday a hundred sheep
-Were nibbling, halcyon bells shake to the sway
-Of waters that no vessel ever sailed...
-It is a kind of spring: the chaffinch tries
-His song. For heat it is like summer too.
-This might be winter's quiet. While the glint
-Of hollies dark in the swollen hedges lasts -
-One mile - and those bells ring, little I know
-Or heed if time be still the same, until
-The lane ends and once more all is the same.
-
-@A Edward Thomas
-#
-@T In Memoriam (Easter, 1915)
-
-The flowers left thick at nightfall in the wood
-This Eastertide call into mind the men,
-Now far from home, who, with their sweethearts, should
-Have gathered them and will do never again.
-
-@A Edward Thomas
-#
-@T Failure
-
-Because God put His adamantine fate
-Between my sullen heart and its desire,
-I swore that I would burst the Iron Gate,
-Rise up, and curse Him on His throne of fire.
-Earth shuddered at my crown of blasphemy,
-But Love was as a flame about my feet;
-Proud up the Golden Stair I strode; and beat
-Thrice on the Gate, and entered with a cry -
-
-All the great courts were quiet in the sun,
-And full of vacant echoes: moss had grown
-Over the glassy pavement, and begun
-To creep within the dusty council-halls.
-An idle wind blew round an empty throne
-And stirred the heavy curtains on the walls.
-
-@A Rupert Brooke
-#
-@T Sonnet
-
-I said I splendidly loved you; it's not true.
-Such long swift tides stir not a land-locked sea.
-On gods or fools the high risk falls - on you -
-The clean clear bitter-sweet that's not for me.
-Love soars from earth to ecstasies unwist.
-Love is flung Lucifer-like from Heaven to Hell.
-But - there are wanderers in the middle mist,
-Who cry for shadows, clutch, and cannot tell
-Whether they love at all, or, loving, whom:
-An old song's lady, a fool in fancy dress,
-Or phantoms, or their own face on the gloom;
-For love of Love, or from heart's loneliness.
-Pleasure's not theirs, nor pain. They doubt, and sigh,
-And do not love at all. Of these am I.
-
-@A Rupert Brooke
-#
-@T The Hill
-
-Breathless, we flung us on the windy hill,
-Laughed in the sun, and kissed the lovely grass.
-You said, `Through glory and ecstasy we pass;
-Wind, sun, and earth remain, the birds sing still,
-When we are old, are old...'  `And when we die
-All's over that is ours; and life burns on
-Through other lovers, other lips,' said I,
-`Heart of my heart, our heaven is now, is won!'
-
-`We are Earth's best, that learnt her lesson here.
-Life is our cry. We have kept the faith!' we said;
-`We shall go down with unreluctant tread
-Rose-crowned into the darkness!' ...Proud we were,
-And laughed, that had such brave true things to say,
-- And then you suddenly cried, and turned away.
-
-@A Rupert Brooke
-#
-@T Song
-
-All suddenly the wind comes soft,
-And Spring is here again;
-And the hawthorn quickens with buds of green,
-And my heart with buds of pain.
-
-My heart all Winter lay so numb,
-The earth so dead and frore,
-That I never thought the Spring would come,
-Or my heart wake any more.
-
-But Winter's broken and earth has woken.
-And the small birds cry again;
-And the hawthorn hedge puts forth its buds,
-And my heart puts forth its pain.
-
-@A Rupert Brooke
-#
-@T The Way that Lovers Use
-
-The way that lovers use is this:
-They bow, catch hands, with never a word,
-And their lips meet, and they do kiss,
-- So I have heard.
-
-They queerly find some healing so,
-And strange attainment in the touch;
-There is a secret lovers know,
-- I have read as much.
-
-And theirs is no longer joy nor smart,
-Changing or ending, night or day;
-But mouth to mouth, and heart on heart,
-- So lovers say.
-
-@A Rupert Brooke
-#
-@T Song
-
-The way of love was thus.
-He was born one winter's morn
-With hands delicious,
-And it was well with us.
-
-Love came our quiet way,
-Lit pride in us, and died in us,
-All in a winter's day.
-There is no more to say.
-
-@A Rupert Brooke
-#
-@T Sonnet Reversed
-
-Hand trembling towards hand; the amazing lights
-Of heart and eye. They stood on supreme heights.
-
-Ah, the delirious weeks of honeymoon!
-Soon they returned, and after strange adventures,
-Settled at Balham by the end of June.
-Their money was in Can. Pasc. B. Debentures,
-And in Antofagastas. Still he went
-Cityward daily; still she did abide
-At home. And both were really quite content
-With work and social pleasures. Then they died.
-They left three children (besides George, who drank):
-The eldest Jane, who married Mr Bell,
-William, the head-clerk in the County Bank,
-And Henry, a stock-broker, doing well.
-
-@A Rupert Brooke
-#
-@T A White Rose
-
-The red rose whispers of passion,
-And the white rose breathes of love;
-O, the red rose is a falcon,
-And the white rose is a dove.
-
-But I send you a cream-white rosebud
-With a flush on its petal tips;
-For the love that is purest and sweetest
-Has a kiss of desire on the lips.
-
-@A John Boyle O'Reilly
-#
-@T Urceus Exit
-
-I intended an Ode,
-And it turn'd to a Sonnet.
-It began 'a la mode',
-I intended an Ode;
-But Rose cross'd the road
-In her latest new bonnet;
-I intended an Ode;
-And it turn'd to a Sonnet.
-
-@A Austin Dobson
-#
-@T Pippa's Song
-
-The year's at the spring,
-And day's at the morn;
-Morning's at seven;
-The hill-side's dew-pearl'd;
-The lark's on the wing;
-The snail's on the thorn;
-God's in His heaven -
-All's right with the world!
-
-@A Robert Browning
-#
-@T Song
-
-She is not fair to outward view
-As many maidens be,
-Her loveliness I never knew
-Until she smiled on me;
-O, then I saw her eye was bright,
-A well of love, a spring of light!
-
-But now her looks are coy and cold,
-To mine they ne'er reply,
-And yet I cease not to behold
-The love-light in her eye:
-Her very frowns are fairer far
-Than smiles of other maidens are.
-
-@A Hartley Coleridge
-#
-@T Rondeau
-
-Jenny kiss'd me when we met,
-Jumping from the chair she sat in;
-Time, you thief, who love to get
-Sweets into your list, put that in!
-Say I'm weary, say I'm sad,
-Say that health and wealth have miss'd me,
-Say I'm growing old, but add,
-Jenny kiss'd me.
-
-@A J. H. Leigh Hunt
-#
-@T A Drinking Song
-
-Bacchus must now his power resign -
-I am the only God of Wine!
-It is not fit the wretch should be
-In competition set with me,
-Who can drink ten times more than he.
-
-Make a new world, ye powers divine!
-Stock'd with nothing else but Wine:
-Let Wine its only product be,
-Let Wine be earth, and air, and sea -
-And let that Wine be all for me!
-
-@A Henry Carey
-#
-I never had a piece of toast
-Particularly long and wide,
-But fell upon the sanded floor
-And always on the buttered side.
-
-@A James Payn
-#
-@T Summer Evening
-
-The frog, half fearful, jumps across the path,
-And little mouse that leaves its hole at eve
-Nimbles with timid dread beneath the swath;
-My rustling steps awhile their joys deceive,
-Till past - and then the cricket sings more strong,
-And grasshoppers in merry mood still wear
-The short night weary with their fretting song.
-Up from behind the mole-hill jumps the hare,
-Cheat of his chosen bed, and from the bank
-The yellowhammer flutters in short fears
-From off its nest hid in the grasses rank,
-And drops again when no more noise it hears.
-Thus nature's human link and endless thrall,
-Proud man, still seems the enemy of all.
-
-@A John Clare
-#
-@T Diamond Cut Diamond
-
-Two cats
-One up a tree
-One under the tree
-The cat up a tree is he
-The cat under the tree is she
-The tree is witch elm, just incidentally.
-He takes no notice  of she, she takes no notice of he.
-He stares at the woolly clouds passing, she stares at the tree.
-There's been a lot written about cats, by Old Possum, Yeats and
-Company
-But not Alfred de Musset or Lord Tennyson or Poe or anybody
-Wrote about one cat under, and one cat up, a tree.
-God knows why this should be left for me
-Except I like cats as cats be
-Especially one cat up
-And one cat under
-A witch elm
-Tree.
-
-@A Ewart Milne
-#
-@T Time and Love
-
-When I have seen by Time's fell hand defaced
-The rich proud cost of out-worn buried age;
-When sometime lofty towers I see down-razed,
-And brass eternal slave to mortal rage;
-
-When I have seen the hungry ocean gain
-Advantage on the kingdom of the shore,
-And the firm soil win of the watery main,
-Increasing store with loss, and loss with store;
-
-When I have seen such interchange of state,
-Or state itself confounded to decay,
-Ruin hath taught me thus to ruminate -
-That Time will come and take my Love away:
-
-- This thought is as a death, which cannot choose
-But weep to have that which it fears to lose.
-
-@A William Shakespeare
-#
-Under the greenwood tree
-Who loves to lie with me,
-And turn his merry note
-Unto the sweet bird's throat -
-Come hither, come hither, come hither !
-Here shall he see
-No enemy
-But winter and rough weather.
-
-Who doth ambition shun
-And loves to live i' the sun,
-Seeking the food he eats
-And pleased with what he gets -
-Come hither, come hither, come hither!
-Here shall he see
-No enemy
-But winter and rough weather.
-
-@A William Shakespeare
-#
-@T Absence
-
-Being your slave, what should I do but tend
-Upon the hours and times of your desire?
-I have no precious time at all to spend
-Nor services to do, till you require:
-
-Nor dare I chide the world-without-end hour
-Whilst I, my sovereign, watch the clock for you,
-Nor think the bitterness of absence sour
-When you have bid your servant once adieu:
-
-Nor dare I question with my jealous thought
-Where you may be, or your affairs suppose,
-But like a sad slave, stay and think of nought
-Save, where you are, how happy you make those;-
-
-So true a fool is love, that in your will,
-Though you do anything, he thinks no ill.
-
-@A William Shakespeare
-#
-To me, fair Friend, you never can be old,
-For as you were when first your eye I eyed
-Such seems your beauty still. Three winters cold
-Have from the forests shook three summers' pride;
-Three beauteous springs to yellow autumn turn'd
-In process of the seasons have I seen,
-Three April perfumes in three hot Junes burn'd,
-Since first I saw you fresh, which yet are green.
-
-Ah! yet doth beauty, like a dial-hand,
-Steal from his figure, and no pace perceived;
-So your sweet hue, which methinks still doth stand,
-Hath motion, and mine eye may be deceived:
-
-For fear of which, hear this, thou age unbred,-
-Ere you were born, was beauty's summer dead.
-
-@A William Shakespeare
-#
-@T To His Love
-
-Shall I compare thee to a summer's day?
-Thou art more lovely and more temperate:
-Rough winds do shake the darling buds of May,
-And summer's lease hath all too short a date:
-
-Sometime too hot the eye of heaven shines,
-And often is his gold complexion dimm'd:
-And every fair from fair sometime declines,
-By chance, or nature's changing course, untrimm'd.
-
-But thy eternal summer shall not fade
-Nor lose possession of that fair thou owest;
-Nor shall death brag thou wanderest in his shade,
-When in eternal lines to time thou growest:
-
-So long as men can breathe, or eyes can see,
-So long lives this, and this gives life to thee.
-
-@A William Shakespeare
-#
-@T Carpe Diem
-
-O Mistress, where are you roaming?
-O stay and hear! your true-love's coming
-That can sing both high and low;
-Trip no further, pretty sweeting,
-Journey's end in lovers' meeting -
-Every wise man's son doth know.
-
-What is love? 'tis not hereafter;
-Present mirth hath present laughter;
-What's to come is still unsure;
-In delay there lies no plenty,-
-Then come kiss me, Sweet-and-twenty,
-Youth's a stuff will not endure.
-
-@A William Shakespeare
-#
-@T A Sea Dirge
-
-Full fathom five thy father lies:
-Of his bones are coral made;
-Those are peals that were his eyes;
-Nothing of him that doth fade
-But doth suffer a sea-change
-Into something rich and strange.
-Sea-nymphs hourly ring his knell;
-Hark! now I hear them,-
-Ding, dong, bell.
-
-@A William Shakespeare
-#
-@T On the Tombs in Westminster Abbey
-
-Mortality, behold and fear,
-What a change of flesh is here!
-Think how many royal bones
-Sleep within these heaps of stones;
-Here they lie, had realms and lands,
-Who now want strength to stir their hands,
-Where from their pulpits seal'd with dust
-They preach, `In greatness is no trust.'
-Here's an acre sown indeed
-With the richest royallest seed
-That the earth did e'er suck in
-Since the first man died for sin:
-Here the bones of birth have cried
-`Though gods they were, as men they died!'
-Here are sands, ignoble things,
-Dropt from the ruin'd sides of kings:
-Here's a world of pomp and state
-Buried in dust, once dead by fate.
-
-@A F. Beaumont
-#
-@T The Terror of Death
-
-When I have fears that I may cease to be
-Before my pen has glean'd my teeming brain,
-Before high-piled books, in charact'ry
-Hold like rich garners the full-ripen'd grain;
-
-When I behold, upon the night's starr'd face,
-Huge cloudy symbols of a high romance,
-And think that I may never live to trace
-Their shadows, with the magic hand of chance;
-
-And when I feel, fair creature of an hour!
-That I shall never look upon thee more,
-Never have relish in the fairy power
-Of unreflecting love - then on the shore
-
-Of the wide world I stand alone, and think
-Till love and fame to nothingness do sink.
-
-@A J. Keats
-#
-@T Young and Old
-
-When all the world is young, lad,
-And all the trees are green;
-And every goose a swan, lad,
-And every lass a queen;
-Then hey for boot and horse, lad,
-And round the world away;
-Young blood must have its course, lad,
-And every dog his day.
-
-When all the world is old, lad,
-And all the trees are brown;
-And all the sport is stale, lad,
-And all the wheels run down;
-Creep home, and take your place there,
-The spent and maimed among:
-God grant you find one face there,
-You loved when all was young.
-
-@A C. Kingsley
-#
-@T Pied Beauty
-
-Glory be to God for dappled things-
-For skies of couple-colour as a brindled cow;
-For rose-moles all in stipple upon trout that swim;
-Fresh-firecoal chestnut-falls; finches' wings;
-Landscape plotted and pieced - fold, fallow, and plough;
-And all trades, their gear and tackle and trim.
-
-All things counter, original, spare, strange;
-Whatever is fickle, freckled (who knows how?)
-With swift, slow; sweet, sour; adazzle, dim;
-He fathers-forth whose beauty is past change:
-Praise Him.
-
-@A Gerard Manley-Hopkins
-#
-@T The Lake Isle of Innisfree
-
-I will arise, and go to Innisfree,
-And a small cabin build there, of clay and wattles made;
-Nine bean rows will I have there, a hive for the hiney bee,
-And live alone in the bee-loud glade.
-
-And I shall have some peace there, for peace comes dropping slow,
-Dropping from the veils of the morning to where the cricket sings;
-There midnight's all a-glimmer, and noon a purple glow,
-And evening full of the linnet's wings.
-
-I will arise and go now, for always night and day
-I hear lake water lapping with low sounds by the shores;
-While I stand on the roadway, or on the pavements gray,
-I hear it in the deep heart's core.
-
-@A W.B. Yeats
-#
-@T The Soldier
-
-If I should die, think only this of me:
-That there's some corner of a foreign field
-That is for ever England. There shall be
-In that rich earth a richer dust concealed;
-A dust whom England bore, shaped, made aware,
-Gave, once, her flowers to love, her ways to roam,
-Washed by the rivers, blest by suns of home.
-
-And think, this heart, all evil shed away,
-A pulse in the eternal mind, no less
-Gives somewhere back the thoughts by England given;
-Her sights and sounds; dreams happy as her day;
-And laughter, learnt of friends; and gentleness,
-In hearts at peace, under an English heaven.
-
-@A Rupert Brooke
-#
-@T Towers
-
-Protected from the gales, we,
-By the line of trees along the bank
-From storms that batter Fife
-And life here through the changing seasons -
-Unchanging, a lonely beauty,
-No reason to look to the rush
-Beyond the rustle of the bushes.
-But through the curtain of our trees,
-The distant towers like castle turrets
-Gleam by day and shine by night,
-Holding, choking
-Invisible souls within the shearing concrete height.
-
-@A Julian Smart
-#
-@T Break of Day
-
-Tis true, 'tis day; what though it be?
-O wilt thou therefore rise from me?
-Why should we rise, because 'tis light?
-Did we lie down, because 'twas night?
-Love which in spite of darkness brought us hither,
-Should in despite of light keep us together.
-
-Light hath no tongue, but is all eye;
-If it could speak as well as spy,
-This were the worst, that it could say,
-That being well, I fain would stay,
-And that I loved my heart and honour so,
-That I would not from him, that had them, go.
-
-Must business thee from hence remove?
-Oh, that's the worst disease of love,
-The poor, the foul, the false, love can
-Admit. but not the busied man.
-He which hath business, and makes love, doth do
-Such wrong, as when a married man doth woo.
-
-@A John Donne
-#
-@T The Computation
-
-For the first twenty years, since yesterday,
-I scarce believed, thou could'st be gone away,
-For forty more, I fed on favours past,
-And forty on hopes, that thou would'st, they might last.
-Tears drowned one hundred, and sighs blew out two,
-A thousand, I did neither think, nor do,
-Or not divide, all being one thought of you;
-Or in a thousand more, forget that too.
-Yet call not this long life; but think that I
-Am, by being dead, immortal; can ghosts die?
-
-@A John Dunne
-#
-@T A Red, Red Rose
-
-O, my love's like a red, red rose,
-That's newly sprung in June.
-O, my love's like the melodie,
-That's sweetly play'd in tune.
-
-As fair art thou, my bonnie lass,
-So deep in love am I,
-And I will love thee still, my Dear,
-Till a' the seas gang dry.
-
-Till a' the seas gang dry, my Dear,
-And the rocks melt wi' the sun!
-O, I will love thee still, my Dear,
-While the sands o' life shall run.
-
-And fare thee weel, my only Love,
-And fare thee weel a while!
-And I will come again, my Love,
-Tho' it were ten thousand mile!
-
-@A Robert Burns
-#
-@T On Charles II
-
-Here lies our sovereign Lord the King,
-Whose word no man relies on,
-Who never said a foolish thing
-Nor ever did a wise one.
-
-@A Earl of Rochester
-#
-@T The Four Georges
-
-George the First was always reckoned
-Vile - but viler George the Second;
-And what mortal ever heard
-Any good of George the Third?
-When from earth the Fourth descended,
-God be praised, the Georges ended!
-
-@A W.S. Landor
-#
-@T Frederick, Prince of Wales
-
-Here lies Fred,
-Who was alive, and is dead,
-Had it been his father,
-I had much rather.
-Had it been his brother,
-Still better than another.
-Had it been his sister,
-No one would have missed her.
-Had it been the whole generation,
-Still better for the nation.
-But since 'tis only Fred,
-Who was alive, and is dead,
-There's no more to be said.
-
-@A W.M. Thackeray
-#
-@T On an Old Woman
-
-Mycilla dyes her locks, 'tis said,
-But 'tis a foul aspersion;
-She buys them black, they therefore need
-No subsequent immersion.
-
-@A W. Cowper
-#
-@T An Epitaph on Sir John Vanbrugh (Architect)
-
-Under this stone, reader, survey
-Dead Sir John Vanbrugh's house of clay.
-Lie heavy on him, earth! for he
-Laid many heavy loads on thee.
-
-@A A. Evans
-#
-@T True Joy in Possession
-
-To have a thing is little,
-If you're not allowed to show it,
-And to know a thing is nothing
-Unless others know you know it.
-
-@A Lord Neaves
-#
-@T To His Mistress Going To Bed
-
-Come, Madam, come, all rest my powers defy,
-Until I labour, I in labour lie.
-The foe oft-times having the foe in sight,
-Is tired with standing though he never fight.
-Off with that girdle, like heaven's zone glistering,
-But a far fairer world encompassing.
-Unpin that spangled breastplate which you wear,
-That th'eyes of busy fools may be stopt there.
-Unlace yourself, for that harmonious chime
-Tells me from you, that now it is bed time.
-Off with that happy busk, which I envy,
-That still can be, and still can stand so nigh.
-Your gown going off, such beauteous state reveals,
-As when from flowry meads the hill's shadow steals.
-@P
-Off with that wiry coronet and show
-The hairy diadem which on you doth grow:
-Now off with those shoes, and then safely tread
-In this love's hallowed temple, this soft bed.
-In such white robes, heaven's angels used to be
-Received by men; thou angel bring'st with thee
-A heaven like Mahomet's Paradise; and though
-Ill spirits walk in white, we easily know,
-By this these angels from an evil sprite,
-Those set our hairs, but these our flesh upright.
-
-Licence my roving hands, and let them go,
-Before, behind, between, above, below.
-O my America! my new-found-land,
-My kingdom, safeliest when with one man manned,
-My mine of precious stones, My empery,
-How blest am I in this discovering thee!
-To enter in these bonds, is to be free;
-Then where my hand is set, my seal shall be.
-@P
-Full nakedness! All joys are due to thee,
-As souls unbodied, bodies unclothed must be,
-To taste whole joys.  Gems which you women use
-Are like Atlanta's balls, cast in men's views,
-That when a fool's eye lighteth on a gem,
-His earthly soul may covet theirs, not them.
-Like pictures, or like books' gay coverings made
-For lay-men, are all women this arrayed;
-Themselves are mystic books, which only we
-(Whom their imputed grace will dignify)
-Must see revealed. Then since that I may know,
-As liberally, as to a midwife, show
-Thyself: cast all, yea, this white linen hence,
-There is no penance due to innocence.
-
-To teach thee, I am naked first; why then
-What needst thou have more covering than a man.
-
-@A John Donne
-#
-@T Cheltenham Waters
-
-Here lie I and my four daughters,
-Killed by drinking Cheltenham waters.
-Had we but stuck to Epsom salts,
-We wouldn't have been in these here vaults.
-
-@A Anonymous
-#
-@T Hypocrisy
-
-Hypocrisy will serve as well
-To propagate a church as zeal;
-As persecution and promotion
-Do equally advance devotion:
-So round white stones will serve, they say,
-As well as eggs to make hens lay.
-
-@A Samuel Butler
-#
-@T The Microbe
-
-The Microbe is so very small
-You cannot make him out at all,
-But many sanguine people hope
-To see him through a microscope.
-His jointed tongue that lies beneath
-A hundred curious rows of teeth;
-His seven tufted tails with lots
-Of lovely pink and purple spots,
-On each of which a pattern stands,
-Composed of forty separate bands;
-His eyebrows of a tender green;
-All of these have never yet been seen -
-But Scientists, who ought to know,
-Assures us that they must be so...
-Oh! let us never, never doubt
-What nobody is sure about!
-
-@A Hilaire Belloc
-#
-@T Slug
-
-Slugs, soft upon damp carpets of rich food,
-Make sullen love with bubbles and with sighs,
-Silvery flaccid.  They consider lewd
-The use of eyes.
-
-@A John Pudney
-#
-@T The Doctor Prescribes
-
-A lady lately, that was fully sped
-Of all the pleasures of the marriage-bed
-Ask'd a physician, whether were more fit
-For Venus' sports, the morning or the night?
-The good old man made answer, as 'twas meet,
-The morn more wholesome, but the night more sweet.
-Nay then, i'faith, quoth she, since we have leisure,
-We'll to't each morn for health, each night for pleasure.
-
-@A Anonymous
-#
-@T On Mary Ann
-
-Mary Ann has gone to rest,
-Safe at last on Abraham's breast,
-Which may be nuts for Mary Ann,
-But is certainly rough on Abraham.
-
-@A Anonymous
-#
-@T Misfortunes never come Singly
-
-Making toast at the fireside,
-Nurse fell in the grate and died;
-And what makes it ten times worse,
-All the toast was burnt with nurse.
-
-@A Harry Graham
-#
-@T Tender Heartedness
-
-Billy, in one of his nice new sashes,
-Fell in the fire and was burnt to ashes;
-Now, although the room grows chilly,
-I haven't the heart to poke poor Billy.
-
-@A Harry Graham
-#
-@T Miss Twye
-
-Miss Twye was soaping her breasts in her bath
-When she heard behind her a meaning laugh
-And to her amazement she discovered
-A wicked man in the bathroom cupboard.
-
-@A Gavin Ewart
-#
-@T The Old Loony of Lyme
-
-There was an old loony of Lyme,
-Whose candour was simply sublime;
-When they asked, 'Are you there?'
-'Yes,' he said, 'but take care,
-For I'm never "all there" at a time.'
-
-@A Anonymous
-#
-@T The Young Lady from Wantage
-
-There was a young lady from Wantage
-Of whom the town clerk took advantage.
-Said the borough surveyor:
-'Indeed you must pay `er.
-You've totally altered her frontage.'
-
-@A Anonymous
-#
-@T The Modern Hiawatha
-
-When he killed the Mudjokivis
-Of the skin he made him mittens,
-Made them with the fur side inside,
-Made them with the skin side outside,
-He, to get the warm side inside,
-Put the inside skin side outside;
-He, to get the cold side outside,
-Put the warm side fur side inside.
-That's why he put fur side inside,
-Why he put the skin side outside,
-Why he turned them inside outside.
-
-@A Anonymous
-#
-@T Is it a Month
-
-Is it a month since I and you
-In the starlight of Glen Dubh
-Stretched beneath a hazel bough
-Kissed from ear and throat to brow,
-Since your fingers, neck, and chin
-Made the bars that fence me in,
-Till Paradise seemed but a wreck
-Near your bosom, brow and neck
-And stars grew wilder, growing wise,
-In the splendour of your eyes!
-Since the weasel wandered near
-Whilst we kissed from ear to ear
-And the wet and withered leaves
-Blew about your cap and sleeves,
-Till the moon sank tired through the ledge
-Of the wet and windy hedge?
-And we took the starry lane
-Back to Dublin town again.
-
-@A J. M. Synge
-@A (1871-1909)
-#
-@T The Lark in the Clear Air
-
-Dear thoughts are in my mind,
-And my soul soars enchanted,
-As I hear the sweet lark sing
-In the clear air of the day.
-For a tender beaming smile
-To my hope has been granted,
-And tomorrow she shall hear
-All my fond heart would say.
-
-I shall tell her all my love,
-All my soul's adoration;
-And I think she will hear me
-And will not say me nay.
-It is this that fills my soul
-With its joyous elation,
-As I hear the sweet lark sing
-In the clear air of the day.
-
-@A Samuel Ferguson
-@A (1810-1886)
-#
-@T The Self-Unseeing
-
-Here is the ancient floor,
-Footworn and hollowed and thin,
-Here was the former door
-Where the dead feet walked in.
-
-She sat here in her chair,
-Smiling into the fire;
-He who played stood there,
-Bowing it higher and higher.
-
-Childlike, I danced in a dream;
-Blessings emblazoned that day;
-Everything glowed with a gleam;
-Yet we were looking away!
-
-@A Thomas Hardy
-#
-@T Cean Dubh Deelish (Darling Black Head)
-
-Put your head, darling, darling, darling,
-Your darling black head my heart above;
-O mouth of honey, with thyme for fragrance,
-Who, with heart in breast, could deny you love?
-
-O many and many a young girl for me is pining,
-Letting her locks of gold to the cold wind free,
-For me, the foremost of our gay young fellows;
-But I'd leave a hundred, pure love, for thee!
-
-Put your head, darling, darling, darling,
-Your darling black head my heart above;
-O mouth of honey, with thyme for fragrance,
-Who, with heart in breast, could deny you love?
-
-@A Samuel Ferguson
-@A (1810-1886)
-#
-@T From 'The Amores'
-
-Ring of mine, made to encircle my pretty mistress's finger,
-Valuable only in terms of the giver's love,
-Go, and good welcome! May she receive you with pleasure,
-Slip you over her knuckle there and then.
-May you fit her as well as she fits me, rub snugly
-Around her finger, precisely the right size!
-Lucky ring to be handled by my mistress!  I'm developing
-A miserable jealousy of my own gift.
-But suppose I could be the ring, transformed in an instant
-By some famous magician's art -
-Then, when I felt like running my hand down Corinna's
-Dress, and exploring her breasts, I'd work
-Myself off her finger (tight squeeze or not) and by crafty
-Cunning drop into her cleavage.  Let's say
-She was writing a private letter - I'd have to seal it,
-@P
-And a dry stone sticks on wax:
-She's moisten me with her tongue. Pure bliss - provided
-I didn't have to endorse any hostile remarks
-Against myself. If she wanted to put me away in her
-Jewel-box, I'd cling tighter, refuse to budge.
-(Don't worry, my sweet, I'd never cause you discomfort,
-or burden
-Your slender finger with an unwelcome weight.)
-Wear me whenever you take a hot shower, don't worry
-If water runs under your gem -
-Though I fancy the sight of you naked would arise my
-passions, leave me
-A ring of visibly virile parts...
-Pure wishful thinking! On your way, then, little present,
-And show her you come with all my love.
-
-@A Ovid
-@A (BC 43-AD 17)
-#
-@T After an Interval
-
-After an interval, reading, here in the midnight,
-With the great stars looking on -- all the starts of Orion looking,
-And the silent Pleiades -- and the duo looking of Saturn and ruddy Mars;
-Pondering, reading my own songs, after a long interval,
-(sorrow and death familiar now)
-Ere Closing the book, what pride! what joy! to find them
-Standing so well the test of death and night,
-And the duo of Saturn and Mars!
-
-@A Walt Whitman
-#
-@T A Last Poem
-
-A last poem, and a last, and yet another --
-O, when can I give over?
-Must I drive the pen until the blood bursts from my nails
-And my breath fails and I shake with fever?
-Shall I never hear her whisper softly,
-"But this is one written by you only,
-And for me only; therefore, love, have done"?
-
-@A Robert Graves
-#
-I have no pain, dear Mother, now,
-But, oh, I am so dry;
-So connect me to a brewery,
-And leave me there to die.
-
-@A Anonymous
-#
-@T Found Poem (from the Hound of the Baskervilles)
-
-I stooped, panting, and pressed my pistol
-To the dreaful, shimmering head,
-But it was useless to press the trigger,
-The giant hound was dead.
-
-@A A. Conan Doyle
-#
-@T Passing through the Carron Iron Works
-
-We cam na here to view your warks,
-In hopes to be mair wise,
-But only, lest we gang to Hell,
-It may be nae surprise.
-
-@A Robert Burns
-#
-@T Imitation of Pope: A Compliment to the Ladies
-
-Wondrous the Gods, more wondrous are the Men,
-More Wondrous Wondrous still the Cock & Hen,
-More Wondrous still the Table, Stool & Chair;
-But Ah! More wondrous still the Charming Fair.
-
-@A William Blake
-#
-@T Upon the Nipples of Julia's Breast
-
-Have ye beheld (with much delight)
-A red rose peeping through a white?
-Or else a cherry (double grac'd)
-Within a lily? Centre plac'd?
-Or ever mark'd the pretty beam,
-A strawberry shows half drown'd in cream?
-Or seen rich rubies blushing through
-A pure smooth pearl, and orient too?
-So like to this, nay all the rest,
-Is each neat niplet of her breast.
-
-@A Robert Herrick
-#
-@T Life
-
-When I consider life, 'tis all a cheat;
-Yet, fooled with hope, men favour the deceit;
-Trust on, and think tomorrow will repay:
-Tomorrow's falser than the former day;
-Lies worse; and while it says, we shall be blessed
-With some new joys, cut off what we possessed.
-Strange cozenage! None would live past years again,
-Yet all hope pleasure in what yet remain;
-And from the dregs of life think to receive
-What the first sprightly running could not give.
-
-@A John Dryden
-#
-@T To a Yellow Hammer
-
-Poor yellow-breasted little thing,
-I would thou had'st been on the wing,
-'Ere 'twas my fate on thee to bring
-Thy death so soon;
-Thou'lt never more be heard to sing
-In joyful tune.
-
-Too late I saw thee 'mongst the dust,
-Gambling so gay in simple trust,
-I knew that with my wheel I must
-Thy life destroy;
-How cruel quick my rubber crushed
-Thee in thy joy.
-
-@A Anonymous
-#
-@T Wrecked
-
-A girl, a wheel,
-A shock, a squeal,
-A header, a thump,
-A girl in a lump,
-A bloomer all torn,
-A maiden forlorn.
-
-@A Annymous
-#
-@T Gather ye Rosebuds
-
-Gather ye rosebuds while ye may,
-Old Time is still a-flying;
-And this same flower that smiles today
-Tomorrow will be dying.
-
-The glorious lamp of heaven, the Sun,
-The higher he's a-getting,
-The sooner will his race be run,
-And nearer he's to setting.
-
-That age is best, which is the first,
-When youth and blood are warmer
-But being spent, the worse, and worst
-Times still succeed the former.
-
-Then be not coy, but use your time,
-And while you may, go marry;
-For having lost but once your prime,
-You may for ever tarry.
-
-@A Robert Herrick
-#
-@T My Love's a Match
-
-My love's a match in beauty
-For every flower that blows,
-Her little ear's a lily,
-Her velvet cheek a rose;
-Her locks like gilly gowans
-Hang golden to her knww.
-If I were King of Ireland,
-My Queen she'd surely be.
-
-Her eyes are fond forget-me-nots,
-And no such snow is seen
-Upon the heaving hawthorn bush
-As crests her bodice green.
-The thrushes when she's talking
-Sit listening on the tree.
-If I were King of Ireland,
-My Queen she'd surely be.
-
-@A Alfred P. Graves
-#
-@T In a Gondola
-
-The moth's kiss, first!
-Kiss me as if you made believe
-You were not sure, this eve,
-How my face, your flower, had pursed
-Its petals up; so, here and there
-You brush it, till I grow aware
-Who wants me, and wide ope I burst.
-
-The bee's kiss, now!
-Kiss me as if you enter'd gay
-My heart at some noonday,
-A bud that dares not disallow
-The claim, so all is render'd up,
-And passively its shatter'd cup
-Over your head to sleep I bow.
-
-@A Robert Browning
-#
-@T To his Coy Mistress
-
-Had we but worlds enough, and time,
-This coyness, Lady, were no crime.
-We would sit down and think which way
-To walk and pass our long love's day.
-Thou by the Indian Ganges' side
-Shouldst rubies find: I by the tide
-Of Humber would complain. I would
-Love you ten years before the Flood,
-And you should, if you please, refuse
-Till the conversion of the Jews.
-My vegetable love should grow
-Vaster than empires, and more slow;
-An hundred years should go to praise
-Thine eyes and on thy forehead gaze;
-Two hundred to adore each breast,
-But thirty thousand to the rest;
-An age at least to every part,
-And the last age should show your heart.
-For, Lady, you deserve this state,
-Nor would I love at a lower rate.
-@P
-But at my back I always hear
-Time's winged chariot hurrying near;
-And yonder all before us lie
-Deserts of vast eternity.
-Thy beauty shall no more be found,
-Nor, in thy marble vault, shall sound
-My echoing song: then worms shall try
-That long preserved virginity,
-And your quaint honour turn to dust,
-And into ashes all my lust:
-The grave's a fine and private place,
-But none, I think, do there embrace.
-@P
-Now therefore, while the youthful hue
-Sits on thy skin like morning dew,
-And while thy willing soul transpires
-At every port with instant fires,
-Now let us sport us while we may,
-And now, like amorous birds of prey,
-Rather at once our time devour
-Than languish in his slow-chapt power.
-Let us roll all our strength and all
-Our sweetness up into one ball,
-And tear our pleasures with rough strife
-Through the iron gates of life:
-Thus, though we cannot make our sun
-Stand still, yet we will make him run.
-
-@A Andrew Marvell
-#
-@T Destiny
-
-Somewhere there waiteth in this world of ours
-For one lone soul another lonely soul,
-Each choosing each through all the weary hours
-And meeting strangely at one sudden goal.
-Then blend they, like green leaves with golden flowers,
-Into one beautiful and perfect whole;
-And life's long night is ended, and the way
-Lies open onward to eternal day.
-
-@A Edwin Arnold
-#
-@T A Stolen Kiss
-
-Now gentle sleep hath closed up those eyes
-Which, waking, kept my boldest thoughts in awe;
-And free access unto that sweet lip lies,
-From whence I long the rosy breath to draw.
-
-Methinks no wrong it were, if I should steal
-From those two melting rubies one poor kiss;
-None sees the theft that would the theft reveal,
-Nor rob I her of aught that she can miss;
-
-Nay, should I twenty kisses take away,
-There would be little sign I would do so;
-Why then should I this robbery delay?
-O, she may wake, and therewith angry grow!
-
-Well, if she do, I'll back restore that one,
-And twenty hundred thousand more for loan.
-
-@A George Wither
-#
-@T How do I love thee?
-
-How do I love thee? Let me count the ways.
-I love thee to the depth and breadth and height
-My soul can reach, when feeling out of sight
-For the ends of Being and ideal Grace.
-I love thee to the level of every day's
-Most quiet need, by sun and candlelight.
-I love thee freely, as men strive for Right;
-I love thee purely, as they turn from Praise.
-I love thee with the passion put to use
-In my old griefs, and with my childhood's faith.
-I love thee with a love I seemed to lose
-With my lost saints, -- I love thee with the breath,
-Smiles, tears, of all my life! -- and, if God choose,
-I shall but love thee better after death.
-
-@A Elizabeth Barrett Browning
-#
-@T Old Man
-
-Old Man, or Lad's-love, -- in the name there's nothing
-To one that knows not Lad's-love, or Old Man,
-The hoar-green feathery herb, almost a tree,
-Growing with rosemary and lavendar.
-Even to one that knows it well, the names
-Hald decorate, half perplex, the thing it is:
-At least, what that is clings not to the names
-In spite of time.  And yet I like the names.
-
-The herb itself I like not, but for certain
-I love it, as some day the child will love it
-Who plucks a feather from the door-side bush
-Whenever she goes in or out of the house.
-Often she waits there, snipping the tips and shrivelling
-The shreds at last on to the path, perhaps
-@P
-Thinking, perhaps of nothing, till she sniffs
-Her finger and runs off. The bush is still
-But half as tall as she, though it is as old;
-So well she clips it. Not a word she says;
-And I can only wonder hwo much hereafter
-She will remember, with that bitter scent,
-Of garden rows, and ancient damson-trees
-Topping a hedge, a bent path to a door,
-A low thick bush beside the door, and me
-Forbidding her to pick.
-
-As for myself,
-Where first I met the bitter scent is lost.
-I, too, often shrivel the grey shreds,
-Sniff them and think and sniff again and try
-Once more to think what it is I am remembering,
-Always in vain. I cannot like the scent,
-Yet I would rather give up others more sweet,
-With no meaning, that this bitter one.
-@P
-I have mislaid the key. I sniff the spray
-And think of nothing; I see and I hear nothing;
-Yet seem, too, to be listening, lying in wait
-For what I should, yet never can, remember:
-No garden appears, no path, no hoar-green bush
-Of Lad's-love, or Old Man, no child beside,
-Neither father nor mother, nor any playmate;
-Only an avenue, dark and nameless, without end.
-
-@A Edward Thomas
-#
-@T The Manor Farm
-
-The rock-like mud unfroze a little and rills
-Ran and sparkled down each side of the road
-Under the catkins wagging in the hedge.
-But earth would have her sleep out, spite of the sun;
-Nor did I value that thin gilding beam
-More than a pretty February thing
-Till I came down to the old Manor Farm,
-And church and yet-tree opposite, in age
-Its equal and in size. Small church, great yew,
-And farmhouse slept in a Sunday silentness.
-The air raised not a straw. The steep farm roof,
-With tiles duskily glowing, entertained
-The midday sun; and up and down the roof
-White pigeons nestled. There was no sound but one.
-Three cart-horses were looking over a gate
-Drowsily through their forelocks, swiching their tails
-Against a fly, a solitary fly.
-@P
-The Winter's cheek flushed as if he had drained
-Spring, Summer, and Autumn at a draught
-And smiled quietly. But 'twas not Winter --
-Rather a season of bliss unchangeable
-Awakened from farm and church where it had lain
-Safe under tile and thatch for ages since
-This England, Old already, was called Merry.
-
-@A Edward Thomas
-#
-@T The Unknown Bird
-
-Three lovely notes he whistled, too soft to be heard
-If others sang; but others never sang
-In the great beech-wood all that May and June.
-No one saw him: I alone could hear him
-Though many listened. Was it but four years
-Ago? or five? He never came again.
-Oftenest when I heard him I was alone,
-Nor could I ever make another hear.
-La-la-la! he called, seeming far-off --
-As if a cock crowed past the edge of the world,
-As if the bird or I were in a dream.
-Yet that he travelled through the trees and soometimes
-Neared me, was plain, though somehow distant still
-He sounded. All the proof is -- I told men
-What I had heard.
-@P
-I never knew a voice,
-Man, beast, or bird, better than this. I told
-The naturalists; but neither had they heard
-Anything like the notes that did so haunt me
-I had them clear by heart and have them still.
-Four years, or five, have made no difference. Then
-As now that La-la-la! was bodiless sweet:
-Sad more than joyful it was, if I must say
-'Twas sad only with joy too, too far off
-For me to taste it. But I cannot tell
-If truly never anything but fair
-The days were when he sang, as now they seem.
-This surely I know, that I who listened then,
-Happy sometimes, sometimes suffering
-A heavy body and a heavy heart,
-Now straightaway, if I think of it, become
-Light as that bird wandering beyond my shore.
-
-@A Edward Thomas
-#
-@T First known when lost
-
-I never had noticed it until
-'Twas gone, -- the narrow copse
-Where now the woodman lops
-The last of the willows with his bill.
-
-It was not more than a hedge o'ergrown.
-One meadow's breadth away
-I passed it day by day.
-Now the soil is bare as a bone,
-
-And black betwixt two meadows green,
-Though fresh-cut faggot ends
-Of hazel make some amends
-With a gleam as if flowers they had been.
-
-Strange it could have hidden so near!
-And now I see as I look
-That the small winding brook,
-A tributary's tributary rises there.
-
-@A Edward Thomas
-#
-@T The Owl
-
-Downhill I came, hungry, and yet not starved;
-Cold, yet had heat within me that was proof
-Against the North wind: tired, yet so that rest
-Had seemed the sweetest thing under a roof.
-
-Then at the inn I had food, fire, and rest,
-Knowing how hungry, cold and tired was I.
-All of the night was quite barred out except
-An owl's cry, a most melancholy cry
-
-Shaken out long and clear upon the hill,
-No merry note, nor cause of merriment,
-But one telling me plain what I escaped
-And others could not, that night, as in I went.
-
-And salted was my food, and my repose,
-Salted and sobered, too, by the bird's voice
-Speaking for all who lay under the stars,
-Soldiers and poor, unable to rejoice.
-
-@A Edward Thomas
-#
-@T But these things also
-
-But these things also are Spring's --
-On banks by the roadside the grass
-Long-dead that is greyer now
-Than all the Winter it was;
-
-The shell of a little snail bleached
-In the grass; chip of flint, and mite
-Of chalk; and the small bird's dung
-In splashes of purest white:
-
-All the white things a man mistakes
-For earliest violets
-Who seeks through Winter's ruins
-Something to pay Winter's debts,
-
-While the North blows, and starling flocks
-By chattering on and on
-Keeep their spirits up in the mist,
-And Spring's here, Winter's not gone.
-
-@A Edward Thomas
-#
-@T The New House
-
-Now first, as I shut the door,
-I was alone
-In the new house; and the wind
-Began to moan.
-
-Old at once was the house,
-And I was old;
-My ears were teased with the dread
-Of what was foretold,
-
-Nights of storm, days of mist, without end;
-Sad days when the sun
-Shone in vain: old griefs, and griefs
-Not yet begun.
-
-All was foretold me; naught
-Could I foresee;
-But I learnt how the wind would sound
-After these things should be.
-
-@A Edward Thomas
-#
-@T Lovers
-
-The two men in the road were taken aback.
-The lovers came out shading their eyes from the sun,
-And never was white so white, or black so black,
-As her cheeks and hair. 'There are more things than one
-A man might turn into a wood for, Jack,'
-Said George; Jack whispered: 'He has not got a gun.
-It's a bit too much of a good thing, I say.
-They are going the other road, look. And see her run.' --
-She ran -- 'What a thing it is, this picking may.'
-
-@A Edward Thomas
-#
-@T Melancholy
-
-The rain and wind, the rain and wind, raved endlessly.
-On me the Summer storm, and fever, and melancholy
-Wrought magic, so that if I feared the solitude
-Far more I feared all company: too sharp, too rude,
-Had been the wisest or the dearest human voice.
-What I desired I knew not, but whate'er my choice
-Vain it must be, I knew. Yet naught did my despair
-But sweeten the strange sweetness, while through the wild air
-All day long I heard a distant cuckoo calling
-And, soft as dulcimers, sounds of near water falling,
-And, softer, and remote as if in history,
-Rumours of what had touched my friends, my foes, or me.
-
-@A Edward Thomas
-#
-@T The Glory
-
-The glory of the beauty of the morning, --
-The cuckoo crying over the untouched dew;
-The blackbird that has found it, and the dove
-That tempts me on to something sweeter than love;
-White clouds ranged even and fair as new-mown hay;
-The heat, the stir, the sublime vancancy
-Of sky meadow and forest and my own heart: --
-The glory invites me, yet it leaves me scorning
-All I can ever do, all I can be,
-Beside the lovely of motion, shape, and hue,
-The happiness I fancy fit to dwell
-In beauty's presence. Shall I now this day
-@P
-Begin to seek as far as heaven, as hell,
-Wisdom or strength to match this beauty, start
-And tread the pale dust pitted with small dark drops,
-In hope to find whatever it is I seek,
-Hearkening to short-lived happy-seeming things
-That we know naught of, in the hazel copse?
-Or must I be content with discontent
-As larks and swallows are perhaps with wings?
-And shall I ask at the day's end once more
-What beauty is, and what I can have meant
-By happiness? And shall I let all go,
-Glad, weary, or both? Or shall I perhaps know
-That I was happy oft and oft before,
-Awhile forgetting how I am fast pent,
-How dreary-swift, with naught to travel to,
-Is Time? I cannot bite the day to the core.
-
-@A Edward Thomas
-#
-@T The Brook
-
-Seated by a brook, watching a child
-Chiefly that paddled, I was this beguiled.
-Mellow the blackbird sang and sharp the thrush
-Not far off in the oak and hazel brush,
-Unseen. There was a scent like honeycomb
-From mugwort dull. And down upon the dome
-Of the stone the card-horse kicks against so oft
-A butterfly alighted. From aloft
-He took the heat of the sun, and from below,
-On the hot stone he perched contented so,
-As if never a cart would pass again
-That way; as if I were the last of men
-And he the first of insects to have earth
-And sun together and to know their worth.
-@P
-I was divided between him and the gleam,
-The motion, and the voices, of the stream,
-The waters running frizzled over gravel,
-Thaat never vanish and for ever travel.
-A grey flycatcher silent on a fence
-And I sat as if we had been there since
-The horseman and the horse lying beneath
-The fir-tree-covered barrow on the heath,
-The horseman and the horse with silver shoes,
-Galloped the downs last. All that I could lose
-I lost. And then the child's voice raised the dead.
-'No one's been here before' was what she said
-And what I felt, yet never should have found
-A word for, while I gathered sight and sound.
-
-@A Edward Thomas
-#
-@T This is no case of petty right or wrong
-
-This is no case of petty right or wrong
-That politicians or philosphers
-Can judge. I hate not Germans, nor grow hot
-With love of Englishmen, to please newspapers.
-Beside my hate for one fat patriot
-My hatred of the Kaiser is love true :--
-A kind of god he is, banging a gong.
-But I have not to choose between the two,
-Or between justice and injustice. Dinned
-With war and argument I read no more
-Than in the storm smoking along the wind
-Athwart the wood. Two witches' cauldrons roar.
-@P
-From one the weather shall rise clear and gay;
-Out of the other an England beautiful
-And like her mother that died yesterday.
-Little I know or care if, being dull,
-I shall miss something that historians
-Can rake out of the ashes when perchance
-The phoenix broods serene above their ken.
-But with the best and meanest Englishmen
-I am one in crying, God save England, lest
-We lose what never slaves and cattle blessed.
-The ages made here that made us from the dust:
-She is all we know and live by, and we trust
-She is good and must endure, loving her so:
-And as we love ourselves we hate her foe.
-
-@A Edward Thomas
-#
-@T Helen
-
-And you, Helen, what should I give you?
-So many things I would give you
-Had I an infinite great store
-Offered me and I stood before
-To choose. I would give you youth,
-All kinds of lovelines and truth,
-A clear eye as good as mine,
-Lands, waters, flowers, wine,
-As many children as your heart
-Might wish for, a far better art
-Than mine can be, all you have lost
-Upon the travelling waters tossed,
-Or given to me. If I could choose
-Freely in that great treasure-house
-Anything from any shelf,
-I would give you back yourself,
-And power to discriminate
-What you want and want it not too late,
-Many fair days free from care
-And heart to enjoy both foul and fair,
-And myself, too, if I could find
-Where it lay hidden and it proved kind.
-
-@A Edward Thomas
-#
-@T Bob's Lane
-
-Women he liked, did shovel-bearded Bob,
-Old Farmer Hayward of the Heath, but he
-Loved horses. He himself was like a cob,
-And leather-coloured. Also he loved a tree.
-
-For the life in them he loved most living things,
-But a tree chiefly. All along the lane
-He planted elms where now the stormcock sings
-That travellers hear from the slow-climbing train.
-
-Till then the track had never had a name
-For all its thicket and the nightingales
-That should have earned it. No one was to blame.
-To name a thing beloved man sometimes fails.
-
-Many years since, Bob Hayward died, and now
-None passes there because the mist and the rain
-Out of the elms have turned the lane to slough
-And gloom, the name alone survives, Bob's Lane.
-
-@A Edward Thomas
-#
-@T The Poetry of Dress
-
-A sweet disorder in the dress
-Kindles in clothes a wantonness :--
-A lawn about the shoulders thrown
-Into a fine distraction, --
-An erring lace, which here and there
-Enthrals the crimson stomacher --
-A cuff neglectful, and thereby
-Ribbands to flow confusedly, --
-A winning wave, deserving note,
-In the tempestuous petticoat, --
-A careless shoe-string, in whose tie
-I see a wild civility, --
-Do more bewitch me, than when art
-Is too precise in evry part.
-
-@A R. Herrick
-#
-@T The Poetry of Dress
-
-When as in silks my Julia goes
-Then, then (methinks) how sweetly flows
-That liquefaction of her clothes.
-
-Next, when I cast mine eyes and see
-That brave vibration each way free;
-O how that glittering taketh me!
-
-@A R. Herrick
-#
-My Love in her attire doth show her wit,
-It doth so well become her:
-For every season she hath dressings fit,
-For Winter, Spring and Summer.
-No beauty she doth miss
-When all her robes are on:
-But Beauty's self she is
-When all her robes are gone.
-
-@A Anonymous
-#
-@T On a Girdle
-
-That which her slender waist confined
-Shall now my joyful temples bind:
-No monarch but would give his crown
-His arms might do what this has done.
-
-It was my Heaven's extremest sphere,
-The pale which held that lovely deer:
-My joy, my grief, my hope, my love
-Did all within this circle move.
-
-A narrow compass! and yet there
-Dwelt all that's good, and all that's fair:
-Give me but what this ribband bound,
-Take all the rest the Sun goes round.
-
-@A E. Waller
-#
-@T The Lost Love
-
-She dwelt among the untrodden ways
-Beside the springs of Dove;
-A maid whom there were none to praise,
-And very few to love:
-
-A violet by a mossy stone
-Half hidden from the eye!
--- Fair as a star, when only one
-Is shining in the sky.
-
-She lived unknown, and few could know
-When Lucy ceased to be;
-But she is in her grave, and oh,
-The difference to me!
-
-@A W. Wordsworth
-#
-I strove with none, for none was worth my strife;
-Nature I loved, and next to Nature, Art;
-I warmed both hands before the fire of life
-It sinks, and I am ready to depart.
-
-@A W. S. Landor
-#
-@T The Miller's Daughter
-
-It is the miller's daughter,
-And she is grown so dear, so dear,
-That I would be the jewel
-That trembles in her ear:
-For his in ringlets day and night,
-I'd touch her neck so warm and white.
-
-And I would be the girdle
-About her dainty waist,
-And her heart would beat against me
-In sorrow and in rest:
-And I should know if it beat right,
-I'd clasp it round so close and tight.
-
-And I would be the necklace,
-And all day long to fall and rise
-Upon her balmy bosom,
-With her laughter or her sighs,
-And I would lie so light, so light,
-I scarce should be unclasp'd at night.
-
-@A Lord Tennyson
-#
-@T Sea-fever
-
-I must down to the seas again, to the lonely sea and the sky,
-And all I ask is a tall ship and a star to steer her by,
-And the wheel's kick and the wind's song and the white sail's shaking,
-And a grey mist on the sea's face and a grey dawn breaking.
-
-I must down to the seas again, for the call of the running tide
-Is a wild call and a clear call that may not be denied;
-And all I ask is a windy day with the white clouds flying,
-And the flung spray and the blown spume, and the sea-gulls crying.
-
-I must down to the seas again, to the vagrant gypsy life,
-To the gull's way and the whale's way where the wind's like a whetted knife;
-And all I ask is a merry yarn from a laughing fellow-rover,
-And a quiet sleep and a sweet dream when the long trick's over.
-
-@A John Masefield
-#
-@T The Drum
-
-I hate that drum's discordant sound,
-Parading round, and round, and round:
-To thoughtless youth it pleasure yields,
-And lures from cities and from fields,
-To sell their liberty for charms
-Of tawdry lace, and glittering arms;
-And when Ambition's voice commands,
-To march, and fight, and fall, in foreign lands.
-
-I hate that drum's discordant sound,
-Parading round, and round, and round:
-To me it talks of ravag'd plains,
-And burning towns, and ruin'd swains,
-And mangled limbs, and dying groans,
-And widows' tears, and orphans' moans;
-And all that Misery's hand bestows,
-To fill the catalogue of human woes.
-
-@A John Scott
-@A (1730-83)
-#
-@T Everlasting Mercy
-
-Near Bullen Bank, on Gloucester road
-Thy everlasting mercy showed
-The ploughman patient on the hill, forever there,
-Forever still
-Ploughing the hill with steady yoke,
-The pine trees lightning-struck and broke.
-
-I've marked the May Hill ploughman stay
-There on his hill day after day
-Driving his team against the sky
-While men and women live and die
-And now and then he seems to stoop
-To clear the coulter with the scoop
-Or touch an ox, to haw or gee,
-While Severn's stream goes out to sea.
-@P
-Near Bullen Bank, on Gloucester road
-Thy everlasting mercy showed
-The ploughman patient on the hill, forever there,
-Forever still
-The sea with all her ships and sails,
-And that great smokey port in Wales,
-And Gloucester tower bright in the sun,
-All know that patient wandering one.
-
-@A John Masefield
-
-Johnny Coppin's haunting arrangement of this available from
-Red Sky Records, 'English Morning' RSKC 107
-#
-@T Dawn
-(From the train between Bologna and Milan, Second Class)
-
-Opposite me two Germans snore and sweat.
-Through sullen swirling gloom we jolt and roar.
-We have been here for ever: even yet
-A dim watch tells two hours, two aeons, more.
-The windows are tight-shut and slimy-wet
-With a night's foetor. There are two hours more;
-Two hours to dawn and Milan; two hours yet.
-Opposite me two Germans sweat and snore...
-
-One of them wakes, and spits, and sleeps again.
-The darkness shivers. A wan light through the rain
-Strikes on our faces, drawn and white. Somewhere
-A new day sprawls; and, inside, the foul air
-Is chill, and damp, and fouler than before...
-Opposite me two Germans sweat and snore.
-
-@A Rupert Brooke
-#
-@T The Voice
-
-Safe in the magic of my woods
-I lay, and watched the dying light.
-Faint in the pale high solitudes,
-And washed with rain and veiled by night,
-
-Silver and blue and green were showing.
-And the dark woods grew darker still;
-And birds were hushed; and peace was growing;
-And quietness crept up the hill;
-
-And no wind was blowing...
-
-And I knew
-That this was the hour of knowing,
-And the night and the woods and you
-Were one together, and I should find
-Soon in the silence the hidden key
-Of all that had hurt and puzzled me --
-Why you were you, and the night was kind,
-And the woods were part of the heart of me.
-@P
-And there I waited breathlessly,
-Alone; and slowly the holy three,
-The three that I loved, together grew
-One, in the hour of knowing,
-Night, and the woods, and you --
-
-And suddenly
-There was an uproar in my woods,
-The noise of a fool in mock distress,
-Crashing and laughing and blindly going,
-Of ignorant feet and a swishing dress,
-And a Voice profaning the solitudes.
-@P
-The spell was broken, the key denied me,
-And at length your flat clear voice beside me
-Mouthed cheerful clear flat platitudes.
-
-You came and quacked beside me in the wood.
-You said, 'The view from here is very good!'
-You said, 'It's nice to be alone a bit!'
-And, 'How the days are drawing out!' you said.
-You said, 'The sunset's pretty, isn't it?'
-
-*              *             *
-
-By God! I wish -- I wish that you were dead!
-
-@A Rupert Brooke
-#
-@T On a Tired Housewife
-
-Here lies a poor woman who was always tired,
-She lived in a house where help wasn't hired;
-Her last words on earth were: 'Dear friends, I am going
-To where there's no cooking, or washing, or sewing,
-For everything there is exact to my wishes,
-For where they don't eat there's no washing of dishes.
-I'll be where loud anthems will always be ringing,
-But having no voice I'll be quit of the singing.
-Don't mourn for me now, don't mourn for me never,
-I am going to do nothing for ever and ever.'
-
-@A Anonymous
-#
-@T On Johnny Cole
-
-Here lies Johnny Cole
-Who died, on my soul,
-After eating a plentiful dinner;
-While chewing his crust,
-He was turned into dust,
-With his crimes undigested - poor sinner.
-
-@A Anonymous
-#
-@T On a Wag in Mauchline
-
-Lament him, Mauchline husbands a',
-He often did assist ye;
-For had ye staid whole weeks awa',
-Your wives they ne'er had missed ye.
-
-Ye Mauchline bairns, as on ye pass,
-To schools in bands thegither,
-Oh, tread ye lightly on his grass,
-Perhaps he was your father.
-
-@A Robert Burns
-#
-@T Willie's Epitaph
-
-Little Willie from his mirror
-Licked the mercury right off,
-Thinking, in his childish error,
-It would cure the whooping cough.
-At the funeral his mother
-Smartly turned to Mrs Brown:
-''Twas a chilly day for Willie
-When the mercury went down.'
-
-@A Anonymous
-#
-@T On Mary Ann Lowder
-
-Here lies the body of Mary Ann Lowder,
-She burst while drinking a seidlitz powder.
-Called from this world to her heavenly rest,
-She should have waited till it effervesced.
-
-@A Anonymous
-#
-@T On Miss Arabella Young
-
-Here lies, returned to clay,
-Miss Arabella Young,
-Who on the first day of May
-Began to hold her tongue.
-
-@A Anonymous
-#
-@T From The Westminster Drollery, 1671
-
-I saw a peacock with a fiery tail
-I saw a blazing comet drop down hail
-I saw a cloud wrapped with ivy round
-I saw an oak creep upon the ground
-I saw a pismire swallow up a whale
-I saw the sea brimful of ale
-I saw a Venice glass full fifteen feet deep
-I saw a well full of men's tears that weep
-I saw red eyes all of a flaming fire
-I saw a house bigger than the moon and higher
-I saw the sun at twelve o'clock at night
-I saw the man that saw this wondrous sight.
-
-@A Anonymous
-#
-@T Epigram
-
-Engraved on the collar which I gave to his
-Royal Highness Frederick Prince of Wales:
-
-I am his Highness' dog at Kew
-Pray tell me, sir, whose dog are you?
-
-@A Alexander Pope
-#
-@T A Man of Words
-
-A man of words and not of deeds,
-Is like a garden full of weeds;
-And when the weeds begin to grow,
-It's like a garden full of snow;
-And when the snow begins to fall,
-It's like a bird upon the wall;
-And when the bird away does fly,
-It's like an eagle in the sky;
-And when the skye begins to roar,
-It's like a lion at the door;
-And when the door begins to crack,
-It's like a stick across your back;
-And when your back begins to smart,
-It's like a penknife in your heart;
-And when your heart begins to bleed,
-You're dead, and dead, and dead indeed.
-
-@A Anonymous
-#
-@T The Voice of the Lobster
-
-''Tis the voice of the Lobster; I heard him declare,
-"You have baked me too brown, I must sugar my hair."
-As a duck with its eyelids, so he with his nose
-Trims his belt and his buttons, and turns out his toes.
-When the sands are all dry, he is gay as a lark,
-And will talk in contemptuous tones of the Shark:
-But, when the tide rises and sharks are around,
-His voice has a timid and tremuous sound.
-
-'I passed by his garden, and marked, with one eye,
-How the Owl and the Panther were sharing a pie:
-The Panther took pie-crust, and gravy, and meat,
-While the Owl had the dish as its share of the treat.
-When the pie was all finished, the Owl, as a boon,
-Was kindly permitted to pocket the spoon:
-While the Panther received knife and fork with a growl,
-And concluded the banquet by --'
-
-@A Lewis Carroll
-#
-@T Lines by a Humanitarian
-
-Be lenient with lobsters, and ever kind to crabs,
-And be not disrespectful to cuttle-fish or dabs;
-Chase not the Cochin-China, chaff not the ox obese,
-And babble not of feather-beds in company with geese.
-Be tender with the tadpole, and let the limpet thrive,
-Be merciful to mussels, don't skin your eels alive;
-When talking to a turtle don't mention calipee --
-Be always kind to animals wherever you may be.
-
-@A Anonymous
-#
-@T The Common Cormorant
-
-The common cormorant or shag
-Lays eggs inside a paper bag.
-The reason you will see no doubt
-It is to keep the lightning out.
-But what these unobservant birds
-Have never noticed is that herds
-Of wandering bears may come with buns
-And steal the bags to hold the crumbs.
-
-@A Anonymous
-#
-@T Imitation of Chaucer
-
-Women ben full of Ragerie,
-Yet swinken not sans secresie
-Thilke Moral shall ye understand,
-From Schoole-boy's Tale of fayre Irelond:
-Which to the Fennes hath him betake,
-To filch the gray Ducke fro the Lake.
-Right then, there passen by the Way
-His Aunt, and eke her Daughters tway.
-Ducke in his Trowses hath he hent,
-Not to be spied of Ladies gent.
-'But ho! our Nephew,' (crieth one)
-'Ho,' quoth another, 'Cozen John';
-And stoppen, and laugh, and callen out, --
-This sely Clerk full low doth lout:
-@P
-They asken that, and talken this,
-'Lo here is Coz, and here is Miss.'
-But, as he glozeth with Speeches soote,
-The Ducke sore tickleth his Erse-root:
-Fore-piece and buttons all-to-brest,
-Forth thrust a white neck, and red crest.
-'Te-he,' cry'd Ladies; Clerke nought spake:
-Miss star'd; and gray Ducke crieth Quake.
-'O Moder, Moder' (quoth the daughter)
-'Be thilke same thing Maids longen a'ter?
-'Better is to pyne on coals and chalke,
-'Then trust on Mon, whose yerde can talke.'
-
-@A Alexander Pope
-#
-@T Sonnet
-
-Live with me, and be my love,
-And we will all the pleasures prove
-That hills and valleys, dales and fields,
-And all the craggy mountains yields.
-
-There will we sit upon the rocks,
-And see the shepherds feed their flocks,
-By shallow rivers, by whose falls
-Melodious birds sing madrigals.
-
-There will I make thee a bed of roses,
-With a thousand fragrant posies,
-A cap of flowers, and a kirtle
-Embroider'd all with leaves of myrtle.
-@P
-A belt of straw and ivy buds,
-With coral clasps and amber studs;
-And if these pleasures may thee move,
-Then live with me and be my love.
-
-LOVE'S ANSWER
-
-If that the world and love were young,
-And truth in every shepherd's tongue,
-These pretty pleasures might me move
-To live with thee and be thy love.
-
-@A William Shakespeare
-#
-@T O No, John!
-
-On yonder hill there stands a creature;
-Who she is I do not know.
-I'll go and court her for her beauty,
-She must answer yes or no.
-O no, John! No, John! No, John! No!
-
-On her bosom are bunches of posies,
-On her breast where flowers grow;
-If I should chance to touch that posy,
-She must answer yes or no.
-O no, John! No, John! No, John! No!
-
-Madam I am come for to court you,
-If your favour I can gain;
-If you will but entertain me,
-Perhaps then I might come again.
-O no, John! No, John! No, John! No!
-
-My husband was a Spanish captain,
-Went to sea a month ago;
-The very last time we kissed and parted,
-Bid me always answer no.
-O no, John! No, John! No, John! No!
-@P
-Madam in your face is beauty,
-In your bosom flowers grow;
-In your bedroom there is pleasure,
-Shall I view it, yes or no?
-O no, John! No, John! No, John! No!
-
-Madam shall I tie your garter,
-Tie it a little above your knee;
-If my hands should slip a little farther,
-Would you think it amiss of me?
-O no, John! No, John! No, John! No!
-
-My love and I went to bed together,
-There we lay till cocks did crow;
-Unclose your arms my dearest jewel,
-Unclose your arms and let me go.
-O no, John! No, John! No, John! No!
-
-@A Old English Folk Song
-#
-@T Unfortunate
-
-Heart, you are as restless as a paper scrap
-That's tossed down dusty pavements by the wind;
-Saying, 'She is most wise, patient and kind.
-Between the small hands folded in her lap
-Surely a shamed head may bow down at length,
-And find forgiveness where the shadows stir
-About her lips, and wisdom in her strength,
-Peace in her peace. Come to her, come to her!' . . .
-
-She will not care. She'll smile to see me come,
-So that I think all Heaven in flower to fold me.
-She'll give me all I ask, kiss me and hold me,
-And open wide upon that holy air
-The gates of peace, and take my tiredness home,
-Kinder than God. But, heart, she will not care.
-
-@A Rupert Brooke
-#
-@T The Busy Heart
-
-Now that we've done our best and worst, and parted,
-I would fill my mind with thoughts that will not rend.
-(O heart, I do not dare go empty-hearted)
-I'll think of Love in books, Love without end;
-Women with child, content; and old men sleeping;
-And wet strong ploughlands, scarred for certain grain;
-And babes that weep, and so forget their weeping;
-And the young heavens, forgetful after rain;
-And evening hush, broken by homing wings;
-And Song's nobility, and Wisdom holy,
-That live, we dead. I would think of a thousand things,
-Lovely and durable, and taste them slowly,
-One after one, like tasting a sweet food.
-I have need to busy my heart with quietude.
-
-@A Rupert Brooke
-#
-@T Love
-
-Love is a breach in the walls, a broken gate,
-Where that comes in that shall not go again;
-Love sells the proud heart's citadel to Fate.
-They have known shame, who love unloved. Even then
-When two mouths, thirsty each for each, find slaking,
-And agony's forgot, and hushed the crying
-Of credulous hearts, in heaven -- such are but taking
-Their own poor dreams within their arms, and lying
-Each in his lonely night, each with a ghost.
-Some share that night. But they know, love grows colder,
-Grows false and dull, that was sweet lies at most.
-Astonishment is no more in hand or shoulder,
-But darkens, and dies out from kiss to kiss.
-All this love; and all love is but this.
-
-@A Rupert Brooke
-#
-@T One Day
-
-Today I have been happy. All the day
-I held the memory of you, and wove
-Its laughter with the dancing light o' the spray,
-And sowed the sky with tiny clouds of love,
-And sent you following the white waves of sea,
-And crowned your head with fancies, nothing worth,
-Stray buds from that old dust of misery,
-Being glad with a new foolish quiet mirth.
-
-So lightly I played with those dark memories,
-Just as a child, beneath the summer skies,
-Plays hour by hour with a strange shining stone,
-For which (he knows not) towns were fire of old,
-And love has been betrayed, and murder done,
-And great kings turned to a little bitter mould.
-
-@A Rupert Brooke
-#
-@T Doubts
-
-When she sleeps, her soul, I know,
-Goes a wanderer on the air,
-Wings where I may never go,
-Leaves her lying, still and fair,
-Waiting, empty, laid aside,
-Like a dress upon a chair...
-This I know, and yet I know
-Doubts that will not be denied.
-
-For if the soul be not in place,
-What has laid trouble in her face?
-And, sits there nothing ware and wise
-Behind the curtains of her eyes,
-What is it, in the self's eclipse,
-Shadows, soft and passingly,
-About the corners of her lips,
-The smile that is essential she?
-
-And if the spirit be not there,
-Why is fragrance in the hair?
-
-@A Rupert Brooke
diff --git a/samples/wxpoem/wxpoem.def b/samples/wxpoem/wxpoem.def
deleted file mode 100644 (file)
index 4cdca34..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-NAME         WXPOEM
-DESCRIPTION  'WXPOEM'
-EXETYPE      WINDOWS
-STUB         'WINSTUB.EXE'
-CODE         PRELOAD MOVEABLE DISCARDABLE
-DATA         PRELOAD MOVEABLE MULTIPLE
-HEAPSIZE     1024
-STACKSIZE    8192
-
diff --git a/samples/wxpoem/wxpoem.h b/samples/wxpoem/wxpoem.h
deleted file mode 100644 (file)
index 2f65c22..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name:        wxpoem.h
-// Purpose:     A small C++ program which displays a random poem on
-//              execution. It also allows search for poems containing a
-//              string.
-//              It requires winpoem.dat and creates winpoem.idx.
-//              Original version (WinPoem) written in 1994.
-//              This has not been rewritten in a long time so
-//              beware, inelegant code!
-// Author:      Julian Smart
-// Created:     12/12/98
-// RCS-ID:      $Id$
-// Copyright:   (c) 1998 Julian Smart
-// Licence:     wxWindows licence
-/////////////////////////////////////////////////////////////////////////////
-
-#ifdef __GNUG__
-#pragma interface "wxpoem.h"
-#endif
-
-// Define a new application
-class MyApp: public wxApp
-{
-  public:
-    bool OnInit();
-    int OnExit();
-};
-
-DECLARE_APP(MyApp)
-
-// Define a new canvas which can receive some events
-class MyCanvas: public wxWindow
-{
-  public:
-    MyCanvas(wxFrame *frame, wxWindowID id, const wxPoint& pos, const wxSize& size);
-
-    void OnPaint(wxPaintEvent& event);
-    void OnMouseEvent(wxMouseEvent& event);
-    void OnChar(wxKeyEvent& event);
-
-    DECLARE_EVENT_TABLE()
-};
-
-// Define a new frame
-class MainWindow: public wxFrame
-{
-  public:
-    MyCanvas *canvas;
-    MainWindow(wxFrame *frame, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style);
-    ~MainWindow();
-
-    void OnCloseWindow(wxCloseEvent& event);
-    void OnChar(wxKeyEvent& event);
-    void OnPopup(wxCommandEvent& event);
-
-    // Display next page or poem
-    void NextPage(void);
-
-    // Display previous page
-    void PreviousPage(void);
-
-    // User search
-    void Search(bool);
-
-    // Look in file for string
-    long DoSearch(void);
-
-    // Do the actual drawing of text (or just calculate size needed)
-    void ScanBuffer(wxDC *dc, bool DrawIt, int *max_x, int *max_y);
-
-    // Load the poem
-    void GetIndexLoadPoem(void);
-    void Resize(void);
-
-DECLARE_EVENT_TABLE()
-};
-
-// Menu items
-#define         POEM_NEXT       100
-#define         POEM_PREVIOUS   101
-#define         POEM_COPY       102
-#define         POEM_SEARCH     103
-#define         POEM_NEXT_MATCH 104
-#define         POEM_ABOUT      105
-#define         POEM_EXIT       106
-#define         POEM_COMPILE    107
-#define         POEM_HELP_CONTENTS 108
-#define         POEM_BIGGER_TEXT 109
-#define         POEM_SMALLER_TEXT 110
-#define         POEM_MINIMIZE   111
-
-
diff --git a/samples/wxpoem/wxpoem.ico b/samples/wxpoem/wxpoem.ico
deleted file mode 100644 (file)
index f3b425d..0000000
Binary files a/samples/wxpoem/wxpoem.ico and /dev/null differ
diff --git a/samples/wxpoem/wxpoem.rc b/samples/wxpoem/wxpoem.rc
deleted file mode 100644 (file)
index 8fdb7de..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-aaaa ICON "wxpoem.ico"
-wxpoem ICON "wxpoem.ico"
-wxSTD_FRAME ICON "wxpoem.ico"
-
-icon_1 ICON "corner1.ico"
-icon_2 ICON "corner2.ico"
-icon_3 ICON "corner3.ico"
-icon_4 ICON "corner4.ico"
-
-#include "wx/msw/wx.rc"
-
diff --git a/samples/wxpoem/wxpoem.txt b/samples/wxpoem/wxpoem.txt
deleted file mode 100644 (file)
index 4f17b5d..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-wxPoem 1.0
-----------
-
-by Julian Smart
----------------
-
-Fancy a little intellectual stimulation after long hours spent staring
-at spreadsheets or reports?  Does your brain long for something a little
-more fulfilling than Tetris or fiddling with the WIN.INI file?  Then you
-could go out and buy a poetry book... or alternatively, if you just
-can't drag yourself away from the screen, click on the wxPoem icon.
-
-wxPoem is a simple Windows application which picks poems from a file at
-random, or finds poems according to a string criterion, and formats them
-nicely in a window.  A displayed poem can be copied to the Windows clipboard
-ready for inclusion in that more imaginative report...
-
-It's small, it's free and it's totally harmless, so far as I know.
-No responsibility accepted, though, for any problems it might cause with
-your setup.
-
-wxPoem was converted to use the wxWindows toolkit, from the original
-WinPoem which received a favourable review from Windows Shareware 500.
-
-Since it now uses wxWindows, wxPoem may be compiled on a variety
-of platforms such as X (XView or Motif), Windows and NT.
-
-Files
------
-
-The main data file is winpoem.dat, and an index file winpoem.idx is
-supplied or can be (re)built by deleting winpoem.idx and rerunning
-wxPoem. Source code is also provided in source.zip, but wxWindows is
-required to build it. The original WinPoem is much leaner (40K
-instead of 400K!) and can be compiled under Windows without wxWindows.
-
-Installation
-------------
-
-  Windows
-  =======
-
-    Copy ctl3dv2.dll to windows\system, and delete the original
-    ctl3dv2.dll or wxPoem will not run.
-
-    wxPoem can be put in the Startup folder in the Program Manager, so that
-    a random poem will pop up every time Windows is run.
-
-  UNIX
-  ====
-
-    wxPoem comes in Open Look and Motif versions for the Sun, and a
-    Linux Open Look version. For other platforms, you will need to
-    recompile the source.
-
-
-Use
----
-
-Simply run the program, and a random poem will be displayed.
-You can optionally give a filename on the command line, without a suffix
-(e.g. winpoem).
-
-The simplest way of operating wxPoem is to keep pressing the space bar
-for new poems (or pages for multi-page poems).
-
-Clicking the right mouse button (or selecting the wxPoem Options menu
-item from the system menu) gives a choice of the following facilities:
-Next poem/page   (Page down)   Display next poem (or next page)
-Previous page    (Page up)     Display previous page (multi-line poems only)
-Search           (S)           Allows user to enter a search string
-Next match       (N)           Gives next search match
-Copy to clipboard              Allows poems to be pasted into other applications
-Bigger text                    Increases text size
-Smaller text                   Decreases text size
-About wxPoem                   About wxPoem
-Exit             (Esc)         Quit wxPoem
-
-When wxPoem is closed, the font, text height and window position are
-remembered (stored in WIN.INI) for next time. Under X, the values
-are not written (since they are stored in .Xdefaults), so you may
-want to edit the following resources by hand:
-
-wxPoem.X         ; X position
-wxPoem.Y         ; Y position
-wxPoem.FontSize  ; Font size in points (default 12)
-
-The data file
--------------
-
-The winpoem.dat file contains poems separated by a #, with optional
-@ codes denoting title (@T) author (@A) and page break (@P).  Any
-unrecognized codes will cause the rest of the line to be ignored, so
-the user can add lines (e.g. @S for subject) which will be searched on but
-not displayed.
-
-The data file contains a mixture of 20th century and earlier poetry,
-subject to copyright constraints.  Apologies if any copyrights have
-inadvertently been infringed, though I have tried to avoid it.
-
-Implementation
---------------
-
-The original WinPoem program was my `Windows learning application', i.e.
-a vehicle for getting stuck into Windows programming, whilst (possibly)
-affording others a modicum of amusement. Therefore the code is pretty
-ugly. So don't look if you're squeamish!
-
-License
--------
-
-Copyright Julian Smart, released into the public domain, October 1994.
-
-Julian Smart
-Artificial Intelligence Applications Institute
-University of Edinburgh
-80 South Bridge
-Einburgh
-EH1 1HN
-
-J.Smart@ed.ac.uk
diff --git a/samples/wxpoem/wxpoem.xpm b/samples/wxpoem/wxpoem.xpm
deleted file mode 100644 (file)
index 73ca05b..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/* XPM */
-static char * wxpoem_xpm[] = {
-/* width height ncolors chars_per_pixel */
-"32 32 9 1",
-/* colors */
-"      s None  c None",
-".     c #800000",
-"+     c #008000",
-"@     c #808000",
-"#     c #c0c0c0",
-"$     c #ff0000",
-"%     c #00ff00",
-"&     c #ffff00",
-"*     c #0000ff",
-/* pixels */
-"                    ****        ",
-"             ********&&*        ",
-"      ******&&&&&&&&&&&&***     ",
-"  *****&&&&&&&&&&&&&&&&&&&*     ",
-"  ****************************  ",
-"  *&&&&&&&&&&&&&&&&&&&&&&&&&&*  ",
-"  *&************************&*  ",
-"  *&************************&*  ",
-"  *&************************&*  ",
-"  *&*&&&@*@&@*@&&*@&@&@*@&@*&*  ",
-"  *&*&**&*&*&*&***&*&*&*&***&*  ",
-"  *&*&&&@*&*&*&&**&*&*&*&&@*&*  ",
-"  *&*&****&*&*&***&*&*&***&*&*  ",
-"  *&*&****&*&*&***&***&***&*&*  ",
-"  *&*&****@&@*@&&*&***&*@&@*&*  ",
-"  *&************************&*  ",
-"  *&************************&*  ",
-"  *&************************&*  ",
-"  *&*****$$$****************&*  ",
-"  *&***...$$$$**************&*  ",
-"  *&***$$....$**************&*  ",
-"  *&****$$$$..******%++*****&*  ",
-"  *&****$$$$$.%%**+%+%%*****&*  ",
-"  *&******$$$**%%*%+%%+*****&*  ",
-"  *&*************%+%%%******&*  ",
-"  *&**************%%%*******&*  ",
-"  *&****************%%%*****&*  ",
-"  *&******************%%****&*  ",
-"  *&&&&&&&&&&&&&&&&&&&&%%&&&&*  ",
-"  ***********************%%***  ",
-"                          %%    ",
-"                          #%%   "};
diff --git a/samples/wxsocket/.cvsignore b/samples/wxsocket/.cvsignore
deleted file mode 100644 (file)
index 8b13789..0000000
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/samples/wxsocket/Makefile.in b/samples/wxsocket/Makefile.in
deleted file mode 100644 (file)
index 96af3cf..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-#
-# File:                Makefile.in
-# Author:      Julian Smart
-# Created:     1998
-# Updated:     
-# Copyright:   (c) 1998 Julian Smart
-#
-# "%W% %G%"
-#
-# Makefile for wxsocket example (UNIX).
-
-top_srcdir = @top_srcdir@
-top_builddir = ../..
-program_dir = samples/wxsocket
-VPATH = :$(top_srcdir)/samples/wxsocket
-
-# Clears all default suffixes
-.SUFFIXES:     .o .cpp .c .cxx
-
-.cpp.o :
-       $(CC) -c $(CPPFLAGS) -o $@ $<
-
-# Set defaults from configure
-include ../../src/make.env
-
-all:   client server
-
-client:        client.o ../../lib/@WX_TARGET_LIBRARY@
-       $(CC) $(LDFLAGS) -o client client.o $(LDLIBS)
-
-server:        server.o ../../lib/@WX_TARGET_LIBRARY@
-       $(CC) $(LDFLAGS) -o server server.o $(LDLIBS)
-
-clean:
-       rm -f $(OBJECTS) $(PROGRAM) core
-
diff --git a/samples/wxsocket/client.cpp b/samples/wxsocket/client.cpp
deleted file mode 100644 (file)
index 2dba5c9..0000000
+++ /dev/null
@@ -1,446 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name:        client.cpp
-// Purpose:     Client for wxSocket demo
-// Author:      Guillermo Rodriguez Garcia <guille@iies.es>
-// Modified by:
-// Created:     1999/09/19
-// RCS-ID:      $Id$
-// Copyright:   (c) 1999 Guillermo Rodriguez Garcia
-// Licence:     wxWindows licence
-/////////////////////////////////////////////////////////////////////////////
-
-// ==========================================================================
-// declarations
-// ==========================================================================
-
-// --------------------------------------------------------------------------
-// headers
-// --------------------------------------------------------------------------
-
-#ifdef __GNUG__
-#  pragma implementation "client.cpp"
-#  pragma interface "client.cpp"
-#endif
-
-// For compilers that support precompilation, includes "wx/wx.h".
-#include "wx/wxprec.h"
-
-#ifdef __BORLANDC__
-#  pragma hdrstop
-#endif
-
-// for all others, include the necessary headers 
-#ifndef WX_PRECOMP
-#  include "wx/wx.h"
-#endif
-
-#  include "wx/socket.h"
-#  include "wx/url.h"
-#  include "wx/protocol/http.h"
-#  include "wx/progdlg.h"
-
-// --------------------------------------------------------------------------
-// resources
-// --------------------------------------------------------------------------
-
-// the application icon
-#if defined(__WXGTK__) || defined(__WXMOTIF__)
-#  include "mondrian.xpm"
-#endif
-
-// --------------------------------------------------------------------------
-// classes
-// --------------------------------------------------------------------------
-
-// Define a new application type
-class MyApp : public wxApp
-{
-public:
-  virtual bool OnInit();
-};
-
-// Define a new frame type: this is going to be our main frame
-class MyFrame : public wxFrame
-{
-public:
-  MyFrame();
-  ~MyFrame();
-
-  // event handlers (these functions should _not_ be virtual)
-  void OnQuit(wxCommandEvent& event);
-  void OnAbout(wxCommandEvent& event);
-  void OnOpenConnection(wxCommandEvent& event);
-  void OnTest1(wxCommandEvent& event);
-  void OnTest2(wxCommandEvent& event);
-  void OnTest3(wxCommandEvent& event);
-  void OnCloseConnection(wxCommandEvent& event);
-  void OnSocketEvent(wxSocketEvent& event);
-
-  // convenience functions
-  void UpdateStatusBar();
-
-private:
-  wxSocketClient *m_sock;
-  wxPanel        *m_panel;
-  wxTextCtrl     *m_text;
-  wxMenu         *m_menuFile;
-  wxMenu         *m_menuSocket;
-  wxMenuBar      *m_menuBar;
-  bool            m_busy;
-
-  // any class wishing to process wxWindows events must use this macro
-  DECLARE_EVENT_TABLE()
-};
-
-// --------------------------------------------------------------------------
-// constants
-// --------------------------------------------------------------------------
-
-// IDs for the controls and the menu commands
-enum
-{
-  // menu items
-  CLIENT_QUIT = 1000,
-  CLIENT_ABOUT,
-  CLIENT_OPEN,
-  CLIENT_TEST1,
-  CLIENT_TEST2,
-  CLIENT_TEST3,
-  CLIENT_CLOSE,
-
-  // id for socket
-  SOCKET_ID
-};
-
-// --------------------------------------------------------------------------
-// event tables and other macros for wxWindows
-// --------------------------------------------------------------------------
-
-BEGIN_EVENT_TABLE(MyFrame, wxFrame)
-  EVT_MENU(CLIENT_QUIT,  MyFrame::OnQuit)
-  EVT_MENU(CLIENT_ABOUT, MyFrame::OnAbout)
-  EVT_MENU(CLIENT_OPEN,  MyFrame::OnOpenConnection)
-  EVT_MENU(CLIENT_TEST1, MyFrame::OnTest1)
-  EVT_MENU(CLIENT_TEST2, MyFrame::OnTest2)
-  EVT_MENU(CLIENT_TEST3, MyFrame::OnTest3)
-  EVT_MENU(CLIENT_CLOSE, MyFrame::OnCloseConnection)
-  EVT_SOCKET(SOCKET_ID,  MyFrame::OnSocketEvent)
-END_EVENT_TABLE()
-
-IMPLEMENT_APP(MyApp)
-
-// ==========================================================================
-// implementation
-// ==========================================================================
-
-// --------------------------------------------------------------------------
-// the application class
-// --------------------------------------------------------------------------
-
-bool MyApp::OnInit()
-{
-  // Create the main application window
-  MyFrame *frame = new MyFrame();
-
-  // Show it and tell the application that it's our main window
-  frame->Show(TRUE);
-  SetTopWindow(frame);
-
-  // success
-  return TRUE;
-}
-
-// --------------------------------------------------------------------------
-// main frame
-// --------------------------------------------------------------------------
-
-// frame constructor
-MyFrame::MyFrame() : wxFrame((wxFrame *)NULL, -1,
-                             _T("wxSocket demo: Client"),
-                             wxDefaultPosition, wxSize(300, 200))
-{
-  // Give the frame an icon
-  SetIcon(wxICON(mondrian));
-
-  // Make menus
-  m_menuFile = new wxMenu();
-  m_menuFile->Append(CLIENT_ABOUT, _T("&About...\tCtrl-A"), _T("Show about dialog"));
-  m_menuFile->AppendSeparator();
-  m_menuFile->Append(CLIENT_QUIT, _T("E&xit\tAlt-X"), _T("Quit client"));
-
-  m_menuSocket = new wxMenu();
-  m_menuSocket->Append(CLIENT_OPEN, _T("&Open session"), _T("Connect to server"));
-  m_menuSocket->AppendSeparator();
-  m_menuSocket->Append(CLIENT_TEST1, _T("Test &1"), _T("Test basic functionality"));
-  m_menuSocket->Append(CLIENT_TEST2, _T("Test &2"), _T("Test ReadMsg and WriteMsg"));
-  m_menuSocket->Append(CLIENT_TEST3, _T("Test &3"), _T("Test large data transfer"));
-  m_menuSocket->AppendSeparator();
-  m_menuSocket->Append(CLIENT_CLOSE, _T("&Close session"), _T("Close connection"));
-
-  // Append menus to the menubar
-  m_menuBar = new wxMenuBar();
-  m_menuBar->Append(m_menuFile, _T("&File"));
-  m_menuBar->Append(m_menuSocket, _T("&Socket"));
-  SetMenuBar(m_menuBar);
-
-  // Status bar
-  CreateStatusBar(2);
-
-  // Make a panel with a textctrl in it
-  m_panel = new wxPanel(this, -1, wxPoint(0, 0), GetClientSize());
-  m_text  = new wxTextCtrl(m_panel, -1,
-                           _T("Welcome to wxSocket demo: Client\n")
-                           _T("Client ready\n\n"),
-                           wxPoint(0, 0), m_panel->GetClientSize(),
-                           wxTE_MULTILINE | wxTE_READONLY);
-
-  // Create the socket
-  m_sock = new wxSocketClient();
-  m_sock->SetEventHandler(*this, SOCKET_ID);
-  m_sock->SetNotify(wxSOCKET_CONNECTION_FLAG |
-                    wxSOCKET_INPUT_FLAG |
-                    wxSOCKET_LOST_FLAG);
-  m_sock->Notify(TRUE);
-
-  m_busy = FALSE;
-  UpdateStatusBar();
-}
-
-MyFrame::~MyFrame()
-{
-  delete m_sock;
-}
-
-// event handlers
-
-void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
-{
-  // TRUE is to force the frame to close
-  Close(TRUE);
-}
-
-void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
-{
-  wxMessageBox(_T("wxSocket demo: Client\n")
-               _T("(c) 1999 Guillermo Rodriguez Garcia\n"),
-               _T("About Client"),
-               wxOK | wxICON_INFORMATION, this);
-}
-
-void MyFrame::OnOpenConnection(wxCommandEvent& WXUNUSED(event))
-{
-  wxIPV4address addr;
-
-  m_menuSocket->Enable(CLIENT_OPEN, FALSE);
-  m_menuSocket->Enable(CLIENT_CLOSE, FALSE);
-
-  // Ask server address
-  wxString hostname = wxGetTextFromUser(
-    _T("Enter the address of the wxSocket demo server:"),
-    _T("Connect ..."),
-    _T("localhost"));
-
-  addr.Hostname(hostname);
-  addr.Service(3000);
-
-  // Non-blocking connect
-  m_text->AppendText(_T("Trying to connect (timeout = 10 sec) ...\n"));
-  m_sock->Connect(addr, FALSE);
-  m_sock->WaitOnConnect(10);
-
-  if (m_sock->IsConnected())
-    m_text->AppendText(_T("Succeeded ! Connection established\n"));
-  else
-  {
-    m_sock->Close();
-    m_text->AppendText(_T("Failed ! Unable to connect\n"));
-    wxMessageBox(_T("Can't connect to the specified host"), _T("Alert !"));
-  }
-  
-  UpdateStatusBar();
-}
-
-void MyFrame::OnTest1(wxCommandEvent& WXUNUSED(event))
-{
-  char *buf1, *buf2;
-  char len;
-
-  // Disable socket menu entries (exception: Close Session)
-  m_busy = TRUE;
-  UpdateStatusBar();
-
-  m_text->AppendText(_T("\n=== Test 1 begins ===\n"));
-
-  // Tell the server which test we are running
-  char c = 0xBE;
-  m_sock->Write(&c, 1);
-
-  // Send some data and read it back. We know the size of the
-  // buffer, so we can specify the exact number of bytes to be
-  // sent or received and use the WAITALL flag. Also, we have
-  // disabled menu entries which could interfere with the test,
-  // so we can safely avoid the BLOCK (formerly SPEED) flag.
-  //
-  // First we send a byte with the length of the string, then
-  // we send the string itself (do NOT try to send any integral
-  // value larger than a byte "as is" acrosss the network, or
-  // you might be in trouble! Ever heard about big and little
-  // endian computers?)
-  //
-  m_sock->SetFlags(wxSOCKET_WAITALL);
-
-  buf1 = _T("Test string (less than 127 chars!)");
-  len  = wxStrlen(buf1) + 1;
-  buf2 = new char[len];
-
-  m_text->AppendText(_T("Sending a test buffer to the server ..."));
-  m_sock->Write(&len, 1);
-  m_sock->Write(buf1, len);
-  m_text->AppendText(m_sock->Error() ? _T("failed !\n") : _T("done\n"));
-
-  m_text->AppendText(_T("Receiving the buffer back from server ..."));
-  m_sock->Read(buf2, len);
-  m_text->AppendText(m_sock->Error() ? _T("failed !\n") : _T("done\n"));
-
-  m_text->AppendText(_T("Comparing the two buffers ..."));
-  if (memcmp(buf1, buf2, len) != 0)
-  {
-    m_text->AppendText(_T("failed!\n"));
-    m_text->AppendText(_T("Test 1 failed !\n"));
-  }
-  else
-  {
-    m_text->AppendText(_T("done\n"));
-    m_text->AppendText(_T("Test 1 passed !\n"));
-  }
-  m_text->AppendText(_T("=== Test 1 ends ===\n"));
-
-  delete[] buf2;
-  m_busy = FALSE;
-  UpdateStatusBar();
-}
-
-void MyFrame::OnTest2(wxCommandEvent& WXUNUSED(event))
-{
-  char *msg1;
-  char *msg2;
-  size_t len;
-
-  // Disable socket menu entries (exception: Close Session)
-  m_busy = TRUE;
-  UpdateStatusBar();
-
-  m_text->AppendText(_T("\n=== Test 2 begins ===\n"));
-
-  // Tell the server which test we are running
-  char c = 0xCE;
-  m_sock->Write(&c, 1);
-
-  // Here we use ReadMsg and WriteMsg to send messages with
-  // a header with size information. Also, the reception is
-  // event triggered, so we test input events as well.
-  //
-  // We need to set no flags here (ReadMsg and WriteMsg are
-  // not affected by flags)
-  //
-  m_sock->SetFlags(wxSOCKET_WAITALL);
-
-  wxString s = wxGetTextFromUser(
-    _T("Enter an arbitrary string to send to the server:"),
-    _T("Test 2 ..."),
-    _T("Yes I like wxWindows!"));
-
-  msg1 = (char *)s.c_str();
-  len  = wxStrlen(msg1) + 1;
-  msg2 = (char *)malloc(len);
-
-  m_text->AppendText(_T("Sending the string with WriteMsg ..."));
-  m_sock->WriteMsg(msg1, len);
-  m_text->AppendText(m_sock->Error() ? _T("failed !\n") : _T("done\n"));
-  m_text->AppendText(_T("Waiting for an event (timeout = 2 sec)\n"));
-
-  // Wait until data available (will also return if the connection is lost)
-  m_sock->WaitForRead(2);
-
-  if (m_sock->IsData())
-  {
-    m_text->AppendText(_T("Reading the string back with ReadMsg ..."));
-    m_sock->ReadMsg(msg2, len);
-    m_text->AppendText(m_sock->Error() ? _T("failed !\n") : _T("done\n"));
-    m_text->AppendText(_T("Comparing the two buffers ..."));
-    if (memcmp(msg1, msg2, len) != 0)
-    {
-      m_text->AppendText(_T("failed!\n"));  
-      m_text->AppendText(_T("Test 2 failed !\n"));
-    }
-    else
-    {
-      m_text->AppendText(_T("done\n"));
-      m_text->AppendText(_T("Test 2 passed !\n"));
-    }
-  }
-  else
-    m_text->AppendText(_T("Timeout ! Test 2 failed.\n"));
-
-  m_text->AppendText(_T("=== Test 2 ends ===\n"));
-
-  free(msg2);
-  m_busy = FALSE;
-  UpdateStatusBar();
-}
-
-void MyFrame::OnTest3(wxCommandEvent& WXUNUSED(event))
-{
-  m_text->AppendText(_T("\n=== Test 3 begins ===\n"));
-  m_text->AppendText(_T("Test 3 not implemented\n"));
-  m_text->AppendText(_T("=== Test 3 ends ===\n"));
-}
-
-void MyFrame::OnCloseConnection(wxCommandEvent& WXUNUSED(event))
-{
-  m_sock->Close();
-  UpdateStatusBar();
-}
-
-void MyFrame::OnSocketEvent(wxSocketEvent& event)
-{
-  wxString s = _T("OnSocketEvent: ");
-
-  switch(event.SocketEvent())
-  {
-    case wxSOCKET_INPUT      : s.Append(_T("wxSOCKET_INPUT\n")); break;
-    case wxSOCKET_LOST       : s.Append(_T("wxSOCKET_LOST\n")); break;
-    case wxSOCKET_CONNECTION : s.Append(_T("wxSOCKET_CONNECTION\n")); break;
-    default                  : s.Append(_T("Unexpected event !\n")); break;
-  }
-
-  m_text->AppendText(s);
-  UpdateStatusBar();
-}
-
-// convenience functions
-
-void MyFrame::UpdateStatusBar()
-{
-  wxString s;
-
-  if (!m_sock->IsConnected())
-  {
-    s.Printf(_T("Not connected"));
-  }
-  else
-  {
-    wxIPV4address addr;
-
-    m_sock->GetPeer(addr);
-    s.Printf(_T("%s : %d"), (addr.Hostname()).c_str(), addr.Service());
-  }
-
-  SetStatusText(s, 1);
-
-  m_menuSocket->Enable(CLIENT_OPEN, !m_sock->IsConnected() && !m_busy);
-  m_menuSocket->Enable(CLIENT_TEST1, m_sock->IsConnected() && !m_busy);
-  m_menuSocket->Enable(CLIENT_TEST2, m_sock->IsConnected() && !m_busy);
-  m_menuSocket->Enable(CLIENT_TEST3, m_sock->IsConnected() && !m_busy);
-  m_menuSocket->Enable(CLIENT_CLOSE, m_sock->IsConnected());
-}
diff --git a/samples/wxsocket/client.def b/samples/wxsocket/client.def
deleted file mode 100644 (file)
index 786b7d6..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-NAME         Client
-DESCRIPTION  'Client'
-EXETYPE      WINDOWS
-STUB         'WINSTUB.EXE'
-CODE         PRELOAD MOVEABLE DISCARDABLE
-DATA         PRELOAD MOVEABLE MULTIPLE
-HEAPSIZE     1024
-STACKSIZE    8192
diff --git a/samples/wxsocket/client.g95 b/samples/wxsocket/client.g95
deleted file mode 100644 (file)
index 260c61c..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# File:         makefile.g95
-# Author:       Julian Smart
-# Created:      1999
-# Updated:
-# Copyright:    (c) Julian Smart, 1999
-#
-# Makefile for wxWindows sample (Cygwin/Mingw32).
-
-WXDIR = ../..
-
-TARGET=client
-OBJECTS = $(TARGET).o
-
-include $(WXDIR)/src/makeprog.g95
-
diff --git a/samples/wxsocket/client.rc b/samples/wxsocket/client.rc
deleted file mode 100644 (file)
index f1579f6..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-mondrian ICON mondrian.ico
-conn_icn ICON connect.ico
-#include "wx/msw/wx.rc"
diff --git a/samples/wxsocket/client.vc b/samples/wxsocket/client.vc
deleted file mode 100644 (file)
index 9cfde26..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# File:                makefile.vc
-# Author:      Julian Smart
-# Created:     1999
-# Updated:     
-# Copyright:   (c) Julian Smart
-#
-# Makefile : Builds sample (VC++, WIN32)
-# Use FINAL=1 argument to nmake to build final version with no debug info.
-
-# Set WXDIR for your system
-WXDIR = $(WXWIN)
-
-PROGRAM=client
-OBJECTS = $(PROGRAM).obj
-
-!include $(WXDIR)\src\makeprog.vc
-
diff --git a/samples/wxsocket/client.wat b/samples/wxsocket/client.wat
deleted file mode 100644 (file)
index 789db64..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#
-# Makefile for WATCOM
-#
-# Created by Julian Smart, January 1999
-# 
-#
-
-WXDIR = $(%WXWIN)
-
-PROGRAM = client
-OBJECTS = $(PROGRAM).obj
-
-!include $(WXDIR)\src\makeprog.wat
-
-
diff --git a/samples/wxsocket/connect.ico b/samples/wxsocket/connect.ico
deleted file mode 100644 (file)
index 74f006f..0000000
Binary files a/samples/wxsocket/connect.ico and /dev/null differ
diff --git a/samples/wxsocket/makefile.b32 b/samples/wxsocket/makefile.b32
deleted file mode 100644 (file)
index 94a0ed2..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-#
-# File:                makefile.b32
-# Author:      Guilhem Lavaux
-# Created:     1998
-# Updated:     
-# Copyright:   (c) Guilhem Lavaux
-#
-# "%W% %G%"
-#
-# Makefile : Builds 32-bit wxSocket sample under BC++
-
-WXDIR = $(WXWIN)
-
-ZLIB = $(WXDIR)\lib\zlib.lib
-
-!include $(WXDIR)\src\makeb32.env
-
-WXLIBDIR = $(WXDIR)\lib
-WXINC = $(WXDIR)\include\msw
-WXLIB = $(WXLIBDIR)\wx32.lib
-LIBS=$(WXLIB) $(ZLIB) cw32 import32 ole2w32
-
-!if "$(FINAL)" == "0"
-LINKFLAGS=/v /Tpe /L$(WXLIBDIR);$(BCCDIR)\lib
-OPT = -Od
-DEBUG_FLAGS= -v
-!else
-LINKFLAGS=/Tpe /L$(WXLIBDIR);$(BCCDIR)\lib
-OPT = -Od
-DEBUG_FLAGS =
-!endif
-CPPFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG)
-
-.$(SRCSUFF).obj:
-       bcc32 $(CPPFLAGS) -c {$< }
-
-.c.obj:
-       bcc32 $(CPPFLAGS) -P- -c {$< }
-
-CLIENT_TARGET=client
-SERVER_TARGET=server
-CLIENT_OBJECTS=client.obj
-SERVER_OBJECTS=server.obj
-
-all:    $(CLIENT_TARGET).exe $(SERVER_TARGET).exe
-
-$(CLIENT_TARGET).exe:   $(CLIENT_OBJECTS) $(CLIENT_TARGET).res
-  tlink32 $(LINKFLAGS) @&&!
-  c0w32.obj $(CLIENT_OBJECTS)
-  $(CLIENT_TARGET)
-  nul
-  $(LIBS)
-  $(CLIENT_TARGET).def
-  $(CLIENT_TARGET).res
-!
-
-client.obj:     client.cpp
-
-$(CLIENT_TARGET).res :      $(CLIENT_TARGET).rc $(WXDIR)\include\wx\msw\wx.rc
-    brc32 -r /i$(BCCDIR)\include /i$(WXDIR)\include $(CLIENT_TARGET)
-
-$(SERVER_TARGET).exe:   $(SERVER_OBJECTS) $(SERVER_TARGET).res
-  tlink32 $(LINKFLAGS) @&&!
-  c0w32.obj $(SERVER_OBJECTS)
-  $(SERVER_TARGET)
-  nul
-  $(LIBS)
-  $(SERVER_TARGET).def
-  $(SERVER_TARGET).res
-!
-
-server.obj:     server.cpp
-
-$(SERVER_TARGET).res:   $(SERVER_TARGET).rc $(WXDIR)\include\wx\msw\wx.rc
-    brc32 -r /i$(BCCDIR)\include /i$(WXDIR)\include $(SERVER_TARGET)
-
-clean:
-        -erase *.obj
-        -erase *.exe
-        -erase *.res
-        -erase *.map
-        -erase *.rws
diff --git a/samples/wxsocket/makefile.dos b/samples/wxsocket/makefile.dos
deleted file mode 100644 (file)
index 2a42833..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# File:                makefile.dos
-# Author:      Julian Smart
-# Created:     1998
-# Updated:     
-#
-# Makefile : Builds 16-bit sample, VC++ 1.5
-# Use FINAL=1 argument to nmake to build final version with no debugging
-# info
-
-WXDIR = $(WXWIN)
-
-TARGET=client
-OBJECTS = $(TARGET).obj
-
-# TODO: server
-
-!include $(WXDIR)\src\makeprog.msc
-
diff --git a/samples/wxsocket/makefile.g95 b/samples/wxsocket/makefile.g95
deleted file mode 100644 (file)
index 4d1b598..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-#
-# File:                makefile.unx
-# Author:      Julian Smart
-# Created:     1993
-# Updated:     
-# Copyright:   (c) 1993, AIAI, University of Edinburgh
-#
-# "%W% %G%"
-#
-# Makefile for server/client example (UNIX).
-
-WXDIR = ../..
-
-# All common UNIX compiler flags and options are now in
-# this central makefile.
-include $(WXDIR)/src/makeg95.env
-
-OBJECTS=$(OBJDIR)/server.$(OBJSUFF) $(OBJDIR)/server_resources.$(OBJSUFF)\
- $(OBJDIR)/client.$(OBJSUFF) $(OBJDIR)/client_resources.$(OBJSUFF)
-
-all:   $(OBJDIR) server$(GUISUFFIX) client$(GUISUFFIX)
-
-
-$(OBJDIR):
-       mkdir $(OBJDIR)
-
-server$(GUISUFFIX): $(OBJDIR)/server.$(OBJSUFF) $(OBJDIR)/server_resources.$(OBJSUFF) $(WXLIB)
-       $(CC) $(LDFLAGS) -o server$(GUISUFFIX)$(EXESUFF) $(OBJDIR)/server.$(OBJSUFF) $(OBJDIR)/server_resources.$(OBJSUFF) $(LDLIBS)
-
-$(OBJDIR)/server.$(OBJSUFF):        server.$(SRCSUFF)
-       $(CC) -c $(CPPFLAGS) -o $@ server.$(SRCSUFF)
-
-client$(GUISUFFIX): $(OBJDIR)/client.$(OBJSUFF) $(OBJDIR)/client_resources.$(OBJSUFF) $(WXLIB)
-       $(CC) $(LDFLAGS) -o client$(GUISUFFIX)$(EXESUFF) $(OBJDIR)/client.$(OBJSUFF) $(OBJDIR)/client_resources.$(OBJSUFF) $(LDLIBS)
-
-$(OBJDIR)/client.$(OBJSUFF):        client.$(SRCSUFF)
-       $(CC) -c $(CPPFLAGS) -o $@ client.$(SRCSUFF)
-        
-$(OBJDIR)/server_resources.o:  server.rc
-       $(RESCOMP) -i server.rc -o $(OBJDIR)/server_resources.o $(RESFLAGS)
-
-$(OBJDIR)/client_resources.o:  client.rc
-       $(RESCOMP) -i client.rc -o $(OBJDIR)/client_resources.o $(RESFLAGS)
-
-clean:
-       rm -f $(OBJECTS) server$(GUISUFFIX).exe client$(GUISUFFIX).exe core *.rsc *.res
diff --git a/samples/wxsocket/makefile.vc b/samples/wxsocket/makefile.vc
deleted file mode 100644 (file)
index 3864d7d..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-#
-# File:                makefile.vc
-# Author:      Julian Smart
-# Created:     1999
-# Updated:     
-# Copyright:   (c) Julian Smart
-#
-# Makefile : Builds sample (VC++, WIN32)
-# Use FINAL=1 argument to nmake to build final version with no debug info.
-
-!include $(WXWIN)/src/makevc.env
-
-all:
-    nmake -f server.vc FINAL=$(FINAL)
-    nmake -f client.vc FINAL=$(FINAL)
-
-clean:
-    nmake -f server.vc clean
-    nmake -f client.vc clean
-
diff --git a/samples/wxsocket/mondrian.ico b/samples/wxsocket/mondrian.ico
deleted file mode 100644 (file)
index 2310c5d..0000000
Binary files a/samples/wxsocket/mondrian.ico and /dev/null differ
diff --git a/samples/wxsocket/mondrian.xpm b/samples/wxsocket/mondrian.xpm
deleted file mode 100644 (file)
index 409f27a..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/* XPM */
-static char *mondrian_xpm[] = {
-/* columns rows colors chars-per-pixel */
-"32 32 6 1",
-"  c Black",
-". c Blue",
-"X c #00bf00",
-"o c Red",
-"O c Yellow",
-"+ c Gray100",
-/* pixels */
-"                                ",
-" oooooo +++++++++++++++++++++++ ",
-" oooooo +++++++++++++++++++++++ ",
-" oooooo +++++++++++++++++++++++ ",
-" oooooo +++++++++++++++++++++++ ",
-" oooooo +++++++++++++++++++++++ ",
-" oooooo +++++++++++++++++++++++ ",
-" oooooo +++++++++++++++++++++++ ",
-"                                ",
-" ++++++ ++++++++++++++++++ .... ",
-" ++++++ ++++++++++++++++++ .... ",
-" ++++++ ++++++++++++++++++ .... ",
-" ++++++ ++++++++++++++++++ .... ",
-" ++++++ ++++++++++++++++++ .... ",
-" ++++++ ++++++++++++++++++      ",
-" ++++++ ++++++++++++++++++ ++++ ",
-" ++++++ ++++++++++++++++++ ++++ ",
-" ++++++ ++++++++++++++++++ ++++ ",
-" ++++++ ++++++++++++++++++ ++++ ",
-" ++++++ ++++++++++++++++++ ++++ ",
-" ++++++ ++++++++++++++++++ ++++ ",
-" ++++++ ++++++++++++++++++ ++++ ",
-" ++++++ ++++++++++++++++++ ++++ ",
-" ++++++ ++++++++++++++++++ ++++ ",
-" ++++++                    ++++ ",
-" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
-" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
-" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
-" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
-" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
-" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
-"                                "
-};
diff --git a/samples/wxsocket/server.cpp b/samples/wxsocket/server.cpp
deleted file mode 100644 (file)
index 817c156..0000000
+++ /dev/null
@@ -1,382 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name:        server.cpp
-// Purpose:     Server for wxSocket demo
-// Author:      Guillermo Rodriguez Garcia <guille@iies.es>
-// Modified by:
-// Created:     1999/09/19
-// RCS-ID:      $Id$
-// Copyright:   (c) 1999 Guillermo Rodriguez Garcia
-// Licence:     wxWindows licence
-/////////////////////////////////////////////////////////////////////////////
-
-// ==========================================================================
-// declarations
-// ==========================================================================
-
-// --------------------------------------------------------------------------
-// headers
-// --------------------------------------------------------------------------
-
-#ifdef __GNUG__
-#  pragma implementation "server.cpp"
-#  pragma interface "server.cpp"
-#endif
-
-// For compilers that support precompilation, includes "wx/wx.h".
-#include "wx/wxprec.h"
-
-#ifdef __BORLANDC__
-#  pragma hdrstop
-#endif
-
-// for all others, include the necessary headers 
-#ifndef WX_PRECOMP
-#  include "wx/wx.h"
-#endif
-
-#include "wx/socket.h"
-
-// --------------------------------------------------------------------------
-// resources
-// --------------------------------------------------------------------------
-
-// the application icon
-#if defined(__WXGTK__) || defined(__WXMOTIF__)
-#  include "mondrian.xpm"
-#endif
-
-// --------------------------------------------------------------------------
-// classes
-// --------------------------------------------------------------------------
-
-// Define a new application type
-class MyApp : public wxApp
-{
-public:
-  virtual bool OnInit();
-};
-
-// Define a new frame type: this is going to be our main frame
-class MyFrame : public wxFrame
-{
-public:
-  MyFrame();
-  ~MyFrame();
-
-  // event handlers (these functions should _not_ be virtual)
-  void OnQuit(wxCommandEvent& event);
-  void OnAbout(wxCommandEvent& event);
-  void OnServerEvent(wxSocketEvent& event);
-  void OnSocketEvent(wxSocketEvent& event);
-
-  void Test1(wxSocketBase *sock);
-  void Test2(wxSocketBase *sock);
-  void Test3(wxSocketBase *sock);
-
-  // convenience functions
-  void UpdateStatusBar();
-
-private:
-  wxSocketServer *m_server;
-  wxPanel        *m_panel;
-  wxTextCtrl     *m_text;
-  wxMenu         *m_menuFile;
-  wxMenuBar      *m_menuBar;
-  bool            m_busy;
-  int             m_numClients;
-
-  // any class wishing to process wxWindows events must use this macro
-  DECLARE_EVENT_TABLE()
-};
-
-// --------------------------------------------------------------------------
-// constants
-// --------------------------------------------------------------------------
-
-// IDs for the controls and the menu commands
-enum
-{
-  // menu items
-  SERVER_QUIT = 1000,
-  SERVER_ABOUT,
-
-  // id for sockets
-  SERVER_ID,
-  SOCKET_ID
-};
-
-// --------------------------------------------------------------------------
-// event tables and other macros for wxWindows
-// --------------------------------------------------------------------------
-
-BEGIN_EVENT_TABLE(MyFrame, wxFrame)
-  EVT_MENU(SERVER_QUIT,  MyFrame::OnQuit)
-  EVT_MENU(SERVER_ABOUT, MyFrame::OnAbout)
-  EVT_SOCKET(SERVER_ID,  MyFrame::OnServerEvent)
-  EVT_SOCKET(SOCKET_ID,  MyFrame::OnSocketEvent)
-END_EVENT_TABLE()
-
-IMPLEMENT_APP(MyApp)
-
-
-// To append sockets for delayed deletion
-extern wxList wxPendingDelete;
-
-
-// ==========================================================================
-// implementation
-// ==========================================================================
-
-// --------------------------------------------------------------------------
-// the application class
-// --------------------------------------------------------------------------
-
-bool MyApp::OnInit()
-{
-  // Create the main application window
-  MyFrame *frame = new MyFrame();
-
-  // Show it and tell the application that it's our main window
-  frame->Show(TRUE);
-  SetTopWindow(frame);
-
-  // success
-  return TRUE;
-}
-
-// --------------------------------------------------------------------------
-// main frame
-// --------------------------------------------------------------------------
-
-// frame constructor
-MyFrame::MyFrame() : wxFrame((wxFrame *)NULL, -1,
-                             _T("wxSocket demo: Server"),
-                             wxDefaultPosition, wxSize(300, 200))
-{
-  // Give the frame an icon
-  SetIcon(wxICON(mondrian));
-
-  // Make menus
-  m_menuFile = new wxMenu();
-  m_menuFile->Append(SERVER_ABOUT, _T("&About...\tCtrl-A"), _T("Show about dialog"));
-  m_menuFile->AppendSeparator();
-  m_menuFile->Append(SERVER_QUIT, _T("E&xit\tAlt-X"), _T("Quit server"));
-
-  // Append menus to the menubar
-  m_menuBar = new wxMenuBar();
-  m_menuBar->Append(m_menuFile, _T("&File"));
-  SetMenuBar(m_menuBar);
-
-  // Status bar
-  CreateStatusBar(2);
-
-  // Make a panel with a textctrl in it
-  m_panel = new wxPanel(this, -1, wxPoint(0, 0), GetClientSize());
-  m_text  = new wxTextCtrl(m_panel, -1,
-                           _T("Welcome to wxSocket demo: Server\n"),
-                           wxPoint(0, 0), m_panel->GetClientSize(),
-                           wxTE_MULTILINE | wxTE_READONLY);
-
-  // Create the socket
-  wxIPV4address addr;
-  addr.Service(3000);
-  addr.LocalHost();
-
-  m_server = new wxSocketServer(addr);
-  m_server->SetEventHandler(*this, SERVER_ID);
-  m_server->SetNotify(wxSOCKET_CONNECTION_FLAG);
-  m_server->Notify(TRUE);
-
-  // We use Ok() here to see if the server is really listening
-  if (m_server->Ok())
-    m_text->AppendText(_T("Server listening.\n\n"));
-  else
-    m_text->AppendText(_T("Could not listen at the specified port !\n\n"));
-
-  m_busy = FALSE;
-  m_numClients = 0;
-  UpdateStatusBar();
-}
-
-MyFrame::~MyFrame()
-{
-  delete m_server;
-}
-
-// event handlers
-
-void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
-{
-  // TRUE is to force the frame to close
-  Close(TRUE);
-}
-
-void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
-{
-  wxMessageBox(_T("wxSocket demo: Server\n")
-               _T("(c) 1999 Guillermo Rodriguez Garcia\n"),
-               _T("About Server"),
-               wxOK | wxICON_INFORMATION, this);
-}
-
-void MyFrame::Test1(wxSocketBase *sock)
-{
-  unsigned char len;
-  char *buf;
-
-  m_text->AppendText(_T("Test 1 begins\n"));
-
-  // Receive data from socket and send it back. We will first
-  // get a byte with the buffer size, so we can specify the
-  // exact size and use the WAITALL flag. Also, we disabled
-  // input events so we won't have unwanted reentrance. This
-  // way we can avoid the infamous BLOCK (formerly SPEED) flag.
-  //
-  sock->SetFlags(wxSOCKET_WAITALL);
-
-  sock->Read((char *)&len, 1);
-
-  buf = (char *)malloc(len);
-  sock->Read(buf, len);
-  sock->Write(buf, len);
-  free(buf);
-
-  m_text->AppendText(_T("Test 1 ends\n"));
-}
-
-void MyFrame::Test2(wxSocketBase *sock)
-{
-#define MAX_MSG_SIZE 10000
-
-  wxString s;
-  char *buf = (char *)malloc(MAX_MSG_SIZE);
-  wxUint32 len;
-
-  m_text->AppendText(_T("Test 2 begins\n"));
-
-  // We don't need to set flags because ReadMsg and WriteMsg
-  // are not affected by them anyway.
-  //
-  len = sock->ReadMsg(buf, MAX_MSG_SIZE).LastCount();
-
-  s.Printf(_T("Client says: %s\n"), buf);
-  m_text->AppendText(s);
-
-  sock->WriteMsg(buf, len);
-  free(buf);
-
-  m_text->AppendText(_T("Test 2 ends\n"));
-
-#undef MAX_MSG_SIZE
-}
-
-void MyFrame::Test3(wxSocketBase *sock)
-{
-  m_text->AppendText(_T("Test 3 begins\n"));
-  m_text->AppendText(_T("(not implemented)\n"));
-  m_text->AppendText(_T("Test 3 ends\n"));
-}
-
-void MyFrame::OnServerEvent(wxSocketEvent& event)
-{
-  wxString s = _T("OnServerEvent: ");
-  wxSocketBase *sock;
-
-  switch(event.SocketEvent())
-  {
-    case wxSOCKET_CONNECTION : s.Append(_T("wxSOCKET_CONNECTION\n")); break;
-    default                  : s.Append(_T("Unexpected event !\n")); break;
-  }
-
-  m_text->AppendText(s);
-
-  // Accept new connection if there is one in the pending
-  // connections queue, else exit. We use Accept(FALSE) for
-  // non-blocking accept (although if we got here, there
-  // should ALWAYS be a pending connection).
-  //
-  sock = m_server->Accept(FALSE);
-
-  if (sock)
-  {
-    m_text->AppendText(_T("New client connection accepted\n"));
-  }
-  else
-  {
-    m_text->AppendText(_T("Error: couldn't accept a new connection"));
-    return;
-  }
-
-  sock->SetEventHandler(*this, SOCKET_ID);
-  sock->SetNotify(wxSOCKET_INPUT_FLAG | wxSOCKET_LOST_FLAG);
-  sock->Notify(TRUE);
-
-  m_numClients++;
-  UpdateStatusBar();
-}
-
-void MyFrame::OnSocketEvent(wxSocketEvent& event)
-{
-  wxSocketBase *sock = event.Socket();
-  wxString s = _T("OnSocketEvent: ");
-
-  // We first print a msg
-  switch(event.SocketEvent())
-  {
-    case wxSOCKET_INPUT: s.Append(_T("wxSOCKET_INPUT\n")); break;
-    case wxSOCKET_LOST:  s.Append(_T("wxSOCKET_LOST\n")); break;
-    default:             s.Append(_T("unexpected event !\n"));
-  }
-
-  m_text->AppendText(s);
-
-  // Now we process the event
-  switch(event.SocketEvent())
-  {
-    case wxSOCKET_INPUT:
-    {
-      // We disable input events, so that the test doesn't trigger
-      // wxSocketEvent again.
-      sock->SetNotify(wxSOCKET_LOST_FLAG);
-
-      // Which test are we going to run?
-      unsigned char c;
-      sock->Read((char *)&c ,1);
-
-      switch (c)
-      {
-        case 0xBE: Test1(sock); break;
-        case 0xCE: Test2(sock); break;
-        case 0xDE: Test3(sock); break;
-        default: s.Append(_T("Unknown test id received from client\n"));
-      }
-
-      // Enable input events again.
-      sock->SetNotify(wxSOCKET_LOST_FLAG | wxSOCKET_INPUT_FLAG);
-      break;
-    }
-    case wxSOCKET_LOST:
-    {
-      m_numClients--;
-
-      // We cannot delete the socket right now because we can
-      // be in the middle of a test or something. So we append
-      // it to the list of objects to be deleted.
-      m_text->AppendText(_T("Deleting socket.\n"));
-      wxPendingDelete.Append(sock);
-      break;
-    }
-    default: ;
-  }
-
-  UpdateStatusBar();
-}
-
-// convenience functions
-
-void MyFrame::UpdateStatusBar()
-{
-  wxString s;
-  s.Printf(_T("%d clients connected"), m_numClients);
-  SetStatusText(s, 1);
-}
diff --git a/samples/wxsocket/server.def b/samples/wxsocket/server.def
deleted file mode 100644 (file)
index 21027a5..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-NAME         Server
-DESCRIPTION  'Server'
-EXETYPE      WINDOWS
-STUB         'WINSTUB.EXE'
-CODE         PRELOAD MOVEABLE DISCARDABLE
-DATA         PRELOAD MOVEABLE MULTIPLE
-HEAPSIZE     4096
-STACKSIZE    8192
diff --git a/samples/wxsocket/server.g95 b/samples/wxsocket/server.g95
deleted file mode 100644 (file)
index 48e622c..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# File:         makefile.g95
-# Author:       Julian Smart
-# Created:      1999
-# Updated:
-# Copyright:    (c) Julian Smart, 1999
-#
-# Makefile for wxWindows sample (Cygwin/Mingw32).
-
-WXDIR = ../..
-
-TARGET=server
-OBJECTS = $(TARGET).o
-
-include $(WXDIR)/src/makeprog.g95
-
diff --git a/samples/wxsocket/server.rc b/samples/wxsocket/server.rc
deleted file mode 100644 (file)
index b289ec6..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-mondrian ICON "mondrian.ico"
-conn_icn ICON "connect.ico"
-#include "wx/msw/wx.rc"
-
diff --git a/samples/wxsocket/server.vc b/samples/wxsocket/server.vc
deleted file mode 100644 (file)
index fdb3bce..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# File:                makefile.vc
-# Author:      Julian Smart
-# Created:     1999
-# Updated:     
-# Copyright:   (c) Julian Smart
-#
-# Makefile : Builds sample (VC++, WIN32)
-# Use FINAL=1 argument to nmake to build final version with no debug info.
-
-# Set WXDIR for your system
-WXDIR = $(WXWIN)
-
-PROGRAM=server
-OBJECTS = $(PROGRAM).obj
-
-!include $(WXDIR)\src\makeprog.vc
-
diff --git a/samples/wxsocket/server.wat b/samples/wxsocket/server.wat
deleted file mode 100644 (file)
index 2acfdf1..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#
-# Makefile for WATCOM
-#
-# Created by Julian Smart, January 1999
-# 
-#
-
-WXDIR = $(%WXWIN)
-
-PROGRAM = server
-OBJECTS = $(PROGRAM).obj
-
-!include $(WXDIR)\src\makeprog.wat
-
-