]>
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"
50 #define buf_size 10000
51 #define DEFAULT_POETRY_DAT "wxpoem"
52 #define DEFAULT_POETRY_IND "wxpoem"
53 #define DEFAULT_CHAR_HEIGHT 18
54 #define DEFAULT_FONT "Swiss"
55 #define DEFAULT_X_POS 0
56 #define DEFAULT_Y_POS 0
57 #define BORDER_SIZE 30
58 #define THIN_LINE_BORDER 10
59 #define THICK_LINE_BORDER 16
60 #define THICK_LINE_WIDTH 2
61 #define SHADOW_OFFSET 1
65 static char *poem_buffer
; // Storage for each poem
66 static char line
[150]; // Storage for a line
67 static char title
[150]; // Remember the title
68 static char *search_string
= NULL
; // The search string
69 static int pages
[30]; // For multipage poems -
70 // store the start of each page
71 static long last_poem_start
= 0; // Start of last found poem
72 static long last_find
= -1; // Point in file of last found
74 static bool search_ok
= FALSE
; // Search was successful
75 static bool same_search
= FALSE
; // Searching on same string
77 static long poem_index
[600]; // Index of poem starts
78 static long nitems
= 0; // Number of poems
79 static int char_height
= DEFAULT_CHAR_HEIGHT
; // Actual height
80 static int index_ptr
= -1; // Pointer into index
81 static int poem_height
, poem_width
; // Size of poem
82 static int XPos
; // Startup X position
83 static int YPos
; // Startup Y position
84 static int pointSize
= 12; // Font size
86 static char *index_filename
= NULL
; // Index filename
87 static char *data_filename
= NULL
; // Data filename
88 static char error_buf
[300]; // Error message buffer
89 static bool loaded_ok
= FALSE
; // Poem loaded ok
90 static bool index_ok
= FALSE
; // Index loaded ok
92 static bool paging
= FALSE
; // Are we paging?
93 static int current_page
= 0; // Currently viewed page
95 wxIcon
*Corner1
= NULL
;
96 wxIcon
*Corner2
= NULL
;
97 wxIcon
*Corner3
= NULL
;
98 wxIcon
*Corner4
= NULL
;
101 wxFont
*NormalFont
= NULL
;
102 wxFont
*BoldFont
= NULL
;
103 wxFont
*ItalicFont
= NULL
;
106 wxPen
*GreyPen
= NULL
;
107 wxPen
*DarkGreyPen
= NULL
;
108 wxPen
*WhitePen
= NULL
;
111 wxBitmap
*backingBitmap
= NULL
;
113 void PoetryError(char *, char *caption
="wxPoem Error");
114 void PoetryNotify(char *Msg
, char *caption
="wxPoem");
116 bool LoadPoem(char *, long);
118 int LoadIndex(char *);
120 void WritePreferences();
121 void ReadPreferences();
122 void FindMax(int *max_thing
, int thing
);
125 void CopyToClipboard(HWND
, char *);
128 wxMenu
*popupMenu
= NULL
;
129 void PopupFunction(wxMenu
& menu
, wxCommandEvent
& event
);
131 wxHelpController
*HelpController
= NULL
;
133 // A macro needed for some compilers (AIX) that need 'main' to be defined
134 // in the application itself.
139 MainWindow
*TheMainWindow
= NULL
;
144 NormalFont
= wxTheFontList
->FindOrCreateFont(pointSize
, wxSWISS
, wxNORMAL
, wxNORMAL
);
145 BoldFont
= wxTheFontList
->FindOrCreateFont(pointSize
, wxSWISS
, wxNORMAL
, wxBOLD
);
146 ItalicFont
= wxTheFontList
->FindOrCreateFont(pointSize
, wxSWISS
, wxITALIC
, wxNORMAL
);
149 BEGIN_EVENT_TABLE(MainWindow
, wxFrame
)
150 EVT_CLOSE(MainWindow::OnCloseWindow
)
151 EVT_CHAR(MainWindow::OnChar
)
154 MainWindow::MainWindow(wxFrame
*frame
, wxWindowID id
, const wxString
& title
,
155 const wxPoint
& pos
, const wxSize
& size
, long style
):
156 wxFrame(frame
, id
, title
, pos
, size
, style
)
160 MainWindow::~MainWindow()
162 // Note: this must be done before the main window/canvas are destroyed
163 // or we get an error (no parent window for menu item button)
168 // Read the poetry buffer, either for finding the size
169 // or for writing to a bitmap (not to the window directly,
170 // since that displays messily)
171 // If DrawIt is true, we draw, otherwise we just determine the
172 // size the window should be.
173 void MainWindow::ScanBuffer(wxDC
*dc
, bool DrawIt
, int *max_x
, int *max_y
)
175 int i
= pages
[current_page
];
182 bool page_break
= FALSE
;
189 y
= (*max_y
- poem_height
)/2;
194 if (DrawIt
&& wxColourDisplay())
196 dc
->SetBrush(*wxLIGHT_GREY_BRUSH
);
197 dc
->SetPen(*GreyPen
);
198 dc
->DrawRectangle(0, 0, width
, height
);
199 dc
->SetBackgroundMode(wxTRANSPARENT
);
202 // See what ACTUAL char height is
203 dc
->SetFont(* NormalFont
);
206 dc
->GetTextExtent("X", &xx
, &yy
);
207 char_height
= (int)yy
;
209 if (current_page
== 0)
211 else if (title
[0] != 0)
213 dc
->SetFont(* BoldFont
);
214 dc
->GetTextExtent(title
, &xx
, &yy
);
215 FindMax(&curr_width
, (int)xx
);
220 dc
->SetFont(* BoldFont
);
222 // Change text to BLACK!
223 dc
->SetTextForeground(* wxBLACK
);
224 dc
->DrawText(title
, x
, y
);
225 // Change text to WHITE!
226 dc
->SetTextForeground(* wxWHITE
);
227 dc
->DrawText(title
, x
-SHADOW_OFFSET
, y
-SHADOW_OFFSET
);
233 while (ch
!= 0 && !page_break
)
237 while (((ch
= poem_buffer
[i
]) != 13) && (ch
!= 0))
239 while (((ch
= poem_buffer
[i
]) != 10) && (ch
!= 0))
256 // Add another to skip the linefeed
259 // If a single newline on its own, put a space in
281 dc
->SetFont(* BoldFont
);
284 strcpy(title
, line_ptr
);
285 strcat(title
, " (cont'd)");
287 dc
->GetTextExtent(line_ptr
, &xx
, &yy
);
288 FindMax(&curr_width
, (int)xx
);
293 dc
->SetFont(* BoldFont
);
295 // Change text to BLACK!
296 dc
->SetTextForeground(* wxBLACK
);
297 dc
->DrawText(line_ptr
, x
, y
);
299 // Change text to WHITE!
300 dc
->SetTextForeground(* wxWHITE
);
301 dc
->DrawText(line_ptr
, x
-SHADOW_OFFSET
, y
-SHADOW_OFFSET
);
302 dc
->SetTextForeground(* wxWHITE
);
308 dc
->SetFont(* ItalicFont
);
310 dc
->GetTextExtent(line_ptr
, &xx
, &yy
);
311 FindMax(&curr_width
, (int)xx
);
316 dc
->SetTextForeground(* wxBLACK
);
317 dc
->DrawText(line_ptr
, x
, y
);
321 // Default: just ignore this line
328 dc
->SetFont(* NormalFont
);
330 dc
->GetTextExtent(line
, &xx
, &yy
);
331 FindMax(&curr_width
, (int)xx
);
335 int x
= (int)((width
- xx
)/2.0);
336 dc
->SetFont(* NormalFont
);
337 dc
->SetTextForeground(* wxBLACK
);
338 dc
->DrawText(line
, x
, y
);
348 char *cont
= "(cont'd)";
350 dc
->SetFont(* NormalFont
);
352 dc
->GetTextExtent(cont
, &xx
, &yy
);
353 FindMax(&curr_width
, (int)xx
);
356 int x
= (int)((width
- xx
)/2.0);
357 dc
->SetFont(* NormalFont
);
358 dc
->SetTextForeground(* wxBLACK
);
359 dc
->DrawText(cont
, x
, y
);
364 *max_x
= (int)curr_width
;
365 *max_y
= (int)(y
-char_height
);
368 pages
[current_page
+1] = i
;
374 // Draw dark grey thick border
375 if (wxColourDisplay())
377 dc
->SetBrush(*wxGREY_BRUSH
);
378 dc
->SetPen(*wxGREY_PEN
);
381 dc
->DrawRectangle(0, 0, THIN_LINE_BORDER
, height
);
383 dc
->DrawRectangle(THIN_LINE_BORDER
, 0, width
-THIN_LINE_BORDER
, THIN_LINE_BORDER
);
385 dc
->DrawRectangle(width
-THIN_LINE_BORDER
, THIN_LINE_BORDER
, width
, height
-THIN_LINE_BORDER
);
387 dc
->DrawRectangle(THIN_LINE_BORDER
, height
-THIN_LINE_BORDER
, width
-THIN_LINE_BORDER
, height
);
390 // Have grey background, plus 3-d border -
391 // One black rectangle.
392 // Inside this, left and top sides - dark grey. Bottom and right -
395 // Change pen to black
396 dc
->SetPen(*wxBLACK_PEN
);
397 dc
->DrawLine(THIN_LINE_BORDER
, THIN_LINE_BORDER
, width
-THIN_LINE_BORDER
, THIN_LINE_BORDER
);
398 dc
->DrawLine(width
-THIN_LINE_BORDER
, THIN_LINE_BORDER
, width
-THIN_LINE_BORDER
, height
-THIN_LINE_BORDER
);
399 dc
->DrawLine(width
-THIN_LINE_BORDER
, height
-THIN_LINE_BORDER
, THIN_LINE_BORDER
, height
-THIN_LINE_BORDER
);
400 dc
->DrawLine(THIN_LINE_BORDER
, height
-THIN_LINE_BORDER
, THIN_LINE_BORDER
, THIN_LINE_BORDER
);
402 // Right and bottom white lines - 'grey' (black!) if
403 // we're running on a mono display.
404 if (wxColourDisplay())
405 dc
->SetPen(*WhitePen
);
407 dc
->SetPen(*DarkGreyPen
);
409 dc
->DrawLine(width
-THICK_LINE_BORDER
, THICK_LINE_BORDER
,
410 width
-THICK_LINE_BORDER
, height
-THICK_LINE_BORDER
);
411 dc
->DrawLine(width
-THICK_LINE_BORDER
, height
-THICK_LINE_BORDER
,
412 THICK_LINE_BORDER
, height
-THICK_LINE_BORDER
);
414 // Left and top grey lines
415 dc
->SetPen(*DarkGreyPen
);
416 dc
->DrawLine(THICK_LINE_BORDER
, height
-THICK_LINE_BORDER
,
417 THICK_LINE_BORDER
, THICK_LINE_BORDER
);
418 dc
->DrawLine(THICK_LINE_BORDER
, THICK_LINE_BORDER
,
419 width
-THICK_LINE_BORDER
, THICK_LINE_BORDER
);
423 dc
->DrawIcon(* Corner1
, 0, 0);
424 dc
->DrawIcon(* Corner2
, int(width
-32), 0);
426 int y2
= height
- 32;
428 dc
->DrawIcon(* Corner3
, 0, y2
);
429 dc
->DrawIcon(* Corner4
, x2
, y2
);
434 // Get an index (randomly generated) and load the poem
435 void MainWindow::GetIndexLoadPoem(void)
438 index_ptr
= GetIndex();
441 loaded_ok
= LoadPoem(data_filename
, -1);
444 // Find the size of the poem and resize the window accordingly
445 void MainWindow::Resize(void)
447 wxClientDC
dc(canvas
);
450 ScanBuffer(& dc
, FALSE
, &poem_width
, &poem_height
);
451 int x
= poem_width
+ (2*BORDER_SIZE
);
452 int y
= poem_height
+ (2*BORDER_SIZE
);
456 // In case client size isn't what we set it to...
458 GetClientSize(&xx
, &yy
);
461 if (backingBitmap
) delete backingBitmap
;
462 backingBitmap
= new wxBitmap(x
, yy
);
463 memDC
.SelectObject(* backingBitmap
);
466 TheMainWindow
->ScanBuffer(&memDC
, TRUE
, &xx
, &yy
);
470 void FindMax(int *max_thing
, int thing
)
472 if (thing
> *max_thing
)
477 void MainWindow::NextPage(void)
490 void MainWindow::PreviousPage(void)
492 if (current_page
> 0)
499 // Search for a string
500 void MainWindow::Search(bool ask
)
504 if (ask
|| !search_string
)
506 wxString s
= wxGetTextFromUser("Enter search string", "Search", (const char*) search_string
);
509 if (search_string
) delete[] search_string
;
510 search_string
= copystring(s
);
512 } else search_ok
= FALSE
;
520 if (search_string
&& search_ok
)
522 position
= DoSearch();
525 loaded_ok
= LoadPoem(data_filename
, position
);
531 PoetryNotify("Search string not found.");
536 // Copy a string to the clipboard
538 void CopyToClipboard(HWND handle
, char *s
)
540 int length
= strlen(s
);
541 HANDLE hGlobalMemory
= GlobalAlloc(GHND
, (DWORD
) length
+ 1);
544 #ifdef __WINDOWS_386__
545 LPSTR lpGlobalMemory
= MK_FP32(GlobalLock(hGlobalMemory
));
547 LPSTR lpGlobalMemory
= (LPSTR
)GlobalLock(hGlobalMemory
);
550 for (i
= 0; i
< length
; i
++)
568 lpGlobalMemory
[j
] = s
[i
];
573 GlobalUnlock(hGlobalMemory
);
574 OpenClipboard(handle
);
576 SetClipboardData(CF_TEXT
, hGlobalMemory
);
584 poem_buffer
= new char[buf_size
];
586 GreyPen
= new wxPen("LIGHT GREY", THICK_LINE_WIDTH
, wxSOLID
);
587 DarkGreyPen
= new wxPen("GREY", THICK_LINE_WIDTH
, wxSOLID
);
588 WhitePen
= new wxPen("WHITE", THICK_LINE_WIDTH
, wxSOLID
);
590 HelpController
= new wxHelpController();
591 HelpController
->Initialize("wxpoem");
597 // Seed the random number generator
600 (void)time(¤t_time
);
601 srand((unsigned int)current_time
);
606 TheMainWindow
= new MainWindow(NULL
, -1, "wxPoem", wxPoint(XPos
, YPos
), wxSize(100, 100), wxCAPTION
|wxMINIMIZE_BOX
|wxSYSTEM_MENU
);
609 TheMainWindow
->SetIcon(Icon("wxpoem"));
612 TheMainWindow
->canvas
= new MyCanvas(TheMainWindow
, -1, wxDefaultPosition
, wxDefaultSize
);
614 popupMenu
= new wxMenu("", (wxFunction
)PopupFunction
);
615 popupMenu
->Append(POEM_NEXT
, "Next poem/page");
616 popupMenu
->Append(POEM_PREVIOUS
, "Previous page");
617 popupMenu
->AppendSeparator();
618 popupMenu
->Append(POEM_SEARCH
, "Search");
619 popupMenu
->Append(POEM_NEXT_MATCH
, "Next match");
620 popupMenu
->Append(POEM_COPY
, "Copy to clipboard");
621 popupMenu
->Append(POEM_MINIMIZE
, "Minimize");
622 popupMenu
->AppendSeparator();
623 popupMenu
->Append(POEM_BIGGER_TEXT
, "Bigger text");
624 popupMenu
->Append(POEM_SMALLER_TEXT
, "Smaller text");
625 popupMenu
->AppendSeparator();
626 popupMenu
->Append(POEM_ABOUT
, "About wxPoem");
627 popupMenu
->AppendSeparator();
628 popupMenu
->Append(POEM_EXIT
, "Exit");
632 index_filename
= copystring(argv
[1]);
633 data_filename
= copystring(argv
[1]);
637 index_filename
= DEFAULT_POETRY_IND
;
638 data_filename
= DEFAULT_POETRY_DAT
;
643 Corner1
= new wxIcon("icon_1");
644 Corner2
= new wxIcon("icon_2");
645 Corner3
= new wxIcon("icon_3");
646 Corner4
= new wxIcon("icon_4");
648 #if defined(__WXGTK__) || defined(__WXMOTIF__)
649 Corner1
= new wxIcon( corner1_xpm
);
650 Corner2
= new wxIcon( corner2_xpm
);
651 Corner3
= new wxIcon( corner3_xpm
);
652 Corner4
= new wxIcon( corner4_xpm
);
655 TheMainWindow
->GetIndexLoadPoem();
656 TheMainWindow
->Resize();
657 TheMainWindow
->Show(TRUE
);
665 delete backingBitmap
;
666 delete HelpController
;
684 void MainWindow::OnCloseWindow(wxCloseEvent
& WXUNUSED(event
))
690 void MainWindow::OnChar(wxKeyEvent
& event
)
692 canvas
->OnChar(event
);
695 BEGIN_EVENT_TABLE(MyCanvas
, wxPanel
)
696 EVT_MOUSE_EVENTS(MyCanvas::OnMouseEvent
)
697 EVT_CHAR(MyCanvas::OnChar
)
698 EVT_PAINT(MyCanvas::OnPaint
)
701 // Define a constructor for my canvas
702 MyCanvas::MyCanvas(wxFrame
*frame
, wxWindowID id
, const wxPoint
& pos
, const wxSize
& size
):
703 wxPanel(frame
, id
, pos
, size
)
707 // Define the repainting behaviour
708 void MyCanvas::OnPaint(wxPaintEvent
& WXUNUSED(event
))
715 TheMainWindow
->GetClientSize(&xx
, &yy
);
718 memDC
.SelectObject(* backingBitmap
);
719 dc
.Blit(0, 0, backingBitmap
->GetWidth(), backingBitmap
->GetHeight(), &memDC
, 0, 0);
723 void MyCanvas::OnMouseEvent(wxMouseEvent
& event
)
726 event
.Position(&x
, &y
);
727 static int startPosX
, startPosY
, startFrameX
, startFrameY
;
729 event
.Position(&x
, &y
);
731 if (event
.RightDown())
733 // Versions from wxWin 1.67 are probably OK
734 PopupMenu(popupMenu
, (int)x
, (int)y
);
736 else if (event
.LeftDown())
738 this->CaptureMouse();
741 ClientToScreen(&x1
, &y1
);
744 GetParent()->GetPosition(&startFrameX
, &startFrameY
);
746 else if (event
.LeftUp())
747 this->ReleaseMouse();
748 else if (event
.Dragging() && event
.LeftIsDown())
752 ClientToScreen(&x1
, &y1
);
754 int dX
= x1
- startPosX
;
755 int dY
= y1
- startPosY
;
756 GetParent()->Move(startFrameX
+ dX
, startFrameY
+ dY
);
760 // Process characters
761 void MyCanvas::OnChar(wxKeyEvent
& event
)
763 switch (event
.KeyCode())
768 TheMainWindow
->Search(FALSE
);
773 TheMainWindow
->Search(TRUE
);
777 TheMainWindow
->NextPage();
780 TheMainWindow
->Close(TRUE
);
787 int LoadIndex(char *file_name
)
796 sprintf(buf
, "%s.idx", file_name
);
797 if (! (file_name
&& (index_file
= fopen(buf
, "r"))))
801 fscanf(index_file
, "%ld", &nitems
);
803 for (i
= 0; i
< nitems
; i
++)
805 fscanf(index_file
, "%ld", &data
);
806 poem_index
[i
] = data
;
819 indexn
= (int)(rand() % nitems
);
821 if ((indexn
< 0) || (indexn
> nitems
))
822 { PoetryError("No such poem!");
830 void ReadPreferences()
832 wxGetResource("wxPoem", "FontSize", &pointSize
);
833 wxGetResource("wxPoem", "X", &XPos
);
834 wxGetResource("wxPoem", "Y", &YPos
);
837 // Write preferences to disk
838 void WritePreferences()
841 TheMainWindow
->GetPosition(&XPos
, &YPos
);
842 wxWriteResource("wxPoem", "FontSize", pointSize
);
843 wxWriteResource("wxPoem", "X", XPos
);
844 wxWriteResource("wxPoem", "Y", YPos
);
848 // Load a poem from given file, at given point in file.
849 // If position is > -1, use this for the position in the
850 // file, otherwise use index[index_ptr] to find the correct position.
851 bool LoadPoem(char *file_name
, long position
)
865 sprintf(buf
, "%s.dat", file_name
);
867 if (! (file_name
&& (data_file
= fopen(buf
, "r"))))
869 sprintf(error_buf
, "Data file %s not found.", buf
);
870 PoetryError(error_buf
);
878 data
= poem_index
[index_ptr
];
880 fseek(data_file
, data
, SEEK_SET
);
884 while ((ch
!= EOF
) && (ch
!= '#'))
886 ch
= getc(data_file
);
887 // Add a linefeed so it will copy to the clipboard ok
899 sprintf(error_buf
, "%s", "Poetry buffer exceeded.");
900 PoetryError(error_buf
);
905 poem_buffer
[i
-1] = 0;
911 long MainWindow::DoSearch(void)
921 long previous_poem_start
;
924 int search_length
= strlen(search_string
);
928 find_start
= last_find
+ 1;
929 previous_poem_start
= last_poem_start
;
935 previous_poem_start
= -1;
939 sprintf(buf
, "%s.dat", data_filename
);
941 if (! (data_filename
&& (file
= fopen(buf
, "r"))))
943 sprintf(error_buf
, "Poetry data file %s not found\n", buf
);
944 PoetryError(error_buf
);
948 fseek(file
, find_start
, SEEK_SET
);
950 while ((ch
!= EOF
) && !found
)
953 ch
|= 0x0020; // Make lower case
955 // Only match if we're looking at a different poem
956 // (no point in displaying the same poem again)
957 if ((ch
== search_string
[i
]) && (last_poem_start
!= previous_poem_start
))
960 last_find
= ftell(file
);
961 if (i
== search_length
-1)
971 last_poem_start
= ftell(file
);
980 return last_poem_start
;
986 // Set up poetry filenames, preferences, load the index
987 // Load index (or compile it if none found)
990 index_ok
= LoadIndex(index_filename
);
991 if (!index_ok
|| (nitems
== 0))
993 PoetryError("Index file not found; will compile new one", "wxPoem");
994 index_ok
= Compile();
999 void PoetryError(char *msg
, char *caption
)
1001 wxMessageBox(msg
, caption
, wxOK
|wxICON_EXCLAMATION
);
1004 // Notification (change icon to something appropriate!)
1005 void PoetryNotify(char *Msg
, char *caption
)
1007 wxMessageBox(Msg
, caption
, wxOK
| wxICON_INFORMATION
);
1010 // Build up and save an index into the poetry data file, for
1011 // rapid random access
1021 sprintf(buf
, "%s.dat", data_filename
);
1023 if (! (data_filename
&& (file
= fopen(buf
, "r"))))
1025 sprintf(error_buf
, "Poetry data file %s not found\n", buf
);
1026 PoetryError(error_buf
);
1033 poem_index
[nitems
] = 0;
1046 poem_index
[nitems
] = data
;
1053 sprintf(buf
, "%s.idx", index_filename
);
1054 if (! (data_filename
&& (file
= fopen(buf
, "w"))))
1056 sprintf(error_buf
, "Poetry index file %s cannot be created\n", buf
);
1057 PoetryError(error_buf
);
1061 fprintf(file
, "%ld\n\n", nitems
);
1062 for (j
= 0; j
< nitems
; j
++)
1063 fprintf(file
, "%ld\n", poem_index
[j
]);
1066 PoetryNotify("Poetry index compiled.");
1070 void PopupFunction(wxMenu
& /*menu*/, wxCommandEvent
& event
)
1072 switch (event
.GetId())
1075 // Another poem/page
1076 TheMainWindow
->NextPage();
1080 TheMainWindow
->PreviousPage();
1083 // Search - with dialog
1084 TheMainWindow
->Search(TRUE
);
1086 case POEM_NEXT_MATCH
:
1087 // Search - without dialog (next match)
1088 TheMainWindow
->Search(FALSE
);
1091 TheMainWindow
->Iconize(TRUE
);
1095 // Copy current poem to the clipboard
1096 CopyToClipboard((HWND
) TheMainWindow
->GetHWND(), poem_buffer
);
1103 case POEM_BIGGER_TEXT
:
1107 TheMainWindow
->Resize();
1110 case POEM_SMALLER_TEXT
:
1116 TheMainWindow
->Resize();
1120 case POEM_HELP_CONTENTS
:
1122 HelpController
->LoadFile("wxpoem");
1123 HelpController
->DisplayContents();
1128 (void)wxMessageBox("wxPoem Version 1.1\nJulian Smart (c) 1995",
1129 "About wxPoem", wxOK
, TheMainWindow
);
1134 TheMainWindow
->Close(TRUE
);