X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ef4a634b1b90cb13426b9006d8e18380b9809fdb..f74172ab4256c9e7c665e44e2f94ce12bf84a37f:/src/mac/textctrl.cpp diff --git a/src/mac/textctrl.cpp b/src/mac/textctrl.cpp index 5f71de9973..ac6399deb8 100644 --- a/src/mac/textctrl.cpp +++ b/src/mac/textctrl.cpp @@ -722,7 +722,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id, m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , "\p" , true , 0 , 0 , 1, (style & wxTE_PASSWORD) ? kControlEditTextPasswordProc : kControlEditTextProc , (long) this ) ; long size ; - ::GetControlData((ControlHandle) m_macControl , 0, kControlEditTextTEHandleTag , sizeof( TEHandle ) , (char*) &((TEHandle) m_macTE) , &size ) ; + ::GetControlData((ControlHandle) m_macControl , 0, kControlEditTextTEHandleTag , sizeof( TEHandle ) , (char*)((TEHandle *)&m_macTE) , &size ) ; } else @@ -859,7 +859,7 @@ void wxTextCtrl::SetValue(const wxString& st) } else { - bool formerEditable = IsEditable() ; + bool formerEditable = m_editable ; if ( !formerEditable ) SetEditable(true) ; #if wxUSE_UNICODE @@ -887,7 +887,7 @@ bool wxTextCtrl::SetStyle(long start, long end, const wxTextAttr& style) { if ( m_macUsesTXN ) { - bool formerEditable = IsEditable() ; + bool formerEditable = m_editable ; if ( !formerEditable ) SetEditable(true) ; TXNTypeAttributes typeAttr[4] ; @@ -931,8 +931,10 @@ bool wxTextCtrl::SetStyle(long start, long end, const wxTextAttr& style) if ( attrCounter > 0 ) { - OSStatus status = TXNSetTypeAttributes ((TXNObject)m_macTXN, attrCounter , typeAttr, - start,end); +#ifdef __WXDEBUG__ + OSStatus status = +#endif // __WXDEBUG__ + TXNSetTypeAttributes ((TXNObject)m_macTXN, attrCounter , typeAttr, start,end); wxASSERT_MSG( status == noErr , wxT("Couldn't set text attributes") ) ; } if ( !formerEditable ) @@ -1150,7 +1152,7 @@ void wxTextCtrl::Replace(long from, long to, const wxString& value) } else { - bool formerEditable = IsEditable() ; + bool formerEditable = m_editable ; if ( !formerEditable ) SetEditable(true) ; TXNSetSelection( ((TXNObject) m_macTXN) , from , to ) ; @@ -1181,7 +1183,7 @@ void wxTextCtrl::Remove(long from, long to) } else { - bool formerEditable = IsEditable() ; + bool formerEditable = m_editable ; if ( !formerEditable ) SetEditable(true) ; TXNSetSelection( ((TXNObject) m_macTXN) , from , to ) ; @@ -1242,7 +1244,7 @@ void wxTextCtrl::WriteText(const wxString& st) } else { - bool formerEditable = IsEditable() ; + bool formerEditable = m_editable ; if ( !formerEditable ) SetEditable(true) ; long start , end , dummy ; @@ -1344,6 +1346,10 @@ void wxTextCtrl::Undo() { if (CanUndo()) { + if ( m_macUsesTXN ) + { + TXNUndo((TXNObject)m_macTXN); + } } } @@ -1351,16 +1357,36 @@ void wxTextCtrl::Redo() { if (CanRedo()) { + if ( m_macUsesTXN ) + { + TXNRedo((TXNObject)m_macTXN); + } } } bool wxTextCtrl::CanUndo() const { + if ( !IsEditable() ) + { + return false ; + } + if ( m_macUsesTXN ) + { + return TXNCanUndo((TXNObject)m_macTXN,NULL); + } return FALSE ; } bool wxTextCtrl::CanRedo() const { + if ( !IsEditable() ) + { + return false ; + } + if ( m_macUsesTXN ) + { + return TXNCanRedo((TXNObject)m_macTXN,NULL); + } return FALSE ; }