Remove more wxT() macros from samples

Also use wxString instead of wxChar* strings.

Closes https://github.com/wxWidgets/wxWidgets/pull/950
This commit is contained in:
Blake Eryx
2018-09-28 21:45:15 -04:00
committed by Vadim Zeitlin
parent 480047ee9a
commit b70ed2d8c8
67 changed files with 1926 additions and 1932 deletions

View File

@@ -149,9 +149,9 @@ Edit::Edit (wxWindow *parent, wxWindowID id,
StyleSetFont (wxSTC_STYLE_DEFAULT, font);
StyleSetForeground (wxSTC_STYLE_DEFAULT, *wxBLACK);
StyleSetBackground (wxSTC_STYLE_DEFAULT, *wxWHITE);
StyleSetForeground (wxSTC_STYLE_LINENUMBER, wxColour (wxT("DARK GREY")));
StyleSetForeground (wxSTC_STYLE_LINENUMBER, wxColour ("DARK GREY"));
StyleSetBackground (wxSTC_STYLE_LINENUMBER, *wxWHITE);
StyleSetForeground(wxSTC_STYLE_INDENTGUIDE, wxColour (wxT("DARK GREY")));
StyleSetForeground(wxSTC_STYLE_INDENTGUIDE, wxColour ("DARK GREY"));
InitializePrefs (DEFAULT_LANGUAGE);
// set visibility
@@ -160,19 +160,19 @@ Edit::Edit (wxWindow *parent, wxWindowID id,
SetYCaretPolicy (wxSTC_CARET_EVEN|wxSTC_VISIBLE_STRICT|wxSTC_CARET_SLOP, 1);
// markers
MarkerDefine (wxSTC_MARKNUM_FOLDER, wxSTC_MARK_DOTDOTDOT, wxT("BLACK"), wxT("BLACK"));
MarkerDefine (wxSTC_MARKNUM_FOLDEROPEN, wxSTC_MARK_ARROWDOWN, wxT("BLACK"), wxT("BLACK"));
MarkerDefine (wxSTC_MARKNUM_FOLDERSUB, wxSTC_MARK_EMPTY, wxT("BLACK"), wxT("BLACK"));
MarkerDefine (wxSTC_MARKNUM_FOLDEREND, wxSTC_MARK_DOTDOTDOT, wxT("BLACK"), wxT("WHITE"));
MarkerDefine (wxSTC_MARKNUM_FOLDEROPENMID, wxSTC_MARK_ARROWDOWN, wxT("BLACK"), wxT("WHITE"));
MarkerDefine (wxSTC_MARKNUM_FOLDERMIDTAIL, wxSTC_MARK_EMPTY, wxT("BLACK"), wxT("BLACK"));
MarkerDefine (wxSTC_MARKNUM_FOLDERTAIL, wxSTC_MARK_EMPTY, wxT("BLACK"), wxT("BLACK"));
MarkerDefine (wxSTC_MARKNUM_FOLDER, wxSTC_MARK_DOTDOTDOT, "BLACK", "BLACK");
MarkerDefine (wxSTC_MARKNUM_FOLDEROPEN, wxSTC_MARK_ARROWDOWN, "BLACK", "BLACK");
MarkerDefine (wxSTC_MARKNUM_FOLDERSUB, wxSTC_MARK_EMPTY, "BLACK", "BLACK");
MarkerDefine (wxSTC_MARKNUM_FOLDEREND, wxSTC_MARK_DOTDOTDOT, "BLACK", "WHITE");
MarkerDefine (wxSTC_MARKNUM_FOLDEROPENMID, wxSTC_MARK_ARROWDOWN, "BLACK", "WHITE");
MarkerDefine (wxSTC_MARKNUM_FOLDERMIDTAIL, wxSTC_MARK_EMPTY, "BLACK", "BLACK");
MarkerDefine (wxSTC_MARKNUM_FOLDERTAIL, wxSTC_MARK_EMPTY, "BLACK", "BLACK");
// annotations
AnnotationSetVisible(wxSTC_ANNOTATION_BOXED);
// miscellaneous
m_LineNrMargin = TextWidth (wxSTC_STYLE_LINENUMBER, wxT("_999999"));
m_LineNrMargin = TextWidth (wxSTC_STYLE_LINENUMBER, "_999999");
m_FoldingMargin = 16;
CmdKeyClear (wxSTC_KEY_TAB, 0); // this is done by the menu accelerator key
SetLayoutCache (wxSTC_CACHE_PAGE);
@@ -501,8 +501,8 @@ wxString Edit::DeterminePrefs (const wxString &filename) {
while (!filepattern.empty()) {
wxString cur = filepattern.BeforeFirst (';');
if ((cur == filename) ||
(cur == (filename.BeforeLast ('.') + wxT(".*"))) ||
(cur == (wxT("*.") + filename.AfterLast ('.')))) {
(cur == (filename.BeforeLast ('.') + ".*")) ||
(cur == ("*." + filename.AfterLast ('.')))) {
return curInfo->name;
}
filepattern = filepattern.AfterFirst (';');
@@ -536,7 +536,7 @@ bool Edit::InitializePrefs (const wxString &name) {
// set margin for line numbers
SetMarginType (m_LineNrID, wxSTC_MARGIN_NUMBER);
StyleSetForeground (wxSTC_STYLE_LINENUMBER, wxColour (wxT("DARK GREY")));
StyleSetForeground (wxSTC_STYLE_LINENUMBER, wxColour ("DARK GREY"));
StyleSetBackground (wxSTC_STYLE_LINENUMBER, *wxWHITE);
SetMarginWidth (m_LineNrID, 0); // start out not visible
@@ -554,8 +554,8 @@ bool Edit::InitializePrefs (const wxString &name) {
}
// set common styles
StyleSetForeground (wxSTC_STYLE_DEFAULT, wxColour (wxT("DARK GREY")));
StyleSetForeground (wxSTC_STYLE_INDENTGUIDE, wxColour (wxT("DARK GREY")));
StyleSetForeground (wxSTC_STYLE_DEFAULT, wxColour ("DARK GREY"));
StyleSetForeground (wxSTC_STYLE_INDENTGUIDE, wxColour ("DARK GREY"));
// initialize settings
if (g_CommonPrefs.syntaxEnable) {
@@ -567,10 +567,10 @@ bool Edit::InitializePrefs (const wxString &name) {
.Family(wxFONTFAMILY_MODERN)
.FaceName(curType.fontname));
StyleSetFont (Nr, font);
if (curType.foreground) {
if (curType.foreground.length()) {
StyleSetForeground (Nr, wxColour (curType.foreground));
}
if (curType.background) {
if (curType.background.length()) {
StyleSetBackground (Nr, wxColour (curType.background));
}
StyleSetBold (Nr, (curType.fontstyle & mySTC_STYLE_BOLD) > 0);
@@ -600,21 +600,21 @@ bool Edit::InitializePrefs (const wxString &name) {
if (g_CommonPrefs.foldEnable) {
SetMarginWidth (m_FoldingID, curInfo->folds != 0? m_FoldingMargin: 0);
SetMarginSensitive (m_FoldingID, curInfo->folds != 0);
SetProperty (wxT("fold"), curInfo->folds != 0? wxT("1"): wxT("0"));
SetProperty (wxT("fold.comment"),
(curInfo->folds & mySTC_FOLD_COMMENT) > 0? wxT("1"): wxT("0"));
SetProperty (wxT("fold.compact"),
(curInfo->folds & mySTC_FOLD_COMPACT) > 0? wxT("1"): wxT("0"));
SetProperty (wxT("fold.preprocessor"),
(curInfo->folds & mySTC_FOLD_PREPROC) > 0? wxT("1"): wxT("0"));
SetProperty (wxT("fold.html"),
(curInfo->folds & mySTC_FOLD_HTML) > 0? wxT("1"): wxT("0"));
SetProperty (wxT("fold.html.preprocessor"),
(curInfo->folds & mySTC_FOLD_HTMLPREP) > 0? wxT("1"): wxT("0"));
SetProperty (wxT("fold.comment.python"),
(curInfo->folds & mySTC_FOLD_COMMENTPY) > 0? wxT("1"): wxT("0"));
SetProperty (wxT("fold.quotes.python"),
(curInfo->folds & mySTC_FOLD_QUOTESPY) > 0? wxT("1"): wxT("0"));
SetProperty ("fold", curInfo->folds != 0? "1": "0");
SetProperty ("fold.comment",
(curInfo->folds & mySTC_FOLD_COMMENT) > 0? "1": "0");
SetProperty ("fold.compact",
(curInfo->folds & mySTC_FOLD_COMPACT) > 0? "1": "0");
SetProperty ("fold.preprocessor",
(curInfo->folds & mySTC_FOLD_PREPROC) > 0? "1": "0");
SetProperty ("fold.html",
(curInfo->folds & mySTC_FOLD_HTML) > 0? "1": "0");
SetProperty ("fold.html.preprocessor",
(curInfo->folds & mySTC_FOLD_HTMLPREP) > 0? "1": "0");
SetProperty ("fold.comment.python",
(curInfo->folds & mySTC_FOLD_COMMENTPY) > 0? "1": "0");
SetProperty ("fold.quotes.python",
(curInfo->folds & mySTC_FOLD_QUOTESPY) > 0? "1": "0");
}
SetFoldFlags (wxSTC_FOLDFLAG_LINEBEFORE_CONTRACTED |
wxSTC_FOLDFLAG_LINEAFTER_CONTRACTED);
@@ -646,8 +646,8 @@ bool Edit::LoadFile ()
#if wxUSE_FILEDLG
// get filename
if (!m_filename) {
wxFileDialog dlg (this, wxT("Open file"), wxEmptyString, wxEmptyString,
wxT("Any file (*)|*"), wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR);
wxFileDialog dlg (this, "Open file", wxEmptyString, wxEmptyString,
"Any file (*)|*", wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR);
if (dlg.ShowModal() != wxID_OK) return false;
m_filename = dlg.GetPath();
}
@@ -683,7 +683,7 @@ bool Edit::SaveFile ()
// get filename
if (!m_filename) {
wxFileDialog dlg (this, wxT("Save file"), wxEmptyString, wxEmptyString, wxT("Any file (*)|*"),
wxFileDialog dlg (this, "Save file", wxEmptyString, wxEmptyString, "Any file (*)|*",
wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
if (dlg.ShowModal() != wxID_OK) return false;
m_filename = dlg.GetPath();
@@ -757,14 +757,14 @@ EditProperties::EditProperties (Edit *edit,
textinfo->Add (new wxStaticText (this, wxID_ANY, _("Lexer-ID: "),
wxDefaultPosition, wxSize(80, wxDefaultCoord)),
0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT, 4);
text = wxString::Format (wxT("%d"), edit->GetLexer());
text = wxString::Format ("%d", edit->GetLexer());
textinfo->Add (new wxStaticText (this, wxID_ANY, text),
0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxRIGHT, 4);
wxString EOLtype = wxEmptyString;
switch (edit->GetEOLMode()) {
case wxSTC_EOL_CR: {EOLtype = wxT("CR (Unix)"); break; }
case wxSTC_EOL_CRLF: {EOLtype = wxT("CRLF (Windows)"); break; }
case wxSTC_EOL_LF: {EOLtype = wxT("CR (Macintosh)"); break; }
case wxSTC_EOL_CR: {EOLtype = "CR (Unix)"; break; }
case wxSTC_EOL_CRLF: {EOLtype = "CRLF (Windows)"; break; }
case wxSTC_EOL_LF: {EOLtype = "CR (Macintosh)"; break; }
}
textinfo->Add (new wxStaticText (this, wxID_ANY, _("Line endings"),
wxDefaultPosition, wxSize(80, wxDefaultCoord)),
@@ -774,7 +774,7 @@ EditProperties::EditProperties (Edit *edit,
// text info box
wxStaticBoxSizer *textinfos = new wxStaticBoxSizer (
new wxStaticBox (this, wxID_ANY, _("Informations")),
new wxStaticBox (this, wxID_ANY, _("Information")),
wxVERTICAL);
textinfos->Add (textinfo, 0, wxEXPAND);
textinfos->Add (0, 6);
@@ -784,25 +784,25 @@ EditProperties::EditProperties (Edit *edit,
statistic->Add (new wxStaticText (this, wxID_ANY, _("Total lines"),
wxDefaultPosition, wxSize(80, wxDefaultCoord)),
0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT, 4);
text = wxString::Format (wxT("%d"), edit->GetLineCount());
text = wxString::Format ("%d", edit->GetLineCount());
statistic->Add (new wxStaticText (this, wxID_ANY, text),
0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxRIGHT, 4);
statistic->Add (new wxStaticText (this, wxID_ANY, _("Total chars"),
wxDefaultPosition, wxSize(80, wxDefaultCoord)),
0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT, 4);
text = wxString::Format (wxT("%d"), edit->GetTextLength());
text = wxString::Format ("%d", edit->GetTextLength());
statistic->Add (new wxStaticText (this, wxID_ANY, text),
0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxRIGHT, 4);
statistic->Add (new wxStaticText (this, wxID_ANY, _("Current line"),
wxDefaultPosition, wxSize(80, wxDefaultCoord)),
0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT, 4);
text = wxString::Format (wxT("%d"), edit->GetCurrentLine());
text = wxString::Format ("%d", edit->GetCurrentLine());
statistic->Add (new wxStaticText (this, wxID_ANY, text),
0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxRIGHT, 4);
statistic->Add (new wxStaticText (this, wxID_ANY, _("Current pos"),
wxDefaultPosition, wxSize(80, wxDefaultCoord)),
0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT, 4);
text = wxString::Format (wxT("%d"), edit->GetCurrentPos());
text = wxString::Format ("%d", edit->GetCurrentPos());
statistic->Add (new wxStaticText (this, wxID_ANY, text),
0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxRIGHT, 4);
@@ -836,7 +836,7 @@ EditProperties::EditProperties (Edit *edit,
// EditPrint
//----------------------------------------------------------------------------
EditPrint::EditPrint (Edit *edit, const wxChar *title)
EditPrint::EditPrint (Edit *edit, const wxString& title)
: wxPrintout(title)
, m_edit(edit)
{