+
+ // calculate the rectangles used by the control
+ UMAGetControlBoundsInWindowCoords( m_controlRef, &bounds );
+
+ m_txnControlBounds = bounds ;
+ m_txnVisBounds = bounds ;
+
+ CGrafPtr origPort ;
+ GDHandle origDev ;
+
+ GetGWorld( &origPort, &origDev ) ;
+ SetPort( m_txnPort );
+
+ // create the new edit field
+ TXNFrameOptions frameOptions = FrameOptionsFromWXStyle( m_windowStyle );
+
+ // the scrollbars are not correctly embedded but are inserted at the root:
+ // this gives us problems as we have erratic redraws even over the structure area
+
+ m_sbHorizontal = 0 ;
+ m_sbVertical = 0 ;
+ m_lastHorizontalValue = 0 ;
+ m_lastVerticalValue = 0 ;
+
+ Rect sb = { 0 , 0 , 0 , 0 } ;
+ if ( frameOptions & kTXNWantVScrollBarMask )
+ {
+ CreateScrollBarControl( m_txnWindow, &sb, 0, 0, 100, 1, true, gTXNScrollActionProc, &m_sbVertical );
+ SetControlReference( m_sbVertical, (SInt32)this );
+ SetControlAction( m_sbVertical, gTXNScrollActionProc );
+ ShowControl( m_sbVertical );
+ EmbedControl( m_sbVertical , m_controlRef );
+ frameOptions &= ~kTXNWantVScrollBarMask;
+ }
+
+ if ( frameOptions & kTXNWantHScrollBarMask )
+ {
+ CreateScrollBarControl( m_txnWindow, &sb, 0, 0, 100, 1, true, gTXNScrollActionProc, &m_sbHorizontal );
+ SetControlReference( m_sbHorizontal, (SInt32)this );
+ SetControlAction( m_sbHorizontal, gTXNScrollActionProc );
+ ShowControl( m_sbHorizontal );
+ EmbedControl( m_sbHorizontal, m_controlRef );
+ frameOptions &= ~(kTXNWantHScrollBarMask | kTXNDrawGrowIconMask);
+ }
+
+ err = TXNNewObject(
+ NULL, m_txnWindow, &bounds, frameOptions,
+ kTXNTextEditStyleFrameType, kTXNTextensionFile, kTXNSystemDefaultEncoding,
+ &m_txn, &m_txnFrameID, NULL );
+ verify_noerr( err );
+
+#if 0
+ TXNControlTag iControlTags[] = { kTXNUseCarbonEvents };
+ TXNControlData iControlData[] = { { (UInt32)&cInfo } };
+ int toptag = WXSIZEOF( iControlTags ) ;
+ TXNCarbonEventInfo cInfo ;
+ cInfo.useCarbonEvents = false ;
+ cInfo.filler = 0 ;
+ cInfo.flags = 0 ;
+ cInfo.fDictionary = NULL ;
+
+ verify_noerr( TXNSetTXNObjectControls( m_txn, false, toptag, iControlTags, iControlData ) );