Tried another fix for my wxTextCtrl crash. Stefan's
attempt had no effect and I didn't see any side effects of my change either. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@17918 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -342,7 +342,7 @@ static pascal void TPPaneIdleProc(ControlHandle theControl) {
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// SetThemeCursor(kThemeArrowCursor);
|
// SetThemeCursor(kThemeArrowCursor);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* if it's in our bounds, set the cursor */
|
/* if it's in our bounds, set the cursor */
|
||||||
@@ -542,29 +542,29 @@ OSStatus mUPOpenControl(ControlHandle theControl, long wxStyle )
|
|||||||
TXNFrameOptions frameOptions =
|
TXNFrameOptions frameOptions =
|
||||||
kTXNDontDrawCaretWhenInactiveMask ;
|
kTXNDontDrawCaretWhenInactiveMask ;
|
||||||
if ( ! ( wxStyle & wxTE_NOHIDESEL ) )
|
if ( ! ( wxStyle & wxTE_NOHIDESEL ) )
|
||||||
frameOptions |= kTXNDontDrawSelectionWhenInactiveMask ;
|
frameOptions |= kTXNDontDrawSelectionWhenInactiveMask ;
|
||||||
|
|
||||||
if ( wxStyle & wxTE_MULTILINE )
|
if ( wxStyle & wxTE_MULTILINE )
|
||||||
{
|
{
|
||||||
if ( ! ( wxStyle & wxTE_DONTWRAP ) )
|
if ( ! ( wxStyle & wxTE_DONTWRAP ) )
|
||||||
frameOptions |= kTXNAlwaysWrapAtViewEdgeMask ;
|
frameOptions |= kTXNAlwaysWrapAtViewEdgeMask ;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
frameOptions |= kTXNAlwaysWrapAtViewEdgeMask ;
|
frameOptions |= kTXNAlwaysWrapAtViewEdgeMask ;
|
||||||
frameOptions |= kTXNWantHScrollBarMask ;
|
frameOptions |= kTXNWantHScrollBarMask ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !(wxStyle & wxTE_NO_VSCROLL ) )
|
if ( !(wxStyle & wxTE_NO_VSCROLL ) )
|
||||||
frameOptions |= kTXNWantVScrollBarMask ;
|
frameOptions |= kTXNWantVScrollBarMask ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
frameOptions |= kTXNSingleLineOnlyMask ;
|
frameOptions |= kTXNSingleLineOnlyMask ;
|
||||||
|
|
||||||
if ( wxStyle & wxTE_READONLY )
|
if ( wxStyle & wxTE_READONLY )
|
||||||
frameOptions |= kTXNReadOnlyMask ;
|
frameOptions |= kTXNReadOnlyMask ;
|
||||||
|
|
||||||
TXNNewObject(NULL, varsp->fOwner, &varsp->fRTextArea,
|
TXNNewObject(NULL, varsp->fOwner, &varsp->fRTextArea,
|
||||||
frameOptions ,
|
frameOptions ,
|
||||||
kTXNTextEditStyleFrameType,
|
kTXNTextEditStyleFrameType,
|
||||||
kTXNTextensionFile,
|
kTXNTextensionFile,
|
||||||
kTXNSystemDefaultEncoding,
|
kTXNSystemDefaultEncoding,
|
||||||
@@ -728,7 +728,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
|
|||||||
/* create the control */
|
/* create the control */
|
||||||
m_macControl = NewControl(MAC_WXHWND(parent->MacGetRootWindow()), &bounds, "\p", true, featurSet, 0, featurSet, kControlUserPaneProc, 0);
|
m_macControl = NewControl(MAC_WXHWND(parent->MacGetRootWindow()), &bounds, "\p", true, featurSet, 0, featurSet, kControlUserPaneProc, 0);
|
||||||
/* set up the mUP specific features and data */
|
/* set up the mUP specific features and data */
|
||||||
mUPOpenControl((ControlHandle) m_macControl, m_windowStyle );
|
mUPOpenControl((ControlHandle) m_macControl, m_windowStyle );
|
||||||
if ( parent )
|
if ( parent )
|
||||||
{
|
{
|
||||||
parent->MacGetTopLevelWindow()->MacInstallEventHandler() ;
|
parent->MacGetTopLevelWindow()->MacInstallEventHandler() ;
|
||||||
@@ -758,7 +758,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
|
|||||||
m_macTXN = (**tpvars).fTXNRec ;
|
m_macTXN = (**tpvars).fTXNRec ;
|
||||||
m_macTXNvars = tpvars ;
|
m_macTXNvars = tpvars ;
|
||||||
m_macUsesTXN = true ;
|
m_macUsesTXN = true ;
|
||||||
TXNSetSelection( (TXNObject) m_macTXN, 0, 0);
|
TXNSetSelection( (TXNObject) m_macTXN, 0, 0);
|
||||||
TXNShowSelection( (TXNObject) m_macTXN, kTXNShowStart);
|
TXNShowSelection( (TXNObject) m_macTXN, kTXNShowStart);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -801,7 +801,7 @@ wxString wxTextCtrl::GetValue() const
|
|||||||
{
|
{
|
||||||
value = wxMacMakePCStringFromMac( wxBuffer ) ;
|
value = wxMacMakePCStringFromMac( wxBuffer ) ;
|
||||||
value.Replace( "\r", "\n" );
|
value.Replace( "\r", "\n" );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
value = wxBuffer;
|
value = wxBuffer;
|
||||||
|
|
||||||
@@ -829,7 +829,7 @@ void wxTextCtrl::SetValue(const wxString& st)
|
|||||||
if( wxApp::s_macDefaultEncodingIsPC )
|
if( wxApp::s_macDefaultEncodingIsPC )
|
||||||
{
|
{
|
||||||
value = wxMacMakeMacStringFromPC( st ) ;
|
value = wxMacMakeMacStringFromPC( st ) ;
|
||||||
value.Replace( "\n", "\r" );
|
value.Replace( "\n", "\r" );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
value = st;
|
value = st;
|
||||||
@@ -843,13 +843,13 @@ void wxTextCtrl::SetValue(const wxString& st)
|
|||||||
{
|
{
|
||||||
bool formerEditable = IsEditable() ;
|
bool formerEditable = IsEditable() ;
|
||||||
if ( !formerEditable )
|
if ( !formerEditable )
|
||||||
SetEditable(true) ;
|
SetEditable(true) ;
|
||||||
TXNSetData( ((TXNObject) m_macTXN), kTXNTextData, (void*)value.c_str(), value.Length(),
|
TXNSetData( ((TXNObject) m_macTXN), kTXNTextData, (void*)value.c_str(), value.Length(),
|
||||||
kTXNStartOffset, kTXNEndOffset);
|
kTXNStartOffset, kTXNEndOffset);
|
||||||
TXNSetSelection( (TXNObject) m_macTXN, 0, 0);
|
TXNSetSelection( (TXNObject) m_macTXN, 0, 0);
|
||||||
TXNShowSelection( (TXNObject) m_macTXN, kTXNShowStart);
|
TXNShowSelection( (TXNObject) m_macTXN, kTXNShowStart);
|
||||||
if ( !formerEditable )
|
if ( !formerEditable )
|
||||||
SetEditable(formerEditable) ;
|
SetEditable(formerEditable) ;
|
||||||
}
|
}
|
||||||
MacRedrawControl() ;
|
MacRedrawControl() ;
|
||||||
}
|
}
|
||||||
@@ -865,45 +865,45 @@ bool wxTextCtrl::SetStyle(long start, long end, const wxTextAttr& style)
|
|||||||
{
|
{
|
||||||
bool formerEditable = IsEditable() ;
|
bool formerEditable = IsEditable() ;
|
||||||
if ( !formerEditable )
|
if ( !formerEditable )
|
||||||
SetEditable(true) ;
|
SetEditable(true) ;
|
||||||
TXNTypeAttributes typeAttr[4] ;
|
TXNTypeAttributes typeAttr[4] ;
|
||||||
Str255 fontName = "\pMonaco" ;
|
Str255 fontName = "\pMonaco" ;
|
||||||
SInt16 fontSize = 12 ;
|
SInt16 fontSize = 12 ;
|
||||||
Style fontStyle = normal ;
|
Style fontStyle = normal ;
|
||||||
RGBColor color ;
|
RGBColor color ;
|
||||||
int attrCounter = 0 ;
|
int attrCounter = 0 ;
|
||||||
if ( style.HasFont() )
|
if ( style.HasFont() )
|
||||||
{
|
{
|
||||||
const wxFont &font = style.GetFont() ;
|
const wxFont &font = style.GetFont() ;
|
||||||
CopyCStringToPascal( font.GetFaceName().c_str() , fontName ) ;
|
CopyCStringToPascal( font.GetFaceName().c_str() , fontName ) ;
|
||||||
fontSize = font.GetPointSize() ;
|
fontSize = font.GetPointSize() ;
|
||||||
if ( font.GetUnderlined() )
|
if ( font.GetUnderlined() )
|
||||||
fontStyle |= underline ;
|
fontStyle |= underline ;
|
||||||
if ( font.GetWeight() == wxBOLD )
|
if ( font.GetWeight() == wxBOLD )
|
||||||
fontStyle |= bold ;
|
fontStyle |= bold ;
|
||||||
if ( font.GetStyle() == wxITALIC )
|
if ( font.GetStyle() == wxITALIC )
|
||||||
fontStyle |= italic ;
|
fontStyle |= italic ;
|
||||||
|
|
||||||
typeAttr[attrCounter].tag = kTXNQDFontNameAttribute ;
|
typeAttr[attrCounter].tag = kTXNQDFontNameAttribute ;
|
||||||
typeAttr[attrCounter].size = kTXNQDFontNameAttributeSize ;
|
typeAttr[attrCounter].size = kTXNQDFontNameAttributeSize ;
|
||||||
typeAttr[attrCounter].data.dataPtr = (void*) fontName ;
|
typeAttr[attrCounter].data.dataPtr = (void*) fontName ;
|
||||||
typeAttr[attrCounter+1].tag = kTXNQDFontSizeAttribute ;
|
typeAttr[attrCounter+1].tag = kTXNQDFontSizeAttribute ;
|
||||||
typeAttr[attrCounter+1].size = kTXNFontSizeAttributeSize ;
|
typeAttr[attrCounter+1].size = kTXNFontSizeAttributeSize ;
|
||||||
typeAttr[attrCounter+1].data.dataValue = (fontSize << 16) ;
|
typeAttr[attrCounter+1].data.dataValue = (fontSize << 16) ;
|
||||||
typeAttr[attrCounter+2].tag = kTXNQDFontStyleAttribute ;
|
typeAttr[attrCounter+2].tag = kTXNQDFontStyleAttribute ;
|
||||||
typeAttr[attrCounter+2].size = kTXNQDFontStyleAttributeSize ;
|
typeAttr[attrCounter+2].size = kTXNQDFontStyleAttributeSize ;
|
||||||
typeAttr[attrCounter+2].data.dataValue = fontStyle ;
|
typeAttr[attrCounter+2].data.dataValue = fontStyle ;
|
||||||
attrCounter += 3 ;
|
attrCounter += 3 ;
|
||||||
|
|
||||||
}
|
}
|
||||||
if ( style.HasTextColour() )
|
if ( style.HasTextColour() )
|
||||||
{
|
{
|
||||||
typeAttr[attrCounter].tag = kTXNQDFontColorAttribute ;
|
typeAttr[attrCounter].tag = kTXNQDFontColorAttribute ;
|
||||||
typeAttr[attrCounter].size = kTXNQDFontColorAttributeSize ;
|
typeAttr[attrCounter].size = kTXNQDFontColorAttributeSize ;
|
||||||
typeAttr[attrCounter].data.dataPtr = (void*) &color ;
|
typeAttr[attrCounter].data.dataPtr = (void*) &color ;
|
||||||
color = MAC_WXCOLORREF(style.GetTextColour().GetPixel()) ;
|
color = MAC_WXCOLORREF(style.GetTextColour().GetPixel()) ;
|
||||||
attrCounter += 1 ;
|
attrCounter += 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( attrCounter > 0 )
|
if ( attrCounter > 0 )
|
||||||
{
|
{
|
||||||
@@ -912,7 +912,7 @@ bool wxTextCtrl::SetStyle(long start, long end, const wxTextAttr& style)
|
|||||||
wxASSERT_MSG( status == noErr , "Couldn't set text attributes" ) ;
|
wxASSERT_MSG( status == noErr , "Couldn't set text attributes" ) ;
|
||||||
}
|
}
|
||||||
if ( !formerEditable )
|
if ( !formerEditable )
|
||||||
SetEditable(formerEditable) ;
|
SetEditable(formerEditable) ;
|
||||||
}
|
}
|
||||||
return TRUE ;
|
return TRUE ;
|
||||||
}
|
}
|
||||||
@@ -1055,9 +1055,9 @@ void wxTextCtrl::SetEditable(bool editable)
|
|||||||
if ( !m_macUsesTXN )
|
if ( !m_macUsesTXN )
|
||||||
{
|
{
|
||||||
if ( editable )
|
if ( editable )
|
||||||
UMAActivateControl( (ControlHandle) m_macControl ) ;
|
UMAActivateControl( (ControlHandle) m_macControl ) ;
|
||||||
else
|
else
|
||||||
UMADeactivateControl((ControlHandle) m_macControl ) ;
|
UMADeactivateControl((ControlHandle) m_macControl ) ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1128,13 +1128,13 @@ void wxTextCtrl::Replace(long from, long to, const wxString& value)
|
|||||||
{
|
{
|
||||||
bool formerEditable = IsEditable() ;
|
bool formerEditable = IsEditable() ;
|
||||||
if ( !formerEditable )
|
if ( !formerEditable )
|
||||||
SetEditable(true) ;
|
SetEditable(true) ;
|
||||||
TXNSetSelection( ((TXNObject) m_macTXN) , from , to ) ;
|
TXNSetSelection( ((TXNObject) m_macTXN) , from , to ) ;
|
||||||
TXNClear( ((TXNObject) m_macTXN) ) ;
|
TXNClear( ((TXNObject) m_macTXN) ) ;
|
||||||
TXNSetData( ((TXNObject) m_macTXN), kTXNTextData, (void*)value.c_str(), value.Length(),
|
TXNSetData( ((TXNObject) m_macTXN), kTXNTextData, (void*)value.c_str(), value.Length(),
|
||||||
kTXNUseCurrentSelection, kTXNUseCurrentSelection);
|
kTXNUseCurrentSelection, kTXNUseCurrentSelection);
|
||||||
if ( !formerEditable )
|
if ( !formerEditable )
|
||||||
SetEditable( formerEditable ) ;
|
SetEditable( formerEditable ) ;
|
||||||
}
|
}
|
||||||
Refresh() ;
|
Refresh() ;
|
||||||
}
|
}
|
||||||
@@ -1154,11 +1154,11 @@ void wxTextCtrl::Remove(long from, long to)
|
|||||||
{
|
{
|
||||||
bool formerEditable = IsEditable() ;
|
bool formerEditable = IsEditable() ;
|
||||||
if ( !formerEditable )
|
if ( !formerEditable )
|
||||||
SetEditable(true) ;
|
SetEditable(true) ;
|
||||||
TXNSetSelection( ((TXNObject) m_macTXN) , from , to ) ;
|
TXNSetSelection( ((TXNObject) m_macTXN) , from , to ) ;
|
||||||
TXNClear( ((TXNObject) m_macTXN) ) ;
|
TXNClear( ((TXNObject) m_macTXN) ) ;
|
||||||
if ( !formerEditable )
|
if ( !formerEditable )
|
||||||
SetEditable( formerEditable ) ;
|
SetEditable( formerEditable ) ;
|
||||||
}
|
}
|
||||||
Refresh() ;
|
Refresh() ;
|
||||||
}
|
}
|
||||||
@@ -1205,7 +1205,7 @@ void wxTextCtrl::WriteText(const wxString& text)
|
|||||||
if( wxApp::s_macDefaultEncodingIsPC )
|
if( wxApp::s_macDefaultEncodingIsPC )
|
||||||
{
|
{
|
||||||
value = wxMacMakeMacStringFromPC( text ) ;
|
value = wxMacMakeMacStringFromPC( text ) ;
|
||||||
value.Replace( "\n", "\r" );
|
value.Replace( "\n", "\r" );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
value = text ;
|
value = text ;
|
||||||
@@ -1218,15 +1218,15 @@ void wxTextCtrl::WriteText(const wxString& text)
|
|||||||
{
|
{
|
||||||
bool formerEditable = IsEditable() ;
|
bool formerEditable = IsEditable() ;
|
||||||
if ( !formerEditable )
|
if ( !formerEditable )
|
||||||
SetEditable(true) ;
|
SetEditable(true) ;
|
||||||
long start , end , dummy ;
|
long start , end , dummy ;
|
||||||
GetSelection( &start , &dummy ) ;
|
GetSelection( &start , &dummy ) ;
|
||||||
TXNSetData( ((TXNObject) m_macTXN), kTXNTextData, (void*) (const char*)value, value.Length(),
|
TXNSetData( ((TXNObject) m_macTXN), kTXNTextData, (void*) (const char*)value, value.Length(),
|
||||||
kTXNUseCurrentSelection, kTXNUseCurrentSelection);
|
kTXNUseCurrentSelection, kTXNUseCurrentSelection);
|
||||||
GetSelection( &dummy , &end ) ;
|
GetSelection( &dummy , &end ) ;
|
||||||
SetStyle( start , end , GetDefaultStyle() ) ;
|
SetStyle( start , end , GetDefaultStyle() ) ;
|
||||||
if ( !formerEditable )
|
if ( !formerEditable )
|
||||||
SetEditable( formerEditable ) ;
|
SetEditable( formerEditable ) ;
|
||||||
}
|
}
|
||||||
MacRedrawControl() ;
|
MacRedrawControl() ;
|
||||||
}
|
}
|
||||||
@@ -1542,9 +1542,9 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
|
|||||||
key == WXK_DELETE ||
|
key == WXK_DELETE ||
|
||||||
key == WXK_BACK)
|
key == WXK_BACK)
|
||||||
{
|
{
|
||||||
long t1 = 0xDEADBEEF ;
|
long t1 = 0xDEADBEEF ;
|
||||||
wxCommandEvent event1(wxEVT_COMMAND_TEXT_UPDATED, m_windowId);
|
wxCommandEvent event1(wxEVT_COMMAND_TEXT_UPDATED, m_windowId);
|
||||||
long t2 = 0xDEADBEEF ;
|
long t2 = 0xDEADBEEF ;
|
||||||
event1.SetString( GetValue() ) ;
|
event1.SetString( GetValue() ) ;
|
||||||
event1.SetEventObject( this );
|
event1.SetEventObject( this );
|
||||||
wxPostEvent(GetEventHandler(),event1);
|
wxPostEvent(GetEventHandler(),event1);
|
||||||
@@ -1572,10 +1572,7 @@ bool wxTextCtrl::Show(bool show)
|
|||||||
|
|
||||||
bool retval = wxControl::Show( show ) ;
|
bool retval = wxControl::Show( show ) ;
|
||||||
|
|
||||||
WindowRef window = (WindowRef) MacGetRootWindow() ;
|
if ( former != m_macControlIsShown && show )
|
||||||
wxWindowMac* win = wxFindWinFromMacWindow( window ) ;
|
|
||||||
|
|
||||||
if ( former != m_macControlIsShown && win!=NULL && !win->IsBeingDeleted() )
|
|
||||||
{
|
{
|
||||||
if ( m_macControlIsShown )
|
if ( m_macControlIsShown )
|
||||||
TXNSetFrameBounds( (TXNObject) m_macTXN, (**(STPTextPaneVars **)m_macTXNvars).fRTextArea.top, (**(STPTextPaneVars **)m_macTXNvars).fRTextArea.left,
|
TXNSetFrameBounds( (TXNObject) m_macTXN, (**(STPTextPaneVars **)m_macTXNvars).fRTextArea.top, (**(STPTextPaneVars **)m_macTXNvars).fRTextArea.left,
|
||||||
|
@@ -342,7 +342,7 @@ static pascal void TPPaneIdleProc(ControlHandle theControl) {
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// SetThemeCursor(kThemeArrowCursor);
|
// SetThemeCursor(kThemeArrowCursor);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* if it's in our bounds, set the cursor */
|
/* if it's in our bounds, set the cursor */
|
||||||
@@ -542,29 +542,29 @@ OSStatus mUPOpenControl(ControlHandle theControl, long wxStyle )
|
|||||||
TXNFrameOptions frameOptions =
|
TXNFrameOptions frameOptions =
|
||||||
kTXNDontDrawCaretWhenInactiveMask ;
|
kTXNDontDrawCaretWhenInactiveMask ;
|
||||||
if ( ! ( wxStyle & wxTE_NOHIDESEL ) )
|
if ( ! ( wxStyle & wxTE_NOHIDESEL ) )
|
||||||
frameOptions |= kTXNDontDrawSelectionWhenInactiveMask ;
|
frameOptions |= kTXNDontDrawSelectionWhenInactiveMask ;
|
||||||
|
|
||||||
if ( wxStyle & wxTE_MULTILINE )
|
if ( wxStyle & wxTE_MULTILINE )
|
||||||
{
|
{
|
||||||
if ( ! ( wxStyle & wxTE_DONTWRAP ) )
|
if ( ! ( wxStyle & wxTE_DONTWRAP ) )
|
||||||
frameOptions |= kTXNAlwaysWrapAtViewEdgeMask ;
|
frameOptions |= kTXNAlwaysWrapAtViewEdgeMask ;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
frameOptions |= kTXNAlwaysWrapAtViewEdgeMask ;
|
frameOptions |= kTXNAlwaysWrapAtViewEdgeMask ;
|
||||||
frameOptions |= kTXNWantHScrollBarMask ;
|
frameOptions |= kTXNWantHScrollBarMask ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !(wxStyle & wxTE_NO_VSCROLL ) )
|
if ( !(wxStyle & wxTE_NO_VSCROLL ) )
|
||||||
frameOptions |= kTXNWantVScrollBarMask ;
|
frameOptions |= kTXNWantVScrollBarMask ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
frameOptions |= kTXNSingleLineOnlyMask ;
|
frameOptions |= kTXNSingleLineOnlyMask ;
|
||||||
|
|
||||||
if ( wxStyle & wxTE_READONLY )
|
if ( wxStyle & wxTE_READONLY )
|
||||||
frameOptions |= kTXNReadOnlyMask ;
|
frameOptions |= kTXNReadOnlyMask ;
|
||||||
|
|
||||||
TXNNewObject(NULL, varsp->fOwner, &varsp->fRTextArea,
|
TXNNewObject(NULL, varsp->fOwner, &varsp->fRTextArea,
|
||||||
frameOptions ,
|
frameOptions ,
|
||||||
kTXNTextEditStyleFrameType,
|
kTXNTextEditStyleFrameType,
|
||||||
kTXNTextensionFile,
|
kTXNTextensionFile,
|
||||||
kTXNSystemDefaultEncoding,
|
kTXNSystemDefaultEncoding,
|
||||||
@@ -728,7 +728,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
|
|||||||
/* create the control */
|
/* create the control */
|
||||||
m_macControl = NewControl(MAC_WXHWND(parent->MacGetRootWindow()), &bounds, "\p", true, featurSet, 0, featurSet, kControlUserPaneProc, 0);
|
m_macControl = NewControl(MAC_WXHWND(parent->MacGetRootWindow()), &bounds, "\p", true, featurSet, 0, featurSet, kControlUserPaneProc, 0);
|
||||||
/* set up the mUP specific features and data */
|
/* set up the mUP specific features and data */
|
||||||
mUPOpenControl((ControlHandle) m_macControl, m_windowStyle );
|
mUPOpenControl((ControlHandle) m_macControl, m_windowStyle );
|
||||||
if ( parent )
|
if ( parent )
|
||||||
{
|
{
|
||||||
parent->MacGetTopLevelWindow()->MacInstallEventHandler() ;
|
parent->MacGetTopLevelWindow()->MacInstallEventHandler() ;
|
||||||
@@ -758,7 +758,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
|
|||||||
m_macTXN = (**tpvars).fTXNRec ;
|
m_macTXN = (**tpvars).fTXNRec ;
|
||||||
m_macTXNvars = tpvars ;
|
m_macTXNvars = tpvars ;
|
||||||
m_macUsesTXN = true ;
|
m_macUsesTXN = true ;
|
||||||
TXNSetSelection( (TXNObject) m_macTXN, 0, 0);
|
TXNSetSelection( (TXNObject) m_macTXN, 0, 0);
|
||||||
TXNShowSelection( (TXNObject) m_macTXN, kTXNShowStart);
|
TXNShowSelection( (TXNObject) m_macTXN, kTXNShowStart);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -801,7 +801,7 @@ wxString wxTextCtrl::GetValue() const
|
|||||||
{
|
{
|
||||||
value = wxMacMakePCStringFromMac( wxBuffer ) ;
|
value = wxMacMakePCStringFromMac( wxBuffer ) ;
|
||||||
value.Replace( "\r", "\n" );
|
value.Replace( "\r", "\n" );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
value = wxBuffer;
|
value = wxBuffer;
|
||||||
|
|
||||||
@@ -829,7 +829,7 @@ void wxTextCtrl::SetValue(const wxString& st)
|
|||||||
if( wxApp::s_macDefaultEncodingIsPC )
|
if( wxApp::s_macDefaultEncodingIsPC )
|
||||||
{
|
{
|
||||||
value = wxMacMakeMacStringFromPC( st ) ;
|
value = wxMacMakeMacStringFromPC( st ) ;
|
||||||
value.Replace( "\n", "\r" );
|
value.Replace( "\n", "\r" );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
value = st;
|
value = st;
|
||||||
@@ -843,13 +843,13 @@ void wxTextCtrl::SetValue(const wxString& st)
|
|||||||
{
|
{
|
||||||
bool formerEditable = IsEditable() ;
|
bool formerEditable = IsEditable() ;
|
||||||
if ( !formerEditable )
|
if ( !formerEditable )
|
||||||
SetEditable(true) ;
|
SetEditable(true) ;
|
||||||
TXNSetData( ((TXNObject) m_macTXN), kTXNTextData, (void*)value.c_str(), value.Length(),
|
TXNSetData( ((TXNObject) m_macTXN), kTXNTextData, (void*)value.c_str(), value.Length(),
|
||||||
kTXNStartOffset, kTXNEndOffset);
|
kTXNStartOffset, kTXNEndOffset);
|
||||||
TXNSetSelection( (TXNObject) m_macTXN, 0, 0);
|
TXNSetSelection( (TXNObject) m_macTXN, 0, 0);
|
||||||
TXNShowSelection( (TXNObject) m_macTXN, kTXNShowStart);
|
TXNShowSelection( (TXNObject) m_macTXN, kTXNShowStart);
|
||||||
if ( !formerEditable )
|
if ( !formerEditable )
|
||||||
SetEditable(formerEditable) ;
|
SetEditable(formerEditable) ;
|
||||||
}
|
}
|
||||||
MacRedrawControl() ;
|
MacRedrawControl() ;
|
||||||
}
|
}
|
||||||
@@ -865,45 +865,45 @@ bool wxTextCtrl::SetStyle(long start, long end, const wxTextAttr& style)
|
|||||||
{
|
{
|
||||||
bool formerEditable = IsEditable() ;
|
bool formerEditable = IsEditable() ;
|
||||||
if ( !formerEditable )
|
if ( !formerEditable )
|
||||||
SetEditable(true) ;
|
SetEditable(true) ;
|
||||||
TXNTypeAttributes typeAttr[4] ;
|
TXNTypeAttributes typeAttr[4] ;
|
||||||
Str255 fontName = "\pMonaco" ;
|
Str255 fontName = "\pMonaco" ;
|
||||||
SInt16 fontSize = 12 ;
|
SInt16 fontSize = 12 ;
|
||||||
Style fontStyle = normal ;
|
Style fontStyle = normal ;
|
||||||
RGBColor color ;
|
RGBColor color ;
|
||||||
int attrCounter = 0 ;
|
int attrCounter = 0 ;
|
||||||
if ( style.HasFont() )
|
if ( style.HasFont() )
|
||||||
{
|
{
|
||||||
const wxFont &font = style.GetFont() ;
|
const wxFont &font = style.GetFont() ;
|
||||||
CopyCStringToPascal( font.GetFaceName().c_str() , fontName ) ;
|
CopyCStringToPascal( font.GetFaceName().c_str() , fontName ) ;
|
||||||
fontSize = font.GetPointSize() ;
|
fontSize = font.GetPointSize() ;
|
||||||
if ( font.GetUnderlined() )
|
if ( font.GetUnderlined() )
|
||||||
fontStyle |= underline ;
|
fontStyle |= underline ;
|
||||||
if ( font.GetWeight() == wxBOLD )
|
if ( font.GetWeight() == wxBOLD )
|
||||||
fontStyle |= bold ;
|
fontStyle |= bold ;
|
||||||
if ( font.GetStyle() == wxITALIC )
|
if ( font.GetStyle() == wxITALIC )
|
||||||
fontStyle |= italic ;
|
fontStyle |= italic ;
|
||||||
|
|
||||||
typeAttr[attrCounter].tag = kTXNQDFontNameAttribute ;
|
typeAttr[attrCounter].tag = kTXNQDFontNameAttribute ;
|
||||||
typeAttr[attrCounter].size = kTXNQDFontNameAttributeSize ;
|
typeAttr[attrCounter].size = kTXNQDFontNameAttributeSize ;
|
||||||
typeAttr[attrCounter].data.dataPtr = (void*) fontName ;
|
typeAttr[attrCounter].data.dataPtr = (void*) fontName ;
|
||||||
typeAttr[attrCounter+1].tag = kTXNQDFontSizeAttribute ;
|
typeAttr[attrCounter+1].tag = kTXNQDFontSizeAttribute ;
|
||||||
typeAttr[attrCounter+1].size = kTXNFontSizeAttributeSize ;
|
typeAttr[attrCounter+1].size = kTXNFontSizeAttributeSize ;
|
||||||
typeAttr[attrCounter+1].data.dataValue = (fontSize << 16) ;
|
typeAttr[attrCounter+1].data.dataValue = (fontSize << 16) ;
|
||||||
typeAttr[attrCounter+2].tag = kTXNQDFontStyleAttribute ;
|
typeAttr[attrCounter+2].tag = kTXNQDFontStyleAttribute ;
|
||||||
typeAttr[attrCounter+2].size = kTXNQDFontStyleAttributeSize ;
|
typeAttr[attrCounter+2].size = kTXNQDFontStyleAttributeSize ;
|
||||||
typeAttr[attrCounter+2].data.dataValue = fontStyle ;
|
typeAttr[attrCounter+2].data.dataValue = fontStyle ;
|
||||||
attrCounter += 3 ;
|
attrCounter += 3 ;
|
||||||
|
|
||||||
}
|
}
|
||||||
if ( style.HasTextColour() )
|
if ( style.HasTextColour() )
|
||||||
{
|
{
|
||||||
typeAttr[attrCounter].tag = kTXNQDFontColorAttribute ;
|
typeAttr[attrCounter].tag = kTXNQDFontColorAttribute ;
|
||||||
typeAttr[attrCounter].size = kTXNQDFontColorAttributeSize ;
|
typeAttr[attrCounter].size = kTXNQDFontColorAttributeSize ;
|
||||||
typeAttr[attrCounter].data.dataPtr = (void*) &color ;
|
typeAttr[attrCounter].data.dataPtr = (void*) &color ;
|
||||||
color = MAC_WXCOLORREF(style.GetTextColour().GetPixel()) ;
|
color = MAC_WXCOLORREF(style.GetTextColour().GetPixel()) ;
|
||||||
attrCounter += 1 ;
|
attrCounter += 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( attrCounter > 0 )
|
if ( attrCounter > 0 )
|
||||||
{
|
{
|
||||||
@@ -912,7 +912,7 @@ bool wxTextCtrl::SetStyle(long start, long end, const wxTextAttr& style)
|
|||||||
wxASSERT_MSG( status == noErr , "Couldn't set text attributes" ) ;
|
wxASSERT_MSG( status == noErr , "Couldn't set text attributes" ) ;
|
||||||
}
|
}
|
||||||
if ( !formerEditable )
|
if ( !formerEditable )
|
||||||
SetEditable(formerEditable) ;
|
SetEditable(formerEditable) ;
|
||||||
}
|
}
|
||||||
return TRUE ;
|
return TRUE ;
|
||||||
}
|
}
|
||||||
@@ -1055,9 +1055,9 @@ void wxTextCtrl::SetEditable(bool editable)
|
|||||||
if ( !m_macUsesTXN )
|
if ( !m_macUsesTXN )
|
||||||
{
|
{
|
||||||
if ( editable )
|
if ( editable )
|
||||||
UMAActivateControl( (ControlHandle) m_macControl ) ;
|
UMAActivateControl( (ControlHandle) m_macControl ) ;
|
||||||
else
|
else
|
||||||
UMADeactivateControl((ControlHandle) m_macControl ) ;
|
UMADeactivateControl((ControlHandle) m_macControl ) ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1128,13 +1128,13 @@ void wxTextCtrl::Replace(long from, long to, const wxString& value)
|
|||||||
{
|
{
|
||||||
bool formerEditable = IsEditable() ;
|
bool formerEditable = IsEditable() ;
|
||||||
if ( !formerEditable )
|
if ( !formerEditable )
|
||||||
SetEditable(true) ;
|
SetEditable(true) ;
|
||||||
TXNSetSelection( ((TXNObject) m_macTXN) , from , to ) ;
|
TXNSetSelection( ((TXNObject) m_macTXN) , from , to ) ;
|
||||||
TXNClear( ((TXNObject) m_macTXN) ) ;
|
TXNClear( ((TXNObject) m_macTXN) ) ;
|
||||||
TXNSetData( ((TXNObject) m_macTXN), kTXNTextData, (void*)value.c_str(), value.Length(),
|
TXNSetData( ((TXNObject) m_macTXN), kTXNTextData, (void*)value.c_str(), value.Length(),
|
||||||
kTXNUseCurrentSelection, kTXNUseCurrentSelection);
|
kTXNUseCurrentSelection, kTXNUseCurrentSelection);
|
||||||
if ( !formerEditable )
|
if ( !formerEditable )
|
||||||
SetEditable( formerEditable ) ;
|
SetEditable( formerEditable ) ;
|
||||||
}
|
}
|
||||||
Refresh() ;
|
Refresh() ;
|
||||||
}
|
}
|
||||||
@@ -1154,11 +1154,11 @@ void wxTextCtrl::Remove(long from, long to)
|
|||||||
{
|
{
|
||||||
bool formerEditable = IsEditable() ;
|
bool formerEditable = IsEditable() ;
|
||||||
if ( !formerEditable )
|
if ( !formerEditable )
|
||||||
SetEditable(true) ;
|
SetEditable(true) ;
|
||||||
TXNSetSelection( ((TXNObject) m_macTXN) , from , to ) ;
|
TXNSetSelection( ((TXNObject) m_macTXN) , from , to ) ;
|
||||||
TXNClear( ((TXNObject) m_macTXN) ) ;
|
TXNClear( ((TXNObject) m_macTXN) ) ;
|
||||||
if ( !formerEditable )
|
if ( !formerEditable )
|
||||||
SetEditable( formerEditable ) ;
|
SetEditable( formerEditable ) ;
|
||||||
}
|
}
|
||||||
Refresh() ;
|
Refresh() ;
|
||||||
}
|
}
|
||||||
@@ -1205,7 +1205,7 @@ void wxTextCtrl::WriteText(const wxString& text)
|
|||||||
if( wxApp::s_macDefaultEncodingIsPC )
|
if( wxApp::s_macDefaultEncodingIsPC )
|
||||||
{
|
{
|
||||||
value = wxMacMakeMacStringFromPC( text ) ;
|
value = wxMacMakeMacStringFromPC( text ) ;
|
||||||
value.Replace( "\n", "\r" );
|
value.Replace( "\n", "\r" );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
value = text ;
|
value = text ;
|
||||||
@@ -1218,15 +1218,15 @@ void wxTextCtrl::WriteText(const wxString& text)
|
|||||||
{
|
{
|
||||||
bool formerEditable = IsEditable() ;
|
bool formerEditable = IsEditable() ;
|
||||||
if ( !formerEditable )
|
if ( !formerEditable )
|
||||||
SetEditable(true) ;
|
SetEditable(true) ;
|
||||||
long start , end , dummy ;
|
long start , end , dummy ;
|
||||||
GetSelection( &start , &dummy ) ;
|
GetSelection( &start , &dummy ) ;
|
||||||
TXNSetData( ((TXNObject) m_macTXN), kTXNTextData, (void*) (const char*)value, value.Length(),
|
TXNSetData( ((TXNObject) m_macTXN), kTXNTextData, (void*) (const char*)value, value.Length(),
|
||||||
kTXNUseCurrentSelection, kTXNUseCurrentSelection);
|
kTXNUseCurrentSelection, kTXNUseCurrentSelection);
|
||||||
GetSelection( &dummy , &end ) ;
|
GetSelection( &dummy , &end ) ;
|
||||||
SetStyle( start , end , GetDefaultStyle() ) ;
|
SetStyle( start , end , GetDefaultStyle() ) ;
|
||||||
if ( !formerEditable )
|
if ( !formerEditable )
|
||||||
SetEditable( formerEditable ) ;
|
SetEditable( formerEditable ) ;
|
||||||
}
|
}
|
||||||
MacRedrawControl() ;
|
MacRedrawControl() ;
|
||||||
}
|
}
|
||||||
@@ -1542,9 +1542,9 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
|
|||||||
key == WXK_DELETE ||
|
key == WXK_DELETE ||
|
||||||
key == WXK_BACK)
|
key == WXK_BACK)
|
||||||
{
|
{
|
||||||
long t1 = 0xDEADBEEF ;
|
long t1 = 0xDEADBEEF ;
|
||||||
wxCommandEvent event1(wxEVT_COMMAND_TEXT_UPDATED, m_windowId);
|
wxCommandEvent event1(wxEVT_COMMAND_TEXT_UPDATED, m_windowId);
|
||||||
long t2 = 0xDEADBEEF ;
|
long t2 = 0xDEADBEEF ;
|
||||||
event1.SetString( GetValue() ) ;
|
event1.SetString( GetValue() ) ;
|
||||||
event1.SetEventObject( this );
|
event1.SetEventObject( this );
|
||||||
wxPostEvent(GetEventHandler(),event1);
|
wxPostEvent(GetEventHandler(),event1);
|
||||||
@@ -1572,10 +1572,7 @@ bool wxTextCtrl::Show(bool show)
|
|||||||
|
|
||||||
bool retval = wxControl::Show( show ) ;
|
bool retval = wxControl::Show( show ) ;
|
||||||
|
|
||||||
WindowRef window = (WindowRef) MacGetRootWindow() ;
|
if ( former != m_macControlIsShown && show )
|
||||||
wxWindowMac* win = wxFindWinFromMacWindow( window ) ;
|
|
||||||
|
|
||||||
if ( former != m_macControlIsShown && win!=NULL && !win->IsBeingDeleted() )
|
|
||||||
{
|
{
|
||||||
if ( m_macControlIsShown )
|
if ( m_macControlIsShown )
|
||||||
TXNSetFrameBounds( (TXNObject) m_macTXN, (**(STPTextPaneVars **)m_macTXNvars).fRTextArea.top, (**(STPTextPaneVars **)m_macTXNvars).fRTextArea.left,
|
TXNSetFrameBounds( (TXNObject) m_macTXN, (**(STPTextPaneVars **)m_macTXNvars).fRTextArea.top, (**(STPTextPaneVars **)m_macTXNvars).fRTextArea.left,
|
||||||
|
Reference in New Issue
Block a user