Added wxPoem sample; fixed some Dialog Editor problems; wxStaticBitmap and wxBitmapButton
now recognised by resource.cpp. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1181 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
1
samples/wxpoem/Makefile
Normal file
1
samples/wxpoem/Makefile
Normal file
@@ -0,0 +1 @@
|
||||
include ../../setup/general/makeapp
|
26
samples/wxpoem/Makefile.in
Normal file
26
samples/wxpoem/Makefile.in
Normal file
@@ -0,0 +1,26 @@
|
||||
# WXXT base directory
|
||||
WXBASEDIR=@WXBASEDIR@
|
||||
|
||||
# set the OS type for compilation
|
||||
OS=@OS@
|
||||
# compile a library only
|
||||
RULE=bin
|
||||
|
||||
# define library name
|
||||
BIN_TARGET=wxpoem
|
||||
# define library sources
|
||||
BIN_SRC=\
|
||||
wxpoem.cpp
|
||||
|
||||
#define library objects
|
||||
BIN_OBJ=\
|
||||
wxpoem.o
|
||||
|
||||
# additional things needed to link
|
||||
BIN_LINK=
|
||||
|
||||
# additional things needed to compile
|
||||
ADD_COMPILE=
|
||||
|
||||
# include the definitions now
|
||||
include ../../../template.mak
|
BIN
samples/wxpoem/corner1.ico
Normal file
BIN
samples/wxpoem/corner1.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 766 B |
BIN
samples/wxpoem/corner2.ico
Normal file
BIN
samples/wxpoem/corner2.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 766 B |
BIN
samples/wxpoem/corner3.ico
Normal file
BIN
samples/wxpoem/corner3.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 766 B |
BIN
samples/wxpoem/corner4.ico
Normal file
BIN
samples/wxpoem/corner4.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 766 B |
64
samples/wxpoem/makefile.b32
Normal file
64
samples/wxpoem/makefile.b32
Normal file
@@ -0,0 +1,64 @@
|
||||
#
|
||||
# File: makefile.b32
|
||||
# Author: Julian Smart
|
||||
# Created: 1993
|
||||
# Updated:
|
||||
# Copyright:
|
||||
#
|
||||
# "%W% %G%"
|
||||
#
|
||||
# Makefile : Builds wxpoem example
|
||||
|
||||
# WXWIN and BCCDIR are set by parent make
|
||||
|
||||
WXDIR = $(WXWIN)
|
||||
!include $(WXDIR)\src\makeb32.env
|
||||
|
||||
WXLIBDIR = $(WXDIR)\lib
|
||||
WXINC = $(WXDIR)\include\msw
|
||||
WXLIB = $(WXLIBDIR)\wx32.lib
|
||||
LIBS=$(WXLIB) cw32 import32 ole2w32
|
||||
|
||||
TARGET=wxpoem
|
||||
|
||||
!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)
|
||||
|
||||
OBJECTS = wxpoem.obj
|
||||
|
||||
$(TARGET).exe: $(OBJECTS) $(TARGET).res
|
||||
tlink32 $(LINKFLAGS) @&&!
|
||||
c0w32.obj $(OBJECTS)
|
||||
$(TARGET)
|
||||
nul
|
||||
$(LIBS)
|
||||
$(TARGET).def
|
||||
$(TARGET).res
|
||||
!
|
||||
|
||||
.$(SRCSUFF).obj:
|
||||
bcc32 $(CPPFLAGS) -c {$< }
|
||||
|
||||
.c.obj:
|
||||
bcc32 $(CPPFLAGS) -P- -c {$< }
|
||||
|
||||
wxpoem.obj: wxpoem.$(SRCSUFF)
|
||||
|
||||
$(TARGET).res : $(TARGET).rc $(WXDIR)\include\wx\msw\wx.rc
|
||||
brc32 -r /i$(BCCDIR)\include /i$(WXDIR)\include $(TARGET)
|
||||
|
||||
clean:
|
||||
-erase *.obj
|
||||
-erase *.exe
|
||||
-erase *.res
|
||||
-erase *.map
|
||||
-erase *.rws
|
||||
|
37
samples/wxpoem/makefile.g95
Normal file
37
samples/wxpoem/makefile.g95
Normal file
@@ -0,0 +1,37 @@
|
||||
#
|
||||
# File: makefile.unx
|
||||
# Author: Julian Smart
|
||||
# Created: 1993
|
||||
# Updated:
|
||||
# Copyright: (c) 1993, AIAI, University of Edinburgh
|
||||
#
|
||||
# "%W% %G%"
|
||||
#
|
||||
# Makefile for wxpoem example (UNIX).
|
||||
|
||||
WXDIR = ../..
|
||||
|
||||
# All common UNIX compiler flags and options are now in
|
||||
# this central makefile.
|
||||
include $(WXDIR)/src/makeg95.env
|
||||
|
||||
OBJECTS = $(OBJDIR)/wxpoem.$(OBJSUFF) $(OBJDIR)/wxpoem_resources.$(OBJSUFF)
|
||||
|
||||
all: $(OBJDIR) wxpoem$(GUISUFFIX)$(EXESUFF)
|
||||
|
||||
wx:
|
||||
|
||||
$(OBJDIR):
|
||||
mkdir $(OBJDIR)
|
||||
|
||||
wxpoem$(GUISUFFIX)$(EXESUFF): $(OBJECTS) $(WXLIB)
|
||||
$(CC) $(LDFLAGS) -o wxpoem$(GUISUFFIX)$(EXESUFF) $(OBJECTS) $(LDLIBS)
|
||||
|
||||
$(OBJDIR)/wxpoem.$(OBJSUFF): wxpoem.$(SRCSUFF)
|
||||
$(CC) -c $(CPPFLAGS) -o $@ wxpoem.$(SRCSUFF)
|
||||
|
||||
$(OBJDIR)/wxpoem_resources.o: wxpoem.rc
|
||||
$(RESCOMP) -i wxpoem.rc -o $(OBJDIR)/wxpoem_resources.o $(RESFLAGS)
|
||||
|
||||
clean:
|
||||
rm -f $(OBJECTS) wxpoem$(GUISUFFIX).exe core *.rsc *.res
|
64
samples/wxpoem/makefile.nt
Normal file
64
samples/wxpoem/makefile.nt
Normal file
@@ -0,0 +1,64 @@
|
||||
#
|
||||
# File: makefile.nt
|
||||
# Author: Julian Smart
|
||||
# Created: 1993
|
||||
# Updated:
|
||||
# Copyright: (c) 1993, AIAI, University of Edinburgh
|
||||
#
|
||||
# "%W% %G%"
|
||||
#
|
||||
# Makefile : Builds wxpoem example (MS VC++).
|
||||
# Use FINAL=1 argument to nmake to build final version with no debugging
|
||||
# info
|
||||
|
||||
# Set WXDIR for your system
|
||||
WXDIR = $(WXWIN)
|
||||
|
||||
WXUSINGDLL=0
|
||||
|
||||
!include $(WXDIR)\src\ntwxwin.mak
|
||||
|
||||
THISDIR = $(WXDIR)\samples\wxpoem
|
||||
PROGRAM=wxpoem
|
||||
|
||||
OBJECTS = $(PROGRAM).obj
|
||||
|
||||
$(PROGRAM): $(PROGRAM).exe
|
||||
|
||||
all: wx $(PROGRAM).exe
|
||||
|
||||
wx:
|
||||
cd $(WXDIR)\src\msw
|
||||
nmake -f makefile.nt FINAL=$(FINAL)
|
||||
cd $(THISDIR)
|
||||
|
||||
wxclean:
|
||||
cd $(WXDIR)\src\msw
|
||||
nmake -f makefile.nt clean
|
||||
cd $(THISDIR)
|
||||
|
||||
$(PROGRAM).exe: $(DUMMYOBJ) $(WXLIB) $(OBJECTS) $(PROGRAM).res
|
||||
$(link) @<<
|
||||
-out:$(PROGRAM).exe
|
||||
$(LINKFLAGS)
|
||||
$(DUMMYOBJ) $(OBJECTS) $(PROGRAM).res
|
||||
$(LIBS)
|
||||
<<
|
||||
|
||||
|
||||
$(PROGRAM).obj: $(PROGRAM).$(SRCSUFF) $(DUMMYOBJ)
|
||||
$(cc) @<<
|
||||
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
|
||||
<<
|
||||
|
||||
$(PROGRAM).res : $(PROGRAM).rc $(WXDIR)\include\wx\msw\wx.rc
|
||||
$(rc) -r /i$(WXDIR)\include -fo$@ $(PROGRAM).rc
|
||||
|
||||
|
||||
clean:
|
||||
-erase *.obj
|
||||
-erase *.exe
|
||||
-erase *.res
|
||||
-erase *.map
|
||||
-erase *.sbr
|
||||
-erase *.pdb
|
17
samples/wxpoem/makefile.unx
Normal file
17
samples/wxpoem/makefile.unx
Normal file
@@ -0,0 +1,17 @@
|
||||
#
|
||||
# File: makefile.unx
|
||||
# Author: Julian Smart
|
||||
# Created: 1998
|
||||
# Updated:
|
||||
# Copyright: (c) 1998 Julian Smart
|
||||
#
|
||||
# "%W% %G%"
|
||||
#
|
||||
# Makefile for wxPoem example (UNIX).
|
||||
|
||||
PROGRAM=wxpoem
|
||||
|
||||
OBJECTS=$(PROGRAM).o
|
||||
|
||||
include ../../src/makeprog.env
|
||||
|
1126
samples/wxpoem/wxpoem.cpp
Normal file
1126
samples/wxpoem/wxpoem.cpp
Normal file
File diff suppressed because it is too large
Load Diff
2532
samples/wxpoem/wxpoem.dat
Normal file
2532
samples/wxpoem/wxpoem.dat
Normal file
File diff suppressed because it is too large
Load Diff
9
samples/wxpoem/wxpoem.def
Normal file
9
samples/wxpoem/wxpoem.def
Normal file
@@ -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
|
||||
|
90
samples/wxpoem/wxpoem.h
Normal file
90
samples/wxpoem/wxpoem.h
Normal file
@@ -0,0 +1,90 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// 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 wxPanel
|
||||
{
|
||||
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);
|
||||
|
||||
void OnCloseWindow(wxCloseEvent& event);
|
||||
void OnChar(wxKeyEvent& 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
|
||||
|
||||
|
BIN
samples/wxpoem/wxpoem.ico
Normal file
BIN
samples/wxpoem/wxpoem.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 766 B |
11
samples/wxpoem/wxpoem.rc
Normal file
11
samples/wxpoem/wxpoem.rc
Normal file
@@ -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"
|
||||
|
121
samples/wxpoem/wxpoem.txt
Normal file
121
samples/wxpoem/wxpoem.txt
Normal file
@@ -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
|
Reference in New Issue
Block a user