[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]
[XaraXtreme-commits] Commit Complete
Commit by : phil
Repository : xara
Revision : 1489
Date : Thu Jul 20 17:02:55 BST 2006
Changed paths:
M /Trunk/XaraLX/Kernel/nodetxtl.cpp
M /Trunk/XaraLX/Kernel/nodetxtl.h
MartinW's patch for ruler attribute caching issues
Diff:
Index: Trunk/XaraLX/Kernel/nodetxtl.cpp
===================================================================
--- Trunk/XaraLX/Kernel/nodetxtl.cpp (revision 1488)
+++ Trunk/XaraLX/Kernel/nodetxtl.cpp (revision 1489)
@@ -178,19 +178,19 @@
mJustification = JLEFT;
mLineSpacing = 0;
mLineSpaceRatio = 1;
+ mpRuler = new TxtRuler;
mPosInStory = 0;
}
-
+
/********************************************************************************************
> TextLine::TextLine()
Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xxxxxxxx>
Created: 21/12/94
Purpose: Simple TextLine constructor, it is required so that SimpleCopy will work.
- You should not normally call this constructor as it does not initialise
- the object.
+
********************************************************************************************/
TextLine::TextLine(): BaseTextClass() // Call the base class
@@ -198,6 +198,19 @@
Init();
}
+/********************************************************************************************
+> TextLine::~TextLine()
+
+ Author: Martin Wuerthner <xara@xxxxxxxxxxxxxxx>
+ Created: 20/07/06
+ Purpose: Destructor
+
+********************************************************************************************/
+
+TextLine::~TextLine()
+{
+ delete mpRuler;
+}
/********************************************************************************************
> TextLine::TextLine(Node* ContextNode, AttachNodeDirection Direction)
@@ -379,7 +392,7 @@
NodeCopy->mLeftMargin = mLeftMargin;
NodeCopy->mFirstIndent = mFirstIndent;
NodeCopy->mRightMargin = mRightMargin;
- NodeCopy->mpRuler = mpRuler;
+ *NodeCopy->mpRuler = *mpRuler;
NodeCopy->mPosInStory = mPosInStory;
}
@@ -714,6 +727,7 @@
BOOL TextLine::ReCacheMetrics(FormatRegion* pFormatRegion)
{
+ TRACEUSER("wuerthne", _T("TextLine::ReCacheMetrics"));
SetJustification( pFormatRegion->GetJustification());
SetLineSpacing( pFormatRegion->GetLineSpacing());
SetLineSpaceRatio(pFormatRegion->GetLineSpaceRatio());
@@ -722,6 +736,33 @@
SetParaFirstIndent(pFormatRegion->GetFirstIndent());
SetParaRightMargin(pFormatRegion->GetRightMargin());
SetRuler(pFormatRegion->GetRuler());
+#if defined(_DEBUG) && 0
+ String_256 TempStr;
+ String Str(_T(" "));
+ for (TxtTabStopIterator It = mpRuler->begin(); It != mpRuler->end(); ++It)
+ {
+ switch((*It).GetType())
+ {
+ case LeftTab:
+ TempStr._MakeMsg( TEXT("L(#1%ld)"), (*It).GetPosition());
+ Str += TempStr;
+ break;
+ case RightTab:
+ TempStr._MakeMsg( TEXT("R(#1%ld)"), (*It).GetPosition());
+ Str += TempStr;
+ break;
+ case CentreTab:
+ TempStr._MakeMsg( TEXT("C(#1%ld)"), (*It).GetPosition());
+ Str += TempStr;
+ break;
+ case DecimalTab:
+ TempStr._MakeMsg( TEXT("D(#1%ld)"), (*It).GetPosition());
+ Str += TempStr;
+ break;
+ }
+ }
+ TRACEUSER("wuerthne", _T("ruler at %08x:%s"), mpRuler, (TCHAR*)Str);
+#endif
return TRUE;
}
Index: Trunk/XaraLX/Kernel/nodetxtl.h
===================================================================
--- Trunk/XaraLX/Kernel/nodetxtl.h (revision 1488)
+++ Trunk/XaraLX/Kernel/nodetxtl.h (revision 1489)
@@ -288,7 +288,8 @@
CC_DECLARE_DYNAMIC(TextLine)
public:
- TextLine();
+ TextLine();
+ ~TextLine();
TextLine(Node* ContextNode, AttachNodeDirection Direction);
void Init();
@@ -378,7 +379,7 @@
void SetParaLeftMargin( MILLIPOINT Margin) { mLeftMargin = Margin; }
void SetParaFirstIndent(MILLIPOINT Indent) { mFirstIndent = Indent; }
void SetParaRightMargin(MILLIPOINT Margin) { mRightMargin = Margin; }
- void SetRuler( const TxtRuler* pRuler) { mpRuler = pRuler; }
+ void SetRuler( const TxtRuler* pRuler) { if (*mpRuler != *pRuler) *mpRuler = *pRuler; }
MILLIPOINT GetPosInStory() { return mPosInStory; }
void SetPosInStory(MILLIPOINT pos) { mPosInStory=pos; }
@@ -396,10 +397,8 @@
MILLIPOINT mLeftMargin; // cache for value read from attr stack
MILLIPOINT mFirstIndent; // cache for value read from attr stack
MILLIPOINT mRightMargin; // cache for value read from attr stack
- const TxtRuler* mpRuler; // cache for value read from attr stack
- // NB - this is a shared pointer to a list object owned by the attribute!
- // this only works because applying a different attribute will cause
- // our cached value to be updated
+ TxtRuler* mpRuler; // cache for value read from attr stack
+ // NB - this is a list object owned by this object
MILLIPOINT mPosInStory; // y position of base of line relative to story
};
Xara