Globally replace _T() with wxT().
Standardize on using a single macro across all wxWidgets sources and solve the name clash with Sun CC standard headers (see #10660). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61508 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -53,7 +53,7 @@ FortyCanvas::FortyCanvas(wxWindow* parent, const wxPoint& pos, const wxSize& siz
|
||||
m_arrowCursor = new wxCursor(wxCURSOR_ARROW);
|
||||
|
||||
wxString name = wxTheApp->GetAppName();
|
||||
if (name.Length() <= 0) name = _T("forty");
|
||||
if (name.Length() <= 0) name = wxT("forty");
|
||||
m_scoreFile = new ScoreFile(name);
|
||||
m_game = new Game(0, 0, 0);
|
||||
m_game->Deal();
|
||||
@@ -156,8 +156,8 @@ Called when the main frame is closed
|
||||
bool FortyCanvas::OnCloseCanvas()
|
||||
{
|
||||
if (m_game->InPlay() &&
|
||||
wxMessageBox(_T("Are you sure you want to\nabandon the current game?"),
|
||||
_T("Warning"), wxYES_NO | wxICON_QUESTION) == wxNO)
|
||||
wxMessageBox(wxT("Are you sure you want to\nabandon the current game?"),
|
||||
wxT("Warning"), wxYES_NO | wxICON_QUESTION) == wxNO)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@@ -62,7 +62,7 @@ Card::Card(int value, WayUp way_up) :
|
||||
m_symbolBmap = new wxBitmap(symbols_xpm);
|
||||
if (!m_symbolBmap->Ok())
|
||||
{
|
||||
::wxMessageBox(_T("Failed to load bitmap CardSymbols"), _T("Error"));
|
||||
::wxMessageBox(wxT("Failed to load bitmap CardSymbols"), wxT("Error"));
|
||||
}
|
||||
}
|
||||
if (!m_pictureBmap)
|
||||
@@ -70,7 +70,7 @@ Card::Card(int value, WayUp way_up) :
|
||||
m_pictureBmap = new wxBitmap(Pictures);
|
||||
if (!m_pictureBmap->Ok())
|
||||
{
|
||||
::wxMessageBox(_T("Failed to load bitmap CardPictures"), _T("Error"));
|
||||
::wxMessageBox(wxT("Failed to load bitmap CardPictures"), wxT("Error"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -79,7 +79,7 @@ bool FortyApp::OnInit()
|
||||
|
||||
wxSize size(668,510);
|
||||
|
||||
if ((argc > 1) && (!wxStrcmp(argv[1],_T("-L"))))
|
||||
if ((argc > 1) && (!wxStrcmp(argv[1],wxT("-L"))))
|
||||
{
|
||||
largecards = true;
|
||||
size = wxSize(1000,750);
|
||||
@@ -87,7 +87,7 @@ bool FortyApp::OnInit()
|
||||
|
||||
FortyFrame* frame = new FortyFrame(
|
||||
0,
|
||||
_T("Forty Thieves"),
|
||||
wxT("Forty Thieves"),
|
||||
wxDefaultPosition,
|
||||
size,
|
||||
largecards
|
||||
@@ -140,35 +140,35 @@ FortyFrame::FortyFrame(wxFrame* frame, const wxString& title, const wxPoint& pos
|
||||
#endif
|
||||
// set the icon
|
||||
#ifdef __WXMSW__
|
||||
SetIcon(wxIcon(_T("CardsIcon")));
|
||||
SetIcon(wxIcon(wxT("CardsIcon")));
|
||||
#else
|
||||
SetIcon(wxIcon(forty_xpm));
|
||||
#endif
|
||||
|
||||
// Make a menu bar
|
||||
wxMenu* gameMenu = new wxMenu;
|
||||
gameMenu->Append(wxID_NEW, wxGetStockLabel(wxID_NEW), _T("Start a new game"));
|
||||
gameMenu->Append(SCORES, _T("&Scores..."), _T("Displays scores"));
|
||||
gameMenu->Append(wxID_EXIT, wxGetStockLabel(wxID_EXIT), _T("Exits Forty Thieves"));
|
||||
gameMenu->Append(wxID_NEW, wxGetStockLabel(wxID_NEW), wxT("Start a new game"));
|
||||
gameMenu->Append(SCORES, wxT("&Scores..."), wxT("Displays scores"));
|
||||
gameMenu->Append(wxID_EXIT, wxGetStockLabel(wxID_EXIT), wxT("Exits Forty Thieves"));
|
||||
|
||||
wxMenu* editMenu = new wxMenu;
|
||||
editMenu->Append(wxID_UNDO, wxGetStockLabel(wxID_UNDO), _T("Undo the last move"));
|
||||
editMenu->Append(wxID_REDO, wxGetStockLabel(wxID_REDO), _T("Redo a move that has been undone"));
|
||||
editMenu->Append(wxID_UNDO, wxGetStockLabel(wxID_UNDO), wxT("Undo the last move"));
|
||||
editMenu->Append(wxID_REDO, wxGetStockLabel(wxID_REDO), wxT("Redo a move that has been undone"));
|
||||
|
||||
wxMenu* optionsMenu = new wxMenu;
|
||||
optionsMenu->Append(RIGHT_BUTTON_UNDO,
|
||||
_T("&Right button undo"),
|
||||
_T("Enables/disables right mouse button undo and redo"),
|
||||
wxT("&Right button undo"),
|
||||
wxT("Enables/disables right mouse button undo and redo"),
|
||||
true
|
||||
);
|
||||
optionsMenu->Append(HELPING_HAND,
|
||||
_T("&Helping hand"),
|
||||
_T("Enables/disables hand cursor when a card can be moved"),
|
||||
wxT("&Helping hand"),
|
||||
wxT("Enables/disables hand cursor when a card can be moved"),
|
||||
true
|
||||
);
|
||||
optionsMenu->Append(LARGE_CARDS,
|
||||
_T("&Large cards"),
|
||||
_T("Enables/disables large cards for high resolution displays"),
|
||||
wxT("&Large cards"),
|
||||
wxT("Enables/disables large cards for high resolution displays"),
|
||||
true
|
||||
);
|
||||
optionsMenu->Check(HELPING_HAND, true);
|
||||
@@ -176,14 +176,14 @@ FortyFrame::FortyFrame(wxFrame* frame, const wxString& title, const wxPoint& pos
|
||||
optionsMenu->Check(LARGE_CARDS, largecards ? true : false);
|
||||
|
||||
wxMenu* helpMenu = new wxMenu;
|
||||
helpMenu->Append(wxID_HELP_CONTENTS, _T("&Help Contents"), _T("Displays information about playing the game"));
|
||||
helpMenu->Append(wxID_ABOUT, _T("&About..."), _T("About Forty Thieves"));
|
||||
helpMenu->Append(wxID_HELP_CONTENTS, wxT("&Help Contents"), wxT("Displays information about playing the game"));
|
||||
helpMenu->Append(wxID_ABOUT, wxT("&About..."), wxT("About Forty Thieves"));
|
||||
|
||||
m_menuBar = new wxMenuBar;
|
||||
m_menuBar->Append(gameMenu, _T("&Game"));
|
||||
m_menuBar->Append(editMenu, _T("&Edit"));
|
||||
m_menuBar->Append(optionsMenu, _T("&Options"));
|
||||
m_menuBar->Append(helpMenu, _T("&Help"));
|
||||
m_menuBar->Append(gameMenu, wxT("&Game"));
|
||||
m_menuBar->Append(editMenu, wxT("&Edit"));
|
||||
m_menuBar->Append(optionsMenu, wxT("&Options"));
|
||||
m_menuBar->Append(helpMenu, wxT("&Help"));
|
||||
|
||||
SetMenuBar(m_menuBar);
|
||||
|
||||
@@ -247,11 +247,11 @@ void
|
||||
FortyFrame::About(wxCommandEvent&)
|
||||
{
|
||||
wxMessageBox(
|
||||
_T("Forty Thieves\n\n")
|
||||
_T("A free card game written with the wxWidgets toolkit\n")
|
||||
_T("Author: Chris Breeze (c) 1992-2004\n")
|
||||
_T("email: chris@breezesys.com"),
|
||||
_T("About Forty Thieves"),
|
||||
wxT("Forty Thieves\n\n")
|
||||
wxT("A free card game written with the wxWidgets toolkit\n")
|
||||
wxT("Author: Chris Breeze (c) 1992-2004\n")
|
||||
wxT("email: chris@breezesys.com"),
|
||||
wxT("About Forty Thieves"),
|
||||
wxOK|wxICON_INFORMATION, this
|
||||
);
|
||||
}
|
||||
@@ -326,7 +326,7 @@ bool FortyAboutDialog::AddControls(wxWindow* parent)
|
||||
file.Open();
|
||||
for ( htmlText = file.GetFirstLine();
|
||||
!file.Eof();
|
||||
htmlText << file.GetNextLine() << _T("\n") ) ;
|
||||
htmlText << file.GetNextLine() << wxT("\n") ) ;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -336,7 +336,7 @@ bool FortyAboutDialog::AddControls(wxWindow* parent)
|
||||
}
|
||||
|
||||
// Customize the HTML
|
||||
htmlText.Replace(wxT("$DATE$"), _T(__DATE__));
|
||||
htmlText.Replace(wxT("$DATE$"), wxT(__DATE__));
|
||||
|
||||
wxSize htmlSize(400, 290);
|
||||
|
||||
|
@@ -158,7 +158,7 @@ void Game::DoMove(wxDC& dc, Pile* src, Pile* dest)
|
||||
{
|
||||
if (src == dest)
|
||||
{
|
||||
wxMessageBox(_T("Game::DoMove() src == dest"), _T("Debug message"),
|
||||
wxMessageBox(wxT("Game::DoMove() src == dest"), wxT("Debug message"),
|
||||
wxOK | wxICON_EXCLAMATION);
|
||||
}
|
||||
m_moves[m_moveIndex].src = src;
|
||||
@@ -170,7 +170,7 @@ void Game::DoMove(wxDC& dc, Pile* src, Pile* dest)
|
||||
}
|
||||
else
|
||||
{
|
||||
wxMessageBox(_T("Game::DoMove() Undo buffer full"), _T("Debug message"),
|
||||
wxMessageBox(wxT("Game::DoMove() Undo buffer full"), wxT("Debug message"),
|
||||
wxOK | wxICON_EXCLAMATION);
|
||||
}
|
||||
|
||||
@@ -198,8 +198,8 @@ void Game::DoMove(wxDC& dc, Pile* src, Pile* dest)
|
||||
// Redraw the score box to update games won
|
||||
DisplayScore(dc);
|
||||
|
||||
if (wxMessageBox(_T("Do you wish to play again?"),
|
||||
_T("Well Done, You have won!"), wxYES_NO | wxICON_QUESTION) == wxYES)
|
||||
if (wxMessageBox(wxT("Do you wish to play again?"),
|
||||
wxT("Well Done, You have won!"), wxYES_NO | wxICON_QUESTION) == wxYES)
|
||||
{
|
||||
Deal();
|
||||
canvas->Refresh();
|
||||
@@ -236,25 +236,25 @@ void Game::DisplayScore(wxDC& dc)
|
||||
wxCoord w, h;
|
||||
{
|
||||
wxCoord width, height;
|
||||
dc.GetTextExtent(_T("Average score:m_x"), &width, &height);
|
||||
dc.GetTextExtent(wxT("Average score:m_x"), &width, &height);
|
||||
w = width;
|
||||
h = height;
|
||||
}
|
||||
dc.DrawRectangle(x + w, y, 20, 4 * h);
|
||||
|
||||
wxString str;
|
||||
str.Printf(_T("%d"), m_currentScore);
|
||||
dc.DrawText(_T("Score:"), x, y);
|
||||
str.Printf(wxT("%d"), m_currentScore);
|
||||
dc.DrawText(wxT("Score:"), x, y);
|
||||
dc.DrawText(str, x + w, y);
|
||||
y += h;
|
||||
|
||||
str.Printf(_T("%d"), m_numGames);
|
||||
dc.DrawText(_T("Games played:"), x, y);
|
||||
str.Printf(wxT("%d"), m_numGames);
|
||||
dc.DrawText(wxT("Games played:"), x, y);
|
||||
dc.DrawText(str, x + w, y);
|
||||
y += h;
|
||||
|
||||
str.Printf(_T("%d"), m_numWins);
|
||||
dc.DrawText(_T("Games won:"), x, y);
|
||||
str.Printf(wxT("%d"), m_numWins);
|
||||
dc.DrawText(wxT("Games won:"), x, y);
|
||||
dc.DrawText(str, x + w, y);
|
||||
y += h;
|
||||
|
||||
@@ -263,8 +263,8 @@ void Game::DisplayScore(wxDC& dc)
|
||||
{
|
||||
average = (2 * (m_currentScore + m_totalScore) + m_numGames ) / (2 * m_numGames);
|
||||
}
|
||||
str.Printf(_T("%d"), average);
|
||||
dc.DrawText(_T("Average score:"), x, y);
|
||||
str.Printf(wxT("%d"), average);
|
||||
dc.DrawText(wxT("Average score:"), x, y);
|
||||
dc.DrawText(str, x + w, y);
|
||||
}
|
||||
|
||||
@@ -794,7 +794,7 @@ void Pack::Redraw(wxDC& dc)
|
||||
Pile::Redraw(dc);
|
||||
|
||||
wxString str;
|
||||
str.Printf(_T("%d "), m_topCard + 1);
|
||||
str.Printf(wxT("%d "), m_topCard + 1);
|
||||
|
||||
dc.SetBackgroundMode( wxSOLID );
|
||||
dc.SetTextBackground(FortyApp::BackgroundColour());
|
||||
@@ -811,7 +811,7 @@ void Pack::AddCard(Card* card)
|
||||
}
|
||||
else
|
||||
{
|
||||
wxMessageBox(_T("Pack::AddCard() Undo error"), _T("Forty Thieves: Warning"),
|
||||
wxMessageBox(wxT("Pack::AddCard() Undo error"), wxT("Forty Thieves: Warning"),
|
||||
wxOK | wxICON_EXCLAMATION);
|
||||
}
|
||||
card->TurnCard(facedown);
|
||||
|
@@ -37,10 +37,10 @@ PlayerSelectionDialog::PlayerSelectionDialog(
|
||||
wxWindow* parent,
|
||||
ScoreFile* file
|
||||
) :
|
||||
wxDialog(parent, wxID_ANY, _T("Player Selection"), wxDefaultPosition),
|
||||
wxDialog(parent, wxID_ANY, wxT("Player Selection"), wxDefaultPosition),
|
||||
m_scoreFile(file)
|
||||
{
|
||||
wxStaticText* msg = new wxStaticText(this, wxID_ANY, _T("Please select a name or type a new one:"));
|
||||
wxStaticText* msg = new wxStaticText(this, wxID_ANY, wxT("Please select a name or type a new one:"));
|
||||
|
||||
wxListBox* list = new wxListBox(
|
||||
this, ID_LISTBOX,
|
||||
@@ -116,9 +116,9 @@ void PlayerSelectionDialog::ButtonCallback(wxCommandEvent& event)
|
||||
wxString name = m_textField->GetValue();
|
||||
if (!name.IsNull() && name.Length() > 0)
|
||||
{
|
||||
if (name.Contains(_T('@')))
|
||||
if (name.Contains(wxT('@')))
|
||||
{
|
||||
wxMessageBox(_T("Names should not contain the '@' character"), _T("Forty Thieves"));
|
||||
wxMessageBox(wxT("Names should not contain the '@' character"), wxT("Forty Thieves"));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -128,7 +128,7 @@ void PlayerSelectionDialog::ButtonCallback(wxCommandEvent& event)
|
||||
}
|
||||
else
|
||||
{
|
||||
wxMessageBox(_T("Please enter your name"), _T("Forty Thieves"));
|
||||
wxMessageBox(wxT("Please enter your name"), wxT("Forty Thieves"));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@@ -156,17 +156,17 @@ ScoreDialog::ScoreDialog(wxWindow* parent, ScoreFile* file) :
|
||||
average = (2 * score + games) / (2 * games);
|
||||
}
|
||||
list->SetCellValue(i,0,players[i]);
|
||||
string_value.Printf( _T("%u"), wins );
|
||||
string_value.Printf( wxT("%u"), wins );
|
||||
list->SetCellValue(i,1,string_value);
|
||||
string_value.Printf( _T("%u"), games );
|
||||
string_value.Printf( wxT("%u"), games );
|
||||
list->SetCellValue(i,2,string_value);
|
||||
string_value.Printf( _T("%u"), average );
|
||||
string_value.Printf( wxT("%u"), average );
|
||||
list->SetCellValue(i,3,string_value);
|
||||
}
|
||||
list->SetColLabelValue(0, _T("Players"));
|
||||
list->SetColLabelValue(1, _T("Wins"));
|
||||
list->SetColLabelValue(2, _T("Games"));
|
||||
list->SetColLabelValue(3, _T("Score"));
|
||||
list->SetColLabelValue(0, wxT("Players"));
|
||||
list->SetColLabelValue(1, wxT("Wins"));
|
||||
list->SetColLabelValue(2, wxT("Games"));
|
||||
list->SetColLabelValue(3, wxT("Score"));
|
||||
list->SetEditable(false);
|
||||
list->AutoSizeColumns();
|
||||
list->AutoSizeRows();
|
||||
|
@@ -33,7 +33,7 @@
|
||||
|
||||
ScoreFile::ScoreFile(const wxString& appName)
|
||||
{
|
||||
m_config = new wxConfig(appName, _T("wxWidgets"), appName, wxEmptyString,
|
||||
m_config = new wxConfig(appName, wxT("wxWidgets"), appName, wxEmptyString,
|
||||
wxCONFIG_USE_LOCAL_FILE); // only local
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ ScoreFile::~ScoreFile()
|
||||
|
||||
void ScoreFile::GetPlayerList( wxArrayString &list )
|
||||
{
|
||||
m_config->SetPath(_T("/Players"));
|
||||
m_config->SetPath(wxT("/Players"));
|
||||
int length = m_config->GetNumberOfGroups();
|
||||
|
||||
if (length <= 0) return;
|
||||
@@ -87,8 +87,8 @@ long ScoreFile::CalcCheck(const wxString& name, int p1, int p2, int p3)
|
||||
wxString ScoreFile::GetPreviousPlayer() const
|
||||
{
|
||||
wxString result;
|
||||
m_config->SetPath(_T("/General"));
|
||||
m_config->Read(_T("LastPlayer"), &result);
|
||||
m_config->SetPath(wxT("/General"));
|
||||
m_config->Read(wxT("LastPlayer"), &result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -103,16 +103,16 @@ void ScoreFile::ReadPlayersScore(
|
||||
|
||||
games = wins = score = 0;
|
||||
|
||||
m_config->SetPath(_T("/Players"));
|
||||
m_config->SetPath(wxT("/Players"));
|
||||
m_config->SetPath(player);
|
||||
if (m_config->Read(_T("Score"), &myScore, 0L) &&
|
||||
m_config->Read(_T("Games"), &myGames, 0L) &&
|
||||
m_config->Read(_T("Wins"), &myWins, 0L) &&
|
||||
m_config->Read(_T("Check"), &check, 0L))
|
||||
if (m_config->Read(wxT("Score"), &myScore, 0L) &&
|
||||
m_config->Read(wxT("Games"), &myGames, 0L) &&
|
||||
m_config->Read(wxT("Wins"), &myWins, 0L) &&
|
||||
m_config->Read(wxT("Check"), &check, 0L))
|
||||
{
|
||||
if (check != CalcCheck(player, myGames, myWins, myScore))
|
||||
{
|
||||
wxMessageBox(_T("Score file corrupted"), _T("Warning"),
|
||||
wxMessageBox(wxT("Score file corrupted"), wxT("Warning"),
|
||||
wxOK | wxICON_EXCLAMATION);
|
||||
}
|
||||
else
|
||||
@@ -130,14 +130,14 @@ void ScoreFile::WritePlayersScore(const wxString& player, int wins, int games, i
|
||||
{
|
||||
if (!player.empty())
|
||||
{
|
||||
m_config->SetPath(_T("/General"));
|
||||
m_config->Write(_T("LastPlayer"), wxString(player)); // Without wxString tmp, thinks it's bool in VC++
|
||||
m_config->SetPath(wxT("/General"));
|
||||
m_config->Write(wxT("LastPlayer"), wxString(player)); // Without wxString tmp, thinks it's bool in VC++
|
||||
|
||||
m_config->SetPath(_T("/Players"));
|
||||
m_config->SetPath(wxT("/Players"));
|
||||
m_config->SetPath(player);
|
||||
m_config->Write(_T("Score"), (long)score);
|
||||
m_config->Write(_T("Games"), (long)games);
|
||||
m_config->Write(_T("Wins"), (long)wins);
|
||||
m_config->Write(_T("Check"), CalcCheck(player, games, wins, score));
|
||||
m_config->Write(wxT("Score"), (long)score);
|
||||
m_config->Write(wxT("Games"), (long)games);
|
||||
m_config->Write(wxT("Wins"), (long)wins);
|
||||
m_config->Write(wxT("Check"), CalcCheck(player, games, wins, score));
|
||||
}
|
||||
}
|
||||
|
@@ -93,13 +93,13 @@ DECLARE_EVENT_TABLE()
|
||||
bool MyApp::OnInit()
|
||||
{
|
||||
// Create the main frame window
|
||||
MyFrame *frame = new MyFrame(NULL, _T("Fractal Mountains for wxWidgets"), wxDefaultPosition, wxSize(640, 480));
|
||||
MyFrame *frame = new MyFrame(NULL, wxT("Fractal Mountains for wxWidgets"), wxDefaultPosition, wxSize(640, 480));
|
||||
|
||||
// Make a menubar
|
||||
wxMenu *file_menu = new wxMenu;
|
||||
file_menu->Append(wxID_EXIT, wxGetStockLabel(wxID_EXIT));
|
||||
menuBar = new wxMenuBar;
|
||||
menuBar->Append(file_menu, _T("&File"));
|
||||
menuBar->Append(file_menu, wxT("&File"));
|
||||
frame->SetMenuBar(menuBar);
|
||||
|
||||
int width, height;
|
||||
|
@@ -46,7 +46,7 @@ public:
|
||||
// causes a crash due to conversion objects not being available
|
||||
// during initialisation.
|
||||
#ifndef __WXMAC__
|
||||
m_shape.Add( wxString::Format(_T("%i %i"), -width/2, -height/2) );
|
||||
m_shape.Add( wxString::Format(wxT("%i %i"), -width/2, -height/2) );
|
||||
#endif
|
||||
for(int j = 0; j < height; j++)
|
||||
{
|
||||
|
@@ -79,8 +79,8 @@ static int current_page = 0; // Currently viewed page
|
||||
// Backing bitmap
|
||||
wxBitmap *backingBitmap = NULL;
|
||||
|
||||
void PoetryError(const wxChar *, const wxChar *caption=_T("wxPoem Error"));
|
||||
void PoetryNotify(const wxChar *Msg, const wxChar *caption=_T("wxPoem"));
|
||||
void PoetryError(const wxChar *, const wxChar *caption=wxT("wxPoem Error"));
|
||||
void PoetryNotify(const wxChar *Msg, const wxChar *caption=wxT("wxPoem"));
|
||||
void TryLoadIndex();
|
||||
bool LoadPoem(const wxChar *, long);
|
||||
int GetIndex();
|
||||
@@ -181,7 +181,7 @@ void MainWindow::ScanBuffer(wxDC *dc, bool DrawIt, int *max_x, int *max_y)
|
||||
dc->SetFont(*m_normalFont);
|
||||
wxCoord xx;
|
||||
wxCoord yy;
|
||||
dc->GetTextExtent(_T("X"), &xx, &yy);
|
||||
dc->GetTextExtent(wxT("X"), &xx, &yy);
|
||||
char_height = (int)yy;
|
||||
|
||||
if (current_page == 0)
|
||||
@@ -262,7 +262,7 @@ void MainWindow::ScanBuffer(wxDC *dc, bool DrawIt, int *max_x, int *max_y)
|
||||
line_ptr = line+3;
|
||||
|
||||
m_title = line_ptr;
|
||||
m_title << _T(" (cont'd)");
|
||||
m_title << wxT(" (cont'd)");
|
||||
|
||||
dc->GetTextExtent(line_ptr, &xx, &yy);
|
||||
FindMax(&curr_width, (int)xx);
|
||||
@@ -325,7 +325,7 @@ void MainWindow::ScanBuffer(wxDC *dc, bool DrawIt, int *max_x, int *max_y)
|
||||
// Write (cont'd)
|
||||
if (page_break)
|
||||
{
|
||||
const wxChar *cont = _T("(cont'd)");
|
||||
const wxChar *cont = wxT("(cont'd)");
|
||||
|
||||
dc->SetFont(* m_normalFont);
|
||||
|
||||
@@ -481,7 +481,7 @@ void MainWindow::Search(bool ask)
|
||||
|
||||
if (ask || m_searchString.empty())
|
||||
{
|
||||
wxString s = wxGetTextFromUser( _T("Enter search string"), _T("Search"), m_searchString);
|
||||
wxString s = wxGetTextFromUser( wxT("Enter search string"), wxT("Search"), m_searchString);
|
||||
if (!s.empty())
|
||||
{
|
||||
s.MakeLower();
|
||||
@@ -510,7 +510,7 @@ void MainWindow::Search(bool ask)
|
||||
else
|
||||
{
|
||||
last_poem_start = 0;
|
||||
PoetryNotify(_T("Search string not found."));
|
||||
PoetryNotify(wxT("Search string not found."));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -534,7 +534,7 @@ bool MyApp::OnInit()
|
||||
|
||||
TheMainWindow = new MainWindow(NULL,
|
||||
wxID_ANY,
|
||||
_T("wxPoem"),
|
||||
wxT("wxPoem"),
|
||||
wxPoint(XPos, YPos),
|
||||
wxDefaultSize,
|
||||
wxCAPTION|wxMINIMIZE_BOX|wxSYSTEM_MENU|wxCLOSE_BOX|wxFULL_REPAINT_ON_RESIZE
|
||||
@@ -549,8 +549,8 @@ bool MyApp::OnInit()
|
||||
}
|
||||
else
|
||||
{
|
||||
index_filename = _T(DEFAULT_POETRY_IND);
|
||||
data_filename = _T(DEFAULT_POETRY_DAT);
|
||||
index_filename = wxT(DEFAULT_POETRY_IND);
|
||||
data_filename = wxT(DEFAULT_POETRY_DAT);
|
||||
}
|
||||
TryLoadIndex();
|
||||
|
||||
@@ -593,20 +593,20 @@ MyCanvas::MyCanvas(wxFrame *frame):
|
||||
wxWindow(frame, wxID_ANY)
|
||||
{
|
||||
m_popupMenu = new wxMenu;
|
||||
m_popupMenu->Append(POEM_NEXT, _T("Next poem/page"));
|
||||
m_popupMenu->Append(POEM_PREVIOUS, _T("Previous page"));
|
||||
m_popupMenu->Append(POEM_NEXT, wxT("Next poem/page"));
|
||||
m_popupMenu->Append(POEM_PREVIOUS, wxT("Previous page"));
|
||||
m_popupMenu->AppendSeparator();
|
||||
m_popupMenu->Append(POEM_SEARCH, _T("Search"));
|
||||
m_popupMenu->Append(POEM_NEXT_MATCH, _T("Next match"));
|
||||
m_popupMenu->Append(POEM_COPY, _T("Copy to clipboard"));
|
||||
m_popupMenu->Append(POEM_MINIMIZE, _T("Minimize"));
|
||||
m_popupMenu->Append(POEM_SEARCH, wxT("Search"));
|
||||
m_popupMenu->Append(POEM_NEXT_MATCH, wxT("Next match"));
|
||||
m_popupMenu->Append(POEM_COPY, wxT("Copy to clipboard"));
|
||||
m_popupMenu->Append(POEM_MINIMIZE, wxT("Minimize"));
|
||||
m_popupMenu->AppendSeparator();
|
||||
m_popupMenu->Append(POEM_BIGGER_TEXT, _T("Bigger text"));
|
||||
m_popupMenu->Append(POEM_SMALLER_TEXT, _T("Smaller text"));
|
||||
m_popupMenu->Append(POEM_BIGGER_TEXT, wxT("Bigger text"));
|
||||
m_popupMenu->Append(POEM_SMALLER_TEXT, wxT("Smaller text"));
|
||||
m_popupMenu->AppendSeparator();
|
||||
m_popupMenu->Append(POEM_ABOUT, _T("About wxPoem"));
|
||||
m_popupMenu->Append(POEM_ABOUT, wxT("About wxPoem"));
|
||||
m_popupMenu->AppendSeparator();
|
||||
m_popupMenu->Append(POEM_EXIT, _T("Exit"));
|
||||
m_popupMenu->Append(POEM_EXIT, wxT("Exit"));
|
||||
}
|
||||
|
||||
MyCanvas::~MyCanvas()
|
||||
@@ -716,17 +716,17 @@ int LoadIndex(const wxChar *file_name)
|
||||
if (file_name == NULL)
|
||||
return 0;
|
||||
|
||||
wxSprintf(buf, _T("%s.idx"), file_name);
|
||||
wxSprintf(buf, wxT("%s.idx"), file_name);
|
||||
|
||||
index_file = wxFopen(buf, _T("r"));
|
||||
index_file = wxFopen(buf, wxT("r"));
|
||||
if (index_file == NULL)
|
||||
return 0;
|
||||
|
||||
wxFscanf(index_file, _T("%ld"), &nitems);
|
||||
wxFscanf(index_file, wxT("%ld"), &nitems);
|
||||
|
||||
for (int i = 0; i < nitems; i++)
|
||||
{
|
||||
wxFscanf(index_file, _T("%ld"), &data);
|
||||
wxFscanf(index_file, wxT("%ld"), &data);
|
||||
poem_index[i] = data;
|
||||
}
|
||||
|
||||
@@ -741,7 +741,7 @@ int GetIndex()
|
||||
int indexn = (int)(rand() % nitems);
|
||||
|
||||
if ((indexn < 0) || (indexn > nitems))
|
||||
{ PoetryError(_T("No such poem!"));
|
||||
{ PoetryError(wxT("No such poem!"));
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
@@ -753,9 +753,9 @@ void MainWindow::ReadPreferences()
|
||||
{
|
||||
/* TODO: convert this code to use wxConfig
|
||||
#if wxUSE_RESOURCES
|
||||
wxGetResource(_T("wxPoem"), _T("FontSize"), &pointSize);
|
||||
wxGetResource(_T("wxPoem"), _T("X"), &XPos);
|
||||
wxGetResource(_T("wxPoem"), _T("Y"), &YPos);
|
||||
wxGetResource(wxT("wxPoem"), wxT("FontSize"), &pointSize);
|
||||
wxGetResource(wxT("wxPoem"), wxT("X"), &XPos);
|
||||
wxGetResource(wxT("wxPoem"), wxT("Y"), &YPos);
|
||||
#endif
|
||||
*/
|
||||
}
|
||||
@@ -767,9 +767,9 @@ void MainWindow::WritePreferences()
|
||||
TheMainWindow->GetPosition(&XPos, &YPos);
|
||||
/* TODO: convert this code to use wxConfig
|
||||
#if wxUSE_RESOURCES
|
||||
wxWriteResource(_T("wxPoem"), _T("FontSize"), pointSize);
|
||||
wxWriteResource(_T("wxPoem"), _T("X"), XPos);
|
||||
wxWriteResource(_T("wxPoem"), _T("Y"), YPos);
|
||||
wxWriteResource(wxT("wxPoem"), wxT("FontSize"), pointSize);
|
||||
wxWriteResource(wxT("wxPoem"), wxT("X"), XPos);
|
||||
wxWriteResource(wxT("wxPoem"), wxT("Y"), YPos);
|
||||
#endif
|
||||
*/
|
||||
#endif
|
||||
@@ -791,17 +791,17 @@ bool LoadPoem(const wxChar *file_name, long position)
|
||||
|
||||
if (file_name == NULL)
|
||||
{
|
||||
wxSprintf(error_buf, _T("Error in Poem loading."));
|
||||
wxSprintf(error_buf, wxT("Error in Poem loading."));
|
||||
PoetryError(error_buf);
|
||||
return false;
|
||||
}
|
||||
|
||||
wxSprintf(buf, _T("%s.dat"), file_name);
|
||||
data_file = wxFopen(buf, _T("r"));
|
||||
wxSprintf(buf, wxT("%s.dat"), file_name);
|
||||
data_file = wxFopen(buf, wxT("r"));
|
||||
|
||||
if (data_file == NULL)
|
||||
{
|
||||
wxSprintf(error_buf, _T("Data file %s not found."), buf);
|
||||
wxSprintf(error_buf, wxT("Data file %s not found."), buf);
|
||||
PoetryError(error_buf);
|
||||
return false;
|
||||
}
|
||||
@@ -830,7 +830,7 @@ bool LoadPoem(const wxChar *file_name, long position)
|
||||
|
||||
if (i == BUFFER_SIZE)
|
||||
{
|
||||
wxSprintf(error_buf, _T("%s"), _T("Poetry buffer exceeded."));
|
||||
wxSprintf(error_buf, wxT("%s"), wxT("Poetry buffer exceeded."));
|
||||
PoetryError(error_buf);
|
||||
return false;
|
||||
}
|
||||
@@ -869,12 +869,12 @@ long MainWindow::DoSearch(void)
|
||||
}
|
||||
|
||||
if (data_filename)
|
||||
wxSprintf(buf, _T("%s.dat"), data_filename);
|
||||
wxSprintf(buf, wxT("%s.dat"), data_filename);
|
||||
|
||||
file = wxFopen(buf, _T("r"));
|
||||
file = wxFopen(buf, wxT("r"));
|
||||
if (! (data_filename && file))
|
||||
{
|
||||
wxSprintf(error_buf, _T("Poetry data file %s not found\n"), buf);
|
||||
wxSprintf(error_buf, wxT("Poetry data file %s not found\n"), buf);
|
||||
PoetryError(error_buf);
|
||||
return false;
|
||||
}
|
||||
@@ -928,7 +928,7 @@ void TryLoadIndex()
|
||||
index_ok = (LoadIndex(index_filename) != 0);
|
||||
if (!index_ok || (nitems == 0))
|
||||
{
|
||||
PoetryError(_T("Index file not found; will compile new one"), _T("wxPoem"));
|
||||
PoetryError(wxT("Index file not found; will compile new one"), wxT("wxPoem"));
|
||||
index_ok = Compile();
|
||||
}
|
||||
}
|
||||
@@ -955,12 +955,12 @@ bool Compile(void)
|
||||
wxChar buf[100];
|
||||
|
||||
if (data_filename)
|
||||
wxSprintf(buf, _T("%s.dat"), data_filename);
|
||||
wxSprintf(buf, wxT("%s.dat"), data_filename);
|
||||
|
||||
file = wxFopen(buf, _T("r"));
|
||||
file = wxFopen(buf, wxT("r"));
|
||||
if (! (data_filename && file))
|
||||
{
|
||||
wxSprintf(error_buf, _T("Poetry data file %s not found\n"), buf);
|
||||
wxSprintf(error_buf, wxT("Poetry data file %s not found\n"), buf);
|
||||
PoetryError(error_buf);
|
||||
return false;
|
||||
}
|
||||
@@ -987,22 +987,22 @@ bool Compile(void)
|
||||
fclose(file);
|
||||
|
||||
if (index_filename)
|
||||
wxSprintf(buf, _T("%s.idx"), index_filename);
|
||||
wxSprintf(buf, wxT("%s.idx"), index_filename);
|
||||
|
||||
file = wxFopen(buf, _T("w"));
|
||||
file = wxFopen(buf, wxT("w"));
|
||||
if (! (data_filename && file))
|
||||
{
|
||||
wxSprintf(error_buf, _T("Poetry index file %s cannot be created\n"), buf);
|
||||
wxSprintf(error_buf, wxT("Poetry index file %s cannot be created\n"), buf);
|
||||
PoetryError(error_buf);
|
||||
return false;
|
||||
}
|
||||
|
||||
wxFprintf(file, _T("%ld\n\n"), nitems);
|
||||
wxFprintf(file, wxT("%ld\n\n"), nitems);
|
||||
for (j = 0; j < nitems; j++)
|
||||
wxFprintf(file, _T("%ld\n"), poem_index[j]);
|
||||
wxFprintf(file, wxT("%ld\n"), poem_index[j]);
|
||||
|
||||
fclose(file);
|
||||
PoetryNotify(_T("Poetry index compiled."));
|
||||
PoetryNotify(wxT("Poetry index compiled."));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1036,18 +1036,18 @@ void MainWindow::OnPopup(wxCommandEvent& event)
|
||||
{
|
||||
static wxString s;
|
||||
s = poem_buffer;
|
||||
s.Replace( _T("@P"),wxEmptyString);
|
||||
s.Replace( _T("@A "),wxEmptyString);
|
||||
s.Replace( _T("@A"),wxEmptyString);
|
||||
s.Replace( _T("@T "),wxEmptyString);
|
||||
s.Replace( _T("@T"),wxEmptyString);
|
||||
s.Replace( wxT("@P"),wxEmptyString);
|
||||
s.Replace( wxT("@A "),wxEmptyString);
|
||||
s.Replace( wxT("@A"),wxEmptyString);
|
||||
s.Replace( wxT("@T "),wxEmptyString);
|
||||
s.Replace( wxT("@T"),wxEmptyString);
|
||||
wxTextDataObject *data = new wxTextDataObject( s.c_str() );
|
||||
if (!wxTheClipboard->SetData( data ))
|
||||
wxMessageBox(_T("Error while copying to the clipboard."));
|
||||
wxMessageBox(wxT("Error while copying to the clipboard."));
|
||||
}
|
||||
else
|
||||
{
|
||||
wxMessageBox(_T("Error opening the clipboard."));
|
||||
wxMessageBox(wxT("Error opening the clipboard."));
|
||||
}
|
||||
wxTheClipboard->Close();
|
||||
break;
|
||||
@@ -1066,8 +1066,8 @@ void MainWindow::OnPopup(wxCommandEvent& event)
|
||||
}
|
||||
break;
|
||||
case POEM_ABOUT:
|
||||
(void)wxMessageBox(_T("wxPoem Version 1.1\nJulian Smart (c) 1995"),
|
||||
_T("About wxPoem"), wxOK, TheMainWindow);
|
||||
(void)wxMessageBox(wxT("wxPoem Version 1.1\nJulian Smart (c) 1995"),
|
||||
wxT("About wxPoem"), wxOK, TheMainWindow);
|
||||
break;
|
||||
case POEM_EXIT:
|
||||
// Exit
|
||||
|
Reference in New Issue
Block a user