]> git.saurik.com Git - wxWidgets.git/blobdiff - demos/poem/wxpoem.cpp
Include wx/dataobj.h from wx/clipbrd.h.
[wxWidgets.git] / demos / poem / wxpoem.cpp
index 13da0411e9c92d428e75c6aba8da84d8daa77de4..cde146f2e8d4a8b8d2ff066c78df5bba0567a54d 100644 (file)
@@ -33,7 +33,7 @@
 #include "corner4.xpm"
 #include "wxpoem.xpm"
 
-#define         buf_size 10000
+#define         BUFFER_SIZE 10000
 #define         DEFAULT_POETRY_DAT "wxpoem"
 #define         DEFAULT_POETRY_IND "wxpoem"
 #define         DEFAULT_CHAR_HEIGHT 18
@@ -48,7 +48,7 @@
 #define         X_SIZE 30
 #define         Y_SIZE 20
 
-static wxChar   *poem_buffer;          // Storage for each poem
+static wxChar   *poem_buffer;                   // Storage for each poem
 static wxChar   line[150];                      // Storage for a line
 static int      pages[30];                      // For multipage poems -
                                                 // store the start of each page
@@ -67,8 +67,8 @@ static int      XPos;                           // Startup X position
 static int      YPos;                           // Startup Y position
 static int      pointSize = 12;                 // Font size
 
-static wxChar   *index_filename = NULL;            // Index filename
-static wxChar   *data_filename = NULL;             // Data filename
+static const wxChar   *index_filename = NULL;            // Index filename
+static const wxChar   *data_filename = NULL;             // Data filename
 static wxChar   error_buf[300];                 // Error message buffer
 static bool     loaded_ok = false;              // Poem loaded ok
 static bool     index_ok = false;               // Index loaded ok
@@ -79,12 +79,12 @@ static int      current_page = 0;               // Currently viewed page
 // Backing bitmap
 wxBitmap        *backingBitmap = NULL;
 
-void            PoetryError(wxChar *, wxChar *caption=_T("wxPoem Error"));
-void            PoetryNotify(wxChar *Msg, wxChar *caption=_T("wxPoem"));
+void            PoetryError(const wxChar *, const wxChar *caption=_T("wxPoem Error"));
+void            PoetryNotify(const wxChar *Msg, const wxChar *caption=_T("wxPoem"));
 void            TryLoadIndex();
-bool            LoadPoem(wxChar *, long);
+bool            LoadPoem(const wxChar *, long);
 int             GetIndex();
-int             LoadIndex(wxChar *);
+int             LoadIndex(const wxChar *);
 bool            Compile(void);
 void            FindMax(int *max_thing, int thing);
 
@@ -325,7 +325,7 @@ void MainWindow::ScanBuffer(wxDC *dc, bool DrawIt, int *max_x, int *max_y)
     // Write (cont'd)
     if (page_break)
     {
-        wxChar *cont = _T("(cont'd)");
+        const wxChar *cont = _T("(cont'd)");
 
         dc->SetFont(* m_normalFont);
 
@@ -517,7 +517,7 @@ void MainWindow::Search(bool ask)
 
 bool MyApp::OnInit()
 {
-    poem_buffer = new wxChar[buf_size];
+    poem_buffer = new wxChar[BUFFER_SIZE];
 
     // Seed the random number generator
 #ifdef __WXWINCE__
@@ -706,7 +706,7 @@ void MyCanvas::OnChar(wxKeyEvent& event)
 }
 
 // Load index file
-int LoadIndex(wxChar *file_name)
+int LoadIndex(const wxChar *file_name)
 {
     long data;
     FILE *index_file;
@@ -778,7 +778,7 @@ void MainWindow::WritePreferences()
 // Load a poem from given file, at given point in file.
 // If position is > -1, use this for the position in the
 // file, otherwise use index[index_ptr] to find the correct position.
-bool LoadPoem(wxChar *file_name, long position)
+bool LoadPoem(const wxChar *file_name, long position)
 {
 //    int j = 0;
 //    int indexn = 0;
@@ -828,7 +828,7 @@ bool LoadPoem(wxChar *file_name, long position)
         poem_buffer[i] = (wxChar)ch;
         i ++;
 
-        if (i == buf_size)
+        if (i == BUFFER_SIZE)
         {
             wxSprintf(error_buf, _T("%s"), _T("Poetry buffer exceeded."));
             PoetryError(error_buf);
@@ -934,13 +934,13 @@ void TryLoadIndex()
 }
 
 // Error message
-void PoetryError(wxChar *msg, wxChar *caption)
+void PoetryError(const wxChar *msg, const wxChar *caption)
 {
     wxMessageBox(msg, caption, wxOK|wxICON_EXCLAMATION);
 }
 
 // Notification (change icon to something appropriate!)
-void PoetryNotify(wxChar *Msg, wxChar *caption)
+void PoetryNotify(const wxChar *Msg, const wxChar *caption)
 {
     wxMessageBox(Msg, caption, wxOK | wxICON_INFORMATION);
 }