Simplify wxMacConvertNewlines helper functions

One is not used at all, two are only used in one place. Make the remaining
two return a wxString instead of taking a wxString pointer parameter.
This commit is contained in:
Paul Cornett
2017-10-01 10:44:35 -07:00
parent 37e29d3451
commit 0b2ec56ae3
5 changed files with 29 additions and 61 deletions

View File

@@ -788,22 +788,22 @@ void wxNSTextViewControl::insertText(NSString* str, WXWidget slf, void *_cmd)
wxString wxNSTextViewControl::GetStringValue() const
{
wxString result;
if (m_textView)
{
wxString result = wxCFStringRef::AsString([m_textView string], m_wxPeer->GetFont().GetEncoding());
wxMacConvertNewlines13To10( &result ) ;
return result;
result = wxMacConvertNewlines13To10(
wxCFStringRef::AsString([m_textView string], m_wxPeer->GetFont().GetEncoding()));
}
return wxEmptyString;
return result;
}
void wxNSTextViewControl::SetStringValue( const wxString &str)
{
wxString st = str;
wxMacConvertNewlines10To13( &st );
wxMacEditHelper helper(m_textView);
if (m_textView)
{
wxString st(wxMacConvertNewlines10To13(str));
[m_textView setString: wxCFStringRef( st , m_wxPeer->GetFont().GetEncoding() ).AsNSString()];
if ( m_wxPeer->HasFlag(wxTE_AUTO_URL) )
{
@@ -984,8 +984,7 @@ void wxNSTextViewControl::ShowPosition(long pos)
void wxNSTextViewControl::WriteText(const wxString& str)
{
wxString st = str;
wxMacConvertNewlines10To13( &st );
wxString st(wxMacConvertNewlines10To13(str));
wxMacEditHelper helper(m_textView);
NSEvent* formerEvent = m_lastKeyDownEvent;
m_lastKeyDownEvent = nil;