+ m_txnVisBounds = visBounds ;
+ wxMacWindowClipper cl( textctrl ) ;
+
+#ifdef __WXMAC_OSX__
+ if ( m_sbHorizontal || m_sbVertical )
+ {
+ int w = bounds.right - bounds.left ;
+ int h = bounds.bottom - bounds.top ;
+
+ if ( m_sbHorizontal )
+ {
+ Rect sbBounds ;
+
+ sbBounds.left = -1 ;
+ sbBounds.top = h - 14 ;
+ sbBounds.right = w + 1 ;
+ sbBounds.bottom = h + 1 ;
+
+ SetControlBounds( m_sbHorizontal , &sbBounds ) ;
+ SetControlViewSize( m_sbHorizontal , w ) ;
+ }
+
+ if ( m_sbVertical )
+ {
+ Rect sbBounds ;
+
+ sbBounds.left = w - 14 ;
+ sbBounds.top = -1 ;
+ sbBounds.right = w + 1 ;
+ sbBounds.bottom = m_sbHorizontal ? h - 14 : h + 1 ;
+
+ SetControlBounds( m_sbVertical , &sbBounds ) ;
+ SetControlViewSize( m_sbVertical , h ) ;
+ }
+ }
+
+ Rect oldviewRect ;
+ TXNLongRect olddestRect ;
+ TXNGetRectBounds( m_txn , &oldviewRect , &olddestRect , NULL ) ;
+
+ Rect viewRect = { m_txnControlBounds.top, m_txnControlBounds.left,
+ m_txnControlBounds.bottom - ( m_sbHorizontal ? 14 : 0 ) ,
+ m_txnControlBounds.right - ( m_sbVertical ? 14 : 0 ) } ;
+ TXNLongRect destRect = { m_txnControlBounds.top, m_txnControlBounds.left,
+ m_txnControlBounds.bottom - ( m_sbHorizontal ? 14 : 0 ) ,
+ m_txnControlBounds.right - ( m_sbVertical ? 14 : 0 ) } ;
+
+ if ( olddestRect.right >= 10000 )
+ destRect.right = destRect.left + 32000 ;
+
+ if ( olddestRect.bottom >= 0x20000000 )
+ destRect.bottom = destRect.top + 0x40000000 ;
+
+ SectRect( &viewRect , &visBounds , &viewRect ) ;
+ TXNSetRectBounds( m_txn , &viewRect , &destRect , true ) ;
+
+#if 0
+ TXNSetFrameBounds(
+ m_txn,
+ m_txnControlBounds.top,
+ m_txnControlBounds.left,
+ m_txnControlBounds.bottom - (m_sbHorizontal ? 14 : 0),
+ m_txnControlBounds.right - (m_sbVertical ? 14 : 0),
+ m_txnFrameID );
+#endif
+#else
+
+ TXNSetFrameBounds(
+ m_txn, m_txnControlBounds.top, m_txnControlBounds.left,
+ wxMax( m_txnControlBounds.bottom, m_txnControlBounds.top ),
+ wxMax( m_txnControlBounds.right, m_txnControlBounds.left ), m_txnFrameID );
+#endif
+
+ // the SetFrameBounds method under Classic sometimes does not correctly scroll a selection into sight after a
+ // movement, therefore we have to force it
+
+ // this problem has been reported in OSX as well, so we use this here once again
+
+ TXNLongRect textRect ;
+ TXNGetRectBounds( m_txn , NULL , NULL , &textRect ) ;
+ if ( textRect.left < m_txnControlBounds.left )
+ TXNShowSelection( m_txn , kTXNShowStart ) ;