]>
git.saurik.com Git - wxWidgets.git/blob - samples/wxpoem/wxpoem.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: A small C++ program which displays a random poem on
4 // execution. It also allows search for poems containing a
6 // It requires winpoem.dat and creates winpoem.idx.
7 // Original version (WinPoem) written in 1994.
8 // This has not been rewritten in a long time so
9 // beware, inelegant code!
10 // Author: Julian Smart
13 // Copyright: (c) 1998 Julian Smart
14 // Licence: wxWindows licence
15 /////////////////////////////////////////////////////////////////////////////
18 #pragma implementation "wxpoem.h"
21 // For compilers that support precompilation, includes "wx.h".
22 #include "wx/wxprec.h"
38 #if defined(__WXGTK__) || defined(__WXMOTIF__)
39 #include "corner1.xpm"
40 #include "corner2.xpm"
41 #include "corner3.xpm"
42 #include "corner4.xpm"
57 #define buf_size 10000
58 #define DEFAULT_POETRY_DAT "wxpoem"
59 #define DEFAULT_POETRY_IND "wxpoem"
60 #define DEFAULT_CHAR_HEIGHT 18
61 #define DEFAULT_FONT "Swiss"
62 #define DEFAULT_X_POS 0
63 #define DEFAULT_Y_POS 0
64 #define BORDER_SIZE 30
65 #define THIN_LINE_BORDER 10
66 #define THICK_LINE_BORDER 16
67 #define THICK_LINE_WIDTH 2
68 #define SHADOW_OFFSET 1
72 static char *poem_buffer
; // Storage for each poem
73 static char line
[150]; // Storage for a line
74 static char title
[150]; // Remember the title
75 static char *search_string
= NULL
; // The search string
76 static int pages
[30]; // For multipage poems -
77 // store the start of each page
78 static long last_poem_start
= 0; // Start of last found poem
79 static long last_find
= -1; // Point in file of last found
81 static bool search_ok
= FALSE
; // Search was successful
82 static bool same_search
= FALSE
; // Searching on same string
84 static long poem_index
[600]; // Index of poem starts
85 static long nitems
= 0; // Number of poems
86 static int char_height
= DEFAULT_CHAR_HEIGHT
; // Actual height
87 static int index_ptr
= -1; // Pointer into index
88 static int poem_height
, poem_width
; // Size of poem
89 static int XPos
; // Startup X position
90 static int YPos
; // Startup Y position
91 static int pointSize
= 12; // Font size
93 static char *index_filename
= NULL
; // Index filename
94 static char *data_filename
= NULL
; // Data filename
95 static char error_buf
[300]; // Error message buffer
96 static bool loaded_ok
= FALSE
; // Poem loaded ok
97 static bool index_ok
= FALSE
; // Index loaded ok
99 static bool paging
= FALSE
; // Are we paging?
100 static int current_page
= 0; // Currently viewed page
102 wxIcon
*Corner1
= NULL
;
103 wxIcon
*Corner2
= NULL
;
104 wxIcon
*Corner3
= NULL
;
105 wxIcon
*Corner4
= NULL
;
108 wxFont
*NormalFont
= NULL
;
109 wxFont
*BoldFont
= NULL
;
110 wxFont
*ItalicFont
= NULL
;
113 wxPen
*GreyPen
= NULL
;
114 wxPen
*DarkGreyPen
= NULL
;
115 wxPen
*WhitePen
= NULL
;
118 wxBitmap
*backingBitmap
= NULL
;
120 void PoetryError(char *, char *caption
="wxPoem Error");
121 void PoetryNotify(char *Msg
, char *caption
="wxPoem");
123 bool LoadPoem(char *, long);
125 int LoadIndex(char *);
127 void WritePreferences();
128 void ReadPreferences();
129 void FindMax(int *max_thing
, int thing
);
132 void CopyToClipboard(HWND
, char *);
135 wxMenu
*popupMenu
= NULL
;
136 void PopupFunction(wxMenu
& menu
, wxCommandEvent
& event
);
138 wxHelpController
*HelpController
= NULL
;
140 // A macro needed for some compilers (AIX) that need 'main' to be defined
141 // in the application itself.
146 MainWindow
*TheMainWindow
= NULL
;
151 NormalFont
= wxTheFontList
->FindOrCreateFont(pointSize
, wxSWISS
, wxNORMAL
, wxNORMAL
);
152 BoldFont
= wxTheFontList
->FindOrCreateFont(pointSize
, wxSWISS
, wxNORMAL
, wxBOLD
);
153 ItalicFont
= wxTheFontList
->FindOrCreateFont(pointSize
, wxSWISS
, wxITALIC
, wxNORMAL
);
156 BEGIN_EVENT_TABLE(MainWindow
, wxFrame
)
157 EVT_CLOSE(MainWindow::OnCloseWindow
)
158 EVT_CHAR(MainWindow::OnChar
)
161 MainWindow::MainWindow(wxFrame
*frame
, wxWindowID id
, const wxString
& title
,
162 const wxPoint
& pos
, const wxSize
& size
, long style
):
163 wxFrame(frame
, id
, title
, pos
, size
, style
)
167 MainWindow::~MainWindow()
169 // Note: this must be done before the main window/canvas are destroyed
170 // or we get an error (no parent window for menu item button)
175 // Read the poetry buffer, either for finding the size
176 // or for writing to a bitmap (not to the window directly,
177 // since that displays messily)
178 // If DrawIt is true, we draw, otherwise we just determine the
179 // size the window should be.
180 void MainWindow::ScanBuffer(wxDC
*dc
, bool DrawIt
, int *max_x
, int *max_y
)
182 int i
= pages
[current_page
];
189 bool page_break
= FALSE
;
196 y
= (*max_y
- poem_height
)/2;
201 if (DrawIt
&& wxColourDisplay())
203 dc
->SetBrush(*wxLIGHT_GREY_BRUSH
);
204 dc
->SetPen(*GreyPen
);
205 dc
->DrawRectangle(0, 0, width
, height
);
206 dc
->SetBackgroundMode(wxTRANSPARENT
);
209 // See what ACTUAL char height is
210 dc
->SetFont(* NormalFont
);
213 dc
->GetTextExtent("X", &xx
, &yy
);
214 char_height
= (int)yy
;
216 if (current_page
== 0)
218 else if (title
[0] != 0)
220 dc
->SetFont(* BoldFont
);
221 dc
->GetTextExtent(title
, &xx
, &yy
);
222 FindMax(&curr_width
, (int)xx
);
227 dc
->SetFont(* BoldFont
);
229 // Change text to BLACK!
230 dc
->SetTextForeground(* wxBLACK
);
231 dc
->DrawText(title
, x
, y
);
232 // Change text to WHITE!
233 dc
->SetTextForeground(* wxWHITE
);
234 dc
->DrawText(title
, x
-SHADOW_OFFSET
, y
-SHADOW_OFFSET
);
240 while (ch
!= 0 && !page_break
)
244 while (((ch
= poem_buffer
[i
]) != 13) && (ch
!= 0))
246 while (((ch
= poem_buffer
[i
]) != 10) && (ch
!= 0))
263 // Add another to skip the linefeed
266 // If a single newline on its own, put a space in
288 dc
->SetFont(* BoldFont
);
291 strcpy(title
, line_ptr
);
292 strcat(title
, " (cont'd)");
294 dc
->GetTextExtent(line_ptr
, &xx
, &yy
);
295 FindMax(&curr_width
, (int)xx
);
300 dc
->SetFont(* BoldFont
);
302 // Change text to BLACK!
303 dc
->SetTextForeground(* wxBLACK
);
304 dc
->DrawText(line_ptr
, x
, y
);
306 // Change text to WHITE!
307 dc
->SetTextForeground(* wxWHITE
);
308 dc
->DrawText(line_ptr
, x
-SHADOW_OFFSET
, y
-SHADOW_OFFSET
);
309 dc
->SetTextForeground(* wxWHITE
);
315 dc
->SetFont(* ItalicFont
);
317 dc
->GetTextExtent(line_ptr
, &xx
, &yy
);
318 FindMax(&curr_width
, (int)xx
);
323 dc
->SetTextForeground(* wxBLACK
);
324 dc
->DrawText(line_ptr
, x
, y
);
328 // Default: just ignore this line
335 dc
->SetFont(* NormalFont
);
337 dc
->GetTextExtent(line
, &xx
, &yy
);
338 FindMax(&curr_width
, (int)xx
);
342 int x
= (int)((width
- xx
)/2.0);
343 dc
->SetFont(* NormalFont
);
344 dc
->SetTextForeground(* wxBLACK
);
345 dc
->DrawText(line
, x
, y
);
355 char *cont
= "(cont'd)";
357 dc
->SetFont(* NormalFont
);
359 dc
->GetTextExtent(cont
, &xx
, &yy
);
360 FindMax(&curr_width
, (int)xx
);
363 int x
= (int)((width
- xx
)/2.0);
364 dc
->SetFont(* NormalFont
);
365 dc
->SetTextForeground(* wxBLACK
);
366 dc
->DrawText(cont
, x
, y
);
371 *max_x
= (int)curr_width
;
372 *max_y
= (int)(y
-char_height
);
375 pages
[current_page
+1] = i
;
381 // Draw dark grey thick border
382 if (wxColourDisplay())
384 dc
->SetBrush(*wxGREY_BRUSH
);
385 dc
->SetPen(*wxGREY_PEN
);
388 dc
->DrawRectangle(0, 0, THIN_LINE_BORDER
, height
);
390 dc
->DrawRectangle(THIN_LINE_BORDER
, 0, width
-THIN_LINE_BORDER
, THIN_LINE_BORDER
);
392 dc
->DrawRectangle(width
-THIN_LINE_BORDER
, THIN_LINE_BORDER
, width
, height
-THIN_LINE_BORDER
);
394 dc
->DrawRectangle(THIN_LINE_BORDER
, height
-THIN_LINE_BORDER
, width
-THIN_LINE_BORDER
, height
);
397 // Have grey background, plus 3-d border -
398 // One black rectangle.
399 // Inside this, left and top sides - dark grey. Bottom and right -
402 // Change pen to black
403 dc
->SetPen(*wxBLACK_PEN
);
404 dc
->DrawLine(THIN_LINE_BORDER
, THIN_LINE_BORDER
, width
-THIN_LINE_BORDER
, THIN_LINE_BORDER
);
405 dc
->DrawLine(width
-THIN_LINE_BORDER
, THIN_LINE_BORDER
, width
-THIN_LINE_BORDER
, height
-THIN_LINE_BORDER
);
406 dc
->DrawLine(width
-THIN_LINE_BORDER
, height
-THIN_LINE_BORDER
, THIN_LINE_BORDER
, height
-THIN_LINE_BORDER
);
407 dc
->DrawLine(THIN_LINE_BORDER
, height
-THIN_LINE_BORDER
, THIN_LINE_BORDER
, THIN_LINE_BORDER
);
409 // Right and bottom white lines - 'grey' (black!) if
410 // we're running on a mono display.
411 if (wxColourDisplay())
412 dc
->SetPen(*WhitePen
);
414 dc
->SetPen(*DarkGreyPen
);
416 dc
->DrawLine(width
-THICK_LINE_BORDER
, THICK_LINE_BORDER
,
417 width
-THICK_LINE_BORDER
, height
-THICK_LINE_BORDER
);
418 dc
->DrawLine(width
-THICK_LINE_BORDER
, height
-THICK_LINE_BORDER
,
419 THICK_LINE_BORDER
, height
-THICK_LINE_BORDER
);
421 // Left and top grey lines
422 dc
->SetPen(*DarkGreyPen
);
423 dc
->DrawLine(THICK_LINE_BORDER
, height
-THICK_LINE_BORDER
,
424 THICK_LINE_BORDER
, THICK_LINE_BORDER
);
425 dc
->DrawLine(THICK_LINE_BORDER
, THICK_LINE_BORDER
,
426 width
-THICK_LINE_BORDER
, THICK_LINE_BORDER
);
430 dc
->DrawIcon(* Corner1
, 0, 0);
431 dc
->DrawIcon(* Corner2
, int(width
-32), 0);
433 int y2
= height
- 32;
435 dc
->DrawIcon(* Corner3
, 0, y2
);
436 dc
->DrawIcon(* Corner4
, x2
, y2
);
441 // Get an index (randomly generated) and load the poem
442 void MainWindow::GetIndexLoadPoem(void)
445 index_ptr
= GetIndex();
448 loaded_ok
= LoadPoem(data_filename
, -1);
451 // Find the size of the poem and resize the window accordingly
452 void MainWindow::Resize(void)
454 wxClientDC
dc(canvas
);
457 ScanBuffer(& dc
, FALSE
, &poem_width
, &poem_height
);
458 int x
= poem_width
+ (2*BORDER_SIZE
);
459 int y
= poem_height
+ (2*BORDER_SIZE
);
463 // In case client size isn't what we set it to...
465 GetClientSize(&xx
, &yy
);
468 if (backingBitmap
) delete backingBitmap
;
469 backingBitmap
= new wxBitmap(x
, yy
);
470 memDC
.SelectObject(* backingBitmap
);
473 TheMainWindow
->ScanBuffer(&memDC
, TRUE
, &xx
, &yy
);
477 void FindMax(int *max_thing
, int thing
)
479 if (thing
> *max_thing
)
484 void MainWindow::NextPage(void)
497 void MainWindow::PreviousPage(void)
499 if (current_page
> 0)
506 // Search for a string
507 void MainWindow::Search(bool ask
)
511 if (ask
|| !search_string
)
513 wxString s
= wxGetTextFromUser("Enter search string", "Search", (const char*) search_string
);
516 if (search_string
) delete[] search_string
;
517 search_string
= copystring(s
);
519 } else search_ok
= FALSE
;
527 if (search_string
&& search_ok
)
529 position
= DoSearch();
532 loaded_ok
= LoadPoem(data_filename
, position
);
538 PoetryNotify("Search string not found.");
543 // Copy a string to the clipboard
545 void CopyToClipboard(HWND handle
, char *s
)
547 int length
= strlen(s
);
548 HANDLE hGlobalMemory
= GlobalAlloc(GHND
, (DWORD
) length
+ 1);
551 #ifdef __WINDOWS_386__
552 LPSTR lpGlobalMemory
= MK_FP32(GlobalLock(hGlobalMemory
));
554 LPSTR lpGlobalMemory
= (LPSTR
)GlobalLock(hGlobalMemory
);
557 for (i
= 0; i
< length
; i
++)
575 lpGlobalMemory
[j
] = s
[i
];
580 GlobalUnlock(hGlobalMemory
);
581 OpenClipboard(handle
);
583 SetClipboardData(CF_TEXT
, hGlobalMemory
);
591 poem_buffer
= new char[buf_size
];
593 GreyPen
= new wxPen("LIGHT GREY", THICK_LINE_WIDTH
, wxSOLID
);
594 DarkGreyPen
= new wxPen("GREY", THICK_LINE_WIDTH
, wxSOLID
);
595 WhitePen
= new wxPen("WHITE", THICK_LINE_WIDTH
, wxSOLID
);
597 HelpController
= new wxHelpController();
598 HelpController
->Initialize("wxpoem");
604 // Seed the random number generator
607 (void)time(¤t_time
);
608 srand((unsigned int)current_time
);
613 TheMainWindow
= new MainWindow(NULL
, -1, "wxPoem", wxPoint(XPos
, YPos
), wxSize(100, 100), wxCAPTION
|wxMINIMIZE_BOX
|wxSYSTEM_MENU
);
616 TheMainWindow
->SetIcon(Icon("wxpoem"));
619 TheMainWindow
->canvas
= new MyCanvas(TheMainWindow
, -1, wxDefaultPosition
, wxDefaultSize
);
621 popupMenu
= new wxMenu("", (wxFunction
)PopupFunction
);
622 popupMenu
->Append(POEM_NEXT
, "Next poem/page");
623 popupMenu
->Append(POEM_PREVIOUS
, "Previous page");
624 popupMenu
->AppendSeparator();
625 popupMenu
->Append(POEM_SEARCH
, "Search");
626 popupMenu
->Append(POEM_NEXT_MATCH
, "Next match");
627 popupMenu
->Append(POEM_COPY
, "Copy to clipboard");
628 popupMenu
->Append(POEM_MINIMIZE
, "Minimize");
629 popupMenu
->AppendSeparator();
630 popupMenu
->Append(POEM_BIGGER_TEXT
, "Bigger text");
631 popupMenu
->Append(POEM_SMALLER_TEXT
, "Smaller text");
632 popupMenu
->AppendSeparator();
633 popupMenu
->Append(POEM_ABOUT
, "About wxPoem");
634 popupMenu
->AppendSeparator();
635 popupMenu
->Append(POEM_EXIT
, "Exit");
639 index_filename
= copystring(argv
[1]);
640 data_filename
= copystring(argv
[1]);
644 index_filename
= DEFAULT_POETRY_IND
;
645 data_filename
= DEFAULT_POETRY_DAT
;
650 Corner1
= new wxIcon("icon_1");
651 Corner2
= new wxIcon("icon_2");
652 Corner3
= new wxIcon("icon_3");
653 Corner4
= new wxIcon("icon_4");
655 #if defined(__WXGTK__) || defined(__WXMOTIF__)
656 Corner1
= new wxIcon( corner1_xpm
);
657 Corner2
= new wxIcon( corner2_xpm
);
658 Corner3
= new wxIcon( corner3_xpm
);
659 Corner4
= new wxIcon( corner4_xpm
);
662 TheMainWindow
->GetIndexLoadPoem();
663 TheMainWindow
->Resize();
664 TheMainWindow
->Show(TRUE
);
672 delete backingBitmap
;
673 delete HelpController
;
691 void MainWindow::OnCloseWindow(wxCloseEvent
& WXUNUSED(event
))
697 void MainWindow::OnChar(wxKeyEvent
& event
)
699 canvas
->OnChar(event
);
702 BEGIN_EVENT_TABLE(MyCanvas
, wxPanel
)
703 EVT_MOUSE_EVENTS(MyCanvas::OnMouseEvent
)
704 EVT_CHAR(MyCanvas::OnChar
)
705 EVT_PAINT(MyCanvas::OnPaint
)
708 // Define a constructor for my canvas
709 MyCanvas::MyCanvas(wxFrame
*frame
, wxWindowID id
, const wxPoint
& pos
, const wxSize
& size
):
710 wxPanel(frame
, id
, pos
, size
)
714 // Define the repainting behaviour
715 void MyCanvas::OnPaint(wxPaintEvent
& WXUNUSED(event
))
722 TheMainWindow
->GetClientSize(&xx
, &yy
);
725 memDC
.SelectObject(* backingBitmap
);
726 dc
.Blit(0, 0, backingBitmap
->GetWidth(), backingBitmap
->GetHeight(), &memDC
, 0, 0);
730 void MyCanvas::OnMouseEvent(wxMouseEvent
& event
)
733 event
.Position(&x
, &y
);
734 static int startPosX
, startPosY
, startFrameX
, startFrameY
;
736 event
.Position(&x
, &y
);
738 if (event
.RightDown())
740 // Versions from wxWin 1.67 are probably OK
741 PopupMenu(popupMenu
, (int)x
, (int)y
);
743 else if (event
.LeftDown())
745 this->CaptureMouse();
748 ClientToScreen(&x1
, &y1
);
751 GetParent()->GetPosition(&startFrameX
, &startFrameY
);
753 else if (event
.LeftUp())
754 this->ReleaseMouse();
755 else if (event
.Dragging() && event
.LeftIsDown())
759 ClientToScreen(&x1
, &y1
);
761 int dX
= x1
- startPosX
;
762 int dY
= y1
- startPosY
;
763 GetParent()->Move(startFrameX
+ dX
, startFrameY
+ dY
);
767 // Process characters
768 void MyCanvas::OnChar(wxKeyEvent
& event
)
770 switch (event
.KeyCode())
775 TheMainWindow
->Search(FALSE
);
780 TheMainWindow
->Search(TRUE
);
784 TheMainWindow
->NextPage();
787 TheMainWindow
->Close(TRUE
);
794 int LoadIndex(char *file_name
)
803 sprintf(buf
, "%s.idx", file_name
);
804 if (! (file_name
&& (index_file
= fopen(buf
, "r"))))
808 fscanf(index_file
, "%ld", &nitems
);
810 for (i
= 0; i
< nitems
; i
++)
812 fscanf(index_file
, "%ld", &data
);
813 poem_index
[i
] = data
;
826 indexn
= (int)(rand() % nitems
);
828 if ((indexn
< 0) || (indexn
> nitems
))
829 { PoetryError("No such poem!");
837 void ReadPreferences()
839 wxGetResource("wxPoem", "FontSize", &pointSize
);
840 wxGetResource("wxPoem", "X", &XPos
);
841 wxGetResource("wxPoem", "Y", &YPos
);
844 // Write preferences to disk
845 void WritePreferences()
848 TheMainWindow
->GetPosition(&XPos
, &YPos
);
849 wxWriteResource("wxPoem", "FontSize", pointSize
);
850 wxWriteResource("wxPoem", "X", XPos
);
851 wxWriteResource("wxPoem", "Y", YPos
);
855 // Load a poem from given file, at given point in file.
856 // If position is > -1, use this for the position in the
857 // file, otherwise use index[index_ptr] to find the correct position.
858 bool LoadPoem(char *file_name
, long position
)
872 sprintf(buf
, "%s.dat", file_name
);
874 if (! (file_name
&& (data_file
= fopen(buf
, "r"))))
876 sprintf(error_buf
, "Data file %s not found.", buf
);
877 PoetryError(error_buf
);
885 data
= poem_index
[index_ptr
];
887 fseek(data_file
, data
, SEEK_SET
);
891 while ((ch
!= EOF
) && (ch
!= '#'))
893 ch
= getc(data_file
);
894 // Add a linefeed so it will copy to the clipboard ok
906 sprintf(error_buf
, "%s", "Poetry buffer exceeded.");
907 PoetryError(error_buf
);
912 poem_buffer
[i
-1] = 0;
918 long MainWindow::DoSearch(void)
928 long previous_poem_start
;
931 int search_length
= strlen(search_string
);
935 find_start
= last_find
+ 1;
936 previous_poem_start
= last_poem_start
;
942 previous_poem_start
= -1;
946 sprintf(buf
, "%s.dat", data_filename
);
948 if (! (data_filename
&& (file
= fopen(buf
, "r"))))
950 sprintf(error_buf
, "Poetry data file %s not found\n", buf
);
951 PoetryError(error_buf
);
955 fseek(file
, find_start
, SEEK_SET
);
957 while ((ch
!= EOF
) && !found
)
960 ch
|= 0x0020; // Make lower case
962 // Only match if we're looking at a different poem
963 // (no point in displaying the same poem again)
964 if ((ch
== search_string
[i
]) && (last_poem_start
!= previous_poem_start
))
967 last_find
= ftell(file
);
968 if (i
== search_length
-1)
978 last_poem_start
= ftell(file
);
987 return last_poem_start
;
993 // Set up poetry filenames, preferences, load the index
994 // Load index (or compile it if none found)
997 index_ok
= LoadIndex(index_filename
);
998 if (!index_ok
|| (nitems
== 0))
1000 PoetryError("Index file not found; will compile new one", "wxPoem");
1001 index_ok
= Compile();
1006 void PoetryError(char *msg
, char *caption
)
1008 wxMessageBox(msg
, caption
, wxOK
|wxICON_EXCLAMATION
);
1011 // Notification (change icon to something appropriate!)
1012 void PoetryNotify(char *Msg
, char *caption
)
1014 wxMessageBox(Msg
, caption
, wxOK
| wxICON_INFORMATION
);
1017 // Build up and save an index into the poetry data file, for
1018 // rapid random access
1028 sprintf(buf
, "%s.dat", data_filename
);
1030 if (! (data_filename
&& (file
= fopen(buf
, "r"))))
1032 sprintf(error_buf
, "Poetry data file %s not found\n", buf
);
1033 PoetryError(error_buf
);
1040 poem_index
[nitems
] = 0;
1053 poem_index
[nitems
] = data
;
1060 sprintf(buf
, "%s.idx", index_filename
);
1061 if (! (data_filename
&& (file
= fopen(buf
, "w"))))
1063 sprintf(error_buf
, "Poetry index file %s cannot be created\n", buf
);
1064 PoetryError(error_buf
);
1068 fprintf(file
, "%ld\n\n", nitems
);
1069 for (j
= 0; j
< nitems
; j
++)
1070 fprintf(file
, "%ld\n", poem_index
[j
]);
1073 PoetryNotify("Poetry index compiled.");
1077 void PopupFunction(wxMenu
& /*menu*/, wxCommandEvent
& event
)
1079 switch (event
.GetId())
1082 // Another poem/page
1083 TheMainWindow
->NextPage();
1087 TheMainWindow
->PreviousPage();
1090 // Search - with dialog
1091 TheMainWindow
->Search(TRUE
);
1093 case POEM_NEXT_MATCH
:
1094 // Search - without dialog (next match)
1095 TheMainWindow
->Search(FALSE
);
1098 TheMainWindow
->Iconize(TRUE
);
1102 // Copy current poem to the clipboard
1103 CopyToClipboard((HWND
) TheMainWindow
->GetHWND(), poem_buffer
);
1110 case POEM_BIGGER_TEXT
:
1114 TheMainWindow
->Resize();
1117 case POEM_SMALLER_TEXT
:
1123 TheMainWindow
->Resize();
1127 case POEM_HELP_CONTENTS
:
1129 HelpController
->LoadFile("wxpoem");
1130 HelpController
->DisplayContents();
1135 (void)wxMessageBox("wxPoem Version 1.1\nJulian Smart (c) 1995",
1136 "About wxPoem", wxOK
, TheMainWindow
);
1141 TheMainWindow
->Close(TRUE
);