]>
git.saurik.com Git - wxWidgets.git/blob - demos/poem/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
12 // Copyright: (c) 1998 Julian Smart
13 // Licence: wxWindows licence
14 /////////////////////////////////////////////////////////////////////////////
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
29 #include "corner1.xpm"
30 #include "corner2.xpm"
31 #include "corner3.xpm"
32 #include "corner4.xpm"
35 #define BUFFER_SIZE 10000
36 #define DEFAULT_POETRY_DAT "wxpoem"
37 #define DEFAULT_POETRY_IND "wxpoem"
38 #define DEFAULT_CHAR_HEIGHT 18
39 #define DEFAULT_FONT "Swiss"
40 #define DEFAULT_X_POS 0
41 #define DEFAULT_Y_POS 0
42 #define BORDER_SIZE 30
43 #define THIN_LINE_BORDER 10
44 #define THICK_LINE_BORDER 16
45 #define THICK_LINE_WIDTH 2
46 #define SHADOW_OFFSET 1
50 static wxChar
*poem_buffer
; // Storage for each poem
51 static wxChar line
[150]; // Storage for a line
52 static int pages
[30]; // For multipage poems -
53 // store the start of each page
54 static long last_poem_start
= 0; // Start of last found poem
55 static long last_find
= -1; // Point in file of last found
57 static bool search_ok
= false; // Search was successful
58 static bool same_search
= false; // Searching on same string
60 static long poem_index
[600]; // Index of poem starts
61 static long nitems
= 0; // Number of poems
62 static int char_height
= DEFAULT_CHAR_HEIGHT
; // Actual height
63 static int index_ptr
= -1; // Pointer into index
64 static int poem_height
, poem_width
; // Size of poem
65 static int XPos
; // Startup X position
66 static int YPos
; // Startup Y position
67 static int pointSize
= 12; // Font size
69 static const wxChar
*index_filename
= NULL
; // Index filename
70 static const wxChar
*data_filename
= NULL
; // Data filename
71 static wxChar error_buf
[300]; // Error message buffer
72 static bool loaded_ok
= false; // Poem loaded ok
73 static bool index_ok
= false; // Index loaded ok
75 static bool paging
= false; // Are we paging?
76 static int current_page
= 0; // Currently viewed page
79 wxBitmap
*backingBitmap
= NULL
;
81 void PoetryError(const wxChar
*, const wxChar
*caption
=wxT("wxPoem Error"));
82 void PoetryNotify(const wxChar
*Msg
, const wxChar
*caption
=wxT("wxPoem"));
84 bool LoadPoem(const wxChar
*, long);
86 int LoadIndex(const wxChar
*);
88 void FindMax(int *max_thing
, int thing
);
91 #include "wx/dataobj.h"
92 #include "wx/clipbrd.h"
96 STDAPI_(__int64
) CeGetRandomSeed();
101 MainWindow
*TheMainWindow
= NULL
;
104 void MainWindow::CreateFonts()
106 m_normalFont
= wxTheFontList
->FindOrCreateFont(pointSize
, wxSWISS
, wxNORMAL
, wxNORMAL
);
107 m_boldFont
= wxTheFontList
->FindOrCreateFont(pointSize
, wxSWISS
, wxNORMAL
, wxBOLD
);
108 m_italicFont
= wxTheFontList
->FindOrCreateFont(pointSize
, wxSWISS
, wxITALIC
, wxNORMAL
);
111 BEGIN_EVENT_TABLE(MainWindow
, wxFrame
)
112 EVT_CLOSE(MainWindow::OnCloseWindow
)
113 EVT_CHAR(MainWindow::OnChar
)
114 EVT_MENU(wxID_ANY
, MainWindow::OnPopup
)
117 MainWindow::MainWindow(wxFrame
*frame
, wxWindowID id
, const wxString
& title
,
118 const wxPoint
& pos
, const wxSize
& size
, long style
):
119 wxFrame(frame
, id
, title
, pos
, size
, style
)
121 m_corners
[0] = m_corners
[1] = m_corners
[2] = m_corners
[3] = NULL
;
128 m_corners
[0] = new wxIcon( corner1_xpm
);
129 m_corners
[1] = new wxIcon( corner2_xpm
);
130 m_corners
[2] = new wxIcon( corner3_xpm
);
131 m_corners
[3] = new wxIcon( corner4_xpm
);
134 MainWindow::~MainWindow()
136 for (int i
=0;i
<4;i
++)
145 // Read the poetry buffer, either for finding the size
146 // or for writing to a bitmap (not to the window directly,
147 // since that displays messily)
148 // If DrawIt is true, we draw, otherwise we just determine the
149 // size the window should be.
150 void MainWindow::ScanBuffer(wxDC
*dc
, bool DrawIt
, int *max_x
, int *max_y
)
152 int i
= pages
[current_page
];
158 bool page_break
= false;
165 y
= (*max_y
- poem_height
)/2;
170 if (DrawIt
&& wxColourDisplay())
172 dc
->SetBrush(*wxLIGHT_GREY_BRUSH
);
173 dc
->SetPen(*wxGREY_PEN
);
174 dc
->DrawRectangle(0, 0, width
, height
);
175 dc
->SetBackgroundMode(wxTRANSPARENT
);
178 // See what ACTUAL char height is
180 dc
->SetFont(*m_normalFont
);
183 dc
->GetTextExtent(wxT("X"), &xx
, &yy
);
184 char_height
= (int)yy
;
186 if (current_page
== 0)
188 m_title
= wxEmptyString
;
190 else if (!m_title
.empty())
192 dc
->SetFont(* m_boldFont
);
193 dc
->GetTextExtent(m_title
, &xx
, &yy
);
194 FindMax(&curr_width
, (int)xx
);
198 int x
= (width
- xx
)/2;
199 dc
->SetFont(* m_boldFont
);
201 // Change text to BLACK!
202 dc
->SetTextForeground(* wxBLACK
);
203 dc
->DrawText(m_title
, x
, y
);
204 // Change text to WHITE!
205 dc
->SetTextForeground(* wxWHITE
);
206 dc
->DrawText(m_title
, x
-SHADOW_OFFSET
, y
-SHADOW_OFFSET
);
212 while (ch
!= 0 && !page_break
)
215 #if defined(__WXMSW__) || defined(__WXMAC__)
216 while (((ch
= poem_buffer
[i
]) != 13) && (ch
!= 0))
218 while (((ch
= poem_buffer
[i
]) != 10) && (ch
!= 0))
221 line
[j
] = (wxChar
)ch
;
226 #if defined(__WXMSW__) || defined(__WXMAC__)
234 #if defined(__WXMSW__) || defined(__WXMAC__)
235 // Add another to skip the linefeed
238 // If a single newline on its own, put a space in
260 dc
->SetFont(* m_boldFont
);
264 m_title
<< wxT(" (cont'd)");
266 dc
->GetTextExtent(line_ptr
, &xx
, &yy
);
267 FindMax(&curr_width
, (int)xx
);
271 int x
= (width
- xx
)/2;
272 dc
->SetFont(* m_boldFont
);
274 // Change text to BLACK!
275 dc
->SetTextForeground(* wxBLACK
);
276 dc
->DrawText(line_ptr
, x
, y
);
278 // Change text to WHITE!
279 dc
->SetTextForeground(* wxWHITE
);
280 dc
->DrawText(line_ptr
, x
-SHADOW_OFFSET
, y
-SHADOW_OFFSET
);
281 dc
->SetTextForeground(* wxWHITE
);
287 dc
->SetFont(* m_italicFont
);
289 dc
->GetTextExtent(line_ptr
, &xx
, &yy
);
290 FindMax(&curr_width
, (int)xx
);
294 int x
= (width
- xx
)/2;
295 dc
->SetTextForeground(* wxBLACK
);
296 dc
->DrawText(line_ptr
, x
, y
);
300 // Default: just ignore this line
307 dc
->SetFont(* m_normalFont
);
309 dc
->GetTextExtent(line
, &xx
, &yy
);
310 FindMax(&curr_width
, (int)xx
);
314 int x
= (int)((width
- xx
)/2.0);
315 dc
->SetFont(* m_normalFont
);
316 dc
->SetTextForeground(* wxBLACK
);
317 dc
->DrawText(line
, x
, y
);
327 const wxChar
*cont
= wxT("(cont'd)");
329 dc
->SetFont(* m_normalFont
);
331 dc
->GetTextExtent(cont
, &xx
, &yy
);
332 FindMax(&curr_width
, (int)xx
);
335 int x
= (int)((width
- xx
)/2.0);
336 dc
->SetFont(* m_normalFont
);
337 dc
->SetTextForeground(* wxBLACK
);
338 dc
->DrawText(cont
, x
, y
);
343 *max_x
= (int)curr_width
;
344 *max_y
= (int)(y
-char_height
);
347 pages
[current_page
+1] = i
;
353 // Draw dark grey thick border
354 if (wxColourDisplay())
356 dc
->SetBrush(*wxGREY_BRUSH
);
357 dc
->SetPen(*wxGREY_PEN
);
360 dc
->DrawRectangle(0, 0, THIN_LINE_BORDER
, height
);
362 dc
->DrawRectangle(THIN_LINE_BORDER
, 0, width
-THIN_LINE_BORDER
, THIN_LINE_BORDER
);
364 dc
->DrawRectangle(width
-THIN_LINE_BORDER
, THIN_LINE_BORDER
, width
, height
-THIN_LINE_BORDER
);
366 dc
->DrawRectangle(THIN_LINE_BORDER
, height
-THIN_LINE_BORDER
, width
-THIN_LINE_BORDER
, height
);
369 // Have grey background, plus 3-d border -
370 // One black rectangle.
371 // Inside this, left and top sides - dark grey. Bottom and right -
374 // Change pen to black
375 dc
->SetPen(*wxBLACK_PEN
);
376 dc
->DrawLine(THIN_LINE_BORDER
, THIN_LINE_BORDER
, width
-THIN_LINE_BORDER
, THIN_LINE_BORDER
);
377 dc
->DrawLine(width
-THIN_LINE_BORDER
, THIN_LINE_BORDER
, width
-THIN_LINE_BORDER
, height
-THIN_LINE_BORDER
);
378 dc
->DrawLine(width
-THIN_LINE_BORDER
, height
-THIN_LINE_BORDER
, THIN_LINE_BORDER
, height
-THIN_LINE_BORDER
);
379 dc
->DrawLine(THIN_LINE_BORDER
, height
-THIN_LINE_BORDER
, THIN_LINE_BORDER
, THIN_LINE_BORDER
);
381 // Right and bottom white lines - 'grey' (black!) if
382 // we're running on a mono display.
383 if (wxColourDisplay())
384 dc
->SetPen(*wxWHITE_PEN
);
386 dc
->SetPen(*wxBLACK_PEN
);
388 dc
->DrawLine(width
-THICK_LINE_BORDER
, THICK_LINE_BORDER
,
389 width
-THICK_LINE_BORDER
, height
-THICK_LINE_BORDER
);
390 dc
->DrawLine(width
-THICK_LINE_BORDER
, height
-THICK_LINE_BORDER
,
391 THICK_LINE_BORDER
, height
-THICK_LINE_BORDER
);
393 // Left and top grey lines
394 dc
->SetPen(*wxBLACK_PEN
);
395 dc
->DrawLine(THICK_LINE_BORDER
, height
-THICK_LINE_BORDER
,
396 THICK_LINE_BORDER
, THICK_LINE_BORDER
);
397 dc
->DrawLine(THICK_LINE_BORDER
, THICK_LINE_BORDER
,
398 width
-THICK_LINE_BORDER
, THICK_LINE_BORDER
);
401 dc
->DrawIcon(* m_corners
[0], 0, 0);
402 dc
->DrawIcon(* m_corners
[1], int(width
-32), 0);
404 int y2
= height
- 32;
406 dc
->DrawIcon(* m_corners
[2], 0, y2
);
407 dc
->DrawIcon(* m_corners
[3], x2
, y2
);
411 // Get an index (randomly generated) and load the poem
412 void MainWindow::GetIndexLoadPoem(void)
415 index_ptr
= GetIndex();
418 loaded_ok
= LoadPoem(data_filename
, -1);
421 // Find the size of the poem and resize the window accordingly
422 void MainWindow::Resize(void)
424 wxClientDC
dc(canvas
);
427 ScanBuffer(& dc
, false, &poem_width
, &poem_height
);
428 int x
= poem_width
+ (2*BORDER_SIZE
);
429 int y
= poem_height
+ (2*BORDER_SIZE
);
433 // In case client size isn't what we set it to...
435 GetClientSize(&xx
, &yy
);
438 if (backingBitmap
) delete backingBitmap
;
439 backingBitmap
= new wxBitmap(x
, yy
);
440 memDC
.SelectObject(* backingBitmap
);
443 ScanBuffer(&memDC
, true, &xx
, &yy
);
447 void FindMax(int *max_thing
, int thing
)
449 if (thing
> *max_thing
)
454 void MainWindow::NextPage(void)
467 void MainWindow::PreviousPage(void)
469 if (current_page
> 0)
476 // Search for a string
477 void MainWindow::Search(bool ask
)
481 if (ask
|| m_searchString
.empty())
483 wxString s
= wxGetTextFromUser( wxT("Enter search string"), wxT("Search"), m_searchString
);
501 if (!m_searchString
.empty() && search_ok
)
503 position
= DoSearch();
506 loaded_ok
= LoadPoem(data_filename
, position
);
512 PoetryNotify(wxT("Search string not found."));
519 poem_buffer
= new wxChar
[BUFFER_SIZE
];
521 // Seed the random number generator
523 srand((unsigned) CeGetRandomSeed());
527 (void)time(¤t_time
);
528 srand((unsigned int)current_time
);
534 TheMainWindow
= new MainWindow(NULL
,
539 wxCAPTION
|wxMINIMIZE_BOX
|wxSYSTEM_MENU
|wxCLOSE_BOX
|wxFULL_REPAINT_ON_RESIZE
542 TheMainWindow
->canvas
= new MyCanvas(TheMainWindow
);
546 index_filename
= wxStrcpy(new wxChar
[wxStrlen(argv
[1]) + 1], argv
[1]);
547 data_filename
= wxStrcpy(new wxChar
[wxStrlen(argv
[1]) + 1], argv
[1]);
551 index_filename
= wxT(DEFAULT_POETRY_IND
);
552 data_filename
= wxT(DEFAULT_POETRY_DAT
);
556 TheMainWindow
->GetIndexLoadPoem();
557 TheMainWindow
->Resize();
558 TheMainWindow
->Show(true);
566 delete backingBitmap
;
568 delete[] poem_buffer
;
573 void MainWindow::OnCloseWindow(wxCloseEvent
& WXUNUSED(event
))
579 void MainWindow::OnChar(wxKeyEvent
& event
)
581 canvas
->OnChar(event
);
584 BEGIN_EVENT_TABLE(MyCanvas
, wxWindow
)
585 EVT_MOUSE_EVENTS(MyCanvas::OnMouseEvent
)
586 EVT_CHAR(MyCanvas::OnChar
)
587 EVT_PAINT(MyCanvas::OnPaint
)
590 // Define a constructor for my canvas
591 MyCanvas::MyCanvas(wxFrame
*frame
):
592 wxWindow(frame
, wxID_ANY
)
594 m_popupMenu
= new wxMenu
;
595 m_popupMenu
->Append(POEM_NEXT
, wxT("Next poem/page"));
596 m_popupMenu
->Append(POEM_PREVIOUS
, wxT("Previous page"));
597 m_popupMenu
->AppendSeparator();
598 m_popupMenu
->Append(POEM_SEARCH
, wxT("Search"));
599 m_popupMenu
->Append(POEM_NEXT_MATCH
, wxT("Next match"));
600 m_popupMenu
->Append(POEM_COPY
, wxT("Copy to clipboard"));
601 m_popupMenu
->Append(POEM_MINIMIZE
, wxT("Minimize"));
602 m_popupMenu
->AppendSeparator();
603 m_popupMenu
->Append(POEM_BIGGER_TEXT
, wxT("Bigger text"));
604 m_popupMenu
->Append(POEM_SMALLER_TEXT
, wxT("Smaller text"));
605 m_popupMenu
->AppendSeparator();
606 m_popupMenu
->Append(POEM_ABOUT
, wxT("About wxPoem"));
607 m_popupMenu
->AppendSeparator();
608 m_popupMenu
->Append(POEM_EXIT
, wxT("Exit"));
611 MyCanvas::~MyCanvas()
613 // Note: this must be done before the main window/canvas are destroyed
614 // or we get an error (no parent window for menu item button)
619 // Define the repainting behaviour
620 void MyCanvas::OnPaint(wxPaintEvent
& WXUNUSED(event
))
627 TheMainWindow
->GetClientSize(&xx
, &yy
);
629 dc
.DrawBitmap(* backingBitmap
, 0, 0);
632 memDC
.SelectObject(* backingBitmap
);
633 dc
.Blit(0, 0, backingBitmap
->GetWidth(), backingBitmap
->GetHeight(), &memDC
, 0, 0);
638 void MyCanvas::OnMouseEvent(wxMouseEvent
& event
)
640 static int startPosX
, startPosY
, startFrameX
, startFrameY
;
643 event
.GetPosition(&x
, &y
);
645 if (event
.RightDown())
647 // Versions from wxWin 1.67 are probably OK
648 PopupMenu(m_popupMenu
, (int)x
, (int)y
);
650 else if (event
.LeftDown())
652 this->CaptureMouse();
655 ClientToScreen(&x1
, &y1
);
658 GetParent()->GetPosition(&startFrameX
, &startFrameY
);
660 else if (event
.LeftUp())
662 if (GetCapture() == this) this->ReleaseMouse();
664 else if (event
.Dragging() && event
.LeftIsDown())
668 ClientToScreen(&x1
, &y1
);
670 int dX
= x1
- startPosX
;
671 int dY
= y1
- startPosY
;
672 GetParent()->Move(startFrameX
+ dX
, startFrameY
+ dY
);
676 // Process characters
677 void MyCanvas::OnChar(wxKeyEvent
& event
)
679 switch (event
.GetKeyCode())
684 TheMainWindow
->Search(false);
690 TheMainWindow
->Search(true);
697 TheMainWindow
->NextPage();
701 TheMainWindow
->Close(true);
708 int LoadIndex(const wxChar
*file_name
)
715 if (file_name
== NULL
)
718 wxSprintf(buf
, wxT("%s.idx"), file_name
);
720 index_file
= wxFopen(buf
, wxT("r"));
721 if (index_file
== NULL
)
724 wxFscanf(index_file
, wxT("%ld"), &nitems
);
726 for (int i
= 0; i
< nitems
; i
++)
728 wxFscanf(index_file
, wxT("%ld"), &data
);
729 poem_index
[i
] = data
;
740 int indexn
= (int)(rand() % nitems
);
742 if ((indexn
< 0) || (indexn
> nitems
))
743 { PoetryError(wxT("No such poem!"));
751 void MainWindow::ReadPreferences()
753 /* TODO: convert this code to use wxConfig
755 wxGetResource(wxT("wxPoem"), wxT("FontSize"), &pointSize);
756 wxGetResource(wxT("wxPoem"), wxT("X"), &XPos);
757 wxGetResource(wxT("wxPoem"), wxT("Y"), &YPos);
762 // Write preferences to disk
763 void MainWindow::WritePreferences()
766 TheMainWindow
->GetPosition(&XPos
, &YPos
);
767 /* TODO: convert this code to use wxConfig
769 wxWriteResource(wxT("wxPoem"), wxT("FontSize"), pointSize);
770 wxWriteResource(wxT("wxPoem"), wxT("X"), XPos);
771 wxWriteResource(wxT("wxPoem"), wxT("Y"), YPos);
777 // Load a poem from given file, at given point in file.
778 // If position is > -1, use this for the position in the
779 // file, otherwise use index[index_ptr] to find the correct position.
780 bool LoadPoem(const wxChar
*file_name
, long position
)
791 if (file_name
== NULL
)
793 wxSprintf(error_buf
, wxT("Error in Poem loading."));
794 PoetryError(error_buf
);
798 wxSprintf(buf
, wxT("%s.dat"), file_name
);
799 data_file
= wxFopen(buf
, wxT("r"));
801 if (data_file
== NULL
)
803 wxSprintf(error_buf
, wxT("Data file %s not found."), buf
);
804 PoetryError(error_buf
);
811 data
= poem_index
[index_ptr
];
813 fseek(data_file
, data
, SEEK_SET
);
817 while ((ch
!= EOF
) && (ch
!= '#'))
819 ch
= getc(data_file
);
820 // Add a linefeed so it will copy to the clipboard ok
827 poem_buffer
[i
] = (wxChar
)ch
;
830 if (i
== BUFFER_SIZE
)
832 wxSprintf(error_buf
, wxT("%s"), wxT("Poetry buffer exceeded."));
833 PoetryError(error_buf
);
838 poem_buffer
[i
-1] = 0;
843 long MainWindow::DoSearch(void)
845 if (m_searchString
.empty())
853 long previous_poem_start
;
856 size_t search_length
= m_searchString
.length();
860 find_start
= last_find
+ 1;
861 previous_poem_start
= last_poem_start
;
867 previous_poem_start
= -1;
871 wxSprintf(buf
, wxT("%s.dat"), data_filename
);
873 file
= wxFopen(buf
, wxT("r"));
874 if (! (data_filename
&& file
))
876 wxSprintf(error_buf
, wxT("Poetry data file %s not found\n"), buf
);
877 PoetryError(error_buf
);
881 fseek(file
, find_start
, SEEK_SET
);
883 while ((ch
!= EOF
) && !found
)
886 ch
= wxTolower(ch
); // Make lower case
888 // Only match if we're looking at a different poem
889 // (no point in displaying the same poem again)
890 if ((m_searchString
[i
] == ch
) && (last_poem_start
!= previous_poem_start
))
893 last_find
= ftell(file
);
894 if (i
== search_length
-1)
906 last_poem_start
= ftell(file
);
917 return last_poem_start
;
923 // Set up poetry filenames, preferences, load the index
924 // Load index (or compile it if none found)
927 index_ok
= (LoadIndex(index_filename
) != 0);
928 if (!index_ok
|| (nitems
== 0))
930 PoetryError(wxT("Index file not found; will compile new one"), wxT("wxPoem"));
931 index_ok
= Compile();
936 void PoetryError(const wxChar
*msg
, const wxChar
*caption
)
938 wxMessageBox(msg
, caption
, wxOK
|wxICON_EXCLAMATION
);
941 // Notification (change icon to something appropriate!)
942 void PoetryNotify(const wxChar
*Msg
, const wxChar
*caption
)
944 wxMessageBox(Msg
, caption
, wxOK
| wxICON_INFORMATION
);
947 // Build up and save an index into the poetry data file, for
948 // rapid random access
957 wxSprintf(buf
, wxT("%s.dat"), data_filename
);
959 file
= wxFopen(buf
, wxT("r"));
960 if (! (data_filename
&& file
))
962 wxSprintf(error_buf
, wxT("Poetry data file %s not found\n"), buf
);
963 PoetryError(error_buf
);
970 poem_index
[nitems
] = 0;
982 poem_index
[nitems
] = data
;
989 wxSprintf(buf
, wxT("%s.idx"), index_filename
);
991 file
= wxFopen(buf
, wxT("w"));
992 if (! (data_filename
&& file
))
994 wxSprintf(error_buf
, wxT("Poetry index file %s cannot be created\n"), buf
);
995 PoetryError(error_buf
);
999 wxFprintf(file
, wxT("%ld\n\n"), nitems
);
1000 for (j
= 0; j
< nitems
; j
++)
1001 wxFprintf(file
, wxT("%ld\n"), poem_index
[j
]);
1004 PoetryNotify(wxT("Poetry index compiled."));
1008 void MainWindow::OnPopup(wxCommandEvent
& event
)
1010 switch (event
.GetId())
1013 // Another poem/page
1014 TheMainWindow
->NextPage();
1018 TheMainWindow
->PreviousPage();
1021 // Search - with dialog
1022 TheMainWindow
->Search(true);
1024 case POEM_NEXT_MATCH
:
1025 // Search - without dialog (next match)
1026 TheMainWindow
->Search(false);
1029 TheMainWindow
->Iconize(true);
1033 wxTheClipboard
->UsePrimarySelection();
1034 if (wxTheClipboard
->Open())
1038 s
.Replace( wxT("@P"),wxEmptyString
);
1039 s
.Replace( wxT("@A "),wxEmptyString
);
1040 s
.Replace( wxT("@A"),wxEmptyString
);
1041 s
.Replace( wxT("@T "),wxEmptyString
);
1042 s
.Replace( wxT("@T"),wxEmptyString
);
1043 wxTextDataObject
*data
= new wxTextDataObject( s
.c_str() );
1044 if (!wxTheClipboard
->SetData( data
))
1045 wxMessageBox(wxT("Error while copying to the clipboard."));
1049 wxMessageBox(wxT("Error opening the clipboard."));
1051 wxTheClipboard
->Close();
1054 case POEM_BIGGER_TEXT
:
1057 TheMainWindow
->Resize();
1059 case POEM_SMALLER_TEXT
:
1064 TheMainWindow
->Resize();
1068 (void)wxMessageBox(wxT("wxPoem Version 1.1\nJulian Smart (c) 1995"),
1069 wxT("About wxPoem"), wxOK
, TheMainWindow
);
1073 TheMainWindow
->Close(true);