From 8623a8838d8c4a7fd531e1eb3940e3ddf7306584 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Wed, 10 Nov 2004 13:44:51 +0000 Subject: [PATCH] text attributes corrected git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30412 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mac/carbon/textctrl.cpp | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/src/mac/carbon/textctrl.cpp b/src/mac/carbon/textctrl.cpp index f41227fd15..d1b9fa2325 100644 --- a/src/mac/carbon/textctrl.cpp +++ b/src/mac/carbon/textctrl.cpp @@ -199,7 +199,6 @@ public : virtual wxString GetStringValue() const ; virtual void SetStringValue( const wxString &str) ; - static int ConvertAttribute( const wxTextAttr& style , TXNTypeAttributes attr[] ) ; static TXNFrameOptions FrameOptionsFromWXStyle( long wxStyle ) ; void AdjustCreationAttributes( const wxColour& background , bool visible ) ; @@ -234,6 +233,7 @@ public : void SetTXNData( const wxString& st , TXNOffset start , TXNOffset end ) ; protected : + void TXNSetAttribute( const wxTextAttr& style , long from , long to ) ; TXNObject m_txn ; } ; @@ -1493,8 +1493,9 @@ void wxMacMLTEControl::SetBackground( const wxBrush &brush ) TXNSetBackground( m_txn , &tback); } -int wxMacMLTEControl::ConvertAttribute( const wxTextAttr& style , TXNTypeAttributes typeAttr[] ) +void wxMacMLTEControl::TXNSetAttribute( const wxTextAttr& style , long from , long to) { + TXNTypeAttributes typeAttr[4] ; Str255 fontName = "\pMonaco" ; SInt16 fontSize = 12 ; Style fontStyle = normal ; @@ -1531,29 +1532,21 @@ int wxMacMLTEControl::ConvertAttribute( const wxTextAttr& style , TXNTypeAttribu color = MAC_WXCOLORREF(style.GetTextColour().GetPixel()) ; attrCounter += 1 ; } - return attrCounter ; + if ( attrCounter > 0 ) + { + verify_noerr( TXNSetTypeAttributes ( m_txn , attrCounter , typeAttr, from , to) ); + } } void wxMacMLTEControl::SetFont( const wxFont & font , const wxColour& foreground , long windowStyle ) { EditHelper help(m_txn) ; - wxTextAttr style(foreground,wxNullColour,font) ; - TXNTypeAttributes typeAttr[4] ; - int attrCounter = ConvertAttribute( style , typeAttr ) ; - if ( attrCounter > 0 ) - { - verify_noerr( TXNSetTypeAttributes ( m_txn , attrCounter , typeAttr, kTXNStartOffset,kTXNEndOffset) ); - } + TXNSetAttribute( wxTextAttr(foreground,wxNullColour,font) , kTXNStartOffset,kTXNEndOffset ) ; } void wxMacMLTEControl::SetStyle(long start, long end, const wxTextAttr& style) { EditHelper help(m_txn) ; - TXNTypeAttributes typeAttr[4] ; - int attrCounter = ConvertAttribute( style , typeAttr ) ; - if ( attrCounter > 0 ) - { - verify_noerr( TXNSetTypeAttributes ( m_txn , attrCounter , typeAttr, start,end) ); - } + TXNSetAttribute( style , start,end ) ; } void wxMacMLTEControl::Copy() -- 2.45.2