]>
git.saurik.com Git - wxWidgets.git/blob - demos/poem/wxpoem.cpp
f4a749d17cfd3a854c732bd8e30e9814d8cc4e7f
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"
34 #include "corner1.xpm"
35 #include "corner2.xpm"
36 #include "corner3.xpm"
37 #include "corner4.xpm"
40 #define buf_size 10000
41 #define DEFAULT_POETRY_DAT "wxpoem"
42 #define DEFAULT_POETRY_IND "wxpoem"
43 #define DEFAULT_CHAR_HEIGHT 18
44 #define DEFAULT_FONT "Swiss"
45 #define DEFAULT_X_POS 0
46 #define DEFAULT_Y_POS 0
47 #define BORDER_SIZE 30
48 #define THIN_LINE_BORDER 10
49 #define THICK_LINE_BORDER 16
50 #define THICK_LINE_WIDTH 2
51 #define SHADOW_OFFSET 1
55 static wxChar
*poem_buffer
; // Storage for each poem
56 static wxChar line
[150]; // Storage for a line
57 static int pages
[30]; // For multipage poems -
58 // store the start of each page
59 static long last_poem_start
= 0; // Start of last found poem
60 static long last_find
= -1; // Point in file of last found
62 static bool search_ok
= false; // Search was successful
63 static bool same_search
= false; // Searching on same string
65 static long poem_index
[600]; // Index of poem starts
66 static long nitems
= 0; // Number of poems
67 static int char_height
= DEFAULT_CHAR_HEIGHT
; // Actual height
68 static int index_ptr
= -1; // Pointer into index
69 static int poem_height
, poem_width
; // Size of poem
70 static int XPos
; // Startup X position
71 static int YPos
; // Startup Y position
72 static int pointSize
= 12; // Font size
74 static wxChar
*index_filename
= NULL
; // Index filename
75 static wxChar
*data_filename
= NULL
; // Data filename
76 static wxChar error_buf
[300]; // Error message buffer
77 static bool loaded_ok
= false; // Poem loaded ok
78 static bool index_ok
= false; // Index loaded ok
80 static bool paging
= false; // Are we paging?
81 static int current_page
= 0; // Currently viewed page
84 wxBitmap
*backingBitmap
= NULL
;
86 void PoetryError(wxChar
*, wxChar
*caption
=_T("wxPoem Error"));
87 void PoetryNotify(wxChar
*Msg
, wxChar
*caption
=_T("wxPoem"));
89 bool LoadPoem(wxChar
*, long);
91 int LoadIndex(wxChar
*);
93 void FindMax(int *max_thing
, int thing
);
96 #include "wx/dataobj.h"
97 #include "wx/clipbrd.h"
101 STDAPI_(__int64
) CeGetRandomSeed();
106 MainWindow
*TheMainWindow
= NULL
;
109 void MainWindow::CreateFonts()
111 m_normalFont
= wxTheFontList
->FindOrCreateFont(pointSize
, wxSWISS
, wxNORMAL
, wxNORMAL
);
112 m_boldFont
= wxTheFontList
->FindOrCreateFont(pointSize
, wxSWISS
, wxNORMAL
, wxBOLD
);
113 m_italicFont
= wxTheFontList
->FindOrCreateFont(pointSize
, wxSWISS
, wxITALIC
, wxNORMAL
);
116 BEGIN_EVENT_TABLE(MainWindow
, wxFrame
)
117 EVT_CLOSE(MainWindow::OnCloseWindow
)
118 EVT_CHAR(MainWindow::OnChar
)
119 EVT_MENU(wxID_ANY
, MainWindow::OnPopup
)
122 MainWindow::MainWindow(wxFrame
*frame
, wxWindowID id
, const wxString
& title
,
123 const wxPoint
& pos
, const wxSize
& size
, long style
):
124 wxFrame(frame
, id
, title
, pos
, size
, style
)
126 m_corners
[0] = m_corners
[1] = m_corners
[2] = m_corners
[3] = NULL
;
133 m_corners
[0] = new wxIcon( corner1_xpm
);
134 m_corners
[1] = new wxIcon( corner2_xpm
);
135 m_corners
[2] = new wxIcon( corner3_xpm
);
136 m_corners
[3] = new wxIcon( corner4_xpm
);
139 MainWindow::~MainWindow()
141 for (int i
=0;i
<4;i
++)
150 // Read the poetry buffer, either for finding the size
151 // or for writing to a bitmap (not to the window directly,
152 // since that displays messily)
153 // If DrawIt is true, we draw, otherwise we just determine the
154 // size the window should be.
155 void MainWindow::ScanBuffer(wxDC
*dc
, bool DrawIt
, int *max_x
, int *max_y
)
157 int i
= pages
[current_page
];
163 bool page_break
= false;
170 y
= (*max_y
- poem_height
)/2;
175 if (DrawIt
&& wxColourDisplay())
177 dc
->SetBrush(*wxLIGHT_GREY_BRUSH
);
178 dc
->SetPen(*wxGREY_PEN
);
179 dc
->DrawRectangle(0, 0, width
, height
);
180 dc
->SetBackgroundMode(wxTRANSPARENT
);
183 // See what ACTUAL char height is
185 dc
->SetFont(*m_normalFont
);
188 dc
->GetTextExtent(_T("X"), &xx
, &yy
);
189 char_height
= (int)yy
;
191 if (current_page
== 0)
193 m_title
= wxEmptyString
;
195 else if (!m_title
.empty())
197 dc
->SetFont(* m_boldFont
);
198 dc
->GetTextExtent(m_title
, &xx
, &yy
);
199 FindMax(&curr_width
, (int)xx
);
203 int x
= (width
- xx
)/2;
204 dc
->SetFont(* m_boldFont
);
206 // Change text to BLACK!
207 dc
->SetTextForeground(* wxBLACK
);
208 dc
->DrawText(m_title
, x
, y
);
209 // Change text to WHITE!
210 dc
->SetTextForeground(* wxWHITE
);
211 dc
->DrawText(m_title
, x
-SHADOW_OFFSET
, y
-SHADOW_OFFSET
);
217 while (ch
!= 0 && !page_break
)
220 #if defined(__WXMSW__) || defined(__WXMAC__)
221 while (((ch
= poem_buffer
[i
]) != 13) && (ch
!= 0))
223 while (((ch
= poem_buffer
[i
]) != 10) && (ch
!= 0))
226 line
[j
] = (wxChar
)ch
;
231 #if defined(__WXMSW__) || defined(__WXMAC__)
239 #if defined(__WXMSW__) || defined(__WXMAC__)
240 // Add another to skip the linefeed
243 // If a single newline on its own, put a space in
265 dc
->SetFont(* m_boldFont
);
269 m_title
<< _T(" (cont'd)");
271 dc
->GetTextExtent(line_ptr
, &xx
, &yy
);
272 FindMax(&curr_width
, (int)xx
);
276 int x
= (width
- xx
)/2;
277 dc
->SetFont(* m_boldFont
);
279 // Change text to BLACK!
280 dc
->SetTextForeground(* wxBLACK
);
281 dc
->DrawText(line_ptr
, x
, y
);
283 // Change text to WHITE!
284 dc
->SetTextForeground(* wxWHITE
);
285 dc
->DrawText(line_ptr
, x
-SHADOW_OFFSET
, y
-SHADOW_OFFSET
);
286 dc
->SetTextForeground(* wxWHITE
);
292 dc
->SetFont(* m_italicFont
);
294 dc
->GetTextExtent(line_ptr
, &xx
, &yy
);
295 FindMax(&curr_width
, (int)xx
);
299 int x
= (width
- xx
)/2;
300 dc
->SetTextForeground(* wxBLACK
);
301 dc
->DrawText(line_ptr
, x
, y
);
305 // Default: just ignore this line
312 dc
->SetFont(* m_normalFont
);
314 dc
->GetTextExtent(line
, &xx
, &yy
);
315 FindMax(&curr_width
, (int)xx
);
319 int x
= (int)((width
- xx
)/2.0);
320 dc
->SetFont(* m_normalFont
);
321 dc
->SetTextForeground(* wxBLACK
);
322 dc
->DrawText(line
, x
, y
);
332 wxChar
*cont
= _T("(cont'd)");
334 dc
->SetFont(* m_normalFont
);
336 dc
->GetTextExtent(cont
, &xx
, &yy
);
337 FindMax(&curr_width
, (int)xx
);
340 int x
= (int)((width
- xx
)/2.0);
341 dc
->SetFont(* m_normalFont
);
342 dc
->SetTextForeground(* wxBLACK
);
343 dc
->DrawText(cont
, x
, y
);
348 *max_x
= (int)curr_width
;
349 *max_y
= (int)(y
-char_height
);
352 pages
[current_page
+1] = i
;
358 // Draw dark grey thick border
359 if (wxColourDisplay())
361 dc
->SetBrush(*wxGREY_BRUSH
);
362 dc
->SetPen(*wxGREY_PEN
);
365 dc
->DrawRectangle(0, 0, THIN_LINE_BORDER
, height
);
367 dc
->DrawRectangle(THIN_LINE_BORDER
, 0, width
-THIN_LINE_BORDER
, THIN_LINE_BORDER
);
369 dc
->DrawRectangle(width
-THIN_LINE_BORDER
, THIN_LINE_BORDER
, width
, height
-THIN_LINE_BORDER
);
371 dc
->DrawRectangle(THIN_LINE_BORDER
, height
-THIN_LINE_BORDER
, width
-THIN_LINE_BORDER
, height
);
374 // Have grey background, plus 3-d border -
375 // One black rectangle.
376 // Inside this, left and top sides - dark grey. Bottom and right -
379 // Change pen to black
380 dc
->SetPen(*wxBLACK_PEN
);
381 dc
->DrawLine(THIN_LINE_BORDER
, THIN_LINE_BORDER
, width
-THIN_LINE_BORDER
, THIN_LINE_BORDER
);
382 dc
->DrawLine(width
-THIN_LINE_BORDER
, THIN_LINE_BORDER
, width
-THIN_LINE_BORDER
, height
-THIN_LINE_BORDER
);
383 dc
->DrawLine(width
-THIN_LINE_BORDER
, height
-THIN_LINE_BORDER
, THIN_LINE_BORDER
, height
-THIN_LINE_BORDER
);
384 dc
->DrawLine(THIN_LINE_BORDER
, height
-THIN_LINE_BORDER
, THIN_LINE_BORDER
, THIN_LINE_BORDER
);
386 // Right and bottom white lines - 'grey' (black!) if
387 // we're running on a mono display.
388 if (wxColourDisplay())
389 dc
->SetPen(*wxWHITE_PEN
);
391 dc
->SetPen(*wxBLACK_PEN
);
393 dc
->DrawLine(width
-THICK_LINE_BORDER
, THICK_LINE_BORDER
,
394 width
-THICK_LINE_BORDER
, height
-THICK_LINE_BORDER
);
395 dc
->DrawLine(width
-THICK_LINE_BORDER
, height
-THICK_LINE_BORDER
,
396 THICK_LINE_BORDER
, height
-THICK_LINE_BORDER
);
398 // Left and top grey lines
399 dc
->SetPen(*wxBLACK_PEN
);
400 dc
->DrawLine(THICK_LINE_BORDER
, height
-THICK_LINE_BORDER
,
401 THICK_LINE_BORDER
, THICK_LINE_BORDER
);
402 dc
->DrawLine(THICK_LINE_BORDER
, THICK_LINE_BORDER
,
403 width
-THICK_LINE_BORDER
, THICK_LINE_BORDER
);
406 dc
->DrawIcon(* m_corners
[0], 0, 0);
407 dc
->DrawIcon(* m_corners
[1], int(width
-32), 0);
409 int y2
= height
- 32;
411 dc
->DrawIcon(* m_corners
[2], 0, y2
);
412 dc
->DrawIcon(* m_corners
[3], x2
, y2
);
416 // Get an index (randomly generated) and load the poem
417 void MainWindow::GetIndexLoadPoem(void)
420 index_ptr
= GetIndex();
423 loaded_ok
= LoadPoem(data_filename
, -1);
426 // Find the size of the poem and resize the window accordingly
427 void MainWindow::Resize(void)
429 wxClientDC
dc(canvas
);
432 ScanBuffer(& dc
, false, &poem_width
, &poem_height
);
433 int x
= poem_width
+ (2*BORDER_SIZE
);
434 int y
= poem_height
+ (2*BORDER_SIZE
);
438 // In case client size isn't what we set it to...
440 GetClientSize(&xx
, &yy
);
443 if (backingBitmap
) delete backingBitmap
;
444 backingBitmap
= new wxBitmap(x
, yy
);
445 memDC
.SelectObject(* backingBitmap
);
448 ScanBuffer(&memDC
, true, &xx
, &yy
);
452 void FindMax(int *max_thing
, int thing
)
454 if (thing
> *max_thing
)
459 void MainWindow::NextPage(void)
472 void MainWindow::PreviousPage(void)
474 if (current_page
> 0)
481 // Search for a string
482 void MainWindow::Search(bool ask
)
486 if (ask
|| m_searchString
.empty())
488 wxString s
= wxGetTextFromUser( _T("Enter search string"), _T("Search"), m_searchString
);
506 if (!m_searchString
.empty() && search_ok
)
508 position
= DoSearch();
511 loaded_ok
= LoadPoem(data_filename
, position
);
517 PoetryNotify(_T("Search string not found."));
524 poem_buffer
= new wxChar
[buf_size
];
526 // Seed the random number generator
528 srand((unsigned) CeGetRandomSeed());
532 (void)time(¤t_time
);
533 srand((unsigned int)current_time
);
539 TheMainWindow
= new MainWindow(NULL
,
544 wxCAPTION
|wxMINIMIZE_BOX
|wxSYSTEM_MENU
|wxCLOSE_BOX
|wxFULL_REPAINT_ON_RESIZE
547 TheMainWindow
->canvas
= new MyCanvas(TheMainWindow
);
551 index_filename
= wxStrcpy(new wxChar
[wxStrlen(argv
[1]) + 1], argv
[1]);
552 data_filename
= wxStrcpy(new wxChar
[wxStrlen(argv
[1]) + 1], argv
[1]);
556 index_filename
= _T(DEFAULT_POETRY_IND
);
557 data_filename
= _T(DEFAULT_POETRY_DAT
);
561 TheMainWindow
->GetIndexLoadPoem();
562 TheMainWindow
->Resize();
563 TheMainWindow
->Show(true);
571 delete backingBitmap
;
573 delete[] poem_buffer
;
578 void MainWindow::OnCloseWindow(wxCloseEvent
& WXUNUSED(event
))
584 void MainWindow::OnChar(wxKeyEvent
& event
)
586 canvas
->OnChar(event
);
589 BEGIN_EVENT_TABLE(MyCanvas
, wxWindow
)
590 EVT_MOUSE_EVENTS(MyCanvas::OnMouseEvent
)
591 EVT_CHAR(MyCanvas::OnChar
)
592 EVT_PAINT(MyCanvas::OnPaint
)
595 // Define a constructor for my canvas
596 MyCanvas::MyCanvas(wxFrame
*frame
):
597 wxWindow(frame
, wxID_ANY
)
599 m_popupMenu
= new wxMenu
;
600 m_popupMenu
->Append(POEM_NEXT
, _T("Next poem/page"));
601 m_popupMenu
->Append(POEM_PREVIOUS
, _T("Previous page"));
602 m_popupMenu
->AppendSeparator();
603 m_popupMenu
->Append(POEM_SEARCH
, _T("Search"));
604 m_popupMenu
->Append(POEM_NEXT_MATCH
, _T("Next match"));
605 m_popupMenu
->Append(POEM_COPY
, _T("Copy to clipboard"));
606 m_popupMenu
->Append(POEM_MINIMIZE
, _T("Minimize"));
607 m_popupMenu
->AppendSeparator();
608 m_popupMenu
->Append(POEM_BIGGER_TEXT
, _T("Bigger text"));
609 m_popupMenu
->Append(POEM_SMALLER_TEXT
, _T("Smaller text"));
610 m_popupMenu
->AppendSeparator();
611 m_popupMenu
->Append(POEM_ABOUT
, _T("About wxPoem"));
612 m_popupMenu
->AppendSeparator();
613 m_popupMenu
->Append(POEM_EXIT
, _T("Exit"));
616 MyCanvas::~MyCanvas()
618 // Note: this must be done before the main window/canvas are destroyed
619 // or we get an error (no parent window for menu item button)
624 // Define the repainting behaviour
625 void MyCanvas::OnPaint(wxPaintEvent
& WXUNUSED(event
))
632 TheMainWindow
->GetClientSize(&xx
, &yy
);
634 dc
.DrawBitmap(* backingBitmap
, 0, 0);
637 memDC
.SelectObject(* backingBitmap
);
638 dc
.Blit(0, 0, backingBitmap
->GetWidth(), backingBitmap
->GetHeight(), &memDC
, 0, 0);
643 void MyCanvas::OnMouseEvent(wxMouseEvent
& event
)
645 static int startPosX
, startPosY
, startFrameX
, startFrameY
;
648 event
.GetPosition(&x
, &y
);
650 if (event
.RightDown())
652 // Versions from wxWin 1.67 are probably OK
653 PopupMenu(m_popupMenu
, (int)x
, (int)y
);
655 else if (event
.LeftDown())
657 this->CaptureMouse();
660 ClientToScreen(&x1
, &y1
);
663 GetParent()->GetPosition(&startFrameX
, &startFrameY
);
665 else if (event
.LeftUp())
667 if (GetCapture() == this) this->ReleaseMouse();
669 else if (event
.Dragging() && event
.LeftIsDown())
673 ClientToScreen(&x1
, &y1
);
675 int dX
= x1
- startPosX
;
676 int dY
= y1
- startPosY
;
677 GetParent()->Move(startFrameX
+ dX
, startFrameY
+ dY
);
681 // Process characters
682 void MyCanvas::OnChar(wxKeyEvent
& event
)
684 switch (event
.GetKeyCode())
689 TheMainWindow
->Search(false);
695 TheMainWindow
->Search(true);
702 TheMainWindow
->NextPage();
706 TheMainWindow
->Close(true);
713 int LoadIndex(wxChar
*file_name
)
720 if (file_name
== NULL
)
723 wxSprintf(buf
, _T("%s.idx"), file_name
);
725 index_file
= wxFopen(buf
, _T("r"));
726 if (index_file
== NULL
)
729 wxFscanf(index_file
, _T("%ld"), &nitems
);
731 for (int i
= 0; i
< nitems
; i
++)
733 wxFscanf(index_file
, _T("%ld"), &data
);
734 poem_index
[i
] = data
;
745 int indexn
= (int)(rand() % nitems
);
747 if ((indexn
< 0) || (indexn
> nitems
))
748 { PoetryError(_T("No such poem!"));
756 void MainWindow::ReadPreferences()
759 wxGetResource(_T("wxPoem"), _T("FontSize"), &pointSize
);
760 wxGetResource(_T("wxPoem"), _T("X"), &XPos
);
761 wxGetResource(_T("wxPoem"), _T("Y"), &YPos
);
765 // Write preferences to disk
766 void MainWindow::WritePreferences()
769 TheMainWindow
->GetPosition(&XPos
, &YPos
);
771 wxWriteResource(_T("wxPoem"), _T("FontSize"), pointSize
);
772 wxWriteResource(_T("wxPoem"), _T("X"), XPos
);
773 wxWriteResource(_T("wxPoem"), _T("Y"), YPos
);
778 // Load a poem from given file, at given point in file.
779 // If position is > -1, use this for the position in the
780 // file, otherwise use index[index_ptr] to find the correct position.
781 bool LoadPoem(wxChar
*file_name
, long position
)
792 if (file_name
== NULL
)
794 wxSprintf(error_buf
, _T("Error in Poem loading."));
795 PoetryError(error_buf
);
799 wxSprintf(buf
, _T("%s.dat"), file_name
);
800 data_file
= wxFopen(buf
, _T("r"));
802 if (data_file
== NULL
)
804 wxSprintf(error_buf
, _T("Data file %s not found."), buf
);
805 PoetryError(error_buf
);
812 data
= poem_index
[index_ptr
];
814 fseek(data_file
, data
, SEEK_SET
);
818 while ((ch
!= EOF
) && (ch
!= '#'))
820 ch
= getc(data_file
);
821 // Add a linefeed so it will copy to the clipboard ok
828 poem_buffer
[i
] = (wxChar
)ch
;
833 wxSprintf(error_buf
, _T("%s"), _T("Poetry buffer exceeded."));
834 PoetryError(error_buf
);
839 poem_buffer
[i
-1] = 0;
844 long MainWindow::DoSearch(void)
846 if (m_searchString
.empty())
854 long previous_poem_start
;
857 size_t search_length
= m_searchString
.length();
861 find_start
= last_find
+ 1;
862 previous_poem_start
= last_poem_start
;
868 previous_poem_start
= -1;
872 wxSprintf(buf
, _T("%s.dat"), data_filename
);
874 file
= wxFopen(buf
, _T("r"));
875 if (! (data_filename
&& file
))
877 wxSprintf(error_buf
, _T("Poetry data file %s not found\n"), buf
);
878 PoetryError(error_buf
);
882 fseek(file
, find_start
, SEEK_SET
);
884 while ((ch
!= EOF
) && !found
)
887 ch
= wxTolower(ch
); // Make lower case
889 // Only match if we're looking at a different poem
890 // (no point in displaying the same poem again)
891 if ((ch
== m_searchString
[i
]) && (last_poem_start
!= previous_poem_start
))
894 last_find
= ftell(file
);
895 if (i
== search_length
-1)
907 last_poem_start
= ftell(file
);
918 return last_poem_start
;
924 // Set up poetry filenames, preferences, load the index
925 // Load index (or compile it if none found)
928 index_ok
= (LoadIndex(index_filename
) != 0);
929 if (!index_ok
|| (nitems
== 0))
931 PoetryError(_T("Index file not found; will compile new one"), _T("wxPoem"));
932 index_ok
= Compile();
937 void PoetryError(wxChar
*msg
, wxChar
*caption
)
939 wxMessageBox(msg
, caption
, wxOK
|wxICON_EXCLAMATION
);
942 // Notification (change icon to something appropriate!)
943 void PoetryNotify(wxChar
*Msg
, wxChar
*caption
)
945 wxMessageBox(Msg
, caption
, wxOK
| wxICON_INFORMATION
);
948 // Build up and save an index into the poetry data file, for
949 // rapid random access
958 wxSprintf(buf
, _T("%s.dat"), data_filename
);
960 file
= wxFopen(buf
, _T("r"));
961 if (! (data_filename
&& file
))
963 wxSprintf(error_buf
, _T("Poetry data file %s not found\n"), buf
);
964 PoetryError(error_buf
);
971 poem_index
[nitems
] = 0;
983 poem_index
[nitems
] = data
;
990 wxSprintf(buf
, _T("%s.idx"), index_filename
);
992 file
= wxFopen(buf
, _T("w"));
993 if (! (data_filename
&& file
))
995 wxSprintf(error_buf
, _T("Poetry index file %s cannot be created\n"), buf
);
996 PoetryError(error_buf
);
1000 wxFprintf(file
, _T("%ld\n\n"), nitems
);
1001 for (j
= 0; j
< nitems
; j
++)
1002 wxFprintf(file
, _T("%ld\n"), poem_index
[j
]);
1005 PoetryNotify(_T("Poetry index compiled."));
1009 void MainWindow::OnPopup(wxCommandEvent
& event
)
1011 switch (event
.GetId())
1014 // Another poem/page
1015 TheMainWindow
->NextPage();
1019 TheMainWindow
->PreviousPage();
1022 // Search - with dialog
1023 TheMainWindow
->Search(true);
1025 case POEM_NEXT_MATCH
:
1026 // Search - without dialog (next match)
1027 TheMainWindow
->Search(false);
1030 TheMainWindow
->Iconize(true);
1034 wxTheClipboard
->UsePrimarySelection();
1035 if (wxTheClipboard
->Open())
1039 s
.Replace( _T("@P"),wxEmptyString
);
1040 s
.Replace( _T("@A "),wxEmptyString
);
1041 s
.Replace( _T("@A"),wxEmptyString
);
1042 s
.Replace( _T("@T "),wxEmptyString
);
1043 s
.Replace( _T("@T"),wxEmptyString
);
1044 wxTextDataObject
*data
= new wxTextDataObject( s
.c_str() );
1045 if (!wxTheClipboard
->SetData( data
))
1046 wxMessageBox(_T("Error while copying to the clipboard."));
1050 wxMessageBox(_T("Error opening the clipboard."));
1052 wxTheClipboard
->Close();
1055 case POEM_BIGGER_TEXT
:
1058 TheMainWindow
->Resize();
1060 case POEM_SMALLER_TEXT
:
1065 TheMainWindow
->Resize();
1069 (void)wxMessageBox(_T("wxPoem Version 1.1\nJulian Smart (c) 1995"),
1070 _T("About wxPoem"), wxOK
, TheMainWindow
);
1074 TheMainWindow
->Close(true);