@@ -42,29 +42,6 @@ along with LiveCode. If not see <http://www.gnu.org/licenses/>. */
4242
4343// //////////////////////////////////////////////////////////////////////////////
4444
45- static struct {const char *name; Properties prop; } kMCParagraphAttrsProps [] =
46- {
47- {" textAlign" , P_TEXT_ALIGN},
48- {" listStyle" , P_LIST_STYLE},
49- {" listDepth" , P_LIST_DEPTH},
50- {" listIndent" , P_LIST_INDENT},
51- {" firstIndent" , P_FIRST_INDENT},
52- {" leftIndent" , P_LEFT_INDENT},
53- {" rightIndent" , P_RIGHT_INDENT},
54- {" spaceAbove" , P_SPACE_ABOVE},
55- {" spaceBelow" , P_SPACE_BELOW},
56- {" tabStops" , P_TAB_STOPS},
57- {" backgroundColor" , P_BACK_COLOR},
58- {" borderWidth" , P_BORDER_WIDTH},
59- {" borderColor" , P_BORDER_COLOR},
60- {" hGrid" , P_HGRID},
61- {" vGrid" , P_VGRID},
62- {" dontWrap" , P_DONT_WRAP},
63- {" padding" , P_PADDING},
64- {" listIndex" , P_LIST_INDEX},
65- {nil, P_UNDEFINED},
66- };
67-
6845bool MCParagraph::hasattrs (void )
6946{
7047 return attrs != nil;
@@ -138,6 +115,20 @@ void MCParagraph::fetchattrs(MCArrayRef src)
138115 MCValueRelease (t_stringref_value);
139116 }
140117
118+ if (ctxt . CopyElementAsString (src, MCNAME (" tabAlign" ), false , t_stringref_value))
119+ {
120+ MCInterfaceFieldTabAlignments t_alignments;
121+ MCMemoryClear (t_alignments);
122+
123+ if (MCField::parsetabalignments (t_stringref_value, t_alignments.m_alignments , t_alignments.m_count ))
124+ {
125+ SetTabAlignments (ctxt, t_alignments);
126+ MCMemoryDeallocate (t_alignments.m_alignments );
127+ }
128+
129+ MCValueRelease (t_stringref_value);
130+ }
131+
141132 if (ctxt . CopyElementAsString (src, MCNAME (" backgroundColor" ), false , t_stringref_value))
142133 {
143134 MCInterfaceNamedColorParse (ctxt, t_stringref_value, t_color);
@@ -512,6 +503,12 @@ void MCParagraph::copyattrs(const MCParagraph& other)
512503 memcpy (attrs -> tabs, other . attrs -> tabs, sizeof (uint16_t ) * other . attrs -> tab_count);
513504 }
514505
506+ // If the struct has tabalignments then copy them properly
507+ if ((other . attrs -> flags & PA_HAS_TAB_ALIGNMENTS) != 0 )
508+ {
509+ /* UNCHECKED */ MCMemoryAllocateCopy (other . attrs -> alignments, sizeof (intenum_t ) * other . attrs -> alignments_count, attrs -> alignments);
510+ }
511+
515512 // MW-2012-12-04: [[ Bug 10577 ]] If the struct has metadata, then copy it properly.
516513 if ((other . attrs -> flags & PA_HAS_METADATA) != 0 )
517514 /* UNCHECKED */ MCStringCopy (other . attrs -> metadata, attrs -> metadata);
@@ -527,6 +524,10 @@ void MCParagraph::clearattrs(void)
527524 if ((attrs -> flags & PA_HAS_TABS) != 0 )
528525 delete attrs -> tabs;
529526
527+ // If we have tab alignments then delete them.
528+ if ((attrs -> flags & PA_HAS_TAB_ALIGNMENTS) != 0 )
529+ MCMemoryDeallocate (attrs -> alignments);
530+
530531 // MW-2012-11-13: [[ ParaMetadata ]] If we have metadata, delete it.
531532 if ((attrs -> flags & PA_HAS_METADATA) != 0 )
532533 MCValueRelease (attrs -> metadata);
@@ -587,6 +588,12 @@ void MCParagraph::exportattrs(MCFieldParagraphStyle& x_style)
587588 x_style . tabs = attrs -> tabs;
588589 x_style . tab_count = attrs -> tab_count;
589590 }
591+ if ((attrs -> flags & PA_HAS_TAB_ALIGNMENTS) != 0 )
592+ {
593+ x_style . has_tab_alignments = true ;
594+ x_style . tab_alignments = attrs -> alignments;
595+ x_style . tab_alignment_count = attrs -> alignments_count;
596+ }
590597 if ((attrs -> flags & PA_HAS_BACKGROUND_COLOR) != 0 )
591598 {
592599 x_style . has_background_color = true ;
@@ -696,6 +703,12 @@ void MCParagraph::importattrs(const MCFieldParagraphStyle& p_style)
696703 attrs -> tabs = new uint16_t [p_style . tab_count];
697704 memcpy (attrs -> tabs, p_style . tabs, sizeof (uint16_t ) * p_style . tab_count);
698705 }
706+ if (p_style . has_tab_alignments)
707+ {
708+ attrs -> flags |= PA_HAS_TAB_ALIGNMENTS;
709+ attrs -> alignments_count = p_style . tab_alignment_count;
710+ /* UNCHECKED */ MCMemoryAllocateCopy (p_style . tab_alignments, sizeof (intenum_t ) * p_style . tab_alignment_count, attrs -> alignments);
711+ }
699712 if (p_style . has_background_color)
700713 {
701714 attrs -> flags |= PA_HAS_BACKGROUND_COLOR;
0 commit comments