Stop using wxWidgets 1.xx wxString compatibility functions
Replace them with std::string-like equivalents when possible (i.e. replace Length() with length(), IsNull() with empty()) or, at least, with wx 2 functions if not (e.g. Remove() with Truncate(), First() with Find(), LowerCase() with MakeLower() etc). Closes #22638.
This commit is contained in:
parent
541be26e78
commit
c69ee439d9
26 changed files with 58 additions and 58 deletions
|
|
@ -255,7 +255,7 @@ MyConnection::OnRequest(const wxString& topic,
|
||||||
m_sRequestDate = wxDateTime::Now().FormatTime() +
|
m_sRequestDate = wxDateTime::Now().FormatTime() +
|
||||||
" " + wxDateTime::Now().FormatDate();
|
" " + wxDateTime::Now().FormatDate();
|
||||||
data = m_sRequestDate.c_str();
|
data = m_sRequestDate.c_str();
|
||||||
*size = m_sRequestDate.Length() + 1;
|
*size = m_sRequestDate.length() + 1;
|
||||||
}
|
}
|
||||||
else if (item == "bytes[3]")
|
else if (item == "bytes[3]")
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -184,7 +184,7 @@ void MyApp::DecorateSplashScreen(wxBitmap& bmp)
|
||||||
// create a copyright notice that uses the year that this file was compiled
|
// create a copyright notice that uses the year that this file was compiled
|
||||||
wxString year(__DATE__);
|
wxString year(__DATE__);
|
||||||
wxString copyrightLabel = wxString::Format("%s%s wxWidgets. %s",
|
wxString copyrightLabel = wxString::Format("%s%s wxWidgets. %s",
|
||||||
wxString::FromUTF8("\xc2\xa9"), year.Mid(year.Length() - 4),
|
wxString::FromUTF8("\xc2\xa9"), year.Mid(year.length() - 4),
|
||||||
"All rights reserved.");
|
"All rights reserved.");
|
||||||
|
|
||||||
// draw the (white) labels inside of our orange box (at the bottom of the splashscreen)
|
// draw the (white) labels inside of our orange box (at the bottom of the splashscreen)
|
||||||
|
|
|
||||||
|
|
@ -166,7 +166,7 @@ wxString wxAuiChopText(wxDC& dc, const wxString& text, int max_size)
|
||||||
if (x <= max_size)
|
if (x <= max_size)
|
||||||
return text;
|
return text;
|
||||||
|
|
||||||
size_t i, len = text.Length();
|
size_t i, len = text.length();
|
||||||
size_t last_good_length = 0;
|
size_t last_good_length = 0;
|
||||||
for (i = 0; i < len; ++i)
|
for (i = 0; i < len; ++i)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -863,7 +863,7 @@ wxDateTime::ParseRfc822Date(const wxString& originalDate, wxString::const_iterat
|
||||||
// 1. week day (optional)
|
// 1. week day (optional)
|
||||||
// if there is a week day present, it must be separated
|
// if there is a week day present, it must be separated
|
||||||
// by a comma at position [3].
|
// by a comma at position [3].
|
||||||
if ( date.Length() > 3 && date[3] == ',' )
|
if ( date.length() > 3 && date[3] == ',' )
|
||||||
{
|
{
|
||||||
const wxDateTime::WeekDay
|
const wxDateTime::WeekDay
|
||||||
wd = GetWeekDayFromName(p, pEnd, Name_Abbr, DateLang_English);
|
wd = GetWeekDayFromName(p, pEnd, Name_Abbr, DateLang_English);
|
||||||
|
|
|
||||||
|
|
@ -1281,7 +1281,7 @@ bool wxGCDCImpl::DoGetPartialTextExtents(const wxString& text, wxArrayInt& width
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( m_graphicContext, false, wxT("wxGCDC(cg)::DoGetPartialTextExtents - invalid DC") );
|
wxCHECK_MSG( m_graphicContext, false, wxT("wxGCDC(cg)::DoGetPartialTextExtents - invalid DC") );
|
||||||
widths.Clear();
|
widths.Clear();
|
||||||
widths.Add(0,text.Length());
|
widths.Add(0,text.length());
|
||||||
if ( text.IsEmpty() )
|
if ( text.IsEmpty() )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -367,7 +367,7 @@ static wxString MakeCorrectPath(const wxString& path)
|
||||||
if (j >= 0 && r.GetChar(j) != wxT(':'))
|
if (j >= 0 && r.GetChar(j) != wxT(':'))
|
||||||
{
|
{
|
||||||
for (j = j - 1; j >= 0 && r.GetChar(j) != wxT('/') && r.GetChar(j) != wxT(':'); j--) {}
|
for (j = j - 1; j >= 0 && r.GetChar(j) != wxT('/') && r.GetChar(j) != wxT(':'); j--) {}
|
||||||
r.Remove(j + 1);
|
r.Truncate(j + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -417,7 +417,7 @@ void wxFileSystem::ChangePathTo(const wxString& location, bool is_dir)
|
||||||
{
|
{
|
||||||
if (m_Path[(unsigned int) i] == wxT(':'))
|
if (m_Path[(unsigned int) i] == wxT(':'))
|
||||||
{
|
{
|
||||||
m_Path.Remove(i+1);
|
m_Path.Truncate(i+1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -426,7 +426,7 @@ void wxFileSystem::ChangePathTo(const wxString& location, bool is_dir)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_Path.Remove(pathpos+1);
|
m_Path.Truncate(pathpos+1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@ static const char hexArray[] = "0123456789ABCDEF";
|
||||||
// Convert 2-digit hex number to decimal
|
// Convert 2-digit hex number to decimal
|
||||||
int wxHexToDec(const wxString& str)
|
int wxHexToDec(const wxString& str)
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( str.Length() >= 2, -1, wxS("Invalid argument") );
|
wxCHECK_MSG( str.length() >= 2, -1, wxS("Invalid argument") );
|
||||||
|
|
||||||
char buf[2];
|
char buf[2];
|
||||||
buf[0] = str.GetChar(0);
|
buf[0] = str.GetChar(0);
|
||||||
|
|
|
||||||
|
|
@ -747,7 +747,7 @@ void wxFileListCtrl::OnListEndLabelEdit( wxListEvent &event )
|
||||||
if ((event.GetLabel().empty()) ||
|
if ((event.GetLabel().empty()) ||
|
||||||
(event.GetLabel() == wxT(".")) ||
|
(event.GetLabel() == wxT(".")) ||
|
||||||
(event.GetLabel() == wxT("..")) ||
|
(event.GetLabel() == wxT("..")) ||
|
||||||
(event.GetLabel().First( wxFILE_SEP_PATH ) != wxNOT_FOUND))
|
(event.GetLabel().Find( wxFILE_SEP_PATH ) != wxNOT_FOUND))
|
||||||
{
|
{
|
||||||
wxMessageDialog dialog(this, _("Illegal directory name."), _("Error"), wxOK | wxICON_ERROR );
|
wxMessageDialog dialog(this, _("Illegal directory name."), _("Error"), wxOK | wxICON_ERROR );
|
||||||
dialog.ShowModal();
|
dialog.ShowModal();
|
||||||
|
|
|
||||||
|
|
@ -2985,7 +2985,7 @@ void wxCairoContext::GetPartialTextExtents(const wxString& text, wxArrayDouble&
|
||||||
while (i++ < len)
|
while (i++ < len)
|
||||||
widths.Add(PANGO_PIXELS(w));
|
widths.Add(PANGO_PIXELS(w));
|
||||||
#else
|
#else
|
||||||
for (size_t i = 0; i < text.Length(); i++)
|
for (size_t i = 0; i < text.length(); i++)
|
||||||
{
|
{
|
||||||
const wxCharBuffer data = text.SubString(0, i).utf8_str();
|
const wxCharBuffer data = text.SubString(0, i).utf8_str();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -399,7 +399,7 @@ bool wxExtHelpController::KeywordSearch(const wxString& k,
|
||||||
if (! showAll)
|
if (! showAll)
|
||||||
{
|
{
|
||||||
compA = k;
|
compA = k;
|
||||||
compA.LowerCase();
|
compA.MakeLower();
|
||||||
}
|
}
|
||||||
|
|
||||||
while (node)
|
while (node)
|
||||||
|
|
@ -410,7 +410,7 @@ bool wxExtHelpController::KeywordSearch(const wxString& k,
|
||||||
bool testTarget = ! compB.empty();
|
bool testTarget = ! compB.empty();
|
||||||
if (testTarget && ! showAll)
|
if (testTarget && ! showAll)
|
||||||
{
|
{
|
||||||
compB.LowerCase();
|
compB.MakeLower();
|
||||||
testTarget = compB.Contains(compA);
|
testTarget = compB.Contains(compA);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -891,7 +891,7 @@ void wxHtmlSearchEngine::LookFor(const wxString& keyword, bool case_sensitive, b
|
||||||
m_Keyword = keyword;
|
m_Keyword = keyword;
|
||||||
|
|
||||||
if (!m_CaseSensitive)
|
if (!m_CaseSensitive)
|
||||||
m_Keyword.LowerCase();
|
m_Keyword.MakeLower();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -937,7 +937,7 @@ bool wxHtmlSearchEngine::Scan(const wxFSFile& file)
|
||||||
wxString bufStr = filter.ReadFile(file);
|
wxString bufStr = filter.ReadFile(file);
|
||||||
|
|
||||||
if (!m_CaseSensitive)
|
if (!m_CaseSensitive)
|
||||||
bufStr.LowerCase();
|
bufStr.MakeLower();
|
||||||
|
|
||||||
{ // remove html tags
|
{ // remove html tags
|
||||||
wxString bufStrCopy;
|
wxString bufStrCopy;
|
||||||
|
|
|
||||||
|
|
@ -479,7 +479,7 @@ void wxHtmlWordCell::Draw(wxDC& dc, int x, int y,
|
||||||
}
|
}
|
||||||
|
|
||||||
int part1 = s->GetFromCell()==this ? s->GetFromCharacterPos() : 0;
|
int part1 = s->GetFromCell()==this ? s->GetFromCharacterPos() : 0;
|
||||||
int part2 = s->GetToCell()==this ? s->GetToCharacterPos() : m_Word.Length();
|
int part2 = s->GetToCell()==this ? s->GetToCharacterPos() : m_Word.length();
|
||||||
|
|
||||||
if ( part1 > 0 )
|
if ( part1 > 0 )
|
||||||
{
|
{
|
||||||
|
|
@ -581,7 +581,7 @@ wxString wxHtmlWordCell::ConvertToText(wxHtmlSelection *s) const
|
||||||
if ( s->AreFromToCharacterPosSet() )
|
if ( s->AreFromToCharacterPosSet() )
|
||||||
{
|
{
|
||||||
const int part1 = s->GetFromCell()==this ? s->GetFromCharacterPos() : 0;
|
const int part1 = s->GetFromCell()==this ? s->GetFromCharacterPos() : 0;
|
||||||
const int part2 = s->GetToCell()==this ? s->GetToCharacterPos() : m_Word.Length();
|
const int part2 = s->GetToCell()==this ? s->GetToCharacterPos() : m_Word.length();
|
||||||
if ( part1 == part2 )
|
if ( part1 == part2 )
|
||||||
return wxEmptyString;
|
return wxEmptyString;
|
||||||
return GetPartAsText(part1, part2);
|
return GetPartAsText(part1, part2);
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ wxHtmlStyleParams::wxHtmlStyleParams(const wxHtmlTag& tag)
|
||||||
m_names.Add(tempString);
|
m_names.Add(tempString);
|
||||||
|
|
||||||
// Extract and trim values
|
// Extract and trim values
|
||||||
tempString = token.SubString(colonIndex + 1, token.Length() - 1);
|
tempString = token.SubString(colonIndex + 1, token.length() - 1);
|
||||||
tempString.Trim(true).Trim(false);
|
tempString.Trim(true).Trim(false);
|
||||||
// Add to values list
|
// Add to values list
|
||||||
m_values.Add(tempString);
|
m_values.Add(tempString);
|
||||||
|
|
|
||||||
|
|
@ -3239,11 +3239,11 @@ wxD2DFontData::wxD2DFontData(wxGraphicsRenderer* renderer, const wxFont& font, c
|
||||||
// The length of the font name must not exceed LF_FACESIZE TCHARs,
|
// The length of the font name must not exceed LF_FACESIZE TCHARs,
|
||||||
// including the terminating NULL.
|
// including the terminating NULL.
|
||||||
wxString name = font.GetFaceName().Mid(0, WXSIZEOF(logfont.lfFaceName)-1);
|
wxString name = font.GetFaceName().Mid(0, WXSIZEOF(logfont.lfFaceName)-1);
|
||||||
for (unsigned int i = 0; i < name.Length(); ++i)
|
for (unsigned int i = 0; i < name.length(); ++i)
|
||||||
{
|
{
|
||||||
logfont.lfFaceName[i] = name.GetChar(i);
|
logfont.lfFaceName[i] = name.GetChar(i);
|
||||||
}
|
}
|
||||||
logfont.lfFaceName[name.Length()] = L'\0';
|
logfont.lfFaceName[name.length()] = L'\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
wxCOMPtr<IDWriteFontFamily> fontFamily;
|
wxCOMPtr<IDWriteFontFamily> fontFamily;
|
||||||
|
|
@ -3860,7 +3860,7 @@ public:
|
||||||
|
|
||||||
static void GetPartialTextExtents(wxD2DFontData* fontData, const wxString& text, wxArrayDouble& widths)
|
static void GetPartialTextExtents(wxD2DFontData* fontData, const wxString& text, wxArrayDouble& widths)
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < text.Length(); ++i)
|
for (unsigned int i = 0; i < text.length(); ++i)
|
||||||
{
|
{
|
||||||
wxDouble width;
|
wxDouble width;
|
||||||
GetTextExtent(fontData, text.SubString(0, i), &width, NULL, NULL, NULL);
|
GetTextExtent(fontData, text.SubString(0, i), &width, NULL, NULL, NULL);
|
||||||
|
|
|
||||||
|
|
@ -161,7 +161,7 @@ wxWindow* wxWindow::CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd)
|
||||||
wxCHECK_MSG( parent, NULL, wxT("must have valid parent for a control") );
|
wxCHECK_MSG( parent, NULL, wxT("must have valid parent for a control") );
|
||||||
|
|
||||||
wxString str(wxGetWindowClass(hWnd));
|
wxString str(wxGetWindowClass(hWnd));
|
||||||
str.UpperCase();
|
str.MakeUpper();
|
||||||
|
|
||||||
long id = wxGetWindowId(hWnd);
|
long id = wxGetWindowId(hWnd);
|
||||||
long style = GetWindowLong((HWND) hWnd, GWL_STYLE);
|
long style = GetWindowLong((HWND) hWnd, GWL_STYLE);
|
||||||
|
|
|
||||||
|
|
@ -408,7 +408,7 @@ WXHRGN wxStaticBox::MSWGetRegionWithoutChildren()
|
||||||
|
|
||||||
wxMSWWinStyleUpdater updateStyle(child);
|
wxMSWWinStyleUpdater updateStyle(child);
|
||||||
wxString str(wxGetWindowClass(child));
|
wxString str(wxGetWindowClass(child));
|
||||||
str.UpperCase();
|
str.MakeUpper();
|
||||||
if ( str == wxT("BUTTON") && updateStyle.IsOn(BS_GROUPBOX) )
|
if ( str == wxT("BUTTON") && updateStyle.IsOn(BS_GROUPBOX) )
|
||||||
{
|
{
|
||||||
if ( child == GetHwnd() )
|
if ( child == GetHwnd() )
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ wxString wxStringProperty::ValueToString( wxVariant& value,
|
||||||
// If string is password and value is for visual purposes,
|
// If string is password and value is for visual purposes,
|
||||||
// then return asterisks instead the actual string.
|
// then return asterisks instead the actual string.
|
||||||
if ( (m_flags & wxPG_PROP_PASSWORD) && !(argFlags & (wxPG_FULL_VALUE|wxPG_EDITABLE_VALUE)) )
|
if ( (m_flags & wxPG_PROP_PASSWORD) && !(argFlags & (wxPG_FULL_VALUE|wxPG_EDITABLE_VALUE)) )
|
||||||
return wxString(wxS('*'), s.Length());
|
return wxString(wxS('*'), s.length());
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -428,7 +428,7 @@ public:
|
||||||
|
|
||||||
QVector<int> roles;
|
QVector<int> roles;
|
||||||
|
|
||||||
if ( (info.m_mask & wxLIST_MASK_TEXT) && !info.GetText().IsNull() )
|
if ( (info.m_mask & wxLIST_MASK_TEXT) && !info.GetText().empty() )
|
||||||
{
|
{
|
||||||
columnItem.m_label = wxQtConvertString(info.GetText());
|
columnItem.m_label = wxQtConvertString(info.GetText());
|
||||||
roles.push_back(Qt::DisplayRole);
|
roles.push_back(Qt::DisplayRole);
|
||||||
|
|
|
||||||
|
|
@ -4750,7 +4750,7 @@ bool wxRichTextParagraphLayoutBox::FindNextParagraphNumber(wxRichTextParagraph*
|
||||||
int pos = text.Find(wxT('.'), true);
|
int pos = text.Find(wxT('.'), true);
|
||||||
if (pos != wxNOT_FOUND)
|
if (pos != wxNOT_FOUND)
|
||||||
{
|
{
|
||||||
text = text.Mid(0, text.Length() - pos - 1);
|
text = text.Mid(0, text.length() - pos - 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
text.clear();
|
text.clear();
|
||||||
|
|
@ -6831,7 +6831,7 @@ bool wxRichTextPlainText::Draw(wxDC& dc, wxRichTextDrawingContext& context, cons
|
||||||
const wxString* pWholeString = &m_text;
|
const wxString* pWholeString = &m_text;
|
||||||
if (context.HasVirtualText(this))
|
if (context.HasVirtualText(this))
|
||||||
{
|
{
|
||||||
if (context.GetVirtualText(this, stringWhole) && stringWhole.Length() == m_text.Length())
|
if (context.GetVirtualText(this, stringWhole) && stringWhole.length() == m_text.length())
|
||||||
pWholeString = &stringWhole;
|
pWholeString = &stringWhole;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -6852,7 +6852,7 @@ bool wxRichTextPlainText::Draw(wxDC& dc, wxRichTextDrawingContext& context, cons
|
||||||
stringWhole = m_text;
|
stringWhole = m_text;
|
||||||
if (context.HasVirtualText(this))
|
if (context.HasVirtualText(this))
|
||||||
{
|
{
|
||||||
if (!context.GetVirtualText(this, stringWhole) || stringWhole.Length() != m_text.Length())
|
if (!context.GetVirtualText(this, stringWhole) || stringWhole.length() != m_text.length())
|
||||||
stringWhole = m_text;
|
stringWhole = m_text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -7264,7 +7264,7 @@ bool wxRichTextPlainText::GetRangeSize(const wxRichTextRange& range, wxSize& siz
|
||||||
const wxString* pWholeString = &m_text;
|
const wxString* pWholeString = &m_text;
|
||||||
if (context.HasVirtualText(this))
|
if (context.HasVirtualText(this))
|
||||||
{
|
{
|
||||||
if (context.GetVirtualText(this, stringWhole) && stringWhole.Length() == m_text.Length())
|
if (context.GetVirtualText(this, stringWhole) && stringWhole.length() == m_text.length())
|
||||||
pWholeString = &stringWhole;
|
pWholeString = &stringWhole;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -7535,7 +7535,7 @@ bool wxRichTextPlainText::CanSplit(wxRichTextDrawingContext& context) const
|
||||||
// If this object has any virtual attributes at all, whether for the whole object
|
// If this object has any virtual attributes at all, whether for the whole object
|
||||||
// or individual ones, we should try splitting it by calling Split.
|
// or individual ones, we should try splitting it by calling Split.
|
||||||
// Must be more than one character in order to be able to split.
|
// Must be more than one character in order to be able to split.
|
||||||
return m_text.Length() > 1 && context.HasVirtualAttributes(const_cast<wxRichTextPlainText*>(this));
|
return m_text.length() > 1 && context.HasVirtualAttributes(const_cast<wxRichTextPlainText*>(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
wxRichTextObject* wxRichTextPlainText::Split(wxRichTextDrawingContext& context)
|
wxRichTextObject* wxRichTextPlainText::Split(wxRichTextDrawingContext& context)
|
||||||
|
|
@ -7558,7 +7558,7 @@ wxRichTextObject* wxRichTextPlainText::Split(wxRichTextDrawingContext& context)
|
||||||
|
|
||||||
// We will gather up runs of text with the same virtual attributes
|
// We will gather up runs of text with the same virtual attributes
|
||||||
|
|
||||||
int len = m_text.Length();
|
int len = m_text.length();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
// runStart and runEnd represent the accumulated run with a consistent attribute
|
// runStart and runEnd represent the accumulated run with a consistent attribute
|
||||||
|
|
@ -8955,9 +8955,9 @@ bool wxRichTextBuffer::PasteFromClipboard(long position)
|
||||||
wxString text(data.GetText());
|
wxString text(data.GetText());
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
wxString text2;
|
wxString text2;
|
||||||
text2.Alloc(text.Length()+1);
|
text2.Alloc(text.length()+1);
|
||||||
size_t i;
|
size_t i;
|
||||||
for (i = 0; i < text.Length(); i++)
|
for (i = 0; i < text.length(); i++)
|
||||||
{
|
{
|
||||||
wxChar ch = text[i];
|
wxChar ch = text[i];
|
||||||
if (ch != wxT('\r'))
|
if (ch != wxT('\r'))
|
||||||
|
|
@ -8969,7 +8969,7 @@ bool wxRichTextBuffer::PasteFromClipboard(long position)
|
||||||
container->InsertTextWithUndo(this, position+1, text2, GetRichTextCtrl(), wxRICHTEXT_INSERT_WITH_PREVIOUS_PARAGRAPH_STYLE);
|
container->InsertTextWithUndo(this, position+1, text2, GetRichTextCtrl(), wxRICHTEXT_INSERT_WITH_PREVIOUS_PARAGRAPH_STYLE);
|
||||||
|
|
||||||
if (GetRichTextCtrl())
|
if (GetRichTextCtrl())
|
||||||
GetRichTextCtrl()->ShowPosition(position + text2.Length());
|
GetRichTextCtrl()->ShowPosition(position + text2.length());
|
||||||
|
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -934,7 +934,7 @@ void wxRichTextFontPage::OnFaceTextCtrlUpdated( wxCommandEvent& WXUNUSED(event)
|
||||||
size_t i;
|
size_t i;
|
||||||
for (i = 0; i < arr.GetCount(); i++)
|
for (i = 0; i < arr.GetCount(); i++)
|
||||||
{
|
{
|
||||||
if (arr[i].Mid(0, facename.Length()).Lower() == facename.Lower())
|
if (arr[i].Mid(0, facename.length()).Lower() == facename.Lower())
|
||||||
{
|
{
|
||||||
m_faceListBox->ScrollToRow(i);
|
m_faceListBox->ScrollToRow(i);
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -510,7 +510,7 @@ bool wxRichTextPlainText::ExportXML(wxOutputStream& stream, int indent, wxRichTe
|
||||||
int i;
|
int i;
|
||||||
int last = 0;
|
int last = 0;
|
||||||
const wxString& text = GetText();
|
const wxString& text = GetText();
|
||||||
int len = (int) text.Length();
|
int len = (int) text.length();
|
||||||
|
|
||||||
if (len == 0)
|
if (len == 0)
|
||||||
{
|
{
|
||||||
|
|
@ -624,7 +624,7 @@ bool wxRichTextPlainText::ExportXML(wxXmlNode* parent, wxRichTextXMLHandler* han
|
||||||
int i;
|
int i;
|
||||||
int last = 0;
|
int last = 0;
|
||||||
const wxString& text = GetText();
|
const wxString& text = GetText();
|
||||||
int len = (int) text.Length();
|
int len = (int) text.length();
|
||||||
|
|
||||||
if (len == 0)
|
if (len == 0)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -767,7 +767,7 @@ SurfaceFontDataD2D::SurfaceFontDataD2D(const FontParameters& fp)
|
||||||
m_pTextFormat->SetWordWrapping(DWRITE_WORD_WRAPPING_NO_WRAP);
|
m_pTextFormat->SetWordWrapping(DWRITE_WORD_WRAPPING_NO_WRAP);
|
||||||
|
|
||||||
hr = pDWriteFactory->CreateTextLayout(extentTest.wc_str(),
|
hr = pDWriteFactory->CreateTextLayout(extentTest.wc_str(),
|
||||||
extentTest.Length(), m_pTextFormat, FLT_MAX, FLT_MAX,
|
extentTest.length(), m_pTextFormat, FLT_MAX, FLT_MAX,
|
||||||
&pTextLayout);
|
&pTextLayout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -791,7 +791,7 @@ SurfaceFontDataD2D::SurfaceFontDataD2D(const FontParameters& fp)
|
||||||
m_ascent = lineMetrics[0].baseline;
|
m_ascent = lineMetrics[0].baseline;
|
||||||
m_descent = lineMetrics[0].height - lineMetrics[0].baseline;
|
m_descent = lineMetrics[0].height - lineMetrics[0].baseline;
|
||||||
m_internalLeading = lineMetrics[0].height - emHeight;
|
m_internalLeading = lineMetrics[0].height - emHeight;
|
||||||
m_averageCharWidth = textmetrics.width/extentTest.Length();
|
m_averageCharWidth = textmetrics.width/extentTest.length();
|
||||||
|
|
||||||
switch ( fp.extraFontFlag & wxSTC_EFF_QUALITY_MASK )
|
switch ( fp.extraFontFlag & wxSTC_EFF_QUALITY_MASK )
|
||||||
{
|
{
|
||||||
|
|
@ -1525,7 +1525,7 @@ XYPOSITION SurfaceD2D::WidthText(Font &font_, const char *s, int len)
|
||||||
DWRITE_TEXT_METRICS textMetrics = {0,0,0,0,0,0,0,0,0};
|
DWRITE_TEXT_METRICS textMetrics = {0,0,0,0,0,0,0,0,0};
|
||||||
|
|
||||||
HRESULT hr = m_pDWriteFactory->CreateTextLayout(tbuf.wc_str(),
|
HRESULT hr = m_pDWriteFactory->CreateTextLayout(tbuf.wc_str(),
|
||||||
tbuf.Length(), m_pTextFormat, FLT_MAX, FLT_MAX, &pTextLayout);
|
tbuf.length(), m_pTextFormat, FLT_MAX, FLT_MAX, &pTextLayout);
|
||||||
|
|
||||||
if ( SUCCEEDED(hr) )
|
if ( SUCCEEDED(hr) )
|
||||||
{
|
{
|
||||||
|
|
@ -1546,10 +1546,10 @@ void SurfaceD2D::MeasureWidths(Font &font_, const char *s, int len,
|
||||||
int fit = 0;
|
int fit = 0;
|
||||||
wxString tbuf = stc2wx(s,len);
|
wxString tbuf = stc2wx(s,len);
|
||||||
wxVector<FLOAT> poses;
|
wxVector<FLOAT> poses;
|
||||||
poses.reserve(tbuf.Length());
|
poses.reserve(tbuf.length());
|
||||||
poses.resize(tbuf.Length());
|
poses.resize(tbuf.length());
|
||||||
|
|
||||||
fit = tbuf.Length();
|
fit = tbuf.length();
|
||||||
const int clusters = 1000;
|
const int clusters = 1000;
|
||||||
DWRITE_CLUSTER_METRICS clusterMetrics[clusters];
|
DWRITE_CLUSTER_METRICS clusterMetrics[clusters];
|
||||||
UINT32 count = 0;
|
UINT32 count = 0;
|
||||||
|
|
@ -1560,7 +1560,7 @@ void SurfaceD2D::MeasureWidths(Font &font_, const char *s, int len,
|
||||||
wxCOMPtr<IDWriteTextLayout> pTextLayout;
|
wxCOMPtr<IDWriteTextLayout> pTextLayout;
|
||||||
|
|
||||||
HRESULT hr = m_pDWriteFactory->CreateTextLayout(tbuf.wc_str(),
|
HRESULT hr = m_pDWriteFactory->CreateTextLayout(tbuf.wc_str(),
|
||||||
tbuf.Length(), m_pTextFormat, FLT_MAX, FLT_MAX, &pTextLayout);
|
tbuf.length(), m_pTextFormat, FLT_MAX, FLT_MAX, &pTextLayout);
|
||||||
if ( !SUCCEEDED(hr) )
|
if ( !SUCCEEDED(hr) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -1583,7 +1583,7 @@ void SurfaceD2D::MeasureWidths(Font &font_, const char *s, int len,
|
||||||
}
|
}
|
||||||
position += clusterMetrics[ci].width;
|
position += clusterMetrics[ci].width;
|
||||||
}
|
}
|
||||||
PLATFORM_ASSERT(ti == tbuf.Length());
|
PLATFORM_ASSERT(ti == tbuf.length());
|
||||||
}
|
}
|
||||||
if (m_unicodeMode)
|
if (m_unicodeMode)
|
||||||
{
|
{
|
||||||
|
|
@ -1628,7 +1628,7 @@ void SurfaceD2D::MeasureWidths(Font &font_, const char *s, int len,
|
||||||
{
|
{
|
||||||
const size_t buflen = static_cast<size_t>(len);
|
const size_t buflen = static_cast<size_t>(len);
|
||||||
// One character per position
|
// One character per position
|
||||||
PLATFORM_ASSERT(buflen == tbuf.Length());
|
PLATFORM_ASSERT(buflen == tbuf.length());
|
||||||
for ( size_t kk=0; kk<buflen; kk++ )
|
for ( size_t kk=0; kk<buflen; kk++ )
|
||||||
{
|
{
|
||||||
positions[kk] = poses[kk];
|
positions[kk] = poses[kk];
|
||||||
|
|
@ -1808,7 +1808,7 @@ void SurfaceD2D::DrawTextCommon(PRectangle rc, Font &font_, XYPOSITION ybase,
|
||||||
D2D1_ANTIALIAS_MODE_ALIASED);
|
D2D1_ANTIALIAS_MODE_ALIASED);
|
||||||
}
|
}
|
||||||
|
|
||||||
hr = m_pDWriteFactory->CreateTextLayout(tbuf.wc_str(), tbuf.Length(),
|
hr = m_pDWriteFactory->CreateTextLayout(tbuf.wc_str(), tbuf.length(),
|
||||||
m_pTextFormat, rc.Width(), rc.Height(), &pTextLayout);
|
m_pTextFormat, rc.Width(), rc.Height(), &pTextLayout);
|
||||||
|
|
||||||
if ( SUCCEEDED(hr) )
|
if ( SUCCEEDED(hr) )
|
||||||
|
|
|
||||||
|
|
@ -2540,7 +2540,7 @@ void wxTextCtrl::SetMaxLength(unsigned long len)
|
||||||
{
|
{
|
||||||
// if the existing value in the text control is too long,
|
// if the existing value in the text control is too long,
|
||||||
// then it is clipped to the newly imposed limit.
|
// then it is clipped to the newly imposed limit.
|
||||||
if ( m_value.Length() > len )
|
if ( m_value.length() > len )
|
||||||
{
|
{
|
||||||
// block the wxEVT_TEXT event temporaryly
|
// block the wxEVT_TEXT event temporaryly
|
||||||
// otherwise Remove will generate a wxEVT_TEXT event
|
// otherwise Remove will generate a wxEVT_TEXT event
|
||||||
|
|
|
||||||
|
|
@ -1097,7 +1097,7 @@ bool OutputNode(wxOutputStream& stream,
|
||||||
case wxXML_TEXT_NODE:
|
case wxXML_TEXT_NODE:
|
||||||
if (node->GetNoConversion())
|
if (node->GetNoConversion())
|
||||||
{
|
{
|
||||||
stream.Write(node->GetContent().c_str(), node->GetContent().Length());
|
stream.Write(node->GetContent().c_str(), node->GetContent().length());
|
||||||
rc = true;
|
rc = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -812,7 +812,7 @@ void TextCtrlTestCase::DoPositionToXYMultiLine(long style)
|
||||||
// empty field
|
// empty field
|
||||||
m_text->Clear();
|
m_text->Clear();
|
||||||
const long numChars_0 = 0;
|
const long numChars_0 = 0;
|
||||||
wxASSERT(numChars_0 == text.Length());
|
wxASSERT(numChars_0 == text.length());
|
||||||
XYPos coords_0[numChars_0+1] =
|
XYPos coords_0[numChars_0+1] =
|
||||||
{ { 0, 0 } };
|
{ { 0, 0 } };
|
||||||
|
|
||||||
|
|
@ -832,7 +832,7 @@ void TextCtrlTestCase::DoPositionToXYMultiLine(long style)
|
||||||
text = wxS("1234");
|
text = wxS("1234");
|
||||||
m_text->SetValue(text);
|
m_text->SetValue(text);
|
||||||
const long numChars_1 = 4;
|
const long numChars_1 = 4;
|
||||||
wxASSERT( numChars_1 == text.Length() );
|
wxASSERT( numChars_1 == text.length() );
|
||||||
XYPos coords_1[numChars_1+1] =
|
XYPos coords_1[numChars_1+1] =
|
||||||
{ { 0, 0 }, { 1, 0 }, { 2, 0}, { 3, 0 }, { 4, 0 } };
|
{ { 0, 0 }, { 1, 0 }, { 2, 0}, { 3, 0 }, { 4, 0 } };
|
||||||
|
|
||||||
|
|
@ -864,7 +864,7 @@ void TextCtrlTestCase::DoPositionToXYMultiLine(long style)
|
||||||
#endif // WXMSW
|
#endif // WXMSW
|
||||||
|
|
||||||
const long numChars_2 = 8;
|
const long numChars_2 = 8;
|
||||||
wxASSERT(numChars_2 == text.Length());
|
wxASSERT(numChars_2 == text.length());
|
||||||
XYPos coords_2[numChars_2 + 1] =
|
XYPos coords_2[numChars_2 + 1] =
|
||||||
{ { 0, 0 }, { 1, 0 }, { 2, 0 }, { 3, 0 },
|
{ { 0, 0 }, { 1, 0 }, { 2, 0 }, { 3, 0 },
|
||||||
{ 0, 1 }, { 1, 1 }, { 2, 1 },
|
{ 0, 1 }, { 1, 1 }, { 2, 1 },
|
||||||
|
|
@ -913,7 +913,7 @@ void TextCtrlTestCase::DoPositionToXYMultiLine(long style)
|
||||||
#endif // WXMSW
|
#endif // WXMSW
|
||||||
|
|
||||||
const long numChars_3 = 3;
|
const long numChars_3 = 3;
|
||||||
wxASSERT(numChars_3 == text.Length());
|
wxASSERT(numChars_3 == text.length());
|
||||||
XYPos coords_3[numChars_3+1] =
|
XYPos coords_3[numChars_3+1] =
|
||||||
{ { 0, 0 },
|
{ { 0, 0 },
|
||||||
{ 0, 1 },
|
{ 0, 1 },
|
||||||
|
|
@ -965,7 +965,7 @@ void TextCtrlTestCase::DoPositionToXYMultiLine(long style)
|
||||||
#endif // WXMSW
|
#endif // WXMSW
|
||||||
|
|
||||||
const long numChars_4 = 10;
|
const long numChars_4 = 10;
|
||||||
wxASSERT(numChars_4 == text.Length());
|
wxASSERT(numChars_4 == text.length());
|
||||||
XYPos coords_4[numChars_4+1] =
|
XYPos coords_4[numChars_4+1] =
|
||||||
{ { 0, 0 }, { 1, 0 }, { 2, 0 }, { 3, 0 },
|
{ { 0, 0 }, { 1, 0 }, { 2, 0 }, { 3, 0 },
|
||||||
{ 0, 1 }, { 1, 1 },
|
{ 0, 1 }, { 1, 1 },
|
||||||
|
|
@ -1200,7 +1200,7 @@ void TextCtrlTestCase::PositionToXYSingleLine()
|
||||||
// pure one line
|
// pure one line
|
||||||
text = wxS("1234");
|
text = wxS("1234");
|
||||||
m_text->SetValue(text);
|
m_text->SetValue(text);
|
||||||
const long numChars_1 = text.Length();
|
const long numChars_1 = text.length();
|
||||||
CPPUNIT_ASSERT_EQUAL( numChars_1, m_text->GetLastPosition() );
|
CPPUNIT_ASSERT_EQUAL( numChars_1, m_text->GetLastPosition() );
|
||||||
for ( long i = 0; i <= numChars_1; i++ )
|
for ( long i = 0; i <= numChars_1; i++ )
|
||||||
{
|
{
|
||||||
|
|
@ -1216,7 +1216,7 @@ void TextCtrlTestCase::PositionToXYSingleLine()
|
||||||
// with new line characters
|
// with new line characters
|
||||||
text = wxS("123\nab\nX");
|
text = wxS("123\nab\nX");
|
||||||
m_text->SetValue(text);
|
m_text->SetValue(text);
|
||||||
const long numChars_2 = text.Length();
|
const long numChars_2 = text.length();
|
||||||
CPPUNIT_ASSERT_EQUAL( numChars_2, m_text->GetLastPosition() );
|
CPPUNIT_ASSERT_EQUAL( numChars_2, m_text->GetLastPosition() );
|
||||||
for ( long i = 0; i <= numChars_2; i++ )
|
for ( long i = 0; i <= numChars_2; i++ )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -622,7 +622,7 @@ static wxString FileToCppArray(wxString filename, int num)
|
||||||
output << wxT("\n");
|
output << wxT("\n");
|
||||||
}
|
}
|
||||||
output << tmp;
|
output << tmp;
|
||||||
linelng += tmp.Length()+1;
|
linelng += tmp.length()+1;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete[] buffer;
|
delete[] buffer;
|
||||||
|
|
@ -780,7 +780,7 @@ static wxString FileToPythonArray(wxString filename, int num)
|
||||||
output << wxT("\\\n");
|
output << wxT("\\\n");
|
||||||
}
|
}
|
||||||
output << tmp;
|
output << tmp;
|
||||||
linelng += tmp.Length();
|
linelng += tmp.length();
|
||||||
}
|
}
|
||||||
|
|
||||||
delete[] buffer;
|
delete[] buffer;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue