Applied patch [ 796140 ] fixes for building demos/poem in Unicode mode
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23494 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -67,10 +67,10 @@
|
|||||||
#define X_SIZE 30
|
#define X_SIZE 30
|
||||||
#define Y_SIZE 20
|
#define Y_SIZE 20
|
||||||
|
|
||||||
static char *poem_buffer; // Storage for each poem
|
static wxChar *poem_buffer; // Storage for each poem
|
||||||
static char line[150]; // Storage for a line
|
static wxChar line[150]; // Storage for a line
|
||||||
static char title[150]; // Remember the title
|
static wxChar title[150]; // Remember the title
|
||||||
static char *search_string = NULL; // The search string
|
static wxChar *search_string = NULL; // The search string
|
||||||
static int pages[30]; // For multipage poems -
|
static int pages[30]; // For multipage poems -
|
||||||
// store the start of each page
|
// store the start of each page
|
||||||
static long last_poem_start = 0; // Start of last found poem
|
static long last_poem_start = 0; // Start of last found poem
|
||||||
@@ -88,9 +88,9 @@ static int XPos; // Startup X position
|
|||||||
static int YPos; // Startup Y position
|
static int YPos; // Startup Y position
|
||||||
static int pointSize = 12; // Font size
|
static int pointSize = 12; // Font size
|
||||||
|
|
||||||
static char *index_filename = NULL; // Index filename
|
static wxChar *index_filename = NULL; // Index filename
|
||||||
static char *data_filename = NULL; // Data filename
|
static wxChar *data_filename = NULL; // Data filename
|
||||||
static char error_buf[300]; // Error message buffer
|
static wxChar error_buf[300]; // Error message buffer
|
||||||
static bool loaded_ok = FALSE; // Poem loaded ok
|
static bool loaded_ok = FALSE; // Poem loaded ok
|
||||||
static bool index_ok = FALSE; // Index loaded ok
|
static bool index_ok = FALSE; // Index loaded ok
|
||||||
|
|
||||||
@@ -115,19 +115,19 @@ wxPen *WhitePen = NULL;
|
|||||||
// Backing bitmap
|
// Backing bitmap
|
||||||
wxBitmap *backingBitmap = NULL;
|
wxBitmap *backingBitmap = NULL;
|
||||||
|
|
||||||
void PoetryError(char *, char *caption="wxPoem Error");
|
void PoetryError(wxChar *, wxChar *caption=_T("wxPoem Error"));
|
||||||
void PoetryNotify(char *Msg, char *caption="wxPoem");
|
void PoetryNotify(wxChar *Msg, wxChar *caption=_T("wxPoem"));
|
||||||
void TryLoadIndex();
|
void TryLoadIndex();
|
||||||
bool LoadPoem(char *, long);
|
bool LoadPoem(wxChar *, long);
|
||||||
int GetIndex();
|
int GetIndex();
|
||||||
int LoadIndex(char *);
|
int LoadIndex(wxChar *);
|
||||||
bool Compile(void);
|
bool Compile(void);
|
||||||
void WritePreferences();
|
void WritePreferences();
|
||||||
void ReadPreferences();
|
void ReadPreferences();
|
||||||
void FindMax(int *max_thing, int thing);
|
void FindMax(int *max_thing, int thing);
|
||||||
void CreateFonts();
|
void CreateFonts();
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
void CopyToClipboard(HWND, char *);
|
void CopyToClipboard(HWND, wxChar *);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wxMenu *popupMenu = NULL;
|
wxMenu *popupMenu = NULL;
|
||||||
@@ -180,7 +180,7 @@ void MainWindow::ScanBuffer(wxDC *dc, bool DrawIt, int *max_x, int *max_y)
|
|||||||
int x = 10;
|
int x = 10;
|
||||||
int y = 0;
|
int y = 0;
|
||||||
int j;
|
int j;
|
||||||
char *line_ptr;
|
wxChar *line_ptr;
|
||||||
int curr_width = 0;
|
int curr_width = 0;
|
||||||
bool page_break = FALSE;
|
bool page_break = FALSE;
|
||||||
|
|
||||||
@@ -284,8 +284,8 @@ void MainWindow::ScanBuffer(wxDC *dc, bool DrawIt, int *max_x, int *max_y)
|
|||||||
dc->SetFont(* BoldFont);
|
dc->SetFont(* BoldFont);
|
||||||
line_ptr = line+3;
|
line_ptr = line+3;
|
||||||
|
|
||||||
strcpy(title, line_ptr);
|
wxStrcpy(title, line_ptr);
|
||||||
strcat(title, " (cont'd)");
|
wxStrcat(title, _T(" (cont'd)"));
|
||||||
|
|
||||||
dc->GetTextExtent(line_ptr, &xx, &yy);
|
dc->GetTextExtent(line_ptr, &xx, &yy);
|
||||||
FindMax(&curr_width, (int)xx);
|
FindMax(&curr_width, (int)xx);
|
||||||
@@ -348,7 +348,7 @@ void MainWindow::ScanBuffer(wxDC *dc, bool DrawIt, int *max_x, int *max_y)
|
|||||||
// Write (cont'd)
|
// Write (cont'd)
|
||||||
if (page_break)
|
if (page_break)
|
||||||
{
|
{
|
||||||
char *cont = "(cont'd)";
|
wxChar *cont = _T("(cont'd)");
|
||||||
|
|
||||||
dc->SetFont(* NormalFont);
|
dc->SetFont(* NormalFont);
|
||||||
|
|
||||||
@@ -506,8 +506,8 @@ void MainWindow::Search(bool ask)
|
|||||||
|
|
||||||
if (ask || !search_string)
|
if (ask || !search_string)
|
||||||
{
|
{
|
||||||
wxString s = wxGetTextFromUser("Enter search string", "Search", (const char*) search_string);
|
wxString s = wxGetTextFromUser( _T("Enter search string"), _T("Search"), (const wxChar*) search_string);
|
||||||
if (s != "")
|
if (s != wxEmptyString)
|
||||||
{
|
{
|
||||||
if (search_string) delete[] search_string;
|
if (search_string) delete[] search_string;
|
||||||
search_string = copystring(s);
|
search_string = copystring(s);
|
||||||
@@ -531,16 +531,16 @@ void MainWindow::Search(bool ask)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
last_poem_start = 0;
|
last_poem_start = 0;
|
||||||
PoetryNotify("Search string not found.");
|
PoetryNotify(_T("Search string not found."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy a string to the clipboard
|
// Copy a string to the clipboard
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
void CopyToClipboard(HWND handle, char *s)
|
void CopyToClipboard(HWND handle, wxChar *s)
|
||||||
{
|
{
|
||||||
int length = strlen(s);
|
int length = wxStrlen(s);
|
||||||
HANDLE hGlobalMemory = GlobalAlloc(GHND, (DWORD) length + 1);
|
HANDLE hGlobalMemory = GlobalAlloc(GHND, (DWORD) length + 1);
|
||||||
if (hGlobalMemory)
|
if (hGlobalMemory)
|
||||||
{
|
{
|
||||||
@@ -584,15 +584,15 @@ void CopyToClipboard(HWND handle, char *s)
|
|||||||
|
|
||||||
bool MyApp::OnInit()
|
bool MyApp::OnInit()
|
||||||
{
|
{
|
||||||
poem_buffer = new char[buf_size];
|
poem_buffer = new wxChar[buf_size];
|
||||||
|
|
||||||
GreyPen = new wxPen("LIGHT GREY", THICK_LINE_WIDTH, wxSOLID);
|
GreyPen = new wxPen(_T("LIGHT GREY"), THICK_LINE_WIDTH, wxSOLID);
|
||||||
DarkGreyPen = new wxPen("GREY", THICK_LINE_WIDTH, wxSOLID);
|
DarkGreyPen = new wxPen(_T("GREY"), THICK_LINE_WIDTH, wxSOLID);
|
||||||
WhitePen = new wxPen("WHITE", THICK_LINE_WIDTH, wxSOLID);
|
WhitePen = new wxPen(_T("WHITE"), THICK_LINE_WIDTH, wxSOLID);
|
||||||
|
|
||||||
#if wxUSE_HELP
|
#if wxUSE_HELP
|
||||||
HelpController = new wxHelpController();
|
HelpController = new wxHelpController();
|
||||||
HelpController->Initialize("wxpoem");
|
HelpController->Initialize(_T("wxpoem"));
|
||||||
#endif // wxUSE_HELP
|
#endif // wxUSE_HELP
|
||||||
|
|
||||||
CreateFonts();
|
CreateFonts();
|
||||||
@@ -608,29 +608,29 @@ bool MyApp::OnInit()
|
|||||||
// randomize();
|
// randomize();
|
||||||
pages[0] = 0;
|
pages[0] = 0;
|
||||||
|
|
||||||
TheMainWindow = new MainWindow(NULL, 500, "wxPoem", wxPoint(XPos, YPos), wxSize(100, 100), wxCAPTION|wxMINIMIZE_BOX|wxSYSTEM_MENU);
|
TheMainWindow = new MainWindow(NULL, 500, _T("wxPoem"), wxPoint(XPos, YPos), wxSize(100, 100), wxCAPTION|wxMINIMIZE_BOX|wxSYSTEM_MENU);
|
||||||
|
|
||||||
#ifdef wx_x
|
#ifdef wx_x
|
||||||
TheMainWindow->SetIcon(Icon("wxpoem"));
|
TheMainWindow->SetIcon(Icon(_T("wxpoem")));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TheMainWindow->canvas = new MyCanvas(TheMainWindow, 501, wxDefaultPosition, wxDefaultSize);
|
TheMainWindow->canvas = new MyCanvas(TheMainWindow, 501, wxDefaultPosition, wxDefaultSize);
|
||||||
|
|
||||||
popupMenu = new wxMenu;
|
popupMenu = new wxMenu;
|
||||||
popupMenu->Append(POEM_NEXT, "Next poem/page");
|
popupMenu->Append(POEM_NEXT, _T("Next poem/page"));
|
||||||
popupMenu->Append(POEM_PREVIOUS, "Previous page");
|
popupMenu->Append(POEM_PREVIOUS, _T("Previous page"));
|
||||||
popupMenu->AppendSeparator();
|
popupMenu->AppendSeparator();
|
||||||
popupMenu->Append(POEM_SEARCH, "Search");
|
popupMenu->Append(POEM_SEARCH, _T("Search"));
|
||||||
popupMenu->Append(POEM_NEXT_MATCH, "Next match");
|
popupMenu->Append(POEM_NEXT_MATCH, _T("Next match"));
|
||||||
popupMenu->Append(POEM_COPY, "Copy to clipboard");
|
popupMenu->Append(POEM_COPY, _T("Copy to clipboard"));
|
||||||
popupMenu->Append(POEM_MINIMIZE, "Minimize");
|
popupMenu->Append(POEM_MINIMIZE, _T("Minimize"));
|
||||||
popupMenu->AppendSeparator();
|
popupMenu->AppendSeparator();
|
||||||
popupMenu->Append(POEM_BIGGER_TEXT, "Bigger text");
|
popupMenu->Append(POEM_BIGGER_TEXT, _T("Bigger text"));
|
||||||
popupMenu->Append(POEM_SMALLER_TEXT, "Smaller text");
|
popupMenu->Append(POEM_SMALLER_TEXT, _T("Smaller text"));
|
||||||
popupMenu->AppendSeparator();
|
popupMenu->AppendSeparator();
|
||||||
popupMenu->Append(POEM_ABOUT, "About wxPoem");
|
popupMenu->Append(POEM_ABOUT, _T("About wxPoem"));
|
||||||
popupMenu->AppendSeparator();
|
popupMenu->AppendSeparator();
|
||||||
popupMenu->Append(POEM_EXIT, "Exit");
|
popupMenu->Append(POEM_EXIT, _T("Exit"));
|
||||||
|
|
||||||
if (argc > 1)
|
if (argc > 1)
|
||||||
{
|
{
|
||||||
@@ -639,16 +639,16 @@ bool MyApp::OnInit()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
index_filename = DEFAULT_POETRY_IND;
|
index_filename = _T(DEFAULT_POETRY_IND);
|
||||||
data_filename = DEFAULT_POETRY_DAT;
|
data_filename = _T(DEFAULT_POETRY_DAT);
|
||||||
}
|
}
|
||||||
TryLoadIndex();
|
TryLoadIndex();
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
Corner1 = new wxIcon("icon_1");
|
Corner1 = new wxIcon(_T("icon_1"));
|
||||||
Corner2 = new wxIcon("icon_2");
|
Corner2 = new wxIcon(_T("icon_2"));
|
||||||
Corner3 = new wxIcon("icon_3");
|
Corner3 = new wxIcon(_T("icon_3"));
|
||||||
Corner4 = new wxIcon("icon_4");
|
Corner4 = new wxIcon(_T("icon_4"));
|
||||||
#endif
|
#endif
|
||||||
#if defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXMAC__) || defined(__WXX11__)
|
#if defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXMAC__) || defined(__WXX11__)
|
||||||
Corner1 = new wxIcon( corner1_xpm );
|
Corner1 = new wxIcon( corner1_xpm );
|
||||||
@@ -799,31 +799,34 @@ void MyCanvas::OnChar(wxKeyEvent& event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load index file
|
// Load index file
|
||||||
int LoadIndex(char *file_name)
|
int LoadIndex(wxChar *file_name)
|
||||||
{
|
{
|
||||||
long data;
|
long data;
|
||||||
FILE *index_file;
|
FILE *index_file;
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
char buf[100];
|
wxChar buf[100];
|
||||||
|
|
||||||
if (file_name)
|
if (file_name == NULL)
|
||||||
sprintf(buf, "%s.idx", file_name);
|
|
||||||
if (! (file_name && (index_file = fopen(buf, "r"))))
|
|
||||||
return 0;
|
return 0;
|
||||||
else
|
|
||||||
{
|
wxSprintf(buf, _T("%s.idx"), file_name);
|
||||||
fscanf(index_file, "%ld", &nitems);
|
|
||||||
|
index_file = wxFopen(buf, _T("r"));
|
||||||
|
if (index_file == NULL)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
wxFscanf(index_file, _T("%ld"), &nitems);
|
||||||
|
|
||||||
for (i = 0; i < nitems; i++)
|
for (i = 0; i < nitems; i++)
|
||||||
{
|
{
|
||||||
fscanf(index_file, "%ld", &data);
|
wxFscanf(index_file, _T("%ld"), &data);
|
||||||
poem_index[i] = data;
|
poem_index[i] = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(index_file);
|
fclose(index_file);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get index
|
// Get index
|
||||||
@@ -834,7 +837,7 @@ int GetIndex()
|
|||||||
indexn = (int)(rand() % nitems);
|
indexn = (int)(rand() % nitems);
|
||||||
|
|
||||||
if ((indexn < 0) || (indexn > nitems))
|
if ((indexn < 0) || (indexn > nitems))
|
||||||
{ PoetryError("No such poem!");
|
{ PoetryError(_T("No such poem!"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -845,11 +848,9 @@ int GetIndex()
|
|||||||
void ReadPreferences()
|
void ReadPreferences()
|
||||||
{
|
{
|
||||||
#if wxUSE_RESOURCES
|
#if wxUSE_RESOURCES
|
||||||
#if wxUSE_RESOURCES
|
wxGetResource(_T("wxPoem"), _T("FontSize"), &pointSize);
|
||||||
wxGetResource("wxPoem", "FontSize", &pointSize);
|
wxGetResource(_T("wxPoem"), _T("X"), &XPos);
|
||||||
wxGetResource("wxPoem", "X", &XPos);
|
wxGetResource(_T("wxPoem"), _T("Y"), &YPos);
|
||||||
wxGetResource("wxPoem", "Y", &YPos);
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -859,11 +860,9 @@ void WritePreferences()
|
|||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
TheMainWindow->GetPosition(&XPos, &YPos);
|
TheMainWindow->GetPosition(&XPos, &YPos);
|
||||||
#if wxUSE_RESOURCES
|
#if wxUSE_RESOURCES
|
||||||
#if wxUSE_RESOURCES
|
wxWriteResource(_T("wxPoem"), _T("FontSize"), pointSize);
|
||||||
wxWriteResource("wxPoem", "FontSize", pointSize);
|
wxWriteResource(_T("wxPoem"), _T("X"), XPos);
|
||||||
wxWriteResource("wxPoem", "X", XPos);
|
wxWriteResource(_T("wxPoem"), _T("Y"), YPos);
|
||||||
wxWriteResource("wxPoem", "Y", YPos);
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -871,30 +870,36 @@ void WritePreferences()
|
|||||||
// Load a poem from given file, at given point in file.
|
// Load a poem from given file, at given point in file.
|
||||||
// If position is > -1, use this for the position in the
|
// If position is > -1, use this for the position in the
|
||||||
// file, otherwise use index[index_ptr] to find the correct position.
|
// file, otherwise use index[index_ptr] to find the correct position.
|
||||||
bool LoadPoem(char *file_name, long position)
|
bool LoadPoem(wxChar *file_name, long position)
|
||||||
{
|
{
|
||||||
int ch = 0;
|
int ch = 0;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
// int j = 0;
|
// int j = 0;
|
||||||
// int indexn = 0;
|
// int indexn = 0;
|
||||||
char buf[100];
|
wxChar buf[100];
|
||||||
long data;
|
long data;
|
||||||
FILE *data_file;
|
FILE *data_file;
|
||||||
|
|
||||||
paging = FALSE;
|
paging = FALSE;
|
||||||
current_page = 0;
|
current_page = 0;
|
||||||
|
|
||||||
if (file_name)
|
if (file_name == NULL)
|
||||||
sprintf(buf, "%s.dat", file_name);
|
|
||||||
|
|
||||||
if (! (file_name && (data_file = fopen(buf, "r"))))
|
|
||||||
{
|
{
|
||||||
sprintf(error_buf, "Data file %s not found.", buf);
|
wxSprintf(error_buf, _T("Error in Poem loading."));
|
||||||
PoetryError(error_buf);
|
PoetryError(error_buf);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
wxSprintf(buf, _T("%s.dat"), file_name);
|
||||||
|
data_file = wxFopen(buf, _T("r"));
|
||||||
|
|
||||||
|
if (data_file == NULL)
|
||||||
{
|
{
|
||||||
|
wxSprintf(error_buf, _T("Data file %s not found."), buf);
|
||||||
|
PoetryError(error_buf);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (position > -1)
|
if (position > -1)
|
||||||
data = position;
|
data = position;
|
||||||
else
|
else
|
||||||
@@ -919,7 +924,7 @@ bool LoadPoem(char *file_name, long position)
|
|||||||
|
|
||||||
if (i == buf_size)
|
if (i == buf_size)
|
||||||
{
|
{
|
||||||
sprintf(error_buf, "%s", "Poetry buffer exceeded.");
|
wxSprintf(error_buf, _T("%s"), _T("Poetry buffer exceeded."));
|
||||||
PoetryError(error_buf);
|
PoetryError(error_buf);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -927,7 +932,6 @@ bool LoadPoem(char *file_name, long position)
|
|||||||
fclose(data_file);
|
fclose(data_file);
|
||||||
poem_buffer[i-1] = 0;
|
poem_buffer[i-1] = 0;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do the search
|
// Do the search
|
||||||
@@ -939,12 +943,12 @@ long MainWindow::DoSearch(void)
|
|||||||
FILE *file;
|
FILE *file;
|
||||||
long i = 0;
|
long i = 0;
|
||||||
int ch = 0;
|
int ch = 0;
|
||||||
char buf[100];
|
wxChar buf[100];
|
||||||
long find_start;
|
long find_start;
|
||||||
long previous_poem_start;
|
long previous_poem_start;
|
||||||
|
|
||||||
bool found = FALSE;
|
bool found = FALSE;
|
||||||
int search_length = strlen(search_string);
|
int search_length = wxStrlen(search_string);
|
||||||
|
|
||||||
if (same_search)
|
if (same_search)
|
||||||
{
|
{
|
||||||
@@ -959,11 +963,12 @@ long MainWindow::DoSearch(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (data_filename)
|
if (data_filename)
|
||||||
sprintf(buf, "%s.dat", data_filename);
|
wxSprintf(buf, _T("%s.dat"), data_filename);
|
||||||
|
|
||||||
if (! (data_filename && (file = fopen(buf, "r"))))
|
file = wxFopen(buf, _T("r"));
|
||||||
|
if (! (data_filename && file))
|
||||||
{
|
{
|
||||||
sprintf(error_buf, "Poetry data file %s not found\n", buf);
|
wxSprintf(error_buf, _T("Poetry data file %s not found\n"), buf);
|
||||||
PoetryError(error_buf);
|
PoetryError(error_buf);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -1013,19 +1018,19 @@ void TryLoadIndex()
|
|||||||
index_ok = (LoadIndex(index_filename) != 0);
|
index_ok = (LoadIndex(index_filename) != 0);
|
||||||
if (!index_ok || (nitems == 0))
|
if (!index_ok || (nitems == 0))
|
||||||
{
|
{
|
||||||
PoetryError("Index file not found; will compile new one", "wxPoem");
|
PoetryError(_T("Index file not found; will compile new one"), _T("wxPoem"));
|
||||||
index_ok = Compile();
|
index_ok = Compile();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Error message
|
// Error message
|
||||||
void PoetryError(char *msg, char *caption)
|
void PoetryError(wxChar *msg, wxChar *caption)
|
||||||
{
|
{
|
||||||
wxMessageBox(msg, caption, wxOK|wxICON_EXCLAMATION);
|
wxMessageBox(msg, caption, wxOK|wxICON_EXCLAMATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Notification (change icon to something appropriate!)
|
// Notification (change icon to something appropriate!)
|
||||||
void PoetryNotify(char *Msg, char *caption)
|
void PoetryNotify(wxChar *Msg, wxChar *caption)
|
||||||
{
|
{
|
||||||
wxMessageBox(Msg, caption, wxOK | wxICON_INFORMATION);
|
wxMessageBox(Msg, caption, wxOK | wxICON_INFORMATION);
|
||||||
}
|
}
|
||||||
@@ -1038,14 +1043,15 @@ bool Compile(void)
|
|||||||
long i = 0;
|
long i = 0;
|
||||||
int j;
|
int j;
|
||||||
int ch = 0;
|
int ch = 0;
|
||||||
char buf[100];
|
wxChar buf[100];
|
||||||
|
|
||||||
if (data_filename)
|
if (data_filename)
|
||||||
sprintf(buf, "%s.dat", data_filename);
|
wxSprintf(buf, _T("%s.dat"), data_filename);
|
||||||
|
|
||||||
if (! (data_filename && (file = fopen(buf, "r"))))
|
file = wxFopen(buf, _T("r"));
|
||||||
|
if (! (data_filename && file))
|
||||||
{
|
{
|
||||||
sprintf(error_buf, "Poetry data file %s not found\n", buf);
|
wxSprintf(error_buf, _T("Poetry data file %s not found\n"), buf);
|
||||||
PoetryError(error_buf);
|
PoetryError(error_buf);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -1073,20 +1079,22 @@ bool Compile(void)
|
|||||||
fclose(file);
|
fclose(file);
|
||||||
|
|
||||||
if (index_filename)
|
if (index_filename)
|
||||||
sprintf(buf, "%s.idx", index_filename);
|
wxSprintf(buf, _T("%s.idx"), index_filename);
|
||||||
if (! (data_filename && (file = fopen(buf, "w"))))
|
|
||||||
|
file = wxFopen(buf, _T("w"));
|
||||||
|
if (! (data_filename && file))
|
||||||
{
|
{
|
||||||
sprintf(error_buf, "Poetry index file %s cannot be created\n", buf);
|
wxSprintf(error_buf, _T("Poetry index file %s cannot be created\n"), buf);
|
||||||
PoetryError(error_buf);
|
PoetryError(error_buf);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(file, "%ld\n\n", nitems);
|
wxFprintf(file, _T("%ld\n\n"), nitems);
|
||||||
for (j = 0; j < nitems; j++)
|
for (j = 0; j < nitems; j++)
|
||||||
fprintf(file, "%ld\n", poem_index[j]);
|
wxFprintf(file, _T("%ld\n"), poem_index[j]);
|
||||||
|
|
||||||
fclose(file);
|
fclose(file);
|
||||||
PoetryNotify("Poetry index compiled.");
|
PoetryNotify(_T("Poetry index compiled."));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1143,15 +1151,15 @@ void MainWindow::OnPopup(wxCommandEvent& event)
|
|||||||
case POEM_HELP_CONTENTS:
|
case POEM_HELP_CONTENTS:
|
||||||
{
|
{
|
||||||
#if wxUSE_HELP
|
#if wxUSE_HELP
|
||||||
HelpController->LoadFile("wxpoem");
|
HelpController->LoadFile(_T("wxpoem"));
|
||||||
HelpController->DisplayContents();
|
HelpController->DisplayContents();
|
||||||
#endif // wxUSE_HELP
|
#endif // wxUSE_HELP
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case POEM_ABOUT:
|
case POEM_ABOUT:
|
||||||
{
|
{
|
||||||
(void)wxMessageBox("wxPoem Version 1.1\nJulian Smart (c) 1995",
|
(void)wxMessageBox(_T("wxPoem Version 1.1\nJulian Smart (c) 1995"),
|
||||||
"About wxPoem", wxOK, TheMainWindow);
|
_T("About wxPoem"), wxOK, TheMainWindow);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case POEM_EXIT:
|
case POEM_EXIT:
|
||||||
|
Reference in New Issue
Block a user