+
+ typeAttr[typeAttrCount].tag = kTXNQDFontColorAttribute ;
+ typeAttr[typeAttrCount].size = kTXNQDFontColorAttributeSize ;
+ typeAttr[typeAttrCount].data.dataPtr = (void*) &color ;
+ typeAttrCount++ ;
+ }
+
+ if ( style.HasAlignment() )
+ {
+ wxASSERT( controlAttrCount < WXSIZEOF(controlTags) );
+ SInt32 align;
+
+ switch ( style.GetAlignment() )
+ {
+ case wxTEXT_ALIGNMENT_LEFT:
+ align = kTXNFlushLeft;
+ break;
+ case wxTEXT_ALIGNMENT_CENTRE:
+ align = kTXNCenter;
+ break;
+ case wxTEXT_ALIGNMENT_RIGHT:
+ align = kTXNFlushRight;
+ break;
+ case wxTEXT_ALIGNMENT_JUSTIFIED:
+ align = kTXNFullJust;
+ break;
+ default :
+ case wxTEXT_ALIGNMENT_DEFAULT:
+ align = kTXNFlushDefault;
+ break;
+ }
+
+ controlTags[controlAttrCount] = kTXNJustificationTag ;
+ controlData[controlAttrCount].sValue = align ;
+ controlAttrCount++ ;
+ }
+
+ if ( style.HasLeftIndent() || style.HasRightIndent() )
+ {
+ wxASSERT( controlAttrCount < WXSIZEOF(controlTags) );
+ controlTags[controlAttrCount] = kTXNMarginsTag;
+ controlData[controlAttrCount].marginsPtr = &margins;
+ verify_noerr( TXNGetTXNObjectControls (m_txn, 1 ,
+ &controlTags[controlAttrCount], &controlData[controlAttrCount]) );
+ if ( style.HasLeftIndent() )
+ {
+ margins.leftMargin = style.GetLeftIndent() / 254.0 * 72 + 0.5;
+ }
+ if ( style.HasRightIndent() )
+ {
+ margins.rightMargin = style.GetRightIndent() / 254.0 * 72 + 0.5;
+ }
+ controlAttrCount++ ;
+ }
+
+ if ( style.HasTabs() )
+ {
+ const wxArrayInt& tabarray = style.GetTabs();
+ // unfortunately Mac only applies a tab distance, not individually different tabs
+ controlTags[controlAttrCount] = kTXNTabSettingsTag;
+ if ( tabarray.size() > 0 )
+ controlData[controlAttrCount].tabValue.value = tabarray[0] / 254.0 * 72 + 0.5;
+ else
+ controlData[controlAttrCount].tabValue.value = 72 ;
+
+ controlData[controlAttrCount].tabValue.tabType = kTXNLeftTab;
+ controlAttrCount++ ;
+ }
+
+ // unfortunately the relayout is not automatic
+ if ( controlAttrCount > 0 )
+ {
+ verify_noerr( TXNSetTXNObjectControls (m_txn, false /* don't clear all */, controlAttrCount,
+ controlTags, controlData) );
+ relayout = true;
+ }
+
+ if ( typeAttrCount > 0 )
+ {
+ verify_noerr( TXNSetTypeAttributes( m_txn , typeAttrCount, typeAttr, from , to ) );
+ relayout = true;
+ }
+
+ if ( tabs != NULL )
+ {
+ delete[] tabs;