cleanup - reformat (part 2)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36689 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Surovell
2006-01-05 00:43:32 +00:00
parent 53758b0fc1
commit 0207e9693c

View File

@@ -953,8 +953,7 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
}
// this will make wxWidgets eat the ENTER key so that
// we actually prevent line wrapping in a single line
// text control
// we actually prevent line wrapping in a single line text control
eat_key = true;
}
break;
@@ -994,8 +993,7 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
if ( wxMacConvertEventToRecord( (EventRef) wxTheApp->MacGetCurrentEvent() , &rec ) )
{
EventRecord *ev = &rec ;
short keycode ;
short keychar ;
short keycode, keychar ;
keychar = short(ev->message & charCodeMask);
keycode = short(ev->message & keyCodeMask) >> 8 ;
@@ -1451,8 +1449,10 @@ void wxMacUnicodeTextControl::GetSelection( long* from, long* to) const
{
ControlEditTextSelectionRec sel ;
verify_noerr( GetData<ControlEditTextSelectionRec>( 0, kControlEditTextSelectionTag, &sel ) ) ;
if ( from ) *from = sel.selStart ;
if ( to ) *to = sel.selEnd ;
if ( from )
*from = sel.selStart ;
if ( to )
*to = sel.selEnd ;
}
void wxMacUnicodeTextControl::SetSelection( long from , long to )
@@ -1473,6 +1473,7 @@ void wxMacUnicodeTextControl::WriteText(const wxString& str)
{
wxString st = str ;
wxMacConvertNewlines10To13( &st ) ;
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
wxMacCFStringHolder cf(st , m_font.GetEncoding() ) ;
CFStringRef value = cf ;
@@ -1578,8 +1579,9 @@ wxString wxMacMLTEControl::GetStringValue() const
#else
Handle theText ;
err = TXNGetDataEncoded( m_txn , kTXNStartOffset, kTXNEndOffset, &theText , kTXNTextData );
// all done
if ( err )
if ( err != noErr )
{
actualSize = 0 ;
}
@@ -1614,10 +1616,12 @@ void wxMacMLTEControl::SetStringValue( const wxString &str)
wxMacConvertNewlines10To13( &st ) ;
{
wxMacWindowClipper c( m_peer ) ;
{
wxMacEditHelper help(m_txn) ;
SetTXNData( st , kTXNStartOffset, kTXNEndOffset ) ;
}
TXNSetSelection( m_txn, 0, 0 );
TXNShowSelection( m_txn, kTXNShowStart );
}
@@ -1683,8 +1687,8 @@ void wxMacMLTEControl::AdjustCreationAttributes( const wxColour &background, boo
else
iControlData[1].uValue = kTXNAutoWrap ;
}
verify_noerr( TXNSetTXNObjectControls( m_txn, false, toptag,
iControlTags, iControlData )) ;
verify_noerr( TXNSetTXNObjectControls( m_txn, false, toptag, iControlTags, iControlData )) ;
// setting the default font:
// under 10.2 this causes a visible caret, therefore we avoid it
@@ -1744,6 +1748,7 @@ void wxMacMLTEControl::SetBackground( const wxBrush &brush )
{
// currently only solid background are supported
TXNBackground tback;
tback.bgType = kTXNBackgroundTypeRGB;
tback.bg.color = MAC_WXCOLORREF( brush.GetColour().GetPixel() );
TXNSetBackground( m_txn , &tback );
@@ -1756,7 +1761,7 @@ void wxMacMLTEControl::TXNSetAttribute( const wxTextAttr& style , long from , lo
SInt16 fontSize = 12 ;
Style fontStyle = normal ;
RGBColor color ;
int attrCounter = 0 ;
int attrCount = 0 ;
if ( style.HasFont() )
{
@@ -1770,30 +1775,35 @@ void wxMacMLTEControl::TXNSetAttribute( const wxTextAttr& style , long from , lo
if ( font.GetStyle() == wxITALIC )
fontStyle |= italic ;
typeAttr[attrCounter].tag = kTXNQDFontNameAttribute ;
typeAttr[attrCounter].size = kTXNQDFontNameAttributeSize ;
typeAttr[attrCounter].data.dataPtr = (void*) fontName ;
typeAttr[attrCounter+1].tag = kTXNQDFontSizeAttribute ;
typeAttr[attrCounter+1].size = kTXNFontSizeAttributeSize ;
typeAttr[attrCounter+1].data.dataValue = (fontSize << 16) ;
typeAttr[attrCounter+2].tag = kTXNQDFontStyleAttribute ;
typeAttr[attrCounter+2].size = kTXNQDFontStyleAttributeSize ;
typeAttr[attrCounter+2].data.dataValue = fontStyle ;
attrCounter += 3 ;
typeAttr[attrCount].tag = kTXNQDFontNameAttribute ;
typeAttr[attrCount].size = kTXNQDFontNameAttributeSize ;
typeAttr[attrCount].data.dataPtr = (void*)fontName ;
attrCount++ ;
typeAttr[attrCount].tag = kTXNQDFontSizeAttribute ;
typeAttr[attrCount].size = kTXNFontSizeAttributeSize ;
typeAttr[attrCount].data.dataValue = (fontSize << 16) ;
attrCount++ ;
typeAttr[attrCount].tag = kTXNQDFontStyleAttribute ;
typeAttr[attrCount].size = kTXNQDFontStyleAttributeSize ;
typeAttr[attrCount].data.dataValue = fontStyle ;
attrCount++ ;
}
if ( style.HasTextColour() )
{
typeAttr[attrCounter].tag = kTXNQDFontColorAttribute ;
typeAttr[attrCounter].size = kTXNQDFontColorAttributeSize ;
typeAttr[attrCounter].data.dataPtr = (void*) &color ;
color = MAC_WXCOLORREF(style.GetTextColour().GetPixel()) ;
attrCounter += 1 ;
typeAttr[attrCount].tag = kTXNQDFontColorAttribute ;
typeAttr[attrCount].size = kTXNQDFontColorAttributeSize ;
typeAttr[attrCount].data.dataPtr = (void*) &color ;
attrCount++ ;
}
if ( attrCounter > 0 )
if ( attrCount > 0 )
{
verify_noerr( TXNSetTypeAttributes ( m_txn , attrCounter , typeAttr, from , to) );
verify_noerr( TXNSetTypeAttributes( m_txn , attrCount , typeAttr, from , to ) );
}
}
@@ -1897,6 +1907,7 @@ void wxMacMLTEControl::SetSelection( long from , long to )
TXNSelectAll( m_txn );
else
TXNSetSelection( m_txn, from, to );
TXNShowSelection( m_txn, kTXNShowStart );
}
@@ -1906,8 +1917,10 @@ void wxMacMLTEControl::WriteText(const wxString& str)
wxMacConvertNewlines10To13( &st ) ;
long start , end , dummy ;
GetSelection( &start , &dummy ) ;
wxMacWindowClipper c( m_peer ) ;
{
wxMacEditHelper helper( m_txn ) ;
SetTXNData( st , kTXNUseCurrentSelection, kTXNUseCurrentSelection ) ;
@@ -1981,6 +1994,7 @@ long wxMacMLTEControl::XYToPosition(long x, long y) const
xpos = 0 ;
if ( n > 0 )
++ypos ;
lastHeight = curpt.v ;
}
else
@@ -2003,15 +2017,14 @@ bool wxMacMLTEControl::PositionToXY(long pos, long *x, long *y) const
lastpos = GetLastPosition() ;
if ( pos <= lastpos )
{
// TODO find a better implementation : while we can get the
// TODO: find a better implementation : while we can get the
// line metrics of a certain line, we don't get its starting
// position, so it would probably be rather a binary search
// for the start position
long xpos = 0 ;
long ypos = 0 ;
long xpos = 0, ypos = 0 ;
int lastHeight = 0 ;
ItemCount n ;
for ( n = 0 ; n <= (ItemCount) pos ; ++n )
{
TXNOffsetToPoint(m_txn , n , &curpt);
@@ -2021,6 +2034,7 @@ bool wxMacMLTEControl::PositionToXY(long pos, long *x, long *y) const
xpos = 0 ;
if ( n > 0 )
++ypos ;
lastHeight = curpt.v ;
}
else
@@ -2162,7 +2176,6 @@ int wxMacMLTEControl::GetLineLength(long lineNo) const
return theLength ;
}
// ----------------------------------------------------------------------------
// MLTE control implementation (classic part)
// ----------------------------------------------------------------------------
@@ -2269,7 +2282,8 @@ pascal void wxMacMLTEClassicControl::TXNScrollActionProc( ControlRef controlRef
SInt32 verticalDelta = isHorizontal ? 0 : delta ;
SInt32 horizontalDelta = isHorizontal ? delta : 0 ;
err = TXNScroll( mlte->m_txn , kTXNScrollUnitsInPixels, kTXNScrollUnitsInPixels,
err = TXNScroll(
mlte->m_txn, kTXNScrollUnitsInPixels, kTXNScrollUnitsInPixels,
&verticalDelta, &horizontalDelta );
if ( isHorizontal )
@@ -2320,9 +2334,8 @@ void wxMacMLTEClassicControl::MacSetObjectVisibility(bool vis)
verify_noerr( TXNSetTXNObjectControls( m_txn, false , 1, iControlTags, iControlData ) ) ;
}
// we right now are always clipping as partial visibility (overlapped) visibility
// is also a problem, if we run into further problems we might set the FrameBounds to an empty
// rect here
// currently, we always clip as partial visibility (overlapped) visibility is also a problem,
// if we run into further problems we might set the FrameBounds to an empty rect here
}
// make sure that the TXNObject is at the right position
@@ -2371,6 +2384,7 @@ void wxMacMLTEClassicControl::MacUpdatePosition()
SetControlBounds( m_sbHorizontal , &sbBounds ) ;
SetControlViewSize( m_sbHorizontal , w ) ;
}
if ( m_sbVertical )
{
Rect sbBounds ;
@@ -2592,8 +2606,8 @@ wxInt16 wxMacMLTEClassicControl::MacControlUserPaneFocusProc(wxInt16 action)
{
case kControlFocusPrevPart:
case kControlFocusNextPart:
MacFocusPaneText( ( !wasFocused));
focusResult = (!wasFocused) ? (ControlPartCode) kControlEditTextPart : (ControlPartCode) kControlFocusNoPart;
MacFocusPaneText( !wasFocused );
focusResult = (!wasFocused ? (ControlPartCode) kControlEditTextPart : (ControlPartCode) kControlFocusNoPart);
break;
case kControlFocusNoPart:
@@ -2621,11 +2635,16 @@ wxMacMLTEClassicControl::wxMacMLTEClassicControl( wxTextCtrl *wxPeer,
short featureSet;
featureSet = kControlSupportsEmbedding | kControlSupportsFocus | kControlWantsIdle
| kControlWantsActivate | kControlHandlesTracking // | kControlHasSpecialBackground
featureSet =
kControlSupportsEmbedding | kControlSupportsFocus | kControlWantsIdle
| kControlWantsActivate | kControlHandlesTracking
// | kControlHasSpecialBackground
| kControlGetsFocusOnClick | kControlSupportsLiveFeedback;
verify_noerr( ::CreateUserPaneControl( MAC_WXHWND(wxPeer->GetParent()->MacGetTopLevelWindowRef()), &bounds, featureSet, &m_controlRef ) );
verify_noerr(
::CreateUserPaneControl(
MAC_WXHWND(wxPeer->GetParent()->MacGetTopLevelWindowRef()),
&bounds, featureSet, &m_controlRef ) );
DoCreate();
@@ -2884,8 +2903,10 @@ wxMacMLTEHIViewControl::wxMacMLTEHIViewControl( wxTextCtrl *wxPeer,
TXNFrameOptions frameOptions = FrameOptionsFromWXStyle( style ) ;
if ( frameOptions & (kTXNWantVScrollBarMask | kTXNWantHScrollBarMask) )
{
HIScrollViewCreate(( frameOptions & kTXNWantHScrollBarMask ? kHIScrollViewOptionsHorizScroll : 0) |
( frameOptions & kTXNWantVScrollBarMask ? kHIScrollViewOptionsVertScroll: 0 ) , &m_scrollView ) ;
HIScrollViewCreate(
(frameOptions & kTXNWantHScrollBarMask ? kHIScrollViewOptionsHorizScroll : 0)
| (frameOptions & kTXNWantVScrollBarMask ? kHIScrollViewOptionsVertScroll : 0) ,
&m_scrollView ) ;
HIViewSetFrame( m_scrollView, &hr );
HIViewSetVisible( m_scrollView, true );